diff --git a/CMakeLists.txt b/CMakeLists.txt
index 75bb00712..9157582aa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -255,6 +255,7 @@ if (ENABLE_CUSTOM_SYSTEM_ARCHIVES)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${CMAKE_BINARY_DIR}/externals/system_archives.7z"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/externals")
set(CUSTOM_ARCHIVES_PREFIX "${CMAKE_BINARY_DIR}/externals/system_archives")
+ add_definitions(-DCUSTOM_ARCHIVES_VERSION="v1.0")
add_definitions(-DENABLE_CUSTOM_SYSTEM_ARCHIVES)
endif()
diff --git a/src/citra/config.cpp b/src/citra/config.cpp
index 3869b6b5d..90bb594f7 100644
--- a/src/citra/config.cpp
+++ b/src/citra/config.cpp
@@ -81,6 +81,8 @@ void Config::ReadValues() {
// Core
Settings::values.use_cpu_jit = sdl2_config->GetBoolean("Core", "use_cpu_jit", true);
+ Settings::values.shared_font_jeu_version =
+ sdl2_config->Get("Core", "shared_font_jeu_version", "dumped");
// Renderer
Settings::values.use_hw_renderer = sdl2_config->GetBoolean("Renderer", "use_hw_renderer", true);
diff --git a/src/citra/default_ini.h b/src/citra/default_ini.h
index ea02a788d..93dff762e 100644
--- a/src/citra/default_ini.h
+++ b/src/citra/default_ini.h
@@ -66,6 +66,9 @@ motion_device=
# Whether to use the Just-In-Time (JIT) compiler for CPU emulation
# 0: Interpreter (slow), 1 (default): JIT (fast)
use_cpu_jit =
+# The version of the JP/EUR/USA shared Font
+# "dumped" (default)
+shared_font_jeu_version = dumped
[Renderer]
# Whether to use software or hardware rendering.
diff --git a/src/citra_qt/configuration/config.cpp b/src/citra_qt/configuration/config.cpp
index e2dceaa4c..6526807f8 100644
--- a/src/citra_qt/configuration/config.cpp
+++ b/src/citra_qt/configuration/config.cpp
@@ -66,6 +66,10 @@ void Config::ReadValues() {
qt_config->beginGroup("Core");
Settings::values.use_cpu_jit = qt_config->value("use_cpu_jit", true).toBool();
+ Settings::values.shared_font_jeu_version =
+ qt_config->value("shared_font_jeu_version", QString::fromStdString("dumped"))
+ .toString()
+ .toStdString();
qt_config->endGroup();
qt_config->beginGroup("Renderer");
@@ -217,6 +221,8 @@ void Config::SaveValues() {
qt_config->beginGroup("Core");
qt_config->setValue("use_cpu_jit", Settings::values.use_cpu_jit);
+ qt_config->setValue("shared_font_jeu_version",
+ QString::fromStdString(Settings::values.shared_font_jeu_version));
qt_config->endGroup();
qt_config->beginGroup("Renderer");
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index eb93610ff..31850bea4 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -422,20 +422,27 @@ bool GMainWindow::LoadROM(const QString& filename) {
return false;
}
Core::System::Integrity integrity = system.GetSystemIntegrity();
- if (integrity && Core::System::Integrity::SharedFont) {
+ switch (integrity.shared_font_JEU) {
+ case Core::System::Integrity::CreatedCustom:
#ifdef ENABLE_CUSTOM_SYSTEM_ARCHIVES
QMessageBox::critical(
this, tr("Shared Font Created."),
- tr("The Shared Font is missing. A custom Shared Font was created. This could result in "
- "some ugly or wrong glyphs. It is recomended to dump the Shared Font from your 3ds. "
+ tr("A custom Shared Font was created. This could result in some ugly or wrong glyphs. "
+ "It is recomended to dump the Shared Font from your 3DS. "
"For more information on dumping these files, please see the "
"following wiki page: Dumping System "
"Archives and the Shared Fonts from a 3DS Console."));
#endif
+ break;
+ case Core::System::Integrity::Missing:
// Don't show an error meassage if the Shared Font is missing. This Message will popup
// anyway if the game requires it
+ break;
+ default:
+ // Nothing to do here
+ break;
}
return true;
}
diff --git a/src/core/core.cpp b/src/core/core.cpp
index c5e18401b..781264b9e 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -208,34 +208,46 @@ void System::Shutdown() {
}
void System::SystemIntegrityCheck() {
- system_integrity = static_cast(0);
- // Shared Font
- // TODO(B3N30): check/create font archive for region CHN/KOR/TWN
+ // Shared Font JP/EUR/USA
std::string nand_directory = FileUtil::GetUserPath(D_NAND_IDX);
const u32 shared_font_archive_id_low = 0x00014002;
- const u32_le shared_font_archive_id_high = 0x0004009b;
+ const u32 shared_font_archive_id_high = 0x0004009b;
std::string shared_font_path = Common::StringFromFormat(
"%s%s/title/%08x/%08x/content/00000000.app.romfs", nand_directory.c_str(), SYSTEM_ID,
shared_font_archive_id_high, shared_font_archive_id_low);
- LOG_DEBUG(Core, "%s", shared_font_path.c_str());
- auto file = std::make_shared(shared_font_path, "rb");
- if (file->IsOpen()) {
- file->Close();
- LOG_INFO(Core, "SystemCheck: Shared Font exists.");
+ if (FileUtil::Exists(shared_font_path)) {
+ std::string version = Settings::values.shared_font_jeu_version;
+ if (version == "dumped") {
+ system_integrity.shared_font_JEU = Integrity::Dumped;
+ LOG_INFO(Core, "SystemCheck: Shared Font exists.");
+ } else if (version == CUSTOM_ARCHIVES_VERSION) {
+ system_integrity.shared_font_JEU = Integrity::Custom;
+ LOG_WARNING(Core, "SystemCheck: Shared Font (custom) exists.");
+#ifdef ENABLE_CUSTOM_SYSTEM_ARCHIVES
+ } else {
+ FileUtil::IOFile file(shared_font_path, "wb");
+ file.WriteBytes(SHARED_FONT_DATA, SHARED_FONT_DATA_len);
+ file.Close();
+ system_integrity.shared_font_JEU = Integrity::CreatedCustom;
+ Settings::values.shared_font_jeu_version = CUSTOM_ARCHIVES_VERSION;
+ LOG_WARNING(Core, "SystemCheck: Updated Shared Font.");
+ }
+#endif
} else {
std::string shared_font_legacy_path = FileUtil::GetUserPath(D_SYSDATA_IDX) + SHARED_FONT;
- file = std::make_shared(shared_font_legacy_path, "rb");
- if (file->IsOpen()) {
- file->Close();
+ if (FileUtil::Exists(shared_font_legacy_path)) {
LOG_INFO(Core, "SystemCheck: Shared Font(legacy) exists.");
+ system_integrity.shared_font_JEU = Integrity::DumpedLegacy;
} else {
LOG_ERROR(Core, "SystemCheck: Shared Font missing.");
- system_integrity = static_cast(system_integrity | Integrity::SharedFont);
+ system_integrity.shared_font_JEU = Integrity::Missing;
#ifdef ENABLE_CUSTOM_SYSTEM_ARCHIVES
- file = std::make_shared(shared_font_path, "w+b");
- file->WriteBytes(SHARED_FONT_DATA, SHARED_FONT_DATA_len);
- file->Close();
- LOG_DEBUG(Core, "SystemCheck: Created Shared Font.");
+ FileUtil::IOFile file(shared_font_path, "wb");
+ file.WriteBytes(SHARED_FONT_DATA, SHARED_FONT_DATA_len);
+ file.Close();
+ system_integrity.shared_font_JEU = Integrity::CreatedCustom;
+ Settings::values.shared_font_jeu_version = CUSTOM_ARCHIVES_VERSION;
+ LOG_WARNING(Core, "SystemCheck: Created Shared Font.");
#endif
}
}
diff --git a/src/core/core.h b/src/core/core.h
index 2c01d5411..d6b273e3e 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -43,8 +43,16 @@ public:
ErrorUnknown ///< Any other error
};
- enum Integrity : u32 {
- SharedFont = 1 << 0,
+ struct Integrity {
+ enum Status: u32 {
+ Dumped,
+ Custom,
+ CreatedCustom,
+ Missing,
+
+ DumpedLegacy,
+ };
+ Status shared_font_JEU{};
};
/**
diff --git a/src/core/settings.h b/src/core/settings.h
index bf8014c5a..7fb058a79 100644
--- a/src/core/settings.h
+++ b/src/core/settings.h
@@ -84,6 +84,7 @@ struct Values {
// Core
bool use_cpu_jit;
+ std::string shared_font_jeu_version;
// Data Storage
bool use_virtual_sd;
diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp
index 104a16cc9..5f946c863 100644
--- a/src/core/telemetry_session.cpp
+++ b/src/core/telemetry_session.cpp
@@ -145,6 +145,8 @@ TelemetrySession::TelemetrySession() {
AddField(Telemetry::FieldType::UserConfig, "Audio_EnableAudioStretching",
Settings::values.enable_audio_stretching);
AddField(Telemetry::FieldType::UserConfig, "Core_UseCpuJit", Settings::values.use_cpu_jit);
+ AddField(Telemetry::FieldType::UserConfig, "Core_SharedFontJEUVersion",
+ Settings::values.shared_font_jeu_version);
AddField(Telemetry::FieldType::UserConfig, "Renderer_ResolutionFactor",
Settings::values.resolution_factor);
AddField(Telemetry::FieldType::UserConfig, "Renderer_ToggleFramelimit",