Decouple emulator and frontend code

This commit is contained in:
offtkp
2023-10-18 01:12:59 +03:00
parent ab83fc1e71
commit fb0a2a6801
8 changed files with 411 additions and 364 deletions

View File

@@ -1,12 +1,11 @@
#include "emulator.hpp"
#include "panda_sdl/frontend_sdl.hpp"
int main(int argc, char *argv[]) {
Emulator emu;
emu.initGraphicsContext();
FrontendSDL frontend;
if (argc > 1) {
auto romPath = std::filesystem::current_path() / argv[1];
if (!emu.loadROM(romPath)) {
if (!frontend.loadROM(romPath)) {
// For some reason just .c_str() doesn't show the proper path
Helpers::panic("Failed to load ROM file: %s", romPath.string().c_str());
}
@@ -14,5 +13,5 @@ int main(int argc, char *argv[]) {
printf("No ROM inserted! Load a ROM by dragging and dropping it into the emulator window!\n");
}
emu.run();
frontend.run();
}