The Rom class is used to load, save, and modify Rom data.
More...
#include <rom.h>
|
absl::Status | LoadFromFile (const std::string &filename, bool z3_load=true) |
|
absl::Status | LoadFromData (const std::vector< uint8_t > &data, bool z3_load=true) |
|
absl::Status | SaveToFile (bool backup, bool save_new=false, std::string filename="") |
| Saves the Rom data to a file.
|
|
absl::Status | SavePalette (int index, const std::string &group_name, gfx::SnesPalette &palette) |
|
absl::Status | SaveAllPalettes () |
| Saves all palettes in the Rom.
|
|
void | Expand (int size) |
|
absl::Status | Close () |
|
absl::StatusOr< uint8_t > | ReadByte (int offset) |
|
absl::StatusOr< uint16_t > | ReadWord (int offset) |
|
absl::StatusOr< uint32_t > | ReadLong (int offset) |
|
absl::StatusOr< std::vector< uint8_t > > | ReadByteVector (uint32_t offset, uint32_t length) const |
|
absl::StatusOr< gfx::Tile16 > | ReadTile16 (uint32_t tile16_id) |
|
absl::Status | WriteTile16 (int tile16_id, const gfx::Tile16 &tile) |
|
absl::Status | WriteByte (int addr, uint8_t value) |
|
absl::Status | WriteWord (int addr, uint16_t value) |
|
absl::Status | WriteShort (int addr, uint16_t value) |
|
absl::Status | WriteLong (uint32_t addr, uint32_t value) |
|
absl::Status | WriteVector (int addr, std::vector< uint8_t > data) |
|
absl::Status | WriteColor (uint32_t address, const gfx::SnesColor &color) |
|
template<typename... Args> |
absl::Status | WriteTransaction (Args... args) |
|
template<typename T, typename... Args> |
absl::Status | ReadTransaction (T &var, int address, Args &&... args) |
|
uint8_t & | operator[] (unsigned long i) |
|
bool | is_loaded () const |
|
auto | title () const |
|
auto | size () const |
|
auto | data () const |
|
auto | mutable_data () |
|
auto | begin () |
|
auto | end () |
|
auto | vector () const |
|
auto | version () const |
|
auto | filename () const |
|
auto | set_filename (std::string name) |
|
std::vector< uint8_t > | graphics_buffer () const |
|
auto | mutable_graphics_buffer () |
|
auto | palette_group () const |
|
auto | mutable_palette_group () |
|
auto | dungeon_palette (int i) |
|
auto | mutable_dungeon_palette (int i) |
|
ResourceLabelManager * | resource_label () |
|
zelda3_version_pointers | version_constants () const |
|
The Rom class is used to load, save, and modify Rom data.
Definition at line 59 of file rom.h.
◆ LoadFromFile()
absl::Status yaze::Rom::LoadFromFile |
( |
const std::string & | filename, |
|
|
bool | z3_load = true ) |
Load Rom data from a file.
- Parameters
-
filename | The name of the file to load. |
z3_load | Whether to load data specific to Zelda 3. |
Definition at line 173 of file rom.cc.
◆ LoadFromData()
absl::Status yaze::Rom::LoadFromData |
( |
const std::vector< uint8_t > & | data, |
|
|
bool | z3_load = true ) |
◆ SaveToFile()
absl::Status yaze::Rom::SaveToFile |
( |
bool | backup, |
|
|
bool | save_new = false, |
|
|
std::string | filename = "" ) |
Saves the Rom data to a file.
- Parameters
-
backup | If true, creates a backup file with timestamp in its name |
filename | The name of the file to save the Rom data to |
- Returns
- absl::Status Returns an OK status if the save was successful, otherwise returns an error status
Definition at line 408 of file rom.cc.
◆ SavePalette()
absl::Status yaze::Rom::SavePalette |
( |
int | index, |
|
|
const std::string & | group_name, |
|
|
gfx::SnesPalette & | palette ) |
Saves the given palette to the Rom if any of its colors have been modified.
- Parameters
-
index | The index of the palette to save. |
group_name | The name of the group containing the palette. |
palette | The palette to save. |
Definition at line 504 of file rom.cc.
◆ SaveAllPalettes()
absl::Status yaze::Rom::SaveAllPalettes |
( |
| ) |
|
Saves all palettes in the Rom.
This function iterates through all palette groups and all palettes in each group, and saves each palette using the SavePalette() function.
Definition at line 518 of file rom.cc.
◆ Expand()
void yaze::Rom::Expand |
( |
int | size | ) |
|
|
inline |
◆ Close()
absl::Status yaze::Rom::Close |
( |
| ) |
|
|
inline |
◆ ReadByte()
absl::StatusOr< uint8_t > yaze::Rom::ReadByte |
( |
int | offset | ) |
|
◆ ReadWord()
absl::StatusOr< uint16_t > yaze::Rom::ReadWord |
( |
int | offset | ) |
|
◆ ReadLong()
absl::StatusOr< uint32_t > yaze::Rom::ReadLong |
( |
int | offset | ) |
|
◆ ReadByteVector()
absl::StatusOr< std::vector< uint8_t > > yaze::Rom::ReadByteVector |
( |
uint32_t | offset, |
|
|
uint32_t | length ) const |
◆ ReadTile16()
absl::StatusOr< gfx::Tile16 > yaze::Rom::ReadTile16 |
( |
uint32_t | tile16_id | ) |
|
◆ WriteTile16()
absl::Status yaze::Rom::WriteTile16 |
( |
int | tile16_id, |
|
|
const gfx::Tile16 & | tile ) |
◆ WriteByte()
absl::Status yaze::Rom::WriteByte |
( |
int | addr, |
|
|
uint8_t | value ) |
◆ WriteWord()
absl::Status yaze::Rom::WriteWord |
( |
int | addr, |
|
|
uint16_t | value ) |
◆ WriteShort()
absl::Status yaze::Rom::WriteShort |
( |
int | addr, |
|
|
uint16_t | value ) |
◆ WriteLong()
absl::Status yaze::Rom::WriteLong |
( |
uint32_t | addr, |
|
|
uint32_t | value ) |
◆ WriteVector()
absl::Status yaze::Rom::WriteVector |
( |
int | addr, |
|
|
std::vector< uint8_t > | data ) |
◆ WriteColor()
absl::Status yaze::Rom::WriteColor |
( |
uint32_t | address, |
|
|
const gfx::SnesColor & | color ) |
◆ WriteTransaction()
template<typename... Args>
absl::Status yaze::Rom::WriteTransaction |
( |
Args... | args | ) |
|
|
inline |
◆ ReadTransaction()
template<typename T, typename... Args>
absl::Status yaze::Rom::ReadTransaction |
( |
T & | var, |
|
|
int | address, |
|
|
Args &&... | args ) |
|
inline |
◆ operator[]()
uint8_t & yaze::Rom::operator[] |
( |
unsigned long | i | ) |
|
|
inline |
◆ is_loaded()
bool yaze::Rom::is_loaded |
( |
| ) |
const |
|
inline |
◆ title()
auto yaze::Rom::title |
( |
| ) |
const |
|
inline |
◆ size()
auto yaze::Rom::size |
( |
| ) |
const |
|
inline |
◆ data()
auto yaze::Rom::data |
( |
| ) |
const |
|
inline |
◆ mutable_data()
auto yaze::Rom::mutable_data |
( |
| ) |
|
|
inline |
◆ begin()
auto yaze::Rom::begin |
( |
| ) |
|
|
inline |
◆ end()
◆ vector()
auto yaze::Rom::vector |
( |
| ) |
const |
|
inline |
◆ version()
auto yaze::Rom::version |
( |
| ) |
const |
|
inline |
◆ filename()
auto yaze::Rom::filename |
( |
| ) |
const |
|
inline |
◆ set_filename()
auto yaze::Rom::set_filename |
( |
std::string | name | ) |
|
|
inline |
◆ graphics_buffer()
std::vector< uint8_t > yaze::Rom::graphics_buffer |
( |
| ) |
const |
|
inline |
◆ mutable_graphics_buffer()
auto yaze::Rom::mutable_graphics_buffer |
( |
| ) |
|
|
inline |
◆ palette_group()
auto yaze::Rom::palette_group |
( |
| ) |
const |
|
inline |
◆ mutable_palette_group()
auto yaze::Rom::mutable_palette_group |
( |
| ) |
|
|
inline |
◆ dungeon_palette()
auto yaze::Rom::dungeon_palette |
( |
int | i | ) |
|
|
inline |
◆ mutable_dungeon_palette()
auto yaze::Rom::mutable_dungeon_palette |
( |
int | i | ) |
|
|
inline |
◆ resource_label()
◆ version_constants()
◆ WriteHelper()
virtual absl::Status yaze::Rom::WriteHelper |
( |
const WriteAction & | action | ) |
|
|
inlineprivatevirtual |
◆ ReadHelper()
template<typename T>
absl::Status yaze::Rom::ReadHelper |
( |
T & | var, |
|
|
int | address ) |
|
inlineprivate |
◆ LoadZelda3()
absl::Status yaze::Rom::LoadZelda3 |
( |
| ) |
|
|
private |
◆ LoadGfxGroups()
absl::Status yaze::Rom::LoadGfxGroups |
( |
| ) |
|
|
private |
◆ SaveGroupsToRom()
absl::Status yaze::Rom::SaveGroupsToRom |
( |
| ) |
|
|
private |
◆ main_blockset_ids
◆ room_blockset_ids
◆ spriteset_ids
std::array<std::array<uint8_t, 4>, kNumSpritesets> yaze::Rom::spriteset_ids |
◆ paletteset_ids
std::array<std::array<uint8_t, 4>, kNumPalettesets> yaze::Rom::paletteset_ids |
◆ is_loaded_
bool yaze::Rom::is_loaded_ = false |
|
private |
◆ size_
unsigned long yaze::Rom::size_ = 0 |
|
private |
◆ title_
std::string yaze::Rom::title_ = "ROM not loaded" |
|
private |
◆ filename_
std::string yaze::Rom::filename_ = "" |
|
private |
◆ rom_data_
std::vector<uint8_t> yaze::Rom::rom_data_ |
|
private |
◆ graphics_buffer_
std::vector<uint8_t> yaze::Rom::graphics_buffer_ |
|
private |
◆ resource_label_manager_
◆ palette_groups_
◆ version_
The documentation for this class was generated from the following files: