diff --git a/src/app/viewer/cgx_viewer.cc b/src/app/viewer/cgx_viewer.cc index e91bbc37..021d08bf 100644 --- a/src/app/viewer/cgx_viewer.cc +++ b/src/app/viewer/cgx_viewer.cc @@ -13,12 +13,13 @@ namespace yaze { namespace app { namespace viewer { +constexpr int kMatchedBytes[] = {0x4E, 0x41, 0x4B, 0x31, 0x39, 0x38, 0x39}; + void CgxViewer::LoadCgx(ROM &cgx_rom) { std::cout << "Loading CGX" << std::endl; raw_data_.malloc(0x40000); all_tiles_data_.malloc(0x40000); - std::vector matched_bytes; int matching_position = -1; bool matched = false; for (int i = 0; i < cgx_rom.size(); i++) { @@ -27,9 +28,9 @@ void CgxViewer::LoadCgx(ROM &cgx_rom) { } raw_data_[i] = cgx_rom[i]; - for (int j = 0; j < matched_bytes.size(); j++) { - if (cgx_rom[i + j] == matched_bytes[j]) { - if (j == matched_bytes.size() - 1) { + for (int j = 0; j < 7; j++) { + if (cgx_rom[i + j] == kMatchedBytes[j]) { + if (j == 7 - 1) { matching_position = i; matched = true; break; diff --git a/src/app/zelda3/overworld.cc b/src/app/zelda3/overworld.cc index 9758581c..c6f83f3a 100644 --- a/src/app/zelda3/overworld.cc +++ b/src/app/zelda3/overworld.cc @@ -65,7 +65,7 @@ absl::Status Overworld::Load(ROM &rom) { } } - LoadSprites(); + // LoadSprites(); is_loaded_ = true; return absl::OkStatus(); @@ -280,13 +280,13 @@ void Overworld::SaveMap16Tiles() { int tpos = core::map16Tiles; // 3760 for (int i = 0; i < core::NumberOfMap16; i += 1) { - rom_.WriteShort(tpos, tiles16[i].tile0_.ToShort()); + rom_.WriteShort(tpos, TileInfoToShort(tiles16[i].tile0_)); tpos += 2; - rom_.WriteShort(tpos, tiles16[i].tile1_.ToShort()); + rom_.WriteShort(tpos, TileInfoToShort(tiles16[i].tile1_)); tpos += 2; - rom_.WriteShort(tpos, tiles16[i].tile2_.ToShort()); + rom_.WriteShort(tpos, TileInfoToShort(tiles16[i].tile2_)); tpos += 2; - rom_.WriteShort(tpos, tiles16[i].tile3_.ToShort()); + rom_.WriteShort(tpos, TileInfoToShort(tiles16[i].tile3_)); tpos += 2; } }