mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Remember Last Remote ISO server
This commit is contained in:
1 parent
3653b12dac
commit
a404138f82
3 files changed
+21
No files matched your search
@@ -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),
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user