mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-30 06:00:05 +00:00
Added a version control for custom archives
This commit is contained in:
parent
38d79c56b9
commit
36f613db7a
@ -255,6 +255,7 @@ if (ENABLE_CUSTOM_SYSTEM_ARCHIVES)
|
|||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${CMAKE_BINARY_DIR}/externals/system_archives.7z"
|
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${CMAKE_BINARY_DIR}/externals/system_archives.7z"
|
||||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/externals")
|
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/externals")
|
||||||
set(CUSTOM_ARCHIVES_PREFIX "${CMAKE_BINARY_DIR}/externals/system_archives")
|
set(CUSTOM_ARCHIVES_PREFIX "${CMAKE_BINARY_DIR}/externals/system_archives")
|
||||||
|
add_definitions(-DCUSTOM_ARCHIVES_VERSION="v1.0")
|
||||||
add_definitions(-DENABLE_CUSTOM_SYSTEM_ARCHIVES)
|
add_definitions(-DENABLE_CUSTOM_SYSTEM_ARCHIVES)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -81,6 +81,8 @@ void Config::ReadValues() {
|
|||||||
|
|
||||||
// Core
|
// Core
|
||||||
Settings::values.use_cpu_jit = sdl2_config->GetBoolean("Core", "use_cpu_jit", true);
|
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
|
// Renderer
|
||||||
Settings::values.use_hw_renderer = sdl2_config->GetBoolean("Renderer", "use_hw_renderer", true);
|
Settings::values.use_hw_renderer = sdl2_config->GetBoolean("Renderer", "use_hw_renderer", true);
|
||||||
|
@ -66,6 +66,9 @@ motion_device=
|
|||||||
# Whether to use the Just-In-Time (JIT) compiler for CPU emulation
|
# Whether to use the Just-In-Time (JIT) compiler for CPU emulation
|
||||||
# 0: Interpreter (slow), 1 (default): JIT (fast)
|
# 0: Interpreter (slow), 1 (default): JIT (fast)
|
||||||
use_cpu_jit =
|
use_cpu_jit =
|
||||||
|
# The version of the JP/EUR/USA shared Font
|
||||||
|
# "dumped" (default)
|
||||||
|
shared_font_jeu_version = dumped
|
||||||
|
|
||||||
[Renderer]
|
[Renderer]
|
||||||
# Whether to use software or hardware rendering.
|
# Whether to use software or hardware rendering.
|
||||||
|
@ -66,6 +66,10 @@ void Config::ReadValues() {
|
|||||||
|
|
||||||
qt_config->beginGroup("Core");
|
qt_config->beginGroup("Core");
|
||||||
Settings::values.use_cpu_jit = qt_config->value("use_cpu_jit", true).toBool();
|
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->endGroup();
|
||||||
|
|
||||||
qt_config->beginGroup("Renderer");
|
qt_config->beginGroup("Renderer");
|
||||||
@ -217,6 +221,8 @@ void Config::SaveValues() {
|
|||||||
|
|
||||||
qt_config->beginGroup("Core");
|
qt_config->beginGroup("Core");
|
||||||
qt_config->setValue("use_cpu_jit", Settings::values.use_cpu_jit);
|
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->endGroup();
|
||||||
|
|
||||||
qt_config->beginGroup("Renderer");
|
qt_config->beginGroup("Renderer");
|
||||||
|
@ -422,20 +422,27 @@ bool GMainWindow::LoadROM(const QString& filename) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Core::System::Integrity integrity = system.GetSystemIntegrity();
|
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
|
#ifdef ENABLE_CUSTOM_SYSTEM_ARCHIVES
|
||||||
QMessageBox::critical(
|
QMessageBox::critical(
|
||||||
this, tr("Shared Font Created."),
|
this, tr("Shared Font Created."),
|
||||||
tr("The Shared Font is missing. A custom Shared Font was created. This could result in "
|
tr("A custom Shared Font was created. This could result in some ugly or wrong glyphs. "
|
||||||
"some ugly or wrong glyphs. It is recomended to dump the Shared Font from your 3ds. "
|
"It is recomended to dump the Shared Font from your 3DS. "
|
||||||
"For more information on dumping these files, please see the "
|
"For more information on dumping these files, please see the "
|
||||||
"following wiki page: <a "
|
"following wiki page: <a "
|
||||||
"href='https://citra-emu.org/wiki/"
|
"href='https://citra-emu.org/wiki/"
|
||||||
"dumping-system-archives-and-the-shared-fonts-from-a-3ds-console/'>Dumping System "
|
"dumping-system-archives-and-the-shared-fonts-from-a-3ds-console/'>Dumping System "
|
||||||
"Archives and the Shared Fonts from a 3DS Console</a>."));
|
"Archives and the Shared Fonts from a 3DS Console</a>."));
|
||||||
#endif
|
#endif
|
||||||
|
break;
|
||||||
|
case Core::System::Integrity::Missing:
|
||||||
// Don't show an error meassage if the Shared Font is missing. This Message will popup
|
// Don't show an error meassage if the Shared Font is missing. This Message will popup
|
||||||
// anyway if the game requires it
|
// anyway if the game requires it
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// Nothing to do here
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -208,34 +208,46 @@ void System::Shutdown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void System::SystemIntegrityCheck() {
|
void System::SystemIntegrityCheck() {
|
||||||
system_integrity = static_cast<Integrity>(0);
|
// Shared Font JP/EUR/USA
|
||||||
// Shared Font
|
|
||||||
// TODO(B3N30): check/create font archive for region CHN/KOR/TWN
|
|
||||||
std::string nand_directory = FileUtil::GetUserPath(D_NAND_IDX);
|
std::string nand_directory = FileUtil::GetUserPath(D_NAND_IDX);
|
||||||
const u32 shared_font_archive_id_low = 0x00014002;
|
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(
|
std::string shared_font_path = Common::StringFromFormat(
|
||||||
"%s%s/title/%08x/%08x/content/00000000.app.romfs", nand_directory.c_str(), SYSTEM_ID,
|
"%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);
|
shared_font_archive_id_high, shared_font_archive_id_low);
|
||||||
LOG_DEBUG(Core, "%s", shared_font_path.c_str());
|
if (FileUtil::Exists(shared_font_path)) {
|
||||||
auto file = std::make_shared<FileUtil::IOFile>(shared_font_path, "rb");
|
std::string version = Settings::values.shared_font_jeu_version;
|
||||||
if (file->IsOpen()) {
|
if (version == "dumped") {
|
||||||
file->Close();
|
system_integrity.shared_font_JEU = Integrity::Dumped;
|
||||||
LOG_INFO(Core, "SystemCheck: Shared Font exists.");
|
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 {
|
} else {
|
||||||
std::string shared_font_legacy_path = FileUtil::GetUserPath(D_SYSDATA_IDX) + SHARED_FONT;
|
std::string shared_font_legacy_path = FileUtil::GetUserPath(D_SYSDATA_IDX) + SHARED_FONT;
|
||||||
file = std::make_shared<FileUtil::IOFile>(shared_font_legacy_path, "rb");
|
if (FileUtil::Exists(shared_font_legacy_path)) {
|
||||||
if (file->IsOpen()) {
|
|
||||||
file->Close();
|
|
||||||
LOG_INFO(Core, "SystemCheck: Shared Font(legacy) exists.");
|
LOG_INFO(Core, "SystemCheck: Shared Font(legacy) exists.");
|
||||||
|
system_integrity.shared_font_JEU = Integrity::DumpedLegacy;
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR(Core, "SystemCheck: Shared Font missing.");
|
LOG_ERROR(Core, "SystemCheck: Shared Font missing.");
|
||||||
system_integrity = static_cast<Integrity>(system_integrity | Integrity::SharedFont);
|
system_integrity.shared_font_JEU = Integrity::Missing;
|
||||||
#ifdef ENABLE_CUSTOM_SYSTEM_ARCHIVES
|
#ifdef ENABLE_CUSTOM_SYSTEM_ARCHIVES
|
||||||
file = std::make_shared<FileUtil::IOFile>(shared_font_path, "w+b");
|
FileUtil::IOFile file(shared_font_path, "wb");
|
||||||
file->WriteBytes(SHARED_FONT_DATA, SHARED_FONT_DATA_len);
|
file.WriteBytes(SHARED_FONT_DATA, SHARED_FONT_DATA_len);
|
||||||
file->Close();
|
file.Close();
|
||||||
LOG_DEBUG(Core, "SystemCheck: Created Shared Font.");
|
system_integrity.shared_font_JEU = Integrity::CreatedCustom;
|
||||||
|
Settings::values.shared_font_jeu_version = CUSTOM_ARCHIVES_VERSION;
|
||||||
|
LOG_WARNING(Core, "SystemCheck: Created Shared Font.");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,8 +43,16 @@ public:
|
|||||||
ErrorUnknown ///< Any other error
|
ErrorUnknown ///< Any other error
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Integrity : u32 {
|
struct Integrity {
|
||||||
SharedFont = 1 << 0,
|
enum Status: u32 {
|
||||||
|
Dumped,
|
||||||
|
Custom,
|
||||||
|
CreatedCustom,
|
||||||
|
Missing,
|
||||||
|
|
||||||
|
DumpedLegacy,
|
||||||
|
};
|
||||||
|
Status shared_font_JEU{};
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,6 +84,7 @@ struct Values {
|
|||||||
|
|
||||||
// Core
|
// Core
|
||||||
bool use_cpu_jit;
|
bool use_cpu_jit;
|
||||||
|
std::string shared_font_jeu_version;
|
||||||
|
|
||||||
// Data Storage
|
// Data Storage
|
||||||
bool use_virtual_sd;
|
bool use_virtual_sd;
|
||||||
|
@ -145,6 +145,8 @@ TelemetrySession::TelemetrySession() {
|
|||||||
AddField(Telemetry::FieldType::UserConfig, "Audio_EnableAudioStretching",
|
AddField(Telemetry::FieldType::UserConfig, "Audio_EnableAudioStretching",
|
||||||
Settings::values.enable_audio_stretching);
|
Settings::values.enable_audio_stretching);
|
||||||
AddField(Telemetry::FieldType::UserConfig, "Core_UseCpuJit", Settings::values.use_cpu_jit);
|
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",
|
AddField(Telemetry::FieldType::UserConfig, "Renderer_ResolutionFactor",
|
||||||
Settings::values.resolution_factor);
|
Settings::values.resolution_factor);
|
||||||
AddField(Telemetry::FieldType::UserConfig, "Renderer_ToggleFramelimit",
|
AddField(Telemetry::FieldType::UserConfig, "Renderer_ToggleFramelimit",
|
||||||
|
Loading…
Reference in New Issue
Block a user