109 mock_rom_data_[0x01772E] = 0x04;
110 mock_rom_data_[0x140145] = 0xFF;
112 auto status = overworld_->Load(rom_.get());
113 ASSERT_TRUE(status.ok());
116 mock_rom_data_[0x01772E] = 0x05;
117 overworld_ = std::make_unique<Overworld>(rom_.get());
119 status = overworld_->Load(rom_.get());
120 ASSERT_TRUE(status.ok());
125 mock_rom_data_[0x017D28] = 0x0F;
126 mock_rom_data_[0x140145] = 0xFF;
128 auto status = overworld_->Load(rom_.get());
129 ASSERT_TRUE(status.ok());
132 mock_rom_data_[0x017D28] = 0x10;
133 overworld_ = std::make_unique<Overworld>(rom_.get());
135 status = overworld_->Load(rom_.get());
136 ASSERT_TRUE(status.ok());
141 auto status = overworld_->Load(rom_.get());
142 ASSERT_TRUE(status.ok());
144 const auto& entrances = overworld_->entrances();
145 EXPECT_EQ(entrances.size(), 129);
154 for (
int i = 0; i < std::min(10, static_cast<int>(entrances.size())); i++) {
155 const auto& entrance = entrances[i];
157 uint16_t map_pos = i * 16;
160 int position = map_pos >> 1;
161 int x_coord = position % 64;
162 int y_coord = position >> 6;
163 int expected_x = (x_coord * 16) + (((map_id % 64) - (((map_id % 64) / 8) * 8)) * 512);
164 int expected_y = (y_coord * 16) + (((map_id % 64) / 8) * 512);
166 EXPECT_EQ(entrance.x_, expected_x);
167 EXPECT_EQ(entrance.y_, expected_y);
168 EXPECT_EQ(entrance.entrance_id_, i);
169 EXPECT_FALSE(entrance.is_hole_);
175 auto status = overworld_->Load(rom_.get());
176 ASSERT_TRUE(status.ok());
178 const auto& exits = overworld_->exits();
179 EXPECT_EQ(exits->size(), 0x4F);
182 for (
int i = 0; i < std::min(5, static_cast<int>(exits->size())); i++) {
183 const auto& exit = exits->at(i);
193 mock_rom_data_[0x140145] = 0xFF;
194 overworld_ = std::make_unique<Overworld>(rom_.get());
196 auto status = overworld_->Load(rom_.get());
197 ASSERT_TRUE(status.ok());
199 const auto& items = overworld_->all_items();
202 mock_rom_data_[0x140145] = 0x03;
203 overworld_ = std::make_unique<Overworld>(rom_.get());
205 status = overworld_->Load(rom_.get());
206 ASSERT_TRUE(status.ok());
208 const auto& items_v3 = overworld_->all_items();
210 EXPECT_GE(items_v3.size(), items.size());
215 auto status = overworld_->Load(rom_.get());
216 ASSERT_TRUE(status.ok());
218 const auto& maps = overworld_->overworld_maps();
219 EXPECT_EQ(maps.size(), 160);
222 for (
const auto& map : maps) {
230 if (!use_real_rom_) {
231 GTEST_SKIP() <<
"Real ROM required for ZSCustomOverworld version testing";
234 auto status = overworld_->Load(rom_.get());
235 ASSERT_TRUE(status.ok());
238 auto version_byte = rom_->ReadByte(0x140145);
239 ASSERT_TRUE(version_byte.ok());
241 uint8_t asm_version = *version_byte;
243 if (asm_version == 0xFF) {
245 EXPECT_FALSE(overworld_->expanded_tile16());
246 EXPECT_FALSE(overworld_->expanded_tile32());
247 }
else if (asm_version >= 0x02 && asm_version <= 0x03) {
250 EXPECT_TRUE(overworld_->expanded_tile16());
251 EXPECT_TRUE(overworld_->expanded_tile32());
255 if (asm_version >= 0x03) {
257 const auto& maps = overworld_->overworld_maps();
258 EXPECT_EQ(maps.size(), 160);
264 if (!use_real_rom_) {
265 GTEST_SKIP() <<
"Real ROM required for RomDependentTestSuite compatibility testing";
269 auto status = overworld_->Load(rom_.get());
270 ASSERT_TRUE(status.ok());
273 EXPECT_TRUE(overworld_->is_loaded());
275 const auto& maps = overworld_->overworld_maps();
276 EXPECT_EQ(maps.size(), 160);
279 for (
int i = 0; i < std::min(10, static_cast<int>(maps.size())); i++) {
280 const auto& map = maps[i];
283 EXPECT_GE(map.area_graphics(), 0);
284 EXPECT_GE(map.main_palette(), 0);
290 const auto& sprites = overworld_->sprites(0);
291 EXPECT_EQ(sprites.size(), 3);
294 const auto& items = overworld_->all_items();
295 EXPECT_GE(items.size(), 0);
298 const auto& entrances = overworld_->entrances();
299 const auto& exits = overworld_->exits();
300 EXPECT_EQ(entrances.size(), 129);
301 EXPECT_EQ(exits->size(), 0x4F);
306 auto status = overworld_->Load(rom_.get());
307 ASSERT_TRUE(status.ok());
310 EXPECT_GT(overworld_->tiles16().size(), 0);
311 EXPECT_GT(overworld_->tiles32_unique().size(), 0);
314 const auto& map_tiles = overworld_->map_tiles();
315 EXPECT_EQ(map_tiles.light_world.size(), 512);
316 EXPECT_EQ(map_tiles.dark_world.size(), 512);
317 EXPECT_EQ(map_tiles.special_world.size(), 512);
320 for (
const auto& row : map_tiles.light_world) {
321 EXPECT_EQ(row.size(), 512);
323 for (
const auto& row : map_tiles.dark_world) {
324 EXPECT_EQ(row.size(), 512);
326 for (
const auto& row : map_tiles.special_world) {
327 EXPECT_EQ(row.size(), 512);
331 const auto& maps = overworld_->overworld_maps();
332 EXPECT_EQ(maps.size(), 160);
334 for (
const auto& map : maps) {
340 const auto& tile_types = overworld_->all_tiles_types();
341 EXPECT_EQ(tile_types.size(), 0x200);
346 auto status = overworld_->Load(rom_.get());
347 ASSERT_TRUE(status.ok());
349 const auto& entrances = overworld_->entrances();
350 EXPECT_EQ(entrances.size(), 129);
353 for (
int i = 0; i < std::min(10, static_cast<int>(entrances.size())); i++) {
354 const auto& entrance = entrances[i];
363 uint16_t map_pos = entrance.map_pos_;
364 uint16_t map_id = entrance.map_id_;
366 int position = map_pos >> 1;
367 int x_coord = position % 64;
368 int y_coord = position >> 6;
369 int expected_x = (x_coord * 16) + (((map_id % 64) - (((map_id % 64) / 8) * 8)) * 512);
370 int expected_y = (y_coord * 16) + (((map_id % 64) / 8) * 512);
372 EXPECT_EQ(entrance.x_, expected_x);
373 EXPECT_EQ(entrance.y_, expected_y);
377 const auto& holes = overworld_->holes();
378 EXPECT_EQ(holes.size(), 0x13);
380 for (
int i = 0; i < std::min(5, static_cast<int>(holes.size())); i++) {
381 const auto& hole = holes[i];
390 uint16_t map_pos = hole.map_pos_;
391 uint16_t map_id = hole.map_id_;
393 int position = map_pos >> 1;
394 int x_coord = position % 64;
395 int y_coord = position >> 6;
396 int expected_x = (x_coord * 16) + (((map_id % 64) - (((map_id % 64) / 8) * 8)) * 512);
397 int expected_y = (y_coord * 16) + (((map_id % 64) / 8) * 512);
399 EXPECT_EQ(hole.x_, expected_x);
400 EXPECT_EQ(hole.y_, expected_y);
401 EXPECT_TRUE(hole.is_hole_);