created auto load feature

This commit is contained in:
Siddharth 2013-10-30 22:46:27 +05:30
parent 122f19a3cf
commit 6cd5b748eb
5 changed files with 23 additions and 0 deletions

View File

@ -72,6 +72,7 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
general->Get("Language", &sLanguageIni, defaultLangRegion.c_str());
general->Get("NumWorkerThreads", &iNumWorkerThreads, cpu_info.num_cores);
general->Get("EnableAutoLoad", &bEnableAutoLoad, true);
general->Get("EnableCheats", &bEnableCheats, false);
general->Get("ScreenshotsAsPNG", &bScreenshotsAsPNG, false);
general->Get("StateSlot", &iCurrentStateSlot, 0);
@ -336,6 +337,7 @@ void Config::Save() {
#endif
general->Set("Language", sLanguageIni);
general->Set("NumWorkerThreads", iNumWorkerThreads);
general->Set("EnableAutoLoad", bEnableAutoLoad);
general->Set("EnableCheats", bEnableCheats);
general->Set("ScreenshotsAsPNG", bScreenshotsAsPNG);
general->Set("StateSlot", iCurrentStateSlot);

View File

@ -92,6 +92,7 @@ public:
int iForceMaxEmulatedFPS;
int iMaxRecent;
int iCurrentStateSlot;
bool bEnableAutoLoad;
bool bEnableCheats;
bool bReloadCheats;
bool bDisableStencilTest;

View File

@ -41,6 +41,7 @@
#include "Core/HLE/sceCtrl.h"
#include "Core/HLE/sceDisplay.h"
#include "Core/Debugger/SymbolMap.h"
#include "Core/SaveState.h"
#include "UI/OnScreenDisplay.h"
#include "UI/ui_atlas.h"
@ -122,6 +123,8 @@ void EmuScreen::bootGame(const std::string &filename) {
if (strstr(renderer, "Chainfire3D") != 0) {
osm.Show(s->T("Chainfire3DWarning", "WARNING: Chainfire3D detected, may cause problems"), 10.0f, 0xFF30a0FF, -1, true);
}
autoLoad();
}
EmuScreen::~EmuScreen() {
@ -138,6 +141,13 @@ void EmuScreen::dialogFinished(const Screen *dialog, DialogResult result) {
if (result == DR_OK) {
screenManager()->switchScreen(new MainScreen());
}
//user didn't click continue. he went back to the main screen and is loading
//the game from there.
if(result != DR_CANCEL && result != DR_BACK){
autoLoad();
}
RecreateViews();
}
@ -620,3 +630,10 @@ void EmuScreen::deviceLost() {
if (gpu)
gpu->DeviceLost();
}
void EmuScreen::autoLoad(){
//check if save state has save, if so, load
if(g_Config.bEnableAutoLoad && SaveState::HasSaveInSlot(g_Config.iCurrentStateSlot)){
SaveState::LoadSlot(g_Config.iCurrentStateSlot, 0, 0);
}
};

View File

@ -55,6 +55,8 @@ private:
void setVKeyAnalogX(int stick, int virtualKeyMin, int virtualKeyMax);
void setVKeyAnalogY(int stick, int virtualKeyMin, int virtualKeyMax);
void autoLoad();
bool booted_;
std::string gamePath_;

View File

@ -264,6 +264,7 @@ void GameSettingsScreen::CreateViews() {
systemSettings->Add(new Choice(s->T("Developer Tools")))->OnClick.Handle(this, &GameSettingsScreen::OnDeveloperTools);
systemSettings->Add(new Choice(s->T("Clear Recent Games List")))->OnClick.Handle(this, &GameSettingsScreen::OnClearRecents);
systemSettings->Add(new Choice(s->T("Restore Default Settings")))->OnClick.Handle(this, &GameSettingsScreen::OnRestoreDefaultSettings);
systemSettings->Add(new CheckBox(&g_Config.bEnableAutoLoad, s->T("Enable Auto Load")));
enableReportsCheckbox_ = new CheckBox(&enableReports_, s->T("Enable Compatibility Server Reports"));
enableReportsCheckbox_->SetEnabled(Reporting::IsSupported());
systemSettings->Add(enableReportsCheckbox_);