From 951f2269f67d618d376656db831796c119f4f6b3 Mon Sep 17 00:00:00 2001
From: Leo Prikler <leo.prikler@student.tugraz.at>
Date: Fri, 26 Jun 2020 18:20:04 +0200
Subject: [PATCH] ppsspp: disable upgrade and gold

---
 Core/Config.cpp             | 11 -------
 Core/Config.h               |  2 --
 Qt/QtMain.cpp               |  6 ----
 SDL/SDLMain.cpp             |  6 ----
 UI/DevScreens.cpp           |  3 --
 UI/GameSettingsScreen.cpp   |  1 -
 UI/MainScreen.cpp           | 63 +------------------------------------
 UI/MiscScreens.cpp          | 31 ++----------------
 UWP/PPSSPP_UWPMain.cpp      |  6 ----
 Windows/MainWindowMenu.cpp  |  2 +-
 Windows/main.cpp            |  6 ----
 android/jni/app-android.cpp |  6 ----
 12 files changed, 5 insertions(+), 138 deletions(-)

diff --git a/Core/Config.cpp b/Core/Config.cpp
index 214aeb433..04e3b151d 100644
--- a/Core/Config.cpp
+++ b/Core/Config.cpp
@@ -428,7 +428,6 @@ static ConfigSetting generalSettings[] = {
 	ConfigSetting("IgnoreBadMemAccess", &g_Config.bIgnoreBadMemAccess, true, true),
 	ConfigSetting("CurrentDirectory", &g_Config.currentDirectory, ""),
 	ConfigSetting("ShowDebuggerOnLoad", &g_Config.bShowDebuggerOnLoad, false),
-	ConfigSetting("CheckForNewVersion", &g_Config.bCheckForNewVersion, true),
 	ConfigSetting("Language", &g_Config.sLanguageIni, &DefaultLangRegion),
 	ConfigSetting("ForceLagSync2", &g_Config.bForceLagSync, false, true, true),
 	ConfigSetting("DiscordPresence", &g_Config.bDiscordPresence, true, true, false),  // Or maybe it makes sense to have it per-game? Race conditions abound...
@@ -1229,16 +1228,6 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
 		upgradeMessage = "";
 	}
 
-	// Check for new version on every 10 runs.
-	// Sometimes the download may not be finished when the main screen shows (if the user dismisses the
-	// splash screen quickly), but then we'll just show the notification next time instead, we store the
-	// upgrade number in the ini.
-	if (iRunCount % 10 == 0 && bCheckForNewVersion) {
-		std::shared_ptr<http::Download> dl = g_DownloadManager.StartDownloadWithCallback(
-			"http://www.ppsspp.org/version.json", "", &DownloadCompletedCallback);
-		dl->SetHidden(true);
-	}
-
 	INFO_LOG(LOADER, "Loading controller config: %s", controllerIniFilename_.c_str());
 	bSaveSettings = true;
 
diff --git a/Core/Config.h b/Core/Config.h
index 084eacc94..e7134cab5 100644
--- a/Core/Config.h
+++ b/Core/Config.h
@@ -99,7 +99,6 @@ struct Config {
 	bool bIgnoreBadMemAccess;
 	bool bFastMemory;
 	int iCpuCore;
-	bool bCheckForNewVersion;
 	bool bForceLagSync;
 	bool bFuncReplacements;
 	bool bHideSlowWarnings;
@@ -521,4 +520,3 @@ std::string CreateRandMAC();
 // TODO: Find a better place for this.
 extern http::Downloader g_DownloadManager;
 extern Config g_Config;
-
diff --git a/Qt/QtMain.cpp b/Qt/QtMain.cpp
index 7713b6587..1d92d1175 100644
--- a/Qt/QtMain.cpp
+++ b/Qt/QtMain.cpp
@@ -194,12 +194,6 @@ bool System_GetPropertyBool(SystemProperty prop) {
 		return true;
 	case SYSPROP_HAS_FILE_BROWSER:
 		return true;
-	case SYSPROP_APP_GOLD:
-#ifdef GOLD
-		return true;
-#else
-		return false;
-#endif
 	default:
 		return false;
 	}
diff --git a/SDL/SDLMain.cpp b/SDL/SDLMain.cpp
index 52028d087..d8697d210 100644
--- a/SDL/SDLMain.cpp
+++ b/SDL/SDLMain.cpp
@@ -356,12 +356,6 @@ bool System_GetPropertyBool(SystemProperty prop) {
 	switch (prop) {
 	case SYSPROP_HAS_BACK_BUTTON:
 		return true;
-	case SYSPROP_APP_GOLD:
-#ifdef GOLD
-		return true;
-#else
-		return false;
-#endif
 	default:
 		return false;
 	}
diff --git a/UI/DevScreens.cpp b/UI/DevScreens.cpp
index f146d099e..625ee124c 100644
--- a/UI/DevScreens.cpp
+++ b/UI/DevScreens.cpp
@@ -603,9 +603,6 @@ void SystemInfoScreen::CreateViews() {
 #ifdef _M_SSE
 	buildConfig->Add(new InfoItem("_M_SSE", StringFromFormat("0x%x", _M_SSE)));
 #endif
-	if (System_GetPropertyBool(SYSPROP_APP_GOLD)) {
-		buildConfig->Add(new InfoItem("GOLD", ""));
-	}
 
 	ViewGroup *cpuExtensionsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT));
 	cpuExtensionsScroll->SetTag("DevSystemInfoCPUExt");
diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp
index 8202870c7..81112f822 100644
--- a/UI/GameSettingsScreen.cpp
+++ b/UI/GameSettingsScreen.cpp
@@ -796,7 +796,6 @@ void GameSettingsScreen::CreateViews() {
 	}
 #endif
 
-	systemSettings->Add(new CheckBox(&g_Config.bCheckForNewVersion, sy->T("VersionCheck", "Check for new versions of PPSSPP")));
 	const std::string bgPng = GetSysDirectory(DIRECTORY_SYSTEM) + "background.png";
 	const std::string bgJpg = GetSysDirectory(DIRECTORY_SYSTEM) + "background.jpg";
 	if (File::Exists(bgPng) || File::Exists(bgJpg)) {
diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp
index 43535913d..36834020d 100644
--- a/UI/MainScreen.cpp
+++ b/UI/MainScreen.cpp
@@ -1054,11 +1054,7 @@ void MainScreen::CreateViews() {
 	sprintf(versionString, "%s", PPSSPP_GIT_VERSION);
 	rightColumnItems->SetSpacing(0.0f);
 	LinearLayout *logos = new LinearLayout(ORIENT_HORIZONTAL);
-	if (System_GetPropertyBool(SYSPROP_APP_GOLD)) {
-		logos->Add(new ImageView(ImageID("I_ICONGOLD"), IS_DEFAULT, new AnchorLayoutParams(64, 64, 10, 10, NONE, NONE, false)));
-	} else {
-		logos->Add(new ImageView(ImageID("I_ICON"), IS_DEFAULT, new AnchorLayoutParams(64, 64, 10, 10, NONE, NONE, false)));
-	}
+	logos->Add(new ImageView(ImageID("I_ICON"), IS_DEFAULT, new AnchorLayoutParams(64, 64, 10, 10, NONE, NONE, false)));
 	logos->Add(new ImageView(ImageID("I_LOGO"), IS_DEFAULT, new LinearLayoutParams(Margins(-12, 0, 0, 0))));
 	rightColumnItems->Add(logos);
 	TextView *ver = rightColumnItems->Add(new TextView(versionString, new LinearLayoutParams(Margins(70, -6, 0, 0))));
@@ -1070,11 +1066,6 @@ void MainScreen::CreateViews() {
 	rightColumnItems->Add(new Choice(mm->T("Game Settings", "Settings")))->OnClick.Handle(this, &MainScreen::OnGameSettings);
 	rightColumnItems->Add(new Choice(mm->T("Credits")))->OnClick.Handle(this, &MainScreen::OnCredits);
 	rightColumnItems->Add(new Choice(mm->T("www.ppsspp.org")))->OnClick.Handle(this, &MainScreen::OnPPSSPPOrg);
-	if (!System_GetPropertyBool(SYSPROP_APP_GOLD)) {
-		Choice *gold = rightColumnItems->Add(new Choice(mm->T("Buy PPSSPP Gold")));
-		gold->OnClick.Handle(this, &MainScreen::OnSupport);
-		gold->SetIcon(ImageID("I_ICONGOLD"));
-	}
 
 #if !PPSSPP_PLATFORM(UWP)
 	// Having an exit button is against UWP guidelines.
@@ -1099,28 +1090,6 @@ void MainScreen::CreateViews() {
 	} else if (tabHolder_->GetVisibility() != V_GONE) {
 		root_->SetDefaultFocusView(tabHolder_);
 	}
-
-	auto u = GetI18NCategory("Upgrade");
-
-	upgradeBar_ = 0;
-	if (!g_Config.upgradeMessage.empty()) {
-		upgradeBar_ = new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT));
-
-		UI::Margins textMargins(10, 5);
-		UI::Margins buttonMargins(0, 0);
-		UI::Drawable solid(0xFFbd9939);
-		upgradeBar_->SetBG(solid);
-		upgradeBar_->Add(new TextView(u->T("New version of PPSSPP available") + std::string(": ") + g_Config.upgradeVersion, new LinearLayoutParams(1.0f, textMargins)));
-		upgradeBar_->Add(new Button(u->T("Download"), new LinearLayoutParams(buttonMargins)))->OnClick.Handle(this, &MainScreen::OnDownloadUpgrade);
-		upgradeBar_->Add(new Button(u->T("Dismiss"), new LinearLayoutParams(buttonMargins)))->OnClick.Handle(this, &MainScreen::OnDismissUpgrade);
-
-		// Slip in under root_
-		LinearLayout *newRoot = new LinearLayout(ORIENT_VERTICAL);
-		newRoot->Add(root_);
-		newRoot->Add(upgradeBar_);
-		root_->ReplaceLayoutParams(new LinearLayoutParams(1.0));
-		root_ = newRoot;
-	}
 }
 
 UI::EventReturn MainScreen::OnAllowStorage(UI::EventParams &e) {
@@ -1128,27 +1097,6 @@ UI::EventReturn MainScreen::OnAllowStorage(UI::EventParams &e) {
 	return UI::EVENT_DONE;
 }
 
-UI::EventReturn MainScreen::OnDownloadUpgrade(UI::EventParams &e) {
-#if PPSSPP_PLATFORM(ANDROID)
-	// Go to app store
-	if (System_GetPropertyBool(SYSPROP_APP_GOLD)) {
-		LaunchBrowser("market://details?id=org.ppsspp.ppssppgold");
-	} else {
-		LaunchBrowser("market://details?id=org.ppsspp.ppsspp");
-	}
-#else
-	// Go directly to ppsspp.org and let the user sort it out
-	LaunchBrowser("https://www.ppsspp.org/downloads.html");
-#endif
-	return UI::EVENT_DONE;
-}
-
-UI::EventReturn MainScreen::OnDismissUpgrade(UI::EventParams &e) {
-	g_Config.DismissUpgrade();
-	upgradeBar_->SetVisibility(UI::V_GONE);
-	return UI::EVENT_DONE;
-}
-
 void MainScreen::sendMessage(const char *message, const char *value) {
 	// Always call the base class method first to handle the most common messages.
 	UIScreenWithBackground::sendMessage(message, value);
@@ -1319,15 +1267,6 @@ UI::EventReturn MainScreen::OnCredits(UI::EventParams &e) {
 	return UI::EVENT_DONE;
 }
 
-UI::EventReturn MainScreen::OnSupport(UI::EventParams &e) {
-#ifdef __ANDROID__
-	LaunchBrowser("market://details?id=org.ppsspp.ppssppgold");
-#else
-	LaunchBrowser("https://central.ppsspp.org/buygold");
-#endif
-	return UI::EVENT_DONE;
-}
-
 UI::EventReturn MainScreen::OnPPSSPPOrg(UI::EventParams &e) {
 	LaunchBrowser("https://www.ppsspp.org");
 	return UI::EVENT_DONE;
diff --git a/UI/MiscScreens.cpp b/UI/MiscScreens.cpp
index a6542c65d..f5f101594 100644
--- a/UI/MiscScreens.cpp
+++ b/UI/MiscScreens.cpp
@@ -498,11 +498,7 @@ void LogoScreen::render() {
 	char temp[256];
 	// Manually formatting UTF-8 is fun.  \xXX doesn't work everywhere.
 	snprintf(temp, sizeof(temp), "%s Henrik Rydg%c%crd", cr->T("created", "Created by"), 0xC3, 0xA5);
-	if (System_GetPropertyBool(SYSPROP_APP_GOLD)) {
-		dc.Draw()->DrawImage(ImageID("I_ICONGOLD"), bounds.centerX() - 120, bounds.centerY() - 30, 1.2f, textColor, ALIGN_CENTER);
-	} else {
-		dc.Draw()->DrawImage(ImageID("I_ICON"), bounds.centerX() - 120, bounds.centerY() - 30, 1.2f, textColor, ALIGN_CENTER);
-	}
+	dc.Draw()->DrawImage(ImageID("I_ICON"), bounds.centerX() - 120, bounds.centerY() - 30, 1.2f, textColor, ALIGN_CENTER);
 	dc.Draw()->DrawImage(ImageID("I_LOGO"), bounds.centerX() + 40, bounds.centerY() - 30, 1.5f, textColor, ALIGN_CENTER);
 	//dc.Draw()->DrawTextShadow(UBUNTU48, "PPSSPP", xres / 2, yres / 2 - 30, textColor, ALIGN_CENTER);
 	dc.SetFontScale(1.0f, 1.0f);
@@ -538,10 +534,6 @@ void CreditsScreen::CreateViews() {
 	// Really need to redo this whole layout with some linear layouts...
 
 	int rightYOffset = 0;
-	if (!System_GetPropertyBool(SYSPROP_APP_GOLD)) {
-		root_->Add(new Button(cr->T("Buy Gold"), new AnchorLayoutParams(260, 64, NONE, NONE, 10, 84, false)))->OnClick.Handle(this, &CreditsScreen::OnSupport);
-		rightYOffset = 74;
-	}
 	root_->Add(new Button(cr->T("PPSSPP Forums"), new AnchorLayoutParams(260, 64, 10, NONE, NONE, 158, false)))->OnClick.Handle(this, &CreditsScreen::OnForums);
 	root_->Add(new Button(cr->T("Discord"), new AnchorLayoutParams(260, 64, 10, NONE, NONE, 232, false)))->OnClick.Handle(this, &CreditsScreen::OnDiscord);
 	root_->Add(new Button("www.ppsspp.org", new AnchorLayoutParams(260, 64, 10, NONE, NONE, 10, false)))->OnClick.Handle(this, &CreditsScreen::OnPPSSPPOrg);
@@ -550,20 +542,7 @@ void CreditsScreen::CreateViews() {
 #if PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(IOS)
 	root_->Add(new Button(cr->T("Share PPSSPP"), new AnchorLayoutParams(260, 64, NONE, NONE, 10, rightYOffset + 158, false)))->OnClick.Handle(this, &CreditsScreen::OnShare);
 #endif
-	if (System_GetPropertyBool(SYSPROP_APP_GOLD)) {
-		root_->Add(new ImageView(ImageID("I_ICONGOLD"), IS_DEFAULT, new AnchorLayoutParams(100, 64, 10, 10, NONE, NONE, false)));
-	} else {
-		root_->Add(new ImageView(ImageID("I_ICON"), IS_DEFAULT, new AnchorLayoutParams(100, 64, 10, 10, NONE, NONE, false)));
-	}
-}
-
-UI::EventReturn CreditsScreen::OnSupport(UI::EventParams &e) {
-#ifdef __ANDROID__
-	LaunchBrowser("market://details?id=org.ppsspp.ppssppgold");
-#else
-	LaunchBrowser("https://central.ppsspp.org/buygold");
-#endif
-	return UI::EVENT_DONE;
+	root_->Add(new ImageView(ImageID("I_ICON"), IS_DEFAULT, new AnchorLayoutParams(100, 64, 10, 10, NONE, NONE, false)));
 }
 
 UI::EventReturn CreditsScreen::OnTwitter(UI::EventParams &e) {
@@ -747,11 +726,7 @@ void CreditsScreen::render() {
 
 	// TODO: This is kinda ugly, done on every frame...
 	char temp[256];
-	if (System_GetPropertyBool(SYSPROP_APP_GOLD)) {
-		snprintf(temp, sizeof(temp), "PPSSPP Gold %s", PPSSPP_GIT_VERSION);
-	} else {
-		snprintf(temp, sizeof(temp), "PPSSPP %s", PPSSPP_GIT_VERSION);
-	}
+	snprintf(temp, sizeof(temp), "PPSSPP %s", PPSSPP_GIT_VERSION);
 	credits[0] = (const char *)temp;
 
 	UIContext &dc = *screenManager()->getUIContext();
diff --git a/UWP/PPSSPP_UWPMain.cpp b/UWP/PPSSPP_UWPMain.cpp
index 24f3b964d..1d66ba7ee 100644
--- a/UWP/PPSSPP_UWPMain.cpp
+++ b/UWP/PPSSPP_UWPMain.cpp
@@ -399,12 +399,6 @@ bool System_GetPropertyBool(SystemProperty prop) {
 		return false;
 	case SYSPROP_HAS_BACK_BUTTON:
 		return true;
-	case SYSPROP_APP_GOLD:
-#ifdef GOLD
-		return true;
-#else
-		return false;
-#endif
 	default:
 		return false;
 	}
diff --git a/Windows/MainWindowMenu.cpp b/Windows/MainWindowMenu.cpp
index b5e1bb0eb..71b29b48a 100644
--- a/Windows/MainWindowMenu.cpp
+++ b/Windows/MainWindowMenu.cpp
@@ -1377,7 +1377,7 @@ namespace MainWindow {
 		{
 			W32Util::CenterWindow(hDlg);
 			HWND versionBox = GetDlgItem(hDlg, IDC_VERSION);
-			std::string windowText = System_GetPropertyBool(SYSPROP_APP_GOLD) ? "PPSSPP Gold " : "PPSSPP ";
+			std::string windowText = "PPSSPP ";
 			windowText.append(PPSSPP_GIT_VERSION);
 			SetWindowText(versionBox, ConvertUTF8ToWString(windowText).c_str());
 		}
diff --git a/Windows/main.cpp b/Windows/main.cpp
index 3795597e2..fd98d0453 100644
--- a/Windows/main.cpp
+++ b/Windows/main.cpp
@@ -268,12 +268,6 @@ bool System_GetPropertyBool(SystemProperty prop) {
 		return true;
 	case SYSPROP_HAS_BACK_BUTTON:
 		return true;
-	case SYSPROP_APP_GOLD:
-#ifdef GOLD
-		return true;
-#else
-		return false;
-#endif
 	default:
 		return false;
 	}
diff --git a/android/jni/app-android.cpp b/android/jni/app-android.cpp
index 086371085..0a340c0ae 100644
--- a/android/jni/app-android.cpp
+++ b/android/jni/app-android.cpp
@@ -372,12 +372,6 @@ bool System_GetPropertyBool(SystemProperty prop) {
 		return true;
 	case SYSPROP_HAS_IMAGE_BROWSER:
 		return true;
-	case SYSPROP_APP_GOLD:
-#ifdef GOLD
-		return true;
-#else
-		return false;
-#endif
 	default:
 		return false;
 	}
-- 
2.26.2