From 2aa1c47109a983140ae4ba6f054b3f7c1c7d60be Mon Sep 17 00:00:00 2001 From: brooksytech Date: Sun, 6 Nov 2022 15:39:38 -0800 Subject: [PATCH] Update DolphinSA ES settings --- packages/games/emulators/dolphinsa/package.mk | 2 +- .../dolphinsa/patches/new/001-padorder.patch | 111 -------------- .../patches/new/002-x11-hotkeys.patch | 142 ----------------- .../patches/new/003-fix-x11-window.patch | 144 ------------------ .../dolphinsa/patches/new/004-git.patch | 13 -- .../patches/new/005-hide-osd-msg.patch | 13 -- .../dolphinsa/scripts/start_dolphin_gc.sh | 16 ++ .../dolphinsa/scripts/start_dolphin_wii.sh | 19 ++- .../config/common/es_features.cfg | 5 + 9 files changed, 35 insertions(+), 430 deletions(-) delete mode 100644 packages/games/emulators/dolphinsa/patches/new/001-padorder.patch delete mode 100644 packages/games/emulators/dolphinsa/patches/new/002-x11-hotkeys.patch delete mode 100644 packages/games/emulators/dolphinsa/patches/new/003-fix-x11-window.patch delete mode 100644 packages/games/emulators/dolphinsa/patches/new/004-git.patch delete mode 100644 packages/games/emulators/dolphinsa/patches/new/005-hide-osd-msg.patch diff --git a/packages/games/emulators/dolphinsa/package.mk b/packages/games/emulators/dolphinsa/package.mk index 11b59d763..ea827bef8 100755 --- a/packages/games/emulators/dolphinsa/package.mk +++ b/packages/games/emulators/dolphinsa/package.mk @@ -10,7 +10,7 @@ case ${DEVICE} in RG552|handheld) PKG_SITE="https://github.com/dolphin-emu/dolphin" PKG_URL="${PKG_SITE}.git" - PKG_VERSION="0210d115c22a1c5745c76eaefe38b5d0af3247f9" + PKG_VERSION="c931529e7aa5926b8a21a193bf8f80244b3ae888" PKG_PATCH_DIRS+=" wayland" ;; *) diff --git a/packages/games/emulators/dolphinsa/patches/new/001-padorder.patch b/packages/games/emulators/dolphinsa/patches/new/001-padorder.patch deleted file mode 100644 index 187a57efc..000000000 --- a/packages/games/emulators/dolphinsa/patches/new/001-padorder.patch +++ /dev/null @@ -1,111 +0,0 @@ -diff --git a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp -index 6df37b4..64ade4a 100644 ---- a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp -+++ b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp -@@ -392,6 +392,65 @@ void Init() - StartHotplugThread(); - } - -+struct joypad_udev_entry -+{ -+ const char *devnode; -+ struct udev_device *dev; -+}; -+ -+int isNumber(const char *s) { -+ int n; -+ -+ if(strlen(s) == 0) { -+ return 0; -+ } -+ -+ for(n=0; ndevnode, bb->devnode); -+} -+ - // Only call this when ControllerInterface::m_devices_population_mutex is locked - void PopulateDevices() - { -@@ -404,6 +463,10 @@ void PopulateDevices() - // We use udev to iterate over all /dev/input/event* devices. - // Note: the Linux kernel is currently limited to just 32 event devices. If - // this ever changes, hopefully udev will take care of this. -+ unsigned sorted_count = 0; -+ struct joypad_udev_entry sorted[64]; -+ const char* devnode; -+ int i; - - udev* const udev = udev_new(); - ASSERT_MSG(CONTROLLERINTERFACE, udev != nullptr, "Couldn't initialize libudev."); -@@ -422,11 +485,25 @@ void PopulateDevices() - - udev_device* dev = udev_device_new_from_syspath(udev, path); - -- if (const char* devnode = udev_device_get_devnode(dev)) -- AddDeviceNode(devnode); -- -- udev_device_unref(dev); -+ devnode = udev_device_get_devnode(dev); -+ if (devnode != NULL && sorted_count < 64) { -+ sorted[sorted_count].devnode = devnode; -+ sorted[sorted_count].dev = dev; -+ sorted_count++; -+ } else { -+ udev_device_unref(dev); -+ } - } -+ -+ /* Sort the udev entries by devnode name so that they are -+ * created in the proper order */ -+ qsort(sorted, sorted_count, sizeof(struct joypad_udev_entry), sort_devnodes); -+ -+ for (i = 0; i < sorted_count; i++) { -+ AddDeviceNode(sorted[i].devnode); -+ udev_device_unref(sorted[i].dev); -+ } -+ - udev_enumerate_unref(enumerate); - udev_unref(udev); - } diff --git a/packages/games/emulators/dolphinsa/patches/new/002-x11-hotkeys.patch b/packages/games/emulators/dolphinsa/patches/new/002-x11-hotkeys.patch deleted file mode 100644 index 4348cb492..000000000 --- a/packages/games/emulators/dolphinsa/patches/new/002-x11-hotkeys.patch +++ /dev/null @@ -1,142 +0,0 @@ -diff --git a/Source/Core/Core/HW/GCPadEmu.h b/Source/Core/Core/HW/GCPadEmu.h -index 66a1aee4e4..a03eaebcd3 100644 ---- a/Source/Core/Core/HW/GCPadEmu.h -+++ b/Source/Core/Core/HW/GCPadEmu.h -@@ -65,6 +65,7 @@ public: - static constexpr const char* X_BUTTON = "X"; - static constexpr const char* Y_BUTTON = "Y"; - static constexpr const char* Z_BUTTON = "Z"; -+ static constexpr const char* HOTKEY_BUTTON = "Hotkey"; - static constexpr const char* START_BUTTON = "Start"; - - // i18n: The left trigger button (labeled L on real controllers) -diff --git a/Source/Core/Core/HW/GCPadEmu.cpp b/Source/Core/Core/HW/GCPadEmu.cpp -index 470d2b8c2f..97818b5b67 100644 ---- a/Source/Core/Core/HW/GCPadEmu.cpp -+++ b/Source/Core/Core/HW/GCPadEmu.cpp -@@ -25,6 +25,7 @@ static const u16 button_bitmasks[] = { - PAD_BUTTON_Y, - PAD_TRIGGER_Z, - PAD_BUTTON_START, -+ PAD_BUTTON_HOTKEY, - 0 // MIC HAX - }; - -@@ -47,6 +48,9 @@ GCPad::GCPad(const unsigned int index) : m_index(index) - // i18n: The START/PAUSE button on GameCube controllers - m_buttons->AddInput(ControllerEmu::Translate, START_BUTTON, _trans("START")); - -+ // Hotkey Button -+ m_buttons->AddInput(ControllerEmu::Translate, HOTKEY_BUTTON, _trans("HOTKEY")); -+ - // sticks - groups.emplace_back(m_main_stick = new ControllerEmu::OctagonAnalogStick( - MAIN_STICK_GROUP, _trans("Control Stick"), MAIN_STICK_GATE_RADIUS)); -diff --git a/Source/Core/DolphinNoGUI/PlatformX11.cpp b/Source/Core/DolphinNoGUI/PlatformX11.cpp -index 8dcd93bf52..5d7386da38 100644 ---- a/Source/Core/DolphinNoGUI/PlatformX11.cpp -+++ b/Source/Core/DolphinNoGUI/PlatformX11.cpp -@@ -16,6 +16,12 @@ static constexpr auto X_None = None; - #include "Core/Core.h" - #include "Core/State.h" - -+#include "Core/HW/GCPad.h" -+#include "InputCommon/GCPadStatus.h" -+#include -+#include "Core/Config/GraphicsSettings.h" -+#include "VideoCommon/VideoConfig.h" -+ - #include - #include - #include -@@ -149,11 +155,78 @@ void PlatformX11::MainLoop() - { - while (IsRunning()) - { -+ static int hotkey = 0; -+ static int slot = 0; -+ static int fps = 0; -+ static int aspect = 0; -+ - UpdateRunningFlag(); - Core::HostDispatchJobs(); - ProcessEvents(); - UpdateWindowPosition(); - -+ if(Pad::IsInitialized()) { -+ GCPadStatus x = Pad::GetStatus(0); -+ -+ if( (x.button & PAD_BUTTON_HOTKEY) == PAD_BUTTON_HOTKEY) { // hotkey pressed -+ if(hotkey == 1) { -+ hotkey = 2; -+ } -+ } else { -+ hotkey = 1; // assure hotkey is released between actions -+ } -+ -+ if(hotkey == 2) { // hotkey pressed -+ if( (x.button & PAD_BUTTON_START) == PAD_BUTTON_START) { -+ RequestShutdown(); -+ hotkey = 0; -+ } -+ -+ if( (x.button & PAD_TRIGGER_L) == PAD_TRIGGER_L) { -+ State::Load(slot); -+ hotkey = 0; -+ } -+ if( (x.button & PAD_TRIGGER_R) == PAD_TRIGGER_R) { -+ State::Save(slot); -+ hotkey = 0; -+ } -+ if( (x.button & PAD_BUTTON_DOWN) == PAD_BUTTON_DOWN) { -+ if(slot > 0) slot--; -+ Core::DisplayMessage(fmt::format("Slot {} selected", slot), 4000); -+ hotkey = 0; -+ } -+ if( (x.button & PAD_BUTTON_UP) == PAD_BUTTON_UP) { -+ if(slot < 10) slot++; -+ Core::DisplayMessage(fmt::format("Slot {} selected", slot), 4000); -+ hotkey = 0; -+ } -+ if( (x.button & PAD_BUTTON_A) == PAD_BUTTON_A) { -+ Core::SaveScreenShot(); -+ hotkey = 0; -+ } -+ if( (x.button & PAD_BUTTON_Y) == PAD_BUTTON_Y) { -+ if(fps == 0) { -+ Config::SetCurrent(Config::GFX_SHOW_FPS, True); -+ fps = 1; -+ } else { -+ Config::SetCurrent(Config::GFX_SHOW_FPS, False); -+ fps = 0; -+ } -+ hotkey = 0; -+ } -+ if( (x.button & PAD_BUTTON_X) == PAD_BUTTON_X) { -+ if(aspect == 0) { -+ Config::SetCurrent(Config::GFX_ASPECT_RATIO, AspectMode::Stretch); -+ aspect = 1; -+ } else { -+ Config::SetCurrent(Config::GFX_ASPECT_RATIO, AspectMode::Auto); -+ aspect = 0; -+ } -+ hotkey = 0; -+ } -+ } -+ } -+ - // TODO: Is this sleep appropriate? - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - } -diff --git a/Source/Core/InputCommon/GCPadStatus.h b/Source/Core/InputCommon/GCPadStatus.h -index 7da1bbd..57d294d 100644 ---- a/Source/Core/InputCommon/GCPadStatus.h -+++ b/Source/Core/InputCommon/GCPadStatus.h -@@ -27,6 +27,7 @@ enum PadButton - PAD_BUTTON_X = 0x0400, - PAD_BUTTON_Y = 0x0800, - PAD_BUTTON_START = 0x1000, -+ PAD_BUTTON_HOTKEY = 0x2000, - }; - - struct GCPadStatus diff --git a/packages/games/emulators/dolphinsa/patches/new/003-fix-x11-window.patch b/packages/games/emulators/dolphinsa/patches/new/003-fix-x11-window.patch deleted file mode 100644 index 6ad08e55b..000000000 --- a/packages/games/emulators/dolphinsa/patches/new/003-fix-x11-window.patch +++ /dev/null @@ -1,144 +0,0 @@ -diff --git a/Source/Core/DolphinNoGUI/MainNoGUI.cpp b/Source/Core/DolphinNoGUI/MainNoGUI.cpp -index 11bbf55da1..71d8960652 100644 ---- a/Source/Core/DolphinNoGUI/MainNoGUI.cpp -+++ b/Source/Core/DolphinNoGUI/MainNoGUI.cpp -@@ -251,6 +251,10 @@ int main(int argc, char* argv[]) - if (options.is_set("user")) - user_directory = static_cast(options.get("user")); - -+ UICommon::SetUserDirectory(user_directory); -+ UICommon::Init(); -+ GCAdapter::Init(); -+ - s_platform = GetPlatform(options); - if (!s_platform || !s_platform->Init()) - { -@@ -258,17 +262,6 @@ int main(int argc, char* argv[]) - return 1; - } - -- const WindowSystemInfo wsi = s_platform->GetWindowSystemInfo(); -- -- UICommon::SetUserDirectory(user_directory); -- UICommon::Init(); -- UICommon::InitControllers(wsi); -- -- Common::ScopeGuard ui_common_guard([] { -- UICommon::ShutdownControllers(); -- UICommon::Shutdown(); -- }); -- - if (save_state_path && !game_specified) - { - fprintf(stderr, "A save state cannot be loaded without specifying a game to launch.\n"); -@@ -295,7 +288,7 @@ int main(int argc, char* argv[]) - - DolphinAnalytics::Instance().ReportDolphinStart("nogui"); - -- if (!BootManager::BootCore(std::move(boot), wsi)) -+ if (!BootManager::BootCore(std::move(boot), s_platform->GetWindowSystemInfo())) - { - fprintf(stderr, "Could not boot the specified file\n"); - return 1; -@@ -310,6 +303,7 @@ int main(int argc, char* argv[]) - - Core::Shutdown(); - s_platform.reset(); -+ UICommon::Shutdown(); - - return 0; - } - -diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp -index 8a02534c57..00d8ac09e8 100644 ---- a/Source/Core/Core/Core.cpp -+++ b/Source/Core/Core/Core.cpp -@@ -470,14 +470,26 @@ static void EmuThread(std::unique_ptr boot, WindowSystemInfo wsi - DeclareAsCPUThread(); - s_frame_step = false; - -- // Switch the window used for inputs to the render window. This way, the cursor position -- // is relative to the render window, instead of the main window. -- ASSERT(g_controller_interface.IsInit()); -- g_controller_interface.ChangeWindow(wsi.render_window); -- -- Pad::LoadConfig(); -- Pad::LoadGBAConfig(); -- Keyboard::LoadConfig(); -+ // The frontend will likely have initialized the controller interface, as it needs -+ // it to provide the configuration dialogs. In this case, instead of re-initializing -+ // entirely, we switch the window used for inputs to the render window. This way, the -+ // cursor position is relative to the render window, instead of the main window. -+ bool init_controllers = false; -+ if (!g_controller_interface.IsInit()) -+ { -+ g_controller_interface.Initialize(wsi); -+ Pad::Initialize(); -+ Pad::InitializeGBA(); -+ Keyboard::Initialize(); -+ init_controllers = true; -+ } -+ else -+ { -+ g_controller_interface.ChangeWindow(wsi.render_window); -+ Pad::LoadConfig(); -+ Pad::LoadGBAConfig(); -+ Keyboard::LoadConfig(); -+ } - - BootSessionData boot_session_data = std::move(boot->boot_session_data); - const std::optional& savestate_path = boot_session_data.GetSavestatePath(); -@@ -494,13 +506,50 @@ static void EmuThread(std::unique_ptr boot, WindowSystemInfo wsi - Common::SyncSDImageToSDFolder(); - }}; - -- // Load Wiimotes - only if we are booting in Wii mode -+ // Load and Init Wiimotes - only if we are booting in Wii mode -+ bool init_wiimotes = false; - if (core_parameter.bWii && !Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_ENABLED)) - { -- Wiimote::LoadConfig(); -+ if (init_controllers) -+ { -+ Wiimote::Initialize(savestate_path ? Wiimote::InitializeMode::DO_WAIT_FOR_WIIMOTES : -+ Wiimote::InitializeMode::DO_NOT_WAIT_FOR_WIIMOTES); -+ init_wiimotes = true; -+ } -+ else -+ { -+ Wiimote::LoadConfig(); -+ } - } - -- FreeLook::LoadInputConfig(); -+ if (init_controllers) -+ { -+ FreeLook::Initialize(); -+ } -+ else -+ { -+ FreeLook::LoadInputConfig(); -+ } -+ -+ Common::ScopeGuard controller_guard{[init_controllers, init_wiimotes] { -+ if (!init_controllers) -+ return; -+ -+ if (init_wiimotes) -+ { -+ Wiimote::ResetAllWiimotes(); -+ Wiimote::Shutdown(); -+ } -+ -+ FreeLook::Shutdown(); -+ -+ ResetRumble(); -+ -+ Keyboard::Shutdown(); -+ Pad::Shutdown(); -+ Pad::ShutdownGBA(); -+ g_controller_interface.Shutdown(); -+ }}; - - Movie::Init(*boot); - Common::ScopeGuard movie_guard{&Movie::Shutdown}; diff --git a/packages/games/emulators/dolphinsa/patches/new/004-git.patch b/packages/games/emulators/dolphinsa/patches/new/004-git.patch deleted file mode 100644 index cbc4b582d..000000000 --- a/packages/games/emulators/dolphinsa/patches/new/004-git.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index eb0f83f..9d41166 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -128,7 +128,7 @@ endif() - include(CCache) - - # for revision info --find_package(Git) -+#find_package(Git) - if(GIT_FOUND) - # make sure version information gets re-run when the current Git HEAD changes - execute_process(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --git-path HEAD diff --git a/packages/games/emulators/dolphinsa/patches/new/005-hide-osd-msg.patch b/packages/games/emulators/dolphinsa/patches/new/005-hide-osd-msg.patch deleted file mode 100644 index 500530983..000000000 --- a/packages/games/emulators/dolphinsa/patches/new/005-hide-osd-msg.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/Source/Core/VideoBackends/OGL/OGLRender.cpp 2020-12-31 00:27:53.998709857 +0100 -+++ b/Source/Core/VideoBackends/OGL/OGLRender.cpp 2020-12-31 00:28:40.414557344 +0100 -@@ -736,10 +736,6 @@ - g_Config.VerifyValidity(); - UpdateActiveConfig(); - -- OSD::AddMessage(fmt::format("Video Info: {}, {}, {}", g_ogl_config.gl_vendor, -- g_ogl_config.gl_renderer, g_ogl_config.gl_version), -- 5000); -- - if (!g_ogl_config.bSupportsGLBufferStorage && !g_ogl_config.bSupportsGLPinnedMemory) - { - OSD::AddMessage(fmt::format("Your OpenGL driver does not support {}_buffer_storage.", diff --git a/packages/games/emulators/dolphinsa/scripts/start_dolphin_gc.sh b/packages/games/emulators/dolphinsa/scripts/start_dolphin_gc.sh index 05ce247c2..d1040e51e 100755 --- a/packages/games/emulators/dolphinsa/scripts/start_dolphin_gc.sh +++ b/packages/games/emulators/dolphinsa/scripts/start_dolphin_gc.sh @@ -11,6 +11,11 @@ if [ ! -d "/storage/.config/dolphin-emu" ]; then cp -r "/usr/config/dolphin-emu" "/storage/.config/" fi +#Check if GC custom controller profile exists in .config/dolphin-emu +if [ ! -f "/storage/.config/dolphin-emu/Custom_GCPadNew.ini" ]; then + cp -r "/usr/config/dolphin-emu/GCPadNew.ini" "/storage/.config/dolphin-emu/Custom_GCPadNew.ini" +fi + #Link Save States to /roms/savestates if [ ! -d "/storage/roms/savestates/gamecube/" ]; then mkdir -p "/storage/roms/savestates/gamecube/" @@ -26,6 +31,7 @@ ln -sf /storage/roms/savestates/gamecube /storage/.config/dolphin-emu/StateSaves RENDERER=$(get_setting graphics_backend gamecube "${GAME}") IRES=$(get_setting internal_resolution gamecube "${GAME}") FPS=$(get_setting show_fps gamecube "${GAME}") + CON=$(get_setting gamecube_controller_profile gamecube "${GAME}") #Anti-Aliasing if [ "$AA" = "0" ] @@ -121,6 +127,16 @@ ln -sf /storage/roms/savestates/gamecube /storage/.config/dolphin-emu/StateSaves sed -i '/ShowFPS/c\ShowFPS = true' /storage/.config/dolphin-emu/GFX.ini fi + #GC Controller Profile + if [ "$CON" = "default" ] + then + cp -r /usr/config/dolphin-emu/GCPadNew.ini /storage/.config/dolphin-emu/GCPadNew.ini + fi + if [ "$CON" = "custom" ] + then + cp -r /storage/.config/dolphin-emu/Custom_GCPadNew.ini /storage/.config/dolphin-emu/GCPadNew.ini + fi + #Link .config/dolphin-emu to .local rm -rf /storage/.local/share/dolphin-emu ln -sf /storage/.config/dolphin-emu /storage/.local/share/dolphin-emu diff --git a/packages/games/emulators/dolphinsa/scripts/start_dolphin_wii.sh b/packages/games/emulators/dolphinsa/scripts/start_dolphin_wii.sh index 26b1afd1d..37770e745 100755 --- a/packages/games/emulators/dolphinsa/scripts/start_dolphin_wii.sh +++ b/packages/games/emulators/dolphinsa/scripts/start_dolphin_wii.sh @@ -11,11 +11,14 @@ if [ ! -d "/storage/.config/dolphin-emu" ]; then cp -r "/usr/config/dolphin-emu" "/storage/.config/" fi -#Check if WiiControllerProfiles exists in .config/dolphin-emu -if [ ! -d "/storage/.config/dolphin-emu/WiiControllerProfiles" ]; then - cp -r "/usr/config/dolphin-emu" "/storage/.config/dolphin-emu/WiiControllerProfiles" +#Check if Wii custom controller profile exists in .config/dolphin-emu +if [ ! -f "/storage/.config/dolphin-emu/Custom_WiimoteNew.ini" ]; then + cp -r "/usr/config/dolphin-emu/WiiControllerProfiles/remote.ini" "/storage/.config/dolphin-emu/Custom_WiimoteNew.ini" fi +#Gamecube controller profile needed for hotkeys to work +cp -r "/usr/config/dolphin-emu/GCPadNew.ini" "/storage/.config/dolphin-emu/GCPadNew.ini" + #Link Save States to /roms/savestates/wii if [ ! -d "/storage/roms/savestates/wii/" ]; then mkdir -p "/storage/roms/savestates/wii/" @@ -130,15 +133,19 @@ ln -sf /storage/roms/savestates/wii /storage/.config/dolphin-emu/StateSaves #Wii Controller Profile if [ "$CON" = "remote" ] then - cp -r /storage/.config/dolphin-emu/WiiControllerProfiles/remote.ini /storage/.config/dolphin-emu/WiimoteNew.ini + cp -r /usr/config/dolphin-emu/WiiControllerProfiles/remote.ini /storage/.config/dolphin-emu/WiimoteNew.ini fi if [ "$CON" = "nunchuck" ] then - cp -r /storage/.config/dolphin-emu/WiiControllerProfiles/nunchuck.ini /storage/.config/dolphin-emu/WiimoteNew.ini + cp -r /usr/config/dolphin-emu/WiiControllerProfiles/nunchuck.ini /storage/.config/dolphin-emu/WiimoteNew.ini fi if [ "$CON" = "classic" ] then - cp -r /storage/.config/dolphin-emu/WiiControllerProfiles/classic.ini /storage/.config/dolphin-emu/WiimoteNew.ini + cp -r /usr/config/dolphin-emu/WiiControllerProfiles/classic.ini /storage/.config/dolphin-emu/WiimoteNew.ini + fi + if [ "$CON" = "custom" ] + then + cp -r /storage/.config/dolphin-emu/Custom_WiimoteNew.ini /storage/.config/dolphin-emu/WiimoteNew.ini fi #Link .config/dolphin-emu to .local diff --git a/packages/ui/emulationstation/config/common/es_features.cfg b/packages/ui/emulationstation/config/common/es_features.cfg index fb7f30099..01037f67f 100644 --- a/packages/ui/emulationstation/config/common/es_features.cfg +++ b/packages/ui/emulationstation/config/common/es_features.cfg @@ -52,6 +52,10 @@ + + + + @@ -89,6 +93,7 @@ +