Compare commits

..

4 Commits

Author SHA1 Message Date
lizzie d336341c8d 2026-09-27 17:50:19
Signed-off-by: lizzie <lizzie@eden-emu.dev>
2026-09-27 17:50:19 +00:00
lizzie a4fd5c6b0b 2026-09-27 17:15:36
Signed-off-by: lizzie <lizzie@eden-emu.dev>
2026-09-27 17:15:37 +00:00
lizzie ef7e9c00b0 2026-09-27 16:59:33
Signed-off-by: lizzie <lizzie@eden-emu.dev>
2026-09-27 16:59:33 +00:00
lizzie 3be0db1266 2026-09-27 15:50:47
Signed-off-by: lizzie <lizzie@eden-emu.dev>
2026-09-27 16:58:25 +00:00
77 changed files with 12776 additions and 12657 deletions
+1 -1
View File
@@ -79,7 +79,7 @@
"name": "ffmpeg", "name": "ffmpeg",
"package": "FFmpeg", "package": "FFmpeg",
"repo": "crueter-ci/FFmpeg", "repo": "crueter-ci/FFmpeg",
"version": "9.0.2-1790726865-946fcce07b" "version": "9.0.1-1788120736-bf1b838f2a"
}, },
"fmt": { "fmt": {
"hash": "f0da82c545b01692e9fd30fdfb613dbb8dd9716983dcd0ff19ac2a8d36f74beb5540ef38072fdecc1e34191b3682a8542ecbf3a61ef287dbba0a2679d4e023f2", "hash": "f0da82c545b01692e9fd30fdfb613dbb8dd9716983dcd0ff19ac2a8d36f74beb5540ef38072fdecc1e34191b3682a8542ecbf3a61ef287dbba0a2679d4e023f2",
+473 -455
View File
File diff suppressed because it is too large Load Diff
+456 -439
View File
File diff suppressed because it is too large Load Diff
+456 -439
View File
File diff suppressed because it is too large Load Diff
+456 -439
View File
File diff suppressed because it is too large Load Diff
+463 -440
View File
File diff suppressed because it is too large Load Diff
+456 -439
View File
File diff suppressed because it is too large Load Diff
+456 -439
View File
File diff suppressed because it is too large Load Diff
+456 -439
View File
File diff suppressed because it is too large Load Diff
+456 -439
View File
File diff suppressed because it is too large Load Diff
+456 -439
View File
File diff suppressed because it is too large Load Diff
+457 -440
View File
File diff suppressed because it is too large Load Diff
+456 -439
View File
File diff suppressed because it is too large Load Diff
+456 -439
View File
File diff suppressed because it is too large Load Diff
+463 -440
View File
File diff suppressed because it is too large Load Diff
+456 -439
View File
File diff suppressed because it is too large Load Diff
+456 -439
View File
File diff suppressed because it is too large Load Diff
+456 -439
View File
File diff suppressed because it is too large Load Diff
+456 -439
View File
File diff suppressed because it is too large Load Diff
+456 -439
View File
File diff suppressed because it is too large Load Diff
+463 -440
View File
File diff suppressed because it is too large Load Diff
+463 -440
View File
File diff suppressed because it is too large Load Diff
+456 -439
View File
File diff suppressed because it is too large Load Diff
+456 -439
View File
File diff suppressed because it is too large Load Diff
+456 -439
View File
File diff suppressed because it is too large Load Diff
+456 -439
View File
File diff suppressed because it is too large Load Diff
+463 -440
View File
File diff suppressed because it is too large Load Diff
+456 -439
View File
File diff suppressed because it is too large Load Diff
@@ -23,7 +23,6 @@ import org.yuzu.yuzu_emu.model.Driver.Companion.toDriver
import org.yuzu.yuzu_emu.utils.GpuDriverHelper import org.yuzu.yuzu_emu.utils.GpuDriverHelper
import org.yuzu.yuzu_emu.NativeLibrary import org.yuzu.yuzu_emu.NativeLibrary
import org.yuzu.yuzu_emu.utils.GpuDriverMetadata import org.yuzu.yuzu_emu.utils.GpuDriverMetadata
import org.yuzu.yuzu_emu.utils.DirectoryInitialization
import org.yuzu.yuzu_emu.utils.NativeConfig import org.yuzu.yuzu_emu.utils.NativeConfig
import java.io.File import java.io.File
@@ -147,11 +146,11 @@ class DriverViewModel : ViewModel() {
private fun wipeGameShaders(game: Game) { private fun wipeGameShaders(game: Game) {
viewModelScope.launch { viewModelScope.launch {
withContext(Dispatchers.IO) { withContext(Dispatchers.IO) {
val userDirectory = DirectoryInitialization.userDirectory val externalFilesDir = YuzuApplication.appContext.getExternalFilesDir(null)
?: return@withContext ?: return@withContext
val shaderDir = File( val shaderDir = File(
userDirectory + externalFilesDir.absolutePath +
"/cache/shader/" + game.settingsName.lowercase() "/shader/" + game.settingsName.lowercase()
) )
if (shaderDir.exists()) { if (shaderDir.exists()) {
shaderDir.deleteRecursively() shaderDir.deleteRecursively()
-1
View File
@@ -62,7 +62,6 @@ add_library(
fs/fs_util.h fs/fs_util.h
fs/path_util.cpp fs/path_util.cpp
fs/path_util.h fs/path_util.h
hash.h
heap_tracker.cpp heap_tracker.cpp
heap_tracker.h heap_tracker.h
hex_util.cpp hex_util.cpp
+252 -251
View File
@@ -12,93 +12,94 @@
#include "common/android/multiplayer/multiplayer.h" #include "common/android/multiplayer/multiplayer.h"
#include <network/network.h> #include <network/network.h>
static struct {
JavaVM *java_vm;
jclass native_library_class;
jclass disk_cache_progress_class;
jclass load_callback_stage_class;
jclass game_dir_class;
jmethodID game_dir_constructor;
jmethodID exit_emulation_activity;
jmethodID disk_cache_load_progress;
jmethodID on_emulation_started;
jmethodID on_emulation_stopped;
jmethodID on_program_changed;
jmethodID copy_to_storage;
jmethodID file_exists;
jmethodID file_extension;
static JavaVM *s_java_vm; jclass game_class;
static jclass s_native_library_class; jmethodID game_constructor;
static jclass s_disk_cache_progress_class; jfieldID game_title_field;
static jclass s_load_callback_stage_class; jfieldID game_path_field;
static jclass s_game_dir_class; jfieldID game_program_id_field;
static jmethodID s_game_dir_constructor; jfieldID game_developer_field;
static jmethodID s_exit_emulation_activity; jfieldID game_version_field;
static jmethodID s_disk_cache_load_progress; jfieldID game_is_homebrew_field;
static jmethodID s_on_emulation_started;
static jmethodID s_on_emulation_stopped;
static jmethodID s_on_program_changed;
static jmethodID s_copy_to_storage;
static jmethodID s_file_exists;
static jmethodID s_file_extension;
static jclass s_game_class; jclass string_class;
static jmethodID s_game_constructor; jclass pair_class;
static jfieldID s_game_title_field; jmethodID pair_constructor;
static jfieldID s_game_path_field; jfieldID pair_first_field;
static jfieldID s_game_program_id_field; jfieldID pair_second_field;
static jfieldID s_game_developer_field;
static jfieldID s_game_version_field;
static jfieldID s_game_is_homebrew_field;
static jclass s_string_class; jclass overlay_control_data_class;
static jclass s_pair_class; jmethodID overlay_control_data_constructor;
static jmethodID s_pair_constructor; jfieldID overlay_control_data_id_field;
static jfieldID s_pair_first_field; jfieldID overlay_control_data_enabled_field;
static jfieldID s_pair_second_field; jfieldID overlay_control_data_individual_scale_field;
jfieldID overlay_control_data_landscape_position_field;
jfieldID overlay_control_data_portrait_position_field;
jfieldID overlay_control_data_foldable_position_field;
static jclass s_overlay_control_data_class; jclass patch_class;
static jmethodID s_overlay_control_data_constructor; jmethodID patch_constructor;
static jfieldID s_overlay_control_data_id_field; jfieldID patch_enabled_field;
static jfieldID s_overlay_control_data_enabled_field; jfieldID patch_name_field;
static jfieldID s_overlay_control_data_individual_scale_field; jfieldID patch_version_field;
static jfieldID s_overlay_control_data_landscape_position_field; jfieldID patch_type_field;
static jfieldID s_overlay_control_data_portrait_position_field; jfieldID patch_program_id_field;
static jfieldID s_overlay_control_data_foldable_position_field; jfieldID patch_title_id_field;
static jclass s_patch_class; jclass double_class;
static jmethodID s_patch_constructor; jmethodID double_constructor;
static jfieldID s_patch_enabled_field; jmethodID double_value_method;
static jfieldID s_patch_name_field;
static jfieldID s_patch_version_field;
static jfieldID s_patch_type_field;
static jfieldID s_patch_program_id_field;
static jfieldID s_patch_title_id_field;
static jclass s_double_class; jclass integer_class;
static jmethodID s_double_constructor; jmethodID integer_constructor;
static jmethodID s_double_value_method; jmethodID integer_value_method;
static jclass s_integer_class; jclass boolean_class;
static jmethodID s_integer_constructor; jmethodID boolean_constructor;
static jmethodID s_integer_value_method; jmethodID boolean_value_method;
static jclass s_boolean_class; jclass player_input_class;
static jmethodID s_boolean_constructor; jmethodID player_input_constructor;
static jmethodID s_boolean_value_method; jfieldID player_input_connected_field;
jfieldID player_input_buttons_field;
jfieldID player_input_analogs_field;
jfieldID player_input_motions_field;
jfieldID player_input_vibration_enabled_field;
jfieldID player_input_vibration_strength_field;
jfieldID player_input_body_color_left_field;
jfieldID player_input_body_color_right_field;
jfieldID player_input_button_color_left_field;
jfieldID player_input_button_color_right_field;
jfieldID player_input_profile_name_field;
jfieldID player_input_use_system_vibrator_field;
static jclass s_player_input_class; jclass yuzu_input_device_interface;
static jmethodID s_player_input_constructor; jmethodID yuzu_input_device_get_name;
static jfieldID s_player_input_connected_field; jmethodID yuzu_input_device_get_guid;
static jfieldID s_player_input_buttons_field; jmethodID yuzu_input_device_get_port;
static jfieldID s_player_input_analogs_field; jmethodID yuzu_input_device_get_supports_vibration;
static jfieldID s_player_input_motions_field; jmethodID yuzu_input_device_vibrate;
static jfieldID s_player_input_vibration_enabled_field; jmethodID yuzu_input_device_get_axes;
static jfieldID s_player_input_vibration_strength_field; jmethodID yuzu_input_device_has_keys;
static jfieldID s_player_input_body_color_left_field;
static jfieldID s_player_input_body_color_right_field;
static jfieldID s_player_input_button_color_left_field;
static jfieldID s_player_input_button_color_right_field;
static jfieldID s_player_input_profile_name_field;
static jfieldID s_player_input_use_system_vibrator_field;
static jclass s_yuzu_input_device_interface; jmethodID add_netplay_message;
static jmethodID s_yuzu_input_device_get_name; jmethodID clear_chat;
static jmethodID s_yuzu_input_device_get_guid; } state;
static jmethodID s_yuzu_input_device_get_port;
static jmethodID s_yuzu_input_device_get_supports_vibration;
static jmethodID s_yuzu_input_device_vibrate;
static jmethodID s_yuzu_input_device_get_axes;
static jmethodID s_yuzu_input_device_has_keys;
static jmethodID s_add_netplay_message;
static jmethodID s_clear_chat;
static constexpr jint JNI_VERSION = JNI_VERSION_1_6; static constexpr jint JNI_VERSION = JNI_VERSION_1_6;
@@ -106,14 +107,14 @@ namespace Common::Android {
JNIEnv *GetEnvForThread() { JNIEnv *GetEnvForThread() {
thread_local static struct OwnedEnv { thread_local static struct OwnedEnv {
OwnedEnv() { OwnedEnv() {
status = s_java_vm->GetEnv(reinterpret_cast<void **>(&env), JNI_VERSION_1_6); status = state.java_vm->GetEnv(reinterpret_cast<void **>(&env), JNI_VERSION_1_6);
if (status == JNI_EDETACHED) if (status == JNI_EDETACHED)
s_java_vm->AttachCurrentThread(&env, nullptr); state.java_vm->AttachCurrentThread(&env, nullptr);
} }
~OwnedEnv() { ~OwnedEnv() {
if (status == JNI_EDETACHED) if (status == JNI_EDETACHED)
s_java_vm->DetachCurrentThread(); state.java_vm->DetachCurrentThread();
} }
int status; int status;
@@ -123,303 +124,303 @@ namespace Common::Android {
} }
jclass GetNativeLibraryClass() { jclass GetNativeLibraryClass() {
return s_native_library_class; return state.native_library_class;
} }
jclass GetDiskCacheProgressClass() { jclass GetDiskCacheProgressClass() {
return s_disk_cache_progress_class; return state.disk_cache_progress_class;
} }
jclass GetDiskCacheLoadCallbackStageClass() { jclass GetDiskCacheLoadCallbackStageClass() {
return s_load_callback_stage_class; return state.load_callback_stage_class;
} }
jclass GetGameDirClass() { jclass GetGameDirClass() {
return s_game_dir_class; return state.game_dir_class;
} }
jmethodID GetGameDirConstructor() { jmethodID GetGameDirConstructor() {
return s_game_dir_constructor; return state.game_dir_constructor;
} }
jmethodID GetExitEmulationActivity() { jmethodID GetExitEmulationActivity() {
return s_exit_emulation_activity; return state.exit_emulation_activity;
} }
jmethodID GetDiskCacheLoadProgress() { jmethodID GetDiskCacheLoadProgress() {
return s_disk_cache_load_progress; return state.disk_cache_load_progress;
} }
jmethodID GetCopyToStorage() { jmethodID GetCopyToStorage() {
return s_copy_to_storage; return state.copy_to_storage;
} }
jmethodID GetFileExists() { jmethodID GetFileExists() {
return s_file_exists; return state.file_exists;
} }
jmethodID GetFileExtension() { jmethodID GetFileExtension() {
return s_file_extension; return state.file_extension;
} }
jmethodID GetOnEmulationStarted() { jmethodID GetOnEmulationStarted() {
return s_on_emulation_started; return state.on_emulation_started;
} }
jmethodID GetOnEmulationStopped() { jmethodID GetOnEmulationStopped() {
return s_on_emulation_stopped; return state.on_emulation_stopped;
} }
jmethodID GetOnProgramChanged() { jmethodID GetOnProgramChanged() {
return s_on_program_changed; return state.on_program_changed;
} }
jclass GetGameClass() { jclass GetGameClass() {
return s_game_class; return state.game_class;
} }
jmethodID GetGameConstructor() { jmethodID GetGameConstructor() {
return s_game_constructor; return state.game_constructor;
} }
jfieldID GetGameTitleField() { jfieldID GetGameTitleField() {
return s_game_title_field; return state.game_title_field;
} }
jfieldID GetGamePathField() { jfieldID GetGamePathField() {
return s_game_path_field; return state.game_path_field;
} }
jfieldID GetGameProgramIdField() { jfieldID GetGameProgramIdField() {
return s_game_program_id_field; return state.game_program_id_field;
} }
jfieldID GetGameDeveloperField() { jfieldID GetGameDeveloperField() {
return s_game_developer_field; return state.game_developer_field;
} }
jfieldID GetGameVersionField() { jfieldID GetGameVersionField() {
return s_game_version_field; return state.game_version_field;
} }
jfieldID GetGameIsHomebrewField() { jfieldID GetGameIsHomebrewField() {
return s_game_is_homebrew_field; return state.game_is_homebrew_field;
} }
jclass GetStringClass() { jclass GetStringClass() {
return s_string_class; return state.string_class;
} }
jclass GetPairClass() { jclass GetPairClass() {
return s_pair_class; return state.pair_class;
} }
jmethodID GetPairConstructor() { jmethodID GetPairConstructor() {
return s_pair_constructor; return state.pair_constructor;
} }
jfieldID GetPairFirstField() { jfieldID GetPairFirstField() {
return s_pair_first_field; return state.pair_first_field;
} }
jfieldID GetPairSecondField() { jfieldID GetPairSecondField() {
return s_pair_second_field; return state.pair_second_field;
} }
jclass GetOverlayControlDataClass() { jclass GetOverlayControlDataClass() {
return s_overlay_control_data_class; return state.overlay_control_data_class;
} }
jmethodID GetOverlayControlDataConstructor() { jmethodID GetOverlayControlDataConstructor() {
return s_overlay_control_data_constructor; return state.overlay_control_data_constructor;
} }
jfieldID GetOverlayControlDataIdField() { jfieldID GetOverlayControlDataIdField() {
return s_overlay_control_data_id_field; return state.overlay_control_data_id_field;
} }
jfieldID GetOverlayControlDataEnabledField() { jfieldID GetOverlayControlDataEnabledField() {
return s_overlay_control_data_enabled_field; return state.overlay_control_data_enabled_field;
} }
jfieldID GetOverlayControlDataIndividualScaleField() { jfieldID GetOverlayControlDataIndividualScaleField() {
return s_overlay_control_data_individual_scale_field; return state.overlay_control_data_individual_scale_field;
} }
jfieldID GetOverlayControlDataLandscapePositionField() { jfieldID GetOverlayControlDataLandscapePositionField() {
return s_overlay_control_data_landscape_position_field; return state.overlay_control_data_landscape_position_field;
} }
jfieldID GetOverlayControlDataPortraitPositionField() { jfieldID GetOverlayControlDataPortraitPositionField() {
return s_overlay_control_data_portrait_position_field; return state.overlay_control_data_portrait_position_field;
} }
jfieldID GetOverlayControlDataFoldablePositionField() { jfieldID GetOverlayControlDataFoldablePositionField() {
return s_overlay_control_data_foldable_position_field; return state.overlay_control_data_foldable_position_field;
} }
jclass GetPatchClass() { jclass GetPatchClass() {
return s_patch_class; return state.patch_class;
} }
jmethodID GetPatchConstructor() { jmethodID GetPatchConstructor() {
return s_patch_constructor; return state.patch_constructor;
} }
jfieldID GetPatchEnabledField() { jfieldID GetPatchEnabledField() {
return s_patch_enabled_field; return state.patch_enabled_field;
} }
jfieldID GetPatchNameField() { jfieldID GetPatchNameField() {
return s_patch_name_field; return state.patch_name_field;
} }
jfieldID GetPatchVersionField() { jfieldID GetPatchVersionField() {
return s_patch_version_field; return state.patch_version_field;
} }
jfieldID GetPatchTypeField() { jfieldID GetPatchTypeField() {
return s_patch_type_field; return state.patch_type_field;
} }
jfieldID GetPatchProgramIdField() { jfieldID GetPatchProgramIdField() {
return s_patch_program_id_field; return state.patch_program_id_field;
} }
jfieldID GetPatchTitleIdField() { jfieldID GetPatchTitleIdField() {
return s_patch_title_id_field; return state.patch_title_id_field;
} }
jclass GetDoubleClass() { jclass GetDoubleClass() {
return s_double_class; return state.double_class;
} }
jmethodID GetDoubleConstructor() { jmethodID GetDoubleConstructor() {
return s_double_constructor; return state.double_constructor;
} }
jmethodID GetDoubleValueMethod() { jmethodID GetDoubleValueMethod() {
return s_double_value_method; return state.double_value_method;
} }
jclass GetIntegerClass() { jclass GetIntegerClass() {
return s_integer_class; return state.integer_class;
} }
jmethodID GetIntegerConstructor() { jmethodID GetIntegerConstructor() {
return s_integer_constructor; return state.integer_constructor;
} }
jmethodID GetIntegerValueMethod() { jmethodID GetIntegerValueMethod() {
return s_integer_value_method; return state.integer_value_method;
} }
jclass GetBooleanClass() { jclass GetBooleanClass() {
return s_boolean_class; return state.boolean_class;
} }
jmethodID GetBooleanConstructor() { jmethodID GetBooleanConstructor() {
return s_boolean_constructor; return state.boolean_constructor;
} }
jmethodID GetBooleanValueMethod() { jmethodID GetBooleanValueMethod() {
return s_boolean_value_method; return state.boolean_value_method;
} }
jclass GetPlayerInputClass() { jclass GetPlayerInputClass() {
return s_player_input_class; return state.player_input_class;
} }
jmethodID GetPlayerInputConstructor() { jmethodID GetPlayerInputConstructor() {
return s_player_input_constructor; return state.player_input_constructor;
} }
jfieldID GetPlayerInputConnectedField() { jfieldID GetPlayerInputConnectedField() {
return s_player_input_connected_field; return state.player_input_connected_field;
} }
jfieldID GetPlayerInputButtonsField() { jfieldID GetPlayerInputButtonsField() {
return s_player_input_buttons_field; return state.player_input_buttons_field;
} }
jfieldID GetPlayerInputAnalogsField() { jfieldID GetPlayerInputAnalogsField() {
return s_player_input_analogs_field; return state.player_input_analogs_field;
} }
jfieldID GetPlayerInputMotionsField() { jfieldID GetPlayerInputMotionsField() {
return s_player_input_motions_field; return state.player_input_motions_field;
} }
jfieldID GetPlayerInputVibrationEnabledField() { jfieldID GetPlayerInputVibrationEnabledField() {
return s_player_input_vibration_enabled_field; return state.player_input_vibration_enabled_field;
} }
jfieldID GetPlayerInputVibrationStrengthField() { jfieldID GetPlayerInputVibrationStrengthField() {
return s_player_input_vibration_strength_field; return state.player_input_vibration_strength_field;
} }
jfieldID GetPlayerInputBodyColorLeftField() { jfieldID GetPlayerInputBodyColorLeftField() {
return s_player_input_body_color_left_field; return state.player_input_body_color_left_field;
} }
jfieldID GetPlayerInputBodyColorRightField() { jfieldID GetPlayerInputBodyColorRightField() {
return s_player_input_body_color_right_field; return state.player_input_body_color_right_field;
} }
jfieldID GetPlayerInputButtonColorLeftField() { jfieldID GetPlayerInputButtonColorLeftField() {
return s_player_input_button_color_left_field; return state.player_input_button_color_left_field;
} }
jfieldID GetPlayerInputButtonColorRightField() { jfieldID GetPlayerInputButtonColorRightField() {
return s_player_input_button_color_right_field; return state.player_input_button_color_right_field;
} }
jfieldID GetPlayerInputProfileNameField() { jfieldID GetPlayerInputProfileNameField() {
return s_player_input_profile_name_field; return state.player_input_profile_name_field;
} }
jfieldID GetPlayerInputUseSystemVibratorField() { jfieldID GetPlayerInputUseSystemVibratorField() {
return s_player_input_use_system_vibrator_field; return state.player_input_use_system_vibrator_field;
} }
jclass GetYuzuInputDeviceInterface() { jclass GetYuzuInputDeviceInterface() {
return s_yuzu_input_device_interface; return state.yuzu_input_device_interface;
} }
jmethodID GetYuzuDeviceGetName() { jmethodID GetYuzuDeviceGetName() {
return s_yuzu_input_device_get_name; return state.yuzu_input_device_get_name;
} }
jmethodID GetYuzuDeviceGetGUID() { jmethodID GetYuzuDeviceGetGUID() {
return s_yuzu_input_device_get_guid; return state.yuzu_input_device_get_guid;
} }
jmethodID GetYuzuDeviceGetPort() { jmethodID GetYuzuDeviceGetPort() {
return s_yuzu_input_device_get_port; return state.yuzu_input_device_get_port;
} }
jmethodID GetYuzuDeviceGetSupportsVibration() { jmethodID GetYuzuDeviceGetSupportsVibration() {
return s_yuzu_input_device_get_supports_vibration; return state.yuzu_input_device_get_supports_vibration;
} }
jmethodID GetYuzuDeviceVibrate() { jmethodID GetYuzuDeviceVibrate() {
return s_yuzu_input_device_vibrate; return state.yuzu_input_device_vibrate;
} }
jmethodID GetYuzuDeviceGetAxes() { jmethodID GetYuzuDeviceGetAxes() {
return s_yuzu_input_device_get_axes; return state.yuzu_input_device_get_axes;
} }
jmethodID GetYuzuDeviceHasKeys() { jmethodID GetYuzuDeviceHasKeys() {
return s_yuzu_input_device_has_keys; return state.yuzu_input_device_has_keys;
} }
jmethodID GetAddNetPlayMessage() { jmethodID GetAddNetPlayMessage() {
return s_add_netplay_message; return state.add_netplay_message;
} }
jmethodID ClearChat() { jmethodID ClearChat() {
return s_clear_chat; return state.clear_chat;
} }
#ifdef __cplusplus #ifdef __cplusplus
@@ -436,20 +437,20 @@ namespace Common::Android {
// UnInitialize Android Storage // UnInitialize Android Storage
Common::FS::Android::UnRegisterCallbacks(); Common::FS::Android::UnRegisterCallbacks();
env->DeleteGlobalRef(s_native_library_class); env->DeleteGlobalRef(state.native_library_class);
env->DeleteGlobalRef(s_disk_cache_progress_class); env->DeleteGlobalRef(state.disk_cache_progress_class);
env->DeleteGlobalRef(s_load_callback_stage_class); env->DeleteGlobalRef(state.load_callback_stage_class);
env->DeleteGlobalRef(s_game_dir_class); env->DeleteGlobalRef(state.game_dir_class);
env->DeleteGlobalRef(s_game_class); env->DeleteGlobalRef(state.game_class);
env->DeleteGlobalRef(s_string_class); env->DeleteGlobalRef(state.string_class);
env->DeleteGlobalRef(s_pair_class); env->DeleteGlobalRef(state.pair_class);
env->DeleteGlobalRef(s_overlay_control_data_class); env->DeleteGlobalRef(state.overlay_control_data_class);
env->DeleteGlobalRef(s_patch_class); env->DeleteGlobalRef(state.patch_class);
env->DeleteGlobalRef(s_double_class); env->DeleteGlobalRef(state.double_class);
env->DeleteGlobalRef(s_integer_class); env->DeleteGlobalRef(state.integer_class);
env->DeleteGlobalRef(s_boolean_class); env->DeleteGlobalRef(state.boolean_class);
env->DeleteGlobalRef(s_player_input_class); env->DeleteGlobalRef(state.player_input_class);
env->DeleteGlobalRef(s_yuzu_input_device_interface); env->DeleteGlobalRef(state.yuzu_input_device_interface);
// UnInitialize applets // UnInitialize applets
SoftwareKeyboard::CleanupJNI(env); SoftwareKeyboard::CleanupJNI(env);
@@ -463,7 +464,7 @@ namespace Common::Android {
#endif #endif
void Initialize(JavaVM* vm, JNIEnv *env) { void Initialize(JavaVM* vm, JNIEnv *env) {
s_java_vm = vm; state.java_vm = vm;
InitFFmpegOnLoad(vm); InitFFmpegOnLoad(vm);
if (env->ExceptionCheck()) { if (env->ExceptionCheck()) {
@@ -472,169 +473,169 @@ void Initialize(JavaVM* vm, JNIEnv *env) {
// Initialize Java classes // Initialize Java classes
const jclass native_library_class = env->FindClass("org/yuzu/yuzu_emu/NativeLibrary"); const jclass native_library_class = env->FindClass("org/yuzu/yuzu_emu/NativeLibrary");
s_native_library_class = reinterpret_cast<jclass>(env->NewGlobalRef(native_library_class)); state.native_library_class = reinterpret_cast<jclass>(env->NewGlobalRef(native_library_class));
s_disk_cache_progress_class = reinterpret_cast<jclass>(env->NewGlobalRef( state.disk_cache_progress_class = reinterpret_cast<jclass>(env->NewGlobalRef(
env->FindClass("org/yuzu/yuzu_emu/disk_shader_cache/DiskShaderCacheProgress"))); env->FindClass("org/yuzu/yuzu_emu/disk_shader_cache/DiskShaderCacheProgress")));
s_load_callback_stage_class = reinterpret_cast<jclass>(env->NewGlobalRef(env->FindClass( state.load_callback_stage_class = reinterpret_cast<jclass>(env->NewGlobalRef(env->FindClass(
"org/yuzu/yuzu_emu/disk_shader_cache/DiskShaderCacheProgress$LoadCallbackStage"))); "org/yuzu/yuzu_emu/disk_shader_cache/DiskShaderCacheProgress$LoadCallbackStage")));
const jclass game_dir_class = env->FindClass("org/yuzu/yuzu_emu/model/GameDir"); const jclass game_dir_class = env->FindClass("org/yuzu/yuzu_emu/model/GameDir");
s_game_dir_class = reinterpret_cast<jclass>(env->NewGlobalRef(game_dir_class)); state.game_dir_class = reinterpret_cast<jclass>(env->NewGlobalRef(game_dir_class));
s_game_dir_constructor = env->GetMethodID(game_dir_class, "<init>", state.game_dir_constructor = env->GetMethodID(game_dir_class, "<init>",
"(Ljava/lang/String;Z)V"); "(Ljava/lang/String;Z)V");
env->DeleteLocalRef(game_dir_class); env->DeleteLocalRef(game_dir_class);
// Initialize methods // Initialize methods
s_exit_emulation_activity = state.exit_emulation_activity =
env->GetStaticMethodID(s_native_library_class, "exitEmulationActivity", "(I)V"); env->GetStaticMethodID(state.native_library_class, "exitEmulationActivity", "(I)V");
s_disk_cache_load_progress = state.disk_cache_load_progress =
env->GetStaticMethodID(s_disk_cache_progress_class, "loadProgress", "(III)V"); env->GetStaticMethodID(state.disk_cache_progress_class, "loadProgress", "(III)V");
s_copy_to_storage = env->GetStaticMethodID(s_native_library_class, "copyFileToStorage", state.copy_to_storage = env->GetStaticMethodID(state.native_library_class, "copyFileToStorage",
"(Ljava/lang/String;Ljava/lang/String;)Z"); "(Ljava/lang/String;Ljava/lang/String;)Z");
s_file_exists = env->GetStaticMethodID(s_native_library_class, "exists", state.file_exists = env->GetStaticMethodID(state.native_library_class, "exists",
"(Ljava/lang/String;)Z"); "(Ljava/lang/String;)Z");
s_file_extension = env->GetStaticMethodID(s_native_library_class, "getFileExtension", state.file_extension = env->GetStaticMethodID(state.native_library_class, "getFileExtension",
"(Ljava/lang/String;)Ljava/lang/String;"); "(Ljava/lang/String;)Ljava/lang/String;");
s_on_emulation_started = state.on_emulation_started =
env->GetStaticMethodID(s_native_library_class, "onEmulationStarted", "()V"); env->GetStaticMethodID(state.native_library_class, "onEmulationStarted", "()V");
s_on_emulation_stopped = state.on_emulation_stopped =
env->GetStaticMethodID(s_native_library_class, "onEmulationStopped", "(I)V"); env->GetStaticMethodID(state.native_library_class, "onEmulationStopped", "(I)V");
s_on_program_changed = state.on_program_changed =
env->GetStaticMethodID(s_native_library_class, "onProgramChanged", "(I)V"); env->GetStaticMethodID(state.native_library_class, "onProgramChanged", "(I)V");
const jclass game_class = env->FindClass("org/yuzu/yuzu_emu/model/Game"); const jclass game_class = env->FindClass("org/yuzu/yuzu_emu/model/Game");
s_game_class = reinterpret_cast<jclass>(env->NewGlobalRef(game_class)); state.game_class = reinterpret_cast<jclass>(env->NewGlobalRef(game_class));
s_game_constructor = env->GetMethodID(game_class, "<init>", state.game_constructor = env->GetMethodID(game_class, "<init>",
"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/" "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/"
"String;Ljava/lang/String;Ljava/lang/String;Z)V"); "String;Ljava/lang/String;Ljava/lang/String;Z)V");
s_game_title_field = env->GetFieldID(game_class, "title", "Ljava/lang/String;"); state.game_title_field = env->GetFieldID(game_class, "title", "Ljava/lang/String;");
s_game_path_field = env->GetFieldID(game_class, "path", "Ljava/lang/String;"); state.game_path_field = env->GetFieldID(game_class, "path", "Ljava/lang/String;");
s_game_program_id_field = env->GetFieldID(game_class, "programId", "Ljava/lang/String;"); state.game_program_id_field = env->GetFieldID(game_class, "programId", "Ljava/lang/String;");
s_game_developer_field = env->GetFieldID(game_class, "developer", "Ljava/lang/String;"); state.game_developer_field = env->GetFieldID(game_class, "developer", "Ljava/lang/String;");
s_game_version_field = env->GetFieldID(game_class, "version", "Ljava/lang/String;"); state.game_version_field = env->GetFieldID(game_class, "version", "Ljava/lang/String;");
s_game_is_homebrew_field = env->GetFieldID(game_class, "isHomebrew", "Z"); state.game_is_homebrew_field = env->GetFieldID(game_class, "isHomebrew", "Z");
env->DeleteLocalRef(game_class); env->DeleteLocalRef(game_class);
const jclass string_class = env->FindClass("java/lang/String"); const jclass string_class = env->FindClass("java/lang/String");
s_string_class = reinterpret_cast<jclass>(env->NewGlobalRef(string_class)); state.string_class = reinterpret_cast<jclass>(env->NewGlobalRef(string_class));
env->DeleteLocalRef(string_class); env->DeleteLocalRef(string_class);
const jclass pair_class = env->FindClass("kotlin/Pair"); const jclass pair_class = env->FindClass("kotlin/Pair");
s_pair_class = reinterpret_cast<jclass>(env->NewGlobalRef(pair_class)); state.pair_class = reinterpret_cast<jclass>(env->NewGlobalRef(pair_class));
s_pair_constructor = state.pair_constructor =
env->GetMethodID(pair_class, "<init>", "(Ljava/lang/Object;Ljava/lang/Object;)V"); env->GetMethodID(pair_class, "<init>", "(Ljava/lang/Object;Ljava/lang/Object;)V");
s_pair_first_field = env->GetFieldID(pair_class, "first", "Ljava/lang/Object;"); state.pair_first_field = env->GetFieldID(pair_class, "first", "Ljava/lang/Object;");
s_pair_second_field = env->GetFieldID(pair_class, "second", "Ljava/lang/Object;"); state.pair_second_field = env->GetFieldID(pair_class, "second", "Ljava/lang/Object;");
env->DeleteLocalRef(pair_class); env->DeleteLocalRef(pair_class);
const jclass overlay_control_data_class = const jclass overlay_control_data_class =
env->FindClass("org/yuzu/yuzu_emu/overlay/model/OverlayControlData"); env->FindClass("org/yuzu/yuzu_emu/overlay/model/OverlayControlData");
s_overlay_control_data_class = state.overlay_control_data_class =
reinterpret_cast<jclass>(env->NewGlobalRef(overlay_control_data_class)); reinterpret_cast<jclass>(env->NewGlobalRef(overlay_control_data_class));
s_overlay_control_data_constructor = state.overlay_control_data_constructor =
env->GetMethodID(overlay_control_data_class, "<init>", env->GetMethodID(overlay_control_data_class, "<init>",
"(Ljava/lang/String;ZLkotlin/Pair;Lkotlin/Pair;Lkotlin/Pair;F)V"); "(Ljava/lang/String;ZLkotlin/Pair;Lkotlin/Pair;Lkotlin/Pair;F)V");
s_overlay_control_data_id_field = state.overlay_control_data_id_field =
env->GetFieldID(overlay_control_data_class, "id", "Ljava/lang/String;"); env->GetFieldID(overlay_control_data_class, "id", "Ljava/lang/String;");
s_overlay_control_data_enabled_field = state.overlay_control_data_enabled_field =
env->GetFieldID(overlay_control_data_class, "enabled", "Z"); env->GetFieldID(overlay_control_data_class, "enabled", "Z");
s_overlay_control_data_landscape_position_field = state.overlay_control_data_landscape_position_field =
env->GetFieldID(overlay_control_data_class, "landscapePosition", "Lkotlin/Pair;"); env->GetFieldID(overlay_control_data_class, "landscapePosition", "Lkotlin/Pair;");
s_overlay_control_data_portrait_position_field = state.overlay_control_data_portrait_position_field =
env->GetFieldID(overlay_control_data_class, "portraitPosition", "Lkotlin/Pair;"); env->GetFieldID(overlay_control_data_class, "portraitPosition", "Lkotlin/Pair;");
s_overlay_control_data_foldable_position_field = state.overlay_control_data_foldable_position_field =
env->GetFieldID(overlay_control_data_class, "foldablePosition", "Lkotlin/Pair;"); env->GetFieldID(overlay_control_data_class, "foldablePosition", "Lkotlin/Pair;");
s_overlay_control_data_individual_scale_field = state.overlay_control_data_individual_scale_field =
env->GetFieldID(overlay_control_data_class, "individualScale", "F"); env->GetFieldID(overlay_control_data_class, "individualScale", "F");
env->DeleteLocalRef(overlay_control_data_class); env->DeleteLocalRef(overlay_control_data_class);
const jclass patch_class = env->FindClass("org/yuzu/yuzu_emu/model/Patch"); const jclass patch_class = env->FindClass("org/yuzu/yuzu_emu/model/Patch");
s_patch_class = reinterpret_cast<jclass>(env->NewGlobalRef(patch_class)); state.patch_class = reinterpret_cast<jclass>(env->NewGlobalRef(patch_class));
s_patch_constructor = env->GetMethodID( state.patch_constructor = env->GetMethodID(
patch_class, "<init>", patch_class, "<init>",
"(ZLjava/lang/String;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;JI)V"); "(ZLjava/lang/String;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;JI)V");
s_patch_enabled_field = env->GetFieldID(patch_class, "enabled", "Z"); state.patch_enabled_field = env->GetFieldID(patch_class, "enabled", "Z");
s_patch_name_field = env->GetFieldID(patch_class, "name", "Ljava/lang/String;"); state.patch_name_field = env->GetFieldID(patch_class, "name", "Ljava/lang/String;");
s_patch_version_field = env->GetFieldID(patch_class, "version", "Ljava/lang/String;"); state.patch_version_field = env->GetFieldID(patch_class, "version", "Ljava/lang/String;");
s_patch_type_field = env->GetFieldID(patch_class, "type", "I"); state.patch_type_field = env->GetFieldID(patch_class, "type", "I");
s_patch_program_id_field = env->GetFieldID(patch_class, "programId", "Ljava/lang/String;"); state.patch_program_id_field = env->GetFieldID(patch_class, "programId", "Ljava/lang/String;");
s_patch_title_id_field = env->GetFieldID(patch_class, "titleId", "Ljava/lang/String;"); state.patch_title_id_field = env->GetFieldID(patch_class, "titleId", "Ljava/lang/String;");
env->DeleteLocalRef(patch_class); env->DeleteLocalRef(patch_class);
const jclass double_class = env->FindClass("java/lang/Double"); const jclass double_class = env->FindClass("java/lang/Double");
s_double_class = reinterpret_cast<jclass>(env->NewGlobalRef(double_class)); state.double_class = reinterpret_cast<jclass>(env->NewGlobalRef(double_class));
s_double_constructor = env->GetMethodID(double_class, "<init>", "(D)V"); state.double_constructor = env->GetMethodID(double_class, "<init>", "(D)V");
s_double_value_method = env->GetMethodID(double_class, "doubleValue", "()D"); state.double_value_method = env->GetMethodID(double_class, "doubleValue", "()D");
env->DeleteLocalRef(double_class); env->DeleteLocalRef(double_class);
const jclass int_class = env->FindClass("java/lang/Integer"); const jclass int_class = env->FindClass("java/lang/Integer");
s_integer_class = reinterpret_cast<jclass>(env->NewGlobalRef(int_class)); state.integer_class = reinterpret_cast<jclass>(env->NewGlobalRef(int_class));
s_integer_constructor = env->GetMethodID(int_class, "<init>", "(I)V"); state.integer_constructor = env->GetMethodID(int_class, "<init>", "(I)V");
s_integer_value_method = env->GetMethodID(int_class, "intValue", "()I"); state.integer_value_method = env->GetMethodID(int_class, "intValue", "()I");
env->DeleteLocalRef(int_class); env->DeleteLocalRef(int_class);
const jclass boolean_class = env->FindClass("java/lang/Boolean"); const jclass boolean_class = env->FindClass("java/lang/Boolean");
s_boolean_class = reinterpret_cast<jclass>(env->NewGlobalRef(boolean_class)); state.boolean_class = reinterpret_cast<jclass>(env->NewGlobalRef(boolean_class));
s_boolean_constructor = env->GetMethodID(boolean_class, "<init>", "(Z)V"); state.boolean_constructor = env->GetMethodID(boolean_class, "<init>", "(Z)V");
s_boolean_value_method = env->GetMethodID(boolean_class, "booleanValue", "()Z"); state.boolean_value_method = env->GetMethodID(boolean_class, "booleanValue", "()Z");
env->DeleteLocalRef(boolean_class); env->DeleteLocalRef(boolean_class);
const jclass player_input_class = const jclass player_input_class =
env->FindClass("org/yuzu/yuzu_emu/features/input/model/PlayerInput"); env->FindClass("org/yuzu/yuzu_emu/features/input/model/PlayerInput");
s_player_input_class = reinterpret_cast<jclass>(env->NewGlobalRef(player_input_class)); state.player_input_class = reinterpret_cast<jclass>(env->NewGlobalRef(player_input_class));
s_player_input_constructor = env->GetMethodID( state.player_input_constructor = env->GetMethodID(
player_input_class, "<init>", player_input_class, "<init>",
"(Z[Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;ZIJJJJLjava/lang/String;Z)V"); "(Z[Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;ZIJJJJLjava/lang/String;Z)V");
s_player_input_connected_field = env->GetFieldID(player_input_class, "connected", "Z"); state.player_input_connected_field = env->GetFieldID(player_input_class, "connected", "Z");
s_player_input_buttons_field = state.player_input_buttons_field =
env->GetFieldID(player_input_class, "buttons", "[Ljava/lang/String;"); env->GetFieldID(player_input_class, "buttons", "[Ljava/lang/String;");
s_player_input_analogs_field = state.player_input_analogs_field =
env->GetFieldID(player_input_class, "analogs", "[Ljava/lang/String;"); env->GetFieldID(player_input_class, "analogs", "[Ljava/lang/String;");
s_player_input_motions_field = state.player_input_motions_field =
env->GetFieldID(player_input_class, "motions", "[Ljava/lang/String;"); env->GetFieldID(player_input_class, "motions", "[Ljava/lang/String;");
s_player_input_vibration_enabled_field = state.player_input_vibration_enabled_field =
env->GetFieldID(player_input_class, "vibrationEnabled", "Z"); env->GetFieldID(player_input_class, "vibrationEnabled", "Z");
s_player_input_vibration_strength_field = state.player_input_vibration_strength_field =
env->GetFieldID(player_input_class, "vibrationStrength", "I"); env->GetFieldID(player_input_class, "vibrationStrength", "I");
s_player_input_body_color_left_field = state.player_input_body_color_left_field =
env->GetFieldID(player_input_class, "bodyColorLeft", "J"); env->GetFieldID(player_input_class, "bodyColorLeft", "J");
s_player_input_body_color_right_field = state.player_input_body_color_right_field =
env->GetFieldID(player_input_class, "bodyColorRight", "J"); env->GetFieldID(player_input_class, "bodyColorRight", "J");
s_player_input_button_color_left_field = state.player_input_button_color_left_field =
env->GetFieldID(player_input_class, "buttonColorLeft", "J"); env->GetFieldID(player_input_class, "buttonColorLeft", "J");
s_player_input_button_color_right_field = state.player_input_button_color_right_field =
env->GetFieldID(player_input_class, "buttonColorRight", "J"); env->GetFieldID(player_input_class, "buttonColorRight", "J");
s_player_input_profile_name_field = state.player_input_profile_name_field =
env->GetFieldID(player_input_class, "profileName", "Ljava/lang/String;"); env->GetFieldID(player_input_class, "profileName", "Ljava/lang/String;");
s_player_input_use_system_vibrator_field = state.player_input_use_system_vibrator_field =
env->GetFieldID(player_input_class, "useSystemVibrator", "Z"); env->GetFieldID(player_input_class, "useSystemVibrator", "Z");
env->DeleteLocalRef(player_input_class); env->DeleteLocalRef(player_input_class);
const jclass yuzu_input_device_interface = const jclass yuzu_input_device_interface =
env->FindClass("org/yuzu/yuzu_emu/features/input/YuzuInputDevice"); env->FindClass("org/yuzu/yuzu_emu/features/input/YuzuInputDevice");
s_yuzu_input_device_interface = state.yuzu_input_device_interface =
reinterpret_cast<jclass>(env->NewGlobalRef(yuzu_input_device_interface)); reinterpret_cast<jclass>(env->NewGlobalRef(yuzu_input_device_interface));
s_yuzu_input_device_get_name = state.yuzu_input_device_get_name =
env->GetMethodID(yuzu_input_device_interface, "getName", "()Ljava/lang/String;"); env->GetMethodID(yuzu_input_device_interface, "getName", "()Ljava/lang/String;");
s_yuzu_input_device_get_guid = state.yuzu_input_device_get_guid =
env->GetMethodID(yuzu_input_device_interface, "getGUID", "()Ljava/lang/String;"); env->GetMethodID(yuzu_input_device_interface, "getGUID", "()Ljava/lang/String;");
s_yuzu_input_device_get_port = env->GetMethodID(yuzu_input_device_interface, "getPort", state.yuzu_input_device_get_port = env->GetMethodID(yuzu_input_device_interface, "getPort",
"()I"); "()I");
s_yuzu_input_device_get_supports_vibration = state.yuzu_input_device_get_supports_vibration =
env->GetMethodID(yuzu_input_device_interface, "getSupportsVibration", "()Z"); env->GetMethodID(yuzu_input_device_interface, "getSupportsVibration", "()Z");
s_yuzu_input_device_vibrate = env->GetMethodID(yuzu_input_device_interface, "vibrate", state.yuzu_input_device_vibrate = env->GetMethodID(yuzu_input_device_interface, "vibrate",
"(F)V"); "(F)V");
s_yuzu_input_device_get_axes = state.yuzu_input_device_get_axes =
env->GetMethodID(yuzu_input_device_interface, "getAxes", "()[Ljava/lang/Integer;"); env->GetMethodID(yuzu_input_device_interface, "getAxes", "()[Ljava/lang/Integer;");
s_yuzu_input_device_has_keys = state.yuzu_input_device_has_keys =
env->GetMethodID(yuzu_input_device_interface, "hasKeys", "([I)[Z"); env->GetMethodID(yuzu_input_device_interface, "hasKeys", "([I)[Z");
env->DeleteLocalRef(yuzu_input_device_interface); env->DeleteLocalRef(yuzu_input_device_interface);
s_add_netplay_message = env->GetStaticMethodID(s_native_library_class, "addNetPlayMessage", state.add_netplay_message = env->GetStaticMethodID(state.native_library_class, "addNetPlayMessage",
"(ILjava/lang/String;)V"); "(ILjava/lang/String;)V");
s_clear_chat = env->GetStaticMethodID(s_native_library_class, "clearChat", "()V"); state.clear_chat = env->GetStaticMethodID(state.native_library_class, "clearChat", "()V");
// Initialize Android Storage // Initialize Android Storage
Common::FS::Android::RegisterCallbacks(env, s_native_library_class); Common::FS::Android::RegisterCallbacks(env, state.native_library_class);
// Initialize applets // Initialize applets
Common::Android::SoftwareKeyboard::InitJNI(env); Common::Android::SoftwareKeyboard::InitJNI(env);
+4 -18
View File
@@ -22,36 +22,22 @@ template <typename T>
return std::size_t(sizeof(T) * CHAR_BIT); return std::size_t(sizeof(T) * CHAR_BIT);
} }
template<typename T>
requires std::is_integral_v<T>
[[nodiscard]] constexpr u32 MostSignificantBit(const T value) {
return u32(sizeof(T) * CHAR_BIT - 1 - std::countl_zero(value));
}
template<typename T> template<typename T>
requires std::is_integral_v<T> requires std::is_integral_v<T>
[[nodiscard]] constexpr T Log2Floor(const T value) { [[nodiscard]] constexpr T Log2Floor(const T value) {
return T(MostSignificantBit<T>(value)); return std::bit_width(value) - 1;
} }
template<typename T> template<typename T>
requires std::is_integral_v<T> requires std::is_integral_v<T>
[[nodiscard]] constexpr T Log2Ceil(const T value) { [[nodiscard]] constexpr T Log2Ceil(const T value) {
const T log2_f = Log2Floor<T>(value); return std::bit_width(value - 1);
return T(log2_f + T((value ^ (T(1ULL) << log2_f)) != T(0ULL)));
}
template <typename T>
requires std::is_integral_v<T>
[[nodiscard]] T NextPow2(T value) {
return T(1ULL << (sizeof(T) * CHAR_BIT - std::countl_zero(value - 1U)));
} }
template <size_t bit_index, typename T> template <size_t bit_index, typename T>
requires std::is_integral_v<T> requires (std::is_integral_v<T> && bit_index < BitSize<T>())
[[nodiscard]] constexpr bool Bit(const T value) { [[nodiscard]] constexpr bool Bit(const T value) {
static_assert(bit_index < BitSize<T>(), "bit_index must be smaller than size of T"); return (T(value >> bit_index) & T(1)) == T(1);
return ((value >> bit_index) & T(1)) == T(1);
} }
} // namespace Common } // namespace Common
+5 -13
View File
@@ -25,26 +25,18 @@ template <typename T>
requires std::is_unsigned_v<T> requires std::is_unsigned_v<T>
inline std::size_t HashValue(T val) { inline std::size_t HashValue(T val) {
const unsigned int size_t_bits = std::numeric_limits<std::size_t>::digits; const unsigned int size_t_bits = std::numeric_limits<std::size_t>::digits;
const unsigned int length = const unsigned int length = (std::numeric_limits<T>::digits - 1) / static_cast<unsigned int>(size_t_bits);
(std::numeric_limits<T>::digits - 1) / static_cast<unsigned int>(size_t_bits);
std::size_t seed = 0; std::size_t seed = 0;
for (unsigned int i = length * size_t_bits; i > 0; i -= size_t_bits)
for (unsigned int i = length * size_t_bits; i > 0; i -= size_t_bits) { seed ^= std::size_t(val >> i) + (seed << 6) + (seed >> 2);
seed ^= static_cast<size_t>(val >> i) + (seed << 6) + (seed >> 2); return seed ^= std::size_t(val) + (seed << 6) + (seed >> 2);
}
seed ^= static_cast<size_t>(val) + (seed << 6) + (seed >> 2);
return seed;
} }
template <size_t Bits> template <size_t Bits>
struct HashCombineImpl { struct HashCombineImpl {
template <typename T> template <typename T>
static inline T fn(T seed, T value) { static inline T fn(T seed, T value) {
seed ^= value + 0x9e3779b9 + (seed << 6) + (seed >> 2); return seed ^= value + 0x9e3779b9 + (seed << 6) + (seed >> 2);
return seed;
} }
}; };
+5 -2
View File
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
@@ -12,14 +15,14 @@ namespace Common {
template <typename N, typename D> template <typename N, typename D>
requires std::is_integral_v<N> && std::is_unsigned_v<D> requires std::is_integral_v<N> && std::is_unsigned_v<D>
[[nodiscard]] constexpr N DivCeil(N number, D divisor) { [[nodiscard]] constexpr N DivCeil(N number, D divisor) {
return static_cast<N>((static_cast<D>(number) + divisor - 1) / divisor); return N((D(number) + divisor - 1) / divisor);
} }
/// Ceiled integer division with logarithmic divisor in base 2 /// Ceiled integer division with logarithmic divisor in base 2
template <typename N, typename D> template <typename N, typename D>
requires std::is_integral_v<N> && std::is_unsigned_v<D> requires std::is_integral_v<N> && std::is_unsigned_v<D>
[[nodiscard]] constexpr N DivCeilLog2(N value, D alignment_log2) { [[nodiscard]] constexpr N DivCeilLog2(N value, D alignment_log2) {
return static_cast<N>((static_cast<D>(value) + (D(1) << alignment_log2) - 1) >> alignment_log2); return N((D(value) + (D(1) << alignment_log2) - 1) >> alignment_log2);
} }
} // namespace Common } // namespace Common
-28
View File
@@ -1,28 +0,0 @@
// SPDX-FileCopyrightText: 2015 Citra Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <cstddef>
#include <utility>
#include <boost/functional/hash.hpp>
namespace Common {
struct PairHash {
template <class T1, class T2>
std::size_t operator()(const std::pair<T1, T2>& pair) const noexcept {
std::size_t seed = std::hash<T1>()(pair.first);
boost::hash_combine(seed, std::hash<T2>()(pair.second));
return seed;
}
};
template <typename T>
struct IdentityHash {
[[nodiscard]] size_t operator()(T value) const noexcept {
return static_cast<size_t>(value);
}
};
} // namespace Common
+10 -16
View File
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2013 Dolphin Emulator Project // SPDX-FileCopyrightText: 2013 Dolphin Emulator Project
// SPDX-FileCopyrightText: 2014 Citra Emulator Project // SPDX-FileCopyrightText: 2014 Citra Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
@@ -16,14 +19,12 @@ namespace Common {
[[nodiscard]] constexpr u8 ToHexNibble(char c) { [[nodiscard]] constexpr u8 ToHexNibble(char c) {
if (c >= 65 && c <= 70) { if (c >= 65 && c <= 70) {
return static_cast<u8>(c - 55); return u8(c - 55);
} }
if (c >= 97 && c <= 102) { if (c >= 97 && c <= 102) {
return static_cast<u8>(c - 87); return u8(c - 87);
} }
return u8(c - 48);
return static_cast<u8>(c - 48);
} }
[[nodiscard]] std::vector<u8> HexStringToVector(std::string_view str, bool little_endian); [[nodiscard]] std::vector<u8> HexStringToVector(std::string_view str, bool little_endian);
@@ -31,35 +32,28 @@ namespace Common {
template <std::size_t Size, bool le = false> template <std::size_t Size, bool le = false>
[[nodiscard]] constexpr std::array<u8, Size> HexStringToArray(std::string_view str) { [[nodiscard]] constexpr std::array<u8, Size> HexStringToArray(std::string_view str) {
ASSERT_MSG(Size * 2 <= str.size(), "Invalid string size"); ASSERT_MSG(Size * 2 <= str.size(), "Invalid string size");
std::array<u8, Size> out{}; std::array<u8, Size> out{};
if constexpr (le) { if constexpr (le) {
for (std::size_t i = 2 * Size - 2; i <= 2 * Size; i -= 2) { for (std::size_t i = 2 * Size - 2; i <= 2 * Size; i -= 2) {
out[i / 2] = static_cast<u8>((ToHexNibble(str[i]) << 4) | ToHexNibble(str[i + 1])); out[i / 2] = u8((ToHexNibble(str[i]) << 4) | ToHexNibble(str[i + 1]));
} }
} else { } else {
for (std::size_t i = 0; i < 2 * Size; i += 2) { for (std::size_t i = 0; i < 2 * Size; i += 2) {
out[i / 2] = static_cast<u8>((ToHexNibble(str[i]) << 4) | ToHexNibble(str[i + 1])); out[i / 2] = u8((ToHexNibble(str[i]) << 4) | ToHexNibble(str[i + 1]));
} }
} }
return out; return out;
} }
template <typename ContiguousContainer> template <typename ContiguousContainer>
requires std::is_same_v<typename ContiguousContainer::value_type, u8>
[[nodiscard]] std::string HexToString(const ContiguousContainer& data, bool upper = true) { [[nodiscard]] std::string HexToString(const ContiguousContainer& data, bool upper = true) {
static_assert(std::is_same_v<typename ContiguousContainer::value_type, u8>,
"Underlying type within the contiguous container must be u8.");
constexpr std::size_t pad_width = 2; constexpr std::size_t pad_width = 2;
std::string out; std::string out;
out.reserve(std::size(data) * pad_width); out.reserve(std::size(data) * pad_width);
const auto format_str = fmt::runtime(upper ? "{:02X}" : "{:02x}"); const auto format_str = fmt::runtime(upper ? "{:02X}" : "{:02x}");
for (const u8 c : data) { for (const u8 c : data)
out += fmt::format(format_str, c); out += fmt::format(format_str, c);
}
return out; return out;
} }
+10 -6
View File
@@ -10,6 +10,7 @@
#include <cstdlib> #include <cstdlib>
#include <regex> #include <regex>
#include <thread> #include <thread>
#include <boost/algorithm/string/predicate.hpp>
#if defined(__ANDROID__) #if defined(__ANDROID__)
#include <android/log.h> #include <android/log.h>
@@ -95,9 +96,10 @@ std::string FormatLogMessage(const Entry& entry) noexcept {
template <typename It> template <typename It>
Level GetLevelByName(const It begin, const It end) { Level GetLevelByName(const It begin, const It end) {
std::string_view const sv{begin, end};
for (u32 i = 0; i < u32(Level::Count); ++i) { for (u32 i = 0; i < u32(Level::Count); ++i) {
const char* level_name = GetLevelName(Level(i)); auto const level_name = GetLevelName(Level(i));
if (Common::ComparePartialString(begin, end, level_name)) if (boost::iequals(sv, level_name))
return Level(i); return Level(i);
} }
return Level::Count; return Level::Count;
@@ -105,9 +107,10 @@ Level GetLevelByName(const It begin, const It end) {
template <typename It> template <typename It>
Class GetClassByName(const It begin, const It end) { Class GetClassByName(const It begin, const It end) {
std::string_view const sv{begin, end};
for (u32 i = 0; i < u32(Class::Count); ++i) { for (u32 i = 0; i < u32(Class::Count); ++i) {
const char* level_name = GetLogClassName(Class(i)); auto const level_name = GetLogClassName(Class(i));
if (Common::ComparePartialString(begin, end, level_name)) if (boost::iequals(sv, level_name))
return Class(i); return Class(i);
} }
return Class::Count; return Class::Count;
@@ -120,12 +123,13 @@ bool ParseFilterRule(Filter& instance, Iterator begin, Iterator end) {
LOG_ERROR(Log, "Invalid log filter. Must specify a log level after `:`: {}", std::string(begin, end)); LOG_ERROR(Log, "Invalid log filter. Must specify a log level after `:`: {}", std::string(begin, end));
return false; return false;
} }
const Level level = GetLevelByName(level_separator + 1, end); auto const sv = std::string_view{begin, level_separator};
auto const level = GetLevelByName(level_separator + 1, end);
if (level == Level::Count) { if (level == Level::Count) {
LOG_ERROR(Log, "Unknown log level in filter: {}", std::string(begin, end)); LOG_ERROR(Log, "Unknown log level in filter: {}", std::string(begin, end));
return false; return false;
} }
if (Common::ComparePartialString(begin, level_separator, "*")) { if (boost::iequals(sv, "*")) {
instance.class_levels.fill(level); instance.class_levels.fill(level);
return true; return true;
} }
+20 -18
View File
@@ -8,6 +8,9 @@
#include <stdexcept> #include <stdexcept>
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/split.hpp>
#include "common/logging.h" #include "common/logging.h"
#include "common/param_package.h" #include "common/param_package.h"
@@ -15,17 +18,16 @@
namespace Common { namespace Common {
constexpr char KEY_VALUE_SEPARATOR = ':'; constexpr auto KEY_VALUE_SEPARATOR = ":";
constexpr char PARAM_SEPARATOR = ','; constexpr auto PARAM_SEPARATOR = ",";
constexpr auto ESCAPE_CHARACTER = "$";
constexpr char ESCAPE_CHARACTER = '$'; constexpr auto KEY_VALUE_SEPARATOR_ESCAPE = "$0";
constexpr char KEY_VALUE_SEPARATOR_ESCAPE[] = "$0"; constexpr auto PARAM_SEPARATOR_ESCAPE = "$1";
constexpr char PARAM_SEPARATOR_ESCAPE[] = "$1"; constexpr auto ESCAPE_CHARACTER_ESCAPE = "$2";
constexpr char ESCAPE_CHARACTER_ESCAPE[] = "$2";
/// A placeholder for empty param packages to avoid empty strings /// A placeholder for empty param packages to avoid empty strings
/// (they may be recognized as "not set" by some frontend libraries like qt) /// (they may be recognized as "not set" by some frontend libraries like qt)
constexpr char EMPTY_PLACEHOLDER[] = "[empty]"; constexpr auto EMPTY_PLACEHOLDER = "[empty]";
ParamPackage::ParamPackage(const std::string& serialized) { ParamPackage::ParamPackage(const std::string& serialized) {
if (serialized == EMPTY_PLACEHOLDER) { if (serialized == EMPTY_PLACEHOLDER) {
@@ -33,20 +35,20 @@ ParamPackage::ParamPackage(const std::string& serialized) {
} }
std::vector<std::string> pairs; std::vector<std::string> pairs;
Common::SplitString(serialized, PARAM_SEPARATOR, pairs); boost::split(pairs, serialized, boost::is_any_of(PARAM_SEPARATOR));
for (const std::string& pair : pairs) { for (const std::string& pair : pairs) {
std::vector<std::string> key_value; std::vector<std::string> key_value;
Common::SplitString(pair, KEY_VALUE_SEPARATOR, key_value); boost::split(key_value, pair, boost::is_any_of(KEY_VALUE_SEPARATOR));
if (key_value.size() != 2) { if (key_value.size() != 2) {
LOG_ERROR(Common, "invalid key pair {}", pair); LOG_ERROR(Common, "invalid key pair {}", pair);
continue; continue;
} }
for (std::string& part : key_value) { for (auto& part : key_value) {
part = Common::ReplaceAll(part, KEY_VALUE_SEPARATOR_ESCAPE, {KEY_VALUE_SEPARATOR}); boost::replace_all(part, KEY_VALUE_SEPARATOR_ESCAPE, KEY_VALUE_SEPARATOR);
part = Common::ReplaceAll(part, PARAM_SEPARATOR_ESCAPE, {PARAM_SEPARATOR}); boost::replace_all(part, PARAM_SEPARATOR_ESCAPE, PARAM_SEPARATOR);
part = Common::ReplaceAll(part, ESCAPE_CHARACTER_ESCAPE, {ESCAPE_CHARACTER}); boost::replace_all(part, ESCAPE_CHARACTER_ESCAPE, ESCAPE_CHARACTER);
} }
Set(key_value[0], std::move(key_value[1])); Set(key_value[0], std::move(key_value[1]));
@@ -63,10 +65,10 @@ std::string ParamPackage::Serialize() const {
for (const auto& pair : data) { for (const auto& pair : data) {
std::array<std::string, 2> key_value{{pair.first, pair.second}}; std::array<std::string, 2> key_value{{pair.first, pair.second}};
for (std::string& part : key_value) { for (auto& part : key_value) {
part = Common::ReplaceAll(part, {ESCAPE_CHARACTER}, ESCAPE_CHARACTER_ESCAPE); boost::replace_all(part, ESCAPE_CHARACTER, ESCAPE_CHARACTER_ESCAPE);
part = Common::ReplaceAll(part, {PARAM_SEPARATOR}, PARAM_SEPARATOR_ESCAPE); boost::replace_all(part, PARAM_SEPARATOR, PARAM_SEPARATOR_ESCAPE);
part = Common::ReplaceAll(part, {KEY_VALUE_SEPARATOR}, KEY_VALUE_SEPARATOR_ESCAPE); boost::replace_all(part, KEY_VALUE_SEPARATOR, KEY_VALUE_SEPARATOR_ESCAPE);
} }
result += key_value[0] + KEY_VALUE_SEPARATOR + key_value[1] + PARAM_SEPARATOR; result += key_value[0] + KEY_VALUE_SEPARATOR + key_value[1] + PARAM_SEPARATOR;
} }
+1 -1
View File
@@ -150,7 +150,7 @@ ENUM(ScalingFilter, NearestNeighbor, Bilinear, Bicubic, Gaussian, Lanczos, Scale
ENUM(AntiAliasing, None, Fxaa, Smaa); ENUM(AntiAliasing, None, Fxaa, Smaa);
ENUM(AspectRatio, R16_9, R4_3, R21_9, R16_10, Stretch); ENUM(AspectRatio, R16_9, R4_3, R21_9, R16_10, Stretch);
ENUM(ConsoleMode, Handheld, Docked); ENUM(ConsoleMode, Handheld, Docked);
ENUM(AppletMode, HLE, LLE, Disabled); ENUM(AppletMode, HLE, LLE);
ENUM(SpirvOptimizeMode, Never, OnLoad, Always); ENUM(SpirvOptimizeMode, Never, OnLoad, Always);
ENUM(GpuClock, Normal, Boost, Overclock) ENUM(GpuClock, Normal, Boost, Overclock)
ENUM(GpuUnswizzleSize, VerySmall, Small, Normal, Large, VeryLarge) ENUM(GpuUnswizzleSize, VerySmall, Small, Normal, Large, VeryLarge)
-51
View File
@@ -24,22 +24,6 @@
namespace Common { namespace Common {
/// Make a string lowercase
std::string ToLower(const std::string_view sv) {
std::string str{sv};
std::transform(str.begin(), str.end(), str.begin(),
[](auto const c) { return char(std::tolower(c)); });
return str;
}
/// Make a string uppercase
std::string ToUpper(const std::string_view sv) {
std::string str{sv};
std::transform(str.begin(), str.end(), str.begin(),
[](auto const c) { return char(std::toupper(c)); });
return str;
}
bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _pFilename, bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _pFilename,
std::string* _pExtension) { std::string* _pExtension) {
if (full_path.empty()) if (full_path.empty())
@@ -80,41 +64,6 @@ bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _
return true; return true;
} }
void SplitString(const std::string& str, const char delim, std::vector<std::string>& output) {
std::istringstream iss(str);
output.resize(1);
while (std::getline(iss, *output.rbegin(), delim)) {
output.emplace_back();
}
output.pop_back();
}
std::string TabsToSpaces(int tab_size, std::string in) {
std::size_t i = 0;
while ((i = in.find('\t')) != std::string::npos) {
in.replace(i, 1, tab_size, ' ');
}
return in;
}
std::string ReplaceAll(std::string result, const std::string& src, const std::string& dest) {
std::size_t pos = 0;
if (src == dest)
return result;
while ((pos = result.find(src, pos)) != std::string::npos) {
result.replace(pos, src.size(), dest);
pos += dest.length();
}
return result;
}
std::string UTF16ToUTF8(std::u16string_view input) { std::string UTF16ToUTF8(std::u16string_view input) {
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert; std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
return convert.to_bytes(input.data(), input.data() + input.size()); return convert.to_bytes(input.data(), input.data() + input.size());
+4 -56
View File
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project // SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2013 Dolphin Emulator Project // SPDX-FileCopyrightText: 2013 Dolphin Emulator Project
@@ -16,12 +16,6 @@
namespace Common { namespace Common {
/// Make a string lowercase
[[nodiscard]] std::string ToLower(const std::string_view sv);
/// Make a string uppercase
[[nodiscard]] std::string ToUpper(const std::string_view sv);
[[nodiscard]] inline std::string StringFromBuffer(std::span<const u8> data) noexcept { [[nodiscard]] inline std::string StringFromBuffer(std::span<const u8> data) noexcept {
return std::string(data.begin(), std::find(data.begin(), data.end(), '\0')); return std::string(data.begin(), std::find(data.begin(), data.end(), '\0'));
} }
@@ -29,37 +23,8 @@ namespace Common {
return std::string(data.begin(), std::find(data.begin(), data.end(), '\0')); return std::string(data.begin(), std::find(data.begin(), data.end(), '\0'));
} }
/// Turns " hej " into "hej". Also handles tabs.
[[nodiscard]] inline std::string StripSpaces(const std::string_view str) noexcept {
const std::size_t s = str.find_first_not_of(" \t\r\n");
if (str.npos != s)
return std::string{str.substr(s, str.find_last_not_of(" \t\r\n") - s + 1)};
return {};
}
/// "\"hello\"" is turned to "hello"
/// This one assumes that the string has already been space stripped in both
/// ends, as done by StripSpaces above, for example.
[[nodiscard]] inline std::string StripQuotes(const std::string_view s) noexcept {
if (s.size() && '\"' == s[0] && '\"' == *s.rbegin())
return std::string{s.substr(1, s.size() - 2)};
return std::string{s};
}
[[nodiscard]] inline std::string StringFromBool(bool value) noexcept {
return value ? "True" : "False";
}
[[nodiscard]] std::string TabsToSpaces(int tab_size, std::string in);
void SplitString(const std::string& str, char delim, std::vector<std::string>& output);
// "C:/Windows/winhelp.exe" to "C:/Windows/", "winhelp", ".exe" // "C:/Windows/winhelp.exe" to "C:/Windows/", "winhelp", ".exe"
bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _pFilename, bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _pFilename, std::string* _pExtension);
std::string* _pExtension);
[[nodiscard]] std::string ReplaceAll(std::string result, const std::string& src,
const std::string& dest);
[[nodiscard]] std::string UTF16ToUTF8(std::u16string_view input); [[nodiscard]] std::string UTF16ToUTF8(std::u16string_view input);
[[nodiscard]] std::u16string UTF8ToUTF16(std::string_view input); [[nodiscard]] std::u16string UTF8ToUTF16(std::string_view input);
@@ -73,30 +38,13 @@ bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _
[[nodiscard]] std::u16string U16StringFromBuffer(const u16* input, std::size_t length); [[nodiscard]] std::u16string U16StringFromBuffer(const u16* input, std::size_t length);
/**
* Compares the string defined by the range [`begin`, `end`) to the null-terminated C-string
* `other` for equality.
*/
template <typename InIt>
[[nodiscard]] inline bool ComparePartialString(InIt begin, InIt end, const char* other) noexcept {
for (; begin != end && *other != '\0'; ++begin, ++other) {
if (*begin != *other) {
return false;
}
}
// Only return true if both strings finished at the same point
return (begin == end) == (*other == '\0');
}
/// Creates a std::string from a fixed-size NUL-terminated char buffer. If the buffer isn't /// Creates a std::string from a fixed-size NUL-terminated char buffer. If the buffer isn't
/// NUL-terminated then the string ends at max_len characters. /// NUL-terminated then the string ends at max_len characters.
[[nodiscard]] std::string StringFromFixedZeroTerminatedBuffer(std::string_view buffer, [[nodiscard]] std::string StringFromFixedZeroTerminatedBuffer(std::string_view buffer, std::size_t max_len);
std::size_t max_len);
/// Creates a UTF-16 std::u16string from a fixed-size NUL-terminated char buffer. If the buffer isn't /// Creates a UTF-16 std::u16string from a fixed-size NUL-terminated char buffer. If the buffer isn't
/// null-terminated, then the string ends at the greatest multiple of two less then or equal to /// null-terminated, then the string ends at the greatest multiple of two less then or equal to
/// max_len_bytes. /// max_len_bytes.
[[nodiscard]] std::u16string UTF16StringFromFixedZeroTerminatedBuffer(std::u16string_view buffer, [[nodiscard]] std::u16string UTF16StringFromFixedZeroTerminatedBuffer(std::u16string_view buffer, std::size_t max_len);
std::size_t max_len);
} // namespace Common } // namespace Common
-1
View File
@@ -13,7 +13,6 @@
#include <dynarmic/interface/A64/a64.h> #include <dynarmic/interface/A64/a64.h>
#include <dynarmic/interface/code_page.h> #include <dynarmic/interface/code_page.h>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/hash.h"
#include "core/arm/arm_interface.h" #include "core/arm/arm_interface.h"
#include "core/arm/dynarmic/dynarmic_exclusive_monitor.h" #include "core/arm/dynarmic/dynarmic_exclusive_monitor.h"
#include "dynarmic/interface/A64/config.h" #include "dynarmic/interface/A64/config.h"
+5 -12
View File
@@ -168,7 +168,7 @@ void CpuManager::ShutdownThread(Kernel::KernelCore& kernel) {
UNREACHABLE(); UNREACHABLE();
} }
void CpuManager::RunThread(std::stop_token token, std::size_t core) { void CpuManager::RunThread(std::stop_token stop_token, std::size_t core) {
/// Initialization /// Initialization
system.RegisterCoreThread(core); system.RegisterCoreThread(core);
std::string name = is_multicore ? ("CPUCore_" + std::to_string(core)) : std::string{"CPUThread"}; std::string name = is_multicore ? ("CPUCore_" + std::to_string(core)) : std::string{"CPUThread"};
@@ -178,26 +178,19 @@ void CpuManager::RunThread(std::stop_token token, std::size_t core) {
auto& data = core_data[core]; auto& data = core_data[core];
data.host_context = Common::Fiber::ThreadToFiber(); data.host_context = Common::Fiber::ThreadToFiber();
// Cleanup
SCOPE_EXIT {
data.host_context->Exit();
};
// Running // Running
if (!gpu_barrier->Sync(token)) { gpu_barrier->arrive_and_wait();
return; if (!stop_token.stop_requested()) {
}
if (!is_async_gpu && !is_multicore) { if (!is_async_gpu && !is_multicore) {
system.GPU().ObtainContext(); system.GPU().ObtainContext();
} }
auto& kernel = system.Kernel(); auto& kernel = system.Kernel();
auto& scheduler = *kernel.CurrentScheduler(); auto& scheduler = *kernel.CurrentScheduler();
auto* thread = scheduler.GetSchedulerCurrentThread(); auto* thread = scheduler.GetSchedulerCurrentThread();
Kernel::SetCurrentThread(kernel, thread); Kernel::SetCurrentThread(kernel, thread);
Common::Fiber::YieldTo(data.host_context, *thread->GetHostContext()); Common::Fiber::YieldTo(data.host_context, *thread->GetHostContext());
} }
data.host_context->Exit();
}
} // namespace Core } // namespace Core
+3 -2
View File
@@ -8,6 +8,7 @@
#include <array> #include <array>
#include <atomic> #include <atomic>
#include <barrier>
#include <functional> #include <functional>
#include <memory> #include <memory>
#include <thread> #include <thread>
@@ -52,7 +53,7 @@ public:
} }
void OnGpuReady() { void OnGpuReady() {
gpu_barrier->Sync(); gpu_barrier->arrive_and_wait();
} }
void Initialize(); void Initialize();
@@ -95,7 +96,7 @@ private:
static constexpr std::size_t max_cycle_runs = 5; static constexpr std::size_t max_cycle_runs = 5;
std::optional<Common::Barrier> gpu_barrier{}; std::optional<std::barrier<>> gpu_barrier{};
struct CoreData { struct CoreData {
std::shared_ptr<Common::Fiber> host_context; std::shared_ptr<Common::Fiber> host_context;
std::jthread host_thread; std::jthread host_thread;
+2 -1
View File
@@ -14,6 +14,7 @@
#include <tuple> #include <tuple>
#include <vector> #include <vector>
#include <boost/algorithm/string/case_conv.hpp>
#include <openssl/evp.h> #include <openssl/evp.h>
#include "common/fs/file.h" #include "common/fs/file.h"
@@ -622,7 +623,7 @@ void KeyManager::LoadFromFile(const std::filesystem::path& file_path, bool is_ti
Key128 key = Common::HexStringToArray<16>(out[1]); Key128 key = Common::HexStringToArray<16>(out[1]);
s128_keys[{S128KeyType::Titlekey, rights_id[1], rights_id[0]}] = key; s128_keys[{S128KeyType::Titlekey, rights_id[1], rights_id[0]}] = key;
} else { } else {
out[0] = Common::ToLower(out[0]); boost::algorithm::to_lower(out[0]);
if (const auto iter128 = Find128ByName(out[0]); iter128 != s128_file_id.end()) { if (const auto iter128 = Find128ByName(out[0]); iter128 != s128_file_id.end()) {
const auto& index = iter128->second; const auto& index = iter128->second;
const Key128 key = Common::HexStringToArray<16>(out[1]); const Key128 key = Common::HexStringToArray<16>(out[1]);
+3 -5
View File
@@ -6,6 +6,7 @@
#include <array> #include <array>
#include <cstring> #include <cstring>
#include <boost/algorithm/string/case_conv.hpp>
#include "common/common_funcs.h" #include "common/common_funcs.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "common/hex_util.h" #include "common/hex_util.h"
@@ -41,16 +42,13 @@ static_assert(sizeof(Package2Header) == 0x200, "Package2Header has incorrect siz
const u8 PartitionDataManager::MAX_KEYBLOB_SOURCE_HASH = 32; const u8 PartitionDataManager::MAX_KEYBLOB_SOURCE_HASH = 32;
static FileSys::VirtualFile FindFileInDirWithNames(const FileSys::VirtualDir& dir, static FileSys::VirtualFile FindFileInDirWithNames(const FileSys::VirtualDir& dir, const std::string& name) {
const std::string& name) { const auto upper = boost::algorithm::to_upper_copy(name);
const auto upper = Common::ToUpper(name);
for (const auto& fname : {name, name + ".bin", upper, upper + ".BIN"}) { for (const auto& fname : {name, name + ".bin", upper, upper + ".BIN"}) {
if (dir->GetFile(fname) != nullptr) { if (dir->GetFile(fname) != nullptr) {
return dir->GetFile(fname); return dir->GetFile(fname);
} }
} }
return nullptr; return nullptr;
} }
+2 -3
View File
@@ -8,6 +8,7 @@
#include <array> #include <array>
#include <cstddef> #include <cstddef>
#include <cstring> #include <cstring>
#include <boost/algorithm/string/case_conv.hpp>
#include "common/assert.h" #include "common/assert.h"
#include "common/hex_util.h" #include "common/hex_util.h"
@@ -73,12 +74,10 @@ VirtualDir FindSubdirectoryCaseless(const VirtualDir dir, std::string_view name)
#else #else
const auto subdirs = dir->GetSubdirectories(); const auto subdirs = dir->GetSubdirectories();
for (const auto& subdir : subdirs) { for (const auto& subdir : subdirs) {
std::string dir_name = Common::ToLower(subdir->GetName()); if (name == boost::algorithm::to_lower_copy(subdir->GetName())) {
if (dir_name == name) {
return subdir; return subdir;
} }
} }
return nullptr; return nullptr;
#endif #endif
} }
+4 -4
View File
@@ -8,6 +8,7 @@
#include <limits> #include <limits>
#include <random> #include <random>
#include <regex> #include <regex>
#include <boost/algorithm/string/case_conv.hpp>
#include <openssl/evp.h> #include <openssl/evp.h>
#include "common/assert.h" #include "common/assert.h"
#include "common/fs/path_util.h" #include "common/fs/path_util.h"
@@ -1414,11 +1415,10 @@ void ExternalContentProvider::ScanDirectory(const VirtualDir& dir) {
continue; continue;
} }
const auto extension = Common::ToLower(filename.substr(dot_pos + 1)); const auto ext = boost::to_lower_copy(filename.substr(dot_pos + 1));
if (ext == "nsp") {
if (extension == "nsp") {
ProcessNSP(file); ProcessNSP(file);
} else if (extension == "xci") { } else if (ext == "xci") {
ProcessXCI(file); ProcessXCI(file);
} }
} }
+3 -2
View File
@@ -9,6 +9,7 @@
#include <regex> #include <regex>
#include <string> #include <string>
#include <boost/algorithm/string/case_conv.hpp>
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/evp.h> #include <openssl/evp.h>
@@ -63,8 +64,8 @@ NAX::NAX(VirtualFile file_)
return; return;
} }
const std::string two_dir = Common::ToUpper(std::string{match[1]}); const std::string two_dir = boost::algorithm::to_upper_copy(std::string{match[1]});
const std::string nca_id = Common::ToLower(std::string{match[2]}); const std::string nca_id = boost::algorithm::to_lower_copy(std::string{match[2]});
status = Parse(fmt::format("/registered/{}/{}.nca", two_dir, nca_id)); status = Parse(fmt::format("/registered/{}/{}.nca", two_dir, nca_id));
} }
+11 -2
View File
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
@@ -19,8 +22,14 @@ constexpr u32 NUM_CPU_CORES = 4; // Number of CPU Cores - sync wit
// Virtual to Physical core map. // Virtual to Physical core map.
constexpr std::array<s32, Common::BitSize<u64>()> VirtualToPhysicalCoreMap{ constexpr std::array<s32, Common::BitSize<u64>()> VirtualToPhysicalCoreMap{
0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 3,
}; };
static constexpr inline size_t NumVirtualCores = Common::BitSize<u64>(); static constexpr inline size_t NumVirtualCores = Common::BitSize<u64>();
+2 -3
View File
@@ -250,10 +250,9 @@ std::shared_ptr<FrontendApplet> FrontendAppletHolder::GetApplet(std::shared_ptr<
return std::make_shared<PhotoViewer>(system, applet, mode, *frontend.photo_viewer); return std::make_shared<PhotoViewer>(system, applet, mode, *frontend.photo_viewer);
case AppletId::NetConnect: case AppletId::NetConnect:
return std::make_shared<NetConnect>(system, applet, mode, *frontend.net_connect); return std::make_shared<NetConnect>(system, applet, mode, *frontend.net_connect);
case AppletId::None:
return nullptr;
default: default:
UNIMPLEMENTED_MSG("No frontend implementation exists for applet_id={:02X} program_id={:016X}! Using stub applet.", static_cast<u8>(id), applet->program_id); LOG_ERROR(Service_AM, "No backend implementation exists for applet_id={:02X} program_id={:016X}"
"Falling back to stub applet", static_cast<u8>(id), applet->program_id);
return std::make_shared<StubApplet>(system, applet, id, mode); return std::make_shared<StubApplet>(system, applet, id, mode);
} }
} }
+2 -30
View File
@@ -16,10 +16,6 @@
#include "core/hle/service/ro/ro_types.h" #include "core/hle/service/ro/ro_types.h"
#include "core/hle/service/server_manager.h" #include "core/hle/service/server_manager.h"
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
#ifdef HAS_NCE
#include "core/arm/nce/patcher.h"
#include "core/hle/kernel/k_shared_memory.h"
#endif
namespace Service::RO { namespace Service::RO {
@@ -390,7 +386,7 @@ public:
R_SUCCEED(); R_SUCCEED();
} }
Result MapManualLoadModuleMemory(Kernel::KernelCore& kernel, u64* out_address, size_t context_id, u64 nro_address, Result MapManualLoadModuleMemory(u64* out_address, size_t context_id, u64 nro_address,
u64 nro_size, u64 bss_address, u64 bss_size) { u64 nro_size, u64 bss_address, u64 bss_size) {
// Get context. // Get context.
ProcessContext* context = this->GetContextById(context_id); ProcessContext* context = this->GetContextById(context_id);
@@ -425,31 +421,7 @@ public:
R_TRY(context->ValidateNro(std::addressof(nro_info->module_id), std::addressof(rx_size), R_TRY(context->ValidateNro(std::addressof(nro_info->module_id), std::addressof(rx_size),
std::addressof(ro_size), std::addressof(rw_size), std::addressof(ro_size), std::addressof(rw_size),
nro_info->base_address, nro_size, bss_size)); nro_info->base_address, nro_size, bss_size));
#ifdef HAS_NCE
if (Settings::IsNceEnabled()) {
auto* process = context->GetProcess();
auto& memory = process->GetMemory();
std::vector<u8> image(total_size);
memory.ReadBlock(nro_info->base_address, image.data(), rx_size);
Kernel::CodeSet::Segment code{.size = static_cast<u32>(rx_size)};
Core::NCE::Patcher patch;
patch.PatchText(image, code);
patch.RelocateAndCopy(nro_info->base_address, code, image, nullptr);
const u64 patch_address = nro_info->base_address + total_size;
const size_t patch_size = patch.GetSectionSize();
constexpr auto permission = Kernel::Svc::MemoryPermission::ReadExecute;
auto* patch_memory = Kernel::KSharedMemory::Create(kernel);
R_TRY(patch_memory->Initialize(kernel, kernel.System().DeviceMemory(), process, permission, permission, patch_size));
std::memcpy(patch_memory->GetPointer(), image.data() + total_size, patch_size);
R_TRY(process->AddSharedMemory(kernel, patch_memory, patch_address, patch_size));
R_TRY(patch_memory->Map(*process, patch_address, patch_size, permission));
memory.WriteBlock(nro_info->base_address, image.data(), rx_size);
}
#endif
// Set NRO perms. // Set NRO perms.
R_TRY(SetNroPerms(context->GetProcess(), nro_info->base_address, rx_size, ro_size, R_TRY(SetNroPerms(context->GetProcess(), nro_info->base_address, rx_size, ro_size,
rw_size + bss_size)); rw_size + bss_size));
@@ -559,7 +531,7 @@ public:
Result MapManualLoadModuleMemory(Out<u64> out_load_address, ClientProcessId client_pid, Result MapManualLoadModuleMemory(Out<u64> out_load_address, ClientProcessId client_pid,
u64 nro_address, u64 nro_size, u64 bss_address, u64 bss_size) { u64 nro_address, u64 nro_size, u64 bss_address, u64 bss_size) {
R_TRY(m_ro->ValidateProcess(m_context_id, *client_pid)); R_TRY(m_ro->ValidateProcess(m_context_id, *client_pid));
R_RETURN(m_ro->MapManualLoadModuleMemory(system.Kernel(), out_load_address.Get(), m_context_id, nro_address, R_RETURN(m_ro->MapManualLoadModuleMemory(out_load_address.Get(), m_context_id, nro_address,
nro_size, bss_address, bss_size)); nro_size, bss_address, bss_size));
} }
+2 -2
View File
@@ -10,6 +10,7 @@
#include <string> #include <string>
#include <concepts> #include <concepts>
#include <algorithm> #include <algorithm>
#include <boost/algorithm/string/case_conv.hpp>
#include "common/concepts.h" #include "common/concepts.h"
#include "common/fs/path_util.h" #include "common/fs/path_util.h"
#include "common/logging.h" #include "common/logging.h"
@@ -170,8 +171,7 @@ FileType GuessFromFilename(const std::string& name) {
else if (name == "00") else if (name == "00")
return FileType::NCA; return FileType::NCA;
auto const extension = auto const extension = boost::algorithm::to_lower_copy(std::string(Common::FS::GetExtensionFromFilename(name)));
Common::ToLower(std::string(Common::FS::GetExtensionFromFilename(name)));
if (extension == "nro") if (extension == "nro")
return FileType::NRO; return FileType::NRO;
else if (extension == "nso") else if (extension == "nso")
+1 -1
View File
@@ -757,7 +757,7 @@ struct Memory::Impl {
}; };
auto& gpu = system.GPU(); auto& gpu = system.GPU();
gpu_device_memory->ApplyOpOnPointer( gpu_device_memory->ApplyOpOnPointer(
p, scratch_buffers[core], [&](DAddr address) { gpu.InvalidateRegion(address, size, true); }); p, scratch_buffers[core], [&](DAddr address) { gpu.InvalidateRegion(address, size); });
} }
Core::System& system; Core::System& system;
+2 -1
View File
@@ -14,6 +14,7 @@
#include <regex> #include <regex>
#include <string> #include <string>
#include <thread> #include <thread>
#include <boost/algorithm/string/trim.hpp>
#ifdef _WIN32 #ifdef _WIN32
// windows.h needs to be included before shellapi.h // windows.h needs to be included before shellapi.h
@@ -132,7 +133,7 @@ static Network::Room::BanList LoadBanList(const std::string& path) {
std::string line; std::string line;
std::getline(file, line); std::getline(file, line);
line.erase(std::remove(line.begin(), line.end(), '\0'), line.end()); line.erase(std::remove(line.begin(), line.end(), '\0'), line.end());
line = Common::StripSpaces(line); boost::trim(line);
if (line.empty()) { if (line.empty()) {
// An empty line marks start of the IP ban list // An empty line marks start of the IP ban list
ban_list_type = true; ban_list_type = true;
+3 -1
View File
@@ -342,6 +342,9 @@ std::unique_ptr<TranslationMap> InitializeTranslations(QObject* parent) {
"it bypasses such prompts and directly exits the emulation.")); "it bypasses such prompts and directly exits the emulation."));
INSERT(UISettings, hide_mouse, tr("Hide mouse on inactivity"), INSERT(UISettings, hide_mouse, tr("Hide mouse on inactivity"),
tr("Hides the mouse after 2.5s of inactivity.")); tr("Hides the mouse after 2.5s of inactivity."));
INSERT(UISettings, controller_applet_disabled, tr("Disable controller applet"),
tr("Forcibly disables the use of the controller applet in emulated programs.\n"
"When a program attempts to open the controller applet, it is immediately closed."));
INSERT(UISettings, check_for_updates, tr("Check for updates"), INSERT(UISettings, check_for_updates, tr("Check for updates"),
tr("Whether or not to check for updates upon startup.")); tr("Whether or not to check for updates upon startup."));
@@ -377,7 +380,6 @@ std::unique_ptr<ComboboxTranslationMap> ComboboxEnumeration(QObject* parent) {
{ {
PAIR(AppletMode, HLE, tr("Custom frontend")), PAIR(AppletMode, HLE, tr("Custom frontend")),
PAIR(AppletMode, LLE, tr("Real applet")), PAIR(AppletMode, LLE, tr("Real applet")),
PAIR(AppletMode, Disabled, tr("Disabled")),
}}); }});
translations->insert({Settings::EnumMetadata<Settings::SpirvOptimizeMode>::Index(), translations->insert({Settings::EnumMetadata<Settings::SpirvOptimizeMode>::Index(),
+2
View File
@@ -127,6 +127,8 @@ struct Values {
Setting<bool> hide_mouse{ Setting<bool> hide_mouse{
linkage, true, "hideInactiveMouse", Category::UiGeneral, Settings::Specialization::Default, linkage, true, "hideInactiveMouse", Category::UiGeneral, Settings::Specialization::Default,
true, true}; true, true};
Setting<bool> controller_applet_disabled{linkage, false, "disableControllerApplet",
Category::UiGeneral};
// Set when Vulkan is known to crash the application // Set when Vulkan is known to crash the application
bool has_broken_vulkan = false; bool has_broken_vulkan = false;
+2 -1
View File
@@ -8,6 +8,7 @@
#include <string> #include <string>
#include <QEventLoop> #include <QEventLoop>
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/algorithm/string/replace.hpp> #include <boost/algorithm/string/replace.hpp>
#include "common/httplib.h" #include "common/httplib.h"
@@ -45,7 +46,7 @@ void DiscordImpl::Pause() {
std::string DiscordImpl::GetGameString(const std::string& title) { std::string DiscordImpl::GetGameString(const std::string& title) {
// Convert to lowercase // Convert to lowercase
std::string icon_name = Common::ToLower(title); std::string icon_name = boost::algorithm::to_lower_copy(title);
// Replace spaces with dashes // Replace spaces with dashes
std::replace(icon_name.begin(), icon_name.end(), ' ', '-'); std::replace(icon_name.begin(), icon_name.end(), ' ', '-');
@@ -38,8 +38,6 @@ struct HostTranslateInfo {
///< passthrough shaders ///< passthrough shaders
bool support_conditional_barrier{}; ///< True when the device supports barriers in conditional bool support_conditional_barrier{}; ///< True when the device supports barriers in conditional
///< control flow ///< control flow
bool support_attribute_texture_handle{}; ///< True when the host binds texture handles that
///< arrive as vertex attributes
void ApplyDescriptorLimitPolicy() noexcept { void ApplyDescriptorLimitPolicy() noexcept {
if (min_ssbo_alignment == 0) { if (min_ssbo_alignment == 0) {
+3 -44
View File
@@ -268,10 +268,6 @@ static inline u32 ReadCbufCached(Environment& env, u32 index, u32 offset) {
return v; return v;
} }
static inline bool IsAttributeHandle(const ConstBufferAddr& cbuf) {
return cbuf.index == ATTRIBUTE_HANDLE_CBUF_INDEX;
}
static inline u32 GetTextureHandleCached(Environment& env, const ConstBufferAddr& cbuf) { static inline u32 GetTextureHandleCached(Environment& env, const ConstBufferAddr& cbuf) {
// Must all be uniquely different variables // Must all be uniquely different variables
// If has secondary, then it will be cbuf.secondary_{index|offset}, else its 0. // If has secondary, then it will be cbuf.secondary_{index|offset}, else its 0.
@@ -291,23 +287,14 @@ static inline u32 GetTextureHandleCached(Environment& env, const ConstBufferAddr
// Cached variants of existing helpers // Cached variants of existing helpers
static inline TextureType ReadTextureTypeCached(Environment& env, const ConstBufferAddr& cbuf) { static inline TextureType ReadTextureTypeCached(Environment& env, const ConstBufferAddr& cbuf) {
if (IsAttributeHandle(cbuf)) {
return TextureType::Color2D;
}
return env.ReadTextureType(GetTextureHandleCached(env, cbuf)); return env.ReadTextureType(GetTextureHandleCached(env, cbuf));
} }
static inline TexturePixelFormat ReadTexturePixelFormatCached(Environment& env, static inline TexturePixelFormat ReadTexturePixelFormatCached(Environment& env,
const ConstBufferAddr& cbuf) { const ConstBufferAddr& cbuf) {
if (IsAttributeHandle(cbuf)) {
return TexturePixelFormat::A8B8G8R8_UNORM;
}
return env.ReadTexturePixelFormat(GetTextureHandleCached(env, cbuf)); return env.ReadTexturePixelFormat(GetTextureHandleCached(env, cbuf));
} }
static inline bool IsTexturePixelFormatIntegerCached(Environment& env, static inline bool IsTexturePixelFormatIntegerCached(Environment& env,
const ConstBufferAddr& cbuf) { const ConstBufferAddr& cbuf) {
if (IsAttributeHandle(cbuf)) {
return false;
}
return env.IsTexturePixelFormatInteger(GetTextureHandleCached(env, cbuf)); return env.IsTexturePixelFormatInteger(GetTextureHandleCached(env, cbuf));
} }
@@ -479,43 +466,15 @@ std::optional<ConstBufferAddr> TryGetConstBuffer(const IR::Inst* inst, Environme
}; };
} }
bool IsAttributeSourcedHandle(const IR::Value& handle) {
if (handle.IsImmediate()) {
return false;
}
const IR::Inst* inst{handle.InstRecursive()};
if (inst->GetOpcode() == IR::Opcode::BitCastU32F32 && !inst->Arg(0).IsImmediate()) {
inst = inst->Arg(0).InstRecursive();
}
return inst->GetOpcode() == IR::Opcode::GetAttribute ||
inst->GetOpcode() == IR::Opcode::GetAttributeU32;
}
TextureInst MakeInst(Environment& env, IR::Block* block, IR::Inst& inst, const HostTranslateInfo& host_info) { TextureInst MakeInst(Environment& env, IR::Block* block, IR::Inst& inst, const HostTranslateInfo& host_info) {
ConstBufferAddr addr; ConstBufferAddr addr;
if (IsBindless(inst)) { if (IsBindless(inst)) {
const std::optional<ConstBufferAddr> track_addr{TrackCached(inst.Arg(0), env, host_info)}; const std::optional<ConstBufferAddr> track_addr{TrackCached(inst.Arg(0), env, host_info)};
if (track_addr) { if (!track_addr) {
addr = *track_addr;
} else if (host_info.support_attribute_texture_handle &&
IsAttributeSourcedHandle(inst.Arg(0))) {
// The handle travels with the vertices (sprite batches pick the texture per quad), so
// there is no constant buffer to read it from. The host binds the handle of each run
// of vertices that share one.
addr = ConstBufferAddr{
.index = ATTRIBUTE_HANDLE_CBUF_INDEX,
.offset = 0,
.shift_left = 0,
.secondary_index = 0,
.secondary_offset = 0,
.secondary_shift_left = 0,
.dynamic_offset = {},
.count = 1,
.has_secondary = false,
};
} else {
throw NotImplementedException("Failed to track bindless texture constant buffer"); throw NotImplementedException("Failed to track bindless texture constant buffer");
} else {
addr = *track_addr;
} }
} else { } else {
addr = ConstBufferAddr{ addr = ConstBufferAddr{
-4
View File
@@ -38,10 +38,6 @@ enum class TextureType : u32 {
}; };
constexpr u32 NUM_TEXTURE_TYPES = 9; constexpr u32 NUM_TEXTURE_TYPES = 9;
/// Constant buffer index marking a texture handle that the shader receives as a vertex attribute
/// instead of reading it from a constant buffer. The host supplies the handle of each draw run.
constexpr u32 ATTRIBUTE_HANDLE_CBUF_INDEX = 0xFFFF;
enum class TexturePixelFormat { enum class TexturePixelFormat {
A8B8G8R8_UNORM, A8B8G8R8_UNORM,
A8B8G8R8_SNORM, A8B8G8R8_SNORM,
+3 -13
View File
@@ -226,17 +226,7 @@ struct GPU::Impl {
} }
/// Notify rasterizer that any caches of the specified region should be invalidated /// Notify rasterizer that any caches of the specified region should be invalidated
void InvalidateRegion(DAddr addr, u64 size, bool preserve_gpu_writes) { void InvalidateRegion(DAddr addr, u64 size) {
VideoCore::RasterizerInterface* rasterizer = renderer->ReadRasterizer();
if (preserve_gpu_writes && rasterizer->MustFlushRegion(addr, size, VideoCommon::CacheType::BufferCache)) {
const u64 fence = RequestSyncOperation([rasterizer, addr, size] {
rasterizer->FlushRegion(addr, size, VideoCommon::CacheType::BufferCache);
rasterizer->OnCacheInvalidation(addr, size);
});
gpu_thread.TickGPU(is_async);
WaitForSyncOperation(fence);
return;
}
gpu_thread.InvalidateRegion(addr, size); gpu_thread.InvalidateRegion(addr, size);
} }
@@ -528,8 +518,8 @@ void GPU::FlushRegion(DAddr addr, u64 size) {
impl->FlushRegion(addr, size); impl->FlushRegion(addr, size);
} }
void GPU::InvalidateRegion(DAddr addr, u64 size, bool preserve_gpu_writes) { void GPU::InvalidateRegion(DAddr addr, u64 size) {
impl->InvalidateRegion(addr, size, preserve_gpu_writes); impl->InvalidateRegion(addr, size);
} }
bool GPU::OnCPUWrite(DAddr addr, u64 size) { bool GPU::OnCPUWrite(DAddr addr, u64 size) {
+1 -1
View File
@@ -248,7 +248,7 @@ public:
void FlushRegion(DAddr addr, u64 size); void FlushRegion(DAddr addr, u64 size);
/// Notify rasterizer that any caches of the specified region should be invalidated /// Notify rasterizer that any caches of the specified region should be invalidated
void InvalidateRegion(DAddr addr, u64 size, bool preserve_gpu_writes = false); void InvalidateRegion(DAddr addr, u64 size);
/// Notify rasterizer that CPU is trying to write this area. It returns true if the area is /// Notify rasterizer that CPU is trying to write this area. It returns true if the area is
/// sensible, false otherwise, addr and size must be a valid combination /// sensible, false otherwise, addr and size must be a valid combination
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project // SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
@@ -55,7 +55,7 @@ size_t StagingBuffers::RequestBuffer(size_t requested_size) {
} }
StagingBufferAlloc alloc; StagingBufferAlloc alloc;
alloc.buffer.Create(); alloc.buffer.Create();
const auto next_pow2_size = Common::NextPow2(requested_size); const auto next_pow2_size = std::bit_ceil(requested_size);
glNamedBufferStorage(alloc.buffer.handle, next_pow2_size, nullptr, glNamedBufferStorage(alloc.buffer.handle, next_pow2_size, nullptr,
storage_flags | GL_MAP_PERSISTENT_BIT); storage_flags | GL_MAP_PERSISTENT_BIT);
alloc.map = static_cast<u8*>(glMapNamedBufferRange(alloc.buffer.handle, 0, next_pow2_size, alloc.map = static_cast<u8*>(glMapNamedBufferRange(alloc.buffer.handle, 0, next_pow2_size,
@@ -1404,7 +1404,7 @@ void FormatConversionPass::ConvertImage(Image& dst_image, Image& src_image,
const u32 copy_size = region.width * region.height * region.depth * img_bpp; const u32 copy_size = region.width * region.height * region.depth * img_bpp;
if (pbo_size < copy_size) { if (pbo_size < copy_size) {
intermediate_pbo.Create(); intermediate_pbo.Create();
pbo_size = Common::NextPow2(copy_size); pbo_size = std::bit_ceil(copy_size);
glNamedBufferData(intermediate_pbo.handle, pbo_size, nullptr, GL_STREAM_COPY); glNamedBufferData(intermediate_pbo.handle, pbo_size, nullptr, GL_STREAM_COPY);
} }
// Copy from source to PBO // Copy from source to PBO
@@ -276,9 +276,6 @@ GraphicsPipeline::GraphicsPipeline(
num_textures += Shader::NumDescriptors(info->texture_descriptors); num_textures += Shader::NumDescriptors(info->texture_descriptors);
num_image_elements += Shader::NumDescriptors(info->texture_descriptors); num_image_elements += Shader::NumDescriptors(info->texture_descriptors);
num_image_elements += Shader::NumDescriptors(info->image_descriptors); num_image_elements += Shader::NumDescriptors(info->image_descriptors);
for (const auto& desc : info->texture_descriptors) {
uses_attribute_handle |= desc.cbuf_index == Shader::ATTRIBUTE_HANDLE_CBUF_INDEX;
}
num_descriptor_entries += NumDescriptorEntries(*info); num_descriptor_entries += NumDescriptorEntries(*info);
} }
fragment_has_color0_output = stage_infos[NUM_STAGES - 1].stores_frag_color[0]; fragment_has_color0_output = stage_infos[NUM_STAGES - 1].stores_frag_color[0];
@@ -378,9 +375,6 @@ bool GraphicsPipeline::ConfigureImpl(bool is_indexed) {
} }
const auto& cbufs{maxwell3d->state.shader_stages[stage].const_buffers}; const auto& cbufs{maxwell3d->state.shader_stages[stage].const_buffers};
const auto read_handle{[&](const auto& desc, u32 index) { const auto read_handle{[&](const auto& desc, u32 index) {
if (desc.cbuf_index == Shader::ATTRIBUTE_HANDLE_CBUF_INDEX) {
return TexturePair(attribute_handle, via_header_index);
}
ASSERT(cbufs[desc.cbuf_index].enabled); ASSERT(cbufs[desc.cbuf_index].enabled);
const u32 index_offset{index << desc.size_shift}; const u32 index_offset{index << desc.size_shift};
const u32 offset{desc.cbuf_offset + index_offset}; const u32 offset{desc.cbuf_offset + index_offset};
@@ -110,16 +110,6 @@ public:
return configure_func(this, is_indexed); return configure_func(this, is_indexed);
} }
/// True when a shader samples a texture whose handle arrives as a vertex attribute.
[[nodiscard]] bool UsesAttributeHandle() const noexcept {
return uses_attribute_handle;
}
/// Handle bound to those textures by the next Configure.
void SetAttributeHandle(u32 handle) noexcept {
attribute_handle = handle;
}
[[nodiscard]] GraphicsPipeline* Next(const GraphicsPipelineCacheKey& current_key) noexcept { [[nodiscard]] GraphicsPipeline* Next(const GraphicsPipelineCacheKey& current_key) noexcept {
if (key == current_key) { if (key == current_key) {
return this; return this;
@@ -178,8 +168,6 @@ private:
u32 num_descriptor_entries{}; u32 num_descriptor_entries{};
size_t num_image_elements{}; size_t num_image_elements{};
u32 num_textures{}; u32 num_textures{};
u32 attribute_handle{};
bool uses_attribute_handle{};
bool fragment_has_color0_output{}; bool fragment_has_color0_output{};
vk::DescriptorSetLayout descriptor_set_layout; vk::DescriptorSetLayout descriptor_set_layout;
@@ -479,7 +479,6 @@ PipelineCache::PipelineCache(Tegra::MaxwellDeviceMemoryManager& device_memory_,
.support_viewport_index_layer = device.IsExtShaderViewportIndexLayerSupported(), .support_viewport_index_layer = device.IsExtShaderViewportIndexLayerSupported(),
.support_geometry_shader_passthrough = device.IsNvGeometryShaderPassthroughSupported(), .support_geometry_shader_passthrough = device.IsNvGeometryShaderPassthroughSupported(),
.support_conditional_barrier = device.SupportsConditionalBarriers(), .support_conditional_barrier = device.SupportsConditionalBarriers(),
.support_attribute_texture_handle = true,
}; };
host_info.ApplyDescriptorLimitPolicy(); host_info.ApplyDescriptorLimitPolicy();
@@ -248,15 +248,6 @@ void RasterizerVulkan::PrepareDraw(bool is_indexed, Func&& draw_func) {
std::scoped_lock lock{buffer_cache.mutex, texture_cache.mutex}; std::scoped_lock lock{buffer_cache.mutex, texture_cache.mutex};
// update engine as channel may be different. // update engine as channel may be different.
pipeline->SetEngine(maxwell3d, gpu_memory); pipeline->SetEngine(maxwell3d, gpu_memory);
attribute_handle_pipeline = nullptr;
attribute_handle_runs.clear();
if (split_attribute_handles && pipeline->UsesAttributeHandle()) {
CollectAttributeHandleRuns(is_indexed);
if (!attribute_handle_runs.empty()) {
attribute_handle_pipeline = pipeline;
pipeline->SetAttributeHandle(attribute_handle_runs.front().handle);
}
}
if (!pipeline->Configure(is_indexed)) if (!pipeline->Configure(is_indexed))
return; return;
@@ -268,110 +259,22 @@ void RasterizerVulkan::PrepareDraw(bool is_indexed, Func&& draw_func) {
draw_func(); draw_func();
} }
void RasterizerVulkan::CollectAttributeHandleRuns(bool is_indexed) {
using VertexAttribute = Maxwell::VertexAttribute;
const auto& regs = maxwell3d->regs;
const auto& draw_state = maxwell3d->draw_manager.draw_state;
const u32 total = is_indexed ? draw_state.index_buffer.count : draw_state.vertex_buffer.count;
if (total == 0) {
return;
}
// The handle is an integer attribute; sprite batches repeat it on every vertex of a quad.
const VertexAttribute* source{};
for (const auto& attr : regs.vertex_attrib_format) {
if (attr.constant || attr.size == VertexAttribute::Size::Invalid) {
continue;
}
if (attr.type == VertexAttribute::Type::UInt || attr.type == VertexAttribute::Type::SInt) {
source = &attr;
break;
}
}
const auto& stream = regs.vertex_streams[source ? source->buffer.Value() : 0];
if (!source || !stream.IsEnabled()) {
attribute_handle_runs.push_back({0, total, 0});
return;
}
// Only plain triangle lists are split; anything else keeps the handle of its first vertex.
const u32 primitive_size =
draw_state.topology == Maxwell::PrimitiveTopology::Triangles ? 3 : total;
const GPUVAddr base_address = stream.Address() + source->offset;
const auto read_handle = [&](u32 position) {
u32 vertex;
if (is_indexed) {
const auto& index_buffer = draw_state.index_buffer;
const GPUVAddr address =
index_buffer.IndexStart() + size_t{position} * index_buffer.FormatSizeInBytes();
u32 index{};
gpu_memory->ReadBlockUnsafe(address, &index, index_buffer.FormatSizeInBytes());
vertex = static_cast<u32>(draw_state.base_index + index);
} else {
vertex = draw_state.vertex_buffer.first + position;
}
return gpu_memory->Read<u32>(base_address + static_cast<GPUVAddr>(vertex) * stream.stride);
};
for (u32 position = 0; position + primitive_size <= total; position += primitive_size) {
const u32 handle = read_handle(position);
if (!attribute_handle_runs.empty() && attribute_handle_runs.back().handle == handle) {
attribute_handle_runs.back().count += primitive_size;
} else {
attribute_handle_runs.push_back({position, primitive_size, handle});
}
}
if (attribute_handle_runs.empty()) {
attribute_handle_runs.push_back({0, total, read_handle(0)});
} else {
const u32 covered = attribute_handle_runs.back().first + attribute_handle_runs.back().count;
if (covered < total) {
attribute_handle_runs.back().count += total - covered;
}
}
}
void RasterizerVulkan::Draw(bool is_indexed, u32 instance_count) { void RasterizerVulkan::Draw(bool is_indexed, u32 instance_count) {
split_attribute_handles = true;
SCOPE_EXIT {
split_attribute_handles = false;
};
PrepareDraw(is_indexed, [this, is_indexed, instance_count] { PrepareDraw(is_indexed, [this, is_indexed, instance_count] {
const auto& draw_state = maxwell3d->draw_manager.draw_state; const auto& draw_state = maxwell3d->draw_manager.draw_state;
const u32 num_instances{instance_count}; const u32 num_instances{instance_count};
const DrawParams draw_params{MakeDrawParams(draw_state, num_instances, is_indexed)}; const DrawParams draw_params{MakeDrawParams(draw_state, num_instances, is_indexed)};
const auto record_draw = [this](const DrawParams& params) { scheduler.Record([draw_params](vk::CommandBuffer cmdbuf) {
scheduler.Record([params](vk::CommandBuffer cmdbuf) { if (draw_params.is_indexed) {
if (params.is_indexed) { cmdbuf.DrawIndexed(draw_params.num_vertices, draw_params.num_instances,
cmdbuf.DrawIndexed(params.num_vertices, params.num_instances, draw_params.first_index, draw_params.base_vertex,
params.first_index, params.base_vertex, draw_params.base_instance);
params.base_instance);
} else { } else {
cmdbuf.Draw(params.num_vertices, params.num_instances, params.base_vertex, cmdbuf.Draw(draw_params.num_vertices, draw_params.num_instances,
params.base_instance); draw_params.base_vertex, draw_params.base_instance);
} }
}); });
};
if (attribute_handle_pipeline && attribute_handle_runs.size() > 1) {
// The first run is already configured, each further one binds its own texture.
for (size_t i = 0; i < attribute_handle_runs.size(); ++i) {
const AttributeHandleRun& run = attribute_handle_runs[i];
if (i != 0) {
attribute_handle_pipeline->SetAttributeHandle(run.handle);
if (!attribute_handle_pipeline->Configure(is_indexed)) {
continue;
}
}
DrawParams run_params = draw_params;
run_params.num_vertices = run.count;
if (is_indexed) {
run_params.first_index += run.first;
} else {
run_params.base_vertex += run.first;
}
record_draw(run_params);
}
} else {
record_draw(draw_params);
}
// Log draw call // Log draw call
if (GPU::Logging::IsActive() && if (GPU::Logging::IsActive() &&
@@ -157,20 +157,6 @@ private:
template <typename Func> template <typename Func>
void PrepareDraw(bool is_indexed, Func&&); void PrepareDraw(bool is_indexed, Func&&);
/// A stretch of a draw whose vertices all carry the same texture handle.
struct AttributeHandleRun {
u32 first;
u32 count;
u32 handle;
};
/// Splits the current draw wherever the texture handle carried in the vertex data changes.
void CollectAttributeHandleRuns(bool is_indexed);
std::vector<AttributeHandleRun> attribute_handle_runs;
GraphicsPipeline* attribute_handle_pipeline{};
bool split_attribute_handles{};
void FlushWork(); void FlushWork();
void UpdateDynamicStates(); void UpdateDynamicStates();
@@ -1011,7 +1011,7 @@ VkBuffer TextureCacheRuntime::GetTemporaryBuffer(size_t needed_size) {
if (buffers[level]) { if (buffers[level]) {
return *buffers[level]; return *buffers[level];
} }
const auto new_size = Common::NextPow2(needed_size); const auto new_size = std::bit_ceil(needed_size);
static constexpr VkBufferUsageFlags flags = static constexpr VkBufferUsageFlags flags =
VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT |
VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT; VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT;
+1 -1
View File
@@ -2190,7 +2190,7 @@ void TextureCache<P>::UnregisterImage(ImageId image_id) {
image.flags &= ~ImageFlagBits::BadOverlap; image.flags &= ~ImageFlagBits::BadOverlap;
lru_cache.Free(image.lru_index); lru_cache.Free(image.lru_index);
const auto& clear_page_table = const auto& clear_page_table =
[image_id](u64 page, ::Common::unordered_map<u64, std::vector<ImageId>, Common::IdentityHash<u64>>& selected_page_table) { [image_id](u64 page, ::Common::unordered_map<u64, std::vector<ImageId>>& selected_page_table) {
const auto page_it = selected_page_table.find(page); const auto page_it = selected_page_table.find(page);
if (page_it == selected_page_table.end()) { if (page_it == selected_page_table.end()) {
ASSERT_MSG(false, "Unregistering unregistered page={:#x}", page << YUZU_PAGEBITS); ASSERT_MSG(false, "Unregistering unregistered page={:#x}", page << YUZU_PAGEBITS);
@@ -22,7 +22,6 @@
#include <queue> #include <queue>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/hash.h"
#include "common/literals.h" #include "common/literals.h"
#include "common/lru_cache.h" #include "common/lru_cache.h"
#include <ranges> #include <ranges>
@@ -69,7 +68,7 @@ struct AsyncDecodeContext {
std::atomic_bool complete; std::atomic_bool complete;
}; };
using TextureCacheGPUMap = ::Common::unordered_map<u64, std::vector<ImageId>, Common::IdentityHash<u64>>; using TextureCacheGPUMap = ::Common::unordered_map<u64, std::vector<ImageId>>;
class TextureCacheChannelInfo : public ChannelInfo { class TextureCacheChannelInfo : public ChannelInfo {
public: public:
@@ -443,7 +442,7 @@ private:
u64 last_framebuffer_serial = 0; u64 last_framebuffer_serial = 0;
::Common::unordered_map<RenderTargets, FramebufferId> framebuffers; ::Common::unordered_map<RenderTargets, FramebufferId> framebuffers;
::Common::unordered_map<u64, std::vector<ImageMapId>, Common::IdentityHash<u64>> page_table; ::Common::unordered_map<u64, std::vector<ImageMapId>> page_table;
::Common::unordered_map<ImageId, boost::container::small_vector<ImageViewId, 16>> sparse_views; ::Common::unordered_map<ImageId, boost::container::small_vector<ImageViewId, 16>> sparse_views;
DAddr virtual_invalid_space{}; DAddr virtual_invalid_space{};
+1 -3
View File
@@ -1,6 +1,3 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2024 yuzu Emulator Project // SPDX-FileCopyrightText: 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
@@ -11,6 +8,7 @@
class QCheckBox; class QCheckBox;
class QLineEdit; class QLineEdit;
class QComboBox;
class QDateTimeEdit; class QDateTimeEdit;
namespace Core { namespace Core {
class System; class System;
+4 -8
View File
@@ -140,12 +140,7 @@ QWidget* Widget::CreateCombobox(std::function<std::string()>& serializer,
if (combobox_enumerations.contains(type)) { if (combobox_enumerations.contains(type)) {
enumeration = &combobox_enumerations.at(type); enumeration = &combobox_enumerations.at(type);
for (const auto& [id, name] : *enumeration) { for (const auto& [id, name] : *enumeration) {
if (type == Settings::EnumMetadata<Settings::AppletMode>::Index() && combobox->addItem(name);
id == static_cast<u32>(Settings::AppletMode::Disabled) &&
setting.Id() != Settings::values.controller_applet_mode.Id()) {
continue;
}
combobox->addItem(name, id);
} }
} else { } else {
return combobox; return combobox;
@@ -163,8 +158,9 @@ QWidget* Widget::CreateCombobox(std::function<std::string()>& serializer,
const u32 setting_value = std::strtoul(setting.ToString().c_str(), nullptr, 0); const u32 setting_value = std::strtoul(setting.ToString().c_str(), nullptr, 0);
combobox->setCurrentIndex(find_index(setting_value)); combobox->setCurrentIndex(find_index(setting_value));
serializer = [this]() { serializer = [this, enumeration]() {
return std::to_string(combobox->currentData().toUInt()); int current = combobox->currentIndex();
return std::to_string(enumeration->at(current).first);
}; };
restore_func = [this, find_index]() { restore_func = [this, find_index]() {
+11 -15
View File
@@ -12,29 +12,25 @@ namespace Yuzu {
inline bool ContainsAllWords(const QString& haystack, const QString& userinput) { inline bool ContainsAllWords(const QString& haystack, const QString& userinput) {
const QStringList userinput_split = userinput.split(QLatin1Char{' '}, Qt::SkipEmptyParts); const QStringList userinput_split = userinput.split(QLatin1Char{' '}, Qt::SkipEmptyParts);
return std::all_of(userinput_split.begin(), userinput_split.end(), [&haystack](const QString& s) { return std::all_of(userinput_split.begin(), userinput_split.end(),
return haystack.contains(s); [&haystack](const QString& s) { return haystack.contains(s); });
});
} }
inline bool FilterMatches(const QString& filter, const QStandardItem* item) { inline bool FilterMatches(const QString& filter, const QStandardItem* item) {
if (filter.isEmpty()) if (filter.isEmpty())
return true; return true;
auto const sluggify = [](const QString& s) {
QString o(s.normalized(QString::NormalizationForm_D).toLower());
return o.replace(QRegularExpression(QStringLiteral("[^a-z\\s]")), QStringLiteral(""));
};
const auto norm_filter = sluggify(filter);
const auto program_id = item->data(GameListItemPath::ProgramIdRole).toULongLong(); const auto program_id = item->data(GameListItemPath::ProgramIdRole).toULongLong();
const QString file_path = sluggify(item->data(GameListItemPath::FullPathRole).toString());
const QString file_title = sluggify(item->data(GameListItemPath::TitleRole).toString()); const QString file_path = item->data(GameListItemPath::FullPathRole).toString().toLower();
const QString file_title = item->data(GameListItemPath::TitleRole).toString().toLower();
const QString file_program_id = QStringLiteral("%1").arg(program_id, 16, 16, QLatin1Char{'0'}); const QString file_program_id = QStringLiteral("%1").arg(program_id, 16, 16, QLatin1Char{'0'});
const QString file_name = sluggify(file_path.mid(file_path.lastIndexOf(QLatin1Char{'/'}) + 1) + QLatin1Char{' '} + file_title);
return (ContainsAllWords(file_name, norm_filter) const QString file_name =
|| ContainsAllWords(file_title, norm_filter)) file_path.mid(file_path.lastIndexOf(QLatin1Char{'/'}) + 1) + QLatin1Char{' '} + file_title;
|| (file_program_id.size() == 16 && file_program_id.contains(norm_filter));
return Yuzu::ContainsAllWords(file_name, filter) ||
(file_program_id.size() == 16 && file_program_id.contains(filter));
} }
} // namespace Yuzu } // namespace Yuzu
+1 -1
View File
@@ -1786,7 +1786,7 @@ bool MainWindow::LoadROM(const QString& filename, Service::AM::FrontendAppletPar
QtCommon::system->SetFrontendAppletSet({ QtCommon::system->SetFrontendAppletSet({
std::make_unique<QtAmiiboSettings>(*this), // Amiibo Settings std::make_unique<QtAmiiboSettings>(*this), // Amiibo Settings
(Settings::values.controller_applet_mode.GetValue() == Settings::AppletMode::Disabled) (UISettings::values.controller_applet_disabled.GetValue() == true)
? nullptr ? nullptr
: std::make_unique<QtControllerSelector>(*this), // Controller Selector : std::make_unique<QtControllerSelector>(*this), // Controller Selector
std::make_unique<QtErrorDisplay>(*this), // Error Display std::make_unique<QtErrorDisplay>(*this), // Error Display