ABC turbo

git-svn-id: file:///home/notaz/opt/svn/PicoDrive@553 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2008-07-16 12:50:33 +00:00
parent 916363c86d
commit f0f0d2df76
15 changed files with 222 additions and 155 deletions

View file

@ -245,10 +245,6 @@ This option causes PicoDrive to use ARM940T core (GP2X's second CPU) for sound
(i.e. to generate YM2612 samples) to improve performance noticeably. (i.e. to generate YM2612 samples) to improve performance noticeably.
#endif #endif
@@0. "6 button pad"
If you enable this, games will think that 6 button gamepad is connected. If you
go and reconfigure your keys, you will be able to bind X,Y,Z and mode actions.
@@0. "Region" @@0. "Region"
This option lets you force the game to think it is running on machine from the This option lets you force the game to think it is running on machine from the
specified region, or just to set autodetection order. Also affects Sega/Mega CD. specified region, or just to set autodetection order. Also affects Sega/Mega CD.
@ -473,7 +469,10 @@ the right Giz ones, which are assigned to them. If you bind 2 different Giz butt
the right PSP ones, which are assigned to them. If you bind 2 different PSP buttons the right PSP ones, which are assigned to them. If you bind 2 different PSP buttons
#endif #endif
to the same action, you will get a combo (which means that you will have to press to the same action, you will get a combo (which means that you will have to press
both buttons for that action to happen. both buttons for that action to happen).
There is also option to enable 6 button pad (will allow you to configure XYZ
keys), and an option to set turbo rate (in Hz) for turbo buttons.
Cheat support Cheat support
@ -646,12 +645,13 @@ Additional thanks
Changelog Changelog
--------- ---------
1.50a 1.51
* Improved bin_to_cso_mp3 tool, it should no longer complain about * Improved bin_to_cso_mp3 tool, it should no longer complain about
missing lame.exe even if it's in working dir. missing lame.exe even if it's in working dir.
* Fixed a regression from 1.50, which caused slowdowns in Final Fight. * Fixed a regression from 1.50, which caused slowdowns in Final Fight.
* Fixed some regressions from 1.50 related to sprite limit and palette * Fixed some regressions from 1.50 related to sprite limit and palette
handling (caused graphical glitches in some games). handling (caused graphical glitches in some games).
+ Added ABC turbo actions to key config.
* Some other minor adjustments. * Some other minor adjustments.
1.50 1.50

View file

@ -20,9 +20,11 @@ static char *mystrip(char *str);
extern menu_entry opt_entries[]; extern menu_entry opt_entries[];
extern menu_entry opt2_entries[]; extern menu_entry opt2_entries[];
extern menu_entry cdopt_entries[]; extern menu_entry cdopt_entries[];
extern menu_entry ctrlopt_entries[];
extern const int opt_entry_count; extern const int opt_entry_count;
extern const int opt2_entry_count; extern const int opt2_entry_count;
extern const int cdopt_entry_count; extern const int cdopt_entry_count;
extern const int ctrlopt_entry_count;
#ifdef PSP #ifdef PSP
extern menu_entry opt3_entries[]; extern menu_entry opt3_entries[];
extern const int opt3_entry_count; extern const int opt3_entry_count;
@ -33,6 +35,7 @@ static menu_entry *cfg_opts[] =
opt_entries, opt_entries,
opt2_entries, opt2_entries,
cdopt_entries, cdopt_entries,
ctrlopt_entries,
#ifdef PSP #ifdef PSP
opt3_entries, opt3_entries,
#endif #endif
@ -43,6 +46,7 @@ static const int *cfg_opt_counts[] =
&opt_entry_count, &opt_entry_count,
&opt2_entry_count, &opt2_entry_count,
&cdopt_entry_count, &cdopt_entry_count,
&ctrlopt_entry_count,
#ifdef PSP #ifdef PSP
&opt3_entry_count, &opt3_entry_count,
#endif #endif
@ -277,6 +281,9 @@ static int default_var(const menu_entry *me)
case MA_CDOPT_LEDS: case MA_CDOPT_LEDS:
return defaultConfig.EmuOpt; return defaultConfig.EmuOpt;
case MA_CTRL_TURBO_RATE:
return defaultConfig.turbo_rate;
case MA_OPT_SAVE_SLOT: case MA_OPT_SAVE_SLOT:
default: default:
return 0; return 0;
@ -370,7 +377,7 @@ write:
if (!no_defaults || ((*(int *)me->var ^ default_var(me)) & me->mask)) if (!no_defaults || ((*(int *)me->var ^ default_var(me)) & me->mask))
fprintf(fn, "%s = %i" NL, me->name, (*(int *)me->var & me->mask) ? 1 : 0); fprintf(fn, "%s = %i" NL, me->name, (*(int *)me->var & me->mask) ? 1 : 0);
} else if (me->beh == MB_RANGE) { } else if (me->beh == MB_RANGE) {
if (!no_defaults || ((*(int *)me->var ^ default_var(me)) & me->mask)) if (!no_defaults || (*(int *)me->var ^ default_var(me)))
fprintf(fn, "%s = %i" NL, me->name, *(int *)me->var); fprintf(fn, "%s = %i" NL, me->name, *(int *)me->var);
} }
} }

View file

@ -1026,6 +1026,27 @@ void emu_RunEventsPico(unsigned int events)
} }
} }
void emu_DoTurbo(int *pad, int acts)
{
static int turbo_pad = 0;
static unsigned char turbo_cnt[3] = { 0, 0, 0 };
int inc = currentConfig.turbo_rate * 2;
if (acts & 0x1000) {
turbo_cnt[0] += inc;
if (turbo_cnt[0] >= 60)
turbo_pad ^= 0x10, turbo_cnt[0] = 0;
}
if (acts & 0x2000) {
turbo_cnt[1] += inc;
if (turbo_cnt[1] >= 60)
turbo_pad ^= 0x20, turbo_cnt[1] = 0;
}
if (acts & 0x4000) {
turbo_cnt[2] += inc;
if (turbo_cnt[2] >= 60)
turbo_pad ^= 0x40, turbo_cnt[2] = 0;
}
*pad |= turbo_pad & (acts >> 8);
}

View file

@ -25,6 +25,7 @@ typedef struct {
float scale; // psp: screen scale float scale; // psp: screen scale
float hscale32, hscale40; // psp: horizontal scale float hscale32, hscale40; // psp: horizontal scale
int gamma2; // psp: black level int gamma2; // psp: black level
int turbo_rate;
} currentConfig_t; } currentConfig_t;
extern currentConfig_t currentConfig, defaultConfig; extern currentConfig_t currentConfig, defaultConfig;
@ -56,6 +57,7 @@ void emu_findKeyBindCombos(void);
void emu_forcedFrame(int opts); void emu_forcedFrame(int opts);
void emu_changeFastForward(int set_on); void emu_changeFastForward(int set_on);
void emu_RunEventsPico(unsigned int events); void emu_RunEventsPico(unsigned int events);
void emu_DoTurbo(int *pad, int acts);
extern const char * const keyNames[]; extern const char * const keyNames[];
void emu_prepareDefaultConfig(void); void emu_prepareDefaultConfig(void);

View file

@ -19,20 +19,23 @@
char menuErrorMsg[64] = { 0, }; char menuErrorMsg[64] = { 0, };
// PicoPad[] format: MXYZ SACB RLDU // PicoPad[] format: MXYZ SACB RLDU
me_bind_action me_ctrl_actions[12] = me_bind_action me_ctrl_actions[15] =
{ {
{ "UP ", 0x001 }, { "UP ", 0x0001 },
{ "DOWN ", 0x002 }, { "DOWN ", 0x0002 },
{ "LEFT ", 0x004 }, { "LEFT ", 0x0004 },
{ "RIGHT ", 0x008 }, { "RIGHT ", 0x0008 },
{ "A ", 0x040 }, { "A ", 0x0040 },
{ "B ", 0x010 }, { "B ", 0x0010 },
{ "C ", 0x020 }, { "C ", 0x0020 },
{ "START ", 0x080 }, { "A turbo", 0x4000 },
{ "MODE ", 0x800 }, { "B turbo", 0x1000 },
{ "X ", 0x400 }, { "C turbo", 0x2000 },
{ "Y ", 0x200 }, { "START ", 0x0080 },
{ "Z ", 0x100 } { "MODE ", 0x0800 },
{ "X ", 0x0400 },
{ "Y ", 0x0200 },
{ "Z ", 0x0100 }
}; };

View file

@ -91,6 +91,11 @@ typedef enum
MA_CDOPT_SCALEROT_CHIP, MA_CDOPT_SCALEROT_CHIP,
MA_CDOPT_BETTER_SYNC, MA_CDOPT_BETTER_SYNC,
MA_CDOPT_DONE, MA_CDOPT_DONE,
MA_CTRL_PLAYER1,
MA_CTRL_PLAYER2,
MA_CTRL_EMU,
MA_CTRL_TURBO_RATE,
MA_CTRL_DONE,
} menu_id; } menu_id;
typedef struct typedef struct
@ -112,7 +117,7 @@ typedef struct
int mask; int mask;
} me_bind_action; } me_bind_action;
extern me_bind_action me_ctrl_actions[12]; extern me_bind_action me_ctrl_actions[15];
extern me_bind_action emuctrl_actions[]; // platform code extern me_bind_action emuctrl_actions[]; // platform code

View file

@ -140,6 +140,7 @@ void emu_setDefaultConfig(void)
currentConfig.KeyBinds[11] = 1<<30; // vol down currentConfig.KeyBinds[11] = 1<<30; // vol down
currentConfig.PicoCDBuffers = 0; currentConfig.PicoCDBuffers = 0;
currentConfig.scaling = 0; currentConfig.scaling = 0;
defaultConfig.turbo_rate = 15;
} }
@ -476,8 +477,11 @@ static void updateKeys(void)
} }
} }
PicoPad[0] = (unsigned short) allActions[0]; PicoPad[0] = allActions[0] & 0xfff;
PicoPad[1] = (unsigned short) allActions[1]; 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; events = (allActions[0] | allActions[1]) >> 16;

View file

@ -438,36 +438,6 @@ static char *romsel_loop(char *curr_path)
} }
#endif #endif
// ------------ debug menu ------------
char *debugString(void);
static void draw_debug(void)
{
char *p, *str = debugString();
int len, line;
menu_draw_begin(1);
p = str;
for (line = 0; line < 24; line++)
{
while (*p && *p != '\n') p++;
len = p - str;
if (len > 55) len = 55;
smalltext_out16_lim(1, line*10, str, 0xffff, len);
if (*p == 0) break;
p++; str = p;
}
menu_draw_end();
}
static void debug_menu_loop(void)
{
draw_debug();
wait_for_input(BTN_PLAY|BTN_STOP);
}
// ------------ patch/gg menu ------------ // ------------ patch/gg menu ------------
static void draw_patchlist(int sel) static void draw_patchlist(int sel)
@ -692,14 +662,14 @@ static int count_bound_keys(int action, int pl_idx)
static void draw_key_config(const me_bind_action *opts, int opt_cnt, int player_idx, int sel) 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;
menu_draw_begin(1); menu_draw_begin(1);
if (player_idx >= 0) { 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; x = 80;
} else { } else {
text_out16(80, 20, "Emulator controls"); text_out16(80, 10, "Emulator controls");
x = 40; x = 40;
} }
@ -712,14 +682,14 @@ static void draw_key_config(const me_bind_action *opts, int opt_cnt, int player_
text_out16(x, y, "Done"); text_out16(x, y, "Done");
if (sel < opt_cnt) { if (sel < opt_cnt) {
text_out16(30, 180, "Press a button to bind/unbind"); text_out16(30, 195, "Press a button to bind/unbind");
text_out16(30, 190, "Use HOME to clear"); text_out16(30, 205, "Use HOME to clear");
text_out16(30, 200, "To bind UP/DOWN, hold HOME"); text_out16(30, 215, "To bind UP/DOWN, hold HOME");
text_out16(30, 210, "Select \"Done\" to exit"); text_out16(30, 225, "Select \"Done\" to exit");
} else { } else {
text_out16(30, 190, "Use Options -> Save cfg"); text_out16(30, 205, "Use Options -> Save cfg");
text_out16(30, 200, "to save controls"); text_out16(30, 215, "to save controls");
text_out16(30, 210, "Press PLAY or STOP to exit"); text_out16(30, 225, "Press PLAY or STOP to exit");
} }
menu_draw_end(); menu_draw_end();
} }
@ -761,6 +731,19 @@ 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, &currentConfig.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) static void draw_kc_sel(int menu_sel)
{ {
int tl_x = 25+40, tl_y = 60, y; int tl_x = 25+40, tl_y = 60, y;
@ -769,10 +752,7 @@ static void draw_kc_sel(int menu_sel)
menu_draw_begin(1); menu_draw_begin(1);
menu_draw_selection(tl_x - 16, tl_y + menu_sel*10, 138); menu_draw_selection(tl_x - 16, tl_y + menu_sel*10, 138);
text_out16(tl_x, y, "Player 1"); me_draw(ctrlopt_entries, ctrlopt_entry_count, tl_x, tl_y, NULL, NULL);
text_out16(tl_x, (y+=10), "Player 2");
text_out16(tl_x, (y+=10), "Emulator controls");
text_out16(tl_x, (y+=10), "Done");
menu_draw_end(); menu_draw_end();
} }
@ -795,23 +775,27 @@ me_bind_action emuctrl_actions[] =
static void kc_sel_loop(void) 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; unsigned long inp = 0;
int is_6button = currentConfig.PicoOpt & 0x020; menu_id selected_id;
while (1) while (1)
{ {
draw_kc_sel(menu_sel); draw_kc_sel(menu_sel);
inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_PLAY|BTN_STOP); inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_PLAY|BTN_STOP);
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_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_PLAY) { if (inp & BTN_PLAY) {
switch (menu_sel) { int is_6button = currentConfig.PicoOpt & 0x020;
case 0: key_config_loop(me_ctrl_actions, is_6button ? 12 : 8, 0); return; switch (selected_id) {
case 1: key_config_loop(me_ctrl_actions, is_6button ? 12 : 8, 1); return; case MA_CTRL_PLAYER1: key_config_loop(me_ctrl_actions, is_6button ? 15 : 11, 0); return;
case 2: key_config_loop(emuctrl_actions, case MA_CTRL_PLAYER2: key_config_loop(me_ctrl_actions, is_6button ? 15 : 11, 1); return;
sizeof(emuctrl_actions)/sizeof(emuctrl_actions[0]) - 1, -1); return; case MA_CTRL_EMU: key_config_loop(emuctrl_actions,
case 3: if (!rom_loaded) emu_WriteConfig(0); return; sizeof(emuctrl_actions)/sizeof(emuctrl_actions[0]) - 1, -1); return;
case MA_CTRL_DONE: if (!rom_loaded) emu_WriteConfig(0); return;
default: return; default: return;
} }
} }
@ -1043,14 +1027,13 @@ static void amenu_loop_options(void)
menu_entry opt_entries[] = menu_entry opt_entries[] =
{ {
{ NULL, MB_NONE, MA_OPT_RENDERER, NULL, 0, 0, 0, 1 }, { NULL, MB_NONE, MA_OPT_RENDERER, NULL, 0, 0, 0, 1 },
{ "Accurate sprites", MB_ONOFF, MA_OPT_ACC_SPRITES, &PicoOpt, 0x080, 0, 0, 0, 1 },
{ "Scanline mode (faster)", MB_ONOFF, MA_OPT_INTERLACED, &currentConfig.EmuOpt, 0x4000, 0, 0, 1 }, { "Scanline mode (faster)", MB_ONOFF, MA_OPT_INTERLACED, &currentConfig.EmuOpt, 0x4000, 0, 0, 1 },
{ "Scale low res mode", MB_ONOFF, MA_OPT_SCALING, &currentConfig.scaling, 0x0001, 0, 3, 1 }, { "Scale low res mode", MB_ONOFF, MA_OPT_SCALING, &currentConfig.scaling, 0x0001, 0, 3, 1 },
{ "Accurate sprites", MB_ONOFF, MA_OPT_ACC_SPRITES, &currentConfig.PicoOpt, 0x0080, 0, 0, 1 },
{ "Show FPS", MB_ONOFF, MA_OPT_SHOW_FPS, &currentConfig.EmuOpt, 0x0002, 0, 0, 1 }, { "Show FPS", MB_ONOFF, MA_OPT_SHOW_FPS, &currentConfig.EmuOpt, 0x0002, 0, 0, 1 },
{ NULL, MB_RANGE, MA_OPT_FRAMESKIP, &currentConfig.Frameskip, 0, -1, 16, 1 }, { NULL, MB_RANGE, MA_OPT_FRAMESKIP, &currentConfig.Frameskip, 0, -1, 16, 1 },
{ "Enable sound", MB_ONOFF, MA_OPT_ENABLE_SOUND, &currentConfig.EmuOpt, 0x0004, 0, 0, 1 }, { "Enable sound", MB_ONOFF, MA_OPT_ENABLE_SOUND, &currentConfig.EmuOpt, 0x0004, 0, 0, 1 },
{ NULL, MB_NONE, MA_OPT_SOUND_QUALITY, NULL, 0, 0, 0, 1 }, { NULL, MB_NONE, MA_OPT_SOUND_QUALITY, NULL, 0, 0, 0, 1 },
{ "6 button pad", MB_ONOFF, MA_OPT_6BUTTON_PAD, &currentConfig.PicoOpt, 0x0020, 0, 0, 1 },
{ NULL, MB_NONE, MA_OPT_REGION, NULL, 0, 0, 0, 1 }, { NULL, MB_NONE, MA_OPT_REGION, NULL, 0, 0, 0, 1 },
{ "Use SRAM/BRAM savestates", MB_ONOFF, MA_OPT_SRAM_STATES, &currentConfig.EmuOpt, 0x0001, 0, 0, 1 }, { "Use SRAM/BRAM savestates", MB_ONOFF, MA_OPT_SRAM_STATES, &currentConfig.EmuOpt, 0x0001, 0, 0, 1 },
{ NULL, MB_NONE, MA_OPT_CONFIRM_STATES,NULL, 0, 0, 0, 1 }, { NULL, MB_NONE, MA_OPT_CONFIRM_STATES,NULL, 0, 0, 0, 1 },

View file

@ -164,6 +164,7 @@ void emu_prepareDefaultConfig(void)
defaultConfig.KeyBinds[22] = 1<<30; // vol down defaultConfig.KeyBinds[22] = 1<<30; // vol down
defaultConfig.gamma = 100; defaultConfig.gamma = 100;
defaultConfig.scaling = 0; defaultConfig.scaling = 0;
defaultConfig.turbo_rate = 15;
} }
void emu_setDefaultConfig(void) 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) 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; static int pdown_frames = 0;
emu_RunEventsPico(events); emu_RunEventsPico(events);
if (pico_inp_mode != 0) if (pico_inp_mode == 0) return;
{
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);
}
// for F200 // for F200
ret = gp2x_touchpad_read(&px, &py); ret = gp2x_touchpad_read(&px, &py);
if (ret >= 0) { if (ret >= 0)
if (ret > 5000) { {
if (ret > 35000)
{
if (pdown_frames++ > 5) if (pdown_frames++ > 5)
PicoPad[0] |= 0x20; 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; if (pico_pen_y > 224) pico_pen_y = 224;
} }
else else
pdown_frames= 0; pdown_frames = 0;
//if (ret == 0) //if (ret == 0)
// PicoPicohw.pen_pos[0] = PicoPicohw.pen_pos[1] = 0x8000; // 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) 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[0] = allActions[0] & 0xfff;
PicoPad[1] = (unsigned short) allActions[1]; 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; events = (allActions[0] | allActions[1]) >> 16;

View file

@ -231,6 +231,7 @@ typedef struct ucb1x00_ts_event
int gp2x_touchpad_read(int *x, int *y) int gp2x_touchpad_read(int *x, int *y)
{ {
UCB1X00_TS_EVENT event; UCB1X00_TS_EVENT event;
static int zero_seen = 0;
int retval; int retval;
if (touchdev < 0) return -1; 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); printf("touch read failed %i %i\n", retval, errno);
return -1; 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 (x) *x = (event.x * touchcal[0] + touchcal[2]) >> 16;
if (y) *y = (event.y * touchcal[4] + touchcal[5]) >> 16; if (y) *y = (event.y * touchcal[4] + touchcal[5]) >> 16;
// printf("read %i %i %i\n", event.pressure, *x, *y); // printf("read %i %i %i\n", event.pressure, *x, *y);
return event.pressure; return zero_seen ? event.pressure : 0;
} }

View file

@ -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) 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(); gp2x_pd_clone_buffer2();
if (player_idx >= 0) { 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; x = 80;
} else { } else {
text_out16(80, 20, "Emulator controls"); text_out16(80, 10, "Emulator controls");
x = 40; 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"); text_out16(x, y, "Done");
if (sel < opt_cnt) { if (sel < opt_cnt) {
text_out16(30, 180, "Press a button to bind/unbind"); text_out16(30, 195, "Press a button to bind/unbind");
text_out16(30, 190, "Use SELECT to clear"); text_out16(30, 205, "Use SELECT to clear");
text_out16(30, 200, "To bind UP/DOWN, hold SELECT"); text_out16(30, 215, "To bind UP/DOWN, hold SELECT");
text_out16(30, 210, "Select \"Done\" to exit"); text_out16(30, 225, "Select \"Done\" to exit");
} else { } else {
text_out16(30, 190, "Use Options -> Save cfg"); text_out16(30, 205, "Use Options -> Save cfg");
text_out16(30, 200, "to save controls"); text_out16(30, 215, "to save controls");
text_out16(30, 210, "Press B or X to exit"); text_out16(30, 225, "Press B or X to exit");
} }
menu_flip(); 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, &currentConfig.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) static void draw_kc_sel(int menu_sel)
{ {
int tl_x = 25+40, tl_y = 60, y, i; 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(); gp2x_pd_clone_buffer2();
menu_draw_selection(tl_x - 16, tl_y + menu_sel*10, 138); menu_draw_selection(tl_x - 16, tl_y + menu_sel*10, 138);
text_out16(tl_x, y, "Player 1"); me_draw(ctrlopt_entries, ctrlopt_entry_count, tl_x, tl_y, NULL, NULL);
text_out16(tl_x, (y+=10), "Player 2");
text_out16(tl_x, (y+=10), "Emulator controls");
text_out16(tl_x, (y+=10), "Done");
tl_x = 25; 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) { if (num_of_joys > 0) {
for (i = 0; i < num_of_joys; i++) { for (i = 0; i < num_of_joys; i++) {
strncpy(joyname, joy_name(joys[i]), 33); joyname[33] = 0; 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) 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; unsigned long inp = 0;
int is_6button = PicoOpt & POPT_6BTN_PAD; menu_id selected_id;
while (1) while (1)
{ {
draw_kc_sel(menu_sel); 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_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_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
if (inp & GP2X_B) { if (inp & GP2X_B) {
switch (menu_sel) { int is_6button = PicoOpt & POPT_6BTN_PAD;
case 0: key_config_loop(me_ctrl_actions, is_6button ? 12 : 8, 0); return; switch (selected_id) {
case 1: key_config_loop(me_ctrl_actions, is_6button ? 12 : 8, 1); return; case MA_CTRL_PLAYER1: key_config_loop(me_ctrl_actions, is_6button ? 15 : 11, 0); return;
case 2: key_config_loop(emuctrl_actions, case MA_CTRL_PLAYER2: key_config_loop(me_ctrl_actions, is_6button ? 15 : 11, 1); return;
sizeof(emuctrl_actions)/sizeof(emuctrl_actions[0]) - 1, -1); return; case MA_CTRL_EMU: key_config_loop(emuctrl_actions,
case 3: if (!rom_loaded) emu_WriteConfig(0); return; sizeof(emuctrl_actions)/sizeof(emuctrl_actions[0]) - 1, -1); return;
case MA_CTRL_DONE: if (!rom_loaded) emu_WriteConfig(0); return;
default: return; default: return;
} }
} }
@ -1126,7 +1142,6 @@ menu_entry opt_entries[] =
{ "Enable sound", MB_ONOFF, MA_OPT_ENABLE_SOUND, &currentConfig.EmuOpt, 0x004, 0, 0, 1, 1 }, { "Enable sound", MB_ONOFF, MA_OPT_ENABLE_SOUND, &currentConfig.EmuOpt, 0x004, 0, 0, 1, 1 },
{ NULL, MB_NONE, MA_OPT_SOUND_QUALITY, NULL, 0, 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 }, { "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 }, { NULL, MB_NONE, MA_OPT_REGION, NULL, 0, 0, 0, 1, 1 },
{ "Use SRAM/BRAM savestates", MB_ONOFF, MA_OPT_SRAM_STATES, &currentConfig.EmuOpt, 0x001, 0, 0, 1, 1 }, { "Use SRAM/BRAM savestates", MB_ONOFF, MA_OPT_SRAM_STATES, &currentConfig.EmuOpt, 0x001, 0, 0, 1, 1 },
{ NULL, MB_NONE, MA_OPT_CONFIRM_STATES,NULL, 0, 0, 0, 1, 1 }, { NULL, MB_NONE, MA_OPT_CONFIRM_STATES,NULL, 0, 0, 0, 1, 1 },

View file

@ -1,2 +1,2 @@
#define VERSION "1.50a" #define VERSION "1.51"

View file

@ -151,6 +151,7 @@ void emu_prepareDefaultConfig(void)
defaultConfig.scale = 1.20; // fullscreen defaultConfig.scale = 1.20; // fullscreen
defaultConfig.hscale40 = 1.25; defaultConfig.hscale40 = 1.25;
defaultConfig.hscale32 = 1.56; defaultConfig.hscale32 = 1.56;
defaultConfig.turbo_rate = 15;
} }
void emu_setDefaultConfig(void) void emu_setDefaultConfig(void)
@ -862,8 +863,11 @@ static void updateKeys(void)
} }
} }
PicoPad[0] = (unsigned short) allActions[0]; PicoPad[0] = allActions[0] & 0xfff;
PicoPad[1] = (unsigned short) allActions[1]; 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; events = (allActions[0] | allActions[1]) >> 16;

View file

@ -672,14 +672,14 @@ static int count_bound_keys(int action, int pl_idx)
static void draw_key_config(const me_bind_action *opts, int opt_cnt, int player_idx, int sel) static void draw_key_config(const me_bind_action *opts, int opt_cnt, int player_idx, int sel)
{ {
int x, y, tl_y = 16+40, i; int x, y, tl_y = 16+20, i;
menu_draw_begin(); menu_draw_begin();
if (player_idx >= 0) { if (player_idx >= 0) {
text_out16(80+80, 16+20, "Player %i controls", player_idx + 1); text_out16(80+80, 16, "Player %i controls", player_idx + 1);
x = 80+80; x = 80+80;
} else { } else {
text_out16(80+80, 16+20, "Emulator controls"); text_out16(80+80, 16, "Emulator controls");
x = 80+40; x = 80+40;
} }
@ -692,14 +692,14 @@ static void draw_key_config(const me_bind_action *opts, int opt_cnt, int player_
text_out16(x, y, "Done"); text_out16(x, y, "Done");
if (sel < opt_cnt) { if (sel < opt_cnt) {
text_out16(80+30, 220, "Press a button to bind/unbind"); text_out16(80+30, 225, "Press a button to bind/unbind");
text_out16(80+30, 230, "Use SELECT to clear"); text_out16(80+30, 235, "Use SELECT to clear");
text_out16(80+30, 240, "To bind UP/DOWN, hold SELECT"); text_out16(80+30, 245, "To bind UP/DOWN, hold SELECT");
text_out16(80+30, 250, "Select \"Done\" to exit"); text_out16(80+30, 255, "Select \"Done\" to exit");
} else { } else {
text_out16(80+30, 230, "Use Options -> Save cfg"); text_out16(80+30, 235, "Use Options -> Save cfg");
text_out16(80+30, 240, "to save controls"); text_out16(80+30, 245, "to save controls");
text_out16(80+30, 250, "Press X or O to exit"); text_out16(80+30, 255, "Press X or O to exit");
} }
menu_draw_end(); menu_draw_end();
} }
@ -741,6 +741,19 @@ 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, &currentConfig.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) static void draw_kc_sel(int menu_sel)
{ {
int tl_x = 80+25+40, tl_y = 16+60, y; int tl_x = 80+25+40, tl_y = 16+60, y;
@ -749,10 +762,7 @@ static void draw_kc_sel(int menu_sel)
menu_draw_begin(); menu_draw_begin();
menu_draw_selection(tl_x - 16, tl_y + menu_sel*10, 138); menu_draw_selection(tl_x - 16, tl_y + menu_sel*10, 138);
text_out16(tl_x, y, "Player 1"); me_draw(ctrlopt_entries, ctrlopt_entry_count, tl_x, tl_y, NULL, NULL);
text_out16(tl_x, (y+=10), "Player 2");
text_out16(tl_x, (y+=10), "Emulator controls");
text_out16(tl_x, (y+=10), "Done");
menu_draw_end(); menu_draw_end();
} }
@ -779,21 +789,25 @@ static void kc_sel_loop(void)
{ {
int menu_sel = 3, menu_sel_max = 3; int menu_sel = 3, menu_sel_max = 3;
unsigned long inp = 0; unsigned long inp = 0;
int is_6button = PicoOpt & POPT_6BTN_PAD; menu_id selected_id;
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, 0); inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT|BTN_X|BTN_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_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_CIRCLE) { if (inp & BTN_CIRCLE) {
switch (menu_sel) { int is_6button = PicoOpt & POPT_6BTN_PAD;
case 0: key_config_loop(me_ctrl_actions, is_6button ? 12 : 8, 0); return; switch (selected_id) {
case 1: key_config_loop(me_ctrl_actions, is_6button ? 12 : 8, 1); return; case MA_CTRL_PLAYER1: key_config_loop(me_ctrl_actions, is_6button ? 15 : 11, 0); return;
case 2: key_config_loop(emuctrl_actions, case MA_CTRL_PLAYER2: key_config_loop(me_ctrl_actions, is_6button ? 15 : 11, 1); return;
sizeof(emuctrl_actions)/sizeof(emuctrl_actions[0]) - 1, -1); return; case MA_CTRL_EMU: key_config_loop(emuctrl_actions,
case 3: if (!rom_loaded) emu_WriteConfig(0); return; sizeof(emuctrl_actions)/sizeof(emuctrl_actions[0]) - 1, -1); return;
case MA_CTRL_DONE: if (!rom_loaded) emu_WriteConfig(0); return;
default: return; default: return;
} }
} }
@ -1205,12 +1219,11 @@ static void amenu_loop_options(void)
menu_entry opt_entries[] = menu_entry opt_entries[] =
{ {
{ NULL, MB_NONE, MA_OPT_RENDERER, NULL, 0, 0, 0, 1, 1 }, { NULL, MB_NONE, MA_OPT_RENDERER, NULL, 0, 0, 0, 1, 1 },
{ "Accurate sprites", MB_ONOFF, MA_OPT_ACC_SPRITES, &PicoOpt, 0x0080, 0, 0, 0, 1 }, { "Accurate sprites", MB_ONOFF, MA_OPT_ACC_SPRITES, &PicoOpt, 0x080, 0, 0, 0, 1 },
{ "Show FPS", MB_ONOFF, MA_OPT_SHOW_FPS, &currentConfig.EmuOpt, 0x0002, 0, 0, 1, 1 }, { "Show FPS", MB_ONOFF, MA_OPT_SHOW_FPS, &currentConfig.EmuOpt, 0x0002, 0, 0, 1, 1 },
{ NULL, MB_RANGE, MA_OPT_FRAMESKIP, &currentConfig.Frameskip, 0, -1, 16, 1, 1 }, { NULL, MB_RANGE, MA_OPT_FRAMESKIP, &currentConfig.Frameskip, 0, -1, 16, 1, 1 },
{ "Enable sound", MB_ONOFF, MA_OPT_ENABLE_SOUND, &currentConfig.EmuOpt, 0x0004, 0, 0, 1, 1 }, { "Enable sound", MB_ONOFF, MA_OPT_ENABLE_SOUND, &currentConfig.EmuOpt, 0x0004, 0, 0, 1, 1 },
{ NULL, MB_NONE, MA_OPT_SOUND_QUALITY, NULL, 0, 0, 0, 1, 1 }, { NULL, MB_NONE, MA_OPT_SOUND_QUALITY, NULL, 0, 0, 0, 1, 1 },
{ "6 button pad", MB_ONOFF, MA_OPT_6BUTTON_PAD, &PicoOpt, 0x0020, 0, 0, 1, 1 },
{ NULL, MB_NONE, MA_OPT_REGION, NULL, 0, 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, &currentConfig.EmuOpt, 0x0001, 0, 0, 1, 1 }, { "Use SRAM/BRAM savestates", MB_ONOFF, MA_OPT_SRAM_STATES, &currentConfig.EmuOpt, 0x0001, 0, 0, 1, 1 },
{ NULL, MB_NONE, MA_OPT_CONFIRM_STATES,NULL, 0, 0, 0, 1, 1 }, { NULL, MB_NONE, MA_OPT_CONFIRM_STATES,NULL, 0, 0, 0, 1, 1 },

View file

@ -1,2 +1,2 @@
#define VERSION "1.50a" #define VERSION "1.51"