add rapid fire buttons 'turbo A/B', turbo speed option

This commit is contained in:
dborth 2008-11-04 08:28:52 +00:00
parent 47c4fa6e25
commit b5297f450e
10 changed files with 95 additions and 16 deletions

View File

@ -30,7 +30,7 @@ LANG := ENGLISH # Supported languages: ENGLISH
# options for code generation
#---------------------------------------------------------------------------------
CFLAGS = -g -O3 -Wall $(MACHDEP) $(INCLUDE) -DNGC \
-DHAVE_ASPRINTF -DSTDC -DFCEU_VERSION_NUMERIC=9812 \
-DHAVE_ASPRINTF -DSTDC -DFCEU_VERSION_NUMERIC=9812 -DFRAMESKIP \
-D_SZ_ONE_DIRECTORY -D_LZMA_IN_CB -D_LZMA_OUT_READ \
-DLANG_$(LANG)
CXXFLAGS = $(CFLAGS)

View File

@ -30,7 +30,7 @@ LANG := ENGLISH # Supported languages: ENGLISH
# options for code generation
#---------------------------------------------------------------------------------
CFLAGS = -g -O3 -Wall $(MACHDEP) $(INCLUDE) -DNGC -DWII_DVD \
-DHAVE_ASPRINTF -DSTDC -DFCEU_VERSION_NUMERIC=9812 \
-DHAVE_ASPRINTF -DSTDC -DFCEU_VERSION_NUMERIC=9812 -DFRAMESKIP \
-D_SZ_ONE_DIRECTORY -D_LZMA_IN_CB -D_LZMA_OUT_READ \
-DLANG_$(LANG)
CXXFLAGS = $(CFLAGS)

View File

@ -1,7 +1,7 @@
¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤
- FCE Ultra GX -
Version 2.0.6
Version 2.0.7
http://code.google.com/p/fceugc
(Under GPL License)
@ -29,6 +29,15 @@ SNES9x GX project.
|0O×øo· UPDATE HISTORY ·oø×O0|
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
[What's New 2.0.7]
* Special thanks to eke-eke & KruLLo for contributions, bugfixes, and tips
* Video code rewritten - now has original, unfiltered, filtered modes
* Zoom option
* 16:9 aspect ratio correction
* SD/USB hot-swapping!
* A/B rapid-fire
* Turbo option
[What's New 2.0.6 - October 21, 2008]
* Right audio channel corruption fixed (thanks cyberdog!)
* Low pass audio filter turned off (muffles audio)

View File

@ -63,5 +63,6 @@ struct SGCSettings{
extern struct SGCSettings GCSettings;
extern int ConfigRequested;
extern int frameskip;
#endif

View File

@ -40,6 +40,7 @@ unsigned char * nesrom = NULL;
int ConfigRequested = 0;
bool isWii;
uint8 *xbsave=NULL;
int frameskip = 0;
extern bool romLoaded;
@ -150,15 +151,25 @@ int main(int argc, char *argv[])
FCEUI_SetSoundQuality(1); // 0 - low, 1 - high, 2 - high (alt.)
ResetVideo_Emu();
static int fskipc=0;
while(1) // emulation loop
{
uint8 *gfx;
int32 *sound;
int32 ssize;
FCEUI_Emulate(&gfx, &sound, &ssize, 0);
xbsave = gfx;
FCEUD_Update(gfx, sound, ssize);
#ifdef FRAMESKIP
fskipc=(fskipc+1)%(frameskip+1);
#endif
FCEUI_Emulate(&gfx, &sound, &ssize, fskipc);
if(!fskipc)
{
xbsave = gfx;
FCEUD_Update(gfx, sound, ssize);
}
if(ConfigRequested)
{

View File

@ -25,6 +25,7 @@
extern unsigned int SMBTimer;
int FDSTimer = 0;
u32 FrameTimer = 0;
int FDSSwitchRequested;
/*** External 2D Video ***/
@ -88,10 +89,10 @@ s16 square[] ATTRIBUTE_ALIGN (32) =
* X, Y, Z
* Values set are for roughly 4:3 aspect
*/
-HASPECT, VASPECT, 0, // 0
HASPECT, VASPECT, 0, // 1
-HASPECT, VASPECT, 0, // 0
HASPECT, VASPECT, 0, // 1
HASPECT, -VASPECT, 0, // 2
-HASPECT, -VASPECT, 0, // 3
-HASPECT, -VASPECT, 0 // 3
};
@ -273,6 +274,7 @@ copy_to_xfb (u32 arg)
}
SMBTimer++;
FrameTimer++;
// FDS switch disk requested - need to eject, select, and insert
// but not all at once!

View File

@ -33,5 +33,6 @@ struct st_palettes {
extern struct st_palettes palettes[];
extern int FDSSwitchRequested;
extern bool progressive;
u32 FrameTimer;
#endif

View File

@ -575,10 +575,12 @@ GetButtonMap(u16 ctrlr_type, char* btn_name)
return pressed;
} // end getButtonMap()
int cfg_btns_count = 10;
int cfg_btns_count = 12;
char cfg_btns_menu[][50] = {
"B - ",
"A - ",
"RAPID B - ",
"RAPID A - ",
"SELECT - ",
"START - ",
"UP - ",
@ -666,6 +668,8 @@ ConfigureButtons (u16 ctrlr_type)
case 6:
case 7:
case 8:
case 9:
case 10:
/*** Change button map ***/
// wait for input
memset (temp, 0, sizeof(temp));
@ -677,7 +681,7 @@ ConfigureButtons (u16 ctrlr_type)
break;
case -1: /*** Button B ***/
case 9:
case 11:
/*** Return ***/
quit = 1;
break;

View File

@ -29,6 +29,7 @@ extern bool romLoaded;
// All other pads are mapped to this
unsigned int nespadmap[] = {
JOY_B, JOY_A,
RAPID_B, RAPID_A, // rapid press A/B buttons
JOY_SELECT, JOY_START,
JOY_UP, JOY_DOWN,
JOY_LEFT, JOY_RIGHT,
@ -38,6 +39,7 @@ unsigned int nespadmap[] = {
/*** Gamecube controller Padmap ***/
unsigned int gcpadmap[] = {
PAD_BUTTON_B, PAD_BUTTON_A,
PAD_BUTTON_Y, PAD_BUTTON_X,
PAD_TRIGGER_Z, PAD_BUTTON_START,
PAD_BUTTON_UP, PAD_BUTTON_DOWN,
PAD_BUTTON_LEFT, PAD_BUTTON_RIGHT,
@ -46,6 +48,7 @@ unsigned int gcpadmap[] = {
/*** Wiimote Padmap ***/
unsigned int wmpadmap[] = {
WPAD_BUTTON_1, WPAD_BUTTON_2,
0, 0,
WPAD_BUTTON_MINUS, WPAD_BUTTON_PLUS,
WPAD_BUTTON_RIGHT, WPAD_BUTTON_LEFT,
WPAD_BUTTON_UP, WPAD_BUTTON_DOWN,
@ -54,14 +57,16 @@ unsigned int wmpadmap[] = {
/*** Classic Controller Padmap ***/
unsigned int ccpadmap[] = {
WPAD_CLASSIC_BUTTON_Y, WPAD_CLASSIC_BUTTON_B,
WPAD_CLASSIC_BUTTON_X, WPAD_CLASSIC_BUTTON_A,
WPAD_CLASSIC_BUTTON_MINUS, WPAD_CLASSIC_BUTTON_PLUS,
WPAD_CLASSIC_BUTTON_UP, WPAD_CLASSIC_BUTTON_DOWN,
WPAD_CLASSIC_BUTTON_LEFT, WPAD_CLASSIC_BUTTON_RIGHT,
WPAD_CLASSIC_BUTTON_A
WPAD_CLASSIC_BUTTON_FULL_L
};
/*** Nunchuk + wiimote Padmap ***/
unsigned int ncpadmap[] = {
WPAD_NUNCHUK_BUTTON_C, WPAD_NUNCHUK_BUTTON_Z,
0, 0,
WPAD_BUTTON_MINUS, WPAD_BUTTON_PLUS,
WPAD_BUTTON_UP, WPAD_BUTTON_DOWN,
WPAD_BUTTON_LEFT, WPAD_BUTTON_RIGHT,
@ -270,7 +275,9 @@ void UpdateCursorPosition (int pad)
/****************************************************************************
* Convert GC Joystick Readings to JOY
****************************************************************************/
u8 PADTUR = 2;
int RAPID_SKIP = 2; // frames to skip between rapid button presses
int RAPID_PRESS = 2; // number of rapid button presses to execute
int rapidbutton[4][2] = {{0}};
unsigned char DecodeJoy( unsigned short pad )
{
@ -381,7 +388,17 @@ unsigned char DecodeJoy( unsigned short pad )
// if zapper is on, ignore all buttons except START and SELECT
if(!GCSettings.zapper || nespadmap[i] == JOY_START || nespadmap[i] == JOY_SELECT)
{
if(nespadmap[i] > 0)
if(nespadmap[i] == RAPID_A)
{
// activate rapid fire for A button
rapidbutton[pad][0] = RAPID_PRESS;
}
else if(nespadmap[i] == RAPID_B)
{
// activate rapid fire for B button
rapidbutton[pad][1] = RAPID_PRESS;
}
else if(nespadmap[i] > 0)
{
J |= nespadmap[i];
}
@ -401,6 +418,22 @@ unsigned char DecodeJoy( unsigned short pad )
}
}
}
// rapid fire buttons
if(FrameTimer % RAPID_SKIP == 0) // only press button every X frames
{
if(rapidbutton[pad][0] > 0) // rapid A
{
J |= JOY_A;
rapidbutton[pad][0]--;
}
if(rapidbutton[pad][1] > 0) // rapid B
{
J |= JOY_B;
rapidbutton[pad][1]--;
}
}
// zapper enabled
if(GCSettings.zapper)
{
@ -459,7 +492,23 @@ void GetJoy()
u32 wm_pb = WPAD_ButtonsHeld (0); // wiimote / expansion button info
#endif
/*** Check for video zoom ***/
// Turbo mode
// RIGHT on c-stick and on classic ctrlr right joystick
if(
(gc_px > 70)
#ifdef HW_RVL
|| (wm_sx > 70)
#endif
)
{
frameskip = 3;
}
else
{
frameskip = 0;
}
// Check for video zoom
if (GCSettings.Zoom)
{
if (gc_py < -36 || gc_py > 36)

View File

@ -16,7 +16,9 @@
#define PI 3.14159265f
#define PADCAL 50
#define MAXJP 9
#define MAXJP 11
#define RAPID_A 256
#define RAPID_B 512
extern unsigned int gcpadmap[];
extern unsigned int wmpadmap[];