Merge pull request #717 from brooksytech/dev

Update DolphinSA ES settings
This commit is contained in:
Brooksytech 2022-11-06 15:47:29 -08:00 committed by GitHub
commit 9e0462b33c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 35 additions and 430 deletions

View file

@ -10,7 +10,7 @@ case ${DEVICE} in
RG552|handheld) RG552|handheld)
PKG_SITE="https://github.com/dolphin-emu/dolphin" PKG_SITE="https://github.com/dolphin-emu/dolphin"
PKG_URL="${PKG_SITE}.git" PKG_URL="${PKG_SITE}.git"
PKG_VERSION="0210d115c22a1c5745c76eaefe38b5d0af3247f9" PKG_VERSION="c931529e7aa5926b8a21a193bf8f80244b3ae888"
PKG_PATCH_DIRS+=" wayland" PKG_PATCH_DIRS+=" wayland"
;; ;;
*) *)

View file

@ -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; n<strlen(s); n++) {
+ if(!(s[n] == '0' || s[n] == '1' || s[n] == '2' || s[n] == '3' || s[n] == '4' ||
+ s[n] == '5' || s[n] == '6' || s[n] == '7' || s[n] == '8' || s[n] == '9'))
+ return 0;
+ }
+ return 1;
+}
+
+// compare /dev/input/eventX and /dev/input/eventY where X and Y are numbers
+int strcmp_events(const char* x, const char* y) {
+
+ // find a common string
+ int n, common, is_number;
+ int a, b;
+
+ n=0;
+ while(x[n] == y[n] && x[n] != '\0' && y[n] != '\0') {
+ n++;
+ }
+ common = n;
+
+ // check if remaining string is a number
+ is_number = 1;
+ if(isNumber(x+common) == 0) is_number = 0;
+ if(isNumber(y+common) == 0) is_number = 0;
+
+ if(is_number == 1) {
+ a = atoi(x+common);
+ b = atoi(y+common);
+
+ if(a == b) return 0;
+ if(a < b) return -1;
+ return 1;
+ } else {
+ return strcmp(x, y);
+ }
+}
+
+/* Used for sorting devnodes to appear in the correct order */
+static int sort_devnodes(const void *a, const void *b)
+{
+ const struct joypad_udev_entry *aa = (const struct joypad_udev_entry *) a;
+ const struct joypad_udev_entry *bb = (const struct joypad_udev_entry *) b;
+ return strcmp_events(aa->devnode, 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);
}

View file

@ -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 <fmt/format.h>
+#include "Core/Config/GraphicsSettings.h"
+#include "VideoCommon/VideoConfig.h"
+
#include <climits>
#include <cstdio>
#include <cstring>
@@ -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

View file

@ -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<const char*>(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<BootParameters> 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<std::string>& savestate_path = boot_session_data.GetSavestatePath();
@@ -494,13 +506,50 @@ static void EmuThread(std::unique_ptr<BootParameters> 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};

View file

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

View file

@ -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.",

View file

@ -11,6 +11,11 @@ if [ ! -d "/storage/.config/dolphin-emu" ]; then
cp -r "/usr/config/dolphin-emu" "/storage/.config/" cp -r "/usr/config/dolphin-emu" "/storage/.config/"
fi 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 #Link Save States to /roms/savestates
if [ ! -d "/storage/roms/savestates/gamecube/" ]; then if [ ! -d "/storage/roms/savestates/gamecube/" ]; then
mkdir -p "/storage/roms/savestates/gamecube/" 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}") RENDERER=$(get_setting graphics_backend gamecube "${GAME}")
IRES=$(get_setting internal_resolution gamecube "${GAME}") IRES=$(get_setting internal_resolution gamecube "${GAME}")
FPS=$(get_setting show_fps gamecube "${GAME}") FPS=$(get_setting show_fps gamecube "${GAME}")
CON=$(get_setting gamecube_controller_profile gamecube "${GAME}")
#Anti-Aliasing #Anti-Aliasing
if [ "$AA" = "0" ] 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 sed -i '/ShowFPS/c\ShowFPS = true' /storage/.config/dolphin-emu/GFX.ini
fi 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 #Link .config/dolphin-emu to .local
rm -rf /storage/.local/share/dolphin-emu rm -rf /storage/.local/share/dolphin-emu
ln -sf /storage/.config/dolphin-emu /storage/.local/share/dolphin-emu ln -sf /storage/.config/dolphin-emu /storage/.local/share/dolphin-emu

View file

@ -11,11 +11,14 @@ if [ ! -d "/storage/.config/dolphin-emu" ]; then
cp -r "/usr/config/dolphin-emu" "/storage/.config/" cp -r "/usr/config/dolphin-emu" "/storage/.config/"
fi fi
#Check if WiiControllerProfiles exists in .config/dolphin-emu #Check if Wii custom controller profile exists in .config/dolphin-emu
if [ ! -d "/storage/.config/dolphin-emu/WiiControllerProfiles" ]; then if [ ! -f "/storage/.config/dolphin-emu/Custom_WiimoteNew.ini" ]; then
cp -r "/usr/config/dolphin-emu" "/storage/.config/dolphin-emu/WiiControllerProfiles" cp -r "/usr/config/dolphin-emu/WiiControllerProfiles/remote.ini" "/storage/.config/dolphin-emu/Custom_WiimoteNew.ini"
fi 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 #Link Save States to /roms/savestates/wii
if [ ! -d "/storage/roms/savestates/wii/" ]; then if [ ! -d "/storage/roms/savestates/wii/" ]; then
mkdir -p "/storage/roms/savestates/wii/" mkdir -p "/storage/roms/savestates/wii/"
@ -130,15 +133,19 @@ ln -sf /storage/roms/savestates/wii /storage/.config/dolphin-emu/StateSaves
#Wii Controller Profile #Wii Controller Profile
if [ "$CON" = "remote" ] if [ "$CON" = "remote" ]
then 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 fi
if [ "$CON" = "nunchuck" ] if [ "$CON" = "nunchuck" ]
then 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 fi
if [ "$CON" = "classic" ] if [ "$CON" = "classic" ]
then 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 fi
#Link .config/dolphin-emu to .local #Link .config/dolphin-emu to .local

View file

@ -52,6 +52,10 @@
<choice name="yes" value="true"/> <choice name="yes" value="true"/>
<choice name="no" value="false"/> <choice name="no" value="false"/>
</feature> </feature>
<feature name="gamecube controller profile">
<choice name="default" value="default"/>
<choice name="custom" value="custom"/>
</feature>
</features> </features>
</emulator> </emulator>
<emulator name="dolphinsa-wii"> <emulator name="dolphinsa-wii">
@ -89,6 +93,7 @@
<choice name="Wiimote" value="remote"/> <choice name="Wiimote" value="remote"/>
<choice name="Wiimote w/ Nunchuck" value="nunchuck"/> <choice name="Wiimote w/ Nunchuck" value="nunchuck"/>
<choice name="Classic Controller" value="classic"/> <choice name="Classic Controller" value="classic"/>
<choice name="custom" value="custom"/>
</feature> </feature>
</features> </features>
</emulator> </emulator>