diff --git a/disc_menu.cpp b/disc_menu.cpp index 3673bc9..5ccd1cd 100644 --- a/disc_menu.cpp +++ b/disc_menu.cpp @@ -1,5 +1,7 @@ #include /* unlink */ +#include + #include "menu.hh" #include "file_browser.hh" #include "game_info.hh" @@ -25,6 +27,8 @@ public: void setDirectory(const char *path); + void runStartSequence(bool what); + /* Inherited */ void runLogic(); @@ -43,6 +47,7 @@ public: DiscMenu(Font *font) : FileBrowser(game_exts, font), TimeoutHandler() { + this->runStartSequence = false; } ~DiscMenu() @@ -101,6 +106,9 @@ public: else Gui::gui->updateGameInfo(new GameInfo(fileName)); Gui::gui->popView(); + + if (this->runStartSequence) + TheC64->startFakeKeySequence("\nLOAD \"*\",8,1\nRUN\n"); } virtual void hoverCallback(int which) @@ -120,6 +128,8 @@ public: Gui::gui->timerController->disarm(this); Gui::gui->popView(); } + + bool runStartSequence; }; @@ -145,6 +155,11 @@ void DiscView::setDirectory(const char *path) this->menu->setDirectory(path); } +void DiscView::runStartSequence(bool what) +{ + this->menu->runStartSequence = what; +} + void DiscView::runLogic() { this->menu->runLogic(); diff --git a/main_menu.cpp b/main_menu.cpp index 476ad23..9d4e161 100644 --- a/main_menu.cpp +++ b/main_menu.cpp @@ -57,10 +57,10 @@ public: this->updatePauseState(); break; case 2: /* Insert disc */ - if (this->p_submenus[0].sel == 0) { - Gui::gui->dv->setDirectory("discs"); - Gui::gui->pushView(Gui::gui->dv); - } + Gui::gui->dv->setDirectory("discs"); + Gui::gui->pushView(Gui::gui->dv); + + Gui::gui->dv->runStartSequence(this->p_submenus[0].sel == 1); break; case 4: /* Load/save states */ break; diff --git a/mocks/C64.h b/mocks/C64.h index 78a572c..61a30be 100644 --- a/mocks/C64.h +++ b/mocks/C64.h @@ -33,6 +33,11 @@ public: return this->have_a_break; } + void startFakeKeySequence(const char *what) + { + printf("Faking %s\n", what); + } + int network_connection_type; private: