You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.2 KiB
47 lines
1.2 KiB
|
|
#include <stddef.h> |
|
#include <iostream> |
|
|
|
#include "Types.h" |
|
|
|
enum ChecksumMode { |
|
ChecksumAdler32, |
|
ChecksumCrc32 |
|
}; |
|
|
|
class SetupLoader { |
|
|
|
public: |
|
|
|
struct Offsets { |
|
|
|
size_t totalSize; //!< Minimum expected size of the setup file |
|
|
|
size_t exeOffset; //!< Offset of compressed setup.e32 |
|
size_t exeCompressedSize; //!< Size of setup.e32 after compression |
|
size_t exeUncompressedSize; //!< Size of setup.e32 before compression |
|
s32 exeChecksum; //!< Checksum of setup.e32 before compression |
|
ChecksumMode exeChecksumMode; //! Type of the checksum in exeChecksum |
|
|
|
size_t messageOffset; // TODO document |
|
|
|
size_t offset0; //!< Offset of embedded setup-0.bin data |
|
size_t offset1; //!< Offset of embedded setup-1.bin data, or 0 when DiskSpanning=yes |
|
|
|
}; |
|
|
|
/*! |
|
* Try to find the setup loader offsets in the given file. |
|
* @return true if the offsets were found, false otherwise |
|
*/ |
|
static bool getOffsets(std::istream & is, Offsets & offsets); |
|
|
|
private: |
|
|
|
static bool getOldOffsets(std::istream & is, Offsets & offsets); |
|
|
|
static bool getNewOffsets(std::istream & is, Offsets & offsets); |
|
|
|
static bool getOffsetsAt(std::istream & is, Offsets & offsets, size_t pos); |
|
|
|
};
|
|
|