More silly warning elimination

This commit is contained in:
jeblanchard 2008-06-07 01:21:38 +00:00
parent 6ae3b48b7d
commit 8e546b1bed
10 changed files with 196 additions and 156 deletions

View File

@ -21,7 +21,8 @@
#include "mapinc.h" #include "mapinc.h"
static uint8 IRQCount, IRQPre; static uint8 IRQCount;
//static uint8 IRQPre;
static uint8 IRQa; static uint8 IRQa;
static uint8 prg_reg[2]; static uint8 prg_reg[2];
static uint8 chr_reg[8]; static uint8 chr_reg[8];
@ -56,8 +57,8 @@ static void Sync(void)
setprg8(0xA000,prg_reg[1]); setprg8(0xA000,prg_reg[1]);
int i; int i;
for(i=0; i<8; i++) for(i=0; i<8; i++)
setchr1(i<<10,chr_reg[i]); setchr1(i<<10,chr_reg[i]);
setmirror(mirr^1); setmirror(mirr^1);
} }
static DECLFW(M222Write) static DECLFW(M222Write)

View File

@ -21,7 +21,7 @@
#include "mapinc.h" #include "mapinc.h"
#include "mmc3.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) static void UNLA9711PW(uint32 A, uint8 V)
{ {

View File

@ -78,9 +78,7 @@ CreateDirs(const std::string &dir)
static void static void
GetBaseDirectory(std::string &dir) GetBaseDirectory(std::string &dir)
{ {
char *home, *lastBS; char *home = getenv("HOME");
home = getenv("HOME");
if(home) { if(home) {
dir = std::string(home) + "/.fceultra"; dir = std::string(home) + "/.fceultra";
} else { } else {
@ -88,7 +86,7 @@ GetBaseDirectory(std::string &dir)
home = new char[MAX_PATH + 1]; home = new char[MAX_PATH + 1];
GetModuleFileName(NULL, home, MAX_PATH + 1); GetModuleFileName(NULL, home, MAX_PATH + 1);
lastBS = strrchr(home,'\\'); char *lastBS = strrchr(home,'\\');
if(lastBS) { if(lastBS) {
*lastBS = 0; *lastBS = 0;
} }
@ -305,7 +303,7 @@ UpdateEMUCore(Config *config)
config->getOption("SDL.ScanLineStart", &start); config->getOption("SDL.ScanLineStart", &start);
config->getOption("SDL.ScanLineEnd", &end); config->getOption("SDL.ScanLineEnd", &end);
#if DOING_SCANLINE_CHECKS #if DOING_SCANLINE_CHECKS
for(int i = 0; i < 2; x++) { for(int i = 0; i < 2; x++) {
if(srendlinev[x]<0 || srendlinev[x]>239) srendlinev[x]=0; if(srendlinev[x]<0 || srendlinev[x]>239) srendlinev[x]=0;
if(erendlinev[x]<srendlinev[x] || erendlinev[x]>239) erendlinev[x]=239; if(erendlinev[x]<srendlinev[x] || erendlinev[x]>239) erendlinev[x]=239;

View File

@ -1429,3 +1429,97 @@ UpdateInput(Config *config)
fkbmap[j].NumC = 1; 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 };

View File

@ -52,104 +52,51 @@ int CLImain(int argc, char *argv[]);
// GamePad defaults // GamePad defaults
#define GAMEPAD_NUM_DEVICES 4 #define GAMEPAD_NUM_DEVICES 4
#define GAMEPAD_NUM_BUTTONS 10 #define GAMEPAD_NUM_BUTTONS 10
static const char *GamePadNames[GAMEPAD_NUM_BUTTONS] = extern const char *GamePadNames[GAMEPAD_NUM_BUTTONS];
{"A", "B", "Select", "Start", extern const char *DefaultGamePadDevice[GAMEPAD_NUM_DEVICES];
"Up", "Down", "Left", "Right", "TurboA", "TurboB"}; extern const int DefaultGamePad[GAMEPAD_NUM_DEVICES][GAMEPAD_NUM_BUTTONS];
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 } };
// PowerPad defaults // PowerPad defaults
#define POWERPAD_NUM_DEVICES 2 #define POWERPAD_NUM_DEVICES 2
#define POWERPAD_NUM_BUTTONS 12 #define POWERPAD_NUM_BUTTONS 12
static const char *PowerPadNames[POWERPAD_NUM_BUTTONS] = extern const char *PowerPadNames[POWERPAD_NUM_BUTTONS];
{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B"}; extern const char *DefaultPowerPadDevice[POWERPAD_NUM_DEVICES];
static const char *DefaultPowerPadDevice[POWERPAD_NUM_DEVICES] = extern const int DefaultPowerPad[POWERPAD_NUM_DEVICES][POWERPAD_NUM_BUTTONS];
{"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 } };
// QuizKing defaults // QuizKing defaults
#define QUIZKING_NUM_BUTTONS 6 #define QUIZKING_NUM_BUTTONS 6
static const char *QuizKingNames[QUIZKING_NUM_BUTTONS] = extern const char *QuizKingNames[QUIZKING_NUM_BUTTONS];
{ "0", "1", "2", "3", "4", "5" }; extern const char *DefaultQuizKingDevice;
static const char *DefaultQuizKingDevice = "Keyboard"; extern const int DefaultQuizKing[QUIZKING_NUM_BUTTONS];
static const int DefaultQuizKing[QUIZKING_NUM_BUTTONS] =
{ SDLK_q, SDLK_w, SDLK_e, SDLK_r, SDLK_t, SDLK_y };
// HyperShot defaults // HyperShot defaults
#define HYPERSHOT_NUM_BUTTONS 4 #define HYPERSHOT_NUM_BUTTONS 4
static const char *HyperShotNames[HYPERSHOT_NUM_BUTTONS] = extern const char *HyperShotNames[HYPERSHOT_NUM_BUTTONS];
{ "0", "1", "2", "3" }; extern const char *DefaultHyperShotDevice;
static const char *DefaultHyperShotDevice = "Keyboard"; extern const int DefaultHyperShot[HYPERSHOT_NUM_BUTTONS];
static const int DefaultHyperShot[HYPERSHOT_NUM_BUTTONS] =
{ SDLK_q, SDLK_w, SDLK_e, SDLK_r };
// Mahjong defaults // Mahjong defaults
#define MAHJONG_NUM_BUTTONS 21 #define MAHJONG_NUM_BUTTONS 21
static const char *MahjongNames[MAHJONG_NUM_BUTTONS] = extern const char *MahjongNames[MAHJONG_NUM_BUTTONS];
{ "00", "01", "02", "03", "04", "05", "06", "07", extern const char *DefaultMahjongDevice;
"08", "09", "10", "11", "12", "13", "14", "15", extern const int DefaultMahjong[MAHJONG_NUM_BUTTONS];
"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 };
// TopRider defaults // TopRider defaults
#define TOPRIDER_NUM_BUTTONS 8 #define TOPRIDER_NUM_BUTTONS 8
static const char *TopRiderNames[TOPRIDER_NUM_BUTTONS] = extern const char *TopRiderNames[TOPRIDER_NUM_BUTTONS];
{ "0", "1", "2", "3", "4", "5", "6", "7" }; extern const char *DefaultTopRiderDevice;
static const char *DefaultTopRiderDevice = "Keyboard"; extern const int DefaultTopRider[TOPRIDER_NUM_BUTTONS];
static const int DefaultTopRider[TOPRIDER_NUM_BUTTONS] =
{ SDLK_q, SDLK_w, SDLK_e, SDLK_r, SDLK_t, SDLK_y, SDLK_u, SDLK_i };
// FTrainer defaults // FTrainer defaults
#define FTRAINER_NUM_BUTTONS 12 #define FTRAINER_NUM_BUTTONS 12
static const char *FTrainerNames[FTRAINER_NUM_BUTTONS] = extern const char *FTrainerNames[FTRAINER_NUM_BUTTONS];
{ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B" }; extern const char *DefaultFTrainerDevice;
static const char *DefaultFTrainerDevice = "Keyboard"; extern const int DefaultFTrainer[FTRAINER_NUM_BUTTONS];
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 };
// FamilyKeyBoard defaults // FamilyKeyBoard defaults
#define FAMILYKEYBOARD_NUM_BUTTONS 0x48 #define FAMILYKEYBOARD_NUM_BUTTONS 0x48
static const char *FamilyKeyBoardNames[FAMILYKEYBOARD_NUM_BUTTONS] = extern const char *FamilyKeyBoardNames[FAMILYKEYBOARD_NUM_BUTTONS];
{ "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", extern const char *DefaultFamilyKeyBoardDevice;
"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", extern const int DefaultFamilyKeyBoard[FAMILYKEYBOARD_NUM_BUTTONS];
"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 };
#endif #endif

View File

@ -61,7 +61,7 @@ extern Config *g_config;
#define SOL_TCP IPPROTO_TCP #define SOL_TCP IPPROTO_TCP
#endif #endif
int FCEUDnetplay=0; int FCEUDnetplay=0;
static int s_Socket = -1; static int s_Socket = -1;
@ -77,7 +77,7 @@ en32(uint8 *buf,
/* /*
static uint32 de32(uint8 *morp) static uint32 de32(uint8 *morp)
{ {
return(morp[0]|(morp[1]<<8)|(morp[2]<<16)|(morp[3]<<24)); return(morp[0]|(morp[1]<<8)|(morp[2]<<16)|(morp[3]<<24));
} }
*/ */
@ -90,7 +90,7 @@ FCEUD_NetworkConnect(void)
unsigned long hadr; unsigned long hadr;
int TSocket, tcpopt, error; int TSocket, tcpopt, error;
int netdivisor; int netdivisor;
// get any required configuration variables // get any required configuration variables
int port, localPlayers; int port, localPlayers;
std::string server, username, password, key; std::string server, username, password, key;
@ -121,7 +121,7 @@ FCEUD_NetworkConnect(void)
#elif WIN32 #elif WIN32
error = setsockopt(TSocket, SOL_TCP, TCP_NODELAY, error = setsockopt(TSocket, SOL_TCP, TCP_NODELAY,
(char*)&tcpopt, sizeof(int)); (char*)&tcpopt, sizeof(int));
#else #else
error = setsockopt(TSocket, SOL_TCP, TCP_NODELAY, &tcpopt, sizeof(int)); error = setsockopt(TSocket, SOL_TCP, TCP_NODELAY, &tcpopt, sizeof(int));
#endif #endif
if(error) { if(error) {
@ -144,7 +144,7 @@ FCEUD_NetworkConnect(void)
} }
memcpy(&sockin.sin_addr, phostentb->h_addr, phostentb->h_length); memcpy(&sockin.sin_addr, phostentb->h_addr, phostentb->h_length);
} }
sockin.sin_port = htons(port); sockin.sin_port = htons(port);
puts("*** Connecting to remote host..."); puts("*** Connecting to remote host...");
error = connect(TSocket, (struct sockaddr *)&sockin, sizeof(sockin)); error = connect(TSocket, (struct sockaddr *)&sockin, sizeof(sockin));
@ -160,17 +160,17 @@ FCEUD_NetworkConnect(void)
puts("*** Sending initialization data to server..."); puts("*** Sending initialization data to server...");
uint8 *sendbuf; uint8 *sendbuf;
uint8 buf[5]; uint8 buf[5];
uint32 sblen, data; uint32 sblen;
sblen = 4 + 16 + 16 + 64 + 1 + username.size(); sblen = 4 + 16 + 16 + 64 + 1 + username.size();
sendbuf = (uint8 *)malloc(sblen); sendbuf = (uint8 *)malloc(sblen);
memset(sendbuf, 0, sblen); memset(sendbuf, 0, sblen);
// XXX soules - should use htons instead of en32() from above! // XXX soules - should use htons instead of en32() from above!
//data = htons(sblen - 4); //uint32 data = htons(sblen - 4);
//memcpy(sendbuf, &data, sizeof(data)); //memcpy(sendbuf, &data, sizeof(data));
en32(sendbuf, sblen - 4); en32(sendbuf, sblen - 4);
if(key.size()) { if(key.size()) {
struct md5_context md5; struct md5_context md5;
uint8 md5out[16]; uint8 md5out[16];
@ -187,13 +187,13 @@ FCEUD_NetworkConnect(void)
if(password.size()) { if(password.size()) {
struct md5_context md5; struct md5_context md5;
uint8 md5out[16]; uint8 md5out[16];
md5_starts(&md5); md5_starts(&md5);
md5_update(&md5, (uint8 *)password.c_str(), password.size()); md5_update(&md5, (uint8 *)password.c_str(), password.size());
md5_finish(&md5, md5out); md5_finish(&md5, md5out);
memcpy(sendbuf + 4 + 16, md5out, 16); memcpy(sendbuf + 4 + 16, md5out, 16);
} }
memset(sendbuf + 4 + 16 + 16, 0, 64); memset(sendbuf + 4 + 16 + 16, 0, 64);
sendbuf[4 + 16 + 16 + 64] = (uint8)localPlayers; sendbuf[4 + 16 + 16 + 64] = (uint8)localPlayers;
@ -258,14 +258,14 @@ FCEUD_RecvData(void *data,
{ {
int size; int size;
NoWaiting &= ~2; NoWaiting &= ~2;
for(;;) { for(;;) {
fd_set funfun; fd_set funfun;
struct timeval popeye; struct timeval popeye;
popeye.tv_sec=0; popeye.tv_sec=0;
popeye.tv_usec=100000; popeye.tv_usec=100000;
FD_ZERO(&funfun); FD_ZERO(&funfun);
FD_SET(s_Socket, &funfun); FD_SET(s_Socket, &funfun);
@ -277,7 +277,7 @@ FCEUD_RecvData(void *data,
if(FD_ISSET(s_Socket,&funfun)) { if(FD_ISSET(s_Socket,&funfun)) {
#ifdef WIN32 #ifdef WIN32
size = recv(s_Socket, (char*)data, len, 0); size = recv(s_Socket, (char*)data, len, 0);
#else #else
size = recv(s_Socket, data, len, MSG_WAITALL); size = recv(s_Socket, data, len, MSG_WAITALL);
#endif #endif

View File

@ -52,7 +52,7 @@ void ApplyIPS(FILE *ips, MEMWRAP *dest)
{ {
uint8 header[5]; uint8 header[5];
uint32 count=0; uint32 count=0;
FCEU_printf(" Applying IPS...\n"); FCEU_printf(" Applying IPS...\n");
if(fread(header,1,5,ips)!=5) if(fread(header,1,5,ips)!=5)
{ {
@ -118,7 +118,7 @@ void ApplyIPS(FILE *ips, MEMWRAP *dest)
if((offset+size)>dest->size) if((offset+size)>dest->size)
{ {
uint8 *tmp; uint8 *tmp;
// Probably a little slow. // Probably a little slow.
tmp=(uint8 *)realloc(dest->data,offset+size); tmp=(uint8 *)realloc(dest->data,offset+size);
if(!tmp) if(!tmp)
@ -175,8 +175,8 @@ static MEMWRAP *MakeMemWrap(void *tz, int type)
} }
else if(type==2) else if(type==2)
{ {
unz_file_info ufo; unz_file_info ufo;
unzGetCurrentFileInfo(tz,&ufo,0,0,0,0,0,0); unzGetCurrentFileInfo(tz,&ufo,0,0,0,0,0,0);
tmp->size=ufo.uncompressed_size; tmp->size=ufo.uncompressed_size;
if(!(tmp->data=(uint8 *)FCEU_malloc(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")) !strcasecmp(za,".nez"))
break; break;
} }
else if(!strcasecmp(za,ext)) else if(!strcasecmp(za,ext))
break; break;
} }
if(strlen(tempu)>=5) if(strlen(tempu)>=5)
@ -255,13 +255,13 @@ FCEUFILE * FCEU_fopen(const char *path, const char *ipsfn, char *mode, char *ext
break; break;
} }
if(unzGoToNextFile(tz)!=UNZ_OK) if(unzGoToNextFile(tz)!=UNZ_OK)
{ {
if(unzGoToFirstFile(tz)!=UNZ_OK) goto zpfail; if(unzGoToFirstFile(tz)!=UNZ_OK) goto zpfail;
break; break;
} }
} }
if(unzOpenCurrentFile(tz)!=UNZ_OK) if(unzOpenCurrentFile(tz)!=UNZ_OK)
goto zpfail; goto zpfail;
} }
else 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); return gzread(fp->fp,ptr,size*nmemb);
} }
else if(fp->type>=2) else if(fp->type>=2)
{ {
MEMWRAP *wz; MEMWRAP *wz;
uint32 total=size*nmemb; uint32 total=size*nmemb;
@ -421,7 +421,7 @@ int FCEU_fseek(FCEUFILE *fp, long offset, int whence)
if(fp->type==1) if(fp->type==1)
{ {
return( (gzseek(fp->fp,offset,whence)>0)?0:-1); return( (gzseek(fp->fp,offset,whence)>0)?0:-1);
} }
else if(fp->type>=2) else if(fp->type>=2)
{ {
MEMWRAP *wz; MEMWRAP *wz;
@ -436,7 +436,7 @@ int FCEU_fseek(FCEUFILE *fp, long offset, int whence)
return (-1); return (-1);
wz->location+=offset; wz->location+=offset;
break; break;
} }
return 0; return 0;
} }
else else
@ -450,8 +450,8 @@ uint64 FCEU_ftell(FCEUFILE *fp)
return gztell(fp->fp); return gztell(fp->fp);
} }
else if(fp->type>=2) else if(fp->type>=2)
{ {
return (((MEMWRAP *)(fp->fp))->location); return (((MEMWRAP *)(fp->fp))->location);
} }
else else
return ftell((FILE *)fp->fp); return ftell((FILE *)fp->fp);
@ -538,7 +538,7 @@ int FCEU_read32le(uint32 *Bufo, FCEUFILE *fp)
int FCEU_fgetc(FCEUFILE *fp) int FCEU_fgetc(FCEUFILE *fp)
{ {
if(fp->type==1) if(fp->type==1)
return gzgetc(fp->fp); return gzgetc(fp->fp);
else if(fp->type>=2) else if(fp->type>=2)
{ {
MEMWRAP *wz; 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_GGROM:asprintf(&ret,"%s"PSS"gg.rom",BaseDirectory);break;
case FCEUMKF_FDSROM: case FCEUMKF_FDSROM:
if(odirs[FCEUIOD_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 else
asprintf(&ret,"%s"PSS"disksys.rom",BaseDirectory,FileBase); asprintf(&ret,"%s"PSS"disksys.rom",BaseDirectory);
break; break;
case FCEUMKF_PALETTE:asprintf(&ret,"%s"PSS"%s.pal",BaseDirectory,FileBase);break; case FCEUMKF_PALETTE:asprintf(&ret,"%s"PSS"%s.pal",BaseDirectory,FileBase);break;
case FCEUMKF_MOVIEGLOB: case FCEUMKF_MOVIEGLOB:

View File

@ -1,7 +1,7 @@
/* FCE Ultra - NES/Famicom Emulator /* FCE Ultra - NES/Famicom Emulator
* *
* Copyright notice for this file: * Copyright notice for this file:
* Copyright (C) 1998 BERO * Copyright (C) 1998 BERO
* Copyright (C) 2002 Xodnizel * Copyright (C) 2002 Xodnizel
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -36,10 +36,10 @@
#include "vsuni.h" #include "vsuni.h"
#include "fds.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. // botmode state changes, to update a label in gui.
#ifdef WIN32 #ifdef WIN32
#include "drivers/win/basicbot.h" #include "drivers/win/basicbot.h"
#endif // WIN32 #endif // WIN32
extern INPUTC *FCEU_InitZapper(int w); extern INPUTC *FCEU_InitZapper(int w);
@ -97,7 +97,7 @@ static INPUTCFC *FCExp=0;
static uint8 ReadGPVS(int w) static uint8 ReadGPVS(int w)
{ {
uint8 ret=0; uint8 ret=0;
if(joy_readbit[w]>=8) if(joy_readbit[w]>=8)
ret=1; ret=1;
else else
@ -137,7 +137,7 @@ static DECLFR(JPRead)
if(JPorts[A&1]->Read) if(JPorts[A&1]->Read)
ret|=JPorts[A&1]->Read(A&1); ret|=JPorts[A&1]->Read(A&1);
if(FCExp) if(FCExp)
if(FCExp->Read) if(FCExp->Read)
ret=FCExp->Read(A&1,ret); ret=FCExp->Read(A&1,ret);
@ -294,27 +294,27 @@ void FCEU_UpdateInput(void)
} }
static DECLFR(VSUNIRead0) static DECLFR(VSUNIRead0)
{ {
uint8 ret=0; uint8 ret=0;
if(JPorts[0]->Read) if(JPorts[0]->Read)
ret|=(JPorts[0]->Read(0))&1; ret|=(JPorts[0]->Read(0))&1;
ret|=(vsdip&3)<<3; ret|=(vsdip&3)<<3;
if(coinon) if(coinon)
ret|=0x4; ret|=0x4;
return ret; return ret;
} }
static DECLFR(VSUNIRead1) static DECLFR(VSUNIRead1)
{ {
uint8 ret=0; uint8 ret=0;
if(JPorts[1]->Read) if(JPorts[1]->Read)
ret|=(JPorts[1]->Read(1))&1; ret|=(JPorts[1]->Read(1))&1;
ret|=vsdip&0xFC; ret|=vsdip&0xFC;
return ret; return ret;
} }
static void SLHLHook(uint8 *bg, uint8 *spr, uint32 linets, int final) 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++) for(x=0;x<2;x++)
if(JPorts[x]->SLHook) if(JPorts[x]->SLHook)
JPorts[x]->SLHook(x,bg,spr,linets,final); JPorts[x]->SLHook(x,bg,spr,linets,final);
if(FCExp) if(FCExp)
if(FCExp->SLHook) if(FCExp->SLHook)
FCExp->SLHook(bg,spr,linets,final); FCExp->SLHook(bg,spr,linets,final);
} }
@ -399,7 +399,7 @@ static void SetInputStuffFC(void)
} }
void InitializeInput(void) void InitializeInput(void)
{ {
memset(joy_readbit,0,sizeof(joy_readbit)); memset(joy_readbit,0,sizeof(joy_readbit));
memset(joy,0,sizeof(joy)); memset(joy,0,sizeof(joy));
LastStrobe = 0; LastStrobe = 0;
@ -408,7 +408,7 @@ void InitializeInput(void)
{ {
SetReadHandler(0x4016,0x4016,VSUNIRead0); SetReadHandler(0x4016,0x4016,VSUNIRead0);
SetReadHandler(0x4017,0x4017,VSUNIRead1); SetReadHandler(0x4017,0x4017,VSUNIRead1);
} }
else else
SetReadHandler(0x4016,0x4017,JPRead); SetReadHandler(0x4016,0x4017,JPRead);
@ -482,13 +482,13 @@ void FCEU_QSimpleCommand(int cmd)
} }
void FCEUI_FDSSelect(void) void FCEUI_FDSSelect(void)
{ {
FCEU_QSimpleCommand(FCEUNPCMD_FDSSELECT); FCEU_QSimpleCommand(FCEUNPCMD_FDSSELECT);
} }
//mbg merge 7/17/06 changed to void fn(void) to make it an EMUCMDFN //mbg merge 7/17/06 changed to void fn(void) to make it an EMUCMDFN
void FCEUI_FDSInsert(void) void FCEUI_FDSInsert(void)
{ {
FCEU_QSimpleCommand(FCEUNPCMD_FDSINSERT); FCEU_QSimpleCommand(FCEUNPCMD_FDSINSERT);
//return(1); //return(1);
} }
@ -545,8 +545,8 @@ static void CommandStateSave(void);
static void CommandSelectSaveSlot(void); static void CommandSelectSaveSlot(void);
static void CommandEmulationSpeed(void); static void CommandEmulationSpeed(void);
// static void CommandMovieSelectSlot(void); // static void CommandMovieSelectSlot(void);
static void CommandMovieRecord(void); //static void CommandMovieRecord(void);
static void CommandMovieReplay(void); //static void CommandMovieReplay(void);
static void CommandSoundAdjust(void); static void CommandSoundAdjust(void);
static void CommandUsePreset(void); static void CommandUsePreset(void);
static void ViewSlots(void); static void ViewSlots(void);
@ -753,7 +753,7 @@ static void CommandStateLoad(void)
FCEUI_LoadState(0); FCEUI_LoadState(0);
} }
static void CommandMovieRecord(void) /*static void CommandMovieRecord(void)
{ {
FCEUI_SaveMovie(0, 0); FCEUI_SaveMovie(0, 0);
} }
@ -761,7 +761,7 @@ static void CommandMovieRecord(void)
static void CommandMovieReplay(void) static void CommandMovieReplay(void)
{ {
FCEUI_LoadMovie(0, 0, 0); FCEUI_LoadMovie(0, 0, 0);
} }*/
static void CommandSoundAdjust(void) static void CommandSoundAdjust(void)
{ {

View File

@ -12,4 +12,4 @@ struct ZAPPER
extern ZAPPER ZD[2]; extern ZAPPER ZD[2];
#endif #endif

View File

@ -26,15 +26,15 @@ private:
//a vector that we have been told to use //a vector that we have been told to use
std::vector<T>* usevec; std::vector<T>* usevec;
public: public:
memory_streambuf() memory_streambuf()
: length(0) : buf(new T[capacity = 128])
, myBuf(true) , myBuf(true)
, length(0)
, ww(0) , ww(0)
, buf(new T[capacity = 128])
, usevec(0) , usevec(0)
{ {
sync(); sync();
@ -42,9 +42,9 @@ public:
//constructs a non-expandable streambuf around the provided buffer //constructs a non-expandable streambuf around the provided buffer
memory_streambuf(T* usebuf, int buflength) memory_streambuf(T* usebuf, int buflength)
: length(buflength) : buf(usebuf)
, myBuf(false) , myBuf(false)
, buf(usebuf) , length(buflength)
, ww(0) , ww(0)
, usevec(0) , usevec(0)
{ {
@ -53,11 +53,11 @@ public:
//constructs an expandable streambuf around the provided buffer //constructs an expandable streambuf around the provided buffer
memory_streambuf(std::vector<T>* _usevec) memory_streambuf(std::vector<T>* _usevec)
: usevec(_usevec) : capacity(_usevec->size())
, length(_usevec->size()) , myBuf(false)
, capacity(_usevec->size()) , length(_usevec->size())
, myBuf(false) , ww(0)
, ww(0) , usevec(_usevec)
{ {
if(length>0) if(length>0)
buf = &(*_usevec)[0]; buf = &(*_usevec)[0];
@ -71,10 +71,10 @@ public:
//only cleanup if we own the seq //only cleanup if we own the seq
if(myBuf) delete[] buf; if(myBuf) delete[] buf;
} }
//the logical length of the buffer //the logical length of the buffer
size_t size() size_t size()
{ {
sync(); sync();
return length; return length;
} }
@ -254,7 +254,7 @@ public:
memory_streambuf<char> streambuf; memory_streambuf<char> streambuf;
public: public:
size_t size() { return streambuf.size(); } size_t size() { return streambuf.size(); }
char* buf() { return streambuf.getbuf(); } char* buf() { return streambuf.getbuf(); }