Poke_Transporter_GB/include/payload_file_reader.h
2025-07-18 13:38:38 +02:00

29 lines
856 B
C++

#ifndef _PAYLOAD_FILE_READER_H
#define _PAYLOAD_FILE_READER_H
#include <cstdint>
/**
* This class can read gameboy payloads from the files that were generated by payload_file_writer in
* the data-generator subproject.
*
* The format stores the base payload metadata alongside the base payload first, and then stores
* other payload metadata alongside binary patches to convert the base payload into that payload.
*
* This way we avoid storing redundancy in the data.
*
* Anyway, this class can extract the desired payload from that file format.
*/
class payload_file_reader
{
public:
payload_file_reader(const uint8_t *file_buffer, uint16_t buffer_size);
bool read_payload(uint8_t *buffer, uint8_t language, uint8_t game_variant);
protected:
private:
const uint8_t *file_buffer_;
const uint8_t *file_buffer_end_;
};
#endif