yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
gfx_sheet_storage.h File Reference

Locates graphics sheets in the ROM and writes edited sheets back. More...

#include <array>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <map>
#include <set>
#include <string>
#include <vector>
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "rom/rom.h"

Go to the source code of this file.

Classes

struct  yaze::zelda3::GfxSheetPointerTables
 PC offsets of the bank, high and low byte pointer tables. More...
 
struct  yaze::zelda3::GfxSheetPcRange
 Half-open PC range [begin, end). More...
 
struct  yaze::zelda3::GfxSheetExtent
 Where one sheet's bytes live and how many bytes they occupy. More...
 
struct  yaze::zelda3::GfxSheetWritePolicy
 Rules a sheet write must follow. More...
 
struct  yaze::zelda3::GfxSheetWriteResult
 

Namespaces

namespace  yaze
 
namespace  yaze::zelda3
 Zelda 3 specific classes and functions.
 

Enumerations

enum class  yaze::zelda3::GfxSheetStorageKind { yaze::zelda3::kCompressed3bpp , yaze::zelda3::kRaw3bpp , yaze::zelda3::kCompressed2bpp }
 
enum class  yaze::zelda3::GfxSheetPlacement { yaze::zelda3::kInPlace , yaze::zelda3::kRelocated }
 

Functions

GfxSheetStorageKind yaze::zelda3::GetGfxSheetStorageKind (uint16_t sheet_id)
 
const char * yaze::zelda3::GfxSheetStorageKindName (GfxSheetStorageKind kind)
 
bool yaze::zelda3::UsesJapaneseGfxSheetTables (const Rom &rom)
 
absl::StatusOr< uint32_t > yaze::zelda3::ReadGfxSheetPc (const Rom &rom, uint16_t sheet_id, const GfxSheetPointerTables &tables={})
 Resolves a sheet's pointer. Does not read the sheet data.
 
absl::StatusOr< GfxSheetExtent > yaze::zelda3::ReadGfxSheetExtent (const Rom &rom, uint16_t sheet_id, const GfxSheetPointerTables &tables)
 
absl::StatusOr< std::vector< uint8_t > > yaze::zelda3::ReadGfxSheetData (const Rom &rom, uint16_t sheet_id, const GfxSheetPointerTables &tables={})
 Returns the sheet's decoded bytes (SNES planar data).
 
std::array< int, 4 > yaze::zelda3::GfxSheetBlockTiles (int block)
 
bool yaze::zelda3::IsGfxSheetBlockEmpty (const std::vector< uint8_t > &data, int block, int bpp)
 
absl::StatusOr< GfxSheetWriteResult > yaze::zelda3::WriteGfxSheet (Rom &rom, uint16_t sheet_id, const std::vector< uint8_t > &snes_3bpp, const GfxSheetWritePolicy &policy, const GfxSheetPointerTables &tables={})
 Writes one edited 3bpp sheet to the ROM buffer.
 

Variables

constexpr size_t yaze::zelda3::kGfxSheetCount = 223
 
constexpr size_t yaze::zelda3::kGfxSheet3bppBytes = 0x600
 
constexpr size_t yaze::zelda3::kGfxSheet2bppBytes = 0x800
 
constexpr int yaze::zelda3::kGfxSheetBlockCount = 16
 16x16 blocks per sheet: 8 columns x 2 rows over the 128x32 sheet.
 

Detailed Description

Locates graphics sheets in the ROM and writes edited sheets back.

Sheet N is addressed by three byte tables (bank, high, low) at PC 0x4F80, 0x505F and 0x513E. Sheets 115-126 are raw 3bpp (0x600 bytes). Sheets 113-114 and 218+ are LC-LZ2 compressed 2bpp. Every other sheet is LC-LZ2 compressed 3bpp that must decode to exactly 0x600 bytes: the game decompresses sprite sheets to $7F:4000 and $7F:4600, so a longer stream overwrites the neighbouring sheet in WRAM.

Definition in file gfx_sheet_storage.h.