Move Emulator to emu namespace

This commit is contained in:
scawful
2023-11-12 10:17:25 -05:00
parent 8677fdaa20
commit 6ae969d345
6 changed files with 32 additions and 11 deletions

View File

@@ -2,7 +2,7 @@ set(
YAZE_APP_CORE_SRC YAZE_APP_CORE_SRC
app/core/common.cc app/core/common.cc
app/core/controller.cc app/core/controller.cc
app/core/emulator.cc
app/core/pipeline.cc app/core/pipeline.cc
) )

View File

@@ -2,6 +2,7 @@ add_executable(
yaze yaze
app/yaze.cc app/yaze.cc
app/rom.cc app/rom.cc
app/emu/emulator.cc
app/emu/audio/apu.cc app/emu/audio/apu.cc
app/emu/audio/spc700.cc app/emu/audio/spc700.cc
app/emu/audio/dsp.cc app/emu/audio/dsp.cc

View File

@@ -7,12 +7,18 @@
#include <imgui_memory_editor.h> #include <imgui_memory_editor.h>
#include "absl/status/status.h" #include "absl/status/status.h"
#include "app/core/common.h"
#include "app/core/constants.h" #include "app/core/constants.h"
#include "app/core/pipeline.h" #include "app/core/pipeline.h"
#include "app/editor/dungeon_editor.h" #include "app/editor/dungeon_editor.h"
#include "app/editor/graphics_editor.h"
#include "app/editor/modules/assembly_editor.h" #include "app/editor/modules/assembly_editor.h"
#include "app/editor/music_editor.h" #include "app/editor/music_editor.h"
#include "app/editor/overworld_editor.h" #include "app/editor/overworld_editor.h"
#include "app/editor/palette_editor.h"
#include "app/editor/screen_editor.h"
#include "app/editor/sprite_editor.h"
#include "app/emu/emulator.h"
#include "app/gfx/snes_palette.h" #include "app/gfx/snes_palette.h"
#include "app/gfx/snes_tile.h" #include "app/gfx/snes_tile.h"
#include "app/gui/canvas.h" #include "app/gui/canvas.h"
@@ -177,11 +183,14 @@ void MasterEditor::DrawYazeMenu() {
DrawHelpMenu(); DrawHelpMenu();
END_MENU_BAR() END_MENU_BAR()
} }
void MasterEditor::DrawFileMenu() { void MasterEditor::DrawFileMenu() {
static bool save_as_menu = false; static bool save_as_menu = false;
if (ImGui::BeginMenu("File")) { if (ImGui::BeginMenu("File")) {
if (ImGui::MenuItem("New", "Ctrl+N")) {
// TODO: Implement new ROM creation.
}
if (ImGui::MenuItem("Open", "Ctrl+O")) { if (ImGui::MenuItem("Open", "Ctrl+O")) {
ImGuiFileDialog::Instance()->OpenDialog("ChooseFileDlgKey", "Open ROM", ImGuiFileDialog::Instance()->OpenDialog("ChooseFileDlgKey", "Open ROM",
".sfc,.smc", "."); ".sfc,.smc", ".");
@@ -206,16 +215,25 @@ void MasterEditor::DrawFileMenu() {
&mutable_flags()->kUseBitmapManager); &mutable_flags()->kUseBitmapManager);
ImGui::EndMenu(); ImGui::EndMenu();
} }
ImGui::Separator();
if (ImGui::MenuItem("Quit", "Ctrl+Q")) {
// TODO: Implement quit confirmation dialog.
}
ImGui::EndMenu(); ImGui::EndMenu();
} }
if (save_as_menu) { if (save_as_menu) {
static std::string save_as_filename = ""; static std::string save_as_filename = "";
ImGui::Begin("Save As..", nullptr, ImGuiWindowFlags_AlwaysAutoResize); ImGui::Begin("Save As..", &save_as_menu, ImGuiWindowFlags_AlwaysAutoResize);
ImGui::InputText("Filename", &save_as_filename); ImGui::InputText("Filename", &save_as_filename);
if (ImGui::Button("Save", gui::kDefaultModalSize)) { if (ImGui::Button("Save", gui::kDefaultModalSize)) {
status_ = rom()->SaveToFile(backup_rom_, save_as_filename); status_ = rom()->SaveToFile(backup_rom_, save_as_filename);
save_as_menu = false;
} }
ImGui::SameLine();
if (ImGui::Button("Cancel", gui::kDefaultModalSize)) { if (ImGui::Button("Cancel", gui::kDefaultModalSize)) {
save_as_menu = false; save_as_menu = false;
} }

View File

@@ -10,7 +10,6 @@
#include "absl/status/status.h" #include "absl/status/status.h"
#include "app/core/common.h" #include "app/core/common.h"
#include "app/core/constants.h" #include "app/core/constants.h"
#include "app/core/emulator.h"
#include "app/core/pipeline.h" #include "app/core/pipeline.h"
#include "app/editor/dungeon_editor.h" #include "app/editor/dungeon_editor.h"
#include "app/editor/graphics_editor.h" #include "app/editor/graphics_editor.h"
@@ -20,6 +19,7 @@
#include "app/editor/palette_editor.h" #include "app/editor/palette_editor.h"
#include "app/editor/screen_editor.h" #include "app/editor/screen_editor.h"
#include "app/editor/sprite_editor.h" #include "app/editor/sprite_editor.h"
#include "app/emu/emulator.h"
#include "app/gfx/snes_palette.h" #include "app/gfx/snes_palette.h"
#include "app/gfx/snes_tile.h" #include "app/gfx/snes_tile.h"
#include "app/gui/canvas.h" #include "app/gui/canvas.h"
@@ -59,7 +59,7 @@ class MasterEditor : public SharedROM, public core::ExperimentFlags {
std::shared_ptr<SDL_Renderer> sdl_renderer_; std::shared_ptr<SDL_Renderer> sdl_renderer_;
core::Emulator emulator_; emu::Emulator emulator_;
AssemblyEditor assembly_editor_; AssemblyEditor assembly_editor_;
DungeonEditor dungeon_editor_; DungeonEditor dungeon_editor_;
GraphicsEditor graphics_editor_; GraphicsEditor graphics_editor_;

View File

@@ -1,13 +1,15 @@
#include "app/core/emulator.h" #include "app/emu/emulator.h"
#include <cstdint> #include <cstdint>
#include <vector> #include <vector>
#include "app/core/constants.h" #include "app/core/constants.h"
#include "app/emu/snes.h"
#include "app/rom.h"
namespace yaze { namespace yaze {
namespace app { namespace app {
namespace core { namespace emu {
void Emulator::Run() { void Emulator::Run() {
// Initialize the emulator if a ROM is loaded // Initialize the emulator if a ROM is loaded
@@ -80,6 +82,6 @@ void Emulator::UpdateEmulator() {
snes_.Run(); snes_.Run();
} }
} // namespace core } // namespace emu
} // namespace app } // namespace app
} // namespace yaze } // namespace yaze

View File

@@ -9,7 +9,7 @@
namespace yaze { namespace yaze {
namespace app { namespace app {
namespace core { namespace emu {
class Emulator : public SharedROM { class Emulator : public SharedROM {
public: public:
@@ -30,13 +30,13 @@ class Emulator : public SharedROM {
void UpdateEmulator(); void UpdateEmulator();
// Member variables to store internal state and resources // Member variables to store internal state and resources
emu::SNES snes_; SNES snes_;
bool running_ = false; bool running_ = false;
bool show_ppu_reg_viewer_ = false; bool show_ppu_reg_viewer_ = false;
}; };
} // namespace core } // namespace emu
} // namespace app } // namespace app
} // namespace yaze } // namespace yaze