Implemented vibration option

This commit is contained in:
Hyper 2025-01-01 18:05:01 +00:00
parent 90cf22e586
commit d23e6d0e90
9 changed files with 21 additions and 4 deletions

View file

@ -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")

View file

@ -2,6 +2,7 @@
#include "xam.h"
#include "xdm.h"
#include <hid/hid.h>
#include <hid/hid_detail.h>
#include <ui/game_window.h>
#include <cpu/guest_thread.h>
#include <ranges>
@ -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);

View file

@ -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)

View file

@ -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.");
}
}

View file

@ -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);

View file

@ -43,6 +43,7 @@
#include <res/images/options_menu/thumbnails/transparency_antialiasing_true.dds.h>
#include <res/images/options_menu/thumbnails/ui_scale_mode.dds.h>
#include <res/images/options_menu/thumbnails/voice_language.dds.h>
#include <res/images/options_menu/thumbnails/vibration.dds.h>
#include <res/images/options_menu/thumbnails/vsync.dds.h>
#include <res/images/options_menu/thumbnails/window_size.dds.h>
#include <res/images/options_menu/thumbnails/xbox_color_correction_false.dds.h>
@ -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);

View file

@ -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));
}

View file

@ -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);

@ -1 +1 @@
Subproject commit d95ba20a3b5d8def44731a18850e9a550f426a34
Subproject commit 179dad7bf4c95eaec2b5be911529d82fe80b15f1