Nokia N900 >> Sbox

移植pcsx rearmed 22


編譯PCSX ReARMed 22(在N900上編譯時,請先確認swap是否夠大):

$ cd
$ wget https://github.com/steward-fu/n900/releases/download/v1.1/pcsx_rearmed-22.7z
$ 7zr x pcsx_rearmed-22.7z
$ cd pcsx_rearmed-22
$ CFLAGS='-mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp' ./configure --enable-neon --sound-drivers=sdl --gpu=neon
$ make

移植步驟:

--- pcsx_rearmed-22/frontend/libpicofe/in_sdl.c
+++ pcsx_rearmed-22_n900/frontend/libpicofe/in_sdl.c
@@ -449,6 +449,7 @@
  }
  else
  {
+       
   for (i = 0; i < map_len; i++) {
    if (map[i].key == keycode) {
     ret = map[i].pbtn;
@@ -462,6 +463,13 @@
    ret |= PBTN_CHAR;
    *charcode = key_names[keycode][0];
   }
+ }
+
+ if(keycode == 271){
+   ret = PBTN_MOK;
+ }
+ if(keycode == 8){
+   ret = PBTN_MBACK;
  }
 
  return ret;
--- pcsx_rearmed-22/frontend/libpicofe/plat_sdl.c
+++ pcsx_rearmed-22_n900/frontend/libpicofe/plat_sdl.c
@@ -29,7 +29,11 @@
 
 static char vid_drv_name[32];
 static int window_w, window_h;
-static int fs_w, fs_h;
+// steward on 20160924
+// in order to change screen resolution in another subroutine, 
+// we remove the keyword of "static"
+int fs_w, fs_h;
+//
 static int old_fullscreen;
 static int vout_mode_overlay = -1, vout_mode_gl = -1;
 static void *display, *window;
@@ -283,7 +287,7 @@
     vout_list[i++] = "OpenGL";
   }
   plat_target.vout_methods = vout_list;
-
+  SDL_ShowCursor(SDL_DISABLE);
   return 0;
 
 fail:
--- pcsx_rearmed-22/frontend/main.c
+++ pcsx_rearmed-22_n900/frontend/main.c
@@ -508,6 +508,7 @@
  int loadst = 0;
  int i;
 
+ printf("PCSX ReARMed v22 recompiled for N900 on 20160924\n");
  emu_core_preinit();
 
  // read command line options
--- pcsx_rearmed-22/frontend/menu.c
+++ pcsx_rearmed-22_n900/frontend/menu.c
@@ -116,7 +116,7 @@
 
 #ifndef UI_FEATURES_H
 #define MENU_BIOS_PATH "bios/"
-#define MENU_SHOW_VARSCALER 0
+#define MENU_SHOW_VARSCALER 1
 #define MENU_SHOW_VOUTMODE 1
 #define MENU_SHOW_SCALER2 0
 #define MENU_SHOW_NUBS_BTNS 0
@@ -324,6 +324,24 @@
  spu_config.iVolume = 768 + 128 * volume_boost;
  pl_rearmed_cbs.frameskip = frameskip - 1;
  pl_timing_prepare(Config.PsxType);
+
+ // steward on 20160924
+ // extern variables for fullescreen resolution
+ extern int fs_h;
+ extern int fs_w;
+ int plat_sdl_change_video_mode(int, int, int);
+ // for n900, we only support 640x480 and 800x480 resolution
+ switch(g_scaler){
+  case 0: // 640x480
+   fs_w = 640;
+   fs_h = 480;
+   break;
+  case 1: // 800x480
+   fs_w = 800;
+   fs_h = 480;
+   break;
+ }
+ plat_sdl_change_video_mode(fs_w, fs_h, 1);
 }
 
 static void menu_set_defconfig(void)
@@ -331,7 +349,7 @@
  emu_set_default_config();
 
  g_opts = 0;
- g_scaler = SCALE_4_3;
+ g_scaler = SCALE_FULLSCREEN;
  g_gamma = 100;
  volume_boost = 0;
  frameskip = 0;
@@ -1229,9 +1247,13 @@
 }
 
 // ------------ gfx options menu ------------
-
+// steward on 20160924
+// for n900, we only support 640x480 and 800x480
+//static const char *men_scaler[] = {
+// "1x1", "integer scaled 2x", "scaled 4:3", "integer scaled 4:3", "fullscreen", "custom", NULL
+//};
 static const char *men_scaler[] = {
- "1x1", "integer scaled 2x", "scaled 4:3", "integer scaled 4:3", "fullscreen", "custom", NULL
+ "scaled 4:3", "fullscreen", "custom", NULL
 };
 static const char *men_soft_filter[] = { "None",
 #ifdef __ARM_NEON__
@@ -1239,8 +1261,10 @@
 #endif
  NULL };
 static const char *men_dummy[] = { NULL };
-static const char h_scaler[]    = "int. 2x  - scales w. or h. 2x if it fits on screen\n"
-      "int. 4:3 - uses integer if possible, else fractional";
+// steward on 20160924
+// replace display message
+//static const char h_scaler[]    = "int. 2x  - scales w. or h. 2x if it fits on screen\n"
+static const char h_scaler[]    = "Screen resolution\n";
 static const char h_cscaler[]   = "Displays the scaler layer, you can resize it\n"
       "using d-pad or move it using R+d-pad";
 static const char h_overlay[]   = "Overlay provides hardware accelerated scaling";
@@ -1317,12 +1341,28 @@
  mee_end,
 };
 
+extern int fs_h;
+extern int fs_w;
+int plat_sdl_change_video_mode(int, int, int);
 static int menu_loop_gfx_options(int id, int keys)
 {
  static int sel = 0;
 
  me_loop(e_menu_gfx_options, &sel);
-
+ // steward on 20160924
+ // after user change resolution selected from menu,
+ // we need to apply it right now
+ switch(g_scaler){
+  case 0: // 640x480
+   fs_w = 640;
+   fs_h = 480;
+   break;
+  case 1: // 800x480
+   fs_w = 800;
+   fs_h = 480;
+   break;
+ }
+ plat_sdl_change_video_mode(fs_w, fs_h, 1);
  return 0;
 }
 
@@ -2500,7 +2540,10 @@
   exit(1);
  }
 
- emu_make_path(buff, "skin/background.jpg", sizeof(buff));
+ // steward on 20160924
+ // we don't need prefix path(~/.picodriver/)
+ sprintf(buff, "skin/background.jpg");
+ //emu_make_path(buff, "skin/background.jpg", sizeof(buff));
  readpng(g_menubg_src_ptr, buff, READPNG_BG, g_menuscreen_w, g_menuscreen_h);
 
  i = plat_target.cpu_clock_set != NULL
--- pcsx_rearmed-22/frontend/plat_sdl.c
+++ pcsx_rearmed-22_n900/frontend/plat_sdl.c
@@ -25,30 +25,30 @@
 #include "revision.h"
 
 static const struct in_default_bind in_sdl_defbinds[] = {
-  { SDLK_UP,     IN_BINDTYPE_PLAYER12, DKEY_UP },
-  { SDLK_DOWN,   IN_BINDTYPE_PLAYER12, DKEY_DOWN },
-  { SDLK_LEFT,   IN_BINDTYPE_PLAYER12, DKEY_LEFT },
-  { SDLK_RIGHT,  IN_BINDTYPE_PLAYER12, DKEY_RIGHT },
-  { SDLK_d,      IN_BINDTYPE_PLAYER12, DKEY_TRIANGLE },
-  { SDLK_z,      IN_BINDTYPE_PLAYER12, DKEY_CROSS },
-  { SDLK_x,      IN_BINDTYPE_PLAYER12, DKEY_CIRCLE },
-  { SDLK_s,      IN_BINDTYPE_PLAYER12, DKEY_SQUARE },
-  { SDLK_v,      IN_BINDTYPE_PLAYER12, DKEY_START },
-  { SDLK_c,      IN_BINDTYPE_PLAYER12, DKEY_SELECT },
-  { SDLK_w,      IN_BINDTYPE_PLAYER12, DKEY_L1 },
-  { SDLK_r,      IN_BINDTYPE_PLAYER12, DKEY_R1 },
-  { SDLK_e,      IN_BINDTYPE_PLAYER12, DKEY_L2 },
-  { SDLK_t,      IN_BINDTYPE_PLAYER12, DKEY_R2 },
-  { SDLK_ESCAPE, IN_BINDTYPE_EMU, SACTION_ENTER_MENU },
-  { SDLK_F1,     IN_BINDTYPE_EMU, SACTION_SAVE_STATE },
-  { SDLK_F2,     IN_BINDTYPE_EMU, SACTION_LOAD_STATE },
+  { SDLK_w,      IN_BINDTYPE_PLAYER12, DKEY_UP },
+  { SDLK_s,      IN_BINDTYPE_PLAYER12, DKEY_DOWN },
+  { SDLK_a,      IN_BINDTYPE_PLAYER12, DKEY_LEFT },
+  { SDLK_d,      IN_BINDTYPE_PLAYER12, DKEY_RIGHT },
+  { SDLK_o,      IN_BINDTYPE_PLAYER12, DKEY_TRIANGLE },
+  { SDLK_PERIOD, IN_BINDTYPE_PLAYER12, DKEY_CROSS },
+  { SDLK_l,      IN_BINDTYPE_PLAYER12, DKEY_CIRCLE },
+  { SDLK_p,      IN_BINDTYPE_PLAYER12, DKEY_SQUARE },
+  { SDLK_SPACE,  IN_BINDTYPE_PLAYER12, DKEY_START },
+  { SDLK_m,      IN_BINDTYPE_PLAYER12, DKEY_SELECT },
+  { SDLK_q,      IN_BINDTYPE_PLAYER12, DKEY_L1 },
+  { SDLK_e,      IN_BINDTYPE_PLAYER12, DKEY_R1 },
+  { SDLK_z,      IN_BINDTYPE_PLAYER12, DKEY_L2 },
+  { SDLK_c,      IN_BINDTYPE_PLAYER12, DKEY_R2 },
+  { SDLK_v,      IN_BINDTYPE_EMU, SACTION_ENTER_MENU },
+  { SDLK_b,      IN_BINDTYPE_EMU, SACTION_SAVE_STATE },
+  { SDLK_n,      IN_BINDTYPE_EMU, SACTION_LOAD_STATE },
   { SDLK_F3,     IN_BINDTYPE_EMU, SACTION_PREV_SSLOT },
   { SDLK_F4,     IN_BINDTYPE_EMU, SACTION_NEXT_SSLOT },
   { SDLK_F5,     IN_BINDTYPE_EMU, SACTION_TOGGLE_FSKIP },
   { SDLK_F6,     IN_BINDTYPE_EMU, SACTION_SCREENSHOT },
   { SDLK_F7,     IN_BINDTYPE_EMU, SACTION_TOGGLE_FPS },
   { SDLK_F8,     IN_BINDTYPE_EMU, SACTION_SWITCH_DISPMODE },
-  { SDLK_F11,    IN_BINDTYPE_EMU, SACTION_TOGGLE_FULLSCREEN },
+  { SDLK_g,      IN_BINDTYPE_EMU, SACTION_TOGGLE_FULLSCREEN },
   { SDLK_BACKSPACE, IN_BINDTYPE_EMU, SACTION_FAST_FORWARD },
   { 0, 0, 0 }
 };
--- pcsx_rearmed-22/frontend/plugin_lib.c
+++ pcsx_rearmed-22_n900/frontend/plugin_lib.c
@@ -201,7 +201,9 @@
   mult = (float)g_layer_w / (float)g_layer_h;
   if (mult < 1.25f || mult > 1.666f)
    g_layer_w = 4.0f/3.0f * (float)g_layer_h;
-  printf("  -> %dx%d %.1f\n", g_layer_w, g_layer_h, mult);
+  // steward on 20160924
+  // in order speed up, we don't print anything to console
+  //printf("  -> %dx%d %.1f\n", g_layer_w, g_layer_h, mult);
   break;
 
  fractional_4_3:
@@ -211,7 +213,9 @@
    mult *= 2.0f;
   g_layer_w = mult * (float)g_menuscreen_h;
   g_layer_h = g_menuscreen_h;
-  printf("  -> %dx%d %.1f\n", g_layer_w, g_layer_h, mult);
+  // steward on 20160924
+  // in order speed up, we don't print anything to console
+  //printf("  -> %dx%d %.1f\n", g_layer_w, g_layer_h, mult);
   break;
 
  case SCALE_FULLSCREEN:
--- pcsx_rearmed-22/plugins/gpu_neon/psx_gpu/psx_gpu_main.c
+++ pcsx_rearmed-22_n900/plugins/gpu_neon/psx_gpu/psx_gpu_main.c
@@ -322,7 +322,6 @@
 #endif
 
   fflush(stdout);
-
   if(no_display == 0)
   {
     while(1)

按鍵說明

N900按鍵 說明
w Up
d Down
a Left
d Right
q L1
e R1
z L2
c R2
v Menu
g Fullscreen
b Save state
n Load state
m Select
space Start
o Triangle
p Square
. Cross
l Circle
Backspace Back
Enter Enter

原本


移植後


支援Scaled 4:3顯示


支援Fullscreen顯示


返回上一頁