feat: Implement lazy initialization for Emulator and Renderer

- Updated Emulator to support optional lazy initialization of the renderer, enhancing flexibility during runtime.
- Introduced a new method in IRenderer for creating textures with specific pixel formats, improving texture management for the emulator.
- Refactored texture command processing in Arena to handle empty queues more gracefully.
- Enhanced SDL2Renderer to support the new texture creation method, ensuring compatibility with emulator requirements.
This commit is contained in:
scawful
2025-10-07 17:49:27 -04:00
parent 6c331f1fd0
commit 0c3c8ebca7
7 changed files with 63 additions and 13 deletions

View File

@@ -51,6 +51,7 @@ class Emulator {
audio_device_ = audio_device;
}
auto wanted_samples() const -> int { return wanted_samples_; }
void set_renderer(gfx::IRenderer* renderer) { renderer_ = renderer; }
// AI Agent Integration API
bool IsEmulatorReady() const { return snes_.running() && !rom_data_.empty(); }
@@ -133,6 +134,7 @@ class Emulator {
Snes snes_;
bool initialized_ = false;
bool snes_initialized_ = false;
gfx::IRenderer* renderer_ = nullptr;
void* ppu_texture_ = nullptr;