Add start sequence faking

This commit is contained in:
simon.kagstrom 2010-01-25 10:59:08 +00:00
parent 6d8fd6fc92
commit 5a0a4dbb82
3 changed files with 24 additions and 4 deletions

View File

@ -1,5 +1,7 @@
#include <unistd.h> /* unlink */ #include <unistd.h> /* unlink */
#include <C64.h>
#include "menu.hh" #include "menu.hh"
#include "file_browser.hh" #include "file_browser.hh"
#include "game_info.hh" #include "game_info.hh"
@ -25,6 +27,8 @@ public:
void setDirectory(const char *path); void setDirectory(const char *path);
void runStartSequence(bool what);
/* Inherited */ /* Inherited */
void runLogic(); void runLogic();
@ -43,6 +47,7 @@ public:
DiscMenu(Font *font) : DiscMenu(Font *font) :
FileBrowser(game_exts, font), TimeoutHandler() FileBrowser(game_exts, font), TimeoutHandler()
{ {
this->runStartSequence = false;
} }
~DiscMenu() ~DiscMenu()
@ -101,6 +106,9 @@ public:
else else
Gui::gui->updateGameInfo(new GameInfo(fileName)); Gui::gui->updateGameInfo(new GameInfo(fileName));
Gui::gui->popView(); Gui::gui->popView();
if (this->runStartSequence)
TheC64->startFakeKeySequence("\nLOAD \"*\",8,1\nRUN\n");
} }
virtual void hoverCallback(int which) virtual void hoverCallback(int which)
@ -120,6 +128,8 @@ public:
Gui::gui->timerController->disarm(this); Gui::gui->timerController->disarm(this);
Gui::gui->popView(); Gui::gui->popView();
} }
bool runStartSequence;
}; };
@ -145,6 +155,11 @@ void DiscView::setDirectory(const char *path)
this->menu->setDirectory(path); this->menu->setDirectory(path);
} }
void DiscView::runStartSequence(bool what)
{
this->menu->runStartSequence = what;
}
void DiscView::runLogic() void DiscView::runLogic()
{ {
this->menu->runLogic(); this->menu->runLogic();

View File

@ -57,10 +57,10 @@ public:
this->updatePauseState(); this->updatePauseState();
break; break;
case 2: /* Insert disc */ case 2: /* Insert disc */
if (this->p_submenus[0].sel == 0) { Gui::gui->dv->setDirectory("discs");
Gui::gui->dv->setDirectory("discs"); Gui::gui->pushView(Gui::gui->dv);
Gui::gui->pushView(Gui::gui->dv);
} Gui::gui->dv->runStartSequence(this->p_submenus[0].sel == 1);
break; break;
case 4: /* Load/save states */ case 4: /* Load/save states */
break; break;

View File

@ -33,6 +33,11 @@ public:
return this->have_a_break; return this->have_a_break;
} }
void startFakeKeySequence(const char *what)
{
printf("Faking %s\n", what);
}
int network_connection_type; int network_connection_type;
private: private: