diff --git a/src/boards/222.cpp b/src/boards/222.cpp index f23be9b1..c6b0a49d 100644 --- a/src/boards/222.cpp +++ b/src/boards/222.cpp @@ -21,7 +21,8 @@ #include "mapinc.h" -static uint8 IRQCount, IRQPre; +static uint8 IRQCount; +//static uint8 IRQPre; static uint8 IRQa; static uint8 prg_reg[2]; static uint8 chr_reg[8]; @@ -56,8 +57,8 @@ static void Sync(void) setprg8(0xA000,prg_reg[1]); int i; for(i=0; i<8; i++) - setchr1(i<<10,chr_reg[i]); - setmirror(mirr^1); + setchr1(i<<10,chr_reg[i]); + setmirror(mirr^1); } static DECLFW(M222Write) diff --git a/src/boards/a9711.cpp b/src/boards/a9711.cpp index 0a4806b3..18f2c264 100644 --- a/src/boards/a9711.cpp +++ b/src/boards/a9711.cpp @@ -21,7 +21,7 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 m_perm[8] = {0, 1, 0, 3, 0, 5, 6, 7}; +//static uint8 m_perm[8] = {0, 1, 0, 3, 0, 5, 6, 7}; static void UNLA9711PW(uint32 A, uint8 V) { diff --git a/src/drivers/sdl/config.cpp b/src/drivers/sdl/config.cpp index 728e7724..db49dc3f 100644 --- a/src/drivers/sdl/config.cpp +++ b/src/drivers/sdl/config.cpp @@ -78,9 +78,7 @@ CreateDirs(const std::string &dir) static void GetBaseDirectory(std::string &dir) { - char *home, *lastBS; - - home = getenv("HOME"); + char *home = getenv("HOME"); if(home) { dir = std::string(home) + "/.fceultra"; } else { @@ -88,7 +86,7 @@ GetBaseDirectory(std::string &dir) home = new char[MAX_PATH + 1]; GetModuleFileName(NULL, home, MAX_PATH + 1); - lastBS = strrchr(home,'\\'); + char *lastBS = strrchr(home,'\\'); if(lastBS) { *lastBS = 0; } @@ -305,7 +303,7 @@ UpdateEMUCore(Config *config) config->getOption("SDL.ScanLineStart", &start); config->getOption("SDL.ScanLineEnd", &end); -#if DOING_SCANLINE_CHECKS +#if DOING_SCANLINE_CHECKS for(int i = 0; i < 2; x++) { if(srendlinev[x]<0 || srendlinev[x]>239) srendlinev[x]=0; if(erendlinev[x]239) erendlinev[x]=239; diff --git a/src/drivers/sdl/input.cpp b/src/drivers/sdl/input.cpp index 3c9ded8f..358d8a64 100644 --- a/src/drivers/sdl/input.cpp +++ b/src/drivers/sdl/input.cpp @@ -1429,3 +1429,97 @@ UpdateInput(Config *config) fkbmap[j].NumC = 1; } } + +// Definitions from main.h: +// GamePad defaults +const char *GamePadNames[GAMEPAD_NUM_BUTTONS] = + {"A", "B", "Select", "Start", + "Up", "Down", "Left", "Right", "TurboA", "TurboB"}; +const char *DefaultGamePadDevice[GAMEPAD_NUM_DEVICES] = + {"Keyboard", "None", "None", "None"}; +const int DefaultGamePad[GAMEPAD_NUM_DEVICES][GAMEPAD_NUM_BUTTONS] = + { { SDLK_KP2, SDLK_KP3, SDLK_TAB, SDLK_RETURN, + SDLK_w, SDLK_s, SDLK_a, SDLK_d, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; + +// PowerPad defaults +const char *PowerPadNames[POWERPAD_NUM_BUTTONS] = + {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B"}; +const char *DefaultPowerPadDevice[POWERPAD_NUM_DEVICES] = + {"Keyboard", "None"}; +const int DefaultPowerPad[POWERPAD_NUM_DEVICES][POWERPAD_NUM_BUTTONS] = + { { SDLK_o, SDLK_p, SDLK_LEFTBRACKET, SDLK_RIGHTBRACKET, + SDLK_k, SDLK_l, SDLK_SEMICOLON, SDLK_QUOTE, + SDLK_m, SDLK_COMMA, SDLK_PERIOD, SDLK_SLASH }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; + +// QuizKing defaults +const char *QuizKingNames[QUIZKING_NUM_BUTTONS] = + { "0", "1", "2", "3", "4", "5" }; +const char *DefaultQuizKingDevice = "Keyboard"; +const int DefaultQuizKing[QUIZKING_NUM_BUTTONS] = + { SDLK_q, SDLK_w, SDLK_e, SDLK_r, SDLK_t, SDLK_y }; + +// HyperShot defaults +const char *HyperShotNames[HYPERSHOT_NUM_BUTTONS] = + { "0", "1", "2", "3" }; +const char *DefaultHyperShotDevice = "Keyboard"; +const int DefaultHyperShot[HYPERSHOT_NUM_BUTTONS] = + { SDLK_q, SDLK_w, SDLK_e, SDLK_r }; + +// Mahjong defaults +const char *MahjongNames[MAHJONG_NUM_BUTTONS] = + { "00", "01", "02", "03", "04", "05", "06", "07", + "08", "09", "10", "11", "12", "13", "14", "15", + "16", "17", "18", "19", "20" }; +const char *DefaultMahjongDevice = "Keyboard"; +const int DefaultMahjong[MAHJONG_NUM_BUTTONS] = + { SDLK_q, SDLK_w, SDLK_e, SDLK_r, SDLK_t, SDLK_a, SDLK_s, SDLK_d, + SDLK_f, SDLK_g, SDLK_h, SDLK_j, SDLK_k, SDLK_l, SDLK_z, SDLK_x, + SDLK_c, SDLK_v, SDLK_b, SDLK_n, SDLK_m }; + +// TopRider defaults +const char *TopRiderNames[TOPRIDER_NUM_BUTTONS] = + { "0", "1", "2", "3", "4", "5", "6", "7" }; +const char *DefaultTopRiderDevice = "Keyboard"; +const int DefaultTopRider[TOPRIDER_NUM_BUTTONS] = + { SDLK_q, SDLK_w, SDLK_e, SDLK_r, SDLK_t, SDLK_y, SDLK_u, SDLK_i }; + +// FTrainer defaults +const char *FTrainerNames[FTRAINER_NUM_BUTTONS] = + { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B" }; +const char *DefaultFTrainerDevice = "Keyboard"; +const int DefaultFTrainer[FTRAINER_NUM_BUTTONS] = + { SDLK_o, SDLK_p, SDLK_LEFTBRACKET, SDLK_RIGHTBRACKET, + SDLK_k, SDLK_l, SDLK_SEMICOLON, SDLK_QUOTE, + SDLK_m, SDLK_COMMA, SDLK_PERIOD, SDLK_SLASH }; + +// FamilyKeyBoard defaults +const char *FamilyKeyBoardNames[FAMILYKEYBOARD_NUM_BUTTONS] = + { "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", + "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", + "MINUS", "EQUAL", "BACKSLASH", "BACKSPACE", + "ESCAPE", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", + "P", "GRAVE", "BRACKET_LEFT", "ENTER", + "LEFTCONTROL", "A", "S", "D", "F", "G", "H", "J", "K", + "L", "SEMICOLON", "APOSTROPHE", "BRACKET_RIGHT", "INSERT", + "LEFTSHIFT", "Z", "X", "C", "V", "B", "N", "M", "COMMA", + "PERIOD", "SLASH", "RIGHTALT", "RIGHTSHIFT", "LEFTALT", "SPACE", + "DELETE", "END", "PAGEDOWN", + "CURSORUP", "CURSORLEFT", "CURSORRIGHT", "CURSORDOWN" }; +const char *DefaultFamilyKeyBoardDevice = "Keyboard"; +const int DefaultFamilyKeyBoard[FAMILYKEYBOARD_NUM_BUTTONS] = + { SDLK_F1, SDLK_F2, SDLK_F3, SDLK_F4, SDLK_F5, SDLK_F6, SDLK_F7, SDLK_F8, + SDLK_1, SDLK_2, SDLK_3, SDLK_4, SDLK_5, + SDLK_6, SDLK_7, SDLK_8, SDLK_9, SDLK_0, + SDLK_MINUS, SDLK_EQUALS, SDLK_BACKSLASH, SDLK_BACKSPACE, + SDLK_ESCAPE, SDLK_q, SDLK_w, SDLK_e, SDLK_r, SDLK_t, SDLK_y, SDLK_u, + SDLK_i, SDLK_o, SDLK_p, SDLK_BACKQUOTE, SDLK_LEFTBRACKET, SDLK_RETURN, + SDLK_LCTRL, SDLK_a, SDLK_s, SDLK_d, SDLK_f, SDLK_g, SDLK_h, SDLK_j, + SDLK_k, SDLK_l, SDLK_SEMICOLON, SDLK_QUOTE, SDLK_RIGHTBRACKET, + SDLK_INSERT, SDLK_LSHIFT, SDLK_z, SDLK_x, SDLK_c, SDLK_v, SDLK_b, + SDLK_n, SDLK_m, SDLK_COMMA, SDLK_PERIOD, SDLK_SLASH, SDLK_RALT, + SDLK_RSHIFT, SDLK_LALT, SDLK_SPACE, SDLK_DELETE, SDLK_END, SDLK_PAGEDOWN, + SDLK_UP, SDLK_LEFT, SDLK_RIGHT, SDLK_DOWN }; diff --git a/src/drivers/sdl/main.h b/src/drivers/sdl/main.h index e51e5dd9..2ed21135 100644 --- a/src/drivers/sdl/main.h +++ b/src/drivers/sdl/main.h @@ -52,104 +52,51 @@ int CLImain(int argc, char *argv[]); // GamePad defaults #define GAMEPAD_NUM_DEVICES 4 #define GAMEPAD_NUM_BUTTONS 10 -static const char *GamePadNames[GAMEPAD_NUM_BUTTONS] = - {"A", "B", "Select", "Start", - "Up", "Down", "Left", "Right", "TurboA", "TurboB"}; -static const char *DefaultGamePadDevice[GAMEPAD_NUM_DEVICES] = - {"Keyboard", "None", "None", "None"}; -static const int DefaultGamePad[GAMEPAD_NUM_DEVICES][GAMEPAD_NUM_BUTTONS] = - { { SDLK_KP2, SDLK_KP3, SDLK_TAB, SDLK_RETURN, - SDLK_w, SDLK_s, SDLK_a, SDLK_d, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; +extern const char *GamePadNames[GAMEPAD_NUM_BUTTONS]; +extern const char *DefaultGamePadDevice[GAMEPAD_NUM_DEVICES]; +extern const int DefaultGamePad[GAMEPAD_NUM_DEVICES][GAMEPAD_NUM_BUTTONS]; // PowerPad defaults #define POWERPAD_NUM_DEVICES 2 #define POWERPAD_NUM_BUTTONS 12 -static const char *PowerPadNames[POWERPAD_NUM_BUTTONS] = - {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B"}; -static const char *DefaultPowerPadDevice[POWERPAD_NUM_DEVICES] = - {"Keyboard", "None"}; -static const int DefaultPowerPad[POWERPAD_NUM_DEVICES][POWERPAD_NUM_BUTTONS] = - { { SDLK_o, SDLK_p, SDLK_LEFTBRACKET, SDLK_RIGHTBRACKET, - SDLK_k, SDLK_l, SDLK_SEMICOLON, SDLK_QUOTE, - SDLK_m, SDLK_COMMA, SDLK_PERIOD, SDLK_SLASH }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; +extern const char *PowerPadNames[POWERPAD_NUM_BUTTONS]; +extern const char *DefaultPowerPadDevice[POWERPAD_NUM_DEVICES]; +extern const int DefaultPowerPad[POWERPAD_NUM_DEVICES][POWERPAD_NUM_BUTTONS]; // QuizKing defaults #define QUIZKING_NUM_BUTTONS 6 -static const char *QuizKingNames[QUIZKING_NUM_BUTTONS] = - { "0", "1", "2", "3", "4", "5" }; -static const char *DefaultQuizKingDevice = "Keyboard"; -static const int DefaultQuizKing[QUIZKING_NUM_BUTTONS] = - { SDLK_q, SDLK_w, SDLK_e, SDLK_r, SDLK_t, SDLK_y }; +extern const char *QuizKingNames[QUIZKING_NUM_BUTTONS]; +extern const char *DefaultQuizKingDevice; +extern const int DefaultQuizKing[QUIZKING_NUM_BUTTONS]; // HyperShot defaults #define HYPERSHOT_NUM_BUTTONS 4 -static const char *HyperShotNames[HYPERSHOT_NUM_BUTTONS] = - { "0", "1", "2", "3" }; -static const char *DefaultHyperShotDevice = "Keyboard"; -static const int DefaultHyperShot[HYPERSHOT_NUM_BUTTONS] = - { SDLK_q, SDLK_w, SDLK_e, SDLK_r }; +extern const char *HyperShotNames[HYPERSHOT_NUM_BUTTONS]; +extern const char *DefaultHyperShotDevice; +extern const int DefaultHyperShot[HYPERSHOT_NUM_BUTTONS]; // Mahjong defaults #define MAHJONG_NUM_BUTTONS 21 -static const char *MahjongNames[MAHJONG_NUM_BUTTONS] = - { "00", "01", "02", "03", "04", "05", "06", "07", - "08", "09", "10", "11", "12", "13", "14", "15", - "16", "17", "18", "19", "20" }; -static const char *DefaultMahjongDevice = "Keyboard"; -static const int DefaultMahjong[MAHJONG_NUM_BUTTONS] = - { SDLK_q, SDLK_w, SDLK_e, SDLK_r, SDLK_t, SDLK_a, SDLK_s, SDLK_d, - SDLK_f, SDLK_g, SDLK_h, SDLK_j, SDLK_k, SDLK_l, SDLK_z, SDLK_x, - SDLK_c, SDLK_v, SDLK_b, SDLK_n, SDLK_m }; +extern const char *MahjongNames[MAHJONG_NUM_BUTTONS]; +extern const char *DefaultMahjongDevice; +extern const int DefaultMahjong[MAHJONG_NUM_BUTTONS]; // TopRider defaults #define TOPRIDER_NUM_BUTTONS 8 -static const char *TopRiderNames[TOPRIDER_NUM_BUTTONS] = - { "0", "1", "2", "3", "4", "5", "6", "7" }; -static const char *DefaultTopRiderDevice = "Keyboard"; -static const int DefaultTopRider[TOPRIDER_NUM_BUTTONS] = - { SDLK_q, SDLK_w, SDLK_e, SDLK_r, SDLK_t, SDLK_y, SDLK_u, SDLK_i }; +extern const char *TopRiderNames[TOPRIDER_NUM_BUTTONS]; +extern const char *DefaultTopRiderDevice; +extern const int DefaultTopRider[TOPRIDER_NUM_BUTTONS]; // FTrainer defaults #define FTRAINER_NUM_BUTTONS 12 -static const char *FTrainerNames[FTRAINER_NUM_BUTTONS] = - { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B" }; -static const char *DefaultFTrainerDevice = "Keyboard"; -static const int DefaultFTrainer[FTRAINER_NUM_BUTTONS] = - { SDLK_o, SDLK_p, SDLK_LEFTBRACKET, SDLK_RIGHTBRACKET, - SDLK_k, SDLK_l, SDLK_SEMICOLON, SDLK_QUOTE, - SDLK_m, SDLK_COMMA, SDLK_PERIOD, SDLK_SLASH }; +extern const char *FTrainerNames[FTRAINER_NUM_BUTTONS]; +extern const char *DefaultFTrainerDevice; +extern const int DefaultFTrainer[FTRAINER_NUM_BUTTONS]; // FamilyKeyBoard defaults #define FAMILYKEYBOARD_NUM_BUTTONS 0x48 -static const char *FamilyKeyBoardNames[FAMILYKEYBOARD_NUM_BUTTONS] = - { "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", - "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", - "MINUS", "EQUAL", "BACKSLASH", "BACKSPACE", - "ESCAPE", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", - "P", "GRAVE", "BRACKET_LEFT", "ENTER", - "LEFTCONTROL", "A", "S", "D", "F", "G", "H", "J", "K", - "L", "SEMICOLON", "APOSTROPHE", "BRACKET_RIGHT", "INSERT", - "LEFTSHIFT", "Z", "X", "C", "V", "B", "N", "M", "COMMA", - "PERIOD", "SLASH", "RIGHTALT", "RIGHTSHIFT", "LEFTALT", "SPACE", - "DELETE", "END", "PAGEDOWN", - "CURSORUP", "CURSORLEFT", "CURSORRIGHT", "CURSORDOWN" }; -static const char *DefaultFamilyKeyBoardDevice = "Keyboard"; -static const int DefaultFamilyKeyBoard[FAMILYKEYBOARD_NUM_BUTTONS] = - { SDLK_F1, SDLK_F2, SDLK_F3, SDLK_F4, SDLK_F5, SDLK_F6, SDLK_F7, SDLK_F8, - SDLK_1, SDLK_2, SDLK_3, SDLK_4, SDLK_5, - SDLK_6, SDLK_7, SDLK_8, SDLK_9, SDLK_0, - SDLK_MINUS, SDLK_EQUALS, SDLK_BACKSLASH, SDLK_BACKSPACE, - SDLK_ESCAPE, SDLK_q, SDLK_w, SDLK_e, SDLK_r, SDLK_t, SDLK_y, SDLK_u, - SDLK_i, SDLK_o, SDLK_p, SDLK_BACKQUOTE, SDLK_LEFTBRACKET, SDLK_RETURN, - SDLK_LCTRL, SDLK_a, SDLK_s, SDLK_d, SDLK_f, SDLK_g, SDLK_h, SDLK_j, - SDLK_k, SDLK_l, SDLK_SEMICOLON, SDLK_QUOTE, SDLK_RIGHTBRACKET, - SDLK_INSERT, SDLK_LSHIFT, SDLK_z, SDLK_x, SDLK_c, SDLK_v, SDLK_b, - SDLK_n, SDLK_m, SDLK_COMMA, SDLK_PERIOD, SDLK_SLASH, SDLK_RALT, - SDLK_RSHIFT, SDLK_LALT, SDLK_SPACE, SDLK_DELETE, SDLK_END, SDLK_PAGEDOWN, - SDLK_UP, SDLK_LEFT, SDLK_RIGHT, SDLK_DOWN }; +extern const char *FamilyKeyBoardNames[FAMILYKEYBOARD_NUM_BUTTONS]; +extern const char *DefaultFamilyKeyBoardDevice; +extern const int DefaultFamilyKeyBoard[FAMILYKEYBOARD_NUM_BUTTONS]; #endif diff --git a/src/drivers/sdl/unix-netplay.cpp b/src/drivers/sdl/unix-netplay.cpp index 4fc43b64..d646f781 100644 --- a/src/drivers/sdl/unix-netplay.cpp +++ b/src/drivers/sdl/unix-netplay.cpp @@ -61,7 +61,7 @@ extern Config *g_config; #define SOL_TCP IPPROTO_TCP #endif -int FCEUDnetplay=0; +int FCEUDnetplay=0; static int s_Socket = -1; @@ -77,7 +77,7 @@ en32(uint8 *buf, /* static uint32 de32(uint8 *morp) -{ +{ return(morp[0]|(morp[1]<<8)|(morp[2]<<16)|(morp[3]<<24)); } */ @@ -90,7 +90,7 @@ FCEUD_NetworkConnect(void) unsigned long hadr; int TSocket, tcpopt, error; int netdivisor; - + // get any required configuration variables int port, localPlayers; std::string server, username, password, key; @@ -121,7 +121,7 @@ FCEUD_NetworkConnect(void) #elif WIN32 error = setsockopt(TSocket, SOL_TCP, TCP_NODELAY, (char*)&tcpopt, sizeof(int)); -#else +#else error = setsockopt(TSocket, SOL_TCP, TCP_NODELAY, &tcpopt, sizeof(int)); #endif if(error) { @@ -144,7 +144,7 @@ FCEUD_NetworkConnect(void) } memcpy(&sockin.sin_addr, phostentb->h_addr, phostentb->h_length); } - + sockin.sin_port = htons(port); puts("*** Connecting to remote host..."); error = connect(TSocket, (struct sockaddr *)&sockin, sizeof(sockin)); @@ -160,17 +160,17 @@ FCEUD_NetworkConnect(void) puts("*** Sending initialization data to server..."); uint8 *sendbuf; uint8 buf[5]; - uint32 sblen, data; + uint32 sblen; sblen = 4 + 16 + 16 + 64 + 1 + username.size(); sendbuf = (uint8 *)malloc(sblen); memset(sendbuf, 0, sblen); - + // XXX soules - should use htons instead of en32() from above! - //data = htons(sblen - 4); + //uint32 data = htons(sblen - 4); //memcpy(sendbuf, &data, sizeof(data)); en32(sendbuf, sblen - 4); - + if(key.size()) { struct md5_context md5; uint8 md5out[16]; @@ -187,13 +187,13 @@ FCEUD_NetworkConnect(void) if(password.size()) { struct md5_context md5; uint8 md5out[16]; - + md5_starts(&md5); md5_update(&md5, (uint8 *)password.c_str(), password.size()); md5_finish(&md5, md5out); memcpy(sendbuf + 4 + 16, md5out, 16); } - + memset(sendbuf + 4 + 16 + 16, 0, 64); sendbuf[4 + 16 + 16 + 64] = (uint8)localPlayers; @@ -258,14 +258,14 @@ FCEUD_RecvData(void *data, { int size; NoWaiting &= ~2; - + for(;;) { fd_set funfun; struct timeval popeye; - + popeye.tv_sec=0; popeye.tv_usec=100000; - + FD_ZERO(&funfun); FD_SET(s_Socket, &funfun); @@ -277,7 +277,7 @@ FCEUD_RecvData(void *data, if(FD_ISSET(s_Socket,&funfun)) { #ifdef WIN32 size = recv(s_Socket, (char*)data, len, 0); -#else +#else size = recv(s_Socket, data, len, MSG_WAITALL); #endif diff --git a/src/file.cpp b/src/file.cpp index df88df2b..f83fab50 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -52,7 +52,7 @@ void ApplyIPS(FILE *ips, MEMWRAP *dest) { uint8 header[5]; uint32 count=0; - + FCEU_printf(" Applying IPS...\n"); if(fread(header,1,5,ips)!=5) { @@ -118,7 +118,7 @@ void ApplyIPS(FILE *ips, MEMWRAP *dest) if((offset+size)>dest->size) { uint8 *tmp; - + // Probably a little slow. tmp=(uint8 *)realloc(dest->data,offset+size); if(!tmp) @@ -175,8 +175,8 @@ static MEMWRAP *MakeMemWrap(void *tz, int type) } else if(type==2) { - unz_file_info ufo; - unzGetCurrentFileInfo(tz,&ufo,0,0,0,0,0,0); + unz_file_info ufo; + unzGetCurrentFileInfo(tz,&ufo,0,0,0,0,0,0); tmp->size=ufo.uncompressed_size; if(!(tmp->data=(uint8 *)FCEU_malloc(ufo.uncompressed_size))) @@ -246,7 +246,7 @@ FCEUFILE * FCEU_fopen(const char *path, const char *ipsfn, char *mode, char *ext !strcasecmp(za,".nez")) break; } - else if(!strcasecmp(za,ext)) + else if(!strcasecmp(za,ext)) break; } if(strlen(tempu)>=5) @@ -255,13 +255,13 @@ FCEUFILE * FCEU_fopen(const char *path, const char *ipsfn, char *mode, char *ext break; } if(unzGoToNextFile(tz)!=UNZ_OK) - { + { if(unzGoToFirstFile(tz)!=UNZ_OK) goto zpfail; - break; + break; } } if(unzOpenCurrentFile(tz)!=UNZ_OK) - goto zpfail; + goto zpfail; } else { @@ -375,7 +375,7 @@ uint64 FCEU_fread(void *ptr, size_t size, size_t nmemb, FCEUFILE *fp) return gzread(fp->fp,ptr,size*nmemb); } else if(fp->type>=2) - { + { MEMWRAP *wz; uint32 total=size*nmemb; @@ -421,7 +421,7 @@ int FCEU_fseek(FCEUFILE *fp, long offset, int whence) if(fp->type==1) { return( (gzseek(fp->fp,offset,whence)>0)?0:-1); - } + } else if(fp->type>=2) { MEMWRAP *wz; @@ -436,7 +436,7 @@ int FCEU_fseek(FCEUFILE *fp, long offset, int whence) return (-1); wz->location+=offset; break; - } + } return 0; } else @@ -450,8 +450,8 @@ uint64 FCEU_ftell(FCEUFILE *fp) return gztell(fp->fp); } else if(fp->type>=2) - { - return (((MEMWRAP *)(fp->fp))->location); + { + return (((MEMWRAP *)(fp->fp))->location); } else return ftell((FILE *)fp->fp); @@ -538,7 +538,7 @@ int FCEU_read32le(uint32 *Bufo, FCEUFILE *fp) int FCEU_fgetc(FCEUFILE *fp) { if(fp->type==1) - return gzgetc(fp->fp); + return gzgetc(fp->fp); else if(fp->type>=2) { MEMWRAP *wz; @@ -821,9 +821,9 @@ char *FCEU_MakeFName(int type, int id1, char *cd1) case FCEUMKF_GGROM:asprintf(&ret,"%s"PSS"gg.rom",BaseDirectory);break; case FCEUMKF_FDSROM: if(odirs[FCEUIOD_FDSROM]) - asprintf(&ret,"%s"PSS"disksys.rom",odirs[FCEUIOD_FDSROM],FileBase); + asprintf(&ret,"%s"PSS"disksys.rom",odirs[FCEUIOD_FDSROM]); else - asprintf(&ret,"%s"PSS"disksys.rom",BaseDirectory,FileBase); + asprintf(&ret,"%s"PSS"disksys.rom",BaseDirectory); break; case FCEUMKF_PALETTE:asprintf(&ret,"%s"PSS"%s.pal",BaseDirectory,FileBase);break; case FCEUMKF_MOVIEGLOB: diff --git a/src/input.cpp b/src/input.cpp index 83f46bdf..2374dceb 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -1,7 +1,7 @@ /* FCE Ultra - NES/Famicom Emulator * * Copyright notice for this file: - * Copyright (C) 1998 BERO + * Copyright (C) 1998 BERO * Copyright (C) 2002 Xodnizel * * This program is free software; you can redistribute it and/or modify @@ -36,10 +36,10 @@ #include "vsuni.h" #include "fds.h" -// qfox: For UpdateExternalButton(), called when the +// qfox: For UpdateExternalButton(), called when the // botmode state changes, to update a label in gui. #ifdef WIN32 - #include "drivers/win/basicbot.h" + #include "drivers/win/basicbot.h" #endif // WIN32 extern INPUTC *FCEU_InitZapper(int w); @@ -97,7 +97,7 @@ static INPUTCFC *FCExp=0; static uint8 ReadGPVS(int w) { uint8 ret=0; - + if(joy_readbit[w]>=8) ret=1; else @@ -137,7 +137,7 @@ static DECLFR(JPRead) if(JPorts[A&1]->Read) ret|=JPorts[A&1]->Read(A&1); - + if(FCExp) if(FCExp->Read) ret=FCExp->Read(A&1,ret); @@ -294,27 +294,27 @@ void FCEU_UpdateInput(void) } static DECLFR(VSUNIRead0) -{ - uint8 ret=0; - - if(JPorts[0]->Read) +{ + uint8 ret=0; + + if(JPorts[0]->Read) ret|=(JPorts[0]->Read(0))&1; - + ret|=(vsdip&3)<<3; if(coinon) ret|=0x4; return ret; } - + static DECLFR(VSUNIRead1) { uint8 ret=0; - + if(JPorts[1]->Read) ret|=(JPorts[1]->Read(1))&1; - ret|=vsdip&0xFC; + ret|=vsdip&0xFC; return ret; -} +} static void SLHLHook(uint8 *bg, uint8 *spr, uint32 linets, int final) { @@ -323,7 +323,7 @@ static void SLHLHook(uint8 *bg, uint8 *spr, uint32 linets, int final) for(x=0;x<2;x++) if(JPorts[x]->SLHook) JPorts[x]->SLHook(x,bg,spr,linets,final); - if(FCExp) + if(FCExp) if(FCExp->SLHook) FCExp->SLHook(bg,spr,linets,final); } @@ -399,7 +399,7 @@ static void SetInputStuffFC(void) } void InitializeInput(void) -{ +{ memset(joy_readbit,0,sizeof(joy_readbit)); memset(joy,0,sizeof(joy)); LastStrobe = 0; @@ -408,7 +408,7 @@ void InitializeInput(void) { SetReadHandler(0x4016,0x4016,VSUNIRead0); SetReadHandler(0x4017,0x4017,VSUNIRead1); - } + } else SetReadHandler(0x4016,0x4017,JPRead); @@ -482,13 +482,13 @@ void FCEU_QSimpleCommand(int cmd) } void FCEUI_FDSSelect(void) -{ +{ FCEU_QSimpleCommand(FCEUNPCMD_FDSSELECT); -} +} //mbg merge 7/17/06 changed to void fn(void) to make it an EMUCMDFN void FCEUI_FDSInsert(void) -{ +{ FCEU_QSimpleCommand(FCEUNPCMD_FDSINSERT); //return(1); } @@ -545,8 +545,8 @@ static void CommandStateSave(void); static void CommandSelectSaveSlot(void); static void CommandEmulationSpeed(void); // static void CommandMovieSelectSlot(void); -static void CommandMovieRecord(void); -static void CommandMovieReplay(void); +//static void CommandMovieRecord(void); +//static void CommandMovieReplay(void); static void CommandSoundAdjust(void); static void CommandUsePreset(void); static void ViewSlots(void); @@ -753,7 +753,7 @@ static void CommandStateLoad(void) FCEUI_LoadState(0); } -static void CommandMovieRecord(void) +/*static void CommandMovieRecord(void) { FCEUI_SaveMovie(0, 0); } @@ -761,7 +761,7 @@ static void CommandMovieRecord(void) static void CommandMovieReplay(void) { FCEUI_LoadMovie(0, 0, 0); -} +}*/ static void CommandSoundAdjust(void) { diff --git a/src/input/zapper.h b/src/input/zapper.h index 7fda3c89..31905f76 100644 --- a/src/input/zapper.h +++ b/src/input/zapper.h @@ -12,4 +12,4 @@ struct ZAPPER extern ZAPPER ZD[2]; -#endif \ No newline at end of file +#endif diff --git a/src/utils/memorystream.h b/src/utils/memorystream.h index 28238c46..ffce93c6 100644 --- a/src/utils/memorystream.h +++ b/src/utils/memorystream.h @@ -26,15 +26,15 @@ private: //a vector that we have been told to use std::vector* usevec; - + public: memory_streambuf() - : length(0) + : buf(new T[capacity = 128]) , myBuf(true) + , length(0) , ww(0) - , buf(new T[capacity = 128]) , usevec(0) { sync(); @@ -42,9 +42,9 @@ public: //constructs a non-expandable streambuf around the provided buffer memory_streambuf(T* usebuf, int buflength) - : length(buflength) - , myBuf(false) - , buf(usebuf) + : buf(usebuf) + , myBuf(false) + , length(buflength) , ww(0) , usevec(0) { @@ -53,11 +53,11 @@ public: //constructs an expandable streambuf around the provided buffer memory_streambuf(std::vector* _usevec) - : usevec(_usevec) - , length(_usevec->size()) - , capacity(_usevec->size()) - , myBuf(false) - , ww(0) + : capacity(_usevec->size()) + , myBuf(false) + , length(_usevec->size()) + , ww(0) + , usevec(_usevec) { if(length>0) buf = &(*_usevec)[0]; @@ -71,10 +71,10 @@ public: //only cleanup if we own the seq if(myBuf) delete[] buf; } - + //the logical length of the buffer size_t size() - { + { sync(); return length; } @@ -254,7 +254,7 @@ public: memory_streambuf streambuf; -public: +public: size_t size() { return streambuf.size(); } char* buf() { return streambuf.getbuf(); }