diff --git a/src/boards/a9711.cpp b/src/boards/a9711.cpp index 18f2c264..c4701dc3 100644 --- a/src/boards/a9711.cpp +++ b/src/boards/a9711.cpp @@ -44,15 +44,15 @@ static void UNLA9711PW(uint32 A, uint8 V) setprg8(A,V&0x3F); } -static DECLFW(UNLA9711Write8000) -{ +//static DECLFW(UNLA9711Write8000) +//{ // FCEU_printf("bs %04x %02x\n",A,V); // if(V&0x80) // MMC3_CMDWrite(A,V); // else // MMC3_CMDWrite(A,m_perm[V&7]); // if(V!=0x86) MMC3_CMDWrite(A,V); -} +//} static DECLFW(UNLA9711WriteLo) { diff --git a/src/cheat.cpp b/src/cheat.cpp index 74a5ef45..0eec23b8 100644 --- a/src/cheat.cpp +++ b/src/cheat.cpp @@ -38,7 +38,7 @@ void FCEU_CheatResetRAM(void) { int x; - for(x=0;x<64;x++) + for(x=0;x<64;x++) CheatRPtrs[x]=0; } @@ -98,7 +98,7 @@ static DECLFR(SubCheatsRead) if(pv==s->compare) return(s->val); else return(pv); - } + } else return(s->val); } s++; @@ -135,7 +135,7 @@ void RebuildSubCheats(void) } } c=c->next; - } + } } void FCEU_PowerCheats() @@ -207,7 +207,7 @@ void FCEU_LoadGameCheats(FILE *override) FCEU_printf("Cheats file loaded.\n"); while(fgets(linebuf,2048,fp)>0) - { + { char *tbuf=linebuf; int doc=0; @@ -226,7 +226,7 @@ void FCEU_LoadGameCheats(FILE *override) doc=1; } - if(tbuf[0]==':') + if(tbuf[0]==':') { tbuf++; status=0; @@ -241,7 +241,7 @@ void FCEU_LoadGameCheats(FILE *override) namebuf=(char *)malloc(strlen(neo)+1); strcpy(namebuf,neo); } - else + else { char *neo=&tbuf[4+2+1+1]; if(sscanf(tbuf,"%04x%*[:]%02x",&addr,&val)!=2) @@ -281,7 +281,7 @@ void FCEU_FlushGameCheats(FILE *override, int nosave) { struct CHEATF *next=cheats; for(;;) - { + { struct CHEATF *last=next; next=next->next; free(last->name); @@ -302,7 +302,7 @@ void FCEU_FlushGameCheats(FILE *override, int nosave) { struct CHEATF *next=cheats; FILE *fp; - + if(override) fp = override; else @@ -398,7 +398,7 @@ int FCEUI_DelCheat(uint32 which) cheats=cheatsl=0; // No (more) cheats. } free(cur->name); // Now that all references to this cheat are removed, - free(cur); // free the memory. + free(cur); // free the memory. break; } // *END REMOVE THIS CHEAT* @@ -457,7 +457,7 @@ int FCEUI_GetCheat(uint32 which, char **name, uint32 *a, uint8 *v, int *compare, if(name) *name=next->name; if(a) - *a=next->addr; + *a=next->addr; if(v) *v=next->val; if(s) @@ -485,7 +485,7 @@ static int GGtobin(char c) } /* Returns 1 on success, 0 on failure. Sets *a,*v,*c. */ -int FCEUI_DecodeGG(const char *str, uint16 *a, uint8 *v, int *c) +int FCEUI_DecodeGG(const char *str, int *a, int *v, int *c) { uint16 A; uint8 V,C; @@ -539,7 +539,7 @@ int FCEUI_DecodeGG(const char *str, uint16 *a, uint8 *v, int *c) t=GGtobin(*str++); C|=(t&0x07); C|=(t&0x08)<<4; - + t=GGtobin(*str++); C|=(t&0x07)<<4; V|=(t&0x08); @@ -551,7 +551,7 @@ int FCEUI_DecodeGG(const char *str, uint16 *a, uint8 *v, int *c) return(0); } -int FCEUI_DecodePAR(const char *str, uint16 *a, uint8 *v, int *c, int *type) +int FCEUI_DecodePAR(const char *str, int *a, int *v, int *c, int *type) { int boo[4]; if(strlen(str)!=8) return(0); @@ -629,7 +629,7 @@ int FCEUI_ToggleCheat(uint32 which) { struct CHEATF *next=cheats; uint32 x=0; - + while(next) { if(x==which) @@ -658,7 +658,7 @@ static int InitCheatComp(void) } for(x=0;x<65536;x++) CheatComp[x]=CHEATC_NONE; - + return(1); } diff --git a/src/driver.h b/src/driver.h index eb1eb19f..da5cb159 100644 --- a/src/driver.h +++ b/src/driver.h @@ -102,7 +102,7 @@ void FCEUI_CloseGame(void); //Deallocates all allocated memory. Call after FCEUI_Emulate() returns. void FCEUI_Kill(void); -//Enable/Disable game genie. a=true->enabled +//Enable/Disable game genie. a=true->enabled void FCEUI_SetGameGenie(bool a); //Set video system a=0 NTSC, a=1 PAL @@ -164,7 +164,7 @@ void FCEUD_SetInput(bool fourscore, ESI port0, ESI port1, ESIFC fcexp); // set in newer version, used for old movie compatibility //TODO - only use this flag to print a warning that the sync might be bad //so that we can get rid of the sync hack code -#define MOVIE_FLAG_NOSYNCHACK (1<<4) +#define MOVIE_FLAG_NOSYNCHACK (1<<4) #define MOVIE_MAX_METADATA 512 @@ -180,7 +180,7 @@ typedef struct int metadata_size; // size of the buffer pointed to by metadata MD5DATA md5_of_rom_used; bool md5_of_rom_used_present; // v1 movies don't have md5 info available - std::string name_of_rom_used; + std::string name_of_rom_used; } MOVIE_INFO; void FCEUI_SaveMovie(char *fname, uint8 flags); @@ -204,8 +204,8 @@ void FCEUI_SaveSnapshot(void); void FCEU_DispMessage(char *format, ...); #define FCEUI_DispMessage FCEU_DispMessage -int FCEUI_DecodePAR(const char *code, uint16 *a, uint8 *v, int *c, int *type); -int FCEUI_DecodeGG(const char *str, uint16 *a, uint8 *v, int *c); +int FCEUI_DecodePAR(const char *code, int *a, int *v, int *c, int *type); +int FCEUI_DecodeGG(const char *str, int *a, int *v, int *c); int FCEUI_AddCheat(const char *name, uint32 addr, uint8 val, int compare, int type); int FCEUI_DelCheat(uint32 which); int FCEUI_ToggleCheat(uint32 which); @@ -299,7 +299,7 @@ bool FCEUI_AviIsRecording(); void FCEUD_AviRecordTo(void); void FCEUD_AviStop(void); -///A callback that the emu core uses to poll the state of a given emulator command key +///A callback that the emu core uses to poll the state of a given emulator command key typedef int TestCommandState(int cmd); ///Signals the emu core to poll for emulator commands and take actions void FCEUI_HandleEmuCommands(TestCommandState* testfn); @@ -353,8 +353,8 @@ bool FCEU_IsValidUI(EFCEUI ui); #ifdef __cplusplus -extern "C" -#endif +extern "C" +#endif FILE *FCEUI_UTF8fopen_C(const char *n, const char *m); #endif //__DRIVER_H_ diff --git a/src/drivers/common/cheat.cpp b/src/drivers/common/cheat.cpp index 9bfedade..c91eeb96 100644 --- a/src/drivers/common/cheat.cpp +++ b/src/drivers/common/cheat.cpp @@ -65,10 +65,10 @@ static uint8 Get8(unsigned int def) static int GetI(int def) { char buf[32]; - + fgets(buf,32,stdin); if(buf[0]=='\n') - return(def); + return(def); sscanf(buf,"%d",&def); return def; } @@ -117,7 +117,7 @@ int ListChoice(int hmm) if(buf[0]=='s' || buf[0]=='S') return(-1); if(buf[0]=='\n') return(0); if(!sscanf(buf,"%d",&num)) - return(0); + return(0); if(num<1) goto tryagain; return(num); } @@ -165,12 +165,12 @@ int AddToList(char *text, uint32 id) mordoe=1; listids[listcount]=id; printf("%2d) %s\n",listcount+1,text); - listcount++; + listcount++; return(1); } /* -** +** ** End list code. **/ @@ -214,7 +214,7 @@ static void ModifyCheat(int num) GetString(buf,256); /* This obviously doesn't allow for cheats with no names. Bah. Who wants - nameless cheats anyway... + nameless cheats anyway... */ if(buf[0]) @@ -245,15 +245,13 @@ static void ModifyCheat(int num) static void AddCheatGGPAR(int which) { - uint16 A; - uint8 V; - int C; + int A, V, C; int type; char name[256],code[256]; printf("Name: "); - GetString(name,256); - + GetString(name,256); + printf("Code: "); GetString(code,256); @@ -268,7 +266,7 @@ static void AddCheatGGPAR(int which) return; } } - else + else { if(!FCEUI_DecodeGG(code,&A,&V,&C)) { @@ -291,8 +289,8 @@ static void AddCheatGG(void) } static void AddCheatPAR(void) -{ - AddCheatGGPAR(1); +{ + AddCheatGGPAR(1); } static void AddCheatParam(uint32 A, uint8 V) @@ -356,7 +354,7 @@ static void ListCheats(void) break; case 'd':if(!FCEUI_DelCheat(which)) puts("Error deleting cheat!"); - else + else puts("Cheat has been deleted."); break; case 'm':ModifyCheat(which); diff --git a/src/drivers/sdl/input.cpp b/src/drivers/sdl/input.cpp index 9ffb9503..12fdc4d0 100644 --- a/src/drivers/sdl/input.cpp +++ b/src/drivers/sdl/input.cpp @@ -1225,35 +1225,35 @@ UpdateInput(Config *config) if(device == "None") { UsrInputType[i] = SI_NONE; } else if(device.find("GamePad") != std::string::npos) { - UsrInputType[i] = (i < 2) ? SI_GAMEPAD : SI_NONE; + UsrInputType[i] = (i < 2) ? (int)SI_GAMEPAD : (int)SIFC_NONE; } else if(device.find("PowerPad.0") != std::string::npos) { - UsrInputType[i] = (i < 2) ? SI_POWERPADA : SI_NONE; + UsrInputType[i] = (i < 2) ? (int)SI_POWERPADA : (int)SIFC_NONE; } else if(device.find("PowerPad.1") != std::string::npos) { - UsrInputType[i] = (i < 2) ? SI_POWERPADB : SI_NONE; + UsrInputType[i] = (i < 2) ? (int)SI_POWERPADB : (int)SIFC_NONE; } else if(device.find("QuizKing") != std::string::npos) { - UsrInputType[i] = (i < 2) ? SI_NONE : SIFC_QUIZKING; + UsrInputType[i] = (i < 2) ? (int)SI_NONE : (int)SIFC_QUIZKING; } else if(device.find("HyperShot") != std::string::npos) { - UsrInputType[i] = (i < 2) ? SI_NONE : SIFC_HYPERSHOT; + UsrInputType[i] = (i < 2) ? (int)SI_NONE : (int)SIFC_HYPERSHOT; } else if(device.find("Mahjong") != std::string::npos) { - UsrInputType[i] = (i < 2) ? SI_NONE : SIFC_MAHJONG; + UsrInputType[i] = (i < 2) ? (int)SI_NONE : (int)SIFC_MAHJONG; } else if(device.find("TopRider") != std::string::npos) { - UsrInputType[i] = (i < 2) ? SI_NONE : SIFC_TOPRIDER; + UsrInputType[i] = (i < 2) ? (int)SI_NONE : (int)SIFC_TOPRIDER; } else if(device.find("FTrainer") != std::string::npos) { - UsrInputType[i] = (i < 2) ? SI_NONE : SIFC_FTRAINERA; + UsrInputType[i] = (i < 2) ? (int)SI_NONE : (int)SIFC_FTRAINERA; } else if(device.find("FamilyKeyBoard") != std::string::npos) { - UsrInputType[i] = (i < 2) ? SI_NONE : SIFC_FKB; + UsrInputType[i] = (i < 2) ? (int)SI_NONE : (int)SIFC_FKB; } else if(device.find("OekaKids") != std::string::npos) { - UsrInputType[i] = (i < 2) ? SI_NONE : SIFC_OEKAKIDS; + UsrInputType[i] = (i < 2) ? (int)SI_NONE : (int)SIFC_OEKAKIDS; } else if(device.find("Arkanoid") != std::string::npos) { - UsrInputType[i] = (i < 2) ? SI_ARKANOID : SIFC_ARKANOID; + UsrInputType[i] = (i < 2) ? (int)SI_ARKANOID : (int)SIFC_ARKANOID; } else if(device.find("Shadow") != std::string::npos) { - UsrInputType[i] = (i < 2) ? SI_NONE : SIFC_SHADOW; + UsrInputType[i] = (i < 2) ? (int)SI_NONE : (int)SIFC_SHADOW; } else if(device.find("Zapper") != std::string::npos) { - UsrInputType[i] = (i < 2) ? SI_ZAPPER : SIFC_NONE; + UsrInputType[i] = (i < 2) ? (int)SI_ZAPPER : (int)SIFC_NONE; } else if(device.find("BWorld") != std::string::npos) { - UsrInputType[i] = (i < 2) ? SI_NONE : SIFC_BWORLD; + UsrInputType[i] = (i < 2) ? (int)SI_NONE : (int)SIFC_BWORLD; } else if(device.find("4Player") != std::string::npos) { - UsrInputType[i] = (i < 2) ? SI_NONE : SIFC_4PLAYER; + UsrInputType[i] = (i < 2) ? (int)SI_NONE : (int)SIFC_4PLAYER; } else { // Unknown device UsrInputType[i] = SI_NONE; diff --git a/src/drivers/win/cheat.cpp b/src/drivers/win/cheat.cpp index e6bbabec..ad4aafc6 100644 --- a/src/drivers/win/cheat.cpp +++ b/src/drivers/win/cheat.cpp @@ -26,7 +26,7 @@ #include "../../fceu.h" #include "../../cart.h" static HWND pwindow = 0; -HWND hCheat; //mbg merge 7/19/06 had to add +HWND hCheat; //mbg merge 7/19/06 had to add int CheatWindow; int CheatStyle=1; @@ -419,7 +419,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l GetDlgItemText(hwndDlg,IDC_CHEAT_VAL_LT_BY,str,3); FCEUI_CheatSearchEnd(8,0,StrToU8(str)); } - else FCEUI_CheatSearchEnd(6,0,0); + else FCEUI_CheatSearchEnd(6,0,0); ShowResults(hwndDlg); break; } @@ -523,11 +523,11 @@ void ConfigCheats(HWND hParent) { } else SetFocus(hCheat); - + if(!pwindow) pwindow=CreateDialog(fceu_hInstance,"CHEATCONSOLE",NULL,CheatConsoleCallB); else - SetFocus(pwindow); + SetFocus(pwindow); } void UpdateCheatList() @@ -576,16 +576,16 @@ BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) GetDlgItemText(hGGConv,IDC_GAME_GENIE_CODE,GGcode,9); if((strlen(GGcode) != 8) && (strlen(GGcode) != 6))break; - FCEUI_DecodeGG(GGcode, (uint16 *)&GGaddr, (uint8 *)&GGval, &GGcomp); + FCEUI_DecodeGG(GGcode, &GGaddr, &GGval, &GGcomp); sprintf(str,"%04X",GGaddr); SetDlgItemText(hGGConv,IDC_GAME_GENIE_ADDR,str); - + if(GGcomp != -1) sprintf(str,"%02X",GGcomp); else str[0] = 0; SetDlgItemText(hGGConv,IDC_GAME_GENIE_COMP,str); - + sprintf(str,"%02X",GGval); SetDlgItemText(hGGConv,IDC_GAME_GENIE_VAL,str); //ListGGAddresses(); @@ -594,7 +594,7 @@ BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) case IDC_GAME_GENIE_ADDR: case IDC_GAME_GENIE_COMP: case IDC_GAME_GENIE_VAL: - + GetDlgItemText(hGGConv,IDC_GAME_GENIE_ADDR,str,5); if(strlen(str) != 4) break; @@ -629,7 +629,7 @@ BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) SendDlgItemMessage(hCheat,IDC_LIST_CHEATS,LB_ADDSTRING,0,(LPARAM)(LPSTR)str); selcheat = (SendDlgItemMessage(hCheat,IDC_LIST_CHEATS,LB_GETCOUNT,0,0) - 1); SendDlgItemMessage(hCheat,IDC_LIST_CHEATS,LB_SETCURSEL,selcheat,0); - + SetDlgItemText(hCheat,IDC_CHEAT_ADDR,(LPTSTR)U16ToStr(GGaddr)); SetDlgItemText(hCheat,IDC_CHEAT_VAL,(LPTSTR)U8ToStr(GGval)); @@ -659,31 +659,31 @@ BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) //The code in this function is a modified version //of Chris Covell's work - I'd just like to point that out -void EncodeGG(char *str, int a, int v, int c){ +void EncodeGG(char *str, int a, int v, int c){ uint8 num[8]; static char lets[16]={'A','P','Z','L','G','I','T','Y','E','O','X','U','K','S','V','N'}; int i; if(a > 0x8000)a-=0x8000; - num[0]=(v&7)+((v>>4)&8); + num[0]=(v&7)+((v>>4)&8); num[1]=((v>>4)&7)+((a>>4)&8); num[2]=((a>>4)&7); num[3]=(a>>12)+(a&8); num[4]=(a&7)+((a>>8)&8); num[5]=((a>>8)&7); - + if (c == -1){ num[5]+=v&8; - for(i = 0;i < 6;i++)str[i] = lets[num[i]]; + for(i = 0;i < 6;i++)str[i] = lets[num[i]]; str[6] = 0; } else { num[2]+=8; num[5]+=c&8; num[6]=(c&7)+((c>>4)&8); num[7]=((c>>4)&7)+(v&8); - for(i = 0;i < 8;i++)str[i] = lets[num[i]]; + for(i = 0;i < 8;i++)str[i] = lets[num[i]]; str[8] = 0; - } + } return; } @@ -707,7 +707,7 @@ void ListGGAddresses(){ } } - + } //A different model for this could be to have everything @@ -722,8 +722,8 @@ void SetGGConvFocus(int address,int compare){ dontupdateGG = 1; //little hack to fix a nasty bug sprintf(str,"%04X",address); - SetDlgItemText(hGGConv,IDC_GAME_GENIE_ADDR,str); - + SetDlgItemText(hGGConv,IDC_GAME_GENIE_ADDR,str); + dontupdateGG = 0; sprintf(str,"%02X",GGcomp);