diff --git a/Core/Config.cpp b/Core/Config.cpp index 44661820b0..9f6869f757 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -377,6 +377,7 @@ static ConfigSetting generalSettings[] = { ConfigSetting("LastRemoteISOServer", &g_Config.sLastRemoteISOServer, ""), ConfigSetting("LastRemoteISOPort", &g_Config.iLastRemoteISOPort, 0), ConfigSetting("RemoteISOManualConfig", &g_Config.bRemoteISOManual, false), + ConfigSetting("RemoteShareOnStartup", &g_Config.bRemoteShareOnStartup, false), ConfigSetting("RemoteISOSubdir", &g_Config.sRemoteISOSubdir, "/"), #ifdef __ANDROID__ diff --git a/Core/Config.h b/Core/Config.h index 25882624e3..09171057e1 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -143,6 +143,7 @@ public: std::string sLastRemoteISOServer; int iLastRemoteISOPort; bool bRemoteISOManual; + bool bRemoteShareOnStartup; std::string sRemoteISOSubdir; bool bMemStickInserted; diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index bd7c165699..a56bebe199 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -92,6 +92,7 @@ #include "UI/HostTypes.h" #include "UI/OnScreenDisplay.h" #include "UI/MiscScreens.h" +#include "UI/RemoteISOScreen.h" #include "UI/TiltEventProcessor.h" #include "UI/BackgroundAudio.h" #include "UI/TextureUtil.h" @@ -544,6 +545,10 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch screenManager->switchScreen(new LogoScreen()); } + if (g_Config.bRemoteShareOnStartup) { + StartRemoteISOSharing(); + } + std::string sysName = System_GetProperty(SYSPROP_NAME); isOuya = KeyMap::IsOuya(sysName); diff --git a/UI/RemoteISOScreen.cpp b/UI/RemoteISOScreen.cpp index 71cf9bf88c..638a93a0db 100644 --- a/UI/RemoteISOScreen.cpp +++ b/UI/RemoteISOScreen.cpp @@ -186,6 +186,20 @@ static void ExecuteServer() { UpdateStatus(ServerStatus::STOPPED); } +bool StartRemoteISOSharing() { + std::lock_guard guard(serverStatusLock); + + if (serverStatus != ServerStatus::STOPPED) { + return false; + } + + serverStatus = ServerStatus::STARTING; + serverThread = new std::thread(&ExecuteServer); + serverThread->detach(); + + return true; +} + static bool FindServer(std::string &resultHost, int &resultPort) { http::Client http; Buffer result; @@ -412,16 +426,10 @@ void RemoteISOScreen::CreateViews() { } UI::EventReturn RemoteISOScreen::HandleStartServer(UI::EventParams &e) { - std::lock_guard guard(serverStatusLock); - - if (serverStatus != ServerStatus::STOPPED) { + if (!StartRemoteISOSharing()) { return EVENT_SKIPPED; } - serverStatus = ServerStatus::STARTING; - serverThread = new std::thread(&ExecuteServer); - serverThread->detach(); - return EVENT_DONE; } @@ -651,7 +659,7 @@ void RemoteISOBrowseScreen::CreateViews() { } RemoteISOSettingsScreen::RemoteISOSettingsScreen() { - serverRunning_ = RetrieveStatus() != ServerStatus::STOPPED;; + serverRunning_ = RetrieveStatus() != ServerStatus::STOPPED; } void RemoteISOSettingsScreen::update() { @@ -674,7 +682,8 @@ void RemoteISOSettingsScreen::CreateViews() { remoteisoSettingsScroll->Add(remoteisoSettings); remoteisoSettings->Add(new ItemHeader(ri->T("Remote disc streaming"))); - remoteisoSettings->Add(new CheckBox(&g_Config.bRemoteISOManual, ri->T("Manual Mode Client", "Manual Mode Client"))); + remoteisoSettings->Add(new CheckBox(&g_Config.bRemoteShareOnStartup, ri->T("Share on PPSSPP startup"))); + remoteisoSettings->Add(new CheckBox(&g_Config.bRemoteISOManual, ri->T("Manual Mode Client", "Manually configure client"))); #if !defined(MOBILE_DEVICE) PopupTextInputChoice *remoteServer = remoteisoSettings->Add(new PopupTextInputChoice(&g_Config.sLastRemoteISOServer, ri->T("Remote Server"), "", 255, screenManager())); #else diff --git a/UI/RemoteISOScreen.h b/UI/RemoteISOScreen.h index b7f7ff0f5c..a4384d793e 100644 --- a/UI/RemoteISOScreen.h +++ b/UI/RemoteISOScreen.h @@ -25,6 +25,8 @@ #include "UI/MiscScreens.h" #include "UI/MainScreen.h" +bool StartRemoteISOSharing(); + class RemoteISOScreen : public UIScreenWithBackground { public: RemoteISOScreen();