mirror of
https://github.com/RaySollium99/libpicofe.git
synced 2025-09-05 14:57:46 -04:00
UI adjustments, nub support
git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@291 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
c93fb19e8f
commit
16e89bed91
10 changed files with 152 additions and 87 deletions
|
@ -9,7 +9,7 @@ typedef struct {
|
||||||
// squidgehack, no_save_cfg_on_exit, <unused>, 16_bit_mode
|
// squidgehack, no_save_cfg_on_exit, <unused>, 16_bit_mode
|
||||||
// craigix_ram, confirm_save, show_cd_leds, confirm_load
|
// craigix_ram, confirm_save, show_cd_leds, confirm_load
|
||||||
// A_SNs_gamma, perfect_vsync, giz_scanlines, giz_dblbuff
|
// A_SNs_gamma, perfect_vsync, giz_scanlines, giz_dblbuff
|
||||||
// vsync_mode
|
// vsync_mode, show_clock
|
||||||
int PicoOpt; // used for config saving only, see Pico.h
|
int PicoOpt; // used for config saving only, see Pico.h
|
||||||
int PsndRate; // ditto
|
int PsndRate; // ditto
|
||||||
int PicoRegion; // ditto
|
int PicoRegion; // ditto
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#define lprintf printf
|
#define lprintf printf
|
||||||
#elif defined(PSP)
|
#elif defined(PSP)
|
||||||
#if 1
|
#ifdef LPRINTF_STDIO
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#define lprintf printf
|
#define lprintf printf
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -63,6 +63,7 @@ typedef enum
|
||||||
MA_OPT2_NO_LAST_ROM,
|
MA_OPT2_NO_LAST_ROM,
|
||||||
MA_OPT2_RAMTIMINGS, /* gp2x */
|
MA_OPT2_RAMTIMINGS, /* gp2x */
|
||||||
MA_OPT2_SQUIDGEHACK, /* gp2x */
|
MA_OPT2_SQUIDGEHACK, /* gp2x */
|
||||||
|
MA_OPT2_STATUS_LINE, /* psp */
|
||||||
MA_OPT2_DONE,
|
MA_OPT2_DONE,
|
||||||
MA_OPT3_SCALE, /* psp (all OPT3) */
|
MA_OPT3_SCALE, /* psp (all OPT3) */
|
||||||
MA_OPT3_HSCALE32,
|
MA_OPT3_HSCALE32,
|
||||||
|
|
|
@ -10,7 +10,7 @@ amalgamate = 0
|
||||||
#up = 1
|
#up = 1
|
||||||
|
|
||||||
|
|
||||||
CFLAGS += -I../.. -I. -DNO_SYNC
|
CFLAGS += -I../.. -I. -DNO_SYNC -DLPRINTF_STDIO
|
||||||
CFLAGS += -Wall -Winline -G0
|
CFLAGS += -Wall -Winline -G0
|
||||||
ifeq ($(DEBUG),)
|
ifeq ($(DEBUG),)
|
||||||
CFLAGS += -O2 -ftracer -fstrength-reduce -ffast-math
|
CFLAGS += -O2 -ftracer -fstrength-reduce -ffast-math
|
||||||
|
@ -76,12 +76,12 @@ endif
|
||||||
OBJS += data/bg32.o data/bg40.o
|
OBJS += data/bg32.o data/bg40.o
|
||||||
|
|
||||||
|
|
||||||
LIBS += -lpng -lm -lpspgu -lpsppower -Wl,-Map=PicoDrive.map -lpspaudio
|
LIBS += -lpng -lm -lpspgu -lpsppower -lpspaudio -lpsprtc -Wl,-Map=PicoDrive.map
|
||||||
|
|
||||||
# target
|
# target
|
||||||
TARGET = PicoDrive
|
TARGET = PicoDrive
|
||||||
EXTRA_TARGETS = EBOOT.PBP
|
EXTRA_TARGETS = EBOOT.PBP
|
||||||
PSP_EBOOT_TITLE = PICODRIVE
|
PSP_EBOOT_TITLE = PicoDrive
|
||||||
PSP_EBOOT_ICON = data/icon.png
|
PSP_EBOOT_ICON = data/icon.png
|
||||||
#PSP_EBOOT_PIC1 = .png
|
#PSP_EBOOT_PIC1 = .png
|
||||||
|
|
||||||
|
|
29
psp/emu.c
29
psp/emu.c
|
@ -145,9 +145,15 @@ void emu_setDefaultConfig(void)
|
||||||
currentConfig.KeyBinds[12] = 1<<26; // switch rnd
|
currentConfig.KeyBinds[12] = 1<<26; // switch rnd
|
||||||
currentConfig.KeyBinds[ 8] = 1<<27; // save state
|
currentConfig.KeyBinds[ 8] = 1<<27; // save state
|
||||||
currentConfig.KeyBinds[ 9] = 1<<28; // load state
|
currentConfig.KeyBinds[ 9] = 1<<28; // load state
|
||||||
|
currentConfig.KeyBinds[28] = 1<<0; // num "buttons"
|
||||||
|
currentConfig.KeyBinds[30] = 1<<1;
|
||||||
|
currentConfig.KeyBinds[31] = 1<<2;
|
||||||
|
currentConfig.KeyBinds[29] = 1<<3;
|
||||||
currentConfig.PicoCDBuffers = 0;
|
currentConfig.PicoCDBuffers = 0;
|
||||||
currentConfig.scaling = 1; // bilinear filtering for psp
|
currentConfig.scaling = 1; // bilinear filtering for psp
|
||||||
currentConfig.scale = currentConfig.hscale32 = currentConfig.hscale40 = 1.0;
|
currentConfig.scale = 1.20; // fullscreen
|
||||||
|
currentConfig.hscale40 = 1.25;
|
||||||
|
currentConfig.hscale32 = 1.56;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -353,15 +359,13 @@ static void blitscreen_clut(void)
|
||||||
|
|
||||||
static void cd_leds(void)
|
static void cd_leds(void)
|
||||||
{
|
{
|
||||||
static int old_reg = 0;
|
unsigned int reg, col_g, col_r, *p;
|
||||||
unsigned int col_g, col_r, *p;
|
|
||||||
|
|
||||||
if (!((Pico_mcd->s68k_regs[0] ^ old_reg) & 3)) return; // no change
|
reg = Pico_mcd->s68k_regs[0];
|
||||||
old_reg = Pico_mcd->s68k_regs[0];
|
|
||||||
|
|
||||||
p = (unsigned int *)((short *)psp_screen + 512*2+4+2);
|
p = (unsigned int *)((short *)psp_screen + 512*2+4+2);
|
||||||
col_g = (old_reg & 2) ? 0x06000600 : 0;
|
col_g = (reg & 2) ? 0x06000600 : 0;
|
||||||
col_r = (old_reg & 1) ? 0x00180018 : 0;
|
col_r = (reg & 1) ? 0x00180018 : 0;
|
||||||
*p++ = col_g; *p++ = col_g; p+=2; *p++ = col_r; *p++ = col_r; p += 512/2 - 12/2;
|
*p++ = col_g; *p++ = col_g; p+=2; *p++ = col_r; *p++ = col_r; p += 512/2 - 12/2;
|
||||||
*p++ = col_g; *p++ = col_g; p+=2; *p++ = col_r; *p++ = col_r; p += 512/2 - 12/2;
|
*p++ = col_g; *p++ = col_g; p+=2; *p++ = col_r; *p++ = col_r; p += 512/2 - 12/2;
|
||||||
*p++ = col_g; *p++ = col_g; p+=2; *p++ = col_r; *p++ = col_r;
|
*p++ = col_g; *p++ = col_g; p+=2; *p++ = col_r; *p++ = col_r;
|
||||||
|
@ -798,23 +802,22 @@ static void find_combos(void)
|
||||||
if (act == 16 || act == 17) continue; // player2 flag
|
if (act == 16 || act == 17) continue; // player2 flag
|
||||||
if (act > 17)
|
if (act > 17)
|
||||||
{
|
{
|
||||||
for (u = 0; u < 32; u++)
|
for (u = 0; u < 28; u++) // 28 because nub can't produce combos
|
||||||
if (currentConfig.KeyBinds[u] & (1 << act)) keyc++;
|
if (currentConfig.KeyBinds[u] & (1 << act)) keyc++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (u = 0; u < 32; u++)
|
for (u = 0; u < 28; u++)
|
||||||
if ((currentConfig.KeyBinds[u] & 0x30000) == 0 && // pl. 1
|
if ((currentConfig.KeyBinds[u] & 0x30000) == 0 && // pl. 1
|
||||||
(currentConfig.KeyBinds[u] & (1 << act))) keyc++;
|
(currentConfig.KeyBinds[u] & (1 << act))) keyc++;
|
||||||
for (u = 0; u < 32; u++)
|
for (u = 0; u < 28; u++)
|
||||||
if ((currentConfig.KeyBinds[u] & 0x30000) == 1 && // pl. 2
|
if ((currentConfig.KeyBinds[u] & 0x30000) == 1 && // pl. 2
|
||||||
(currentConfig.KeyBinds[u] & (1 << act))) keyc2++;
|
(currentConfig.KeyBinds[u] & (1 << act))) keyc2++;
|
||||||
if (keyc2 > keyc) keyc = keyc2;
|
|
||||||
}
|
}
|
||||||
if (keyc > 1)
|
if (keyc > 1 || keyc2 > 1)
|
||||||
{
|
{
|
||||||
// loop again and mark those keys and actions as combo
|
// loop again and mark those keys and actions as combo
|
||||||
for (u = 0; u < 32; u++)
|
for (u = 0; u < 28; u++)
|
||||||
{
|
{
|
||||||
if (currentConfig.KeyBinds[u] & (1 << act)) {
|
if (currentConfig.KeyBinds[u] & (1 << act)) {
|
||||||
combo_keys |= 1 << u;
|
combo_keys |= 1 << u;
|
||||||
|
|
|
@ -4,9 +4,11 @@
|
||||||
#include "../common/menu.h"
|
#include "../common/menu.h"
|
||||||
#include "../common/emu.h"
|
#include "../common/emu.h"
|
||||||
#include "../common/lprintf.h"
|
#include "../common/lprintf.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
lprintf("\nPicoDrive v" VERSION " " __DATE__ " " __TIME__ "\n");
|
||||||
psp_init();
|
psp_init();
|
||||||
|
|
||||||
emu_ReadConfig(0, 0);
|
emu_ReadConfig(0, 0);
|
||||||
|
|
129
psp/menu.c
129
psp/menu.c
|
@ -36,7 +36,7 @@ static const char * const pspKeyNames[] = {
|
||||||
"SELECT", pspKeyUnkn, pspKeyUnkn, "START", "UP", "RIGHT", "DOWN", "LEFT",
|
"SELECT", pspKeyUnkn, pspKeyUnkn, "START", "UP", "RIGHT", "DOWN", "LEFT",
|
||||||
"L", "R", pspKeyUnkn, pspKeyUnkn, "TRIANGLE", "CIRCLE", "X", "SQUARE",
|
"L", "R", pspKeyUnkn, pspKeyUnkn, "TRIANGLE", "CIRCLE", "X", "SQUARE",
|
||||||
"HOME", "HOLD", "WLAN_UP", "REMOTE", "VOLUP", "VOLDOWN", "SCREEN", "NOTE",
|
"HOME", "HOLD", "WLAN_UP", "REMOTE", "VOLUP", "VOLDOWN", "SCREEN", "NOTE",
|
||||||
pspKeyUnkn, pspKeyUnkn, pspKeyUnkn, pspKeyUnkn, pspKeyUnkn, pspKeyUnkn, pspKeyUnkn, pspKeyUnkn
|
pspKeyUnkn, pspKeyUnkn, pspKeyUnkn, pspKeyUnkn, "NUB UP", "NUB RIGHT", "NUB DOWN", "NUB LEFT" // fake
|
||||||
};
|
};
|
||||||
|
|
||||||
static unsigned short bg_buffer[480*272] __attribute__((aligned(16)));
|
static unsigned short bg_buffer[480*272] __attribute__((aligned(16)));
|
||||||
|
@ -48,11 +48,14 @@ static void menu_prepare_bg(int use_game_bg, int use_fg);
|
||||||
|
|
||||||
static unsigned int inp_prev = 0;
|
static unsigned int inp_prev = 0;
|
||||||
|
|
||||||
static unsigned long wait_for_input(unsigned int interesting)
|
static unsigned long wait_for_input(unsigned int interesting, int is_key_config)
|
||||||
{
|
{
|
||||||
unsigned int ret;
|
unsigned int ret;
|
||||||
static int repeats = 0, wait = 50;
|
static int repeats = 0, wait = 50;
|
||||||
int release = 0, i;
|
int release = 0, count, i;
|
||||||
|
|
||||||
|
if (!is_key_config)
|
||||||
|
interesting |= (interesting & 0xf0) << 24; // also use analog
|
||||||
|
|
||||||
if (repeats == 2 || repeats == 4) wait /= 2;
|
if (repeats == 2 || repeats == 4) wait /= 2;
|
||||||
if (repeats == 6) wait = 15;
|
if (repeats == 6) wait = 15;
|
||||||
|
@ -62,7 +65,7 @@ static unsigned long wait_for_input(unsigned int interesting)
|
||||||
psp_msleep(wait);
|
psp_msleep(wait);
|
||||||
}
|
}
|
||||||
|
|
||||||
while ( !((ret = psp_pad_read(1)) & interesting) ) {
|
for (count = 0; !((ret = psp_pad_read(1)) & interesting) && count < 100; count++) {
|
||||||
psp_msleep(50);
|
psp_msleep(50);
|
||||||
release = 1;
|
release = 1;
|
||||||
}
|
}
|
||||||
|
@ -73,6 +76,9 @@ static unsigned long wait_for_input(unsigned int interesting)
|
||||||
}
|
}
|
||||||
inp_prev = ret;
|
inp_prev = ret;
|
||||||
|
|
||||||
|
if (!is_key_config)
|
||||||
|
ret |= (ret & 0xf0000000) >> 24; // use analog as d-pad
|
||||||
|
|
||||||
// we don't need diagonals in menus
|
// we don't need diagonals in menus
|
||||||
if ((ret&BTN_UP) && (ret&BTN_LEFT)) ret &= ~BTN_LEFT;
|
if ((ret&BTN_UP) && (ret&BTN_LEFT)) ret &= ~BTN_LEFT;
|
||||||
if ((ret&BTN_UP) && (ret&BTN_RIGHT)) ret &= ~BTN_RIGHT;
|
if ((ret&BTN_UP) && (ret&BTN_RIGHT)) ret &= ~BTN_RIGHT;
|
||||||
|
@ -350,14 +356,14 @@ static char *romsel_loop(char *curr_path)
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
draw_dirlist(curr_path, namelist, n, sel);
|
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);
|
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_UP ) { sel--; if (sel < 0) sel = n-2; }
|
||||||
if(inp & BTN_DOWN) { sel++; if (sel > n-2) sel = 0; }
|
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_LEFT) { sel-=10; if (sel < 0) sel = 0; }
|
||||||
if(inp & BTN_L) { sel-=24; 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_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_R) { sel+=24; if (sel > n-2) sel = n-2; }
|
||||||
if(inp & BTN_X) { // enter dir/select
|
if(inp & BTN_CIRCLE) { // enter dir/select
|
||||||
if (namelist[sel+1]->d_type & DT_REG) {
|
if (namelist[sel+1]->d_type & DT_REG) {
|
||||||
strcpy(romFileName, curr_path);
|
strcpy(romFileName, curr_path);
|
||||||
strcat(romFileName, "/");
|
strcat(romFileName, "/");
|
||||||
|
@ -386,7 +392,7 @@ static char *romsel_loop(char *curr_path)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(inp & BTN_CIRCLE) break; // cancel
|
if(inp & BTN_X) break; // cancel
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
|
@ -424,7 +430,7 @@ static void draw_debug(void)
|
||||||
static void debug_menu_loop(void)
|
static void debug_menu_loop(void)
|
||||||
{
|
{
|
||||||
draw_debug();
|
draw_debug();
|
||||||
wait_for_input(BTN_X|BTN_CIRCLE);
|
wait_for_input(BTN_X|BTN_CIRCLE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------ patch/gg menu ------------
|
// ------------ patch/gg menu ------------
|
||||||
|
@ -461,17 +467,17 @@ static void patches_menu_loop(void)
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
draw_patchlist(menu_sel);
|
draw_patchlist(menu_sel);
|
||||||
inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT|BTN_L|BTN_R|BTN_X|BTN_CIRCLE);
|
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_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_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_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_RIGHT|BTN_R)) { menu_sel+=10; if (menu_sel > PicoPatchCount) menu_sel = PicoPatchCount; }
|
||||||
if(inp & BTN_X) { // action
|
if(inp & BTN_CIRCLE) { // action
|
||||||
if (menu_sel < PicoPatchCount)
|
if (menu_sel < PicoPatchCount)
|
||||||
PicoPatches[menu_sel].active = !PicoPatches[menu_sel].active;
|
PicoPatches[menu_sel].active = !PicoPatches[menu_sel].active;
|
||||||
else return;
|
else return;
|
||||||
}
|
}
|
||||||
if(inp & BTN_CIRCLE) return;
|
if(inp & BTN_X) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -591,7 +597,7 @@ static int savestate_menu_loop(int is_loading)
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
draw_savestate_menu(menu_sel, is_loading);
|
draw_savestate_menu(menu_sel, is_loading);
|
||||||
inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_X|BTN_CIRCLE);
|
inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_X|BTN_CIRCLE, 0);
|
||||||
if(inp & BTN_UP ) {
|
if(inp & BTN_UP ) {
|
||||||
do {
|
do {
|
||||||
menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max;
|
menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max;
|
||||||
|
@ -602,7 +608,7 @@ static int savestate_menu_loop(int is_loading)
|
||||||
menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0;
|
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);
|
} while (!(state_slot_flags & (1 << menu_sel)) && menu_sel != menu_sel_max && is_loading);
|
||||||
}
|
}
|
||||||
if(inp & BTN_X) { // save/load
|
if(inp & BTN_CIRCLE) { // save/load
|
||||||
if (menu_sel < 10) {
|
if (menu_sel < 10) {
|
||||||
state_slot = menu_sel;
|
state_slot = menu_sel;
|
||||||
PicoStateProgressCB = emu_msg_cb; /* also suitable for menu */
|
PicoStateProgressCB = emu_msg_cb; /* also suitable for menu */
|
||||||
|
@ -613,7 +619,7 @@ static int savestate_menu_loop(int is_loading)
|
||||||
return 0;
|
return 0;
|
||||||
} else return 1;
|
} else return 1;
|
||||||
}
|
}
|
||||||
if(inp & BTN_CIRCLE) return 1;
|
if(inp & BTN_X) return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,7 +636,11 @@ static char *action_binds(int player_idx, int action_mask)
|
||||||
if (currentConfig.KeyBinds[i] & action_mask)
|
if (currentConfig.KeyBinds[i] & action_mask)
|
||||||
{
|
{
|
||||||
if (player_idx >= 0 && ((currentConfig.KeyBinds[i] >> 16) & 3) != player_idx) continue;
|
if (player_idx >= 0 && ((currentConfig.KeyBinds[i] >> 16) & 3) != player_idx) continue;
|
||||||
if (strkeys[0]) { strcat(strkeys, " + "); strcat(strkeys, pspKeyNames[i]); break; }
|
if (strkeys[0]) {
|
||||||
|
strcat(strkeys, i >= 28 ? ", " : " + "); // nub "buttons" don't create combos
|
||||||
|
strcat(strkeys, pspKeyNames[i]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
else strcpy(strkeys, pspKeyNames[i]);
|
else strcpy(strkeys, pspKeyNames[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -683,14 +693,14 @@ static void draw_key_config(const bind_action_t *opts, int opt_cnt, int player_i
|
||||||
text_out16(x, y, "Done");
|
text_out16(x, y, "Done");
|
||||||
|
|
||||||
if (sel < opt_cnt) {
|
if (sel < opt_cnt) {
|
||||||
text_out16(80+30, 180, "Press a button to bind/unbind");
|
text_out16(80+30, 220, "Press a button to bind/unbind");
|
||||||
text_out16(80+30, 190, "Use SELECT to clear");
|
text_out16(80+30, 230, "Use SELECT to clear");
|
||||||
text_out16(80+30, 200, "To bind UP/DOWN, hold SELECT");
|
text_out16(80+30, 240, "To bind UP/DOWN, hold SELECT");
|
||||||
text_out16(80+30, 210, "Select \"Done\" to exit");
|
text_out16(80+30, 250, "Select \"Done\" to exit");
|
||||||
} else {
|
} else {
|
||||||
text_out16(80+30, 190, "Use Options -> Save cfg");
|
text_out16(80+30, 230, "Use Options -> Save cfg");
|
||||||
text_out16(80+30, 200, "to save controls");
|
text_out16(80+30, 240, "to save controls");
|
||||||
text_out16(80+30, 210, "Press X or O to exit");
|
text_out16(80+30, 250, "Press X or O to exit");
|
||||||
}
|
}
|
||||||
menu_draw_end();
|
menu_draw_end();
|
||||||
}
|
}
|
||||||
|
@ -703,7 +713,7 @@ static void key_config_loop(const bind_action_t *opts, int opt_cnt, int player_i
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
draw_key_config(opts, opt_cnt, player_idx, sel);
|
draw_key_config(opts, opt_cnt, player_idx, sel);
|
||||||
inp = wait_for_input(CONFIGURABLE_KEYS|BTN_SELECT);
|
inp = wait_for_input(CONFIGURABLE_KEYS|BTN_SELECT, 1);
|
||||||
if (!(inp & BTN_SELECT)) {
|
if (!(inp & BTN_SELECT)) {
|
||||||
prev_select = 0;
|
prev_select = 0;
|
||||||
if(inp & BTN_UP ) { sel--; if (sel < 0) sel = menu_sel_max; continue; }
|
if(inp & BTN_UP ) { sel--; if (sel < 0) sel = menu_sel_max; continue; }
|
||||||
|
@ -776,8 +786,6 @@ static bind_action_t emuctrl_actions[] =
|
||||||
{ "Prev Save Slot ", 1<<25 },
|
{ "Prev Save Slot ", 1<<25 },
|
||||||
{ "Next Save Slot ", 1<<24 },
|
{ "Next Save Slot ", 1<<24 },
|
||||||
{ "Switch Renderer", 1<<26 },
|
{ "Switch Renderer", 1<<26 },
|
||||||
{ "Volume Down ", 1<<30 },
|
|
||||||
{ "Volume Up ", 1<<29 },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void kc_sel_loop(void)
|
static void kc_sel_loop(void)
|
||||||
|
@ -789,10 +797,10 @@ static void kc_sel_loop(void)
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
draw_kc_sel(menu_sel);
|
draw_kc_sel(menu_sel);
|
||||||
inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_X|BTN_CIRCLE);
|
inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_X|BTN_CIRCLE, 0);
|
||||||
if (inp & BTN_UP ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }
|
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_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
|
||||||
if (inp & BTN_X) {
|
if (inp & BTN_CIRCLE) {
|
||||||
switch (menu_sel) {
|
switch (menu_sel) {
|
||||||
case 0: key_config_loop(ctrl_actions, is_6button ? 12 : 8, 0); return;
|
case 0: key_config_loop(ctrl_actions, is_6button ? 12 : 8, 0); return;
|
||||||
case 1: key_config_loop(ctrl_actions, is_6button ? 12 : 8, 1); return;
|
case 1: key_config_loop(ctrl_actions, is_6button ? 12 : 8, 1); return;
|
||||||
|
@ -802,7 +810,7 @@ static void kc_sel_loop(void)
|
||||||
default: return;
|
default: return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (inp & BTN_CIRCLE) return;
|
if (inp & BTN_X) return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -870,7 +878,7 @@ static void draw_cd_menu_options(int menu_sel, struct bios_names_t *bios_names)
|
||||||
if ((selected_id == MA_CDOPT_TESTBIOS_USA && strcmp(bios_names->us, "NOT FOUND")) ||
|
if ((selected_id == MA_CDOPT_TESTBIOS_USA && strcmp(bios_names->us, "NOT FOUND")) ||
|
||||||
(selected_id == MA_CDOPT_TESTBIOS_EUR && strcmp(bios_names->eu, "NOT FOUND")) ||
|
(selected_id == MA_CDOPT_TESTBIOS_EUR && strcmp(bios_names->eu, "NOT FOUND")) ||
|
||||||
(selected_id == MA_CDOPT_TESTBIOS_JAP && strcmp(bios_names->jp, "NOT FOUND")))
|
(selected_id == MA_CDOPT_TESTBIOS_JAP && strcmp(bios_names->jp, "NOT FOUND")))
|
||||||
text_out16(tl_x, 210, "Press start to test selected BIOS");
|
text_out16(tl_x, 250, "Press start to test selected BIOS");
|
||||||
|
|
||||||
menu_draw_end();
|
menu_draw_end();
|
||||||
}
|
}
|
||||||
|
@ -902,7 +910,7 @@ static void cd_menu_loop_options(void)
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
draw_cd_menu_options(menu_sel, &bios_names);
|
draw_cd_menu_options(menu_sel, &bios_names);
|
||||||
inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT|BTN_X|BTN_CIRCLE);
|
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_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_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
|
||||||
selected_id = me_index2id(cdopt_entries, CDOPT_ENTRY_COUNT, menu_sel);
|
selected_id = me_index2id(cdopt_entries, CDOPT_ENTRY_COUNT, menu_sel);
|
||||||
|
@ -919,7 +927,7 @@ static void cd_menu_loop_options(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (inp & BTN_X) { // toggleable options
|
if (inp & BTN_CIRCLE) { // toggleable options
|
||||||
if (!me_process(cdopt_entries, CDOPT_ENTRY_COUNT, selected_id, 1) &&
|
if (!me_process(cdopt_entries, CDOPT_ENTRY_COUNT, selected_id, 1) &&
|
||||||
selected_id == MA_CDOPT_DONE) {
|
selected_id == MA_CDOPT_DONE) {
|
||||||
return;
|
return;
|
||||||
|
@ -950,7 +958,7 @@ static void cd_menu_loop_options(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (inp & BTN_CIRCLE) return;
|
if (inp & BTN_X) return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1054,7 +1062,7 @@ static void dispmenu_loop_options(void)
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
draw_dispmenu_options(menu_sel);
|
draw_dispmenu_options(menu_sel);
|
||||||
inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT|BTN_X|BTN_CIRCLE);
|
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_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_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
|
||||||
selected_id = me_index2id(opt3_entries, OPT3_ENTRY_COUNT, menu_sel);
|
selected_id = me_index2id(opt3_entries, OPT3_ENTRY_COUNT, menu_sel);
|
||||||
|
@ -1087,7 +1095,7 @@ static void dispmenu_loop_options(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (inp & BTN_X) { // toggleable options
|
if (inp & BTN_CIRCLE) { // toggleable options
|
||||||
me_process(opt3_entries, OPT3_ENTRY_COUNT, selected_id, 1);
|
me_process(opt3_entries, OPT3_ENTRY_COUNT, selected_id, 1);
|
||||||
switch (selected_id) {
|
switch (selected_id) {
|
||||||
case MA_OPT3_DONE:
|
case MA_OPT3_DONE:
|
||||||
|
@ -1108,7 +1116,7 @@ static void dispmenu_loop_options(void)
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (inp & BTN_CIRCLE) return;
|
if (inp & BTN_X) return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1117,11 +1125,12 @@ static void dispmenu_loop_options(void)
|
||||||
|
|
||||||
menu_entry opt2_entries[] =
|
menu_entry opt2_entries[] =
|
||||||
{
|
{
|
||||||
{ "Emulate Z80", MB_ONOFF, MA_OPT2_ENABLE_Z80, ¤tConfig.PicoOpt,0x0004, 0, 0, 1 },
|
{ "Emulate Z80", MB_ONOFF, MA_OPT2_ENABLE_Z80, ¤tConfig.PicoOpt,0x00004, 0, 0, 1 },
|
||||||
{ "Emulate YM2612 (FM)", MB_ONOFF, MA_OPT2_ENABLE_YM2612, ¤tConfig.PicoOpt,0x0001, 0, 0, 1 },
|
{ "Emulate YM2612 (FM)", MB_ONOFF, MA_OPT2_ENABLE_YM2612, ¤tConfig.PicoOpt,0x00001, 0, 0, 1 },
|
||||||
{ "Emulate SN76496 (PSG)", MB_ONOFF, MA_OPT2_ENABLE_SN76496,¤tConfig.PicoOpt,0x0002, 0, 0, 1 },
|
{ "Emulate SN76496 (PSG)", MB_ONOFF, MA_OPT2_ENABLE_SN76496,¤tConfig.PicoOpt,0x00002, 0, 0, 1 },
|
||||||
{ "gzip savestates", MB_ONOFF, MA_OPT2_GZIP_STATES, ¤tConfig.EmuOpt, 0x0008, 0, 0, 1 },
|
{ "gzip savestates", MB_ONOFF, MA_OPT2_GZIP_STATES, ¤tConfig.EmuOpt, 0x00008, 0, 0, 1 },
|
||||||
{ "Don't save last used ROM", MB_ONOFF, MA_OPT2_NO_LAST_ROM, ¤tConfig.EmuOpt, 0x0020, 0, 0, 1 },
|
{ "Don't save last used ROM", MB_ONOFF, MA_OPT2_NO_LAST_ROM, ¤tConfig.EmuOpt, 0x00020, 0, 0, 1 },
|
||||||
|
{ "Status line in main menu", MB_ONOFF, MA_OPT2_STATUS_LINE, ¤tConfig.EmuOpt, 0x20000, 0, 0, 1 },
|
||||||
{ "done", MB_NONE, MA_OPT2_DONE, NULL, 0, 0, 0, 1 },
|
{ "done", MB_NONE, MA_OPT2_DONE, NULL, 0, 0, 0, 1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1153,7 +1162,7 @@ static void amenu_loop_options(void)
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
draw_amenu_options(menu_sel);
|
draw_amenu_options(menu_sel);
|
||||||
inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT|BTN_X|BTN_CIRCLE);
|
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_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_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
|
||||||
selected_id = me_index2id(opt2_entries, OPT2_ENTRY_COUNT, menu_sel);
|
selected_id = me_index2id(opt2_entries, OPT2_ENTRY_COUNT, menu_sel);
|
||||||
|
@ -1163,13 +1172,13 @@ static void amenu_loop_options(void)
|
||||||
// TODO?
|
// TODO?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (inp & BTN_X) { // toggleable options
|
if (inp & BTN_CIRCLE) { // toggleable options
|
||||||
if (!me_process(opt2_entries, OPT2_ENTRY_COUNT, selected_id, 1) &&
|
if (!me_process(opt2_entries, OPT2_ENTRY_COUNT, selected_id, 1) &&
|
||||||
selected_id == MA_OPT2_DONE) {
|
selected_id == MA_OPT2_DONE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (inp & BTN_CIRCLE) return;
|
if (inp & BTN_X) return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1360,7 +1369,7 @@ static int menu_loop_options(void)
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
draw_menu_options(menu_sel);
|
draw_menu_options(menu_sel);
|
||||||
inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT|BTN_X|BTN_CIRCLE);
|
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_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_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
|
||||||
selected_id = me_index2id(opt_entries, OPT_ENTRY_COUNT, menu_sel);
|
selected_id = me_index2id(opt_entries, OPT_ENTRY_COUNT, menu_sel);
|
||||||
|
@ -1421,7 +1430,7 @@ static int menu_loop_options(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (inp & BTN_X) {
|
if (inp & BTN_CIRCLE) {
|
||||||
if (!me_process(opt_entries, OPT_ENTRY_COUNT, selected_id, 1))
|
if (!me_process(opt_entries, OPT_ENTRY_COUNT, selected_id, 1))
|
||||||
{
|
{
|
||||||
switch (selected_id)
|
switch (selected_id)
|
||||||
|
@ -1459,7 +1468,7 @@ static int menu_loop_options(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(inp & BTN_CIRCLE) {
|
if(inp & BTN_X) {
|
||||||
menu_options_save();
|
menu_options_save();
|
||||||
return 0; // done (update, no write)
|
return 0; // done (update, no write)
|
||||||
}
|
}
|
||||||
|
@ -1512,11 +1521,15 @@ menu_entry main_entries[] =
|
||||||
|
|
||||||
static void draw_menu_root(int menu_sel)
|
static void draw_menu_root(int menu_sel)
|
||||||
{
|
{
|
||||||
const int tl_x = 80+70, tl_y = 16+70;
|
const int tl_x = 86+70, tl_y = 16+70;
|
||||||
|
char *stat = NULL;
|
||||||
|
|
||||||
menu_draw_begin();
|
menu_draw_begin();
|
||||||
|
|
||||||
text_out16(tl_x, 16+20, "PicoDrive v" VERSION);
|
if ((currentConfig.EmuOpt&0x20000) && (stat = psp_get_status_line()))
|
||||||
|
text_out16(287, 12, "%s", stat);
|
||||||
|
|
||||||
|
text_out16(tl_x, 48, "PicoDrive v" VERSION);
|
||||||
|
|
||||||
menu_draw_selection(tl_x - 16, tl_y + menu_sel*10, 146);
|
menu_draw_selection(tl_x - 16, tl_y + menu_sel*10, 146);
|
||||||
|
|
||||||
|
@ -1552,23 +1565,23 @@ static void menu_loop_root(void)
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
draw_menu_root(menu_sel);
|
draw_menu_root(menu_sel);
|
||||||
inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_X|BTN_CIRCLE|BTN_SELECT|BTN_L|BTN_R);
|
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_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_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_L|BTN_R)) == (BTN_L|BTN_R)) debug_menu_loop();
|
||||||
if( inp & (BTN_SELECT|BTN_CIRCLE)) {
|
if( inp & (BTN_SELECT|BTN_X)) {
|
||||||
if (rom_data) {
|
if (rom_data) {
|
||||||
while (psp_pad_read(1) & (BTN_SELECT|BTN_CIRCLE)) psp_msleep(50); // wait until released
|
while (psp_pad_read(1) & (BTN_SELECT|BTN_X)) psp_msleep(50); // wait until released
|
||||||
engineState = PGS_Running;
|
engineState = PGS_Running;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(inp & BTN_X) {
|
if(inp & BTN_CIRCLE) {
|
||||||
switch (me_index2id(main_entries, MAIN_ENTRY_COUNT, menu_sel))
|
switch (me_index2id(main_entries, MAIN_ENTRY_COUNT, menu_sel))
|
||||||
{
|
{
|
||||||
case MA_MAIN_RESUME_GAME:
|
case MA_MAIN_RESUME_GAME:
|
||||||
if (rom_data) {
|
if (rom_data) {
|
||||||
while (psp_pad_read(1) & BTN_X) psp_msleep(50);
|
while (psp_pad_read(1) & BTN_CIRCLE) psp_msleep(50);
|
||||||
engineState = PGS_Running;
|
engineState = PGS_Running;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1627,7 +1640,9 @@ static void menu_loop_root(void)
|
||||||
case MA_MAIN_CREDITS:
|
case MA_MAIN_CREDITS:
|
||||||
draw_menu_credits();
|
draw_menu_credits();
|
||||||
psp_msleep(500);
|
psp_msleep(500);
|
||||||
inp = wait_for_input(BTN_X|BTN_CIRCLE);
|
inp = 0;
|
||||||
|
while (!(inp & (BTN_X|BTN_CIRCLE)))
|
||||||
|
inp = wait_for_input(BTN_X|BTN_CIRCLE, 0);
|
||||||
break;
|
break;
|
||||||
case MA_MAIN_EXIT:
|
case MA_MAIN_EXIT:
|
||||||
engineState = PGS_Quit;
|
engineState = PGS_Quit;
|
||||||
|
@ -1757,15 +1772,15 @@ int menu_loop_tray(void)
|
||||||
|
|
||||||
/* make sure action buttons are not pressed on entering menu */
|
/* make sure action buttons are not pressed on entering menu */
|
||||||
draw_menu_tray(menu_sel);
|
draw_menu_tray(menu_sel);
|
||||||
while (psp_pad_read(1) & BTN_X) psp_msleep(50);
|
while (psp_pad_read(1) & BTN_CIRCLE) psp_msleep(50);
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
draw_menu_tray(menu_sel);
|
draw_menu_tray(menu_sel);
|
||||||
inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_X);
|
inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_X, 0);
|
||||||
if(inp & BTN_UP ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }
|
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_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
|
||||||
if(inp & BTN_X ) {
|
if(inp & BTN_CIRCLE) {
|
||||||
switch (menu_sel) {
|
switch (menu_sel) {
|
||||||
case 0: // select image
|
case 0: // select image
|
||||||
selfname = romsel_loop(curr_path);
|
selfname = romsel_loop(curr_path);
|
||||||
|
|
|
@ -9,5 +9,6 @@ void menu_romload_prepare(const char *rom_name);
|
||||||
void menu_romload_end(void);
|
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_NOTE)
|
#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)
|
||||||
|
|
||||||
|
|
45
psp/psp.c
45
psp/psp.c
|
@ -6,6 +6,7 @@
|
||||||
#include <pspiofilemgr.h>
|
#include <pspiofilemgr.h>
|
||||||
#include <pspdisplay.h>
|
#include <pspdisplay.h>
|
||||||
#include <psppower.h>
|
#include <psppower.h>
|
||||||
|
#include <psprtc.h>
|
||||||
#include <pspgu.h>
|
#include <pspgu.h>
|
||||||
|
|
||||||
#include "psp.h"
|
#include "psp.h"
|
||||||
|
@ -18,7 +19,7 @@ unsigned int __attribute__((aligned(16))) guCmdList[GU_CMDLIST_SIZE];
|
||||||
void *psp_screen = VRAM_FB0;
|
void *psp_screen = VRAM_FB0;
|
||||||
static int current_screen = 0; /* front bufer */
|
static int current_screen = 0; /* front bufer */
|
||||||
|
|
||||||
static SceUID logfd = -1;
|
#define ANALOG_DEADZONE 80
|
||||||
|
|
||||||
/* Exit callback */
|
/* Exit callback */
|
||||||
static int exit_callback(int arg1, int arg2, void *common)
|
static int exit_callback(int arg1, int arg2, void *common)
|
||||||
|
@ -47,6 +48,7 @@ void psp_init(void)
|
||||||
{
|
{
|
||||||
SceUID thid;
|
SceUID thid;
|
||||||
|
|
||||||
|
lprintf("running in %08x kernel\n", sceKernelDevkitVersion()),
|
||||||
lprintf("entered psp_init, threadId %i, priority %i\n", sceKernelGetThreadId(),
|
lprintf("entered psp_init, threadId %i, priority %i\n", sceKernelGetThreadId(),
|
||||||
sceKernelGetThreadCurrentPriority());
|
sceKernelGetThreadCurrentPriority());
|
||||||
|
|
||||||
|
@ -93,7 +95,7 @@ void psp_init(void)
|
||||||
|
|
||||||
/* input */
|
/* input */
|
||||||
sceCtrlSetSamplingCycle(0);
|
sceCtrlSetSamplingCycle(0);
|
||||||
sceCtrlSetSamplingMode(0);
|
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
|
||||||
}
|
}
|
||||||
|
|
||||||
void psp_finish(void)
|
void psp_finish(void)
|
||||||
|
@ -132,12 +134,21 @@ void psp_msleep(int ms)
|
||||||
|
|
||||||
unsigned int psp_pad_read(int blocking)
|
unsigned int psp_pad_read(int blocking)
|
||||||
{
|
{
|
||||||
|
unsigned int buttons;
|
||||||
SceCtrlData pad;
|
SceCtrlData pad;
|
||||||
if (blocking)
|
if (blocking)
|
||||||
sceCtrlReadBufferPositive(&pad, 1);
|
sceCtrlReadBufferPositive(&pad, 1);
|
||||||
else sceCtrlPeekBufferPositive(&pad, 1);
|
else sceCtrlPeekBufferPositive(&pad, 1);
|
||||||
|
buttons = pad.Buttons;
|
||||||
|
|
||||||
return 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;
|
||||||
|
|
||||||
|
return buttons;
|
||||||
}
|
}
|
||||||
|
|
||||||
int psp_get_cpu_clock(void)
|
int psp_get_cpu_clock(void)
|
||||||
|
@ -153,27 +164,51 @@ int psp_set_cpu_clock(int clock)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *psp_get_status_line(void)
|
||||||
|
{
|
||||||
|
static char buff[64];
|
||||||
|
int ret, bat_percent, bat_time;
|
||||||
|
pspTime time;
|
||||||
|
|
||||||
|
ret = sceRtcGetCurrentClockLocalTime(&time);
|
||||||
|
bat_percent = scePowerGetBatteryLifePercent();
|
||||||
|
bat_time = scePowerGetBatteryLifeTime();
|
||||||
|
if (ret < 0 || bat_percent < 0 || bat_time < 0) return NULL;
|
||||||
|
|
||||||
|
snprintf(buff, sizeof(buff), "%02i:%02i bat: %3i%%", time.hour, time.minutes, bat_percent);
|
||||||
|
if (!scePowerIsPowerOnline())
|
||||||
|
snprintf(buff+strlen(buff), sizeof(buff)-strlen(buff), " (%i:%02i)", bat_time/60, bat_time%60);
|
||||||
|
return buff;
|
||||||
|
}
|
||||||
|
|
||||||
/* alt logging */
|
/* alt logging */
|
||||||
#define LOG_FILE "log.log"
|
#define LOG_FILE "log.log"
|
||||||
|
|
||||||
|
static SceUID logfd = -1;
|
||||||
|
|
||||||
void lprintf_f(const char *fmt, ...)
|
void lprintf_f(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list vl;
|
va_list vl;
|
||||||
char buff[256];
|
char buff[256];
|
||||||
|
|
||||||
|
if (logfd == -2) return; // disabled
|
||||||
|
|
||||||
if (logfd < 0)
|
if (logfd < 0)
|
||||||
{
|
{
|
||||||
logfd = sceIoOpen(LOG_FILE, PSP_O_WRONLY|PSP_O_APPEND, 0777);
|
logfd = sceIoOpen(LOG_FILE, PSP_O_WRONLY|PSP_O_APPEND, 0777);
|
||||||
if (logfd < 0)
|
if (logfd < 0) {
|
||||||
|
logfd = -2;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
va_start(vl, fmt);
|
va_start(vl, fmt);
|
||||||
vsnprintf(buff, sizeof(buff), fmt, vl);
|
vsnprintf(buff, sizeof(buff), fmt, vl);
|
||||||
va_end(vl);
|
va_end(vl);
|
||||||
|
|
||||||
sceIoWrite(logfd, buff, strlen(buff));
|
sceIoWrite(logfd, buff, strlen(buff));
|
||||||
//sceKernelDelayThread(200 * 1000);
|
|
||||||
|
// make sure it gets flushed
|
||||||
sceIoClose(logfd);
|
sceIoClose(logfd);
|
||||||
logfd = -1;
|
logfd = -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,8 @@ unsigned int psp_pad_read(int blocking);
|
||||||
int psp_get_cpu_clock(void);
|
int psp_get_cpu_clock(void);
|
||||||
int psp_set_cpu_clock(int clock);
|
int psp_set_cpu_clock(int clock);
|
||||||
|
|
||||||
|
char *psp_get_status_line(void);
|
||||||
|
|
||||||
/* shorter btn names */
|
/* shorter btn names */
|
||||||
#define BTN_UP PSP_CTRL_UP
|
#define BTN_UP PSP_CTRL_UP
|
||||||
#define BTN_LEFT PSP_CTRL_LEFT
|
#define BTN_LEFT PSP_CTRL_LEFT
|
||||||
|
@ -51,3 +53,9 @@ int psp_set_cpu_clock(int clock);
|
||||||
#define BTN_START PSP_CTRL_START
|
#define BTN_START PSP_CTRL_START
|
||||||
#define BTN_NOTE PSP_CTRL_NOTE // doesn't seem to work?
|
#define BTN_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)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue