Skip to content

Commit

Permalink
Decouple emulator and frontend code
Browse files Browse the repository at this point in the history
  • Loading branch information
OFFTKP committed Oct 18, 2023
1 parent ab83fc1 commit f15614a
Show file tree
Hide file tree
Showing 7 changed files with 392 additions and 365 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,14 @@ set(RENDERER_SW_SOURCE_FILES src/core/renderer_sw/renderer_sw.cpp)

# Frontend source files
if(ENABLE_QT_GUI)
set(FRONTEND_SOURCE_FILES src/panda_qt/main.cpp src/panda_qt/screen.cpp src/panda_qt/main_window.cpp)
set(FRONTEND_SOURCE_FILES src/panda_qt/main.cpp src/panda_qt/screen.cpp src/panda_qt/main_window.cpp src/panda_qt/frontend_qt.cpp)
set(FRONTEND_HEADER_FILES include/panda_qt/screen.hpp include/panda_qt/main_window.hpp)

source_group("Source Files\\Qt" FILES ${FRONTEND_SOURCE_FILES})
source_group("Header Files\\Qt" FILES ${FRONTEND_HEADER_FILES})
include_directories(${Qt6Gui_PRIVATE_INCLUDE_DIRS})
else()
set(FRONTEND_SOURCE_FILES src/panda_sdl/main.cpp)
set(FRONTEND_SOURCE_FILES src/panda_sdl/main.cpp src/panda_sdl/frontend_sdl.cpp)
set(FRONTEND_HEADER_FILES "")
endif()

Expand Down
19 changes: 1 addition & 18 deletions include/emulator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
#include "http_server.hpp"
#endif

#ifdef PANDA3DS_FRONTEND_QT
#include "gl/context.h"
#endif

enum class ROMType {
None,
ELF,
Expand All @@ -42,14 +38,6 @@ class Emulator {
Crypto::AESEngine aesEngine;
Cheats cheats;

#ifdef PANDA3DS_FRONTEND_SDL
SDL_Window* window;

#ifdef PANDA3DS_ENABLE_OPENGL
SDL_GLContext glContext;
#endif
#endif

SDL_GameController* gameController = nullptr;
int gameControllerID;

Expand Down Expand Up @@ -114,12 +102,7 @@ class Emulator {
bool loadELF(const std::filesystem::path& path);
bool loadELF(std::ifstream& file);

#ifdef PANDA3DS_FRONTEND_QT
// For passing the GL context from Qt to the renderer
void initGraphicsContext(GL::Context* glContext) { gpu.initGraphicsContext(nullptr); }
#else
void initGraphicsContext() { gpu.initGraphicsContext(window); }
#endif
void initFrontend();

RomFS::DumpingResult dumpRomFS(const std::filesystem::path& path);
void setOutputSize(u32 width, u32 height) { gpu.setOutputSize(width, height); }
Expand Down
Loading

0 comments on commit f15614a

Please sign in to comment.