Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit
Swift apple-silicond3dmetaldxmtdxvkgame-porting-toolkitgptkmac-gamingmacosmetalfxrosetta-2steamsteam-playwinewinecx
fix(winecx): GameSir G7 Pro over Bluetooth reaches games
raymondchins63a9c909c6c8
diff --git a/app/Sources/NotProtonApp/Model/FreeEngineWinecx.swift b/app/Sources/NotProtonApp/Model/FreeEngineWinecx.swiftindex faf657a..650c6cb 100644--- a/app/Sources/NotProtonApp/Model/FreeEngineWinecx.swift+++ b/app/Sources/NotProtonApp/Model/FreeEngineWinecx.swift@@ -98,13 +98,14 @@ enum FreeEngineWinecx {],macDriver: "76d8f93839386f37e8badf0c82bb31b5ead22ac580f17896f9d2a729af0fc147",// winebus.so: winecx 5b45f45 built with SONAME_LIBSDL2 (docs/WINECX.md). libSDL2:- // SDL 2.32.8 (zlib license, NOTICE), the WineHQ engine runner's copy signed ad hoc,- // since a release build strips unsigned Mach-O resources and would break the pin.+ // SDL 2.32.8 (zlib license, NOTICE) built x86_64 with winemac-patch/sdl2-iokit-gamepad-collection.patch+ // (pads whose gamepad is a secondary HID collection, e.g. GameSir G7 Pro over Bluetooth),+ // signed ad hoc, since a release build strips unsigned Mach-O resources and would break the pin.gamepad: [WinecxBundledFile(resource: "winebus-winecx-11.15", ext: "so", path: "lib/wine/x86_64-unix/winebus.so",sha256: "1bc53184f5d026ab84a26cf6ef721348fc3b028c019ff969e69eb6cf9b9d1af9"),WinecxBundledFile(resource: "libSDL2-2.0.0", ext: "dylib", path: "lib/libSDL2-2.0.0.dylib",- sha256: "605724f463875e945ca4a79a1db7bf35384d912fa5387f3042a27a42e878db19"),+ sha256: "28ca23a44bb24b4bb42fe84902788ca866ac824c7b83ea2ca28aebc6640f344d"),])diff --git a/app/Sources/NotProtonApp/Resources/libSDL2-2.0.0.dylib b/app/Sources/NotProtonApp/Resources/libSDL2-2.0.0.dylibindex 914827a..fb15032 100755Binary files a/app/Sources/NotProtonApp/Resources/libSDL2-2.0.0.dylib and b/app/Sources/NotProtonApp/Resources/libSDL2-2.0.0.dylib differdiff --git a/docs/STATE.md b/docs/STATE.mdindex c27af90..a35e27a 100644--- a/docs/STATE.md+++ b/docs/STATE.md@@ -8,6 +8,7 @@ Branch `integrate` = working fork state; nothing pushed except the `dxmt-e94c312- Xbox controllers: SDL-enabled winebus (9a0cbf5). Do NOT set winebus `Hidraw=1` for pads; it bypasses SDL.- Controllers need no per-game Input Monitoring grant: the run script starts the launcher bundle directly instead of via `open`, so TCC attributes HID access to Steam (verified: all `kTCCServiceListenEvent` requests from Horizon `responsible=com.valvesoftware.steam`, authValue=2). `NOTPROTON_LAUNCH_SERVICES=1` restores the old `open` launch.- Pads SDL doesn't know: `~/Library/Application Support/notproton/gamecontrollerdb.txt` is exported as `SDL_GAMECONTROLLERCONFIG`. GameSir G7 Pro dongle (3537:1022) mapping lives there; SDL IOKit axis order is X,Y,Z,Rz,Accel,Brake (browser Gamepad API numbers them differently). Never use the winebus registry `map` key: its loader (main.c:1101, writes `mappings[count]` after `count++`) crashes winebus and kills every pad.+- Bluetooth GameSir G7 Pro: its primary HID usage is Consumer, so stock SDL skips it; bundled libSDL2 carries winemac-patch/sdl2-iokit-gamepad-collection.patch, and the run script exports SDL_JOYSTICK_MFI=0 (SDL's MFi driver claims the pad but finds nothing in winedevice.exe). Verified 2026-10-11: winebus `sdl_add_device … is_gamepad 1`, user confirmed input in Megabonk.- Many games need `ROSETTA_ADVERTISE_AVX=1` (set in user gamefixes/default.conf and per-game Steam launch options).## Blockers / opendiff --git a/dylib/feats/compat_run.sh b/dylib/feats/compat_run.shindex ff7ec69..6d585cb 100755--- a/dylib/feats/compat_run.sh+++ b/dylib/feats/compat_run.sh@@ -158,6 +158,12 @@ if [ "${NOTPROTON_RAW_CONTROLLERS:-1}" = "1" ]; thenexport NOTPROTON_RAW_CONTROLLERS SDL_GAMECONTROLLER_IGNORE_DEVICESfi+# SDL hands pads that macOS GameController.framework knows (GameSir G7 Pro over Bluetooth)+# to its MFi driver, which finds nothing outside an app run loop such as winedevice.exe's,+# so the pad never reached Wine. IOKit reads them instead.+SDL_JOYSTICK_MFI=0+export SDL_JOYSTICK_MFI+pad_db="$HOME/Library/Application Support/notproton/gamecontrollerdb.txt"if [ -f "$pad_db" ]; thenpad_maps=$(sed -e '/^[[:space:]]*#/d' -e '/^[[:space:]]*$/d' "$pad_db")@@ -1980,7 +1986,7 @@ elseecho "=== client staged no overlay renderer, overlay disabled ===" >> "$log" 2>&1 || truefiset -- --args "$shim_exe" "$@"-for name in $(env | sed -nE 's/^(CX_APPLEGPTK_LIBD3DSHARED_PATH|SDL_GAMECONTROLLERCONFIG|WINE_LARGE_ADDRESS_AWARE|WINE_CPU_TOPOLOGY|Steam[A-Za-z0-9]*|(CX_GRAPHICS|D3DM_|DXMT_|DXVK_|MVK_|VKD3D_|STAGING_|MTL_|ROSETTA_)[A-Z0-9_]*)=.*/\1/p'); do+for name in $(env | sed -nE 's/^(CX_APPLEGPTK_LIBD3DSHARED_PATH|SDL_GAMECONTROLLERCONFIG|SDL_JOYSTICK_MFI|WINE_LARGE_ADDRESS_AWARE|WINE_CPU_TOPOLOGY|Steam[A-Za-z0-9]*|(CX_GRAPHICS|D3DM_|DXMT_|DXVK_|MVK_|VKD3D_|STAGING_|MTL_|ROSETTA_)[A-Z0-9_]*)=.*/\1/p'); doeval "value=\$$name"# shellcheck disable=SC2154 # eval assigns value on the line aboveset -- --env "$name=$value" "$@"diff --git a/dylib/version.h b/dylib/version.hindex 8eecd95..ed864cc 100644--- a/dylib/version.h+++ b/dylib/version.h@@ -2,6 +2,6 @@#ifndef NOTPROTON_VERSION_H#define NOTPROTON_VERSION_H-#define NOTPROTON_VERSION "1.1.4-winehq.1-ray.3"+#define NOTPROTON_VERSION "1.1.4-winehq.1-ray.4"#endif // NOTPROTON_VERSION_Hdiff --git a/winemac-patch/sdl2-iokit-gamepad-collection.patch b/winemac-patch/sdl2-iokit-gamepad-collection.patchnew file mode 100644index 0000000..08e785e--- /dev/null+++ b/winemac-patch/sdl2-iokit-gamepad-collection.patch@@ -0,0 +1,93 @@+--- /private/tmp/claude-501/sdlbuild/SDL2-2.32.8/src/joystick/darwin/SDL_iokitjoystick.c.orig 2026-10-10 23:49:11++++ /private/tmp/claude-501/sdlbuild/SDL2-2.32.8/src/joystick/darwin/SDL_iokitjoystick.c 2026-10-10 23:49:11+@@ -264,6 +264,28 @@+ return SDL_FALSE;+ }+++static SDL_bool IsGamepadUsage(uint32_t page, uint32_t usage)++{++ return page == kHIDPage_GenericDesktop &&++ (usage == kHIDUsage_GD_Joystick || usage == kHIDUsage_GD_GamePad ||++ usage == kHIDUsage_GD_MultiAxisController);++}++++/* Some pads (GameSir G7 Pro over Bluetooth) list a consumer-control collection first,++ so the device's primary usage is not a gamepad even though one of its top-level++ collections is. Keep only the elements under that gamepad collection. */++static SDL_bool InGamepadCollection(IOHIDElementRef element)++{++ while (element) {++ if (IOHIDElementGetType(element) == kIOHIDElementTypeCollection &&++ IOHIDElementGetCollectionType(element) == kIOHIDElementCollectionTypeApplication) {++ return IsGamepadUsage(IOHIDElementGetUsagePage(element), IOHIDElementGetUsage(element));++ }++ element = IOHIDElementGetParent(element);++ }++ return SDL_FALSE;++}+++ /* See if we care about this HID element, and if so, note it in our recDevice. */+ static void AddHIDElement(const void *value, void *parameter)+ {+@@ -271,7 +293,8 @@+ IOHIDElementRef refElement = (IOHIDElementRef)value;+ const CFTypeID elementTypeID = refElement ? CFGetTypeID(refElement) : 0;++- if (refElement && (elementTypeID == IOHIDElementGetTypeID())) {++ if (refElement && (elementTypeID == IOHIDElementGetTypeID()) &&++ (!pDevice->gamepadCollectionOnly || InGamepadCollection(refElement))) {+ const IOHIDElementCookie cookie = IOHIDElementGetCookie(refElement);+ const uint32_t usagePage = IOHIDElementGetUsagePage(refElement);+ const uint32_t usage = IOHIDElementGetUsage(refElement);+@@ -436,19 +459,33 @@+ if (refCF) {+ CFNumberGetValue(refCF, kCFNumberSInt32Type, &pDevice->usagePage);+ }+- if (pDevice->usagePage != kHIDPage_GenericDesktop) {+- return SDL_FALSE; /* Filter device list to non-keyboard/mouse stuff */+- }+-+ refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDPrimaryUsageKey));+ if (refCF) {+ CFNumberGetValue(refCF, kCFNumberSInt32Type, &pDevice->usage);+ }++- if ((pDevice->usage != kHIDUsage_GD_Joystick &&+- pDevice->usage != kHIDUsage_GD_GamePad &&+- pDevice->usage != kHIDUsage_GD_MultiAxisController)) {+- return SDL_FALSE; /* Filter device list to non-keyboard/mouse stuff */++ if (!IsGamepadUsage(pDevice->usagePage, pDevice->usage)) {++ CFArrayRef pairs = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDDeviceUsagePairsKey));++ CFIndex i, count = (pairs && CFGetTypeID(pairs) == CFArrayGetTypeID()) ? CFArrayGetCount(pairs) : 0;++++ for (i = 0; i < count && !pDevice->gamepadCollectionOnly; i++) {++ CFDictionaryRef pair = CFArrayGetValueAtIndex(pairs, i);++ CFNumberRef pageRef = CFDictionaryGetValue(pair, CFSTR(kIOHIDDeviceUsagePageKey));++ CFNumberRef usageRef = CFDictionaryGetValue(pair, CFSTR(kIOHIDDeviceUsageKey));++ uint32_t page = 0, usage = 0;++++ if (pageRef && usageRef &&++ CFNumberGetValue(pageRef, kCFNumberSInt32Type, &page) &&++ CFNumberGetValue(usageRef, kCFNumberSInt32Type, &usage) &&++ IsGamepadUsage(page, usage)) {++ pDevice->usagePage = page;++ pDevice->usage = usage;++ pDevice->gamepadCollectionOnly = SDL_TRUE;++ }++ }++ if (!pDevice->gamepadCollectionOnly) {++ return SDL_FALSE; /* Filter device list to non-keyboard/mouse stuff */++ }+ }++ /* Make sure we retain the use of the IOKit-provided device-object,+--- /private/tmp/claude-501/sdlbuild/SDL2-2.32.8/src/joystick/darwin/SDL_iokitjoystick_c.h.orig 2026-10-10 23:49:11++++ /private/tmp/claude-501/sdlbuild/SDL2-2.32.8/src/joystick/darwin/SDL_iokitjoystick_c.h 2026-10-10 23:49:11+@@ -73,6 +73,7 @@+ SDL_JoystickGUID guid;+ int steam_virtual_gamepad_slot;+++ SDL_bool gamepadCollectionOnly; /* gamepad is a secondary top-level collection */+ struct joystick_hwdata *pNext; /* next device */+ };+ typedef struct joystick_hwdata recDevice;