yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::EditorContext Struct Reference

Lightweight view into the essential runtime context (Rom + GameData) More...

#include <editor.h>

Collaboration diagram for yaze::editor::EditorContext:

Public Member Functions

bool IsValid () const
 
bool HasRom () const
 
bool HasGameData () const
 
 operator bool () const
 

Public Attributes

Romrom = nullptr
 
zelda3::GameDatagame_data = nullptr
 

Detailed Description

Lightweight view into the essential runtime context (Rom + GameData)

This struct provides a bundled view of the two primary dependencies for Zelda3 editing operations. It can be passed by value and is designed to replace the pattern of passing rom_ and game_data_ separately.

Usage:

void SomeComponent::DoWork(EditorContext ctx) {
if (!ctx.IsValid()) return;
auto data = ctx.rom->ReadByte(0x1234);
auto& palettes = ctx.game_data->palette_groups;
}
absl::StatusOr< uint8_t > ReadByte(int offset)
Definition rom.cc:221
Lightweight view into the essential runtime context (Rom + GameData)
Definition editor.h:67
zelda3::GameData * game_data
Definition editor.h:69
gfx::PaletteGroupMap palette_groups
Definition game_data.h:89

Definition at line 67 of file editor.h.

Member Function Documentation

◆ IsValid()

bool yaze::editor::EditorContext::IsValid ( ) const
inline

Definition at line 72 of file editor.h.

References game_data, and rom.

Referenced by operator bool().

◆ HasRom()

bool yaze::editor::EditorContext::HasRom ( ) const
inline

Definition at line 73 of file editor.h.

References rom.

◆ HasGameData()

bool yaze::editor::EditorContext::HasGameData ( ) const
inline

Definition at line 74 of file editor.h.

References game_data.

◆ operator bool()

yaze::editor::EditorContext::operator bool ( ) const
inlineexplicit

Definition at line 77 of file editor.h.

References IsValid().

Here is the call graph for this function:

Member Data Documentation

◆ rom

◆ game_data


The documentation for this struct was generated from the following file: