Pandora Rebirth

移植PCSX ReARMed(支援振動功能)


移植部份:

diff -Naur old/frontend/pandora/ui_feat.h new/frontend/pandora/ui_feat.h
--- old/frontend/pandora/ui_feat.h	2019-10-20 00:33:53.808949576 -0400
+++ new/frontend/pandora/ui_feat.h	2019-10-19 07:11:26.000000000 -0400
@@ -7,7 +7,7 @@
 #define MENU_SHOW_VOUTMODE 0
 #define MENU_SHOW_SCALER2 0
 #define MENU_SHOW_NUBS_BTNS 1
-#define MENU_SHOW_VIBRATION 0
+#define MENU_SHOW_VIBRATION 1
 #define MENU_SHOW_DEADZONE 0
 #define MENU_SHOW_MINIMIZE 1
 #define MENU_SHOW_FULLSCREEN 0
diff -Naur old/frontend/plat_pandora.c new/frontend/plat_pandora.c
--- old/frontend/plat_pandora.c	2019-10-20 00:33:53.808949576 -0400
+++ new/frontend/plat_pandora.c	2019-10-19 12:11:55.000000000 -0400
@@ -6,6 +6,8 @@
  */
 
 #include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
 #include <linux/input.h>
 
 #include "libpicofe/input.h"
@@ -75,8 +77,16 @@
 	.kmap_size = sizeof(key_pbtn_map) / sizeof(key_pbtn_map[0]),
 };
 
+static int gpio_fd[2]={0};
+static const char* gpio_name[2]={
+  "/sys/class/gpio/gpio58/value", 
+  "/sys/class/gpio/gpio64/value"
+};
+
 int plat_init(void)
 {
+  int x;
+
 	plat_omap_init();
 	plat_target_init();
 
@@ -88,11 +98,22 @@
 	in_adev[1] = in_name_to_id("evdev:nub1");
 	in_adev_is_nublike[0] = in_adev_is_nublike[1] = 1;
 
+  for(x=0; x<2; x++){
+    gpio_fd[x] = open(gpio_name[x], O_RDWR);
+  }
 	return 0;
 }
 
 void plat_finish(void)
 {
+  int x;
+
+  for(x=0; x<2; x++){
+    if(gpio_fd[x] > 0){
+      close(gpio_fd[x]);
+      gpio_fd[x] = -1;
+    }
+  }
 	plat_omap_finish();
 	plat_target_finish();
 }
@@ -108,4 +129,17 @@
 
 void plat_trigger_vibrate(int pad, int low, int high)
 {
+  int x;
+
+  for(x=0; x<2; x++){
+    if(gpio_fd[x] > 0){
+      if(high > 0x80){
+        write(gpio_fd[x], "1", 1);
+      }
+      if(high == 0){
+        write(gpio_fd[x], "0", 1);
+      }
+    }
+  }
 }
+

Enable GPIO

$ sudo chmod 0777 /sys/class/gpio/export 
$ sudo chmod 0777 /sys/class/gpio/unexport
$ echo 58 > /sys/class/gpio/export 
$ echo 64 > /sys/class/gpio/export
$ sudo chmod 0777 /sys/class/gpio/gpio58/value
$ sudo chmod 0777 /sys/class/gpio/gpio64/value
$ sudo chmod 0777 /sys/class/gpio/gpio58/direction
$ sudo chmod 0777 /sys/class/gpio/gpio64/direction
$ echo "low" > /sys/class/gpio/gpio58/direction
$ echo "low" > /sys/class/gpio/gpio64/direction

進入PCSX ReARMed後,記得設定成類比搖桿以及啟動振動功能



完美


返回上一頁