Remember Last Remote ISO server

This commit is contained in:
Fireball Wayne committed 2017-02-14 19:16:51 -05:00
1 parent 3653b12dac
commit a404138f82
3 files changed
+21

No files matched your search

+2
View File
@@ -339,6 +339,8 @@ static ConfigSetting generalSettings[] = {
ConfigSetting("AutoSaveSymbolMap", &g_Config.bAutoSaveSymbolMap, false, true, true),
ConfigSetting("CacheFullIsoInRam", &g_Config.bCacheFullIsoInRam, false, true, true),
ConfigSetting("RemoteISOPort", &g_Config.iRemoteISOPort, 0, true, false),
ConfigSetting("LastRemoteISOServer", &g_Config.sLastRemoteISOServer, ""),
ConfigSetting("LastRemoteISOPort", &g_Config.iLastRemoteISOPort, 0),
#ifdef __ANDROID__
ConfigSetting("ScreenRotation", &g_Config.iScreenRotation, 1),
+2
View File
@@ -141,6 +141,8 @@ public:
bool bAutoSaveSymbolMap;
bool bCacheFullIsoInRam;
int iRemoteISOPort;
std::string sLastRemoteISOServer;
int iLastRemoteISOPort;
bool bMemStickInserted;
int iScreenRotation; // The rotation angle of the PPSSPP UI. Only supported on Android and possibly other mobile platforms.
+17
View File
@@ -188,6 +188,17 @@ static bool FindServer(std::string &resultHost, int &resultPort) {
Buffer result;
int code = 500;
// Not sure why this is needed here, but windows fails without it.
net::Init();
// Try last server first, if it is set
if (g_Config.iLastRemoteISOPort && g_Config.sLastRemoteISOServer != "" && http.Resolve(g_Config.sLastRemoteISOServer.c_str(), g_Config.iLastRemoteISOPort) && http.Connect()) {
http.Disconnect();
resultHost = g_Config.sLastRemoteISOServer;
resultPort = g_Config.iLastRemoteISOPort;
return true;
}
// Start by requesting a list of recent local ips for this network.
if (http.Resolve(REPORT_HOSTNAME, REPORT_PORT)) {
if (http.Connect()) {
@@ -269,6 +280,12 @@ static bool LoadGameList(const std::string &host, int port, std::vector<std::str
games.push_back(temp);
}
//save for next time
if (!games.empty()){
g_Config.sLastRemoteISOServer = host;
g_Config.iLastRemoteISOPort = port;
}
return !games.empty();
}