Add FindMetastamp, etc housekeeping
This commit is contained in:
@@ -15,6 +15,31 @@ namespace yaze {
|
||||
namespace app {
|
||||
namespace gfx {
|
||||
|
||||
void FindMetastamp() {
|
||||
int matching_position = -1;
|
||||
bool matched = false;
|
||||
Bytes cgx_rom;
|
||||
Bytes raw_data_;
|
||||
for (int i = 0;
|
||||
i < cgx_rom.size() - sizeof(kMatchedBytes) - kOffsetFromMatchedBytesEnd;
|
||||
i++) {
|
||||
raw_data_.push_back(cgx_rom[i]);
|
||||
bool is_match = std::equal(std::begin(kMatchedBytes),
|
||||
std::end(kMatchedBytes), &cgx_rom[i]);
|
||||
if (is_match) {
|
||||
matching_position = i;
|
||||
matched = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (matched) {
|
||||
int bpp_marker_position =
|
||||
matching_position + sizeof(kMatchedBytes) + kOffsetFromMatchedBytesEnd;
|
||||
int bpp_marker = cgx_rom[bpp_marker_position];
|
||||
std::string bpp_type = (bpp_marker == 0x31) ? "8bpp" : "4bpp";
|
||||
}
|
||||
}
|
||||
|
||||
absl::Status LoadCgx(uint8_t bpp, std::string_view filename,
|
||||
std::vector<uint8_t>& cgx_data,
|
||||
std::vector<uint8_t>& cgx_loaded,
|
||||
|
||||
@@ -46,6 +46,11 @@ struct CgxHeader {
|
||||
uint8_t color_path[0x100];
|
||||
};
|
||||
|
||||
constexpr uint16_t kMatchedBytes[] = {0x4E, 0x41, 0x4B, 0x31, 0x39, 0x38, 0x39};
|
||||
constexpr uint16_t kOffsetFromMatchedBytesEnd = 0x1D;
|
||||
|
||||
void FindMetastamp();
|
||||
|
||||
absl::Status LoadScr(std::string_view filename, uint8_t input_value,
|
||||
std::vector<uint8_t>& map_data);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user