extracted OSS code to sndout_oss_*, BTN->PBTN, refactoring
authornotaz <notasas@gmail.com>
Fri, 17 Oct 2008 15:29:37 +0000 (15:29 +0000)
committernotaz <notasas@gmail.com>
Fri, 17 Oct 2008 15:29:37 +0000 (15:29 +0000)
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@599 be3aeb3a-fb24-0410-a615-afba39da0efa

25 files changed:
platform/common/common.h
platform/common/menu.c
platform/gizmondo/emu.c
platform/gizmondo/giz.h
platform/gizmondo/menu.c
platform/gizmondo/menu.h
platform/gp2x/Makefile
platform/gp2x/emu.c
platform/gp2x/gp2x.c
platform/gp2x/gp2x.h
platform/gp2x/menu.c
platform/linux/Makefile
platform/linux/gp2x.c
platform/linux/sndout_oss.c [new file with mode: 0644]
platform/linux/sndout_oss.h [new file with mode: 0644]
platform/linux/usbjoy.c [moved from platform/gp2x/usbjoy.c with 88% similarity]
platform/linux/usbjoy.h [moved from platform/gp2x/usbjoy.h with 96% similarity]
platform/pandora/Makefile
platform/pandora/emu.c
platform/pandora/pandora.c
platform/psp/emu.c
platform/psp/menu.c
platform/psp/menu.h
platform/psp/psp.c
platform/psp/psp.h

index 4945f5e..0b7a20f 100644 (file)
@@ -3,17 +3,17 @@
 #ifdef __GP2X__
 #include "../gp2x/gp2x.h"
 
-#define BTN_UP    GP2X_UP
-#define BTN_DOWN  GP2X_DOWN
-#define BTN_LEFT  GP2X_LEFT
-#define BTN_RIGHT GP2X_RIGHT
-
-#define BTN_NORTH GP2X_Y
-#define BTN_SOUTH GP2X_X
-#define BTN_WEST  GP2X_A
-#define BTN_EAST  GP2X_B
-#define BTN_L     GP2X_L
-#define BTN_R     GP2X_R
+#define PBTN_UP    GP2X_UP
+#define PBTN_DOWN  GP2X_DOWN
+#define PBTN_LEFT  GP2X_LEFT
+#define PBTN_RIGHT GP2X_RIGHT
+
+#define PBTN_NORTH GP2X_Y
+#define PBTN_SOUTH GP2X_X
+#define PBTN_WEST  GP2X_A
+#define PBTN_EAST  GP2X_B
+#define PBTN_L     GP2X_L
+#define PBTN_R     GP2X_R
 
 unsigned long wait_for_input(unsigned long interesting);
 void gp2x_pd_clone_buffer2(void);
@@ -43,10 +43,10 @@ void menu_flip(void);
 
 #include "../gizmondo/giz.h"
 
-#define BTN_NORTH BTN_STOP
-#define BTN_SOUTH BTN_PLAY
-#define BTN_WEST  BTN_REW
-#define BTN_EAST  BTN_FWD
+#define PBTN_NORTH PBTN_STOP
+#define PBTN_SOUTH PBTN_PLAY
+#define PBTN_WEST  PBTN_REW
+#define PBTN_EAST  PBTN_FWD
 
 unsigned long wait_for_input(unsigned int interesting);
 void menu_draw_begin(int use_bgbuff);
@@ -75,10 +75,10 @@ extern void *giz_screen;
 
 #include "../psp/psp.h"
 
-#define BTN_NORTH BTN_TRIANGLE
-#define BTN_SOUTH BTN_X
-#define BTN_WEST  BTN_SQUARE
-#define BTN_EAST  BTN_CIRCLE
+#define PBTN_NORTH PBTN_TRIANGLE
+#define PBTN_SOUTH PBTN_X
+#define PBTN_WEST  PBTN_SQUARE
+#define PBTN_EAST  PBTN_CIRCLE
 
 unsigned long wait_for_input(unsigned int interesting, int is_key_config);
 void menu_draw_begin(void);
@@ -106,17 +106,17 @@ void menu_draw_end(void);
 
 #include "../gp2x/gp2x.h"
 
-#define BTN_UP    0
-#define BTN_DOWN  0
-#define BTN_LEFT  0
-#define BTN_RIGHT 0
-
-#define BTN_NORTH 0
-#define BTN_SOUTH 0
-#define BTN_WEST  0
-#define BTN_EAST  0
-#define BTN_L     0
-#define BTN_R     0
+#define PBTN_UP    0
+#define PBTN_DOWN  0
+#define PBTN_LEFT  0
+#define PBTN_RIGHT 0
+
+#define PBTN_NORTH 0
+#define PBTN_SOUTH 0
+#define PBTN_WEST  0
+#define PBTN_EAST  0
+#define PBTN_L     0
+#define PBTN_R     0
 
 unsigned long wait_for_input(unsigned long interesting);
 void gp2x_pd_clone_buffer2(void);
index 241af9f..611cee9 100644 (file)
@@ -350,7 +350,7 @@ static void mplayer_loop(void)
        while (1)\r
        {\r
                PDebugZ80Frame();\r
-               if (read_buttons_async(BTN_NORTH)) break;\r
+               if (read_buttons_async(PBTN_NORTH)) break;\r
                emu_waitSound();\r
        }\r
 \r
@@ -429,41 +429,41 @@ void debug_menu_loop(void)
                }\r
                menu_draw_end();\r
 \r
-               inp = read_buttons(BTN_EAST|BTN_SOUTH|BTN_WEST|BTN_NORTH|BTN_L|BTN_R|BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT);\r
-               if (inp & BTN_SOUTH) return;\r
-               if (inp & BTN_L) { mode--; if (mode < 0) mode = 3; }\r
-               if (inp & BTN_R) { mode++; if (mode > 3) mode = 0; }\r
+               inp = read_buttons(PBTN_EAST|PBTN_SOUTH|PBTN_WEST|PBTN_NORTH|PBTN_L|PBTN_R|PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT);\r
+               if (inp & PBTN_SOUTH) return;\r
+               if (inp & PBTN_L) { mode--; if (mode < 0) mode = 3; }\r
+               if (inp & PBTN_R) { mode++; if (mode > 3) mode = 0; }\r
                switch (mode)\r
                {\r
                        case 0:\r
-                               if (inp & BTN_EAST) SekStepM68k();\r
-                               if (inp & BTN_NORTH) {\r
-                                       while (inp & BTN_NORTH) inp = read_buttons_async(BTN_NORTH);\r
+                               if (inp & PBTN_EAST) SekStepM68k();\r
+                               if (inp & PBTN_NORTH) {\r
+                                       while (inp & PBTN_NORTH) inp = read_buttons_async(PBTN_NORTH);\r
                                        mplayer_loop();\r
                                }\r
-                               if ((inp & (BTN_WEST|BTN_LEFT)) == (BTN_WEST|BTN_LEFT)) {\r
+                               if ((inp & (PBTN_WEST|PBTN_LEFT)) == (PBTN_WEST|PBTN_LEFT)) {\r
                                        mkdir("dumps", 0777);\r
                                        PDebugDumpMem();\r
-                                       while (inp & BTN_WEST) inp = read_buttons_async(BTN_WEST);\r
+                                       while (inp & PBTN_WEST) inp = read_buttons_async(PBTN_WEST);\r
                                        dumped = 1;\r
                                }\r
                                break;\r
                        case 1:\r
-                               if (inp & BTN_LEFT)  PicoDrawMask ^= PDRAW_LAYERB_ON;\r
-                               if (inp & BTN_RIGHT) PicoDrawMask ^= PDRAW_LAYERA_ON;\r
-                               if (inp & BTN_DOWN)  PicoDrawMask ^= PDRAW_SPRITES_LOW_ON;\r
-                               if (inp & BTN_UP)    PicoDrawMask ^= PDRAW_SPRITES_HI_ON;\r
-                               if (inp & BTN_EAST) {\r
+                               if (inp & PBTN_LEFT)  PicoDrawMask ^= PDRAW_LAYERB_ON;\r
+                               if (inp & PBTN_RIGHT) PicoDrawMask ^= PDRAW_LAYERA_ON;\r
+                               if (inp & PBTN_DOWN)  PicoDrawMask ^= PDRAW_SPRITES_LOW_ON;\r
+                               if (inp & PBTN_UP)    PicoDrawMask ^= PDRAW_SPRITES_HI_ON;\r
+                               if (inp & PBTN_EAST) {\r
                                        PsndOut = NULL; // just in case\r
                                        PicoSkipFrame = 1;\r
                                        PicoFrame();\r
                                        PicoSkipFrame = 0;\r
-                                       while (inp & BTN_EAST) inp = read_buttons_async(BTN_EAST);\r
+                                       while (inp & PBTN_EAST) inp = read_buttons_async(PBTN_EAST);\r
                                }\r
                                break;\r
                        case 3:\r
-                               if (inp & BTN_DOWN)  spr_offs++;\r
-                               if (inp & BTN_UP)    spr_offs--;\r
+                               if (inp & PBTN_DOWN)  spr_offs++;\r
+                               if (inp & PBTN_UP)    spr_offs--;\r
                                if (spr_offs < 0) spr_offs = 0;\r
                                break;\r
                }\r
index 9f08f06..5469c56 100644 (file)
@@ -390,10 +390,10 @@ static void RunEvents(unsigned int which)
                {
                        int keys;
                        blit("", (which & 0x1000) ? "LOAD STATE? (PLAY=yes, STOP=no)" : "OVERWRITE SAVE? (PLAY=yes, STOP=no)");
-                       while( !((keys = Framework_PollGetButtons()) & (BTN_PLAY|BTN_STOP)) )
+                       while( !((keys = Framework_PollGetButtons()) & (PBTN_PLAY|PBTN_STOP)) )
                                Sleep(50);
-                       if (keys & BTN_STOP) do_it = 0;
-                       while(  ((keys = Framework_PollGetButtons()) & (BTN_PLAY|BTN_STOP)) ) // wait for release
+                       if (keys & PBTN_STOP) do_it = 0;
+                       while(  ((keys = Framework_PollGetButtons()) & (PBTN_PLAY|PBTN_STOP)) ) // wait for release
                                Sleep(50);
                        clearArea(0);
                }
@@ -449,7 +449,7 @@ static void updateKeys(void)
        int i;
 
        keys = Framework_PollGetButtons();
-       if (keys & BTN_HOME)
+       if (keys & PBTN_HOME)
                engineState = PGS_Menu;
 
        keys &= CONFIGURABLE_KEYS;
index 54fba15..2083fc8 100644 (file)
@@ -43,20 +43,20 @@ enum FRAMEWORK_BUTTONTYPES
 };
 #endif
 
-#define BTN_LEFT  (1 << FRAMEWORK_BUTTON_DPAD_LEFT)
-#define BTN_RIGHT (1 << FRAMEWORK_BUTTON_DPAD_RIGHT)
-#define BTN_UP    (1 << FRAMEWORK_BUTTON_DPAD_UP)
-#define BTN_DOWN  (1 << FRAMEWORK_BUTTON_DPAD_DOWN)
-#define BTN_STOP  (1 << FRAMEWORK_BUTTON_STOP)
-#define BTN_PLAY  (1 << FRAMEWORK_BUTTON_PLAY)
-#define BTN_FWD   (1 << FRAMEWORK_BUTTON_FORWARD)
-#define BTN_REW   (1 << FRAMEWORK_BUTTON_REWIND)
-#define BTN_L     (1 << FRAMEWORK_BUTTON_LEFT_SHOULDER)
-#define BTN_R     (1 << FRAMEWORK_BUTTON_RIGHT_SHOULDER)
-
-#define BTN_HOME       (1 << FRAMEWORK_BUTTON_HOME)
-#define BTN_VOLUME     (1 << FRAMEWORK_BUTTON_VOLUME)
-#define BTN_BRIGHTNESS (1 << FRAMEWORK_BUTTON_BRIGHTNESS)
-#define BTN_ALARM      (1 << FRAMEWORK_BUTTON_ALARM)
-#define BTN_POWER      (1 << FRAMEWORK_BUTTON_POWER)
+#define PBTN_LEFT  (1 << FRAMEWORK_BUTTON_DPAD_LEFT)
+#define PBTN_RIGHT (1 << FRAMEWORK_BUTTON_DPAD_RIGHT)
+#define PBTN_UP    (1 << FRAMEWORK_BUTTON_DPAD_UP)
+#define PBTN_DOWN  (1 << FRAMEWORK_BUTTON_DPAD_DOWN)
+#define PBTN_STOP  (1 << FRAMEWORK_BUTTON_STOP)
+#define PBTN_PLAY  (1 << FRAMEWORK_BUTTON_PLAY)
+#define PBTN_FWD   (1 << FRAMEWORK_BUTTON_FORWARD)
+#define PBTN_REW   (1 << FRAMEWORK_BUTTON_REWIND)
+#define PBTN_L     (1 << FRAMEWORK_BUTTON_LEFT_SHOULDER)
+#define PBTN_R     (1 << FRAMEWORK_BUTTON_RIGHT_SHOULDER)
+
+#define PBTN_HOME       (1 << FRAMEWORK_BUTTON_HOME)
+#define PBTN_VOLUME     (1 << FRAMEWORK_BUTTON_VOLUME)
+#define PBTN_BRIGHTNESS (1 << FRAMEWORK_BUTTON_BRIGHTNESS)
+#define PBTN_ALARM      (1 << FRAMEWORK_BUTTON_ALARM)
+#define PBTN_POWER      (1 << FRAMEWORK_BUTTON_POWER)
 
index edd7ef0..6a2a8f2 100644 (file)
@@ -71,15 +71,15 @@ unsigned long wait_for_input(unsigned int interesting)
                repeats = 0;\r
                wait = 20;\r
        }\r
-       if (wait > 6 && (ret&(BTN_UP|BTN_LEFT|BTN_DOWN|BTN_RIGHT|BTN_L|BTN_R)))\r
+       if (wait > 6 && (ret&(PBTN_UP|PBTN_LEFT|PBTN_DOWN|PBTN_RIGHT|PBTN_L|PBTN_R)))\r
                wait = 6;\r
        inp_prev = ret;\r
 \r
        // we don't need diagonals in menus\r
-       if ((ret&BTN_UP)   && (ret&BTN_LEFT))  ret &= ~BTN_LEFT;\r
-       if ((ret&BTN_UP)   && (ret&BTN_RIGHT)) ret &= ~BTN_RIGHT;\r
-       if ((ret&BTN_DOWN) && (ret&BTN_LEFT))  ret &= ~BTN_LEFT;\r
-       if ((ret&BTN_DOWN) && (ret&BTN_RIGHT)) ret &= ~BTN_RIGHT;\r
+       if ((ret&PBTN_UP)   && (ret&PBTN_LEFT))  ret &= ~PBTN_LEFT;\r
+       if ((ret&PBTN_UP)   && (ret&PBTN_RIGHT)) ret &= ~PBTN_RIGHT;\r
+       if ((ret&PBTN_DOWN) && (ret&PBTN_LEFT))  ret &= ~PBTN_LEFT;\r
+       if ((ret&PBTN_DOWN) && (ret&PBTN_RIGHT)) ret &= ~PBTN_RIGHT;\r
 \r
        return ret;\r
 }\r
@@ -386,14 +386,14 @@ static char *romsel_loop(char *curr_path)
        for (;;)\r
        {\r
                draw_dirlist(curr_path, namelist, n, sel);\r
-               inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT|BTN_L|BTN_R|BTN_PLAY|BTN_STOP);\r
-               if(inp & BTN_UP  )  { sel--;   if (sel < 0)   sel = n-2; }\r
-               if(inp & BTN_DOWN)  { sel++;   if (sel > n-2) sel = 0; }\r
-               if(inp & BTN_LEFT)  { sel-=10; if (sel < 0)   sel = 0; }\r
-               if(inp & BTN_L)     { sel-=24; if (sel < 0)   sel = 0; }\r
-               if(inp & BTN_RIGHT) { sel+=10; if (sel > n-2) sel = n-2; }\r
-               if(inp & BTN_R)     { sel+=24; if (sel > n-2) sel = n-2; }\r
-               if(inp & BTN_PLAY)     { // enter dir/select\r
+               inp = wait_for_input(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT|PBTN_L|PBTN_R|PBTN_PLAY|PBTN_STOP);\r
+               if(inp & PBTN_UP  )  { sel--;   if (sel < 0)   sel = n-2; }\r
+               if(inp & PBTN_DOWN)  { sel++;   if (sel > n-2) sel = 0; }\r
+               if(inp & PBTN_LEFT)  { sel-=10; if (sel < 0)   sel = 0; }\r
+               if(inp & PBTN_L)     { sel-=24; if (sel < 0)   sel = 0; }\r
+               if(inp & PBTN_RIGHT) { sel+=10; if (sel > n-2) sel = n-2; }\r
+               if(inp & PBTN_R)     { sel+=24; if (sel > n-2) sel = n-2; }\r
+               if(inp & PBTN_PLAY)     { // enter dir/select\r
                        if (namelist[sel+1]->d_type == DT_REG) {\r
                                strcpy(romFileName, curr_path);\r
                                strcat(romFileName, "/");\r
@@ -422,7 +422,7 @@ static char *romsel_loop(char *curr_path)
                                break;\r
                        }\r
                }\r
-               if(inp & BTN_STOP) break; // cancel\r
+               if(inp & PBTN_STOP) break; // cancel\r
        }\r
 \r
        if (n > 0) {\r
@@ -473,17 +473,17 @@ static void patches_menu_loop(void)
        for(;;)\r
        {\r
                draw_patchlist(menu_sel);\r
-               inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT|BTN_L|BTN_R|BTN_PLAY|BTN_STOP);\r
-               if(inp & BTN_UP  ) { menu_sel--; if (menu_sel < 0) menu_sel = PicoPatchCount; }\r
-               if(inp & BTN_DOWN) { menu_sel++; if (menu_sel > PicoPatchCount) menu_sel = 0; }\r
-               if(inp &(BTN_LEFT|BTN_L))  { menu_sel-=10; if (menu_sel < 0) menu_sel = 0; }\r
-               if(inp &(BTN_RIGHT|BTN_R)) { menu_sel+=10; if (menu_sel > PicoPatchCount) menu_sel = PicoPatchCount; }\r
-               if(inp & BTN_PLAY) { // action\r
+               inp = wait_for_input(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT|PBTN_L|PBTN_R|PBTN_PLAY|PBTN_STOP);\r
+               if(inp & PBTN_UP  ) { menu_sel--; if (menu_sel < 0) menu_sel = PicoPatchCount; }\r
+               if(inp & PBTN_DOWN) { menu_sel++; if (menu_sel > PicoPatchCount) menu_sel = 0; }\r
+               if(inp &(PBTN_LEFT|PBTN_L))  { menu_sel-=10; if (menu_sel < 0) menu_sel = 0; }\r
+               if(inp &(PBTN_RIGHT|PBTN_R)) { menu_sel+=10; if (menu_sel > PicoPatchCount) menu_sel = PicoPatchCount; }\r
+               if(inp & PBTN_PLAY) { // action\r
                        if (menu_sel < PicoPatchCount)\r
                                PicoPatches[menu_sel].active = !PicoPatches[menu_sel].active;\r
                        else    return;\r
                }\r
-               if(inp & BTN_STOP) return;\r
+               if(inp & PBTN_STOP) return;\r
        }\r
 \r
 }\r
@@ -593,18 +593,18 @@ static int savestate_menu_loop(int is_loading)
        for(;;)\r
        {\r
                draw_savestate_menu(menu_sel, is_loading);\r
-               inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_PLAY|BTN_STOP);\r
-               if(inp & BTN_UP  ) {\r
+               inp = wait_for_input(PBTN_UP|PBTN_DOWN|PBTN_PLAY|PBTN_STOP);\r
+               if(inp & PBTN_UP  ) {\r
                        do {\r
                                menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max;\r
                        } while (!(state_slot_flags & (1 << menu_sel)) && menu_sel != menu_sel_max && is_loading);\r
                }\r
-               if(inp & BTN_DOWN) {\r
+               if(inp & PBTN_DOWN) {\r
                        do {\r
                                menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0;\r
                        } while (!(state_slot_flags & (1 << menu_sel)) && menu_sel != menu_sel_max && is_loading);\r
                }\r
-               if(inp & BTN_PLAY) { // save/load\r
+               if(inp & PBTN_PLAY) { // save/load\r
                        if (menu_sel < 10) {\r
                                state_slot = menu_sel;\r
                                PicoStateProgressCB = emu_stateCb; /* also suitable for menu */\r
@@ -615,7 +615,7 @@ static int savestate_menu_loop(int is_loading)
                                return 0;\r
                        } else  return 1;\r
                }\r
-               if(inp & BTN_STOP) return 1;\r
+               if(inp & PBTN_STOP) return 1;\r
        }\r
 }\r
 \r
@@ -703,22 +703,22 @@ static void key_config_loop(const me_bind_action *opts, int opt_cnt, int player_
        for (;;)\r
        {\r
                draw_key_config(opts, opt_cnt, player_idx, sel);\r
-               inp = wait_for_input(CONFIGURABLE_KEYS|BTN_HOME);\r
-               if (!(inp & BTN_HOME)) {\r
+               inp = wait_for_input(CONFIGURABLE_KEYS|PBTN_HOME);\r
+               if (!(inp & PBTN_HOME)) {\r
                        prev_select = 0;\r
-                       if(inp & BTN_UP  ) { sel--; if (sel < 0) sel = menu_sel_max; continue; }\r
-                       if(inp & BTN_DOWN) { sel++; if (sel > menu_sel_max) sel = 0; continue; }\r
+                       if(inp & PBTN_UP  ) { sel--; if (sel < 0) sel = menu_sel_max; continue; }\r
+                       if(inp & PBTN_DOWN) { sel++; if (sel > menu_sel_max) sel = 0; continue; }\r
                }\r
                if (sel >= opt_cnt) {\r
-                       if (inp & (BTN_PLAY|BTN_STOP)) break;\r
+                       if (inp & (PBTN_PLAY|PBTN_STOP)) break;\r
                        else continue;\r
                }\r
                // if we are here, we want to bind/unbind something\r
-               if ((inp & BTN_HOME) && !prev_select)\r
+               if ((inp & PBTN_HOME) && !prev_select)\r
                        unbind_action(opts[sel].mask);\r
-               prev_select = inp & BTN_HOME;\r
+               prev_select = inp & PBTN_HOME;\r
                inp &= CONFIGURABLE_KEYS;\r
-               inp &= ~BTN_HOME;\r
+               inp &= ~PBTN_HOME;\r
                for (i = 0; i < 32; i++)\r
                        if (inp & (1 << i)) {\r
                                if (count_bound_keys(opts[sel].mask, player_idx) >= 2)\r
@@ -783,13 +783,13 @@ static void kc_sel_loop(void)
        while (1)\r
        {\r
                draw_kc_sel(menu_sel);\r
-               inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_PLAY|BTN_STOP);\r
+               inp = wait_for_input(PBTN_UP|PBTN_DOWN|PBTN_PLAY|PBTN_STOP);\r
                selected_id = me_index2id(ctrlopt_entries, CTRLOPT_ENTRY_COUNT, menu_sel);\r
-               if (inp & (BTN_LEFT|BTN_RIGHT)) // multi choise\r
-                       me_process(ctrlopt_entries, CTRLOPT_ENTRY_COUNT, selected_id, (inp&BTN_RIGHT) ? 1 : 0);\r
-               if (inp & BTN_UP  ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }\r
-               if (inp & BTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }\r
-               if (inp & BTN_PLAY) {\r
+               if (inp & (PBTN_LEFT|PBTN_RIGHT)) // multi choise\r
+                       me_process(ctrlopt_entries, CTRLOPT_ENTRY_COUNT, selected_id, (inp&PBTN_RIGHT) ? 1 : 0);\r
+               if (inp & PBTN_UP  ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }\r
+               if (inp & PBTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }\r
+               if (inp & PBTN_PLAY) {\r
                        int is_6button = PicoOpt & 0x020;\r
                        switch (selected_id) {\r
                                case MA_CTRL_PLAYER1: key_config_loop(me_ctrl_actions, is_6button ? 15 : 11, 0); return;\r
@@ -800,7 +800,7 @@ static void kc_sel_loop(void)
                                default: return;\r
                        }\r
                }\r
-               if (inp & BTN_STOP) return;\r
+               if (inp & PBTN_STOP) return;\r
        }\r
 }\r
 \r
@@ -904,14 +904,14 @@ static void cd_menu_loop_options(void)
        for(;;)\r
        {\r
                draw_cd_menu_options(menu_sel, &bios_names);\r
-               inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT|BTN_PLAY|BTN_STOP|BTN_REW);\r
-               if (inp & BTN_UP  ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }\r
-               if (inp & BTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }\r
+               inp = wait_for_input(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT|PBTN_PLAY|PBTN_STOP|PBTN_REW);\r
+               if (inp & PBTN_UP  ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }\r
+               if (inp & PBTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }\r
                selected_id = me_index2id(cdopt_entries, CDOPT_ENTRY_COUNT, menu_sel);\r
-               if (inp & (BTN_LEFT|BTN_RIGHT)) { // multi choise\r
-                       if (!me_process(cdopt_entries, CDOPT_ENTRY_COUNT, selected_id, (inp&BTN_RIGHT) ? 1 : 0) &&\r
+               if (inp & (PBTN_LEFT|PBTN_RIGHT)) { // multi choise\r
+                       if (!me_process(cdopt_entries, CDOPT_ENTRY_COUNT, selected_id, (inp&PBTN_RIGHT) ? 1 : 0) &&\r
                            selected_id == MA_CDOPT_READAHEAD) {\r
-                               if (inp & BTN_LEFT) {\r
+                               if (inp & PBTN_LEFT) {\r
                                        PicoCDBuffers >>= 1;\r
                                        if (PicoCDBuffers < 2) PicoCDBuffers = 0;\r
                                } else {\r
@@ -921,7 +921,7 @@ static void cd_menu_loop_options(void)
                                }\r
                        }\r
                }\r
-               if (inp & BTN_PLAY) { // toggleable options\r
+               if (inp & PBTN_PLAY) { // toggleable options\r
                        if (!me_process(cdopt_entries, CDOPT_ENTRY_COUNT, selected_id, 1) &&\r
                            selected_id == MA_CDOPT_DONE) {\r
                                return;\r
@@ -952,7 +952,7 @@ static void cd_menu_loop_options(void)
                                        break;\r
                        }\r
                }\r
-               if (inp & (BTN_STOP|BTN_REW)) return;\r
+               if (inp & (PBTN_STOP|PBTN_REW)) return;\r
        }\r
 }\r
 \r
@@ -1003,15 +1003,15 @@ static void amenu_loop_options(void)
        for(;;)\r
        {\r
                draw_amenu_options(menu_sel);\r
-               inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT|BTN_PLAY|BTN_STOP|BTN_REW);\r
-               if (inp & BTN_UP  ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }\r
-               if (inp & BTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }\r
+               inp = wait_for_input(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT|PBTN_PLAY|PBTN_STOP|PBTN_REW);\r
+               if (inp & PBTN_UP  ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }\r
+               if (inp & PBTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }\r
                selected_id = me_index2id(opt2_entries, OPT2_ENTRY_COUNT, menu_sel);\r
-               if (inp & (BTN_LEFT|BTN_RIGHT)) { // multi choise\r
-                       if (!me_process(opt2_entries, OPT2_ENTRY_COUNT, selected_id, (inp&BTN_RIGHT) ? 1 : 0) &&\r
+               if (inp & (PBTN_LEFT|PBTN_RIGHT)) { // multi choise\r
+                       if (!me_process(opt2_entries, OPT2_ENTRY_COUNT, selected_id, (inp&PBTN_RIGHT) ? 1 : 0) &&\r
                            selected_id == MA_OPT2_GAMMA) {\r
-                               while ((inp = Framework_PollGetButtons()) & (BTN_LEFT|BTN_RIGHT)) {\r
-                                       currentConfig.gamma += (inp & BTN_LEFT) ? -1 : 1;\r
+                               while ((inp = Framework_PollGetButtons()) & (PBTN_LEFT|PBTN_RIGHT)) {\r
+                                       currentConfig.gamma += (inp & PBTN_LEFT) ? -1 : 1;\r
                                        if (currentConfig.gamma <   1) currentConfig.gamma =   1;\r
                                        if (currentConfig.gamma > 300) currentConfig.gamma = 300;\r
                                        draw_amenu_options(menu_sel);\r
@@ -1019,13 +1019,13 @@ static void amenu_loop_options(void)
                                }\r
                        }\r
                }\r
-               if (inp & BTN_PLAY) { // toggleable options\r
+               if (inp & PBTN_PLAY) { // toggleable options\r
                        if (!me_process(opt2_entries, OPT2_ENTRY_COUNT, selected_id, 1) &&\r
                            selected_id == MA_OPT2_DONE) {\r
                                return;\r
                        }\r
                }\r
-               if (inp & (BTN_STOP|BTN_REW)) return;\r
+               if (inp & (PBTN_STOP|PBTN_REW)) return;\r
        }\r
 }\r
 \r
@@ -1187,15 +1187,15 @@ static int menu_loop_options(void)
        while (1)\r
        {\r
                draw_menu_options(menu_sel);\r
-               inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT|BTN_PLAY|BTN_STOP|BTN_REW);\r
-               if (inp & BTN_UP  ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }\r
-               if (inp & BTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }\r
+               inp = wait_for_input(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT|PBTN_PLAY|PBTN_STOP|PBTN_REW);\r
+               if (inp & PBTN_UP  ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }\r
+               if (inp & PBTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }\r
                selected_id = me_index2id(opt_entries, OPT_ENTRY_COUNT, menu_sel);\r
-               if (inp & (BTN_LEFT|BTN_RIGHT)) { // multi choise\r
-                       if (!me_process(opt_entries, OPT_ENTRY_COUNT, selected_id, (inp&BTN_RIGHT) ? 1 : 0)) {\r
+               if (inp & (PBTN_LEFT|PBTN_RIGHT)) { // multi choise\r
+                       if (!me_process(opt_entries, OPT_ENTRY_COUNT, selected_id, (inp&PBTN_RIGHT) ? 1 : 0)) {\r
                                switch (selected_id) {\r
                                        case MA_OPT_RENDERER:\r
-                                               if (inp & BTN_LEFT) {\r
+                                               if (inp & PBTN_LEFT) {\r
                                                        if ((PicoOpt&0x10) || !(currentConfig.EmuOpt &0x80)) {\r
                                                                PicoOpt&= ~0x10;\r
                                                                currentConfig.EmuOpt |=  0x80;\r
@@ -1208,25 +1208,25 @@ static int menu_loop_options(void)
                                                }\r
                                                break;\r
                                        case MA_OPT_SOUND_QUALITY:\r
-                                               if ((inp & BTN_RIGHT) && PsndRate == 44100 &&\r
+                                               if ((inp & PBTN_RIGHT) && PsndRate == 44100 &&\r
                                                                !(PicoOpt&0x08))\r
                                                {\r
                                                        PsndRate =  11025;\r
                                                        PicoOpt |=  8;\r
-                                               } else if ((inp & BTN_LEFT) && PsndRate == 11025 &&\r
+                                               } else if ((inp & PBTN_LEFT) && PsndRate == 11025 &&\r
                                                                (PicoOpt&0x08) && !(PicoAHW&1))\r
                                                {\r
                                                        PsndRate =  44100;\r
                                                        PicoOpt &= ~8;\r
                                                } else\r
-                                                       PsndRate = sndrate_prevnext(PsndRate, inp & BTN_RIGHT);\r
+                                                       PsndRate = sndrate_prevnext(PsndRate, inp & PBTN_RIGHT);\r
                                                break;\r
                                        case MA_OPT_REGION:\r
-                                               region_prevnext(inp & BTN_RIGHT);\r
+                                               region_prevnext(inp & PBTN_RIGHT);\r
                                                break;\r
                                        case MA_OPT_CONFIRM_STATES: {\r
                                                         int n = ((currentConfig.EmuOpt>>9)&1) | ((currentConfig.EmuOpt>>10)&2);\r
-                                                        n += (inp & BTN_LEFT) ? -1 : 1;\r
+                                                        n += (inp & PBTN_LEFT) ? -1 : 1;\r
                                                         if (n < 0) n = 0; else if (n > 3) n = 3;\r
                                                         n |= n << 1; n &= ~2;\r
                                                         currentConfig.EmuOpt &= ~0xa00;\r
@@ -1234,7 +1234,7 @@ static int menu_loop_options(void)
                                                         break;\r
                                                 }\r
                                        case MA_OPT_SAVE_SLOT:\r
-                                                if (inp & BTN_RIGHT) {\r
+                                                if (inp & PBTN_RIGHT) {\r
                                                         state_slot++; if (state_slot > 9) state_slot = 0;\r
                                                 } else {state_slot--; if (state_slot < 0) state_slot = 9;\r
                                                 }\r
@@ -1242,7 +1242,7 @@ static int menu_loop_options(void)
                                        case MA_OPT_SAVECFG:\r
                                        case MA_OPT_SAVECFG_GAME:\r
                                        case MA_OPT_LOADCFG:\r
-                                                config_slot += (inp&BTN_RIGHT) ? 1 : -1;\r
+                                                config_slot += (inp&PBTN_RIGHT) ? 1 : -1;\r
                                                 if (config_slot > 9) config_slot = 0;\r
                                                 if (config_slot < 0) config_slot = 9;\r
                                                 me_enable(opt_entries, OPT_ENTRY_COUNT, MA_OPT_LOADCFG, config_slot != config_slot_current);\r
@@ -1255,7 +1255,7 @@ static int menu_loop_options(void)
                                }\r
                        }\r
                }\r
-               if (inp & BTN_PLAY) {\r
+               if (inp & PBTN_PLAY) {\r
                        if (!me_process(opt_entries, OPT_ENTRY_COUNT, selected_id, 1))\r
                        {\r
                                switch (selected_id)\r
@@ -1290,7 +1290,7 @@ static int menu_loop_options(void)
                                }\r
                        }\r
                }\r
-               if(inp & (BTN_STOP|BTN_REW)) {\r
+               if(inp & (PBTN_STOP|PBTN_REW)) {\r
                        menu_options_save();\r
                        return 0;  // done (update, no write)\r
                }\r
@@ -1383,28 +1383,28 @@ static void menu_loop_root(void)
        /* make sure action buttons are not pressed on entering menu */\r
        draw_menu_root(menu_sel);\r
 \r
-       while (Framework_PollGetButtons() & (BTN_PLAY|BTN_STOP|BTN_HOME)) Sleep(50);\r
+       while (Framework_PollGetButtons() & (PBTN_PLAY|PBTN_STOP|PBTN_HOME)) Sleep(50);\r
 \r
        for (;;)\r
        {\r
                draw_menu_root(menu_sel);\r
-               inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_PLAY|BTN_STOP|BTN_HOME|BTN_L|BTN_R);\r
-               if(inp & BTN_UP  )  { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }\r
-               if(inp & BTN_DOWN)  { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }\r
-               if((inp & (BTN_L|BTN_R)) == (BTN_L|BTN_R)) debug_menu_loop();\r
-               if( inp & (BTN_HOME|BTN_STOP)) {\r
+               inp = wait_for_input(PBTN_UP|PBTN_DOWN|PBTN_PLAY|PBTN_STOP|PBTN_HOME|PBTN_L|PBTN_R);\r
+               if(inp & PBTN_UP  )  { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }\r
+               if(inp & PBTN_DOWN)  { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }\r
+               if((inp & (PBTN_L|PBTN_R)) == (PBTN_L|PBTN_R)) debug_menu_loop();\r
+               if( inp & (PBTN_HOME|PBTN_STOP)) {\r
                        if (rom_loaded) {\r
-                               while (Framework_PollGetButtons() & (BTN_HOME|BTN_STOP)) Sleep(50); // wait until released\r
+                               while (Framework_PollGetButtons() & (PBTN_HOME|PBTN_STOP)) Sleep(50); // wait until released\r
                                engineState = PGS_Running;\r
                                break;\r
                        }\r
                }\r
-               if(inp & BTN_PLAY)  {\r
+               if(inp & PBTN_PLAY)  {\r
                        switch (me_index2id(main_entries, MAIN_ENTRY_COUNT, menu_sel))\r
                        {\r
                                case MA_MAIN_RESUME_GAME:\r
                                        if (rom_loaded) {\r
-                                               while (Framework_PollGetButtons() & BTN_PLAY) Sleep(50);\r
+                                               while (Framework_PollGetButtons() & PBTN_PLAY) Sleep(50);\r
                                                engineState = PGS_Running;\r
                                                return;\r
                                        }\r
@@ -1421,7 +1421,7 @@ static void menu_loop_root(void)
                                        if (rom_loaded) {\r
                                                if(savestate_menu_loop(1))\r
                                                        continue;\r
-                                               while (Framework_PollGetButtons() & BTN_PLAY) Sleep(50);\r
+                                               while (Framework_PollGetButtons() & PBTN_PLAY) Sleep(50);\r
                                                engineState = PGS_Running;\r
                                                return;\r
                                        }\r
@@ -1429,7 +1429,7 @@ static void menu_loop_root(void)
                                case MA_MAIN_RESET_GAME:\r
                                        if (rom_loaded) {\r
                                                emu_ResetGame();\r
-                                               while (Framework_PollGetButtons() & BTN_PLAY) Sleep(50);\r
+                                               while (Framework_PollGetButtons() & PBTN_PLAY) Sleep(50);\r
                                                engineState = PGS_Running;\r
                                                return;\r
                                        }\r
@@ -1465,7 +1465,7 @@ static void menu_loop_root(void)
                                case MA_MAIN_CREDITS:\r
                                        draw_menu_credits();\r
                                        Sleep(500);\r
-                                       inp = wait_for_input(BTN_PLAY|BTN_STOP);\r
+                                       inp = wait_for_input(PBTN_PLAY|PBTN_STOP);\r
                                        break;\r
                                case MA_MAIN_EXIT:\r
                                        engineState = PGS_Quit;\r
@@ -1598,15 +1598,15 @@ int menu_loop_tray(void)
 \r
        /* make sure action buttons are not pressed on entering menu */\r
        draw_menu_tray(menu_sel);\r
-       while (Framework_PollGetButtons() & BTN_PLAY) Sleep(50);\r
+       while (Framework_PollGetButtons() & PBTN_PLAY) Sleep(50);\r
 \r
        for (;;)\r
        {\r
                draw_menu_tray(menu_sel);\r
-               inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_PLAY);\r
-               if(inp & BTN_UP  )  { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }\r
-               if(inp & BTN_DOWN)  { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }\r
-               if(inp & BTN_PLAY   )  {\r
+               inp = wait_for_input(PBTN_UP|PBTN_DOWN|PBTN_PLAY);\r
+               if(inp & PBTN_UP  )  { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }\r
+               if(inp & PBTN_DOWN)  { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }\r
+               if(inp & PBTN_PLAY)  {\r
                        switch (menu_sel) {\r
                                case 0: // select image\r
                                        selfname = romsel_loop(curr_path);\r
index 3829836..8a88679 100644 (file)
@@ -10,6 +10,6 @@ void menu_romload_end(void);
 \r
 \r
 #define CONFIGURABLE_KEYS \\r
-       (BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT|BTN_STOP|BTN_PLAY|BTN_FWD|BTN_REW| \\r
-               BTN_L|BTN_R|BTN_VOLUME|BTN_BRIGHTNESS|BTN_ALARM)\r
+       (PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT|PBTN_STOP|PBTN_PLAY|PBTN_FWD|PBTN_REW| \\r
+               PBTN_L|PBTN_R|PBTN_VOLUME|PBTN_BRIGHTNESS|PBTN_ALARM)\r
 \r
index 1fa5c8b..ed4f928 100644 (file)
@@ -54,14 +54,14 @@ LD = $(CROSS)ld
 OBJCOPY = $(CROSS)objcopy\r
 \r
 # frontend\r
-OBJS += main.o menu.o gp2x.o usbjoy.o emu.o squidgehack.o cpuctrl.o\r
+OBJS += main.o menu.o gp2x.o emu.o squidgehack.o cpuctrl.o\r
 # 940 core control\r
 OBJS += 940ctl.o\r
 \r
 # common\r
 OBJS += platform/common/emu.o platform/common/menu.o platform/common/fonts.o platform/common/config.o \\r
        platform/common/arm_utils.o platform/common/arm_linux.o platform/common/readpng.o \\r
-       platform/common/mp3_helix.o\r
+       platform/common/mp3_helix.o platform/linux/usbjoy.o platform/linux/sndout_oss.o\r
 \r
 # Pico\r
 ifeq "$(amalgamate)" "1"\r
@@ -116,8 +116,8 @@ endif
 vpath %.c = ../..\r
 vpath %.s = ../..\r
 vpath %.S = ../..\r
-DIRS = platform platform/gp2x platform/common pico pico/cd pico/pico pico/sound pico/carthw/svp \\r
-       zlib unzip cpu cpu/musashi cpu/Cyclone/proj cpu/Cyclone/tools cpu/mz80 cpu/DrZ80\r
+DIRS = platform platform/gp2x platform/linux platform/common pico pico/cd pico/pico pico/sound \\r
+       pico/carthw/svp zlib unzip cpu cpu/musashi cpu/Cyclone/proj cpu/Cyclone/tools cpu/mz80 cpu/DrZ80\r
 \r
 \r
 all: mkdirs PicoDrive.gpe\r
index 8e726e3..c696d88 100644 (file)
 \r
 #include "emu.h"\r
 #include "gp2x.h"\r
-#include "usbjoy.h"\r
 #include "menu.h"\r
+#include "../linux/usbjoy.h"\r
 #include "../common/arm_utils.h"\r
 #include "../common/fonts.h"\r
 #include "../common/emu.h"\r
 #include "../common/config.h"\r
+#include "../linux/sndout_oss.h"\r
 #include "cpuctrl.h"\r
 \r
 #include <pico/pico_int.h>\r
@@ -487,7 +488,7 @@ static void update_volume(int has_changed, int is_up)
                                if (vol >  0) vol--;\r
                        }\r
                        wait_frames = 0;\r
-                       gp2x_sound_volume(vol, vol);\r
+                       sndout_oss_setvol(vol, vol);\r
                        currentConfig.volume = vol;\r
                }\r
                sprintf(noticeMsg, "VOL: %02i", vol);\r
@@ -614,9 +615,9 @@ static void updateKeys(void)
        // add joy inputs\r
        if (num_of_joys > 0)\r
        {\r
-               gp2x_usbjoy_update();\r
+               usbjoy_update();\r
                for (joy = 0; joy < num_of_joys; joy++) {\r
-                       int btns = gp2x_usbjoy_check2(joy);\r
+                       int btns = usbjoy_check2(joy);\r
                        for (i = 0; i < 32; i++) {\r
                                if (btns & (1 << i)) {\r
                                        int acts = currentConfig.JoyBinds[joy][i];\r
@@ -662,7 +663,7 @@ static void updateSound(int len)
 \r
        /* avoid writing audio when lagging behind to prevent audio lag */\r
        if (PicoSkipFrame != 2)\r
-               gp2x_sound_write(PsndOut, len<<1);\r
+               sndout_oss_write(PsndOut, len<<1);\r
 }\r
 \r
 void emu_startSound(void)\r
@@ -683,8 +684,8 @@ void emu_startSound(void)
                snd_excess_add = ((PsndRate - PsndLen*target_fps)<<16) / target_fps;\r
                printf("starting audio: %i len: %i (ex: %04x) stereo: %i, pal: %i\n",\r
                        PsndRate, PsndLen, snd_excess_add, (PicoOpt&8)>>3, Pico.m.pal);\r
-               gp2x_start_sound(PsndRate, 16, (PicoOpt&8)>>3);\r
-               gp2x_sound_volume(currentConfig.volume, currentConfig.volume);\r
+               sndout_oss_start(PsndRate, 16, (PicoOpt&8)>>3);\r
+               sndout_oss_setvol(currentConfig.volume, currentConfig.volume);\r
                PicoWriteSound = updateSound;\r
                update_volume(0, 0);\r
                memset(sndBuffer, 0, sizeof(sndBuffer));\r
index 0276038..89505a0 100644 (file)
 #include <sys/mman.h>\r
 #include <sys/types.h>\r
 #include <sys/stat.h>\r
-#include <sys/ioctl.h>\r
-#include <sys/soundcard.h>\r
 #include <fcntl.h>\r
 #include <errno.h>\r
 \r
 #include "gp2x.h"\r
-#include "usbjoy.h"\r
+#include "../linux/usbjoy.h"\r
+#include "../linux/sndout_oss.h"\r
 #include "../common/arm_utils.h"\r
 #include "../common/arm_linux.h"\r
 \r
@@ -45,7 +44,7 @@ static void *gp2x_screens[4];
 static int screensel = 0;\r
 //static\r
 int memdev = 0;\r
-static int sounddev = -1, mixerdev = -1, touchdev = -1;\r
+static int touchdev = -1;\r
 static int touchcal[7] = { 6203, 0, -1501397, 0, -4200, 16132680, 65536 };\r
 \r
 void *gp2x_screen;\r
@@ -210,9 +209,9 @@ unsigned long gp2x_joystick_read(int allow_usb_joy)
 \r
        if (allow_usb_joy && num_of_joys > 0) {\r
                // check the usb joy as well..\r
-               gp2x_usbjoy_update();\r
+               usbjoy_update();\r
                for (i = 0; i < num_of_joys; i++)\r
-                       value |= gp2x_usbjoy_check(i);\r
+                       value |= usbjoy_check(i);\r
        }\r
 \r
        return value;\r
@@ -251,57 +250,6 @@ int gp2x_touchpad_read(int *x, int *y)
 }\r
 \r
 \r
-static int s_oldrate = 0, s_oldbits = 0, s_oldstereo = 0;\r
-\r
-void gp2x_start_sound(int rate, int bits, int stereo)\r
-{\r
-       int frag = 0, bsize, buffers;\r
-\r
-       // if no settings change, we don't need to do anything\r
-       if (rate == s_oldrate && s_oldbits == bits && s_oldstereo == stereo) return;\r
-\r
-       if (sounddev > 0) close(sounddev);\r
-       sounddev = open("/dev/dsp", O_WRONLY|O_ASYNC);\r
-       if (sounddev == -1)\r
-               printf("open(\"/dev/dsp\") failed with %i\n", errno);\r
-\r
-       ioctl(sounddev, SNDCTL_DSP_SETFMT, &bits);\r
-       ioctl(sounddev, SNDCTL_DSP_SPEED,  &rate);\r
-       ioctl(sounddev, SNDCTL_DSP_STEREO, &stereo);\r
-       // calculate buffer size\r
-       buffers = 16;\r
-       bsize = rate / 32;\r
-       if (rate > 22050) { bsize*=4; buffers*=2; } // 44k mode seems to be very demanding\r
-       while ((bsize>>=1)) frag++;\r
-       frag |= buffers<<16; // 16 buffers\r
-       ioctl(sounddev, SNDCTL_DSP_SETFRAGMENT, &frag);\r
-       usleep(192*1024);\r
-\r
-       printf("gp2x_set_sound: %i/%ibit/%s, %i buffers of %i bytes\n",\r
-               rate, bits, stereo?"stereo":"mono", frag>>16, 1<<(frag&0xffff));\r
-\r
-       s_oldrate = rate; s_oldbits = bits; s_oldstereo = stereo;\r
-}\r
-\r
-\r
-void gp2x_sound_write(void *buff, int len)\r
-{\r
-       write(sounddev, buff, len);\r
-}\r
-\r
-void gp2x_sound_sync(void)\r
-{\r
-       ioctl(sounddev, SOUND_PCM_SYNC, 0);\r
-}\r
-\r
-void gp2x_sound_volume(int l, int r)\r
-{\r
-       l=l<0?0:l; l=l>255?255:l; r=r<0?0:r; r=r>255?255:r;\r
-       l<<=8; l|=r;\r
-       ioctl(mixerdev, SOUND_MIXER_WRITE_PCM, &l); /*SOUND_MIXER_WRITE_VOLUME*/\r
-}\r
-\r
-\r
 /* 940 */\r
 void Pause940(int yes)\r
 {\r
@@ -352,7 +300,7 @@ void gp2x_init(void)
        memdev = open("/dev/mem", O_RDWR);\r
        if (memdev == -1)\r
        {\r
-               printf("open(\"/dev/mem\") failed with %i\n", errno);\r
+               perror("open(\"/dev/mem\")");\r
                exit(1);\r
        }\r
 \r
@@ -360,7 +308,7 @@ void gp2x_init(void)
        printf("memregs are @ %p\n", gp2x_memregs);\r
        if(gp2x_memregs == MAP_FAILED)\r
        {\r
-               printf("mmap(memregs) failed with %i\n", errno);\r
+               perror("mmap(memregs)");\r
                exit(1);\r
        }\r
        gp2x_memregl = (unsigned long *) gp2x_memregs;\r
@@ -370,7 +318,7 @@ void gp2x_init(void)
        gp2x_screens[0] = mmap(0, FRAMEBUFF_WHOLESIZE, PROT_WRITE, MAP_SHARED, memdev, FRAMEBUFF_ADDR0);\r
        if(gp2x_screens[0] == MAP_FAILED)\r
        {\r
-               printf("mmap(gp2x_screen) failed with %i\n", errno);\r
+               perror("mmap(gp2x_screen)");\r
                exit(1);\r
        }\r
        printf("framebuffers point to %p\n", gp2x_screens[0]);\r
@@ -390,12 +338,10 @@ void gp2x_init(void)
        gp2x_memset_all_buffers(0, 0, 320*240*2);\r
 \r
        // snd\r
-       mixerdev = open("/dev/mixer", O_RDWR);\r
-       if (mixerdev == -1)\r
-               printf("open(\"/dev/mixer\") failed with %i\n", errno);\r
+       sndout_oss_init();\r
 \r
        /* init usb joys -GnoStiC */\r
-       gp2x_usbjoy_init();\r
+       usbjoy_init();\r
 \r
        // touchscreen\r
        touchdev = open("/dev/touchscreen/wm97xx", O_RDONLY);\r
@@ -432,16 +378,15 @@ void gp2x_deinit(void)
        munmap(gp2x_screens[0], FRAMEBUFF_WHOLESIZE);\r
        munmap((void *)gp2x_memregs, 0x10000);\r
        close(memdev);\r
-       close(mixerdev);\r
-       if (sounddev >= 0) close(sounddev);\r
        if (touchdev >= 0) close(touchdev);\r
 \r
-       gp2x_usbjoy_deinit();\r
+       sndout_oss_exit();\r
+       usbjoy_deinit();\r
 \r
        printf("all done, running ");\r
 \r
        // Zaq121's alternative frontend support from MAME\r
-       if(ext_menu && ext_state) {\r
+       if (ext_menu && ext_state) {\r
                printf("%s -state %s\n", ext_menu, ext_state);\r
                execl(ext_menu, ext_menu, "-state", ext_state, NULL);\r
        } else if(ext_menu) {\r
index 3d0db13..b61b853 100644 (file)
@@ -20,12 +20,6 @@ void gp2x_memcpy_all_buffers(void *data, int offset, int len);
 void gp2x_memset_all_buffers(int offset, int byte, int len);\r
 void gp2x_pd_clone_buffer2(void);\r
 \r
-/* sound */\r
-void gp2x_start_sound(int rate, int bits, int stereo);\r
-void gp2x_sound_write(void *buff, int len);\r
-void gp2x_sound_volume(int l, int r);\r
-void gp2x_sound_sync(void);\r
-\r
 /* input */\r
 unsigned long gp2x_joystick_read(int allow_usb_joy);\r
 int gp2x_touchpad_read(int *x, int *y);\r
index e37c878..ff8cd99 100644 (file)
@@ -13,7 +13,7 @@
 #include "gp2x.h"\r
 #include "emu.h"\r
 #include "menu.h"\r
-#include "usbjoy.h"\r
+#include "../linux/usbjoy.h"\r
 #include "../common/emu.h"\r
 #include "../common/menu.h"\r
 #include "../common/arm_utils.h"\r
@@ -90,9 +90,9 @@ static unsigned long input2_read(unsigned long interesting, int *joy)
        {\r
                *joy = 0;\r
                if ((ret = gp2x_joystick_read(0) & interesting)) break;\r
-               gp2x_usbjoy_update();\r
+               usbjoy_update();\r
                for (i = 0; i < num_of_joys; i++) {\r
-                       ret = gp2x_usbjoy_check2(i);\r
+                       ret = usbjoy_check2(i);\r
                        if (ret) { *joy = i + 1; break; }\r
                }\r
                if (ret) break;\r
index 442b50a..8000a0d 100644 (file)
@@ -27,8 +27,8 @@ COPT    += `pkg-config --cflags gthread-2.0`
 LDFLAGS += `pkg-config --libs gthread-2.0`
 
 # frontend
-OBJS += platform/gp2x/main.o platform/gp2x/menu.o platform/gp2x/emu.o platform/gp2x/usbjoy.o blit.o \
-               gp2x.o 940ctl_ym2612.o log_io.o
+OBJS += platform/gp2x/main.o platform/gp2x/menu.o platform/gp2x/emu.o usbjoy.o blit.o \
+               sndout_oss.o gp2x.o 940ctl_ym2612.o log_io.o
 
 # common
 OBJS += platform/common/emu.o platform/common/menu.o platform/common/config.o platform/common/fonts.o \
index ef21a67..bcb3ee3 100644 (file)
@@ -9,15 +9,14 @@
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/soundcard.h>
 #include <fcntl.h>
 #include <errno.h>
 
 #include "../gp2x/emu.h"
 #include "../gp2x/gp2x.h"
-#include "../gp2x/usbjoy.h"
 #include "../gp2x/version.h"
+#include "sndout_oss.h"
+#include "usbjoy.h"
 
 #include "log_io.h"
 
@@ -25,7 +24,6 @@ void *gp2x_screen;
 static int current_bpp = 8;
 static int current_pal[256];
 static unsigned long current_keys = 0;
-static int sounddev = 0, mixerdev = 0;
 static const char *verstring = "PicoDrive " VERSION;
 
 // dummies
@@ -184,13 +182,11 @@ void gp2x_init(void)
        memset(gp2x_screen, 0, 320*240*2 + 320*2);
 
        // snd
-       mixerdev = open("/dev/mixer", O_RDWR);
-       if (mixerdev == -1)
-               printf("open(\"/dev/mixer\") failed with %i\n", errno);
+       sndout_oss_init();
 
        gtk_initf();
 
-       gp2x_usbjoy_init();
+       usbjoy_init();
 
        printf("exitting init()\n"); fflush(stdout);
 }
@@ -198,9 +194,8 @@ void gp2x_init(void)
 void gp2x_deinit(void)
 {
        free(gp2x_screen);
-       if (sounddev > 0) close(sounddev);
-       close(mixerdev);
-       gp2x_usbjoy_deinit();
+       sndout_oss_exit();
+       usbjoy_deinit();
 }
 
 /* video */
@@ -304,54 +299,6 @@ void gp2x_pd_clone_buffer2(void)
        memset(gp2x_screen, 0, 320*240*2);
 }
 
-/* sound */
-static int s_oldrate = 0, s_oldbits = 0, s_oldstereo = 0;
-
-void gp2x_start_sound(int rate, int bits, int stereo)
-{
-       int frag = 0, bsize, buffers;
-
-       // if no settings change, we don't need to do anything
-       if (rate == s_oldrate && s_oldbits == bits && s_oldstereo == stereo) return;
-
-       if (sounddev > 0) close(sounddev);
-       sounddev = open("/dev/dsp", O_WRONLY|O_ASYNC);
-       if (sounddev == -1)
-               printf("open(\"/dev/dsp\") failed with %i\n", errno);
-
-       ioctl(sounddev, SNDCTL_DSP_SPEED,  &rate);
-       ioctl(sounddev, SNDCTL_DSP_SETFMT, &bits);
-       ioctl(sounddev, SNDCTL_DSP_STEREO, &stereo);
-       // calculate buffer size
-       buffers = 16;
-       bsize = rate / 32;
-       if (rate > 22050) { bsize*=4; buffers*=2; } // 44k mode seems to be very demanding
-       while ((bsize>>=1)) frag++;
-       frag |= buffers<<16; // 16 buffers
-       ioctl(sounddev, SNDCTL_DSP_SETFRAGMENT, &frag);
-       printf("gp2x_set_sound: %i/%ibit/%s, %i buffers of %i bytes\n",
-               rate, bits, stereo?"stereo":"mono", frag>>16, 1<<(frag&0xffff));
-
-       s_oldrate = rate; s_oldbits = bits; s_oldstereo = stereo;
-}
-
-void gp2x_sound_write(void *buff, int len)
-{
-       write(sounddev, buff, len);
-}
-
-void gp2x_sound_sync(void)
-{
-       ioctl(sounddev, SOUND_PCM_SYNC, 0);
-}
-
-void gp2x_sound_volume(int l, int r)
-{
-       l=l<0?0:l; l=l>255?255:l; r=r<0?0:r; r=r>255?255:r;
-       l<<=8; l|=r;
-       ioctl(mixerdev, SOUND_MIXER_WRITE_PCM, &l); /*SOUND_MIXER_WRITE_VOLUME*/
-}
-
 /* joy */
 unsigned long gp2x_joystick_read(int allow_usb_joy)
 {
@@ -360,9 +307,9 @@ unsigned long gp2x_joystick_read(int allow_usb_joy)
 
        if (allow_usb_joy && num_of_joys > 0) {
                // check the usb joy as well..
-               gp2x_usbjoy_update();
+               usbjoy_update();
                for (i = 0; i < num_of_joys; i++)
-                       value |= gp2x_usbjoy_check(i);
+                       value |= usbjoy_check(i);
        }
 
        return value;
diff --git a/platform/linux/sndout_oss.c b/platform/linux/sndout_oss.c
new file mode 100644 (file)
index 0000000..e2d0bde
--- /dev/null
@@ -0,0 +1,96 @@
+/* sound output via OSS */
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/soundcard.h>
+#include <unistd.h>
+
+#include "sndout_oss.h"
+
+static int sounddev = -1, mixerdev = -1;
+
+int sndout_oss_init(void)
+{
+       if (mixerdev >= 0) close(mixerdev);
+       mixerdev = open("/dev/mixer", O_RDWR);
+       if (mixerdev == -1)
+       {
+               perror("open(\"/dev/mixer\")");
+       }
+
+       return 0;
+}
+
+
+int sndout_oss_start(int rate, int bits, int stereo)
+{
+       static int s_oldrate = 0, s_oldbits = 0, s_oldstereo = 0;
+       int frag = 0, bsize, buffers, ret;
+
+       // if no settings change, we don't need to do anything,
+       // since audio is never stopped
+       if (rate == s_oldrate && s_oldbits == bits && s_oldstereo == stereo)
+               return 0;
+
+       if (sounddev >= 0) close(sounddev);
+       sounddev = open("/dev/dsp", O_WRONLY|O_ASYNC);
+       if (sounddev == -1)
+       {
+               perror("open(\"/dev/dsp\")");
+               return -1;
+       }
+
+       // calculate buffer size
+       // this is tuned for GP2X
+       buffers = 16;
+       bsize = rate / 32;
+       if (rate > 22050) { bsize*=4; buffers*=2; }
+       while ((bsize>>=1)) frag++;
+       frag |= buffers<<16; // 16 buffers
+       ret = ioctl(sounddev, SNDCTL_DSP_SETFRAGMENT, &frag);
+       if (ret) perror("SNDCTL_DSP_SETFRAGMENT failed");
+
+       ret  = ioctl(sounddev, SNDCTL_DSP_STEREO, &stereo);
+       ret |= ioctl(sounddev, SNDCTL_DSP_SETFMT, &bits);
+       ret |= ioctl(sounddev, SNDCTL_DSP_SPEED,  &rate);
+       if (ret) printf("failed to set audio format\n");
+       usleep(192*1024);
+
+       printf("gp2x_set_sound: %i/%ibit/%s, %i buffers of %i bytes\n",
+               rate, bits, stereo?"stereo":"mono", frag>>16, 1<<(frag&0xffff));
+
+       s_oldrate = rate; s_oldbits = bits; s_oldstereo = stereo;
+       return 0;
+}
+
+
+int sndout_oss_write(const void *buff, int len)
+{
+       return write(sounddev, buff, len);
+}
+
+
+void sndout_oss_sync(void)
+{
+       ioctl(sounddev, SOUND_PCM_SYNC, 0);
+}
+
+
+void sndout_oss_setvol(int l, int r)
+{
+       if (mixerdev < 0) return;
+
+       l=l<0?0:l; l=l>255?255:l; r=r<0?0:r; r=r>255?255:r;
+       l<<=8; l|=r;
+       ioctl(mixerdev, SOUND_MIXER_WRITE_PCM, &l); /*SOUND_MIXER_WRITE_VOLUME*/
+}
+
+
+void sndout_oss_exit(void)
+{
+       if (sounddev >= 0) close(sounddev); sounddev = -1;
+       if (mixerdev >= 0) close(mixerdev); mixerdev = -1;
+}
+
diff --git a/platform/linux/sndout_oss.h b/platform/linux/sndout_oss.h
new file mode 100644 (file)
index 0000000..d6f285b
--- /dev/null
@@ -0,0 +1,6 @@
+int  sndout_oss_init(void);
+int  sndout_oss_start(int rate, int bits, int stereo);
+int  sndout_oss_write(const void *buff, int len);
+void sndout_oss_sync(void);
+void sndout_oss_setvol(int l, int r);
+void sndout_oss_exit(void);
similarity index 88%
rename from platform/gp2x/usbjoy.c
rename to platform/linux/usbjoy.c
index d92e8f6..5930038 100644 (file)
@@ -321,16 +321,15 @@ int joy_close (struct usbjoy * joy) {
 }
 
 
-/*********************************************************************/
-/* GP2X USB Joystick Handling -GnoStiC                               */
 /*********************************************************************/
 
-#include "gp2x.h"
+#include "../common/common.h"
 
 int num_of_joys = 0;
 struct usbjoy *joys[4];
 
-void gp2x_usbjoy_init (void) {
+void usbjoy_init (void)
+{
        /* Open available joysticks -GnoStiC */
        int i, n = 0;
 
@@ -347,7 +346,8 @@ void gp2x_usbjoy_init (void) {
        printf("Found %d Joystick(s)\n",num_of_joys);
 }
 
-void gp2x_usbjoy_update (void) {
+void usbjoy_update (void)
+{
        /* Update Joystick Event Cache */
        int q, foo;
        for (q=0; q < num_of_joys; q++) {
@@ -355,45 +355,48 @@ void gp2x_usbjoy_update (void) {
        }
 }
 
-int gp2x_usbjoy_check (int joyno) {
+int usbjoy_check (int joyno)
+{
        /* Check Joystick */
        int q, joyExKey = 0;
        struct usbjoy *joy = joys[joyno];
 
        if (joy != NULL) {
-               if (joy_getaxe(JOYUP, joy))    { joyExKey |= GP2X_UP; }
-               if (joy_getaxe(JOYDOWN, joy))  { joyExKey |= GP2X_DOWN; }
-               if (joy_getaxe(JOYLEFT, joy))  { joyExKey |= GP2X_LEFT; }
-               if (joy_getaxe(JOYRIGHT, joy)) { joyExKey |= GP2X_RIGHT; }
+               if (joy_getaxe(JOYUP, joy))    { joyExKey |= PBTN_UP; }
+               if (joy_getaxe(JOYDOWN, joy))  { joyExKey |= PBTN_DOWN; }
+               if (joy_getaxe(JOYLEFT, joy))  { joyExKey |= PBTN_LEFT; }
+               if (joy_getaxe(JOYRIGHT, joy)) { joyExKey |= PBTN_RIGHT; }
 
                /* loop through joy buttons to check if they are pushed */
                for (q=0; q<joy_buttons (joy); q++) {
                        if (joy_getbutton (q, joy)) {
                                if (joy->type == JOY_TYPE_LOGITECH) {
                                        switch (q) {
-                                               case 0: joyExKey |= GP2X_A; break;
-                                               case 1: joyExKey |= GP2X_X; break;
-                                               case 2: joyExKey |= GP2X_B; break;
-                                               case 3: joyExKey |= GP2X_Y; break;
+                                               case 0: joyExKey |= PBTN_WEST;  break;
+                                               case 1: joyExKey |= PBTN_SOUTH; break;
+                                               case 2: joyExKey |= PBTN_EAST;  break;
+                                               case 3: joyExKey |= PBTN_NORTH; break;
                                        }
                                } else {
                                        switch (q) {
-                                               case 0: joyExKey |= GP2X_Y; break;
-                                               case 1: joyExKey |= GP2X_B; break;
-                                               case 2: joyExKey |= GP2X_X; break;
-                                               case 3: joyExKey |= GP2X_A; break;
+                                               case 0: joyExKey |= PBTN_NORTH; break;
+                                               case 1: joyExKey |= PBTN_EAST;  break;
+                                               case 2: joyExKey |= PBTN_SOUTH; break;
+                                               case 3: joyExKey |= PBTN_WEST;  break;
                                        }
                                }
 
                                switch (q) {
-                                       case  4: joyExKey |= GP2X_L; break;
-                                       case  5: joyExKey |= GP2X_R; break;
-                                       case  6: joyExKey |= GP2X_L; break; /* left shoulder button 2 */
-                                       case  7: joyExKey |= GP2X_R; break; /* right shoulder button 2 */
+                                       case  4: joyExKey |= PBTN_L; break;
+                                       case  5: joyExKey |= PBTN_R; break;
+                                       case  6: joyExKey |= PBTN_L; break; /* left shoulder button 2 */
+                                       case  7: joyExKey |= PBTN_R; break; /* right shoulder button 2 */
+/*
                                        case  8: joyExKey |= GP2X_SELECT;break;
                                        case  9: joyExKey |= GP2X_START; break;
                                        case 10: joyExKey |= GP2X_PUSH;  break;
                                        case 11: joyExKey |= GP2X_PUSH;  break;
+*/
                                }
                        }
                }
@@ -401,7 +404,8 @@ int gp2x_usbjoy_check (int joyno) {
        return joyExKey;
 }
 
-int gp2x_usbjoy_check2 (int joyno) {
+int usbjoy_check2 (int joyno)
+{
        /* Check Joystick, don't map to gp2x joy */
        int q, to, joyExKey = 0;
        struct usbjoy *joy = joys[joyno];
@@ -423,7 +427,8 @@ int gp2x_usbjoy_check2 (int joyno) {
 
 
 
-void gp2x_usbjoy_deinit (void) {
+void usbjoy_deinit (void)
+{
        int i;
        for (i=0; i<num_of_joys; i++) {
                joy_close (joys[i]);
similarity index 96%
rename from platform/gp2x/usbjoy.h
rename to platform/linux/usbjoy.h
index cdcc654..dc91802 100644 (file)
@@ -228,15 +228,15 @@ int joy_close (struct usbjoy * joy);
 
 
 
-/* gp2x stuff */
+/* more stuff */
 extern int num_of_joys;
 extern struct usbjoy *joys[4];
 
-void gp2x_usbjoy_update(void);
-void gp2x_usbjoy_init(void);
-int  gp2x_usbjoy_check(int joyno);
-int  gp2x_usbjoy_check2(int joyno);
-void gp2x_usbjoy_deinit(void);
+void usbjoy_update(void);
+void usbjoy_init(void);
+int  usbjoy_check(int joyno);
+int  usbjoy_check2(int joyno);
+void usbjoy_deinit(void);
 
 
 #endif // USBJOY_H
index ba9bbcb..045fd52 100644 (file)
@@ -1,4 +1,5 @@
-export CROSS = arm-none-linux-gnueabi-\r
+#export CROSS = arm-none-linux-gnueabi-\r
+LIBROOT = /home/notaz/dev/pnd/libroot\r
 \r
 # settings\r
 #mz80 = 1\r
@@ -29,7 +30,7 @@ use_cyclone = 1
 endif\r
 \r
 DEFINC = -I../.. -I. -DARM -DPANDORA\r
-COPT_COMMON = -Wall -Winline -mcpu=cortex-a8 -mtune=cortex-a8 -march=armv7-a\r
+COPT_COMMON = -Wall -Winline -mcpu=cortex-a8 -mtune=cortex-a8 -march=armv7-a -I$(LIBROOT)/include\r
 ifeq ($(DEBUG),)\r
 COPT_COMMON += -O2 # -ftracer -fstrength-reduce -fomit-frame-pointer -fstrict-aliasing -ffast-math\r
 else\r
@@ -51,12 +52,12 @@ LD = $(CROSS)ld
 OBJCOPY = $(CROSS)objcopy\r
 \r
 # frontend\r
-OBJS += pandora.o main.o emu.o asm_utils.o platform/gp2x/menu.o platform/gp2x/usbjoy.o\r
+OBJS += pandora.o main.o emu.o asm_utils.o platform/gp2x/menu.o\r
 \r
 # common\r
 OBJS += platform/common/emu.o platform/common/menu.o platform/common/fonts.o platform/common/config.o \\r
-       platform/common/arm_utils.o platform/common/mp3_helix.o platform/common/arm_linux.o\r
-       # platform/common/readpng.o\r
+       platform/common/arm_utils.o platform/common/mp3_helix.o platform/common/arm_linux.o \\r
+       platform/common/readpng.o platform/linux/usbjoy.o platform/linux/sndout_oss.o\r
 \r
 # Pico\r
 ifeq "$(amalgamate)" "1"\r
@@ -120,7 +121,7 @@ endif
 vpath %.c = ../..\r
 vpath %.s = ../..\r
 vpath %.S = ../..\r
-DIRS = platform platform/gp2x platform/common pico pico/cd pico/pico pico/sound pico/carthw/svp \\r
+DIRS = platform platform/gp2x platform/linux platform/common pico pico/cd pico/pico pico/sound pico/carthw/svp \\r
        zlib unzip cpu cpu/musashi cpu/Cyclone/proj cpu/Cyclone/tools cpu/mz80 cpu/DrZ80\r
 \r
 \r
@@ -130,7 +131,7 @@ include ../common/common_arm.mak
 \r
 PicoDrive : $(OBJS) ../common/helix/$(CROSS)helix-mp3.a\r
        @echo ">>>" $@\r
-       $(CC) -o $@ $(CFLAGS) $^ -lm -Wl,-Map=PicoDrive.map # -lpng\r
+       $(CC) -o $@ $(CFLAGS) $^ -lm -Wl,-Map=PicoDrive.map -lpng -L$(LIBROOT)/lib\r
 ifeq ($(DEBUG),)\r
        $(STRIP) $@\r
 endif\r
index a749836..f12bac6 100644 (file)
 #include <stdarg.h>\r
 \r
 #include "../gp2x/emu.h"\r
-#include "../gp2x/usbjoy.h"\r
 #include "../gp2x/menu.h"\r
 #include "../common/arm_utils.h"\r
 #include "../common/fonts.h"\r
 #include "../common/emu.h"\r
 #include "../common/config.h"\r
 #include "../common/common.h"\r
+#include "../linux/usbjoy.h"\r
+#include "../linux/sndout_oss.h"\r
 #include "asm_utils.h"\r
 \r
 #include <pico/pico_int.h>\r
@@ -554,7 +555,7 @@ static void update_volume(int has_changed, int is_up)
                                if (vol >  0) vol--;\r
                        }\r
                        wait_frames = 0;\r
-                       gp2x_sound_volume(vol, vol);\r
+                       sndout_oss_setvol(vol, vol);\r
                        currentConfig.volume = vol;\r
                }\r
                sprintf(noticeMsg, "VOL: %02i", vol);\r
@@ -681,9 +682,9 @@ static void updateKeys(void)
        // add joy inputs\r
        if (num_of_joys > 0)\r
        {\r
-               gp2x_usbjoy_update();\r
+               usbjoy_update();\r
                for (joy = 0; joy < num_of_joys; joy++) {\r
-                       int btns = gp2x_usbjoy_check2(joy);\r
+                       int btns = usbjoy_check2(joy);\r
                        for (i = 0; i < 32; i++) {\r
                                if (btns & (1 << i)) {\r
                                        int acts = currentConfig.JoyBinds[joy][i];\r
@@ -729,7 +730,7 @@ static void updateSound(int len)
 \r
        /* avoid writing audio when lagging behind to prevent audio lag */\r
        if (PicoSkipFrame != 2)\r
-               gp2x_sound_write(PsndOut, len<<1);\r
+               sndout_oss_write(PsndOut, len<<1);\r
 }\r
 \r
 \r
@@ -833,8 +834,8 @@ void emu_Loop(void)
                snd_excess_add = ((PsndRate - PsndLen*target_fps)<<16) / target_fps;\r
                printf("starting audio: %i len: %i (ex: %04x) stereo: %i, pal: %i\n",\r
                        PsndRate, PsndLen, snd_excess_add, (PicoOpt&8)>>3, Pico.m.pal);\r
-               gp2x_start_sound(PsndRate, 16, (PicoOpt&8)>>3);\r
-               gp2x_sound_volume(currentConfig.volume, currentConfig.volume);\r
+               sndout_oss_start(PsndRate, 16, (PicoOpt&8)>>3);\r
+               sndout_oss_setvol(currentConfig.volume, currentConfig.volume);\r
                PicoWriteSound = updateSound;\r
                update_volume(0, 0);\r
                memset(sndBuffer, 0, sizeof(sndBuffer));\r
index dd73973..b72d8b6 100644 (file)
@@ -7,23 +7,20 @@
 #include <sys/mman.h>\r
 #include <sys/types.h>\r
 #include <sys/stat.h>\r
-#include <sys/ioctl.h>\r
-#include <sys/soundcard.h>\r
 #include <linux/fb.h>\r
 #include <fcntl.h>\r
 #include <errno.h>\r
 \r
 #include "../gp2x/gp2x.h"\r
-#include "../gp2x/usbjoy.h"\r
+#include "../linux/usbjoy.h"\r
+#include "../linux/sndout_oss.h"\r
 #include "../common/arm_linux.h"\r
 \r
 static volatile unsigned int *memregs = MAP_FAILED;\r
 //static\r
 int memdev = 0;\r
-static int fbdev = -1, sounddev = -1, mixerdev = -1, touchdev = -1;\r
-static int touchcal[7] = { 6203, 0, -1501397, 0, -4200, 16132680, 65536 };\r
+static int fbdev = -1;\r
 \r
-//#define SCREEN_MAP_SIZE (((800*(480+11)*2)+0xfff)&~0xfff)\r
 #define SCREEN_MAP_SIZE (800*480*2)\r
 static void *screen = MAP_FAILED;\r
 void *gp2x_screen;\r
@@ -98,14 +95,18 @@ unsigned long gp2x_joystick_read(int allow_usb_joy)
 \r
        if (allow_usb_joy && num_of_joys > 0) {\r
                // check the usb joy as well..\r
-               gp2x_usbjoy_update();\r
+               usbjoy_update();\r
                for (i = 0; i < num_of_joys; i++)\r
-                       value |= gp2x_usbjoy_check(i);\r
+                       value |= usbjoy_check(i);\r
        }\r
 \r
        return value;\r
 }\r
 \r
+// FIXME\r
+#if 0\r
+static int touchcal[7] = { 6203, 0, -1501397, 0, -4200, 16132680, 65536 };\r
+\r
 typedef struct ucb1x00_ts_event\r
 {\r
        unsigned short pressure;\r
@@ -137,73 +138,19 @@ int gp2x_touchpad_read(int *x, int *y)
 \r
        return zero_seen ? event.pressure : 0;\r
 }\r
-\r
-\r
-static int s_oldrate = 0, s_oldbits = 0, s_oldstereo = 0;\r
-\r
-void gp2x_start_sound(int rate, int bits, int stereo)\r
-{\r
-       int frag = 0, bsize, buffers;\r
-\r
-       // if no settings change, we don't need to do anything\r
-       if (rate == s_oldrate && s_oldbits == bits && s_oldstereo == stereo) return;\r
-\r
-       if (sounddev > 0) close(sounddev);\r
-       sounddev = open("/dev/dsp", O_WRONLY|O_ASYNC);\r
-       if (sounddev == -1)\r
-               printf("open(\"/dev/dsp\") failed with %i\n", errno);\r
-\r
-       ioctl(sounddev, SNDCTL_DSP_SETFMT, &bits);\r
-       ioctl(sounddev, SNDCTL_DSP_SPEED,  &rate);\r
-       ioctl(sounddev, SNDCTL_DSP_STEREO, &stereo);\r
-       // calculate buffer size\r
-       buffers = 16;\r
-       bsize = rate / 32;\r
-       if (rate > 22050) { bsize*=4; buffers*=2; } // 44k mode seems to be very demanding\r
-       while ((bsize>>=1)) frag++;\r
-       frag |= buffers<<16; // 16 buffers\r
-       ioctl(sounddev, SNDCTL_DSP_SETFRAGMENT, &frag);\r
-       usleep(192*1024);\r
-\r
-       printf("gp2x_set_sound: %i/%ibit/%s, %i buffers of %i bytes\n",\r
-               rate, bits, stereo?"stereo":"mono", frag>>16, 1<<(frag&0xffff));\r
-\r
-       s_oldrate = rate; s_oldbits = bits; s_oldstereo = stereo;\r
-}\r
-\r
-\r
-void gp2x_sound_write(void *buff, int len)\r
-{\r
-       write(sounddev, buff, len);\r
-}\r
-\r
-void gp2x_sound_sync(void)\r
-{\r
-//     ioctl(sounddev, SOUND_PCM_SYNC, 0);\r
-}\r
-\r
-void gp2x_sound_volume(int l, int r)\r
-{\r
-#if 0\r
-       l=l<0?0:l; l=l>255?255:l; r=r<0?0:r; r=r>255?255:r;\r
-       l<<=8; l|=r;\r
-       ioctl(mixerdev, SOUND_MIXER_WRITE_PCM, &l); /*SOUND_MIXER_WRITE_VOLUME*/\r
+#else\r
+int gp2x_touchpad_read(int *x, int *y) { return -1; }\r
 #endif\r
-}\r
-\r
 \r
 /* common */\r
 void gp2x_init(void)\r
 {\r
-       struct fb_fix_screeninfo fbfix;\r
-       int ret;\r
-\r
        printf("entering init()\n"); fflush(stdout);\r
 \r
        memdev = open("/dev/mem", O_RDWR);\r
        if (memdev == -1)\r
        {\r
-               printf("open(\"/dev/mem\") failed with %i\n", errno);\r
+               perror("open(\"/dev/mem\")");\r
                exit(1);\r
        }\r
 /*\r
@@ -217,73 +164,39 @@ void gp2x_init(void)
        fbdev = open("/dev/fb0", O_RDWR);\r
        if (fbdev == -1)\r
        {\r
-               printf("open(\"/dev/fb0\") failed with %i\n", errno);\r
-               exit(1);\r
-       }\r
-\r
-       ret = ioctl(fbdev, FBIOGET_FSCREENINFO, &fbfix);\r
-       if (ret == -1)\r
-       {\r
-               printf("ioctl(fbdev) failed with %i\n", errno);\r
+               perror("open(\"/dev/fb0\")");\r
                exit(1);\r
        }\r
 \r
-       // squidge hack\r
-       if (fbfix.line_length != 800*2)\r
-       {\r
-               gp2x_screen = malloc(800*640*2);\r
-               return;\r
-       }\r
-\r
        screen = mmap(0, SCREEN_MAP_SIZE, PROT_WRITE|PROT_READ, MAP_SHARED, fbdev, 0);\r
        if (screen == MAP_FAILED)\r
        {\r
-               printf("mmap(fbptr) failed with %i\n", errno);\r
+               perror("mmap(fbptr)");\r
                exit(1);\r
        }\r
        printf("fbptr %p\n", screen);\r
-//     gp2x_screen = (char *)screen + 800*10*2-64;\r
        gp2x_screen = screen;\r
 \r
-\r
        // snd\r
-       mixerdev = open("/dev/mixer", O_RDWR);\r
-       if (mixerdev == -1)\r
-               printf("open(\"/dev/mixer\") failed with %i\n", errno);\r
+       sndout_oss_init();\r
 \r
        /* init usb joys -GnoStiC */\r
-       gp2x_usbjoy_init();\r
-\r
-       // touchscreen\r
-       touchdev = open("/dev/touchscreen/wm97xx", O_RDONLY);\r
-       if (touchdev >= 0) {\r
-               FILE *pcf = fopen("/etc/pointercal", "r");\r
-               if (pcf) {\r
-                       fscanf(pcf, "%d %d %d %d %d %d %d", &touchcal[0], &touchcal[1],\r
-                               &touchcal[2], &touchcal[3], &touchcal[4], &touchcal[5], &touchcal[6]);\r
-                       fclose(pcf);\r
-               }\r
-               printf("found touchscreen/wm97xx\n");\r
-       }\r
+       usbjoy_init();\r
 \r
        printf("exitting init()\n"); fflush(stdout);\r
 }\r
 \r
 void gp2x_deinit(void)\r
 {\r
-       //gp2x_video_changemode(15);\r
-\r
        if (screen != MAP_FAILED)\r
                munmap(screen, SCREEN_MAP_SIZE);\r
        if (memregs != MAP_FAILED)\r
                munmap((void *)memregs, 0x10000);\r
        close(memdev);\r
        if (fbdev >= 0)    close(fbdev);\r
-       if (mixerdev >= 0) close(mixerdev);\r
-       if (sounddev >= 0) close(sounddev);\r
-       if (touchdev >= 0) close(touchdev);\r
 \r
-       gp2x_usbjoy_deinit();\r
+       sndout_oss_exit();\r
+       usbjoy_deinit();\r
 \r
        printf("all done");\r
 }\r
@@ -302,7 +215,6 @@ void lprintf(const char *fmt, ...)
 /* fake GP2X */\r
 int crashed_940 = 0;\r
 \r
-int readpng(void *dest, const char *fname, int what) { return -1; }\r
 void set_gamma(int g100, int A_SNs_curve) {}\r
 void set_FCLK(unsigned MHZ) {}\r
 void set_LCD_custom_rate(int rate) {}\r
index 015c320..a9acac7 100644 (file)
@@ -750,10 +750,10 @@ static void RunEventsPico(unsigned int events, unsigned int keys)
        if (pico_inp_mode != 0)
        {
                PicoPad[0] &= ~0x0f; // release UDLR
-               if (keys & BTN_UP)   { pico_pen_y--; if (pico_pen_y < 8) pico_pen_y = 8; }
-               if (keys & BTN_DOWN) { pico_pen_y++; if (pico_pen_y > 224-PICO_PEN_ADJUST_Y) pico_pen_y = 224-PICO_PEN_ADJUST_Y; }
-               if (keys & BTN_LEFT) { pico_pen_x--; if (pico_pen_x < 0) pico_pen_x = 0; }
-               if (keys & BTN_RIGHT) {
+               if (keys & PBTN_UP)   { pico_pen_y--; if (pico_pen_y < 8) pico_pen_y = 8; }
+               if (keys & PBTN_DOWN) { pico_pen_y++; if (pico_pen_y > 224-PICO_PEN_ADJUST_Y) pico_pen_y = 224-PICO_PEN_ADJUST_Y; }
+               if (keys & PBTN_LEFT) { pico_pen_x--; if (pico_pen_x < 0) pico_pen_x = 0; }
+               if (keys & PBTN_RIGHT) {
                        int lim = (Pico.video.reg[12]&1) ? 319 : 255;
                        pico_pen_x++;
                        if (pico_pen_x > lim-PICO_PEN_ADJUST_X)
@@ -779,10 +779,10 @@ static void RunEvents(unsigned int which)
                        int keys;
                        sceGuSync(0,0);
                        blit2("", (which & 0x1000) ? "LOAD STATE? (X=yes, O=no)" : "OVERWRITE SAVE? (X=yes, O=no)", 0);
-                       while( !((keys = psp_pad_read(1)) & (BTN_X|BTN_CIRCLE)) )
+                       while( !((keys = psp_pad_read(1)) & (PBTN_X|PBTN_CIRCLE)) )
                                psp_msleep(50);
-                       if (keys & BTN_CIRCLE) do_it = 0;
-                       while(  ((keys = psp_pad_read(1)) & (BTN_X|BTN_CIRCLE)) ) // wait for release
+                       if (keys & PBTN_CIRCLE) do_it = 0;
+                       while(  ((keys = psp_pad_read(1)) & (PBTN_X|PBTN_CIRCLE)) ) // wait for release
                                psp_msleep(50);
                        clearArea(0);
                }
@@ -836,7 +836,7 @@ static void updateKeys(void)
        if (keys & PSP_CTRL_HOME)
                sceDisplayWaitVblankStart();
 
-       if (keys & BTN_SELECT)
+       if (keys & PBTN_SELECT)
                engineState = PGS_Menu;
 
        keys &= CONFIGURABLE_KEYS;
index 6fe06ae..68b55b4 100644 (file)
@@ -80,14 +80,14 @@ unsigned long wait_for_input(unsigned int interesting, int is_key_config)
 
        if (!is_key_config)
                ret |= (ret & 0xf0000000) >> 24; // use analog as d-pad
-       if (wait > 6 && (ret&(BTN_UP|BTN_LEFT|BTN_DOWN|BTN_RIGHT|BTN_L|BTN_R)))
+       if (wait > 6 && (ret&(PBTN_UP|PBTN_LEFT|PBTN_DOWN|PBTN_RIGHT|PBTN_L|PBTN_R)))
                wait = 6;
 
        // we don't need diagonals in menus
-       if ((ret&BTN_UP)   && (ret&BTN_LEFT))  ret &= ~BTN_LEFT;
-       if ((ret&BTN_UP)   && (ret&BTN_RIGHT)) ret &= ~BTN_RIGHT;
-       if ((ret&BTN_DOWN) && (ret&BTN_LEFT))  ret &= ~BTN_LEFT;
-       if ((ret&BTN_DOWN) && (ret&BTN_RIGHT)) ret &= ~BTN_RIGHT;
+       if ((ret&PBTN_UP)   && (ret&PBTN_LEFT))  ret &= ~PBTN_LEFT;
+       if ((ret&PBTN_UP)   && (ret&PBTN_RIGHT)) ret &= ~PBTN_RIGHT;
+       if ((ret&PBTN_DOWN) && (ret&PBTN_LEFT))  ret &= ~PBTN_LEFT;
+       if ((ret&PBTN_DOWN) && (ret&PBTN_RIGHT)) ret &= ~PBTN_RIGHT;
 
        return ret;
 }
@@ -384,14 +384,14 @@ static char *romsel_loop(char *curr_path)
        for (;;)
        {
                draw_dirlist(curr_path, namelist, n, sel);
-               inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT|BTN_L|BTN_R|BTN_X|BTN_CIRCLE, 0);
-               if(inp & BTN_UP  )  { sel--;   if (sel < 0)   sel = n-2; }
-               if(inp & BTN_DOWN)  { sel++;   if (sel > n-2) sel = 0; }
-               if(inp & BTN_LEFT)  { sel-=10; if (sel < 0)   sel = 0; }
-               if(inp & BTN_L)     { sel-=24; if (sel < 0)   sel = 0; }
-               if(inp & BTN_RIGHT) { sel+=10; if (sel > n-2) sel = n-2; }
-               if(inp & BTN_R)     { sel+=24; if (sel > n-2) sel = n-2; }
-               if(inp & BTN_CIRCLE) // enter dir/select
+               inp = wait_for_input(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT|PBTN_L|PBTN_R|PBTN_X|PBTN_CIRCLE, 0);
+               if(inp & PBTN_UP  )  { sel--;   if (sel < 0)   sel = n-2; }
+               if(inp & PBTN_DOWN)  { sel++;   if (sel > n-2) sel = 0; }
+               if(inp & PBTN_LEFT)  { sel-=10; if (sel < 0)   sel = 0; }
+               if(inp & PBTN_L)     { sel-=24; if (sel < 0)   sel = 0; }
+               if(inp & PBTN_RIGHT) { sel+=10; if (sel > n-2) sel = n-2; }
+               if(inp & PBTN_R)     { sel+=24; if (sel > n-2) sel = n-2; }
+               if(inp & PBTN_CIRCLE) // enter dir/select
                {
                        if (namelist[sel+1]->d_type & FIO_S_IFDIR)
                        {
@@ -424,7 +424,7 @@ static char *romsel_loop(char *curr_path)
                                break;
                        }
                }
-               if(inp & BTN_X) break; // cancel
+               if(inp & PBTN_X) break; // cancel
        }
 
        if (n > 0) {
@@ -469,17 +469,17 @@ static void patches_menu_loop(void)
        for(;;)
        {
                draw_patchlist(menu_sel);
-               inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT|BTN_L|BTN_R|BTN_X|BTN_CIRCLE, 0);
-               if(inp & BTN_UP  ) { menu_sel--; if (menu_sel < 0) menu_sel = PicoPatchCount; }
-               if(inp & BTN_DOWN) { menu_sel++; if (menu_sel > PicoPatchCount) menu_sel = 0; }
-               if(inp &(BTN_LEFT|BTN_L))  { menu_sel-=10; if (menu_sel < 0) menu_sel = 0; }
-               if(inp &(BTN_RIGHT|BTN_R)) { menu_sel+=10; if (menu_sel > PicoPatchCount) menu_sel = PicoPatchCount; }
-               if(inp & BTN_CIRCLE) { // action
+               inp = wait_for_input(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT|PBTN_L|PBTN_R|PBTN_X|PBTN_CIRCLE, 0);
+               if(inp & PBTN_UP  ) { menu_sel--; if (menu_sel < 0) menu_sel = PicoPatchCount; }
+               if(inp & PBTN_DOWN) { menu_sel++; if (menu_sel > PicoPatchCount) menu_sel = 0; }
+               if(inp &(PBTN_LEFT|PBTN_L))  { menu_sel-=10; if (menu_sel < 0) menu_sel = 0; }
+               if(inp &(PBTN_RIGHT|PBTN_R)) { menu_sel+=10; if (menu_sel > PicoPatchCount) menu_sel = PicoPatchCount; }
+               if(inp & PBTN_CIRCLE) { // action
                        if (menu_sel < PicoPatchCount)
                                PicoPatches[menu_sel].active = !PicoPatches[menu_sel].active;
                        else    return;
                }
-               if(inp & BTN_X) return;
+               if(inp & PBTN_X) return;
        }
 
 }
@@ -599,18 +599,18 @@ static int savestate_menu_loop(int is_loading)
        for(;;)
        {
                draw_savestate_menu(menu_sel, is_loading);
-               inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_X|BTN_CIRCLE, 0);
-               if(inp & BTN_UP  ) {
+               inp = wait_for_input(PBTN_UP|PBTN_DOWN|PBTN_X|PBTN_CIRCLE, 0);
+               if(inp & PBTN_UP  ) {
                        do {
                                menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max;
                        } while (!(state_slot_flags & (1 << menu_sel)) && menu_sel != menu_sel_max && is_loading);
                }
-               if(inp & BTN_DOWN) {
+               if(inp & PBTN_DOWN) {
                        do {
                                menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0;
                        } while (!(state_slot_flags & (1 << menu_sel)) && menu_sel != menu_sel_max && is_loading);
                }
-               if(inp & BTN_CIRCLE) { // save/load
+               if(inp & PBTN_CIRCLE) { // save/load
                        if (menu_sel < 10) {
                                state_slot = menu_sel;
                                PicoStateProgressCB = emu_msg_cb; /* also suitable for menu */
@@ -621,7 +621,7 @@ static int savestate_menu_loop(int is_loading)
                                return 0;
                        } else  return 1;
                }
-               if(inp & BTN_X) return 1;
+               if(inp & PBTN_X) return 1;
        }
 }
 
@@ -713,22 +713,22 @@ static void key_config_loop(const me_bind_action *opts, int opt_cnt, int player_
        for (;;)
        {
                draw_key_config(opts, opt_cnt, player_idx, sel);
-               inp = wait_for_input(CONFIGURABLE_KEYS|BTN_SELECT, 1);
-               if (!(inp & BTN_SELECT)) {
+               inp = wait_for_input(CONFIGURABLE_KEYS|PBTN_SELECT, 1);
+               if (!(inp & PBTN_SELECT)) {
                        prev_select = 0;
-                       if(inp & BTN_UP  ) { sel--; if (sel < 0) sel = menu_sel_max; continue; }
-                       if(inp & BTN_DOWN) { sel++; if (sel > menu_sel_max) sel = 0; continue; }
+                       if(inp & PBTN_UP  ) { sel--; if (sel < 0) sel = menu_sel_max; continue; }
+                       if(inp & PBTN_DOWN) { sel++; if (sel > menu_sel_max) sel = 0; continue; }
                }
                if (sel >= opt_cnt) {
-                       if (inp & (BTN_X|BTN_CIRCLE)) break;
+                       if (inp & (PBTN_X|PBTN_CIRCLE)) break;
                        else continue;
                }
                // if we are here, we want to bind/unbind something
-               if ((inp & BTN_SELECT) && !prev_select)
+               if ((inp & PBTN_SELECT) && !prev_select)
                        unbind_action(opts[sel].mask);
-               prev_select = inp & BTN_SELECT;
+               prev_select = inp & PBTN_SELECT;
                inp &= CONFIGURABLE_KEYS;
-               inp &= ~BTN_SELECT;
+               inp &= ~PBTN_SELECT;
                for (i = 0; i < 32; i++)
                        if (inp & (1 << i)) {
                                if (count_bound_keys(opts[sel].mask, player_idx) >= 2)
@@ -795,13 +795,13 @@ static void kc_sel_loop(void)
        while (1)
        {
                draw_kc_sel(menu_sel);
-               inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT|BTN_X|BTN_CIRCLE, 0);
+               inp = wait_for_input(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT|PBTN_X|PBTN_CIRCLE, 0);
                selected_id = me_index2id(ctrlopt_entries, CTRLOPT_ENTRY_COUNT, menu_sel);
-               if (inp & (BTN_LEFT|BTN_RIGHT)) // multi choise
-                       me_process(ctrlopt_entries, CTRLOPT_ENTRY_COUNT, selected_id, (inp&BTN_RIGHT) ? 1 : 0);
-               if (inp & BTN_UP  ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }
-               if (inp & BTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
-               if (inp & BTN_CIRCLE) {
+               if (inp & (PBTN_LEFT|PBTN_RIGHT)) // multi choise
+                       me_process(ctrlopt_entries, CTRLOPT_ENTRY_COUNT, selected_id, (inp&PBTN_RIGHT) ? 1 : 0);
+               if (inp & PBTN_UP  ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }
+               if (inp & PBTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
+               if (inp & PBTN_CIRCLE) {
                        int is_6button = PicoOpt & POPT_6BTN_PAD;
                        switch (selected_id) {
                                case MA_CTRL_PLAYER1: key_config_loop(me_ctrl_actions, is_6button ? 15 : 11, 0); return;
@@ -812,7 +812,7 @@ static void kc_sel_loop(void)
                                default: return;
                        }
                }
-               if (inp & BTN_X) return;
+               if (inp & PBTN_X) return;
        }
 }
 
@@ -918,14 +918,14 @@ static void cd_menu_loop_options(void)
        for (;;)
        {
                draw_cd_menu_options(menu_sel, &bios_names);
-               inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT|BTN_X|BTN_CIRCLE|BTN_START, 0);
-               if (inp & BTN_UP  ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }
-               if (inp & BTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
+               inp = wait_for_input(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT|PBTN_X|PBTN_CIRCLE|PBTN_START, 0);
+               if (inp & PBTN_UP  ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }
+               if (inp & PBTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
                selected_id = me_index2id(cdopt_entries, CDOPT_ENTRY_COUNT, menu_sel);
-               if (inp & (BTN_LEFT|BTN_RIGHT)) { // multi choise
-                       if (!me_process(cdopt_entries, CDOPT_ENTRY_COUNT, selected_id, (inp&BTN_RIGHT) ? 1 : 0) &&
+               if (inp & (PBTN_LEFT|PBTN_RIGHT)) { // multi choise
+                       if (!me_process(cdopt_entries, CDOPT_ENTRY_COUNT, selected_id, (inp&PBTN_RIGHT) ? 1 : 0) &&
                            selected_id == MA_CDOPT_READAHEAD) {
-                               if (inp & BTN_LEFT) {
+                               if (inp & PBTN_LEFT) {
                                        PicoCDBuffers >>= 1;
                                        if (PicoCDBuffers < 2) PicoCDBuffers = 0;
                                } else {
@@ -935,12 +935,12 @@ static void cd_menu_loop_options(void)
                                }
                        }
                }
-               if (inp & BTN_CIRCLE) // toggleable options
+               if (inp & PBTN_CIRCLE) // toggleable options
                        if (!me_process(cdopt_entries, CDOPT_ENTRY_COUNT, selected_id, 1) &&
                            selected_id == MA_CDOPT_DONE) {
                                return;
                        }
-               if (inp & BTN_START) {
+               if (inp & PBTN_START) {
                        switch (selected_id) { // BIOS testers
                                case MA_CDOPT_TESTBIOS_USA:
                                        if (emu_findBios(4, &bios)) { // test US
@@ -967,7 +967,7 @@ static void cd_menu_loop_options(void)
                                        break;
                        }
                }
-               if (inp & BTN_X) return;
+               if (inp & PBTN_X) return;
        }
 }
 
@@ -1081,18 +1081,18 @@ static void dispmenu_loop_options(void)
        for (;;)
        {
                draw_dispmenu_options(menu_sel);
-               inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT|BTN_X|BTN_CIRCLE, 0);
-               if (inp & BTN_UP  ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }
-               if (inp & BTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
+               inp = wait_for_input(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT|PBTN_X|PBTN_CIRCLE, 0);
+               if (inp & PBTN_UP  ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }
+               if (inp & PBTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
                selected_id = me_index2id(opt3_entries, OPT3_ENTRY_COUNT, menu_sel);
                if (selected_id == MA_OPT3_HSCALE40 &&  is_32col) { is_32col = 0; menu_opt3_preview(is_32col); }
                if (selected_id == MA_OPT3_HSCALE32 && !is_32col) { is_32col = 1; menu_opt3_preview(is_32col); }
 
-               if (inp & (BTN_LEFT|BTN_RIGHT)) // multi choise
+               if (inp & (PBTN_LEFT|PBTN_RIGHT)) // multi choise
                {
                        float *setting = NULL;
                        int tmp;
-                       me_process(opt3_entries, OPT3_ENTRY_COUNT, selected_id, (inp&BTN_RIGHT) ? 1 : 0);
+                       me_process(opt3_entries, OPT3_ENTRY_COUNT, selected_id, (inp&PBTN_RIGHT) ? 1 : 0);
                        switch (selected_id) {
                                case MA_OPT3_SCALE:     setting = &currentConfig.scale; break;
                                case MA_OPT3_HSCALE40:  setting = &currentConfig.hscale40; is_32col = 0; break;
@@ -1102,7 +1102,7 @@ static void dispmenu_loop_options(void)
                                case MA_OPT3_BLACKLVL:  menu_opt3_preview(is_32col); break;
                                case MA_OPT3_VSYNC:
                                        tmp = ((currentConfig.EmuOpt>>13)&1) | ((currentConfig.EmuOpt>>15)&2);
-                                       tmp = (inp & BTN_LEFT) ? (tmp>>1) : ((tmp<<1)|1);
+                                       tmp = (inp & PBTN_LEFT) ? (tmp>>1) : ((tmp<<1)|1);
                                        if (tmp > 3) tmp = 3;
                                        currentConfig.EmuOpt &= ~0x12000;
                                        currentConfig.EmuOpt |= ((tmp&2)<<15) | ((tmp&1)<<13);
@@ -1110,15 +1110,15 @@ static void dispmenu_loop_options(void)
                                default: break;
                        }
                        if (setting != NULL) {
-                               while ((inp = psp_pad_read(0)) & (BTN_LEFT|BTN_RIGHT)) {
-                                       *setting += (inp & BTN_LEFT) ? -0.01 : 0.01;
+                               while ((inp = psp_pad_read(0)) & (PBTN_LEFT|PBTN_RIGHT)) {
+                                       *setting += (inp & PBTN_LEFT) ? -0.01 : 0.01;
                                        if (*setting <= 0) *setting = 0.01;
                                        menu_opt3_preview(is_32col);
                                        draw_dispmenu_options(menu_sel); // will wait vsync
                                }
                        }
                }
-               if (inp & BTN_CIRCLE) { // toggleable options
+               if (inp & PBTN_CIRCLE) { // toggleable options
                        me_process(opt3_entries, OPT3_ENTRY_COUNT, selected_id, 1);
                        switch (selected_id) {
                                case MA_OPT3_DONE:
@@ -1145,7 +1145,7 @@ static void dispmenu_loop_options(void)
                                default: break;
                        }
                }
-               if (inp & BTN_X) return;
+               if (inp & PBTN_X) return;
        }
 }
 
@@ -1195,23 +1195,23 @@ static void amenu_loop_options(void)
        for(;;)
        {
                draw_amenu_options(menu_sel);
-               inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT|BTN_X|BTN_CIRCLE, 0);
-               if (inp & BTN_UP  ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }
-               if (inp & BTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
+               inp = wait_for_input(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT|PBTN_X|PBTN_CIRCLE, 0);
+               if (inp & PBTN_UP  ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }
+               if (inp & PBTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
                selected_id = me_index2id(opt2_entries, OPT2_ENTRY_COUNT, menu_sel);
-               if (inp & (BTN_LEFT|BTN_RIGHT)) { // multi choise
-                       if (!me_process(opt2_entries, OPT2_ENTRY_COUNT, selected_id, (inp&BTN_RIGHT) ? 1 : 0) &&
+               if (inp & (PBTN_LEFT|PBTN_RIGHT)) { // multi choise
+                       if (!me_process(opt2_entries, OPT2_ENTRY_COUNT, selected_id, (inp&PBTN_RIGHT) ? 1 : 0) &&
                            selected_id == MA_OPT2_GAMMA) {
                                // TODO?
                        }
                }
-               if (inp & BTN_CIRCLE) { // toggleable options
+               if (inp & PBTN_CIRCLE) { // toggleable options
                        if (!me_process(opt2_entries, OPT2_ENTRY_COUNT, selected_id, 1) &&
                            selected_id == MA_OPT2_DONE) {
                                return;
                        }
                }
-               if (inp & BTN_X) return;
+               if (inp & PBTN_X) return;
        }
 }
 
@@ -1375,12 +1375,12 @@ static int menu_loop_options(void)
        while (1)
        {
                draw_menu_options(menu_sel);
-               inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT|BTN_X|BTN_CIRCLE, 0);
-               if (inp & BTN_UP  ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }
-               if (inp & BTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
+               inp = wait_for_input(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT|PBTN_X|PBTN_CIRCLE, 0);
+               if (inp & PBTN_UP  ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }
+               if (inp & PBTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
                selected_id = me_index2id(opt_entries, OPT_ENTRY_COUNT, menu_sel);
-               if (inp & (BTN_LEFT|BTN_RIGHT)) { // multi choise
-                       if (!me_process(opt_entries, OPT_ENTRY_COUNT, selected_id, (inp&BTN_RIGHT) ? 1 : 0)) {
+               if (inp & (PBTN_LEFT|PBTN_RIGHT)) { // multi choise
+                       if (!me_process(opt_entries, OPT_ENTRY_COUNT, selected_id, (inp&PBTN_RIGHT) ? 1 : 0)) {
                                switch (selected_id) {
                                        case MA_OPT_RENDERER:
                                                if ((PicoOpt & 0x10) || !(currentConfig.EmuOpt & 0x80)) {
@@ -1392,14 +1392,14 @@ static int menu_loop_options(void)
                                                }
                                                break;
                                        case MA_OPT_SOUND_QUALITY:
-                                               PsndRate = sndrate_prevnext(PsndRate, inp & BTN_RIGHT);
+                                               PsndRate = sndrate_prevnext(PsndRate, inp & PBTN_RIGHT);
                                                break;
                                        case MA_OPT_REGION:
-                                               region_prevnext(inp & BTN_RIGHT);
+                                               region_prevnext(inp & PBTN_RIGHT);
                                                break;
                                        case MA_OPT_CONFIRM_STATES: {
                                                         int n = ((currentConfig.EmuOpt>>9)&1) | ((currentConfig.EmuOpt>>10)&2);
-                                                        n += (inp & BTN_LEFT) ? -1 : 1;
+                                                        n += (inp & PBTN_LEFT) ? -1 : 1;
                                                         if (n < 0) n = 0; else if (n > 3) n = 3;
                                                         n |= n << 1; n &= ~2;
                                                         currentConfig.EmuOpt &= ~0xa00;
@@ -1407,14 +1407,14 @@ static int menu_loop_options(void)
                                                         break;
                                                 }
                                        case MA_OPT_SAVE_SLOT:
-                                                if (inp & BTN_RIGHT) {
+                                                if (inp & PBTN_RIGHT) {
                                                         state_slot++; if (state_slot > 9) state_slot = 0;
                                                 } else {state_slot--; if (state_slot < 0) state_slot = 9;
                                                 }
                                                 break;
                                        case MA_OPT_CPU_CLOCKS:
-                                                while ((inp = psp_pad_read(0)) & (BTN_LEFT|BTN_RIGHT)) {
-                                                        currentConfig.CPUclock += (inp & BTN_LEFT) ? -1 : 1;
+                                                while ((inp = psp_pad_read(0)) & (PBTN_LEFT|PBTN_RIGHT)) {
+                                                        currentConfig.CPUclock += (inp & PBTN_LEFT) ? -1 : 1;
                                                         if (currentConfig.CPUclock <  19) currentConfig.CPUclock = 19;
                                                         if (currentConfig.CPUclock > 333) currentConfig.CPUclock = 333;
                                                         draw_menu_options(menu_sel); // will wait vsync
@@ -1423,7 +1423,7 @@ static int menu_loop_options(void)
                                        case MA_OPT_SAVECFG:
                                        case MA_OPT_SAVECFG_GAME:
                                        case MA_OPT_LOADCFG:
-                                                config_slot += (inp&BTN_RIGHT) ? 1 : -1;
+                                                config_slot += (inp&PBTN_RIGHT) ? 1 : -1;
                                                 if (config_slot > 9) config_slot = 0;
                                                 if (config_slot < 0) config_slot = 9;
                                                 me_enable(opt_entries, OPT_ENTRY_COUNT, MA_OPT_LOADCFG, config_slot != config_slot_current);
@@ -1436,7 +1436,7 @@ static int menu_loop_options(void)
                                }
                        }
                }
-               if (inp & BTN_CIRCLE) {
+               if (inp & PBTN_CIRCLE) {
                        if (!me_process(opt_entries, OPT_ENTRY_COUNT, selected_id, 1))
                        {
                                switch (selected_id)
@@ -1474,7 +1474,7 @@ static int menu_loop_options(void)
                                }
                        }
                }
-               if(inp & BTN_X) {
+               if(inp & PBTN_X) {
                        menu_options_save();
                        return 0;  // done (update, no write)
                }
@@ -1576,29 +1576,29 @@ static void menu_loop_root(void)
        /* make sure action buttons are not pressed on entering menu */
        draw_menu_root(menu_sel);
 
-       while (psp_pad_read(1) & (BTN_X|BTN_CIRCLE|BTN_SELECT)) psp_msleep(50);
+       while (psp_pad_read(1) & (PBTN_X|PBTN_CIRCLE|PBTN_SELECT)) psp_msleep(50);
 
        for (;;)
        {
                draw_menu_root(menu_sel);
-               inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_X|BTN_CIRCLE|BTN_SELECT|BTN_L|BTN_R, 0);
-               if(inp & BTN_UP  )  { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }
-               if(inp & BTN_DOWN)  { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
-               if((inp & (BTN_L|BTN_R)) == (BTN_L|BTN_R)) debug_menu_loop();
-               if( inp & (BTN_SELECT|BTN_X)) {
+               inp = wait_for_input(PBTN_UP|PBTN_DOWN|PBTN_X|PBTN_CIRCLE|PBTN_SELECT|PBTN_L|PBTN_R, 0);
+               if(inp & PBTN_UP  )  { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }
+               if(inp & PBTN_DOWN)  { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
+               if((inp & (PBTN_L|PBTN_R)) == (PBTN_L|PBTN_R)) debug_menu_loop();
+               if( inp & (PBTN_SELECT|PBTN_X)) {
                        if (rom_loaded) {
-                               while (psp_pad_read(1) & (BTN_SELECT|BTN_X)) psp_msleep(50); // wait until released
+                               while (psp_pad_read(1) & (PBTN_SELECT|PBTN_X)) psp_msleep(50); // wait until released
                                engineState = PGS_Running;
                                break;
                        }
                }
-               if(inp & BTN_CIRCLE)  {
+               if(inp & PBTN_CIRCLE)  {
                        menuErrorMsg[0] = 0; // clear error msg
                        switch (me_index2id(main_entries, MAIN_ENTRY_COUNT, menu_sel))
                        {
                                case MA_MAIN_RESUME_GAME:
                                        if (rom_loaded) {
-                                               while (psp_pad_read(1) & BTN_CIRCLE) psp_msleep(50);
+                                               while (psp_pad_read(1) & PBTN_CIRCLE) psp_msleep(50);
                                                engineState = PGS_Running;
                                                return;
                                        }
@@ -1615,7 +1615,7 @@ static void menu_loop_root(void)
                                        if (rom_loaded) {
                                                if(savestate_menu_loop(1))
                                                        continue;
-                                               while (psp_pad_read(1) & BTN_CIRCLE) psp_msleep(50);
+                                               while (psp_pad_read(1) & PBTN_CIRCLE) psp_msleep(50);
                                                engineState = PGS_Running;
                                                return;
                                        }
@@ -1623,7 +1623,7 @@ static void menu_loop_root(void)
                                case MA_MAIN_RESET_GAME:
                                        if (rom_loaded) {
                                                emu_ResetGame();
-                                               while (psp_pad_read(1) & BTN_CIRCLE) psp_msleep(50);
+                                               while (psp_pad_read(1) & PBTN_CIRCLE) psp_msleep(50);
                                                engineState = PGS_Running;
                                                return;
                                        }
@@ -1660,8 +1660,8 @@ static void menu_loop_root(void)
                                        draw_menu_credits();
                                        psp_msleep(500);
                                        inp = 0;
-                                       while (!(inp & (BTN_X|BTN_CIRCLE)))
-                                               inp = wait_for_input(BTN_X|BTN_CIRCLE, 0);
+                                       while (!(inp & (PBTN_X|PBTN_CIRCLE)))
+                                               inp = wait_for_input(PBTN_X|PBTN_CIRCLE, 0);
                                        break;
                                case MA_MAIN_EXIT:
                                        engineState = PGS_Quit;
@@ -1789,15 +1789,15 @@ int menu_loop_tray(void)
 
        /* make sure action buttons are not pressed on entering menu */
        draw_menu_tray(menu_sel);
-       while (psp_pad_read(1) & BTN_CIRCLE) psp_msleep(50);
+       while (psp_pad_read(1) & PBTN_CIRCLE) psp_msleep(50);
 
        for (;;)
        {
                draw_menu_tray(menu_sel);
-               inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_CIRCLE, 0);
-               if(inp & BTN_UP  )  { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }
-               if(inp & BTN_DOWN)  { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
-               if(inp & BTN_CIRCLE)  {
+               inp = wait_for_input(PBTN_UP|PBTN_DOWN|PBTN_CIRCLE, 0);
+               if(inp & PBTN_UP  )  { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }
+               if(inp & PBTN_DOWN)  { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
+               if(inp & PBTN_CIRCLE)  {
                        switch (menu_sel) {
                                case 0: // select image
                                        selfname = romsel_loop(curr_path);
index a36b2a4..24da1dc 100644 (file)
@@ -9,6 +9,6 @@ void menu_romload_prepare(const char *rom_name);
 void menu_romload_end(void);
 
 
-#define CONFIGURABLE_KEYS (BTN_UP|BTN_LEFT|BTN_RIGHT|BTN_DOWN|BTN_L|BTN_R|BTN_TRIANGLE|BTN_CIRCLE|BTN_X|BTN_SQUARE|BTN_START| \
-       BTN_NUB_UP|BTN_NUB_RIGHT|BTN_NUB_DOWN|BTN_NUB_LEFT|BTN_NOTE)
+#define CONFIGURABLE_KEYS (PBTN_UP|PBTN_LEFT|PBTN_RIGHT|PBTN_DOWN|PBTN_L|PBTN_R|PBTN_TRIANGLE|PBTN_CIRCLE|PBTN_X|PBTN_SQUARE|PBTN_START| \
+       PBTN_NUB_UP|PBTN_NUB_RIGHT|PBTN_NUB_DOWN|PBTN_NUB_LEFT|PBTN_NOTE)
 
index 1b1a1f5..9ddb952 100644 (file)
@@ -224,11 +224,11 @@ unsigned int psp_pad_read(int blocking)
        buttons = pad.Buttons;
 
        // analog..
-       buttons &= ~(BTN_NUB_UP|BTN_NUB_DOWN|BTN_NUB_LEFT|BTN_NUB_RIGHT);
-       if (pad.Lx < 128 - ANALOG_DEADZONE) buttons |= BTN_NUB_LEFT;
-       if (pad.Lx > 128 + ANALOG_DEADZONE) buttons |= BTN_NUB_RIGHT;
-       if (pad.Ly < 128 - ANALOG_DEADZONE) buttons |= BTN_NUB_UP;
-       if (pad.Ly > 128 + ANALOG_DEADZONE) buttons |= BTN_NUB_DOWN;
+       buttons &= ~(PBTN_NUB_UP|PBTN_NUB_DOWN|PBTN_NUB_LEFT|PBTN_NUB_RIGHT);
+       if (pad.Lx < 128 - ANALOG_DEADZONE) buttons |= PBTN_NUB_LEFT;
+       if (pad.Lx > 128 + ANALOG_DEADZONE) buttons |= PBTN_NUB_RIGHT;
+       if (pad.Ly < 128 - ANALOG_DEADZONE) buttons |= PBTN_NUB_UP;
+       if (pad.Ly > 128 + ANALOG_DEADZONE) buttons |= PBTN_NUB_DOWN;
 
        return buttons;
 }
index 7269863..ef12f59 100644 (file)
@@ -48,23 +48,23 @@ void psp_wait_suspend(void);
 void psp_resume_suspend(void);
 
 /* shorter btn names */
-#define BTN_UP       PSP_CTRL_UP
-#define BTN_LEFT     PSP_CTRL_LEFT
-#define BTN_RIGHT    PSP_CTRL_RIGHT
-#define BTN_DOWN     PSP_CTRL_DOWN
-#define BTN_L        PSP_CTRL_LTRIGGER
-#define BTN_R        PSP_CTRL_RTRIGGER
-#define BTN_TRIANGLE PSP_CTRL_TRIANGLE
-#define BTN_CIRCLE   PSP_CTRL_CIRCLE
-#define BTN_X        PSP_CTRL_CROSS
-#define BTN_SQUARE   PSP_CTRL_SQUARE
-#define BTN_SELECT   PSP_CTRL_SELECT
-#define BTN_START    PSP_CTRL_START
-#define BTN_NOTE     PSP_CTRL_NOTE // doesn't seem to work?
+#define PBTN_UP       PSP_CTRL_UP
+#define PBTN_LEFT     PSP_CTRL_LEFT
+#define PBTN_RIGHT    PSP_CTRL_RIGHT
+#define PBTN_DOWN     PSP_CTRL_DOWN
+#define PBTN_L        PSP_CTRL_LTRIGGER
+#define PBTN_R        PSP_CTRL_RTRIGGER
+#define PBTN_TRIANGLE PSP_CTRL_TRIANGLE
+#define PBTN_CIRCLE   PSP_CTRL_CIRCLE
+#define PBTN_X        PSP_CTRL_CROSS
+#define PBTN_SQUARE   PSP_CTRL_SQUARE
+#define PBTN_SELECT   PSP_CTRL_SELECT
+#define PBTN_START    PSP_CTRL_START
+#define PBTN_NOTE     PSP_CTRL_NOTE // doesn't seem to work?
 
 /* fake 'nub' btns */
-#define BTN_NUB_UP    (1 << 28)
-#define BTN_NUB_RIGHT (1 << 29)
-#define BTN_NUB_DOWN  (1 << 30)
-#define BTN_NUB_LEFT  (1 << 31)
+#define PBTN_NUB_UP    (1 << 28)
+#define PBTN_NUB_RIGHT (1 << 29)
+#define PBTN_NUB_DOWN  (1 << 30)
+#define PBTN_NUB_LEFT  (1 << 31)