frontends: Adapt UIs to new changes

This commit is contained in:
PabloMK7 2026-05-03 17:51:17 +02:00
parent 418a056147
commit bafd58b0df
9 changed files with 103 additions and 38 deletions

View file

@ -317,6 +317,12 @@ object NativeLibrary {
canContinue = false
}
CoreError.ErrorCoreExceptionRaised -> {
title = emulationActivity.getString(R.string.fatal_error)
message = emulationActivity.getString(R.string.fatal_error_message)
canContinue = false
}
CoreError.ErrorUnknown -> {
title = emulationActivity.getString(R.string.fatal_error)
message = emulationActivity.getString(R.string.fatal_error_message)
@ -439,7 +445,7 @@ object NativeLibrary {
return
}
if (resultCode == EmulationErrorDialogFragment.ShutdownRequested) {
if (resultCode == CoreError.ShutdownRequested.value) {
emulationActivity.finish()
return
}
@ -458,23 +464,25 @@ object NativeLibrary {
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
emulationActivity = requireActivity() as EmulationActivity
var captionId = R.string.loader_error_invalid_format
val result = requireArguments().getInt(RESULT_CODE)
if (result == ErrorLoader_ErrorEncrypted) {
captionId = R.string.loader_error_encrypted
var captionString = getString(R.string.loader_error_invalid_format)
if (result == CoreError.ErrorLoader_ErrorEncrypted.value) {
captionString = getString(R.string.loader_error_encrypted)
}
if (result == ErrorArticDisconnected) {
captionId = R.string.artic_base
if (result == CoreError.ErrorArticDisconnected.value) {
captionString = getString(R.string.artic_base)
}
val alert = MaterialAlertDialogBuilder(requireContext())
.setTitle(captionId)
.setTitle(captionString)
.setMessage(
Html.fromHtml(
if (result == ErrorArticDisconnected)
CitraApplication.appContext.resources.getString(R.string.artic_server_comm_error)
if (result == CoreError.ErrorArticDisconnected.value)
getString(R.string.artic_server_comm_error)
else if (result == CoreError.ErrorLoader_ErrorEncrypted.value)
getString(R.string.loader_error_encrypted_desc)
else
CitraApplication.appContext.resources.getString(R.string.redump_games),
getString(R.string.loader_error_generic, result),
Html.FROM_HTML_MODE_LEGACY
)
)
@ -496,21 +504,6 @@ object NativeLibrary {
const val RESULT_CODE = "resultcode"
const val Success = 0
const val ErrorNotInitialized = 1
const val ErrorGetLoader = 2
const val ErrorSystemMode = 3
const val ErrorLoader = 4
const val ErrorLoader_ErrorEncrypted = 5
const val ErrorLoader_ErrorInvalidFormat = 6
const val ErrorLoader_ErrorGBATitle = 7
const val ErrorSystemFiles = 8
const val ErrorSavestate = 9
const val ErrorArticDisconnected = 10
const val ErrorN3DSApplication = 11
const val ShutdownRequested = 12
const val ErrorUnknown = 13
fun newInstance(resultCode: Int): EmulationErrorDialogFragment {
val args = Bundle()
args.putInt(RESULT_CODE, resultCode)
@ -857,12 +850,23 @@ object NativeLibrary {
FileUtil.deleteDocument(path)
}
enum class CoreError {
ErrorSystemFiles,
ErrorSavestate,
ErrorArticDisconnected,
ErrorN3DSApplication,
ErrorUnknown
enum class CoreError(val value: Int) {
Success(0),
ErrorNotInitialized(1),
ErrorGetLoader(2),
ErrorSystemMode(3),
ErrorLoader(4),
ErrorLoader_ErrorEncrypted(5),
ErrorLoader_ErrorInvalidFormat(6),
ErrorLoader_ErrorGBATitle(7),
ErrorSystemFiles(8),
ErrorSavestate(9),
ErrorArticDisconnected(10),
ErrorN3DSApplication(11),
ErrorCoreExceptionRaised(12),
ErrorMemoryExceptionRaised(13),
ShutdownRequested(14),
ErrorUnknown(15)
}
enum class InstallStatus {

View file

@ -317,6 +317,7 @@ void Config::ReadValues() {
ReadSetting("Debugging", Settings::values.instant_debug_log);
ReadSetting("Debugging", Settings::values.enable_rpc_server);
ReadSetting("Debugging", Settings::values.toggle_unique_data_console_type);
ReadSetting("Debugging", Settings::values.break_on_unmapped_memory_access);
for (const auto& service_module : Service::service_module_map) {
bool use_lle =

View file

@ -35,7 +35,8 @@ constexpr std::array android_config_omitted_keys = {
Keys::audio_encoder,
Keys::audio_encoder_options,
Keys::audio_bitrate,
Keys::last_artic_base_addr, // On Android, this value is stored as a "preference"
Keys::last_artic_base_addr, // On Android, this value is stored as a "preference"
Keys::break_on_unmapped_memory_access, // Does nothing as the error is ignored
};
// clang-format off

View file

@ -393,7 +393,6 @@
<string name="learn_more">Learn More</string>
<string name="close">Close</string>
<string name="reset_to_default">Reset to Default</string>
<string name="redump_games"><![CDATA[Please follow the guides to redump your <a href="https://web.archive.org/web/20240304210021/https://citra-emu.org/wiki/dumping-game-cartridges/">game cartridges</a> or <a href="https://web.archive.org/web/20240304210011/https://citra-emu.org/wiki/dumping-installed-titles/">installed titles</a>.]]></string>
<string name="option_default">Default</string>
<string name="none">None</string>
<string name="auto">Auto</string>
@ -437,9 +436,11 @@
<!-- ROM loading errors -->
<string name="loader_error_encrypted">Your ROM is Encrypted</string>
<string name="loader_error_encrypted_desc"><![CDATA[Azahar does not support encrypted ROMS. Read our <a href="https://azahar-emu.org/blog/game-loading-changes/">blog post</a> for more information.]]></string>
<string name="loader_error_invalid_format">Invalid ROM format</string>
<string name="loader_error_file_not_found">ROM file does not exist</string>
<string name="no_game_present">No bootable game present!</string>
<string name="loader_error_generic">An error occurred while loading ROM: %d</string>
<!-- Emulation Menu -->
<string name="emulation_menu_help">Press Back to access the menu.</string>

View file

@ -855,10 +855,11 @@ void GMainWindow::InitializeHotkeys() {
// QAction Hotkeys
const auto link_action_shortcut = [&](QAction* action, const QString& action_name,
const bool primary_only = false) {
const bool primary_only = false,
const bool auto_repeat = false) {
static const QString main_window = QStringLiteral("Main Window");
action->setShortcut(hotkey_registry.GetKeySequence(main_window, action_name));
action->setAutoRepeat(false);
action->setAutoRepeat(auto_repeat);
this->addAction(action);
if (!primary_only)
secondary_window->addAction(action);
@ -875,6 +876,9 @@ void GMainWindow::InitializeHotkeys() {
link_action_shortcut(ui->action_Show_Status_Bar, QStringLiteral("Toggle Status Bar"));
link_action_shortcut(ui->action_Fullscreen, fullscreen, true);
link_action_shortcut(ui->action_Capture_Screenshot, QStringLiteral("Capture Screenshot"));
link_action_shortcut(ui->action_Debug_Pause, QStringLiteral("Debug Pause"));
link_action_shortcut(ui->action_Debug_Resume, QStringLiteral("Debug Resume"));
link_action_shortcut(ui->action_Debug_Step, QStringLiteral("Debug Step"), false, true);
link_action_shortcut(ui->action_Screen_Layout_Swap_Screens, QStringLiteral("Swap Screens"));
link_action_shortcut(ui->action_Screen_Layout_Upright_Screens,
QStringLiteral("Rotate Screens Upright"));
@ -1189,6 +1193,23 @@ void GMainWindow::ConnectMenuEvents() {
connect_menu(ui->action_Capture_Screenshot, &GMainWindow::OnCaptureScreenshot);
connect_menu(ui->action_Dump_Video, &GMainWindow::OnDumpVideo);
// Tools debug
connect_menu(ui->action_Debug_Pause, [this] {
if (emu_thread) {
emu_thread->SetRunning(false);
}
});
connect_menu(ui->action_Debug_Resume, [this] {
if (emu_thread) {
emu_thread->SetRunning(true);
}
});
connect_menu(ui->action_Debug_Step, [this] {
if (emu_thread) {
emu_thread->ExecStep();
}
});
// Tools
connect_menu(ui->action_Compress_ROM_File, &GMainWindow::OnCompressFile);
connect_menu(ui->action_Decompress_ROM_File, &GMainWindow::OnDecompressFile);

View file

@ -57,12 +57,15 @@ const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> QtConfi
// This must be in alphabetical order according to action name as it must have the same order as
// UISetting::values.shortcuts, which is alphabetically ordered.
// clang-format off
const std::array<UISettings::Shortcut, 38> QtConfig::default_hotkeys {{
const std::array<UISettings::Shortcut, 41> QtConfig::default_hotkeys {{
{QStringLiteral("Advance Frame"), QStringLiteral("Main Window"), {QStringLiteral(""), Qt::ApplicationShortcut}},
{QStringLiteral("Audio Mute/Unmute"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+M"), Qt::WindowShortcut}},
{QStringLiteral("Audio Volume Down"), QStringLiteral("Main Window"), {QStringLiteral(""), Qt::WindowShortcut}},
{QStringLiteral("Audio Volume Up"), QStringLiteral("Main Window"), {QStringLiteral(""), Qt::WindowShortcut}},
{QStringLiteral("Capture Screenshot"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+P"), Qt::WidgetWithChildrenShortcut}},
{QStringLiteral("Debug Pause"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+F4"),Qt::WidgetWithChildrenShortcut}},
{QStringLiteral("Debug Resume"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+F5"),Qt::WidgetWithChildrenShortcut}},
{QStringLiteral("Debug Step"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+F6"),Qt::WidgetWithChildrenShortcut}},
{QStringLiteral("Continue/Pause Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F4"), Qt::WindowShortcut}},
{QStringLiteral("Decrease 3D Factor"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+-"), Qt::ApplicationShortcut}},
{QStringLiteral("Decrease Speed Limit"), QStringLiteral("Main Window"), {QStringLiteral("-"), Qt::ApplicationShortcut}},

View file

@ -26,7 +26,7 @@ public:
static const std::array<int, Settings::NativeButton::NumButtons> default_buttons;
static const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> default_analogs;
static const std::array<UISettings::Shortcut, 38> default_hotkeys;
static const std::array<UISettings::Shortcut, 41> default_hotkeys;
private:
void Initialize(const std::string& config_name);

View file

@ -206,6 +206,16 @@
<addaction name="action_Advance_Frame"/>
<addaction name="menu_Movie"/>
<addaction name="separator"/>
<widget class="QMenu" name="menu_Debug">
<property name="title">
<string>Debug</string>
</property>
<addaction name="action_Debug_Pause"/>
<addaction name="action_Debug_Resume"/>
<addaction name="action_Debug_Step"/>
</widget>
<addaction name="menu_Debug"/>
<addaction name="separator"/>
<addaction name="action_Capture_Screenshot"/>
<addaction name="action_Dump_Video"/>
<addaction name="separator"/>
@ -453,6 +463,30 @@
<string>Capture Screenshot</string>
</property>
</action>
<action name="action_Debug_Pause">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Debug Pause</string>
</property>
</action>
<action name="action_Debug_Resume">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Debug Resume</string>
</property>
</action>
<action name="action_Debug_Step">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Debug Step</string>
</property>
</action>
<action name="action_Dump_Video">
<property name="checkable">
<bool>true</bool>

View file

@ -1,4 +1,4 @@
// Copyright 2014 Citra Emulator Project
// Copyright Citra Emulator Project / Azahar Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.