Remote disc streaming: Add an option for a "Remote" tab on the main screen

This commit is contained in:
Henrik Rydgård
2023-12-28 15:34:40 +01:00
parent 7ab979a387
commit 6ac4cc4559
6 changed files with 60 additions and 31 deletions
+12 -24
View File
@@ -96,7 +96,7 @@ static ServerAllowStatus IsServerAllowed(int port) {
#endif
}
static std::string RemoteSubdir() {
std::string RemoteSubdir() {
if (g_Config.bRemoteISOManual) {
return g_Config.sRemoteISOSubdir;
}
@@ -484,9 +484,13 @@ ScanStatus RemoteISOConnectScreen::GetStatus() {
return status_;
}
std::string FormatRemoteISOUrl(const char *host, int port, const char *subdir) {
return StringFromFormat("http://%s:%d%s", host, port, subdir);
}
void RemoteISOConnectScreen::ExecuteLoad() {
std::string subdir = RemoteSubdir();
url_ = StringFromFormat("http://%s:%d%s", host_.c_str(), port_, subdir.c_str());
url_ = FormatRemoteISOUrl(host_.c_str(), port_, subdir.c_str());
bool result = LoadGameList(Path(url_), games_);
if (scanAborted) {
return;
@@ -501,25 +505,6 @@ void RemoteISOConnectScreen::ExecuteLoad() {
status_ = result ? ScanStatus::LOADED : ScanStatus::FAILED;
}
class RemoteGameBrowser : public GameBrowser {
public:
RemoteGameBrowser(const Path &url, BrowseFlags browseFlags, bool *gridStyle, ScreenManager *screenManager, std::string lastText, std::string lastLink, UI::LayoutParams *layoutParams = nullptr)
: GameBrowser(url, browseFlags, gridStyle, screenManager, lastText, lastLink, layoutParams) {
initialPath_ = url;
}
protected:
Path HomePath() override {
return initialPath_;
}
Path initialPath_;
};
RemoteISOBrowseScreen::RemoteISOBrowseScreen(const std::string &url, const std::vector<Path> &games)
: url_(url), games_(games) {
}
void RemoteISOBrowseScreen::CreateViews() {
auto di = GetI18NCategory(I18NCat::DIALOG);
auto ri = GetI18NCategory(I18NCat::REMOTEISO);
@@ -535,9 +520,11 @@ void RemoteISOBrowseScreen::CreateViews() {
ScrollView *scrollRecentGames = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT));
scrollRecentGames->SetTag("RemoteGamesTab");
GameBrowser *tabRemoteGames = new RemoteGameBrowser(
Path(url_), BrowseFlags::PIN | BrowseFlags::NAVIGATE, &g_Config.bGridView1, screenManager(), "", "",
GameBrowser *tabRemoteGames = new GameBrowser(
Path(url_), BrowseFlags::NAVIGATE, &g_Config.bGridView1, screenManager(), "", "",
new LinearLayoutParams(FILL_PARENT, FILL_PARENT));
tabRemoteGames->SetHomePath(Path(url_));
scrollRecentGames->Add(tabRemoteGames);
gameBrowsers_.push_back(tabRemoteGames);
@@ -599,13 +586,14 @@ void RemoteISOSettingsScreen::CreateViews() {
remoteisoSettings->Add(new ItemHeader(ri->T("Remote disc streaming")));
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")));
remoteisoSettings->Add(new CheckBox(&g_Config.bRemoteTab, ri->T("Show Remote tab on main screen")));
UI::Choice *remoteServer;
remoteServer = new PopupTextInputChoice(&g_Config.sLastRemoteISOServer, ri->T("Remote Server"), "", 255, screenManager());
remoteisoSettings->Add(remoteServer);
remoteServer->SetEnabledPtr(&g_Config.bRemoteISOManual);
PopupSliderChoice *remotePort = remoteisoSettings->Add(new PopupSliderChoice(&g_Config.iLastRemoteISOPort, 0, 65535, 0, ri->T("Remote Port", "Remote Port"), 100, screenManager()));
PopupSliderChoice *remotePort = remoteisoSettings->Add(new PopupSliderChoice(&g_Config.iLastRemoteISOPort, 0, 65535, 0, ri->T("Remote Port"), 100, screenManager()));
remotePort->SetEnabledPtr(&g_Config.bRemoteISOManual);
UI::Choice *remoteSubdir;