Merge pull request #145391 from bb2020/gimx

authored by

Sandro and committed by
GitHub
5bea0fab 458a4081

+150 -59
+26
pkgs/games/gimx/conf.patch
··· 1 + diff --git a/core/config_reader.c b/core/config_reader.c 2 + index 451fc48..ed45f4d 100644 3 + --- a/core/config_reader.c 4 + +++ b/core/config_reader.c 5 + @@ -1355,7 +1355,7 @@ int read_config_file(const char* file) 6 + char file_path[PATH_MAX]; 7 + 8 + snprintf(file_path, sizeof(file_path), "%s%s%s%s", gimx_params.homedir, GIMX_DIR, CONFIG_DIR, file); 9 + - 10 + + if(getenv("GIMXCONF")) { snprintf(file_path, sizeof(file_path), "%s", file); } 11 + if(read_file(file_path) == -1) 12 + { 13 + gerror("read_file failed\n"); 14 + diff --git a/core/gimx.c b/core/gimx.c 15 + index 700cae9..9143d8b 100755 16 + --- a/core/gimx.c 17 + +++ b/core/gimx.c 18 + @@ -192,7 +192,7 @@ void show_config() 19 + char file_path[PATH_MAX]; 20 + 21 + snprintf(file_path, sizeof(file_path), "%s%s%s%s", gimx_params.homedir, GIMX_DIR, CONFIG_DIR, gimx_params.config_file); 22 + - 23 + + if(getenv("GIMXCONF")) { snprintf(file_path, sizeof(file_path), "%s", gimx_params.config_file); } 24 + FILE * fp = gfile_fopen(file_path, "r"); 25 + if (fp == NULL) 26 + {
+104
pkgs/games/gimx/custom/Dualshock4.xml
··· 1 + <?xml version="1.0" encoding="UTF-8"?> 2 + <root> 3 + <controller id="1" dpi="0" type="DS4"> 4 + <configuration id="1"> 5 + <trigger type="" id="" name="" button_id="" switch_back="no" delay="0"/> 6 + <mouse_options_list/> 7 + <intensity_list/> 8 + <button_map> 9 + <button id="abs_axis_10" label=""> 10 + <device type="joystick" id="0" name="Sony Computer Entertainment Wireless Controller"/> 11 + <event type="button" id="3"/> 12 + </button> 13 + <button id="abs_axis_9" label=""> 14 + <device type="joystick" id="0" name="Sony Computer Entertainment Wireless Controller"/> 15 + <event type="button" id="0"/> 16 + </button> 17 + <button id="abs_axis_8" label=""> 18 + <device type="joystick" id="0" name="Sony Computer Entertainment Wireless Controller"/> 19 + <event type="button" id="1"/> 20 + </button> 21 + <button id="abs_axis_7" label=""> 22 + <device type="joystick" id="0" name="Sony Computer Entertainment Wireless Controller"/> 23 + <event type="button" id="2"/> 24 + </button> 25 + <button id="abs_axis_11" label=""> 26 + <device type="joystick" id="0" name="Sony Computer Entertainment Wireless Controller"/> 27 + <event type="button" id="4"/> 28 + </button> 29 + <button id="abs_axis_12" label=""> 30 + <device type="joystick" id="0" name="Sony Computer Entertainment Wireless Controller"/> 31 + <event type="button" id="5"/> 32 + </button> 33 + <button id="abs_axis_0" label=""> 34 + <device type="joystick" id="0" name="Sony Computer Entertainment Wireless Controller"/> 35 + <event type="button" id="8"/> 36 + </button> 37 + <button id="abs_axis_1" label=""> 38 + <device type="joystick" id="0" name="Sony Computer Entertainment Wireless Controller"/> 39 + <event type="button" id="9"/> 40 + </button> 41 + <button id="abs_axis_15" label=""> 42 + <device type="joystick" id="0" name="Sony Computer Entertainment Wireless Controller"/> 43 + <event type="button" id="11"/> 44 + </button> 45 + <button id="abs_axis_16" label=""> 46 + <device type="joystick" id="0" name="Sony Computer Entertainment Wireless Controller"/> 47 + <event type="button" id="12"/> 48 + </button> 49 + <button id="abs_axis_2" label=""> 50 + <device type="joystick" id="0" name="Sony Computer Entertainment Wireless Controller"/> 51 + <event type="button" id="10"/> 52 + </button> 53 + <button id="abs_axis_3" label=""> 54 + <device type="joystick" id="0" name="Sony Computer Entertainment Wireless Controller"/> 55 + <event type="button" id="13"/> 56 + </button> 57 + <button id="abs_axis_4" label=""> 58 + <device type="joystick" id="0" name="Sony Computer Entertainment Wireless Controller"/> 59 + <event type="button" id="14"/> 60 + </button> 61 + <button id="abs_axis_5" label=""> 62 + <device type="joystick" id="0" name="Sony Computer Entertainment Wireless Controller"/> 63 + <event type="button" id="15"/> 64 + </button> 65 + <button id="abs_axis_6" label=""> 66 + <device type="joystick" id="0" name="Sony Computer Entertainment Wireless Controller"/> 67 + <event type="button" id="16"/> 68 + </button> 69 + </button_map> 70 + <axis_map> 71 + <axis id="rel_axis_0" label=""> 72 + <device type="joystick" id="0" name="Sony Computer Entertainment Wireless Controller"/> 73 + <event type="axis" id="0" dead_zone="0" multiplier="0.004" exponent="1.00" shape=""/> 74 + </axis> 75 + <axis id="rel_axis_1" label=""> 76 + <device type="joystick" id="0" name="Sony Computer Entertainment Wireless Controller"/> 77 + <event type="axis" id="1" dead_zone="0" multiplier="0.004" exponent="1.00" shape=""/> 78 + </axis> 79 + <axis id="rel_axis_2" label=""> 80 + <device type="joystick" id="0" name="Sony Computer Entertainment Wireless Controller"/> 81 + <event type="axis" id="3" dead_zone="0" multiplier="0.004" exponent="1.00" shape=""/> 82 + </axis> 83 + <axis id="rel_axis_3" label=""> 84 + <device type="joystick" id="0" name="Sony Computer Entertainment Wireless Controller"/> 85 + <event type="axis" id="4" dead_zone="0" multiplier="0.004" exponent="1.00" shape=""/> 86 + </axis> 87 + <axis id="abs_axis_13" label=""> 88 + <device type="joystick" id="0" name="Sony Computer Entertainment Wireless Controller"/> 89 + <event type="axis" id="2" dead_zone="0" multiplier="0.008" exponent="1.00" shape=""/> 90 + </axis> 91 + <axis id="abs_axis_14" label=""> 92 + <device type="joystick" id="0" name="Sony Computer Entertainment Wireless Controller"/> 93 + <event type="axis" id="5" dead_zone="0" multiplier="0.008" exponent="1.00" shape=""/> 94 + </axis> 95 + </axis_map> 96 + <joystick_corrections_list/> 97 + <force_feedback> 98 + <device type="joystick" id="0" name="Sony Computer Entertainment Wireless Controller"/> 99 + <inversion enable="no"/> 100 + <gain rumble="0" constant="0" spring="0" damper="0"/> 101 + </force_feedback> 102 + </configuration> 103 + </controller> 104 + </root>
+20 -14
pkgs/games/gimx/default.nix
··· 1 1 { stdenv, lib, fetchFromGitHub, makeWrapper, curl, libusb1, xorg, libxml2 2 - , ncurses5, bluez, libmhash, gimxAuth ? "" }: 2 + , ncurses5, bluez, libmhash, gimxPDP ? false }: 3 3 4 4 let 5 5 gimx-config = fetchFromGitHub { ··· 21 21 sha256 = "0265gg6q7ymg76fb4pjrfdwjd280b3zzry96qy92w0h411slph85"; 22 22 }; 23 23 24 + patches = [ ./conf.patch ]; 24 25 nativeBuildInputs = [ makeWrapper ]; 25 26 buildInputs = [ 26 27 curl libusb1 bluez libxml2 ncurses5 libmhash 27 28 xorg.libX11 xorg.libXi xorg.libXext 28 29 ]; 29 30 30 - patches = [ ./env.patch ]; 31 - prePatch = (if gimxAuth == "afterglow" then (import ./variant.nix).afterglow 32 - else ""); 31 + postPatch = lib.optionals gimxPDP '' 32 + substituteInPlace ./shared/gimxcontroller/include/x360.h \ 33 + --replace "0x045e" "0x0e6f" --replace "0x028e" "0x0213" 34 + substituteInPlace ./loader/firmware/EMU360.hex \ 35 + --replace "1B210001" "1B211001" \ 36 + --replace "09210001" "09211001" \ 37 + --replace "5E048E021001" "6F0E13020001" 38 + ''; 33 39 34 40 makeFlags = "build-core"; 35 41 installPhase = '' ··· 51 57 mkdir -p $out/share 52 58 cp -r ./loader/firmware $out/share/firmware 53 59 cp -r ${gimx-config}/Linux $out/share/config 60 + cp -r ${./custom} $out/share/custom 54 61 55 - makeWrapper $out/bin/gimx $out/bin/gimx-with-confs \ 56 - --set GIMXCONF $out/share/config 62 + makeWrapper $out/bin/gimx $out/bin/gimx-dualshock4 \ 63 + --set GIMXCONF 1 --add-flags "--nograb" --add-flags "-p /dev/ttyUSB0" \ 64 + --add-flags "-c $out/share/config/Dualshock4.xml" 57 65 58 - makeWrapper $out/bin/gimx $out/bin/gimx-test-ds4 \ 59 - --set GIMXCONF $out/share/config \ 60 - --add-flags "--nograb" --add-flags "--curses" \ 61 - --add-flags "-p /dev/ttyUSB0" --add-flags "-c Dualshock4.xml" 66 + makeWrapper $out/bin/gimx $out/bin/gimx-dualshock4-noff \ 67 + --set GIMXCONF 1 --add-flags "--nograb" --add-flags "-p /dev/ttyUSB0" \ 68 + --add-flags "-c $out/share/custom/Dualshock4.xml" 62 69 63 - makeWrapper $out/bin/gimx $out/bin/gimx-test-xone \ 64 - --set GIMXCONF $out/share/config \ 65 - --add-flags "--nograb" --add-flags "--curses" \ 66 - --add-flags "-p /dev/ttyUSB0" --add-flags "-c XOnePadUsb.xml" 70 + makeWrapper $out/bin/gimx $out/bin/gimx-xboxonepad \ 71 + --set GIMXCONF 1 --add-flags "--nograb" --add-flags "-p /dev/ttyUSB0" \ 72 + --add-flags "-c $out/share/config/XOnePadUsb.xml" 67 73 ''; 68 74 69 75 meta = with lib; {
-30
pkgs/games/gimx/env.patch
··· 1 - --- a/core/config_reader.c 2 - +++ b/core/config_reader.c 3 - @@ -1353,8 +1353,10 @@ static int read_file(char* file_path) 4 - int read_config_file(const char* file) 5 - { 6 - char file_path[PATH_MAX]; 7 - - 8 - - snprintf(file_path, sizeof(file_path), "%s%s%s%s", gimx_params.homedir, GIMX_DIR, CONFIG_DIR, file); 9 - + char* e = getenv("GIMXCONF"); if (e) { snprintf(file_path, sizeof(file_path), "%s/%s", e, file); } 10 - + else { 11 - + snprintf(file_path, sizeof(file_path), "%s%s%s%s", gimx_params.homedir, GIMX_DIR, CONFIG_DIR, file); 12 - + } 13 - 14 - if(read_file(file_path) == -1) 15 - { 16 - --- a/core/gimx.c 17 - +++ b/core/gimx.c 18 - @@ -190,8 +190,10 @@ void show_config() 19 - } 20 - 21 - char file_path[PATH_MAX]; 22 - - 23 - - snprintf(file_path, sizeof(file_path), "%s%s%s%s", gimx_params.homedir, GIMX_DIR, CONFIG_DIR, gimx_params.config_file); 24 - + char* e = getenv("GIMXCONF"); if (e) { snprintf(file_path, sizeof(file_path), "%s/%s", e, gimx_params.config_file); } 25 - + else { 26 - + snprintf(file_path, sizeof(file_path), "%s%s%s%s", gimx_params.homedir, GIMX_DIR, CONFIG_DIR, gimx_params.config_file); 27 - + } 28 - 29 - FILE * fp = gfile_fopen(file_path, "r"); 30 - if (fp == NULL)
-14
pkgs/games/gimx/variant.nix
··· 1 - { 2 - afterglow = '' 3 - substituteInPlace ./shared/gimxcontroller/include/x360.h \ 4 - --replace "0x045e" "0x0e6f" --replace "0x028e" "0x0213" 5 - 6 - HEX="./loader/firmware/EMU360.hex" 7 - sed -i '34s|1B2100|1B2110|' "$HEX" 8 - sed -i '38s|092100|092110|' "$HEX" 9 - sed -i '40s|5E048E021001|6F0E13020001|' "$HEX" 10 - sed -i '34s|1C\r|0C\r|' "$HEX" 11 - sed -i '38s|FE\r|EE\r|' "$HEX" 12 - sed -i '40s|6D\r|DD\r|' "$HEX" 13 - ''; 14 - }
-1
pkgs/top-level/all-packages.nix
··· 30176 30176 gemrb = callPackage ../games/gemrb { }; 30177 30177 30178 30178 gimx = callPackage ../games/gimx {}; 30179 - gimx-afterglow = lowPrio (gimx.override { gimxAuth = "afterglow"; }); 30180 30179 30181 30180 gl117 = callPackage ../games/gl-117 {}; 30182 30181