- pretty much done commenting... might have a chance to start cleanup tonight
- had to change the name of the 'brk' variable name again... please don't change it back... brk is a reserved word in *nix.
This commit is contained in:
parent
8d2dfca52c
commit
c39de3f8a8
|
@ -21,13 +21,14 @@
|
|||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static uint8 chrcmd[8], prg0, prg1, brk, latc, mirr;
|
||||
// brk is a system call in *nix, and is an illegal variable name - soules
|
||||
static uint8 chrcmd[8], prg0, prg1, bbrk, latc, mirr;
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{chrcmd, 8, "CHRCMD"},
|
||||
{&prg0, 1, "PRG0"},
|
||||
{&prg1, 1, "PRG1"},
|
||||
{&brk, 1, "BRK"},
|
||||
{&bbrk, 1, "BRK"},
|
||||
{&mirr, 1, "MIRR"},
|
||||
{0}
|
||||
};
|
||||
|
@ -47,9 +48,9 @@ static void Sync(void)
|
|||
static void UNLSL1632CW(uint32 A, uint8 V)
|
||||
{
|
||||
int cbase=(MMC3_cmd&0x80)<<5;
|
||||
int page0=(brk&0x08)<<5;
|
||||
int page1=(brk&0x20)<<3;
|
||||
int page2=(brk&0x80)<<1;
|
||||
int page0=(bbrk&0x08)<<5;
|
||||
int page1=(bbrk&0x20)<<3;
|
||||
int page2=(bbrk&0x80)<<1;
|
||||
setchr1(cbase^0x0000,page0|(DRegBuf[0]&(~1)));
|
||||
setchr1(cbase^0x0400,page0|DRegBuf[0]|1);
|
||||
setchr1(cbase^0x0800,page0|(DRegBuf[1]&(~1)));
|
||||
|
@ -64,10 +65,10 @@ static DECLFW(UNLSL1632CMDWrite)
|
|||
{
|
||||
if((A&0xA131)==0xA131)
|
||||
{
|
||||
brk=V;
|
||||
latc = brk;
|
||||
bbrk=V;
|
||||
latc = bbrk;
|
||||
}
|
||||
if(brk&2)
|
||||
if(bbrk&2)
|
||||
{
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
|
@ -99,7 +100,7 @@ static DECLFW(UNLSL1632CMDWrite)
|
|||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
if(brk&2)
|
||||
if(bbrk&2)
|
||||
{
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
|
|
|
@ -35,14 +35,23 @@ static int cspec=0;
|
|||
|
||||
extern int gametype;
|
||||
|
||||
/* Necessary for proper GUI functioning(configuring when a game isn't loaded). */
|
||||
void InputUserActiveFix(void)
|
||||
/**
|
||||
* Necessary for proper GUI functioning (configuring when a game isn't loaded).
|
||||
*/
|
||||
void
|
||||
InputUserActiveFix()
|
||||
{
|
||||
int x;
|
||||
for(x=0;x<3;x++) InputType[x]=UsrInputType[x];
|
||||
for(x = 0; x < 3; x++) {
|
||||
InputType[x] = UsrInputType[x];
|
||||
}
|
||||
}
|
||||
|
||||
void ParseGIInput(FCEUGI *gi)
|
||||
/**
|
||||
* Parse game information and configure the input devices accordingly.
|
||||
*/
|
||||
void
|
||||
ParseGIInput(FCEUGI *gi)
|
||||
{
|
||||
gametype=gi->type;
|
||||
|
||||
|
@ -50,12 +59,15 @@ void ParseGIInput(FCEUGI *gi)
|
|||
InputType[1] = UsrInputType[1];
|
||||
InputType[2] = UsrInputType[2];
|
||||
|
||||
if(gi->input[0]>=0)
|
||||
if(gi->input[0]>=0) {
|
||||
InputType[0] = gi->input[0];
|
||||
if(gi->input[1]>=0)
|
||||
}
|
||||
if(gi->input[1]>=0) {
|
||||
InputType[1] = gi->input[1];
|
||||
if(gi->inputfc>=0)
|
||||
}
|
||||
if(gi->inputfc>=0) {
|
||||
InputType[2] = gi->inputfc;
|
||||
}
|
||||
cspec = gi->cspecial;
|
||||
}
|
||||
|
||||
|
@ -79,7 +91,12 @@ static void UpdateTopRider(void);
|
|||
static uint32 JSreturn=0;
|
||||
int NoWaiting=1;
|
||||
|
||||
static void DoCheatSeq(void)
|
||||
/**
|
||||
* Configure cheat devices (game genie, etc.). Restarts the keyboard
|
||||
* and video subsystems.
|
||||
*/
|
||||
static void
|
||||
DoCheatSeq()
|
||||
{
|
||||
SilenceSound(1);
|
||||
KillKeyboard();
|
||||
|
@ -98,18 +115,17 @@ static int DIPS=0;
|
|||
static uint8 keyonce[MKK_COUNT];
|
||||
#define KEY(__a) keys[MKK(__a)]
|
||||
|
||||
static int _keyonly(int a)
|
||||
{
|
||||
if(keys[a])
|
||||
{
|
||||
if(!keyonce[a])
|
||||
static int
|
||||
_keyonly(int a)
|
||||
{
|
||||
if(keys[a]) {
|
||||
if(!keyonce[a]) {
|
||||
keyonce[a] = 1;
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
} else {
|
||||
keyonce[a] = 0;
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
@ -117,89 +133,144 @@ static int _keyonly(int a)
|
|||
|
||||
static int cidisabled=0;
|
||||
|
||||
static void KeyboardCommands(void)
|
||||
/**
|
||||
* Parse keyboard commands and execute accordingly.
|
||||
*/
|
||||
static void
|
||||
KeyboardCommands()
|
||||
{
|
||||
int is_shift, is_alt;
|
||||
|
||||
// get the keyboard input
|
||||
keys = GetKeyboard();
|
||||
|
||||
if(InputType[2]==SIFC_FKB)
|
||||
{
|
||||
if(keyonly(SCROLLLOCK))
|
||||
{
|
||||
// check if the family keyboard is enabled
|
||||
if(InputType[2] == SIFC_FKB) {
|
||||
if(keyonly(SCROLLLOCK)) {
|
||||
cidisabled ^= 1;
|
||||
FCEUI_DispMessage("Family Keyboard %sabled.",cidisabled?"en":"dis");
|
||||
FCEUI_DispMessage("Family Keyboard %sabled.",
|
||||
cidisabled ? "en" : "dis");
|
||||
}
|
||||
#ifdef SDL
|
||||
SDL_WM_GrabInput(cidisabled ? SDL_GRAB_ON : SDL_GRAB_OFF);
|
||||
#endif
|
||||
if(cidisabled) return;
|
||||
if(cidisabled) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
is_shift = KEY(LEFTSHIFT) | KEY(RIGHTSHIFT);
|
||||
is_alt = KEY(LEFTALT) | KEY(RIGHTALT);
|
||||
|
||||
if(keyonly(F4))
|
||||
{
|
||||
if(is_shift) FCEUI_SetRenderDisable(-1, 2);
|
||||
else FCEUI_SetRenderDisable(2, -1);
|
||||
// f4 controls rendering
|
||||
if(keyonly(F4)) {
|
||||
if(is_shift) {
|
||||
FCEUI_SetRenderDisable(-1, 2);
|
||||
} else {
|
||||
FCEUI_SetRenderDisable(2, -1);
|
||||
}
|
||||
}
|
||||
#ifdef SDL
|
||||
if(keyonly(ENTER) && is_alt) ToggleFS();
|
||||
#endif
|
||||
|
||||
// Alt-Enter to toggle full-screen
|
||||
if(keyonly(ENTER) && is_alt) {
|
||||
ToggleFS();
|
||||
}
|
||||
|
||||
// Toggle throttling
|
||||
NoWaiting &= ~1;
|
||||
if(KEY(GRAVE))
|
||||
if(KEY(GRAVE)) {
|
||||
NoWaiting |= 1;
|
||||
|
||||
if(gametype==GIT_FDS)
|
||||
{
|
||||
if(keyonly(F6)) FCEUI_FDSSelect();
|
||||
if(keyonly(F8)) FCEUI_FDSInsert();
|
||||
}
|
||||
|
||||
if(keyonly(F9)) FCEUI_SaveSnapshot();
|
||||
if(gametype!=GIT_NSF)
|
||||
{
|
||||
if(keyonly(F2)) DoCheatSeq();
|
||||
if(keyonly(F5))
|
||||
{
|
||||
if(is_shift)
|
||||
// Famicom disk-system games
|
||||
if(gametype==GIT_FDS) {
|
||||
if(keyonly(F6)) {
|
||||
FCEUI_FDSSelect();
|
||||
}
|
||||
if(keyonly(F8)) {
|
||||
FCEUI_FDSInsert();
|
||||
}
|
||||
}
|
||||
|
||||
// f9 is save snapshot key
|
||||
if(keyonly(F9)) {
|
||||
FCEUI_SaveSnapshot();
|
||||
}
|
||||
|
||||
// if not NES Sound Format
|
||||
if(gametype != GIT_NSF) {
|
||||
// f2 to enable cheats
|
||||
if(keyonly(F2)) {
|
||||
DoCheatSeq();
|
||||
}
|
||||
|
||||
// f5 to save state, Shift-f5 to save movie
|
||||
if(keyonly(F5)) {
|
||||
if(is_shift) {
|
||||
FCEUI_SaveMovie(NULL,0,NULL);
|
||||
else
|
||||
} else {
|
||||
FCEUI_SaveState(NULL);
|
||||
}
|
||||
if(keyonly(F7))
|
||||
{
|
||||
if(is_shift)
|
||||
FCEUI_LoadMovie(NULL,0,0); //mbg merge 7/23/06 loadmovie takes another arg now
|
||||
else
|
||||
}
|
||||
|
||||
// f7 to load state, Shift-f7 to load movie
|
||||
if(keyonly(F7)) {
|
||||
if(is_shift) {
|
||||
//mbg merge 7/23/06 loadmovie takes another arg now
|
||||
FCEUI_LoadMovie(NULL,0,0);
|
||||
} else {
|
||||
FCEUI_LoadState(NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyonly(F1)) FCEUI_ToggleTileView();
|
||||
// f1 to toggle tile view
|
||||
if(keyonly(F1)) {
|
||||
FCEUI_ToggleTileView();
|
||||
}
|
||||
|
||||
if(keyonly(MINUS)) DecreaseEmulationSpeed();
|
||||
if(keyonly(EQUAL)) IncreaseEmulationSpeed();
|
||||
if(keyonly(BACKSPACE)) FCEUI_MovieToggleFrameDisplay();
|
||||
if(keyonly(BACKSLASH)) FCEUI_ToggleEmulationPause();
|
||||
if(keyonly(RIGHTCONTROL)) FCEUI_FrameAdvance();
|
||||
// - to decrease speed, = to increase speed
|
||||
if(keyonly(MINUS)) {
|
||||
DecreaseEmulationSpeed();
|
||||
}
|
||||
if(keyonly(EQUAL)) {
|
||||
IncreaseEmulationSpeed();
|
||||
}
|
||||
|
||||
if(keyonly(F10)) FCEUI_ResetNES();
|
||||
if(keyonly(F11)) FCEUI_PowerNES();
|
||||
if(keyonly(BACKSPACE)) {
|
||||
FCEUI_MovieToggleFrameDisplay();
|
||||
}
|
||||
if(keyonly(BACKSLASH)) {
|
||||
FCEUI_ToggleEmulationPause();
|
||||
}
|
||||
if(keyonly(RIGHTCONTROL)) {
|
||||
FCEUI_FrameAdvance();
|
||||
}
|
||||
|
||||
if(KEY(F12) || KEY(ESCAPE)) CloseGame();
|
||||
// f10 reset, f11 power
|
||||
if(keyonly(F10)) {
|
||||
FCEUI_ResetNES();
|
||||
}
|
||||
if(keyonly(F11)) {
|
||||
FCEUI_PowerNES();
|
||||
}
|
||||
|
||||
if(gametype==GIT_VSUNI)
|
||||
{
|
||||
// F12 or Esc close game
|
||||
if(KEY(F12) || KEY(ESCAPE)) {
|
||||
CloseGame();
|
||||
}
|
||||
|
||||
// VS Unisystem games
|
||||
if(gametype == GIT_VSUNI) {
|
||||
// insert coin
|
||||
if(keyonly(F8)) FCEUI_VSUniCoin();
|
||||
if(keyonly(F6))
|
||||
{
|
||||
|
||||
// toggle dipswitch display
|
||||
if(keyonly(F6)) {
|
||||
DIPS^=1;
|
||||
FCEUI_VSUniToggleDIPView();
|
||||
}
|
||||
if(!(DIPS&1)) goto DIPSless;
|
||||
|
||||
// toggle the various dipswitches
|
||||
if(keyonly(1)) FCEUI_VSUniToggleDIP(0);
|
||||
if(keyonly(2)) FCEUI_VSUniToggleDIP(1);
|
||||
if(keyonly(3)) FCEUI_VSUniToggleDIP(2);
|
||||
|
@ -208,9 +279,7 @@ static void KeyboardCommands(void)
|
|||
if(keyonly(6)) FCEUI_VSUniToggleDIP(5);
|
||||
if(keyonly(7)) FCEUI_VSUniToggleDIP(6);
|
||||
if(keyonly(8)) FCEUI_VSUniToggleDIP(7);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
static uint8 bbuf[32];
|
||||
static int bbuft;
|
||||
static int barcoder = 0;
|
||||
|
@ -220,32 +289,42 @@ static void KeyboardCommands(void)
|
|||
if(KEY(KP_MINUS) || KEY(MINUS)) FCEUI_NTSCDEC();
|
||||
if(KEY(KP_PLUS) || KEY(EQUAL)) FCEUI_NTSCINC();
|
||||
|
||||
if((InputType[2] == SIFC_BWORLD) || (cspec == SIS_DATACH))
|
||||
{
|
||||
if(keyonly(F8))
|
||||
{
|
||||
if((InputType[2] == SIFC_BWORLD) || (cspec == SIS_DATACH)) {
|
||||
if(keyonly(F8)) {
|
||||
barcoder ^= 1;
|
||||
if(!barcoder)
|
||||
{
|
||||
if(InputType[2] == SIFC_BWORLD)
|
||||
{
|
||||
if(!barcoder) {
|
||||
if(InputType[2] == SIFC_BWORLD) {
|
||||
strcpy((char *)&BWorldData[1], (char *)bbuf);
|
||||
BWorldData[0] = 1;
|
||||
}
|
||||
else
|
||||
} else {
|
||||
FCEUI_DatachSet(bbuf);
|
||||
}
|
||||
FCEUI_DispMessage("Barcode Entered");
|
||||
} else {
|
||||
bbuft = 0;
|
||||
FCEUI_DispMessage("Enter Barcode");
|
||||
}
|
||||
else { bbuft = 0; FCEUI_DispMessage("Enter Barcode");}
|
||||
}
|
||||
} else barcoder = 0;
|
||||
} else {
|
||||
barcoder = 0;
|
||||
}
|
||||
|
||||
#define SSM(x) \
|
||||
{ if(barcoder) { if(bbuft < 13) {bbuf[bbuft++] = '0' + x; bbuf[bbuft] = 0;} FCEUI_DispMessage("Barcode: %s",bbuf);} \
|
||||
else { \
|
||||
if(is_shift) FCEUI_SelectMovie(x,1); \
|
||||
else FCEUI_SelectState(x,1); \
|
||||
} }
|
||||
do { \
|
||||
if(barcoder) { \
|
||||
if(bbuft < 13) { \
|
||||
bbuf[bbuft++] = '0' + x; \
|
||||
bbuf[bbuft] = 0; \
|
||||
} \
|
||||
FCEUI_DispMessage("Barcode: %s", bbuf); \
|
||||
} else { \
|
||||
if(is_shift) { \
|
||||
FCEUI_SelectMovie(x,1); \
|
||||
} else { \
|
||||
FCEUI_SelectState(x,1); \
|
||||
} \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
DIPSless:
|
||||
if(keyonly(0)) SSM(0);
|
||||
|
@ -287,10 +366,16 @@ ButtConfig GamePadConfig[4][10]={
|
|||
};
|
||||
|
||||
|
||||
static void UpdateGamepad(void)
|
||||
/**
|
||||
* Update the gamepad button configurations.
|
||||
*/
|
||||
static void
|
||||
UpdateGamepad(void)
|
||||
{
|
||||
if(FCEUI_IsMovieActive()<0)
|
||||
// don't update during movie playback
|
||||
if(FCEUI_IsMovieActive() < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
static int rapid=0;
|
||||
uint32 JS=0;
|
||||
|
@ -299,17 +384,24 @@ static void UpdateGamepad(void)
|
|||
|
||||
rapid ^= 1;
|
||||
|
||||
for(wg=0;wg<4;wg++)
|
||||
{
|
||||
for(x=0;x<8;x++)
|
||||
if(DTestButton(&GamePadConfig[wg][x]))
|
||||
// go through each of the four game pads
|
||||
for(wg = 0; wg < 4; wg++) {
|
||||
// the 4 directional buttons, start, select, a, b
|
||||
for(x = 0; x < 8; x++) {
|
||||
if(DTestButton(&GamePadConfig[wg][x])) {
|
||||
JS |= (1 << x) << (wg << 3);
|
||||
}
|
||||
}
|
||||
|
||||
if(rapid)
|
||||
for(x=0;x<2;x++)
|
||||
if(DTestButton(&GamePadConfig[wg][8+x]))
|
||||
// rapid-fire a, rapid-fire b
|
||||
if(rapid) {
|
||||
for(x = 0; x < 2; x++) {
|
||||
if(DTestButton(&GamePadConfig[wg][8+x])) {
|
||||
JS |= (1 << x) << (wg << 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// for(x=0;x<32;x+=8) /* Now, test to see if anything weird(up+down at same time)
|
||||
// is happening, and correct */
|
||||
|
@ -338,17 +430,27 @@ ButtConfig powerpadsc[2][12]={
|
|||
|
||||
static uint32 powerpadbuf[2]={0,0};
|
||||
|
||||
static uint32 UpdatePPadData(int w)
|
||||
/**
|
||||
* Update power pad button configuration.
|
||||
*/
|
||||
static uint32
|
||||
UpdatePPadData(int w)
|
||||
{
|
||||
if(FCEUI_IsMovieActive()<0)
|
||||
// don't update if a movie is playing
|
||||
if(FCEUI_IsMovieActive() < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32 r = 0;
|
||||
ButtConfig *ppadtsc = powerpadsc[w];
|
||||
int x;
|
||||
|
||||
for(x=0;x<12;x++)
|
||||
if(DTestButton(&ppadtsc[x])) r|=1<<x;
|
||||
// update each of the 12 buttons
|
||||
for(x = 0; x < 12; x++) {
|
||||
if(DTestButton(&ppadtsc[x])) {
|
||||
r |= 1 << x;
|
||||
}
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
@ -356,7 +458,11 @@ static uint32 UpdatePPadData(int w)
|
|||
static uint32 MouseData[3]={0,0,0};
|
||||
static uint8 fkbkeys[0x48];
|
||||
|
||||
void FCEUD_UpdateInput(void)
|
||||
/**
|
||||
* Update all of the input devices required for the active game.
|
||||
*/
|
||||
void
|
||||
FCEUD_UpdateInput()
|
||||
{
|
||||
int x;
|
||||
int t = 0;
|
||||
|
@ -364,39 +470,71 @@ void FCEUD_UpdateInput(void)
|
|||
UpdatePhysicalInput();
|
||||
KeyboardCommands();
|
||||
|
||||
for(x=0;x<2;x++)
|
||||
switch(InputType[x])
|
||||
{
|
||||
case SI_GAMEPAD:t|=1;break;
|
||||
case SI_ARKANOID:t|=2;break;
|
||||
case SI_ZAPPER:t|=2;break;
|
||||
for(x = 0; x < 2; x++) {
|
||||
switch(InputType[x]) {
|
||||
case SI_GAMEPAD:
|
||||
t |= 1;
|
||||
break;
|
||||
case SI_ARKANOID:
|
||||
t |= 2;
|
||||
break;
|
||||
case SI_ZAPPER:
|
||||
t |= 2;
|
||||
break;
|
||||
case SI_POWERPADA:
|
||||
case SI_POWERPADB:powerpadbuf[x]=UpdatePPadData(x);break;
|
||||
case SI_POWERPADB:
|
||||
powerpadbuf[x] = UpdatePPadData(x);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch(InputType[2])
|
||||
{
|
||||
case SIFC_ARKANOID:t|=2;break;
|
||||
case SIFC_SHADOW:t|=2;break;
|
||||
case SIFC_FKB:if(cidisabled) UpdateFKB();break;
|
||||
case SIFC_HYPERSHOT: UpdateHyperShot();break;
|
||||
case SIFC_MAHJONG: UpdateMahjong();break;
|
||||
case SIFC_QUIZKING: UpdateQuizKing();break;
|
||||
switch(InputType[2]) {
|
||||
case SIFC_ARKANOID:
|
||||
t |= 2;
|
||||
break;
|
||||
case SIFC_SHADOW:
|
||||
t |= 2;
|
||||
break;
|
||||
case SIFC_FKB:
|
||||
if(cidisabled) {
|
||||
UpdateFKB();
|
||||
}
|
||||
break;
|
||||
case SIFC_HYPERSHOT:
|
||||
UpdateHyperShot();
|
||||
break;
|
||||
case SIFC_MAHJONG:
|
||||
UpdateMahjong();
|
||||
break;
|
||||
case SIFC_QUIZKING:
|
||||
UpdateQuizKing();
|
||||
break;
|
||||
case SIFC_FTRAINERB:
|
||||
case SIFC_FTRAINERA: UpdateFTrainer();break;
|
||||
case SIFC_TOPRIDER: UpdateTopRider();break;
|
||||
case SIFC_OEKAKIDS:t|=2;break;
|
||||
|
||||
case SIFC_FTRAINERA:
|
||||
UpdateFTrainer();
|
||||
break;
|
||||
case SIFC_TOPRIDER:
|
||||
UpdateTopRider();
|
||||
break;
|
||||
case SIFC_OEKAKIDS:
|
||||
t |= 2;
|
||||
break;
|
||||
}
|
||||
|
||||
if(t&1)
|
||||
if(t & 1) {
|
||||
UpdateGamepad();
|
||||
}
|
||||
|
||||
if(t&2)
|
||||
if(t & 2) {
|
||||
GetMouseData(MouseData);
|
||||
}
|
||||
}
|
||||
|
||||
void InitOtherInput(void)
|
||||
/**
|
||||
* Initialize "other" input devices? Not entirely sure what this does yet.
|
||||
*/
|
||||
void
|
||||
InitOtherInput()
|
||||
{
|
||||
void *InputDPtr;
|
||||
|
||||
|
@ -404,17 +542,24 @@ void InitOtherInput(void)
|
|||
int x;
|
||||
int attrib;
|
||||
|
||||
for(t=0,x=0;x<2;x++)
|
||||
{
|
||||
for(t = 0, x = 0; x < 2; x++) {
|
||||
attrib = 0;
|
||||
InputDPtr = 0;
|
||||
switch(InputType[x])
|
||||
{
|
||||
|
||||
switch(InputType[x]) {
|
||||
case SI_POWERPADA:
|
||||
case SI_POWERPADB:InputDPtr=&powerpadbuf[x];break;
|
||||
case SI_GAMEPAD:InputDPtr=&JSreturn;break;
|
||||
case SI_ARKANOID:InputDPtr=MouseData;t|=1;break;
|
||||
case SI_ZAPPER:InputDPtr=MouseData;
|
||||
case SI_POWERPADB:
|
||||
InputDPtr = &powerpadbuf[x];
|
||||
break;
|
||||
case SI_GAMEPAD:
|
||||
InputDPtr = &JSreturn;
|
||||
break;
|
||||
case SI_ARKANOID:
|
||||
InputDPtr = MouseData;
|
||||
t |= 1;
|
||||
break;
|
||||
case SI_ZAPPER:
|
||||
InputDPtr = MouseData;
|
||||
t |= 1;
|
||||
attrib = 1;
|
||||
break;
|
||||
|
@ -424,27 +569,52 @@ void InitOtherInput(void)
|
|||
|
||||
attrib = 0;
|
||||
InputDPtr = 0;
|
||||
switch(InputType[2])
|
||||
{
|
||||
case SIFC_SHADOW:InputDPtr=MouseData;t|=1;attrib=1;break;
|
||||
case SIFC_OEKAKIDS:InputDPtr=MouseData;t|=1;attrib=1;break;
|
||||
case SIFC_ARKANOID:InputDPtr=MouseData;t|=1;break;
|
||||
case SIFC_FKB:InputDPtr=fkbkeys;break;
|
||||
case SIFC_HYPERSHOT:InputDPtr=&HyperShotData;break;
|
||||
case SIFC_MAHJONG:InputDPtr=&MahjongData;break;
|
||||
case SIFC_QUIZKING:InputDPtr=&QuizKingData;break;
|
||||
case SIFC_TOPRIDER:InputDPtr=&TopRiderData;break;
|
||||
case SIFC_BWORLD:InputDPtr=BWorldData;break;
|
||||
switch(InputType[2]) {
|
||||
case SIFC_SHADOW:
|
||||
InputDPtr = MouseData;
|
||||
t |= 1;
|
||||
attrib = 1;
|
||||
break;
|
||||
case SIFC_OEKAKIDS:
|
||||
InputDPtr = MouseData;
|
||||
t |= 1;
|
||||
attrib = 1;
|
||||
break;
|
||||
case SIFC_ARKANOID:
|
||||
InputDPtr = MouseData;
|
||||
t |= 1;
|
||||
break;
|
||||
case SIFC_FKB:
|
||||
InputDPtr = fkbkeys;
|
||||
break;
|
||||
case SIFC_HYPERSHOT:
|
||||
InputDPtr = &HyperShotData;
|
||||
break;
|
||||
case SIFC_MAHJONG:
|
||||
InputDPtr = &MahjongData;
|
||||
break;
|
||||
case SIFC_QUIZKING:
|
||||
InputDPtr = &QuizKingData;
|
||||
break;
|
||||
case SIFC_TOPRIDER:
|
||||
InputDPtr = &TopRiderData;
|
||||
break;
|
||||
case SIFC_BWORLD:
|
||||
InputDPtr = BWorldData;
|
||||
break;
|
||||
case SIFC_FTRAINERA:
|
||||
case SIFC_FTRAINERB:InputDPtr=&FTrainerData;break;
|
||||
case SIFC_FTRAINERB:
|
||||
InputDPtr = &FTrainerData;
|
||||
break;
|
||||
}
|
||||
|
||||
FCEUI_SetInputFC(InputType[2], InputDPtr, attrib);
|
||||
FCEUI_DisableFourScore(eoptions & EO_NOFOURSCORE);
|
||||
|
||||
if(t)
|
||||
if(t) {
|
||||
InitMouse();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ButtConfig fkbmap[0x48]=
|
||||
|
@ -462,35 +632,43 @@ ButtConfig fkbmap[0x48]=
|
|||
MK(CURSORUP),MK(CURSORLEFT),MK(CURSORRIGHT),MK(CURSORDOWN)
|
||||
};
|
||||
|
||||
static void UpdateFKB(void)
|
||||
/**
|
||||
* Update the button configuration for the Family KeyBoard.
|
||||
*/
|
||||
static void
|
||||
UpdateFKB()
|
||||
{
|
||||
int x;
|
||||
|
||||
for(x=0;x<0x48;x++)
|
||||
{
|
||||
for(x = 0; x < 0x48; x++) {
|
||||
fkbkeys[x] = 0;
|
||||
|
||||
if(DTestButton(&fkbmap[x]))
|
||||
if(DTestButton(&fkbmap[x])) {
|
||||
fkbkeys[x] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static ButtConfig HyperShotButtons[4]=
|
||||
{
|
||||
MK(Q),MK(W),MK(E),MK(R)
|
||||
};
|
||||
|
||||
static void UpdateHyperShot(void)
|
||||
/**
|
||||
* Update the button configuration for the HyperShot input device.
|
||||
*/
|
||||
static void
|
||||
UpdateHyperShot()
|
||||
{
|
||||
int x;
|
||||
|
||||
HyperShotData=0;
|
||||
for(x=0;x<0x4;x++)
|
||||
{
|
||||
if(DTestButton(&HyperShotButtons[x]))
|
||||
for(x = 0; x < 0x4; x++) {
|
||||
if(DTestButton(&HyperShotButtons[x])) {
|
||||
HyperShotData |= 1 << x;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static ButtConfig MahjongButtons[21]=
|
||||
{
|
||||
|
@ -499,35 +677,42 @@ static ButtConfig MahjongButtons[21]=
|
|||
MK(Z),MK(X),MK(C),MK(V),MK(B),MK(N),MK(M)
|
||||
};
|
||||
|
||||
static void UpdateMahjong(void)
|
||||
/**
|
||||
* Update the button configuration for the Mahjong input device.
|
||||
*/
|
||||
static void
|
||||
UpdateMahjong()
|
||||
{
|
||||
int x;
|
||||
|
||||
MahjongData=0;
|
||||
for(x=0;x<21;x++)
|
||||
{
|
||||
if(DTestButton(&MahjongButtons[x]))
|
||||
for(x = 0; x < 21; x++) {
|
||||
if(DTestButton(&MahjongButtons[x])) {
|
||||
MahjongData |= 1 << x;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ButtConfig QuizKingButtons[6]=
|
||||
{
|
||||
MK(Q),MK(W),MK(E),MK(R),MK(T),MK(Y)
|
||||
};
|
||||
|
||||
static void UpdateQuizKing(void)
|
||||
/**
|
||||
* Update the button configuration for the QuizKing input device.
|
||||
*/
|
||||
static void
|
||||
UpdateQuizKing()
|
||||
{
|
||||
int x;
|
||||
|
||||
QuizKingData=0;
|
||||
|
||||
for(x=0;x<6;x++)
|
||||
{
|
||||
if(DTestButton(&QuizKingButtons[x]))
|
||||
for(x = 0; x < 6; x++) {
|
||||
if(DTestButton(&QuizKingButtons[x])) {
|
||||
QuizKingData |= 1 << x;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ButtConfig TopRiderButtons[8]=
|
||||
|
@ -535,13 +720,19 @@ ButtConfig TopRiderButtons[8]=
|
|||
MK(Q),MK(W),MK(E),MK(R),MK(T),MK(Y),MK(U),MK(I)
|
||||
};
|
||||
|
||||
static void UpdateTopRider(void)
|
||||
/**
|
||||
* Update the button configuration for the TopRider input device.
|
||||
*/
|
||||
static void
|
||||
UpdateTopRider()
|
||||
{
|
||||
int x;
|
||||
TopRiderData=0;
|
||||
for(x=0;x<8;x++)
|
||||
if(DTestButton(&TopRiderButtons[x]))
|
||||
TopRiderData|=1<<x;
|
||||
for(x = 0; x < 8; x++) {
|
||||
if(DTestButton(&TopRiderButtons[x])) {
|
||||
TopRiderData |= (1 << x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ButtConfig FTrainerButtons[12]=
|
||||
|
@ -552,75 +743,86 @@ ButtConfig FTrainerButtons[12]=
|
|||
MK(M),MK(COMMA),MK(PERIOD),MK(SLASH)
|
||||
};
|
||||
|
||||
static void UpdateFTrainer(void)
|
||||
/**
|
||||
* Update the button configuration for the FTrainer input device.
|
||||
*/
|
||||
static void
|
||||
UpdateFTrainer()
|
||||
{
|
||||
int x;
|
||||
|
||||
FTrainerData = 0;
|
||||
|
||||
for(x=0;x<12;x++)
|
||||
{
|
||||
if(DTestButton(&FTrainerButtons[x]))
|
||||
FTrainerData|=1<<x;
|
||||
for(x = 0; x < 12; x++) {
|
||||
if(DTestButton(&FTrainerButtons[x])) {
|
||||
FTrainerData |= (1 << x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void subcon(char *text, ButtConfig *bc)
|
||||
/**
|
||||
* I think this function takes in button inputs until either it sees
|
||||
* two of the same button presses in a row or gets four inputs and
|
||||
* then saves the total number of button presses. Needs an overhaul.
|
||||
*/
|
||||
static void
|
||||
subcon(char *text,
|
||||
ButtConfig *bc)
|
||||
{
|
||||
uint8 buf[256];
|
||||
int wc;
|
||||
|
||||
for(wc=0;wc<MAXBUTTCONFIG;wc++)
|
||||
{
|
||||
for(wc = 0; wc < MAXBUTTCONFIG; wc++) {
|
||||
sprintf((char *)buf, "%s (%d)", text, wc + 1);
|
||||
DWaitButton(buf, bc, wc);
|
||||
|
||||
if(wc && bc->ButtType[wc]==bc->ButtType[wc-1] && bc->DeviceNum[wc]==bc->DeviceNum[wc-1] &&
|
||||
bc->ButtonNum[wc]==bc->ButtonNum[wc-1])
|
||||
if(wc &&
|
||||
bc->ButtType[wc] == bc->ButtType[wc - 1] &&
|
||||
bc->DeviceNum[wc] == bc->DeviceNum[wc - 1] &&
|
||||
bc->ButtonNum[wc]==bc->ButtonNum[wc-1]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
bc->NumC = wc;
|
||||
}
|
||||
|
||||
void ConfigDevice(int which, int arg)
|
||||
/**
|
||||
* Update the button configuration for a specified device.
|
||||
*/
|
||||
void
|
||||
ConfigDevice(int which,
|
||||
int arg)
|
||||
{
|
||||
uint8 buf[256];
|
||||
int x;
|
||||
char *str[10]={"A","B","SELECT","START","UP","DOWN","LEFT","RIGHT","Rapid A","Rapid B"};
|
||||
|
||||
ButtonConfigBegin();
|
||||
switch(which)
|
||||
{
|
||||
switch(which) {
|
||||
case FCFGD_QUIZKING:
|
||||
for(x=0;x<6;x++)
|
||||
{
|
||||
for(x = 0; x < 6; x++) {
|
||||
sprintf((char *)buf, "Quiz King Buzzer #%d", x+1);
|
||||
subcon((char *)buf, &QuizKingButtons[x]);
|
||||
}
|
||||
break;
|
||||
case FCFGD_HYPERSHOT:
|
||||
for(x=0;x<4;x++)
|
||||
{
|
||||
sprintf((char *)buf,"Hyper Shot %d: %s",((x&2)>>1)+1,(x&1)?"JUMP":"RUN");
|
||||
for(x = 0; x < 4; x++) {
|
||||
sprintf((char *)buf, "Hyper Shot %d: %s",
|
||||
((x & 2) >> 1) + 1, (x & 1) ? "JUMP" : "RUN");
|
||||
subcon((char *)buf, &HyperShotButtons[x]);
|
||||
}
|
||||
break;
|
||||
case FCFGD_POWERPAD:
|
||||
for(x=0;x<12;x++)
|
||||
{
|
||||
for(x = 0; x < 12; x++) {
|
||||
sprintf((char *)buf, "PowerPad %d: %d", (arg & 1) + 1, x + 11);
|
||||
subcon((char *)buf, &powerpadsc[arg&1][x]);
|
||||
}
|
||||
break;
|
||||
|
||||
case FCFGD_GAMEPAD:
|
||||
{
|
||||
char *str[10]={"A","B","SELECT","START","UP","DOWN","LEFT","RIGHT","Rapid A","Rapid B"};
|
||||
for(x=0;x<10;x++)
|
||||
{
|
||||
for(x = 0; x < 10; x++) {
|
||||
sprintf((char *)buf, "GamePad #%d: %s", arg + 1, str[x]);
|
||||
subcon((char *)buf, &GamePadConfig[arg][x]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -641,23 +843,29 @@ CFGSTRUCT InputConfig[]={
|
|||
};
|
||||
|
||||
|
||||
static void InputCfg(char *text)
|
||||
{
|
||||
if(!strncasecmp(text,"gamepad",strlen("gamepad")))
|
||||
/**
|
||||
* Update the button configuration for a device, specified by a text string.
|
||||
*/
|
||||
static void
|
||||
InputCfg(char *text)
|
||||
{
|
||||
if(!strncasecmp(text, "gamepad", strlen("gamepad"))) {
|
||||
ConfigDevice(FCFGD_GAMEPAD, (text[strlen("gamepad")] - '1') & 3);
|
||||
}
|
||||
else if(!strncasecmp(text,"powerpad",strlen("powerpad")))
|
||||
{
|
||||
} else if(!strncasecmp(text, "powerpad", strlen("powerpad"))) {
|
||||
ConfigDevice(FCFGD_POWERPAD, (text[strlen("powerpad")] - '1') & 1);
|
||||
}
|
||||
else if(!strcasecmp(text,"hypershot"))
|
||||
} else if(!strcasecmp(text,"hypershot")) {
|
||||
ConfigDevice(FCFGD_HYPERSHOT, 0);
|
||||
else if(!strcasecmp(text,"quizking"))
|
||||
} else if(!strcasecmp(text,"quizking")) {
|
||||
ConfigDevice(FCFGD_QUIZKING, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void FCExp(char *text)
|
||||
/**
|
||||
* Specify a FamiCom Expansion device as the 3rd input device. Takes
|
||||
* a text string describing the device.
|
||||
*/
|
||||
static void
|
||||
FCExp(char *text)
|
||||
{
|
||||
static char *fccortab[11]={"none","arkanoid","shadow","4player","fkb","hypershot",
|
||||
"mahjong","quizking","ftrainera","ftrainerb","oekakids"};
|
||||
|
@ -665,33 +873,50 @@ static void FCExp(char *text)
|
|||
static int fccortabi[11]={SIFC_NONE,SIFC_ARKANOID,SIFC_SHADOW,
|
||||
SIFC_4PLAYER,SIFC_FKB,SIFC_HYPERSHOT,SIFC_MAHJONG,SIFC_QUIZKING,
|
||||
SIFC_FTRAINERA,SIFC_FTRAINERB,SIFC_OEKAKIDS};
|
||||
|
||||
int y;
|
||||
for(y=0;y<11;y++)
|
||||
if(!strcmp(fccortab[y],text))
|
||||
for(y = 0; y < 11; y++) {
|
||||
if(!strcmp(fccortab[y], text)) {
|
||||
UsrInputType[2] = fccortabi[y];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static char *cortab[6]={"none","gamepad","zapper","powerpada","powerpadb","arkanoid"};
|
||||
static int cortabi[6]={SI_NONE,SI_GAMEPAD,
|
||||
SI_ZAPPER,SI_POWERPADA,SI_POWERPADB,SI_ARKANOID};
|
||||
|
||||
static void Input1(char *text)
|
||||
/**
|
||||
* Set the 1st user-specified input device. Specified as a text
|
||||
* string.
|
||||
*/
|
||||
static void
|
||||
Input1(char *text)
|
||||
{
|
||||
int y;
|
||||
|
||||
for(y=0;y<6;y++)
|
||||
if(!strcmp(cortab[y],text))
|
||||
for(y = 0; y < 6; y++) {
|
||||
if(!strcmp(cortab[y], text)) {
|
||||
UsrInputType[0] = cortabi[y];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Input2(char *text)
|
||||
/**
|
||||
* Set the 2nd user-specified input device. Specified as a text
|
||||
* string.
|
||||
*/
|
||||
static void
|
||||
Input2(char *text)
|
||||
{
|
||||
int y;
|
||||
|
||||
for(y=0;y<6;y++)
|
||||
if(!strcmp(cortab[y],text))
|
||||
for(y = 0; y < 6; y++) {
|
||||
if(!strcmp(cortab[y], text)) {
|
||||
UsrInputType[1] = cortabi[y];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ARGPSTRUCT InputArgs[]={
|
||||
{"-inputcfg",0,(void *)InputCfg,0x2000},
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/// \file
|
||||
/// \brief A set of functions for dealing with the main execution loop. Much of this code will likely be dispersed to sdl.cpp and other files since we no longer support non-SDL and non-Windows builds.
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
static SDL_Joystick *Joysticks[MAX_JOYSTICKS] = {NULL};
|
||||
|
||||
/**
|
||||
* Updates a single input button configuration on the joystick. Note:
|
||||
* I'm not fully sure that this is what the function does - soules.
|
||||
* Updates a single input button configuration on the joystick?
|
||||
*/
|
||||
int
|
||||
DTestButtonJoy(ButtConfig *bc)
|
||||
|
|
Loading…
Reference in New Issue