yaze 0.2.0
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
rom.h
Go to the documentation of this file.
1#ifndef YAZE_APP_ROM_H
2#define YAZE_APP_ROM_H
3
4#include <SDL.h>
5
6#include <cstddef>
7#include <cstdint>
8#include <cstring>
9#include <ctime>
10#include <iostream>
11#include <map>
12#include <memory>
13#include <string>
14#include <variant>
15#include <vector>
16
17#include "absl/status/status.h"
18#include "absl/status/statusor.h"
19#include "absl/strings/match.h"
20#include "absl/strings/str_format.h"
21#include "absl/strings/string_view.h"
22#include "app/core/common.h"
23#include "app/core/constants.h"
24#include "app/core/project.h"
25#include "app/gfx/bitmap.h"
27#include "app/gfx/snes_tile.h"
28
29namespace yaze {
30namespace app {
31
35enum class Z3_Version {
36 US = 1, // US version
37 JP = 2, // JP version
38 SD = 3, // Super Donkey Proto (Experimental)
39 RANDO = 4, // Randomizer (Unimplemented)
40};
41
65
69static const std::map<Z3_Version, VersionConstants> kVersionConstantsMap = {
71 {
72 0x10275, // kGfxAnimatedPointer
73 0x5D97, // kOverworldGfxGroups1
74 0x6073, // kOverworldGfxGroups2
75 0x1794D, // kCompressedAllMap32PointersHigh
76 0x17B2D, // kCompressedAllMap32PointersLow
77 0x75504, // overworldMapPaletteGroup
78 0x77664, // overlayPointers
79 0x0E, // overlayPointersBank
80 0x71459, // overworldTilesType
81 0x4F80, // kOverworldGfxPtr1
82 0x505F, // kOverworldGfxPtr2
83 0x513E, // kOverworldGfxPtr3
84 0x18000, // kMap32TileTL
85 0x1B400, // kMap32TileTR
86 0x20000, // kMap32TileBL
87 0x23400, // kMap32TileBR
88 0x5B57, // kSpriteBlocksetPointer
89 0x75460, // kDungeonPalettesGroups
90 }},
92 {
93 0x10624, // kGfxAnimatedPointer
94 0x5DD7, // kOverworldGfxGroups1
95 0x60B3, // kOverworldGfxGroups2
96 0x176B1, // kCompressedAllMap32PointersHigh
97 0x17891, // kCompressedAllMap32PointersLow
98 0x67E74, // overworldMapPaletteGroup
99 0x3FAF4, // overlayPointers
100 0x07, // overlayPointersBank
101 0x7FD94, // overworldTilesType
102 0x4FC0, // kOverworldGfxPtr1
103 0x509F, // kOverworldGfxPtr2
104 0x517E, // kOverworldGfxPtr3
105 0x18000, // kMap32TileTL
106 0x1B3C0, // kMap32TileTR
107 0x20000, // kMap32TileBL
108 0x233C0, // kMap32TileBR
109 0x5B97, // kSpriteBlocksetPointer
110 0x67DD0, // kDungeonPalettesGroups
111 }},
112 {Z3_Version::SD, {}},
113 {Z3_Version::RANDO, {}},
114};
115
116constexpr uint32_t kNumGfxSheets = 223;
117constexpr uint32_t kNumLinkSheets = 14;
118constexpr uint32_t kTile16Ptr = 0x78000;
119constexpr uint32_t kNormalGfxSpaceStart = 0x87000;
120constexpr uint32_t kNormalGfxSpaceEnd = 0xC4200;
121constexpr uint32_t kFontSpriteLocation = 0x70000;
122constexpr uint32_t kGfxGroupsPointer = 0x6237;
123constexpr uint32_t kUncompressedSheetSize = 0x0800;
124constexpr uint32_t kNumMainBlocksets = 37;
125constexpr uint32_t kNumRoomBlocksets = 82;
126constexpr uint32_t kNumSpritesets = 144;
127constexpr uint32_t kNumPalettesets = 72;
128constexpr uint32_t kEntranceGfxGroup = 0x5D97;
129
130// TODO: Verify what this was used for in ZS
131constexpr uint32_t kMaxGraphics = 0xC3FB5;
132
137 public:
146 absl::StatusOr<std::vector<uint8_t>> Load2BppGraphics();
147
151 absl::Status LoadLinkGraphics();
152
171 absl::Status LoadAllGraphicsData(bool defer_render = false);
172
180 absl::Status LoadFromFile(const std::string& filename, bool z3_load = true);
181 absl::Status LoadFromPointer(uchar* data, size_t length, bool z3_load = true);
182 absl::Status LoadFromBytes(const std::vector<uint8_t>& data);
183
193 absl::Status SaveToFile(bool backup, bool save_new = false,
194 std::string filename = "");
195
196 absl::Status SaveAllGraphicsData();
197
205 absl::Status SavePalette(int index, const std::string& group_name,
206 gfx::SnesPalette& palette);
207
214 absl::Status SaveAllPalettes();
215
219 void Expand(int size) {
220 rom_data_.resize(size);
221 size_ = size;
222 }
223
227 absl::Status Close() {
228 rom_data_.clear();
229 size_ = 0;
230 is_loaded_ = false;
231 return absl::OkStatus();
232 }
233
237 absl::Status ReadWritePreconditions() {
238 if (!is_loaded_) {
239 return absl::FailedPreconditionError("ROM file not loaded");
240 }
241 if (rom_data_.empty() || size_ == 0) {
242 return absl::FailedPreconditionError(
243 "File was loaded, but ROM data was empty.");
244 }
245 return absl::OkStatus();
246 }
247
248 // Read functions
249 absl::StatusOr<uint8_t> ReadByte(int offset) {
251 if (offset >= static_cast<int>(rom_data_.size())) {
252 return absl::FailedPreconditionError("Offset out of range");
253 }
254 return rom_data_[offset];
255 }
256
257 absl::StatusOr<uint16_t> ReadWord(int offset) {
259 if (offset + 1 >= static_cast<int>(rom_data_.size())) {
260 return absl::FailedPreconditionError("Offset out of range");
261 }
262 auto result = (uint16_t)(rom_data_[offset] | (rom_data_[offset + 1] << 8));
263 return result;
264 }
265
266 uint16_t toint16(int offset) {
267 return (uint16_t)(rom_data_[offset] | (rom_data_[offset + 1] << 8));
268 }
269
270 absl::StatusOr<uint32_t> ReadLong(int offset) {
272 if (offset + 2 >= static_cast<int>(rom_data_.size())) {
273 return absl::OutOfRangeError("Offset out of range");
274 }
275 auto result = (uint32_t)(rom_data_[offset] | (rom_data_[offset + 1] << 8) |
276 (rom_data_[offset + 2] << 16));
277 return result;
278 }
279
280 absl::StatusOr<std::vector<uint8_t>> ReadByteVector(uint32_t offset,
281 uint32_t length) {
283 if (offset + length > static_cast<uint32_t>(rom_data_.size())) {
284 return absl::OutOfRangeError("Offset and length out of range");
285 }
286 std::vector<uint8_t> result;
287 for (uint32_t i = offset; i < offset + length; i++) {
288 result.push_back(rom_data_[i]);
289 }
290 return result;
291 }
292
293 absl::StatusOr<gfx::Tile16> ReadTile16(uint32_t tile16_id) {
294 // Skip 8 bytes per tile.
295 auto tpos = kTile16Ptr + (tile16_id * 0x08);
296 gfx::Tile16 tile16;
297 ASSIGN_OR_RETURN(auto new_tile0, ReadWord(tpos))
298 tile16.tile0_ = gfx::WordToTileInfo(new_tile0);
299 tpos += 2;
300 ASSIGN_OR_RETURN(auto new_tile1, ReadWord(tpos))
301 tile16.tile1_ = gfx::WordToTileInfo(new_tile1);
302 tpos += 2;
303 ASSIGN_OR_RETURN(auto new_tile2, ReadWord(tpos))
304 tile16.tile2_ = gfx::WordToTileInfo(new_tile2);
305 tpos += 2;
306 ASSIGN_OR_RETURN(auto new_tile3, ReadWord(tpos))
307 tile16.tile3_ = gfx::WordToTileInfo(new_tile3);
308 return tile16;
309 }
310
311 absl::Status WriteTile16(int tile16_id, const gfx::Tile16& tile) {
312 // Skip 8 bytes per tile.
313 auto tpos = kTile16Ptr + (tile16_id * 0x08);
315 tpos += 2;
317 tpos += 2;
319 tpos += 2;
321 return absl::OkStatus();
322 }
323
324 // Write functions
325 absl::Status Write(int addr, int value) {
326 if (addr >= static_cast<int>(rom_data_.size())) {
327 return absl::InvalidArgumentError(absl::StrFormat(
328 "Attempt to write %d value failed, address %d out of range", value,
329 addr));
330 }
331 rom_data_[addr] = value;
332 return absl::OkStatus();
333 }
334
335 absl::Status WriteByte(int addr, uint8_t value) {
337 if (addr >= static_cast<int>(rom_data_.size())) {
338 return absl::OutOfRangeError(absl::StrFormat(
339 "Attempt to write byte %#02x value failed, address %d out of range",
340 value, addr));
341 }
342 rom_data_[addr] = value;
343 std::string log_str = absl::StrFormat("WriteByte: %#06X: %s", addr,
345 core::Logger::log(log_str);
346 return absl::OkStatus();
347 }
348
349 absl::Status WriteWord(int addr, uint16_t value) {
351 if (addr + 1 >= static_cast<int>(rom_data_.size())) {
352 return absl::OutOfRangeError(absl::StrFormat(
353 "Attempt to write word %#04x value failed, address %d out of range",
354 value, addr));
355 }
356 rom_data_[addr] = (uint8_t)(value & 0xFF);
357 rom_data_[addr + 1] = (uint8_t)((value >> 8) & 0xFF);
358 core::Logger::log(absl::StrFormat("WriteWord: %#06X: %s", addr,
359 core::UppercaseHexWord(value)));
360 return absl::OkStatus();
361 }
362
363 absl::Status WriteShort(int addr, uint16_t value) {
365 if (addr + 1 >= static_cast<int>(rom_data_.size())) {
366 return absl::OutOfRangeError(absl::StrFormat(
367 "Attempt to write short %#04x value failed, address %d out of range",
368 value, addr));
369 }
370 rom_data_[addr] = (uint8_t)(value & 0xFF);
371 rom_data_[addr + 1] = (uint8_t)((value >> 8) & 0xFF);
372 core::Logger::log(absl::StrFormat("WriteShort: %#06X: %s", addr,
373 core::UppercaseHexWord(value)));
374 return absl::OkStatus();
375 }
376
377 absl::Status WriteLong(uint32_t addr, uint32_t value) {
379 if (addr + 2 >= static_cast<uint32_t>(rom_data_.size())) {
380 return absl::OutOfRangeError(absl::StrFormat(
381 "Attempt to write long %#06x value failed, address %d out of range",
382 value, addr));
383 }
384 rom_data_[addr] = (uint8_t)(value & 0xFF);
385 rom_data_[addr + 1] = (uint8_t)((value >> 8) & 0xFF);
386 rom_data_[addr + 2] = (uint8_t)((value >> 16) & 0xFF);
387 core::Logger::log(absl::StrFormat("WriteLong: %#06X: %s", addr,
388 core::UppercaseHexLong(value)));
389 return absl::OkStatus();
390 }
391
392 absl::Status WriteVector(int addr, std::vector<uint8_t> data) {
393 if (addr + static_cast<int>(data.size()) >
394 static_cast<int>(rom_data_.size())) {
395 return absl::InvalidArgumentError(absl::StrFormat(
396 "Attempt to write vector value failed, address %d out of range",
397 addr));
398 }
399 for (int i = 0; i < static_cast<int>(data.size()); i++) {
400 rom_data_[addr + i] = data[i];
401 }
402 core::Logger::log(absl::StrFormat("WriteVector: %#06X: %s", addr,
404 return absl::OkStatus();
405 }
406
407 absl::Status WriteColor(uint32_t address, const gfx::SnesColor& color) {
408 uint16_t bgr = ((color.snes() >> 10) & 0x1F) |
409 ((color.snes() & 0x1F) << 10) | (color.snes() & 0x7C00);
410
411 // Write the 16-bit color value to the ROM at the specified address
412 core::Logger::log(absl::StrFormat("WriteColor: %#06X: %s", address,
414 return WriteShort(address, bgr);
415 }
416
417 template <typename... Args>
418 absl::Status WriteTransaction(Args... args) {
419 absl::Status status;
420 // Fold expression to apply the Write function on each argument
421 ((status = WriteHelper(args)), ...);
422 return status;
423 }
424
425 template <typename T, typename... Args>
426 absl::Status ReadTransaction(T& var, int address, Args&&... args) {
427 absl::Status status = ReadHelper<T>(var, address);
428 if (!status.ok()) {
429 return status;
430 }
431
432 if constexpr (sizeof...(args) > 0) {
433 status = ReadTransaction(std::forward<Args>(args)...);
434 }
435
436 return status;
437 }
438
439 uint8_t& operator[](unsigned long i) {
440 if (i > size_) {
441 std::cout << "ROM: Index " << i << " out of bounds, size: " << size_
442 << std::endl;
443 return rom_data_[0];
444 }
445 return rom_data_[i];
446 }
447
448 bool is_loaded() const {
449 if (!absl::StrContains(filename_, ".sfc") &&
450 !absl::StrContains(filename_, ".smc")) {
451 return false;
452 }
453 return is_loaded_;
454 }
455
456 // Full graphical data for the game
457 std::vector<uint8_t> graphics_buffer() const { return graphics_buffer_; }
458
459 auto title() const { return title_; }
460 auto size() const { return size_; }
461 auto begin() { return rom_data_.begin(); }
462 auto end() { return rom_data_.end(); }
463 auto data() { return rom_data_.data(); }
464 auto vector() const { return rom_data_; }
465 auto version() const { return version_; }
466 auto filename() const { return filename_; }
467 auto set_filename(std::string name) { filename_ = name; }
468
469 auto link_graphics() { return link_graphics_; }
471 auto gfx_sheets() { return graphics_sheets_; }
473
480
483 return kVersionConstantsMap.at(version_);
484 }
485
486 std::array<std::array<uint8_t, 8>, kNumMainBlocksets> main_blockset_ids;
487 std::array<std::array<uint8_t, 4>, kNumRoomBlocksets> room_blockset_ids;
488 std::array<std::array<uint8_t, 4>, kNumSpritesets> spriteset_ids;
489 std::array<std::array<uint8_t, 4>, kNumPalettesets> paletteset_ids;
490
491 struct WriteAction {
493 std::variant<int, uint8_t, uint16_t, short, std::vector<uint8_t>,
494 gfx::SnesColor, std::vector<gfx::SnesColor>>
496 };
497
498 private:
499 virtual absl::Status WriteHelper(const WriteAction& action) {
500 if (std::holds_alternative<uint8_t>(action.value)) {
501 return Write(action.address, std::get<uint8_t>(action.value));
502 } else if (std::holds_alternative<uint16_t>(action.value) ||
503 std::holds_alternative<short>(action.value)) {
504 return WriteShort(action.address, std::get<uint16_t>(action.value));
505 } else if (std::holds_alternative<std::vector<uint8_t>>(action.value)) {
506 return WriteVector(action.address,
507 std::get<std::vector<uint8_t>>(action.value));
508 } else if (std::holds_alternative<gfx::SnesColor>(action.value)) {
509 return WriteColor(action.address, std::get<gfx::SnesColor>(action.value));
510 } else if (std::holds_alternative<std::vector<gfx::SnesColor>>(
511 action.value)) {
512 return absl::UnimplementedError(
513 "WriteHelper: std::vector<gfx::SnesColor>");
514 }
515 auto error_message = absl::StrFormat("Invalid write argument type: %s",
516 typeid(action.value).name());
517 return absl::InvalidArgumentError(error_message);
518 }
519
520 template <typename T>
521 absl::Status ReadHelper(T& var, int address) {
522 if constexpr (std::is_same_v<T, uint8_t>) {
523 ASSIGN_OR_RETURN(auto result, ReadByte(address));
524 var = result;
525 } else if constexpr (std::is_same_v<T, uint16_t>) {
526 ASSIGN_OR_RETURN(auto result, ReadWord(address));
527 var = result;
528 } else if constexpr (std::is_same_v<T, std::vector<uint8_t>>) {
529 ASSIGN_OR_RETURN(auto result, ReadByteVector(address, var.size()));
530 var = result;
531 }
532 return absl::OkStatus();
533 }
534
535 absl::Status LoadZelda3();
536 absl::Status LoadGfxGroups();
537 absl::Status SaveGroupsToRom();
538
539 // ROM file loaded flag
540 bool is_loaded_ = false;
541
542 // Size of the ROM data.
543 unsigned long size_ = 0;
544
545 // Title of the ROM loaded from the header
546 std::string title_ = "ROM not loaded";
547
548 // Filename of the ROM
549 std::string filename_ = "";
550
551 // Full contiguous rom space
552 std::vector<uint8_t> rom_data_;
553
554 // Full contiguous graphics space
555 std::vector<uint8_t> graphics_buffer_;
556
557 // All graphics sheets in the game
558 std::array<gfx::Bitmap, kNumGfxSheets> graphics_sheets_;
559
560 // All graphics sheets for Link
561 std::array<gfx::Bitmap, kNumLinkSheets> link_graphics_;
562
563 // Label manager for unique resource names.
565
566 // All palette groups in the game
568
569 // Version of the game
571};
572
577 public:
578 SharedRom() = default;
579 virtual ~SharedRom() = default;
580
581 std::shared_ptr<Rom> shared_rom() {
582 if (!shared_rom_) {
583 shared_rom_ = std::make_shared<Rom>();
584 }
585 return shared_rom_;
586 }
587
588 auto rom() {
589 if (!shared_rom_) {
590 shared_rom_ = std::make_shared<Rom>();
591 }
592 Rom* rom = shared_rom_.get();
593 return rom;
594 }
595
596 // private:
597 static std::shared_ptr<Rom> shared_rom_;
598};
599
600} // namespace app
601} // namespace yaze
602
603#endif
The Rom class is used to load, save, and modify Rom data.
Definition rom.h:136
absl::Status WriteByte(int addr, uint8_t value)
Definition rom.h:335
auto mutable_palette_group()
Definition rom.h:475
std::array< std::array< uint8_t, 4 >, kNumRoomBlocksets > room_blockset_ids
Definition rom.h:487
auto palette_group()
Definition rom.h:474
auto gfx_sheets()
Definition rom.h:471
std::string title_
Definition rom.h:546
std::array< std::array< uint8_t, 4 >, kNumPalettesets > paletteset_ids
Definition rom.h:489
VersionConstants version_constants() const
Definition rom.h:482
absl::Status WriteTransaction(Args... args)
Definition rom.h:418
Z3_Version version_
Definition rom.h:570
auto begin()
Definition rom.h:461
std::vector< uint8_t > graphics_buffer() const
Definition rom.h:457
std::vector< uint8_t > rom_data_
Definition rom.h:552
absl::Status WriteLong(uint32_t addr, uint32_t value)
Definition rom.h:377
absl::Status LoadGfxGroups()
Definition rom.cc:399
std::array< std::array< uint8_t, 8 >, kNumMainBlocksets > main_blockset_ids
Definition rom.h:486
ResourceLabelManager * resource_label()
Definition rom.h:481
uint16_t toint16(int offset)
Definition rom.h:266
absl::Status SaveAllGraphicsData()
Definition rom.cc:136
auto vector() const
Definition rom.h:464
absl::Status ReadTransaction(T &var, int address, Args &&... args)
Definition rom.h:426
std::array< std::array< uint8_t, 4 >, kNumSpritesets > spriteset_ids
Definition rom.h:488
absl::Status SaveToFile(bool backup, bool save_new=false, std::string filename="")
Saves the Rom data to a file.
Definition rom.cc:277
absl::StatusOr< uint32_t > ReadLong(int offset)
Definition rom.h:270
absl::Status SaveAllPalettes()
Saves all palettes in the Rom.
Definition rom.cc:386
ResourceLabelManager resource_label_manager_
Definition rom.h:564
absl::StatusOr< gfx::Tile16 > ReadTile16(uint32_t tile16_id)
Definition rom.h:293
auto link_graphics()
Definition rom.h:469
auto mutable_gfx_sheets()
Definition rom.h:472
std::array< gfx::Bitmap, kNumGfxSheets > graphics_sheets_
Definition rom.h:558
auto filename() const
Definition rom.h:466
absl::Status SavePalette(int index, const std::string &group_name, gfx::SnesPalette &palette)
Definition rom.cc:372
absl::Status LoadAllGraphicsData(bool defer_render=false)
This function iterates over all graphics sheets in the Rom and loads them into memory....
Definition rom.cc:77
virtual absl::Status WriteHelper(const WriteAction &action)
Definition rom.h:499
auto size() const
Definition rom.h:460
absl::StatusOr< std::vector< uint8_t > > Load2BppGraphics()
Loads 2bpp graphics from Rom data.
Definition rom.cc:39
void Expand(int size)
Expand the Rom data to a specified size.
Definition rom.h:219
absl::Status WriteTile16(int tile16_id, const gfx::Tile16 &tile)
Definition rom.h:311
auto version() const
Definition rom.h:465
auto set_filename(std::string name)
Definition rom.h:467
absl::Status LoadLinkGraphics()
Loads the players 4bpp graphics sheet from Rom data.
Definition rom.cc:58
gfx::PaletteGroupMap palette_groups_
Definition rom.h:567
absl::Status WriteShort(int addr, uint16_t value)
Definition rom.h:363
unsigned long size_
Definition rom.h:543
absl::Status WriteColor(uint32_t address, const gfx::SnesColor &color)
Definition rom.h:407
absl::Status Write(int addr, int value)
Definition rom.h:325
absl::Status SaveGroupsToRom()
Definition rom.cc:432
absl::Status Close()
Close the Rom file.
Definition rom.h:227
bool is_loaded() const
Definition rom.h:448
std::string filename_
Definition rom.h:549
auto data()
Definition rom.h:463
absl::StatusOr< uint16_t > ReadWord(int offset)
Definition rom.h:257
absl::Status ReadHelper(T &var, int address)
Definition rom.h:521
auto end()
Definition rom.h:462
auto mutable_dungeon_palette(int i)
Definition rom.h:477
auto title() const
Definition rom.h:459
absl::Status WriteWord(int addr, uint16_t value)
Definition rom.h:349
bool is_loaded_
Definition rom.h:540
auto mutable_link_graphics()
Definition rom.h:470
auto dungeon_palette(int i)
Definition rom.h:476
uint8_t & operator[](unsigned long i)
Definition rom.h:439
absl::Status LoadFromFile(const std::string &filename, bool z3_load=true)
Definition rom.cc:168
absl::StatusOr< uint8_t > ReadByte(int offset)
Definition rom.h:249
absl::Status LoadFromBytes(const std::vector< uint8_t > &data)
Definition rom.cc:266
absl::Status WriteVector(int addr, std::vector< uint8_t > data)
Definition rom.h:392
absl::StatusOr< std::vector< uint8_t > > ReadByteVector(uint32_t offset, uint32_t length)
Definition rom.h:280
std::vector< uint8_t > graphics_buffer_
Definition rom.h:555
absl::Status LoadFromPointer(uchar *data, size_t length, bool z3_load=true)
Definition rom.cc:213
absl::Status ReadWritePreconditions()
Precondition check for reading and writing to the Rom.
Definition rom.h:237
absl::Status LoadZelda3()
Definition rom.cc:231
std::array< gfx::Bitmap, kNumLinkSheets > link_graphics_
Definition rom.h:561
A class to hold a shared pointer to a Rom object.
Definition rom.h:576
static std::shared_ptr< Rom > shared_rom_
Definition rom.h:597
std::shared_ptr< Rom > shared_rom()
Definition rom.h:581
virtual ~SharedRom()=default
A class to manage experimental feature flags.
Definition common.h:36
static void log(std::string message)
Definition common.h:218
SNES Color container.
Definition snes_color.h:39
uint16_t snes() const
Definition snes_color.h:91
Represents a palette of colors for the Super Nintendo Entertainment System (SNES).
Tile composition of four 8x8 tiles.
Definition snes_tile.h:130
#define RETURN_IF_ERROR(expression)
Definition constants.h:62
#define ASSIGN_OR_RETURN(type_variable_name, expression)
Definition constants.h:70
unsigned char uchar
Definition constants.h:114
std::string UppercaseHexLong(uint32_t dword)
Definition common.cc:119
std::string UppercaseHexByte(uint8_t byte, bool leading)
Definition common.cc:103
std::string UppercaseHexWord(uint16_t word, bool leading)
Definition common.cc:111
TileInfo WordToTileInfo(uint16_t word)
Definition snes_tile.cc:331
uint16_t TileInfoToWord(TileInfo tile_info)
Definition snes_tile.cc:314
constexpr uint32_t kTile16Ptr
Definition rom.h:118
constexpr uint32_t kNumRoomBlocksets
Definition rom.h:125
Z3_Version
Different versions of the game supported by the Rom class.
Definition rom.h:35
constexpr uint32_t kNormalGfxSpaceStart
Definition rom.h:119
constexpr uint32_t kNormalGfxSpaceEnd
Definition rom.h:120
constexpr uint32_t kNumSpritesets
Definition rom.h:126
constexpr uint32_t kNumLinkSheets
Definition rom.h:117
constexpr uint32_t kMaxGraphics
Definition rom.h:131
constexpr uint32_t kUncompressedSheetSize
Definition rom.h:123
constexpr uint32_t kFontSpriteLocation
Definition rom.h:121
constexpr uint32_t kNumGfxSheets
Definition rom.h:116
constexpr uint32_t kEntranceGfxGroup
Definition rom.h:128
constexpr uint32_t kNumMainBlocksets
Definition rom.h:124
constexpr uint32_t kGfxGroupsPointer
Definition rom.h:122
constexpr uint32_t kNumPalettesets
Definition rom.h:127
Definition common.cc:22
std::variant< int, uint8_t, uint16_t, short, std::vector< uint8_t >, gfx::SnesColor, std::vector< gfx::SnesColor > > value
Definition rom.h:495
Constants for each version of the game.
Definition rom.h:45
uint32_t overlayPointersBank
Definition rom.h:53
uint32_t kOverworldGfxPtr1
Definition rom.h:55
uint32_t kOverworldGfxGroups2
Definition rom.h:48
uint32_t kCompressedAllMap32PointersLow
Definition rom.h:50
uint32_t overlayPointers
Definition rom.h:52
uint32_t kGfxAnimatedPointer
Definition rom.h:46
uint32_t kOverworldGfxGroups1
Definition rom.h:47
uint32_t kCompressedAllMap32PointersHigh
Definition rom.h:49
uint32_t kDungeonPalettesGroups
Definition rom.h:63
uint32_t overworldMapPaletteGroup
Definition rom.h:51
uint32_t overworldTilesType
Definition rom.h:54
uint32_t kSpriteBlocksetPointer
Definition rom.h:62
uint32_t kOverworldGfxPtr3
Definition rom.h:57
uint32_t kOverworldGfxPtr2
Definition rom.h:56
Represents a mapping of palette groups.