Files
yaze/src/app/emu/emulator.h
scawful 62230fbe5c Remove Windows ARM64 build configuration and delete unused generate-vs-projects.py script
- Removed the Windows ARM64 configuration from the GitHub Actions release workflow to streamline the build process.
- Deleted the generate-vs-projects.py script as it was no longer needed for project setup, simplifying the codebase.
- Updated the OverworldEditor header to improve clarity by renaming a method parameter for better understanding.
- Refactored the Emulator class to enhance the rendering interface, improving the user experience in the emulator's GUI.
2025-09-29 20:23:17 -04:00

104 lines
2.3 KiB
C++

#ifndef YAZE_APP_CORE_EMULATOR_H
#define YAZE_APP_CORE_EMULATOR_H
#include <cstdint>
#include <vector>
#include "app/emu/snes.h"
#include "app/rom.h"
#include "imgui/imgui.h"
namespace yaze {
/**
* @namespace yaze::emu
* @brief SNES Emulation and debugging tools.
*/
namespace emu {
struct EmulatorKeybindings {
ImGuiKey a_button = ImGuiKey_Z;
ImGuiKey b_button = ImGuiKey_A;
ImGuiKey x_button = ImGuiKey_S;
ImGuiKey y_button = ImGuiKey_X;
ImGuiKey l_button = ImGuiKey_Q;
ImGuiKey r_button = ImGuiKey_W;
ImGuiKey start_button = ImGuiKey_Enter;
ImGuiKey select_button = ImGuiKey_Backspace;
ImGuiKey up_button = ImGuiKey_UpArrow;
ImGuiKey down_button = ImGuiKey_DownArrow;
ImGuiKey left_button = ImGuiKey_LeftArrow;
ImGuiKey right_button = ImGuiKey_RightArrow;
};
/**
* @class Emulator
* @brief A class for emulating and debugging SNES games.
*/
class Emulator {
public:
Emulator() = default;
void Run();
auto snes() -> Snes& { return snes_; }
auto running() const -> bool { return running_; }
void set_audio_buffer(int16_t* audio_buffer) { audio_buffer_ = audio_buffer; }
auto set_audio_device_id(SDL_AudioDeviceID audio_device) {
audio_device_ = audio_device;
}
auto wanted_samples() const -> int { return wanted_samples_; }
auto rom() { return rom_; }
auto mutable_rom() { return rom_; }
private:
void RenderNavBar();
void HandleEvents();
void RenderEmulatorInterface();
void RenderSnesPpu();
void RenderBreakpointList();
void RenderMemoryViewer();
struct Bookmark {
std::string name;
uint64_t value;
};
std::vector<Bookmark> bookmarks;
void RenderCpuInstructionLog(
const std::vector<InstructionEntry>& instructionLog);
bool step_ = true;
bool power_ = false;
bool loading_ = false;
bool running_ = false;
bool turbo_mode_ = false;
float wanted_frames_;
int wanted_samples_;
uint8_t manual_pb_ = 0;
uint16_t manual_pc_ = 0;
// timing
uint64_t count_frequency;
uint64_t last_count;
float time_adder = 0.0;
int16_t* audio_buffer_;
SDL_AudioDeviceID audio_device_;
Rom* rom_;
Snes snes_;
SDL_Texture* ppu_texture_;
std::vector<uint8_t> rom_data_;
EmulatorKeybindings keybindings_;
};
} // namespace emu
} // namespace yaze
#endif // YAZE_APP_CORE_EMULATOR_H