diff --git a/UnleashedRecomp/CMakeLists.txt b/UnleashedRecomp/CMakeLists.txt index e361b2d..a33b334 100644 --- a/UnleashedRecomp/CMakeLists.txt +++ b/UnleashedRecomp/CMakeLists.txt @@ -483,6 +483,7 @@ BIN2C(TARGET_OBJ UnleashedRecomp SOURCE_FILE "${RESOURCES_SOURCE_PATH}/images/op BIN2C(TARGET_OBJ UnleashedRecomp SOURCE_FILE "${RESOURCES_SOURCE_PATH}/images/options_menu/thumbnails/transparency_antialiasing_true.dds" DEST_FILE "${RESOURCES_OUTPUT_PATH}/images/options_menu/thumbnails/transparency_antialiasing_true.dds" ARRAY_NAME "g_transparency_antialiasing_true" COMPRESSION_TYPE "zstd") BIN2C(TARGET_OBJ UnleashedRecomp SOURCE_FILE "${RESOURCES_SOURCE_PATH}/images/options_menu/thumbnails/ui_scale_mode.dds" DEST_FILE "${RESOURCES_OUTPUT_PATH}/images/options_menu/thumbnails/ui_scale_mode.dds" ARRAY_NAME "g_ui_scale_mode" COMPRESSION_TYPE "zstd") BIN2C(TARGET_OBJ UnleashedRecomp SOURCE_FILE "${RESOURCES_SOURCE_PATH}/images/options_menu/thumbnails/voice_language.dds" DEST_FILE "${RESOURCES_OUTPUT_PATH}/images/options_menu/thumbnails/voice_language.dds" ARRAY_NAME "g_voice_language" COMPRESSION_TYPE "zstd") +BIN2C(TARGET_OBJ UnleashedRecomp SOURCE_FILE "${RESOURCES_SOURCE_PATH}/images/options_menu/thumbnails/vibration.dds" DEST_FILE "${RESOURCES_OUTPUT_PATH}/images/options_menu/thumbnails/vibration.dds" ARRAY_NAME "g_vibration" COMPRESSION_TYPE "zstd") BIN2C(TARGET_OBJ UnleashedRecomp SOURCE_FILE "${RESOURCES_SOURCE_PATH}/images/options_menu/thumbnails/vsync.dds" DEST_FILE "${RESOURCES_OUTPUT_PATH}/images/options_menu/thumbnails/vsync.dds" ARRAY_NAME "g_vsync" COMPRESSION_TYPE "zstd") BIN2C(TARGET_OBJ UnleashedRecomp SOURCE_FILE "${RESOURCES_SOURCE_PATH}/images/options_menu/thumbnails/window_size.dds" DEST_FILE "${RESOURCES_OUTPUT_PATH}/images/options_menu/thumbnails/window_size.dds" ARRAY_NAME "g_window_size" COMPRESSION_TYPE "zstd") BIN2C(TARGET_OBJ UnleashedRecomp SOURCE_FILE "${RESOURCES_SOURCE_PATH}/images/options_menu/thumbnails/xbox_color_correction_false.dds" DEST_FILE "${RESOURCES_OUTPUT_PATH}/images/options_menu/thumbnails/xbox_color_correction_false.dds" ARRAY_NAME "g_xbox_color_correction_false" COMPRESSION_TYPE "zstd") diff --git a/UnleashedRecomp/kernel/xam.cpp b/UnleashedRecomp/kernel/xam.cpp index 66a3d67..6136ee8 100644 --- a/UnleashedRecomp/kernel/xam.cpp +++ b/UnleashedRecomp/kernel/xam.cpp @@ -2,6 +2,7 @@ #include "xam.h" #include "xdm.h" #include +#include #include #include #include @@ -462,6 +463,9 @@ SWA_API uint32_t XamInputGetState(uint32_t userIndex, uint32_t flags, XAMINPUT_S SWA_API uint32_t XamInputSetState(uint32_t userIndex, uint32_t flags, XAMINPUT_VIBRATION* vibration) { + if (!hid::detail::IsInputDeviceController() || !Config::Vibration) + return ERROR_SUCCESS; + ByteSwapInplace(vibration->wLeftMotorSpeed); ByteSwapInplace(vibration->wRightMotorSpeed); diff --git a/UnleashedRecomp/locale/config_locale.cpp b/UnleashedRecomp/locale/config_locale.cpp index 56392f0..5defd50 100644 --- a/UnleashedRecomp/locale/config_locale.cpp +++ b/UnleashedRecomp/locale/config_locale.cpp @@ -89,9 +89,14 @@ CONFIG_DEFINE_LOCALE(InvertCameraY) { ELanguage::English, { "Invert Camera Y", "Toggle between inverted up and down camera movement." } } }; +CONFIG_DEFINE_LOCALE(Vibration) +{ + { ELanguage::English, { "Vibration", "Toggle controller vibration." } } +}; + CONFIG_DEFINE_LOCALE(AllowBackgroundInput) { - { ELanguage::English, { "Allow Background Input", "Accept controller input whilst the game window is unfocused." } } + { ELanguage::English, { "Allow Background Input", "Allow controller input whilst the game window is unfocused." } } }; CONFIG_DEFINE_LOCALE(AllowDPadMovement) diff --git a/UnleashedRecomp/main.cpp b/UnleashedRecomp/main.cpp index cf87aa5..da354c8 100644 --- a/UnleashedRecomp/main.cpp +++ b/UnleashedRecomp/main.cpp @@ -160,16 +160,18 @@ int main(int argc, char *argv[]) bool forceInstaller = false; bool forceDLCInstaller = false; const char *sdlVideoDriver = nullptr; + for (uint32_t i = 1; i < argc; i++) { forceInstaller = forceInstaller || (strcmp(argv[i], "--install") == 0); forceDLCInstaller = forceDLCInstaller || (strcmp(argv[i], "--install-dlc") == 0); + if (strcmp(argv[i], "--sdl-video-driver") == 0) { if ((i + 1) < argc) sdlVideoDriver = argv[++i]; else - fmt::println("No argument was specified for --sdl-video-driver. Option was ignored."); + LOGN_WARNING("No argument was specified for --sdl-video-driver. Option will be ignored."); } } diff --git a/UnleashedRecomp/ui/options_menu.cpp b/UnleashedRecomp/ui/options_menu.cpp index 3909bf4..66da4bd 100644 --- a/UnleashedRecomp/ui/options_menu.cpp +++ b/UnleashedRecomp/ui/options_menu.cpp @@ -819,6 +819,7 @@ static void DrawConfigOptions() case 1: // INPUT DrawConfigOption(rowCount++, yOffset, &Config::InvertCameraX, true); DrawConfigOption(rowCount++, yOffset, &Config::InvertCameraY, true); + DrawConfigOption(rowCount++, yOffset, &Config::Vibration, true); DrawConfigOption(rowCount++, yOffset, &Config::AllowBackgroundInput, true); DrawConfigOption(rowCount++, yOffset, &Config::AllowDPadMovement, true); DrawConfigOption(rowCount++, yOffset, &Config::ControllerIcons, true); diff --git a/UnleashedRecomp/ui/options_menu_thumbnails.cpp b/UnleashedRecomp/ui/options_menu_thumbnails.cpp index a226bda..d2b968c 100644 --- a/UnleashedRecomp/ui/options_menu_thumbnails.cpp +++ b/UnleashedRecomp/ui/options_menu_thumbnails.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -75,6 +76,7 @@ void LoadThumbnails() g_configThumbnails[&Config::InvertCameraX] = LOAD_ZSTD_TEXTURE(g_invert_camera_x); g_configThumbnails[&Config::InvertCameraY] = LOAD_ZSTD_TEXTURE(g_invert_camera_y); + g_configThumbnails[&Config::Vibration] = LOAD_ZSTD_TEXTURE(g_vibration); g_configThumbnails[&Config::AllowBackgroundInput] = LOAD_ZSTD_TEXTURE(g_allow_background_input); g_configThumbnails[&Config::AllowDPadMovement] = LOAD_ZSTD_TEXTURE(g_allow_dpad_movement); g_configThumbnails[&Config::ControllerIcons] = LOAD_ZSTD_TEXTURE(g_controller_icons); diff --git a/UnleashedRecomp/user/achievement_data.cpp b/UnleashedRecomp/user/achievement_data.cpp index 4b9e25b..650e830 100644 --- a/UnleashedRecomp/user/achievement_data.cpp +++ b/UnleashedRecomp/user/achievement_data.cpp @@ -110,6 +110,7 @@ void AchievementData::Load() { // Try loading base achievement data as fallback. dataPath = GetDataPath(false); + if (!std::filesystem::exists(dataPath)) return; } @@ -156,7 +157,7 @@ void AchievementData::Load() // TODO: display error message to user before wiping data? if (!VerifyChecksum()) { - LOGN_ERROR("Achievement data checksum mismatch."); + LOGN_WARNING("Achievement data checksum mismatch."); memset(&Data.Records, 0, sizeof(Data.Records)); } diff --git a/UnleashedRecomp/user/config.h b/UnleashedRecomp/user/config.h index 702a335..cd450b9 100644 --- a/UnleashedRecomp/user/config.h +++ b/UnleashedRecomp/user/config.h @@ -598,6 +598,7 @@ public: CONFIG_DEFINE_LOCALISED("Input", bool, InvertCameraX, false); CONFIG_DEFINE_LOCALISED("Input", bool, InvertCameraY, false); + CONFIG_DEFINE_LOCALISED("Input", bool, Vibration, true); CONFIG_DEFINE_LOCALISED("Input", bool, AllowBackgroundInput, false); CONFIG_DEFINE_LOCALISED("Input", bool, AllowDPadMovement, false); CONFIG_DEFINE_ENUM_LOCALISED("Input", EControllerIcons, ControllerIcons, EControllerIcons::Auto); diff --git a/UnleashedRecompResources b/UnleashedRecompResources index d95ba20..179dad7 160000 --- a/UnleashedRecompResources +++ b/UnleashedRecompResources @@ -1 +1 @@ -Subproject commit d95ba20a3b5d8def44731a18850e9a550f426a34 +Subproject commit 179dad7bf4c95eaec2b5be911529d82fe80b15f1