fix(emu): load GameData for render service

This commit is contained in:
scawful
2025-12-22 14:28:35 -05:00
parent 62734f3727
commit 344ef39d66
2 changed files with 16 additions and 0 deletions

View File

@@ -24,6 +24,21 @@ absl::Status EmulatorRenderService::Initialize() {
return absl::FailedPreconditionError("ROM not loaded"); return absl::FailedPreconditionError("ROM not loaded");
} }
if (!game_data_) {
owned_game_data_ = std::make_unique<zelda3::GameData>(rom_);
zelda3::LoadOptions options;
options.load_graphics = true;
options.load_palettes = true;
options.load_gfx_groups = true;
options.expand_rom = false;
options.populate_metadata = true;
auto data_status = zelda3::LoadGameData(*rom_, *owned_game_data_, options);
if (!data_status.ok()) {
return data_status;
}
game_data_ = owned_game_data_.get();
}
// Create SNES instance // Create SNES instance
snes_ = std::make_unique<emu::Snes>(); snes_ = std::make_unique<emu::Snes>();
const std::vector<uint8_t>& rom_data = rom_->vector(); const std::vector<uint8_t>& rom_data = rom_->vector();

View File

@@ -119,6 +119,7 @@ class EmulatorRenderService {
Rom* rom_ = nullptr; Rom* rom_ = nullptr;
zelda3::GameData* game_data_ = nullptr; zelda3::GameData* game_data_ = nullptr;
std::unique_ptr<zelda3::GameData> owned_game_data_;
std::unique_ptr<emu::Snes> snes_; std::unique_ptr<emu::Snes> snes_;
std::unique_ptr<SaveStateManager> state_manager_; std::unique_ptr<SaveStateManager> state_manager_;