yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze Namespace Reference

Main namespace for the application. More...

Namespaces

namespace  agent
 
namespace  anonymous_namespace{font_loader.cc}
 
namespace  anonymous_namespace{rom.cc}
 
namespace  cli
 Namespace for the command line interface.
 
namespace  core
 
namespace  editor
 Editors are the view controllers for the application.
 
namespace  emu
 SNES Emulation and debugging tools.
 
namespace  gfx
 Contains classes for handling graphical data.
 
namespace  gui
 Graphical User Interface (GUI) components for the application.
 
namespace  net
 
namespace  test
 
namespace  util
 
namespace  zelda3
 Zelda 3 specific classes and functions.
 

Classes

class  AssetLoader
 Cross-platform asset file loading utility. More...
 
struct  FontConfig
 
struct  FontState
 
class  Rom
 The Rom class is used to load, save, and modify Rom data. More...
 
struct  RomLoadOptions
 
class  Transaction
 

Functions

absl::Status LoadPackageFonts ()
 
absl::Status ReloadPackageFont (const FontConfig &config)
 
void LoadSystemFonts ()
 
uint32_t GetGraphicsAddress (const uint8_t *data, uint8_t addr, uint32_t ptr1, uint32_t ptr2, uint32_t ptr3)
 
absl::StatusOr< std::vector< uint8_t > > Load2BppGraphics (const Rom &rom)
 Loads 2bpp graphics from Rom data.
 
absl::StatusOr< std::array< gfx::Bitmap, kNumLinkSheets > > LoadLinkGraphics (const Rom &rom)
 Loads the players 4bpp graphics sheet from Rom data.
 
absl::StatusOr< gfx::BitmapLoadFontGraphics (const Rom &rom)
 
absl::StatusOr< std::array< gfx::Bitmap, kNumGfxSheets > > LoadAllGraphicsData (Rom &rom, bool defer_render=false)
 This function iterates over all graphics sheets in the Rom and loads them into memory. Depending on the sheet's index, it may be uncompressed or compressed using the LC-LZ2 algorithm. The uncompressed sheets are 3 bits per pixel (BPP), while the compressed sheets are 4 BPP. The loaded graphics data is converted to 8 BPP and stored in a bitmap.
 
absl::Status SaveAllGraphicsData (Rom &rom, std::array< gfx::Bitmap, kNumGfxSheets > &gfx_sheets)
 
uint32_t SnesToPc (uint32_t addr) noexcept
 
uint32_t PcToSnes (uint32_t addr)
 
uint32_t Get24LocalFromPC (uint8_t *data, int addr, bool pc=true)
 
int AddressFromBytes (uint8_t bank, uint8_t high, uint8_t low) noexcept
 
uint32_t MapBankToWordAddress (uint8_t bank, uint16_t addr) noexcept
 

Variables

constexpr int Uncompressed3BPPSize = 0x0600
 
constexpr uint32_t kNumGfxSheets = 223
 
constexpr uint32_t kNumLinkSheets = 14
 
constexpr uint32_t kTile16Ptr = 0x78000
 
constexpr uint32_t kNormalGfxSpaceStart = 0x87000
 
constexpr uint32_t kNormalGfxSpaceEnd = 0xC4200
 
constexpr uint32_t kFontSpriteLocation = 0x70000
 
constexpr uint32_t kGfxGroupsPointer = 0x6237
 
constexpr uint32_t kUncompressedSheetSize = 0x0800
 
constexpr uint32_t kNumMainBlocksets = 37
 
constexpr uint32_t kNumRoomBlocksets = 82
 
constexpr uint32_t kNumSpritesets = 144
 
constexpr uint32_t kNumPalettesets = 72
 
constexpr uint32_t kEntranceGfxGroup = 0x5D97
 
constexpr uint32_t kMaxGraphics = 0x0C3FFF
 

Detailed Description

Main namespace for the application.

Function Documentation

◆ LoadPackageFonts()

absl::Status yaze::LoadPackageFonts ( )

Definition at line 98 of file font_loader.cc.

References RETURN_IF_ERROR.

Referenced by yaze::core::CreateWindow().

◆ ReloadPackageFont()

absl::Status yaze::ReloadPackageFont ( const FontConfig config)

◆ LoadSystemFonts()

void yaze::LoadSystemFonts ( )

◆ GetGraphicsAddress()

uint32_t yaze::GetGraphicsAddress ( const uint8_t *  data,
uint8_t  addr,
uint32_t  ptr1,
uint32_t  ptr2,
uint32_t  ptr3 
)

Definition at line 70 of file rom.cc.

References AddressFromBytes(), and SnesToPc().

Referenced by Load2BppGraphics(), LoadAllGraphicsData(), and SaveAllGraphicsData().

Here is the call graph for this function:

◆ Load2BppGraphics()

absl::StatusOr< std::vector< uint8_t > > yaze::Load2BppGraphics ( const Rom rom)

Loads 2bpp graphics from Rom data.

This function loads 2bpp graphics from Rom data by iterating over a list of sheet IDs, decompressing the sheet data, converting it to 8bpp format, and appending the converted sheet data to a byte vector.

Definition at line 76 of file rom.cc.

References ASSIGN_OR_RETURN, yaze::Rom::data(), yaze::gfx::lc_lz2::DecompressV2(), GetGraphicsAddress(), zelda3_version_pointers::kOverworldGfxPtr1, zelda3_version_pointers::kOverworldGfxPtr2, zelda3_version_pointers::kOverworldGfxPtr3, yaze::gfx::SnesTo8bppSheet(), and yaze::Rom::version_constants().

Referenced by yaze::zelda3::Inventory::BuildTileset().

◆ LoadLinkGraphics()

absl::StatusOr< std::array< gfx::Bitmap, kNumLinkSheets > > yaze::LoadLinkGraphics ( const Rom rom)

Loads the players 4bpp graphics sheet from Rom data.

Definition at line 94 of file rom.cc.

References ASSIGN_OR_RETURN, kNumLinkSheets, yaze::gfx::kTilesheetDepth, yaze::gfx::kTilesheetHeight, yaze::gfx::kTilesheetWidth, yaze::Rom::palette_group(), yaze::Rom::ReadByteVector(), and yaze::gfx::SnesTo8bppSheet().

Referenced by yaze::editor::GraphicsEditor::UpdateLinkGfxView().

Here is the call graph for this function:

◆ LoadFontGraphics()

absl::StatusOr< gfx::Bitmap > yaze::LoadFontGraphics ( const Rom rom)

Definition at line 114 of file rom.cc.

References yaze::gfx::Bitmap::Create(), and yaze::Rom::data().

Referenced by yaze::editor::MessageEditor::Initialize().

Here is the call graph for this function:

◆ LoadAllGraphicsData()

absl::StatusOr< std::array< gfx::Bitmap, kNumGfxSheets > > yaze::LoadAllGraphicsData ( Rom rom,
bool  defer_render = false 
)

This function iterates over all graphics sheets in the Rom and loads them into memory. Depending on the sheet's index, it may be uncompressed or compressed using the LC-LZ2 algorithm. The uncompressed sheets are 3 bits per pixel (BPP), while the compressed sheets are 4 BPP. The loaded graphics data is converted to 8 BPP and stored in a bitmap.

The graphics sheets are divided into the following ranges:

Range Compression Type Decompressed Size Number of Chars
0-112 Compressed 3bpp BGR 0x600 chars Decompressed each
113-114 Compressed 2bpp 0x800 chars Decompressed each
115-126 Uncompressed 3bpp sprites 0x600 chars Each
127-217 Compressed 3bpp sprites 0x600 chars Decompressed each
218-222 Compressed 2bpp 0x800 chars Decompressed each

Definition at line 172 of file rom.cc.

References ASSIGN_OR_RETURN, yaze::Rom::data(), yaze::gfx::lc_lz2::DecompressV2(), yaze::gfx::SnesPalette::empty(), GetGraphicsAddress(), kNumGfxSheets, zelda3_version_pointers::kOverworldGfxPtr1, zelda3_version_pointers::kOverworldGfxPtr2, zelda3_version_pointers::kOverworldGfxPtr3, yaze::gfx::kTilesheetDepth, yaze::gfx::kTilesheetHeight, yaze::gfx::kTilesheetWidth, LOG_DEBUG, yaze::Rom::mutable_graphics_buffer(), yaze::Rom::palette_group(), yaze::gfx::SnesTo8bppSheet(), Uncompressed3BPPSize, and yaze::Rom::version_constants().

Referenced by yaze::editor::EditorManager::LoadAssets(), and yaze::test::RomDependentTestSuite::RunRomGraphicsExtractionTest().

◆ SaveAllGraphicsData()

◆ SnesToPc()

◆ PcToSnes()

◆ Get24LocalFromPC()

uint32_t yaze::Get24LocalFromPC ( uint8_t *  data,
int  addr,
bool  pc = true 
)
inline

Definition at line 30 of file snes.h.

References PcToSnes(), and SnesToPc().

Referenced by yaze::editor::ParseSingleMessage(), and yaze::editor::ReadAllTextData().

Here is the call graph for this function:

◆ AddressFromBytes()

int yaze::AddressFromBytes ( uint8_t  bank,
uint8_t  high,
uint8_t  low 
)
inlinenoexcept

Definition at line 39 of file snes.h.

Referenced by GetGraphicsAddress().

◆ MapBankToWordAddress()

uint32_t yaze::MapBankToWordAddress ( uint8_t  bank,
uint16_t  addr 
)
inlinenoexcept

Definition at line 43 of file snes.h.

Variable Documentation

◆ Uncompressed3BPPSize

constexpr int yaze::Uncompressed3BPPSize = 0x0600
constexpr

Definition at line 32 of file rom.cc.

Referenced by LoadAllGraphicsData().

◆ kNumGfxSheets

◆ kNumLinkSheets

constexpr uint32_t yaze::kNumLinkSheets = 14
constexpr

Definition at line 29 of file rom.h.

Referenced by LoadLinkGraphics().

◆ kTile16Ptr

constexpr uint32_t yaze::kTile16Ptr = 0x78000
constexpr

Definition at line 30 of file rom.h.

Referenced by yaze::Rom::ReadTile16(), and yaze::Rom::WriteTile16().

◆ kNormalGfxSpaceStart

constexpr uint32_t yaze::kNormalGfxSpaceStart = 0x87000
constexpr

Definition at line 31 of file rom.h.

◆ kNormalGfxSpaceEnd

constexpr uint32_t yaze::kNormalGfxSpaceEnd = 0xC4200
constexpr

Definition at line 32 of file rom.h.

◆ kFontSpriteLocation

constexpr uint32_t yaze::kFontSpriteLocation = 0x70000
constexpr

Definition at line 33 of file rom.h.

◆ kGfxGroupsPointer

constexpr uint32_t yaze::kGfxGroupsPointer = 0x6237
constexpr

Definition at line 34 of file rom.h.

Referenced by yaze::Rom::LoadGfxGroups(), and yaze::Rom::SaveGfxGroups().

◆ kUncompressedSheetSize

constexpr uint32_t yaze::kUncompressedSheetSize = 0x0800
constexpr

Definition at line 35 of file rom.h.

◆ kNumMainBlocksets

constexpr uint32_t yaze::kNumMainBlocksets = 37
constexpr

Definition at line 36 of file rom.h.

Referenced by yaze::Rom::LoadGfxGroups(), and yaze::Rom::SaveGfxGroups().

◆ kNumRoomBlocksets

constexpr uint32_t yaze::kNumRoomBlocksets = 82
constexpr

Definition at line 37 of file rom.h.

Referenced by yaze::Rom::LoadGfxGroups(), and yaze::Rom::SaveGfxGroups().

◆ kNumSpritesets

constexpr uint32_t yaze::kNumSpritesets = 144
constexpr

Definition at line 38 of file rom.h.

Referenced by yaze::Rom::LoadGfxGroups(), and yaze::Rom::SaveGfxGroups().

◆ kNumPalettesets

constexpr uint32_t yaze::kNumPalettesets = 72
constexpr

Definition at line 39 of file rom.h.

Referenced by yaze::Rom::LoadGfxGroups(), and yaze::Rom::SaveGfxGroups().

◆ kEntranceGfxGroup

constexpr uint32_t yaze::kEntranceGfxGroup = 0x5D97
constexpr

Definition at line 40 of file rom.h.

Referenced by yaze::Rom::LoadGfxGroups(), and yaze::Rom::SaveGfxGroups().

◆ kMaxGraphics

constexpr uint32_t yaze::kMaxGraphics = 0x0C3FFF
constexpr

Definition at line 41 of file rom.h.