Android: Allow disabling cover downloading

In case someone wants to be very careful with how much bandwidth
they use or with what data GameTDB.com collects on you.
This is already an option in DolphinQt (though in DolphinQt it
will switch entirely from using covers to banners when turned off).
This commit is contained in:
JosJuice 2020-10-11 19:32:27 +02:00
parent 195b551d87
commit 5e70dda4cc
6 changed files with 36 additions and 6 deletions

View File

@ -38,6 +38,8 @@ public enum BooleanSetting implements AbstractBooleanSetting
MAIN_RECURSIVE_ISO_PATHS(Settings.FILE_DOLPHIN, Settings.SECTION_INI_GENERAL,
"RecursiveISOPaths", false),
MAIN_USE_GAME_COVERS(Settings.FILE_DOLPHIN, Settings.SECTION_INI_GENERAL,
"UseGameCovers", true),
SYSCONF_SCREENSAVER(Settings.FILE_SYSCONF, "IPL", "SSV", false),
SYSCONF_WIDESCREEN(Settings.FILE_SYSCONF, "IPL", "AR", true),

View File

@ -224,7 +224,6 @@ public final class SettingsFragmentPresenter
sl.add(new SubmenuSetting(R.string.advanced_submenu, MenuTag.CONFIG_ADVANCED));
sl.add(new SubmenuSetting(R.string.log_submenu, MenuTag.CONFIG_LOG));
sl.add(new SubmenuSetting(R.string.debug_submenu, MenuTag.DEBUG));
sl.add(new HeaderSetting(R.string.gametdb_thanks, 0));
}
private void addGeneralSettings(ArrayList<SettingsItem> sl)
@ -247,6 +246,8 @@ public final class SettingsFragmentPresenter
R.string.panic_handlers_description));
sl.add(new CheckBoxSetting(BooleanSetting.MAIN_OSD_MESSAGES, R.string.osd_messages,
R.string.osd_messages_description));
sl.add(new CheckBoxSetting(BooleanSetting.MAIN_USE_GAME_COVERS, R.string.download_game_covers,
0));
}
private void addAudioSettings(ArrayList<SettingsItem> sl)

View File

@ -10,6 +10,7 @@ import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso;
import org.dolphinemu.dolphinemu.R;
import org.dolphinemu.dolphinemu.features.settings.model.BooleanSetting;
import org.dolphinemu.dolphinemu.model.GameFile;
import java.io.File;
@ -62,7 +63,7 @@ public class PicassoUtils
}
// GameTDB has a pretty close to complete collection for US/EN covers. First pass at getting
// the cover will be by the disk's region, second will be the US cover, and third EN.
else
else if (BooleanSetting.MAIN_USE_GAME_COVERS.getBooleanGlobal())
{
Picasso.get()
.load(CoverHelper.buildGameTDBUrl(gameFile, CoverHelper.getRegion(gameFile)))
@ -136,5 +137,16 @@ public class PicassoUtils
}
});
}
else
{
Picasso.get()
.load(R.drawable.no_banner)
.noFade()
.noPlaceholder()
.fit()
.centerInside()
.config(Bitmap.Config.ARGB_8888)
.into(imageView);
}
}
}

View File

@ -158,7 +158,6 @@
<string name="lock_emulation_landscape_desc">Some touch controls will require additional tweaking if played in portrait</string>
<string name="analytics">Enable usage statistics reporting</string>
<string name="analytics_desc">If authorized, Dolphin can collect data on its performance, feature usage, and configuration, as well as data on your system\'s hardware and operating system.\n\nNo private data is ever collected. This data helps us understand how people and emulated games use Dolphin and prioritize our efforts. It also helps us identify rare configurations that are causing bugs, performance and stability issues. This authorization can be revoked at any time through Dolphin\'s settings.</string>
<string name="gametdb_thanks">Thanks to GameTDB.com for providing GameCube and Wii covers!</string>
<!-- Interface Preference Fragment -->
<string name="interface_submenu">Interface</string>
@ -166,6 +165,7 @@
<string name="panic_handlers_description">Show a message box when a potentially serious error has occurred. Disabling this may avoid annoying and non-fatal messages, but it may result in major crashes having no explanation at all.</string>
<string name="osd_messages">Show On-Screen Display Messages</string>
<string name="osd_messages_description">Display messages over the emulation screen area. These messages include memory card writes, video backend and CPU information, and JIT cache clearing.</string>
<string name="download_game_covers">Download Game Covers from GameTDB.com</string>
<!-- Audio Settings -->
<string name="audio_submenu">Audio</string>

View File

@ -9,7 +9,11 @@ namespace Config
// UI.General
const Info<bool> MAIN_USE_DISCORD_PRESENCE{{System::Main, "General", "UseDiscordPresence"}, true};
#ifdef ANDROID
const Info<bool> MAIN_USE_GAME_COVERS{{System::Main, "General", "UseGameCovers"}, true};
#else
const Info<bool> MAIN_USE_GAME_COVERS{{System::Main, "General", "UseGameCovers"}, false};
#endif
const Info<bool> MAIN_FOCUSED_HOTKEYS{{System::Main, "General", "HotkeysRequireFocus"}, true};
const Info<bool> MAIN_RECURSIVE_ISO_PATHS{{System::Main, "General", "RecursiveISOPaths"}, false};

View File

@ -52,6 +52,17 @@ namespace UICommon
namespace
{
const std::string EMPTY_STRING;
bool UseGameCovers()
{
#ifdef ANDROID
// Android has its own code for handling covers, written completely in Java.
// It's best if we disable the C++ cover code on Android to avoid duplicated data and such.
return false;
#else
return Config::Get(Config::MAIN_USE_GAME_COVERS);
#endif
}
} // Anonymous namespace
DiscIO::Language GameFile::GetConfigLanguage() const
@ -169,7 +180,7 @@ bool GameFile::IsValid() const
bool GameFile::CustomCoverChanged()
{
if (!m_custom_cover.buffer.empty() || !Config::Get(Config::MAIN_USE_GAME_COVERS))
if (!m_custom_cover.buffer.empty() || !UseGameCovers())
return false;
std::string path, name;
@ -196,7 +207,7 @@ bool GameFile::CustomCoverChanged()
void GameFile::DownloadDefaultCover()
{
if (!m_default_cover.buffer.empty() || !Config::Get(Config::MAIN_USE_GAME_COVERS))
if (!m_default_cover.buffer.empty() || !UseGameCovers())
return;
const auto cover_path = File::GetUserPath(D_COVERCACHE_IDX) + DIR_SEP;
@ -262,7 +273,7 @@ void GameFile::DownloadDefaultCover()
bool GameFile::DefaultCoverChanged()
{
if (!m_default_cover.buffer.empty() || !Config::Get(Config::MAIN_USE_GAME_COVERS))
if (!m_default_cover.buffer.empty() || !UseGameCovers())
return false;
const auto cover_path = File::GetUserPath(D_COVERCACHE_IDX) + DIR_SEP;