2016-07-03 17:24:33 +00:00
|
|
|
// Copyright (c) 2016- PPSSPP Project.
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, version 2.0 or later versions.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official git repository and contact information can be found at
|
|
|
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2017-02-27 22:09:12 +00:00
|
|
|
#include <thread>
|
2017-02-27 20:57:46 +00:00
|
|
|
#include <mutex>
|
2016-10-12 09:32:24 +00:00
|
|
|
|
2020-10-04 18:48:47 +00:00
|
|
|
#include "Common/UI/UIScreen.h"
|
|
|
|
#include "Common/UI/ViewGroup.h"
|
2016-07-03 17:24:33 +00:00
|
|
|
#include "UI/MiscScreens.h"
|
2016-07-04 03:48:27 +00:00
|
|
|
#include "UI/MainScreen.h"
|
2016-07-03 17:24:33 +00:00
|
|
|
|
|
|
|
class RemoteISOScreen : public UIScreenWithBackground {
|
|
|
|
public:
|
|
|
|
RemoteISOScreen();
|
|
|
|
|
|
|
|
protected:
|
2017-03-15 05:01:18 +00:00
|
|
|
void update() override;
|
2016-07-03 17:24:33 +00:00
|
|
|
void CreateViews() override;
|
|
|
|
|
|
|
|
UI::EventReturn HandleStartServer(UI::EventParams &e);
|
|
|
|
UI::EventReturn HandleStopServer(UI::EventParams &e);
|
2016-07-04 00:38:29 +00:00
|
|
|
UI::EventReturn HandleBrowse(UI::EventParams &e);
|
2017-03-11 04:05:56 +00:00
|
|
|
UI::EventReturn HandleSettings(UI::EventParams &e);
|
2016-07-03 17:43:35 +00:00
|
|
|
|
2020-03-10 06:01:55 +00:00
|
|
|
UI::TextView *firewallWarning_ = nullptr;
|
|
|
|
bool serverRunning_ = false;
|
|
|
|
bool serverStopping_ = false;
|
2016-07-03 17:24:33 +00:00
|
|
|
};
|
2016-07-04 00:38:29 +00:00
|
|
|
|
2016-07-04 03:48:27 +00:00
|
|
|
enum class ScanStatus {
|
|
|
|
SCANNING,
|
|
|
|
RETRY_SCAN,
|
|
|
|
FOUND,
|
|
|
|
FAILED,
|
|
|
|
LOADING,
|
|
|
|
LOADED,
|
|
|
|
};
|
|
|
|
|
2016-07-04 00:38:29 +00:00
|
|
|
class RemoteISOConnectScreen : public UIScreenWithBackground {
|
|
|
|
public:
|
|
|
|
RemoteISOConnectScreen();
|
|
|
|
~RemoteISOConnectScreen() override;
|
|
|
|
|
|
|
|
protected:
|
2017-03-15 05:01:18 +00:00
|
|
|
void update() override;
|
2016-07-04 00:38:29 +00:00
|
|
|
void CreateViews() override;
|
|
|
|
|
2016-07-04 03:48:27 +00:00
|
|
|
ScanStatus GetStatus();
|
2016-07-04 00:38:29 +00:00
|
|
|
void ExecuteScan();
|
2016-07-04 03:48:27 +00:00
|
|
|
void ExecuteLoad();
|
2020-03-10 02:51:25 +00:00
|
|
|
bool FindServer(std::string &resultHost, int &resultPort);
|
2016-07-04 00:38:29 +00:00
|
|
|
|
2016-07-04 03:48:27 +00:00
|
|
|
UI::TextView *statusView_;
|
|
|
|
|
2020-03-10 02:51:25 +00:00
|
|
|
ScanStatus status_ = ScanStatus::SCANNING;
|
|
|
|
std::string statusMessage_;
|
|
|
|
double nextRetry_ = 0.0;
|
2016-07-04 00:38:29 +00:00
|
|
|
std::thread *scanThread_;
|
2017-02-27 20:57:46 +00:00
|
|
|
std::mutex statusLock_;
|
2016-07-04 03:48:27 +00:00
|
|
|
std::string host_;
|
|
|
|
int port_;
|
2019-10-06 19:40:00 +00:00
|
|
|
std::string url_;
|
2016-07-04 03:48:27 +00:00
|
|
|
std::vector<std::string> games_;
|
2016-07-04 00:38:29 +00:00
|
|
|
};
|
|
|
|
|
2016-07-04 03:48:27 +00:00
|
|
|
class RemoteISOBrowseScreen : public MainScreen {
|
2016-07-04 00:38:29 +00:00
|
|
|
public:
|
2019-10-06 19:40:00 +00:00
|
|
|
RemoteISOBrowseScreen(const std::string &url, const std::vector<std::string> &games);
|
2016-07-04 00:38:29 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void CreateViews() override;
|
2016-07-04 03:48:27 +00:00
|
|
|
|
2019-10-06 19:40:00 +00:00
|
|
|
std::string url_;
|
2016-07-04 03:48:27 +00:00
|
|
|
std::vector<std::string> games_;
|
2016-07-04 00:38:29 +00:00
|
|
|
};
|
2017-03-11 04:05:56 +00:00
|
|
|
|
2017-03-22 07:03:45 +00:00
|
|
|
class RemoteISOSettingsScreen : public UIDialogScreenWithBackground {
|
2017-03-11 04:05:56 +00:00
|
|
|
public:
|
2017-03-22 07:03:45 +00:00
|
|
|
RemoteISOSettingsScreen();
|
2017-03-11 04:05:56 +00:00
|
|
|
|
2017-11-16 12:33:10 +00:00
|
|
|
UI::EventReturn OnClickRemoteISOSubdir(UI::EventParams &e);
|
|
|
|
UI::EventReturn OnClickRemoteServer(UI::EventParams &e);
|
2017-03-11 04:05:56 +00:00
|
|
|
protected:
|
2017-11-16 12:33:10 +00:00
|
|
|
|
2017-03-22 07:03:45 +00:00
|
|
|
void update() override;
|
2017-03-11 04:05:56 +00:00
|
|
|
void CreateViews() override;
|
|
|
|
|
|
|
|
UI::EventReturn OnChangeRemoteISOSubdir(UI::EventParams &e);
|
|
|
|
|
2017-03-22 07:03:45 +00:00
|
|
|
bool serverRunning_ = false;
|
2017-03-15 05:01:18 +00:00
|
|
|
};
|