http: Allow sharing automatically on PPSSPP start.

Since that might always be something you want, on your desktop.
This commit is contained in:
Unknown W. Brackets 2017-12-10 18:30:28 -08:00
parent caf9eca2db
commit 721f5877eb
5 changed files with 27 additions and 9 deletions

View File

@ -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__

View File

@ -143,6 +143,7 @@ public:
std::string sLastRemoteISOServer;
int iLastRemoteISOPort;
bool bRemoteISOManual;
bool bRemoteShareOnStartup;
std::string sRemoteISOSubdir;
bool bMemStickInserted;

View File

@ -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);

View File

@ -186,6 +186,20 @@ static void ExecuteServer() {
UpdateStatus(ServerStatus::STOPPED);
}
bool StartRemoteISOSharing() {
std::lock_guard<std::mutex> 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<std::mutex> 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

View File

@ -25,6 +25,8 @@
#include "UI/MiscScreens.h"
#include "UI/MainScreen.h"
bool StartRemoteISOSharing();
class RemoteISOScreen : public UIScreenWithBackground {
public:
RemoteISOScreen();