mirror of
https://github.com/RaySollium99/libpicofe.git
synced 2025-09-05 06:47:45 -04:00
ABC turbo
git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@553 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
1b38d64b02
commit
6589c840ca
13 changed files with 179 additions and 99 deletions
53
gp2x/emu.c
53
gp2x/emu.c
|
@ -164,6 +164,7 @@ void emu_prepareDefaultConfig(void)
|
|||
defaultConfig.KeyBinds[22] = 1<<30; // vol down
|
||||
defaultConfig.gamma = 100;
|
||||
defaultConfig.scaling = 0;
|
||||
defaultConfig.turbo_rate = 15;
|
||||
}
|
||||
|
||||
void emu_setDefaultConfig(void)
|
||||
|
@ -436,33 +437,19 @@ static void emu_msg_tray_open(void)
|
|||
|
||||
static void RunEventsPico(unsigned int events, unsigned int gp2x_keys)
|
||||
{
|
||||
int ret, px, py;
|
||||
int ret, px, py, lim_x;
|
||||
static int pdown_frames = 0;
|
||||
|
||||
emu_RunEventsPico(events);
|
||||
|
||||
if (pico_inp_mode != 0)
|
||||
{
|
||||
PicoPad[0] &= ~0x0f; // release UDLR
|
||||
if (gp2x_keys & GP2X_UP) { pico_pen_y--; if (pico_pen_y < 8) pico_pen_y = 8; }
|
||||
if (gp2x_keys & GP2X_DOWN) { pico_pen_y++; if (pico_pen_y > 224-PICO_PEN_ADJUST_Y) pico_pen_y = 224-PICO_PEN_ADJUST_Y; }
|
||||
if (gp2x_keys & GP2X_LEFT) { pico_pen_x--; if (pico_pen_x < 0) pico_pen_x = 0; }
|
||||
if (gp2x_keys & GP2X_RIGHT) {
|
||||
int lim = (Pico.video.reg[12]&1) ? 319 : 255;
|
||||
pico_pen_x++;
|
||||
if (pico_pen_x > lim-PICO_PEN_ADJUST_X)
|
||||
pico_pen_x = lim-PICO_PEN_ADJUST_X;
|
||||
}
|
||||
PicoPicohw.pen_pos[0] = pico_pen_x;
|
||||
if (!(Pico.video.reg[12]&1)) PicoPicohw.pen_pos[0] += pico_pen_x/4;
|
||||
PicoPicohw.pen_pos[0] += 0x3c;
|
||||
PicoPicohw.pen_pos[1] = pico_inp_mode == 1 ? (0x2f8 + pico_pen_y) : (0x1fc + pico_pen_y);
|
||||
}
|
||||
if (pico_inp_mode == 0) return;
|
||||
|
||||
// for F200
|
||||
ret = gp2x_touchpad_read(&px, &py);
|
||||
if (ret >= 0) {
|
||||
if (ret > 5000) {
|
||||
if (ret >= 0)
|
||||
{
|
||||
if (ret > 35000)
|
||||
{
|
||||
if (pdown_frames++ > 5)
|
||||
PicoPad[0] |= 0x20;
|
||||
|
||||
|
@ -476,11 +463,28 @@ static void RunEventsPico(unsigned int events, unsigned int gp2x_keys)
|
|||
if (pico_pen_y > 224) pico_pen_y = 224;
|
||||
}
|
||||
else
|
||||
pdown_frames= 0;
|
||||
pdown_frames = 0;
|
||||
|
||||
//if (ret == 0)
|
||||
// PicoPicohw.pen_pos[0] = PicoPicohw.pen_pos[1] = 0x8000;
|
||||
}
|
||||
|
||||
PicoPad[0] &= ~0x0f; // release UDLR
|
||||
if (gp2x_keys & GP2X_UP) pico_pen_y--;
|
||||
if (gp2x_keys & GP2X_DOWN) pico_pen_y++;
|
||||
if (gp2x_keys & GP2X_LEFT) pico_pen_x--;
|
||||
if (gp2x_keys & GP2X_RIGHT) pico_pen_x++;
|
||||
|
||||
lim_x = (Pico.video.reg[12]&1) ? 319 : 255;
|
||||
if (pico_pen_y < 8) pico_pen_y = 8;
|
||||
if (pico_pen_y > 224-PICO_PEN_ADJUST_Y) pico_pen_y = 224-PICO_PEN_ADJUST_Y;
|
||||
if (pico_pen_x < 0) pico_pen_x = 0;
|
||||
if (pico_pen_x > lim_x-PICO_PEN_ADJUST_X) pico_pen_x = lim_x-PICO_PEN_ADJUST_X;
|
||||
|
||||
PicoPicohw.pen_pos[0] = pico_pen_x;
|
||||
if (!(Pico.video.reg[12]&1)) PicoPicohw.pen_pos[0] += pico_pen_x/4;
|
||||
PicoPicohw.pen_pos[0] += 0x3c;
|
||||
PicoPicohw.pen_pos[1] = pico_inp_mode == 1 ? (0x2f8 + pico_pen_y) : (0x1fc + pico_pen_y);
|
||||
}
|
||||
|
||||
static void update_volume(int has_changed, int is_up)
|
||||
|
@ -639,8 +643,11 @@ static void updateKeys(void)
|
|||
}
|
||||
}
|
||||
|
||||
PicoPad[0] = (unsigned short) allActions[0];
|
||||
PicoPad[1] = (unsigned short) allActions[1];
|
||||
PicoPad[0] = allActions[0] & 0xfff;
|
||||
PicoPad[1] = allActions[1] & 0xfff;
|
||||
|
||||
if (allActions[0] & 0x7000) emu_DoTurbo(&PicoPad[0], allActions[0]);
|
||||
if (allActions[1] & 0x7000) emu_DoTurbo(&PicoPad[1], allActions[1]);
|
||||
|
||||
events = (allActions[0] | allActions[1]) >> 16;
|
||||
|
||||
|
|
|
@ -231,6 +231,7 @@ typedef struct ucb1x00_ts_event
|
|||
int gp2x_touchpad_read(int *x, int *y)
|
||||
{
|
||||
UCB1X00_TS_EVENT event;
|
||||
static int zero_seen = 0;
|
||||
int retval;
|
||||
|
||||
if (touchdev < 0) return -1;
|
||||
|
@ -240,12 +241,14 @@ int gp2x_touchpad_read(int *x, int *y)
|
|||
printf("touch read failed %i %i\n", retval, errno);
|
||||
return -1;
|
||||
}
|
||||
// this is to ignore the messed-up 4.1.x driver
|
||||
if (retval == 0) zero_seen = 1;
|
||||
|
||||
if (x) *x = (event.x * touchcal[0] + touchcal[2]) >> 16;
|
||||
if (y) *y = (event.y * touchcal[4] + touchcal[5]) >> 16;
|
||||
// printf("read %i %i %i\n", event.pressure, *x, *y);
|
||||
|
||||
return event.pressure;
|
||||
return zero_seen ? event.pressure : 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
65
gp2x/menu.c
65
gp2x/menu.c
|
@ -712,14 +712,14 @@ static int count_bound_keys(int action, int pl_idx, int joy)
|
|||
|
||||
static void draw_key_config(const me_bind_action *opts, int opt_cnt, int player_idx, int sel)
|
||||
{
|
||||
int x, y, tl_y = 40, i;
|
||||
int x, y, tl_y = 30, i;
|
||||
|
||||
gp2x_pd_clone_buffer2();
|
||||
if (player_idx >= 0) {
|
||||
text_out16(80, 20, "Player %i controls", player_idx + 1);
|
||||
text_out16(80, 10, "Player %i controls", player_idx + 1);
|
||||
x = 80;
|
||||
} else {
|
||||
text_out16(80, 20, "Emulator controls");
|
||||
text_out16(80, 10, "Emulator controls");
|
||||
x = 40;
|
||||
}
|
||||
|
||||
|
@ -732,14 +732,14 @@ static void draw_key_config(const me_bind_action *opts, int opt_cnt, int player_
|
|||
text_out16(x, y, "Done");
|
||||
|
||||
if (sel < opt_cnt) {
|
||||
text_out16(30, 180, "Press a button to bind/unbind");
|
||||
text_out16(30, 190, "Use SELECT to clear");
|
||||
text_out16(30, 200, "To bind UP/DOWN, hold SELECT");
|
||||
text_out16(30, 210, "Select \"Done\" to exit");
|
||||
text_out16(30, 195, "Press a button to bind/unbind");
|
||||
text_out16(30, 205, "Use SELECT to clear");
|
||||
text_out16(30, 215, "To bind UP/DOWN, hold SELECT");
|
||||
text_out16(30, 225, "Select \"Done\" to exit");
|
||||
} else {
|
||||
text_out16(30, 190, "Use Options -> Save cfg");
|
||||
text_out16(30, 200, "to save controls");
|
||||
text_out16(30, 210, "Press B or X to exit");
|
||||
text_out16(30, 205, "Use Options -> Save cfg");
|
||||
text_out16(30, 215, "to save controls");
|
||||
text_out16(30, 225, "Press B or X to exit");
|
||||
}
|
||||
menu_flip();
|
||||
}
|
||||
|
@ -800,6 +800,21 @@ static void key_config_loop(const me_bind_action *opts, int opt_cnt, int player_
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
menu_entry ctrlopt_entries[] =
|
||||
{
|
||||
{ "Player 1", MB_NONE, MA_CTRL_PLAYER1, NULL, 0, 0, 0, 1, 0 },
|
||||
{ "Player 2", MB_NONE, MA_CTRL_PLAYER2, NULL, 0, 0, 0, 1, 0 },
|
||||
{ "Emulator controls", MB_NONE, MA_CTRL_EMU, NULL, 0, 0, 0, 1, 0 },
|
||||
{ "6 button pad", MB_ONOFF, MA_OPT_6BUTTON_PAD, &PicoOpt, 0x020, 0, 0, 1, 1 },
|
||||
{ "Turbo rate", MB_RANGE, MA_CTRL_TURBO_RATE, ¤tConfig.turbo_rate, 0, 1, 30, 1, 1 },
|
||||
{ "Done", MB_NONE, MA_CTRL_DONE, NULL, 0, 0, 0, 1, 0 },
|
||||
};
|
||||
|
||||
#define CTRLOPT_ENTRY_COUNT (sizeof(ctrlopt_entries) / sizeof(ctrlopt_entries[0]))
|
||||
const int ctrlopt_entry_count = CTRLOPT_ENTRY_COUNT;
|
||||
|
||||
|
||||
static void draw_kc_sel(int menu_sel)
|
||||
{
|
||||
int tl_x = 25+40, tl_y = 60, y, i;
|
||||
|
@ -809,13 +824,10 @@ static void draw_kc_sel(int menu_sel)
|
|||
gp2x_pd_clone_buffer2();
|
||||
menu_draw_selection(tl_x - 16, tl_y + menu_sel*10, 138);
|
||||
|
||||
text_out16(tl_x, y, "Player 1");
|
||||
text_out16(tl_x, (y+=10), "Player 2");
|
||||
text_out16(tl_x, (y+=10), "Emulator controls");
|
||||
text_out16(tl_x, (y+=10), "Done");
|
||||
me_draw(ctrlopt_entries, ctrlopt_entry_count, tl_x, tl_y, NULL, NULL);
|
||||
|
||||
tl_x = 25;
|
||||
text_out16(tl_x, (y=110), "USB joys detected:");
|
||||
text_out16(tl_x, (y=130), "USB joys detected:");
|
||||
if (num_of_joys > 0) {
|
||||
for (i = 0; i < num_of_joys; i++) {
|
||||
strncpy(joyname, joy_name(joys[i]), 33); joyname[33] = 0;
|
||||
|
@ -852,23 +864,27 @@ me_bind_action emuctrl_actions[] =
|
|||
|
||||
static void kc_sel_loop(void)
|
||||
{
|
||||
int menu_sel = 3, menu_sel_max = 3;
|
||||
int menu_sel = 5, menu_sel_max = 5;
|
||||
unsigned long inp = 0;
|
||||
int is_6button = PicoOpt & POPT_6BTN_PAD;
|
||||
menu_id selected_id;
|
||||
|
||||
while (1)
|
||||
{
|
||||
draw_kc_sel(menu_sel);
|
||||
inp = wait_for_input(GP2X_UP|GP2X_DOWN|GP2X_B|GP2X_X);
|
||||
inp = wait_for_input(GP2X_UP|GP2X_DOWN|GP2X_RIGHT|GP2X_LEFT|GP2X_B|GP2X_X);
|
||||
selected_id = me_index2id(ctrlopt_entries, CTRLOPT_ENTRY_COUNT, menu_sel);
|
||||
if (inp & (GP2X_LEFT|GP2X_RIGHT)) // multi choise
|
||||
me_process(ctrlopt_entries, CTRLOPT_ENTRY_COUNT, selected_id, (inp&GP2X_RIGHT) ? 1 : 0);
|
||||
if (inp & GP2X_UP ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }
|
||||
if (inp & GP2X_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
|
||||
if (inp & GP2X_B) {
|
||||
switch (menu_sel) {
|
||||
case 0: key_config_loop(me_ctrl_actions, is_6button ? 12 : 8, 0); return;
|
||||
case 1: key_config_loop(me_ctrl_actions, is_6button ? 12 : 8, 1); return;
|
||||
case 2: key_config_loop(emuctrl_actions,
|
||||
sizeof(emuctrl_actions)/sizeof(emuctrl_actions[0]) - 1, -1); return;
|
||||
case 3: if (!rom_loaded) emu_WriteConfig(0); return;
|
||||
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;
|
||||
case MA_CTRL_PLAYER2: key_config_loop(me_ctrl_actions, is_6button ? 15 : 11, 1); return;
|
||||
case MA_CTRL_EMU: key_config_loop(emuctrl_actions,
|
||||
sizeof(emuctrl_actions)/sizeof(emuctrl_actions[0]) - 1, -1); return;
|
||||
case MA_CTRL_DONE: if (!rom_loaded) emu_WriteConfig(0); return;
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
|
@ -1126,7 +1142,6 @@ menu_entry opt_entries[] =
|
|||
{ "Enable sound", MB_ONOFF, MA_OPT_ENABLE_SOUND, ¤tConfig.EmuOpt, 0x004, 0, 0, 1, 1 },
|
||||
{ NULL, MB_NONE, MA_OPT_SOUND_QUALITY, NULL, 0, 0, 0, 1, 1 },
|
||||
{ "Use ARM940 core for sound", MB_ONOFF, MA_OPT_ARM940_SOUND, &PicoOpt, 0x200, 0, 0, 1, 1 },
|
||||
{ "6 button pad", MB_ONOFF, MA_OPT_6BUTTON_PAD, &PicoOpt, 0x020, 0, 0, 1, 1 },
|
||||
{ NULL, MB_NONE, MA_OPT_REGION, NULL, 0, 0, 0, 1, 1 },
|
||||
{ "Use SRAM/BRAM savestates", MB_ONOFF, MA_OPT_SRAM_STATES, ¤tConfig.EmuOpt, 0x001, 0, 0, 1, 1 },
|
||||
{ NULL, MB_NONE, MA_OPT_CONFIRM_STATES,NULL, 0, 0, 0, 1, 1 },
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#define VERSION "1.50a"
|
||||
#define VERSION "1.51"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue