Refactor emulator code: update SNES references to Snes for consistency, clean up includes, and remove commented-out code
This commit is contained in:
@@ -1,6 +1,4 @@
|
|||||||
#if defined(_WIN32)
|
#if __APPLE__
|
||||||
#define main SDL_main
|
|
||||||
#elif __APPLE__
|
|
||||||
#include "app/core/platform/app_delegate.h"
|
#include "app/core/platform/app_delegate.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -10,24 +8,13 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "absl/base/internal/raw_logging.h"
|
|
||||||
#include "absl/base/macros.h"
|
|
||||||
#include "absl/container/flat_hash_map.h"
|
|
||||||
#include "absl/debugging/failure_signal_handler.h"
|
#include "absl/debugging/failure_signal_handler.h"
|
||||||
#include "absl/debugging/leak_check.h"
|
|
||||||
#include "absl/debugging/stacktrace.h"
|
|
||||||
#include "absl/debugging/symbolize.h"
|
#include "absl/debugging/symbolize.h"
|
||||||
#include "absl/flags/flag.h"
|
|
||||||
#include "absl/status/status.h"
|
#include "absl/status/status.h"
|
||||||
#include "absl/status/statusor.h"
|
|
||||||
#include "absl/strings/str_format.h"
|
|
||||||
#include "app/core/utils/sdl_deleter.h"
|
#include "app/core/utils/sdl_deleter.h"
|
||||||
#include "app/emu/snes.h"
|
#include "app/emu/snes.h"
|
||||||
#include "app/rom.h"
|
#include "app/rom.h"
|
||||||
#include "imgui/imgui.h"
|
|
||||||
#include "imgui_memory_editor.h"
|
|
||||||
|
|
||||||
using namespace yaze;
|
|
||||||
using yaze::core::SDL_Deleter;
|
using yaze::core::SDL_Deleter;
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
@@ -38,6 +25,8 @@ int main(int argc, char **argv) {
|
|||||||
options.alarm_on_failure_secs = true;
|
options.alarm_on_failure_secs = true;
|
||||||
absl::InstallFailureSignalHandler(options);
|
absl::InstallFailureSignalHandler(options);
|
||||||
|
|
||||||
|
SDL_SetMainReady();
|
||||||
|
|
||||||
std::unique_ptr<SDL_Window, SDL_Deleter> window_;
|
std::unique_ptr<SDL_Window, SDL_Deleter> window_;
|
||||||
std::unique_ptr<SDL_Renderer, SDL_Deleter> renderer_;
|
std::unique_ptr<SDL_Renderer, SDL_Deleter> renderer_;
|
||||||
if (SDL_Init(SDL_INIT_EVERYTHING) != 0) {
|
if (SDL_Init(SDL_INIT_EVERYTHING) != 0) {
|
||||||
@@ -96,8 +85,8 @@ int main(int argc, char **argv) {
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Rom rom_;
|
yaze::Rom rom_;
|
||||||
emu::SNES snes_;
|
yaze::emu::Snes snes_;
|
||||||
std::vector<uint8_t> rom_data_;
|
std::vector<uint8_t> rom_data_;
|
||||||
|
|
||||||
bool running = true;
|
bool running = true;
|
||||||
@@ -191,10 +180,10 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
SDL_PauseAudioDevice(audio_device_, 1);
|
SDL_PauseAudioDevice(audio_device_, 1);
|
||||||
SDL_CloseAudioDevice(audio_device_);
|
SDL_CloseAudioDevice(audio_device_);
|
||||||
delete audio_buffer_;
|
delete[] audio_buffer_;
|
||||||
// ImGui_ImplSDLRenderer2_Shutdown();
|
//ImGui_ImplSDLRenderer2_Shutdown();
|
||||||
// ImGui_ImplSDL2_Shutdown();
|
//ImGui_ImplSDL2_Shutdown();
|
||||||
// ImGui::DestroyContext();
|
//ImGui::DestroyContext();
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
|||||||
@@ -3,14 +3,11 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "app/core/constants.h"
|
|
||||||
#include "app/core/platform/file_dialog.h"
|
#include "app/core/platform/file_dialog.h"
|
||||||
#include "app/core/platform/renderer.h"
|
#include "app/core/platform/renderer.h"
|
||||||
#include "app/emu/snes.h"
|
|
||||||
#include "app/gui/icons.h"
|
#include "app/gui/icons.h"
|
||||||
#include "app/gui/input.h"
|
#include "app/gui/input.h"
|
||||||
#include "app/gui/zeml.h"
|
#include "app/gui/zeml.h"
|
||||||
#include "app/rom.h"
|
|
||||||
#include "imgui/imgui.h"
|
#include "imgui/imgui.h"
|
||||||
#include "imgui_memory_editor.h"
|
#include "imgui_memory_editor.h"
|
||||||
|
|
||||||
|
|||||||
@@ -17,31 +17,6 @@ namespace yaze {
|
|||||||
*/
|
*/
|
||||||
namespace emu {
|
namespace emu {
|
||||||
|
|
||||||
// case SDLK_z:
|
|
||||||
// editor.emulator().snes().SetButtonState(1, 0, false);
|
|
||||||
// case SDLK_a:
|
|
||||||
// editor.emulator().snes().SetButtonState(1, 1, false);
|
|
||||||
// case SDLK_RSHIFT:
|
|
||||||
// editor.emulator().snes().SetButtonState(1, 2, false);
|
|
||||||
// case SDLK_RETURN:
|
|
||||||
// editor.emulator().snes().SetButtonState(1, 3, false);
|
|
||||||
// case SDLK_UP:
|
|
||||||
// editor.emulator().snes().SetButtonState(1, 4, false);
|
|
||||||
// case SDLK_DOWN:
|
|
||||||
// editor.emulator().snes().SetButtonState(1, 5, false);
|
|
||||||
// case SDLK_LEFT:
|
|
||||||
// editor.emulator().snes().SetButtonState(1, 6, false);
|
|
||||||
// case SDLK_RIGHT:
|
|
||||||
// editor.emulator().snes().SetButtonState(1, 7, false);
|
|
||||||
// case SDLK_x:
|
|
||||||
// editor.emulator().snes().SetButtonState(1, 8, false);
|
|
||||||
// case SDLK_s:
|
|
||||||
// editor.emulator().snes().SetButtonState(1, 9, false);
|
|
||||||
// case SDLK_d:
|
|
||||||
// editor.emulator().snes().SetButtonState(1, 10, false);
|
|
||||||
// case SDLK_c:
|
|
||||||
// editor.emulator().snes().SetButtonState(1, 11, false);
|
|
||||||
|
|
||||||
struct EmulatorKeybindings {
|
struct EmulatorKeybindings {
|
||||||
ImGuiKey a_button = ImGuiKey_Z;
|
ImGuiKey a_button = ImGuiKey_Z;
|
||||||
ImGuiKey b_button = ImGuiKey_A;
|
ImGuiKey b_button = ImGuiKey_A;
|
||||||
@@ -133,7 +108,7 @@ class Emulator : public SharedRom {
|
|||||||
}
|
}
|
||||||
void Run();
|
void Run();
|
||||||
|
|
||||||
auto snes() -> SNES& { return snes_; }
|
auto snes() -> Snes& { return snes_; }
|
||||||
auto running() const -> bool { return running_; }
|
auto running() const -> bool { return running_; }
|
||||||
void set_audio_buffer(int16_t* audio_buffer) { audio_buffer_ = audio_buffer; }
|
void set_audio_buffer(int16_t* audio_buffer) { audio_buffer_ = audio_buffer; }
|
||||||
auto set_audio_device_id(SDL_AudioDeviceID audio_device) {
|
auto set_audio_device_id(SDL_AudioDeviceID audio_device) {
|
||||||
@@ -178,7 +153,7 @@ class Emulator : public SharedRom {
|
|||||||
int16_t* audio_buffer_;
|
int16_t* audio_buffer_;
|
||||||
SDL_AudioDeviceID audio_device_;
|
SDL_AudioDeviceID audio_device_;
|
||||||
|
|
||||||
SNES snes_;
|
Snes snes_;
|
||||||
SDL_Texture* ppu_texture_;
|
SDL_Texture* ppu_texture_;
|
||||||
|
|
||||||
std::vector<uint8_t> rom_data_;
|
std::vector<uint8_t> rom_data_;
|
||||||
@@ -189,7 +164,6 @@ class Emulator : public SharedRom {
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace emu
|
} // namespace emu
|
||||||
|
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
|
|
||||||
#endif // YAZE_APP_CORE_EMULATOR_H
|
#endif // YAZE_APP_CORE_EMULATOR_H
|
||||||
|
|||||||
Reference in New Issue
Block a user