2016-07-03 10:24:33 -07: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 23:09:12 +01:00
|
|
|
#include <thread>
|
2017-02-27 21:57:46 +01:00
|
|
|
#include <mutex>
|
2016-10-12 11:32:24 +02:00
|
|
|
|
2020-10-04 20:48:47 +02:00
|
|
|
#include "Common/UI/UIScreen.h"
|
|
|
|
#include "Common/UI/ViewGroup.h"
|
2016-07-03 10:24:33 -07:00
|
|
|
#include "UI/MiscScreens.h"
|
2016-07-03 20:48:27 -07:00
|
|
|
#include "UI/MainScreen.h"
|
2016-07-03 10:24:33 -07:00
|
|
|
|
2023-01-01 21:33:11 +01:00
|
|
|
class RemoteISOScreen : public UIDialogScreenWithGameBackground {
|
2016-07-03 10:24:33 -07:00
|
|
|
public:
|
2023-01-01 21:33:11 +01:00
|
|
|
RemoteISOScreen(const Path &filename);
|
2016-07-03 10:24:33 -07:00
|
|
|
|
2022-09-16 10:14:00 +02:00
|
|
|
const char *tag() const override { return "RemoteISO"; }
|
|
|
|
|
2016-07-03 10:24:33 -07:00
|
|
|
protected:
|
2017-03-14 22:01:18 -07:00
|
|
|
void update() override;
|
2016-07-03 10:24:33 -07:00
|
|
|
void CreateViews() override;
|
|
|
|
|
|
|
|
UI::EventReturn HandleStartServer(UI::EventParams &e);
|
|
|
|
UI::EventReturn HandleStopServer(UI::EventParams &e);
|
2016-07-03 17:38:29 -07:00
|
|
|
UI::EventReturn HandleBrowse(UI::EventParams &e);
|
2017-03-10 23:05:56 -05:00
|
|
|
UI::EventReturn HandleSettings(UI::EventParams &e);
|
2016-07-03 10:43:35 -07:00
|
|
|
|
2020-03-09 23:01:55 -07:00
|
|
|
UI::TextView *firewallWarning_ = nullptr;
|
|
|
|
bool serverRunning_ = false;
|
|
|
|
bool serverStopping_ = false;
|
2016-07-03 10:24:33 -07:00
|
|
|
};
|
2016-07-03 17:38:29 -07:00
|
|
|
|
2016-07-03 20:48:27 -07:00
|
|
|
enum class ScanStatus {
|
|
|
|
SCANNING,
|
|
|
|
RETRY_SCAN,
|
|
|
|
FOUND,
|
|
|
|
FAILED,
|
|
|
|
LOADING,
|
|
|
|
LOADED,
|
|
|
|
};
|
|
|
|
|
2023-01-01 21:33:11 +01:00
|
|
|
class RemoteISOConnectScreen : public UIDialogScreenWithBackground {
|
2016-07-03 17:38:29 -07:00
|
|
|
public:
|
|
|
|
RemoteISOConnectScreen();
|
2022-12-10 20:32:12 -08:00
|
|
|
~RemoteISOConnectScreen();
|
2016-07-03 17:38:29 -07:00
|
|
|
|
2022-09-16 10:14:00 +02:00
|
|
|
const char *tag() const override { return "RemoteISOConnect"; }
|
|
|
|
|
2016-07-03 17:38:29 -07:00
|
|
|
protected:
|
2017-03-14 22:01:18 -07:00
|
|
|
void update() override;
|
2016-07-03 17:38:29 -07:00
|
|
|
void CreateViews() override;
|
|
|
|
|
2016-07-03 20:48:27 -07:00
|
|
|
ScanStatus GetStatus();
|
2016-07-03 17:38:29 -07:00
|
|
|
void ExecuteScan();
|
2016-07-03 20:48:27 -07:00
|
|
|
void ExecuteLoad();
|
2020-03-09 19:51:25 -07:00
|
|
|
bool FindServer(std::string &resultHost, int &resultPort);
|
2016-07-03 17:38:29 -07:00
|
|
|
|
2023-01-01 21:33:11 +01:00
|
|
|
UI::TextView *statusView_ = nullptr;
|
2016-07-03 20:48:27 -07:00
|
|
|
|
2020-03-09 19:51:25 -07:00
|
|
|
ScanStatus status_ = ScanStatus::SCANNING;
|
|
|
|
std::string statusMessage_;
|
|
|
|
double nextRetry_ = 0.0;
|
2016-07-03 17:38:29 -07:00
|
|
|
std::thread *scanThread_;
|
2017-02-27 21:57:46 +01:00
|
|
|
std::mutex statusLock_;
|
2016-07-03 20:48:27 -07:00
|
|
|
std::string host_;
|
2023-01-01 21:33:11 +01:00
|
|
|
int port_ = -1;
|
2019-10-06 12:40:00 -07:00
|
|
|
std::string url_;
|
2021-05-09 15:25:12 +02:00
|
|
|
std::vector<Path> games_;
|
2016-07-03 17:38:29 -07:00
|
|
|
};
|
|
|
|
|
2016-07-03 20:48:27 -07:00
|
|
|
class RemoteISOBrowseScreen : public MainScreen {
|
2016-07-03 17:38:29 -07:00
|
|
|
public:
|
2021-05-09 15:25:12 +02:00
|
|
|
RemoteISOBrowseScreen(const std::string &url, const std::vector<Path> &games);
|
2016-07-03 17:38:29 -07:00
|
|
|
|
2022-09-16 10:14:00 +02:00
|
|
|
const char *tag() const override { return "RemoteISOBrowse"; }
|
|
|
|
|
2016-07-03 17:38:29 -07:00
|
|
|
protected:
|
|
|
|
void CreateViews() override;
|
2016-07-03 20:48:27 -07:00
|
|
|
|
2019-10-06 12:40:00 -07:00
|
|
|
std::string url_;
|
2021-05-09 15:25:12 +02:00
|
|
|
std::vector<Path> games_;
|
2016-07-03 17:38:29 -07:00
|
|
|
};
|
2017-03-10 23:05:56 -05:00
|
|
|
|
2017-03-22 00:03:45 -07:00
|
|
|
class RemoteISOSettingsScreen : public UIDialogScreenWithBackground {
|
2017-03-10 23:05:56 -05:00
|
|
|
public:
|
2017-03-22 00:03:45 -07:00
|
|
|
RemoteISOSettingsScreen();
|
2017-03-10 23:05:56 -05:00
|
|
|
|
2022-09-16 10:14:00 +02:00
|
|
|
const char *tag() const override { return "RemoteISOSettings"; }
|
|
|
|
|
2017-03-10 23:05:56 -05:00
|
|
|
protected:
|
2017-03-22 00:03:45 -07:00
|
|
|
void update() override;
|
2017-03-10 23:05:56 -05:00
|
|
|
void CreateViews() override;
|
|
|
|
|
|
|
|
UI::EventReturn OnChangeRemoteISOSubdir(UI::EventParams &e);
|
|
|
|
|
2017-03-22 00:03:45 -07:00
|
|
|
bool serverRunning_ = false;
|
2017-03-14 22:01:18 -07:00
|
|
|
};
|