ABC turbo

git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@553 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2008-07-16 12:50:33 +00:00
parent 1b38d64b02
commit 6589c840ca
13 changed files with 179 additions and 99 deletions

View file

@ -20,9 +20,11 @@ static char *mystrip(char *str);
extern menu_entry opt_entries[];
extern menu_entry opt2_entries[];
extern menu_entry cdopt_entries[];
extern menu_entry ctrlopt_entries[];
extern const int opt_entry_count;
extern const int opt2_entry_count;
extern const int cdopt_entry_count;
extern const int ctrlopt_entry_count;
#ifdef PSP
extern menu_entry opt3_entries[];
extern const int opt3_entry_count;
@ -33,6 +35,7 @@ static menu_entry *cfg_opts[] =
opt_entries,
opt2_entries,
cdopt_entries,
ctrlopt_entries,
#ifdef PSP
opt3_entries,
#endif
@ -43,6 +46,7 @@ static const int *cfg_opt_counts[] =
&opt_entry_count,
&opt2_entry_count,
&cdopt_entry_count,
&ctrlopt_entry_count,
#ifdef PSP
&opt3_entry_count,
#endif
@ -277,6 +281,9 @@ static int default_var(const menu_entry *me)
case MA_CDOPT_LEDS:
return defaultConfig.EmuOpt;
case MA_CTRL_TURBO_RATE:
return defaultConfig.turbo_rate;
case MA_OPT_SAVE_SLOT:
default:
return 0;
@ -370,7 +377,7 @@ write:
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);
} 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);
}
}

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 hscale32, hscale40; // psp: horizontal scale
int gamma2; // psp: black level
int turbo_rate;
} currentConfig_t;
extern currentConfig_t currentConfig, defaultConfig;
@ -56,6 +57,7 @@ void emu_findKeyBindCombos(void);
void emu_forcedFrame(int opts);
void emu_changeFastForward(int set_on);
void emu_RunEventsPico(unsigned int events);
void emu_DoTurbo(int *pad, int acts);
extern const char * const keyNames[];
void emu_prepareDefaultConfig(void);

View file

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

View file

@ -91,6 +91,11 @@ typedef enum
MA_CDOPT_SCALEROT_CHIP,
MA_CDOPT_BETTER_SYNC,
MA_CDOPT_DONE,
MA_CTRL_PLAYER1,
MA_CTRL_PLAYER2,
MA_CTRL_EMU,
MA_CTRL_TURBO_RATE,
MA_CTRL_DONE,
} menu_id;
typedef struct
@ -112,7 +117,7 @@ typedef struct
int mask;
} 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