Permalink
Browse files

http: Allow sharing automatically on PPSSPP start.

Since that might always be something you want, on your desktop.
  • Loading branch information...
unknownbrackets committed Dec 11, 2017
1 parent caf9eca commit 721f5877ebe7a5d87c619fe00650487a7e8406b7
Showing with 27 additions and 9 deletions.
  1. +1 −0 Core/Config.cpp
  2. +1 −0 Core/Config.h
  3. +5 −0 UI/NativeApp.cpp
  4. +18 −9 UI/RemoteISOScreen.cpp
  5. +2 −0 UI/RemoteISOScreen.h
View
@@ -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
@@ -143,6 +143,7 @@ struct Config {
std::string sLastRemoteISOServer;
int iLastRemoteISOPort;
bool bRemoteISOManual;
bool bRemoteShareOnStartup;
std::string sRemoteISOSubdir;
bool bMemStickInserted;
View
@@ -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
@@ -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
@@ -25,6 +25,8 @@
#include "UI/MiscScreens.h"
#include "UI/MainScreen.h"
bool StartRemoteISOSharing();
class RemoteISOScreen : public UIScreenWithBackground {
public:
RemoteISOScreen();

0 comments on commit 721f587

Please sign in to comment.