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 # options for code generation
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
CFLAGS = -g -O3 -Wall $(MACHDEP) $(INCLUDE) -DNGC \ 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 \ -D_SZ_ONE_DIRECTORY -D_LZMA_IN_CB -D_LZMA_OUT_READ \
-DLANG_$(LANG) -DLANG_$(LANG)
CXXFLAGS = $(CFLAGS) CXXFLAGS = $(CFLAGS)

View File

@ -30,7 +30,7 @@ LANG := ENGLISH # Supported languages: ENGLISH
# options for code generation # options for code generation
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
CFLAGS = -g -O3 -Wall $(MACHDEP) $(INCLUDE) -DNGC -DWII_DVD \ 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 \ -D_SZ_ONE_DIRECTORY -D_LZMA_IN_CB -D_LZMA_OUT_READ \
-DLANG_$(LANG) -DLANG_$(LANG)
CXXFLAGS = $(CFLAGS) CXXFLAGS = $(CFLAGS)

View File

@ -1,7 +1,7 @@
¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤ ¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤
- FCE Ultra GX - - FCE Ultra GX -
Version 2.0.6 Version 2.0.7
http://code.google.com/p/fceugc http://code.google.com/p/fceugc
(Under GPL License) (Under GPL License)
@ -29,6 +29,15 @@ SNES9x GX project.
|0O×øo· UPDATE HISTORY ·oø×O0| |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] [What's New 2.0.6 - October 21, 2008]
* Right audio channel corruption fixed (thanks cyberdog!) * Right audio channel corruption fixed (thanks cyberdog!)
* Low pass audio filter turned off (muffles audio) * Low pass audio filter turned off (muffles audio)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -29,6 +29,7 @@ extern bool romLoaded;
// All other pads are mapped to this // All other pads are mapped to this
unsigned int nespadmap[] = { unsigned int nespadmap[] = {
JOY_B, JOY_A, JOY_B, JOY_A,
RAPID_B, RAPID_A, // rapid press A/B buttons
JOY_SELECT, JOY_START, JOY_SELECT, JOY_START,
JOY_UP, JOY_DOWN, JOY_UP, JOY_DOWN,
JOY_LEFT, JOY_RIGHT, JOY_LEFT, JOY_RIGHT,
@ -38,6 +39,7 @@ unsigned int nespadmap[] = {
/*** Gamecube controller Padmap ***/ /*** Gamecube controller Padmap ***/
unsigned int gcpadmap[] = { unsigned int gcpadmap[] = {
PAD_BUTTON_B, PAD_BUTTON_A, PAD_BUTTON_B, PAD_BUTTON_A,
PAD_BUTTON_Y, PAD_BUTTON_X,
PAD_TRIGGER_Z, PAD_BUTTON_START, PAD_TRIGGER_Z, PAD_BUTTON_START,
PAD_BUTTON_UP, PAD_BUTTON_DOWN, PAD_BUTTON_UP, PAD_BUTTON_DOWN,
PAD_BUTTON_LEFT, PAD_BUTTON_RIGHT, PAD_BUTTON_LEFT, PAD_BUTTON_RIGHT,
@ -46,6 +48,7 @@ unsigned int gcpadmap[] = {
/*** Wiimote Padmap ***/ /*** Wiimote Padmap ***/
unsigned int wmpadmap[] = { unsigned int wmpadmap[] = {
WPAD_BUTTON_1, WPAD_BUTTON_2, WPAD_BUTTON_1, WPAD_BUTTON_2,
0, 0,
WPAD_BUTTON_MINUS, WPAD_BUTTON_PLUS, WPAD_BUTTON_MINUS, WPAD_BUTTON_PLUS,
WPAD_BUTTON_RIGHT, WPAD_BUTTON_LEFT, WPAD_BUTTON_RIGHT, WPAD_BUTTON_LEFT,
WPAD_BUTTON_UP, WPAD_BUTTON_DOWN, WPAD_BUTTON_UP, WPAD_BUTTON_DOWN,
@ -54,14 +57,16 @@ unsigned int wmpadmap[] = {
/*** Classic Controller Padmap ***/ /*** Classic Controller Padmap ***/
unsigned int ccpadmap[] = { unsigned int ccpadmap[] = {
WPAD_CLASSIC_BUTTON_Y, WPAD_CLASSIC_BUTTON_B, 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_MINUS, WPAD_CLASSIC_BUTTON_PLUS,
WPAD_CLASSIC_BUTTON_UP, WPAD_CLASSIC_BUTTON_DOWN, WPAD_CLASSIC_BUTTON_UP, WPAD_CLASSIC_BUTTON_DOWN,
WPAD_CLASSIC_BUTTON_LEFT, WPAD_CLASSIC_BUTTON_RIGHT, WPAD_CLASSIC_BUTTON_LEFT, WPAD_CLASSIC_BUTTON_RIGHT,
WPAD_CLASSIC_BUTTON_A WPAD_CLASSIC_BUTTON_FULL_L
}; };
/*** Nunchuk + wiimote Padmap ***/ /*** Nunchuk + wiimote Padmap ***/
unsigned int ncpadmap[] = { unsigned int ncpadmap[] = {
WPAD_NUNCHUK_BUTTON_C, WPAD_NUNCHUK_BUTTON_Z, WPAD_NUNCHUK_BUTTON_C, WPAD_NUNCHUK_BUTTON_Z,
0, 0,
WPAD_BUTTON_MINUS, WPAD_BUTTON_PLUS, WPAD_BUTTON_MINUS, WPAD_BUTTON_PLUS,
WPAD_BUTTON_UP, WPAD_BUTTON_DOWN, WPAD_BUTTON_UP, WPAD_BUTTON_DOWN,
WPAD_BUTTON_LEFT, WPAD_BUTTON_RIGHT, WPAD_BUTTON_LEFT, WPAD_BUTTON_RIGHT,
@ -270,7 +275,9 @@ void UpdateCursorPosition (int pad)
/**************************************************************************** /****************************************************************************
* Convert GC Joystick Readings to JOY * 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 ) 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 zapper is on, ignore all buttons except START and SELECT
if(!GCSettings.zapper || nespadmap[i] == JOY_START || nespadmap[i] == JOY_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]; 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 // zapper enabled
if(GCSettings.zapper) if(GCSettings.zapper)
{ {
@ -459,7 +492,23 @@ void GetJoy()
u32 wm_pb = WPAD_ButtonsHeld (0); // wiimote / expansion button info u32 wm_pb = WPAD_ButtonsHeld (0); // wiimote / expansion button info
#endif #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 (GCSettings.Zoom)
{ {
if (gc_py < -36 || gc_py > 36) if (gc_py < -36 || gc_py > 36)

View File

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