/** * Loads a game, given a full path/filename. The driver code must be * initialized after the game is loaded, because the emulator code * provides data necessary for the driver code(number of scanlines to * render, what virtual input devices to use, etc.). */ int LoadGame(const char *path) { if (isloaded){ CloseGame(); } if(!FCEUI_LoadGame(path, 1)) { return 0; } int state_to_load; g_config->getOption("SDL.AutoLoadState", &state_to_load); if (state_to_load >= 0 && state_to_load < 10){ FCEUI_SelectState(state_to_load, 0); FCEUI_LoadState(NULL, false); } ParseGIInput(GameInfo); RefreshThrottleFPS(); if(!DriverInitialize(GameInfo)) { return(0); } // set pal/ntsc int id; g_config->getOption("SDL.PAL", &id); switch(id) { case 0: FCEUI_SetVidSystem(0); pal_emulation = 0; dendy = 0; break; case 1: FCEUI_SetVidSystem(1); pal_emulation = 1; dendy = 0; break; case 2: FCEUI_SetVidSystem(0); pal_emulation = 0; dendy = 1; } std::string filename; g_config->getOption("SDL.Sound.RecordFile", &filename); if(filename.size()) { if(!FCEUI_BeginWaveRecord(filename.c_str())) { g_config->setOption("SDL.Sound.RecordFile", ""); } } isloaded = 1; FCEUD_NetworkConnect(); return 1; }
static BOOL CALLBACK NetCon(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_CLOSE: GetSettings(hwndDlg); DestroyWindow(hwndDlg); netwin=0; FCEUD_NetworkClose(); break; case WM_COMMAND: if(HIWORD(wParam)==BN_CLICKED) { switch(LOWORD(wParam)) { case BTN_NETMOO_CONNECT: if(FCEUDnetplay) { FCEUD_NetworkClose(); SetDlgItemText(hwndDlg,BTN_NETMOO_CONNECT,"Connect"); FixCDis(hwndDlg,1); } else if(GameInfo) { GetSettings(hwndDlg); if(FCEUD_NetworkConnect()) { SetDlgItemText(hwndDlg,BTN_NETMOO_CONNECT,"Disconnect"); FixCDis(hwndDlg,0); } } break; } } else if(HIWORD(wParam)==EN_CHANGE && Socket!=INVALID_SOCKET) { char buf[1024]; int t; t=GetDlgItemText(hwndDlg,IDC_NETMOO_CMD_INPUT,buf,1024); buf[1023]=0; if(strchr(buf,'\r')) { char *src,*dest; src=dest=buf; while(*src) { if(*src != '\n' && *src != '\r') { *dest = *src; dest++; } src++; } *dest = 0; FCEUI_NetplayText((uint8*)buf); //mbg merge 7/17/06 added cast SetDlgItemText(hwndDlg,IDC_NETMOO_CMD_INPUT,""); } } break; case WM_INITDIALOG: if(netplayhost) SetDlgItemText(hwndDlg,IDC_NETMOO_HOST,netplayhost); SetDlgItemInt(hwndDlg,IDC_NETMOO_PORT,remotetport,0); if(netplaynick) SetDlgItemText(hwndDlg,IDC_NETMOO_NICK,netplaynick); if(netgamekey) SetDlgItemText(hwndDlg,IDC_NETMOO_KEY,netgamekey); if(netpassword) SetDlgItemText(hwndDlg,IDC_NETMOO_PASS,netpassword); { int x; char buf[8]; for(x=0;x<4;x++) { sprintf(buf,"%d",x+1); SendDlgItemMessage(hwndDlg,COMBO_NETMOO_LOCAL_PLAYERS,CB_ADDSTRING,0,(LPARAM)(LPSTR)buf); } SendDlgItemMessage(hwndDlg,COMBO_NETMOO_LOCAL_PLAYERS,CB_SETCURSEL,netlocalplayers-1,(LPARAM)(LPSTR)0); } break; } return 0; }
static BOOL CALLBACK NetCon(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_CLOSE: GetSettings(hwndDlg); DestroyWindow(hwndDlg); netwin = 0; FCEUD_NetworkClose(); break; case WM_COMMAND: if (HIWORD(wParam) == BN_CLICKED) { switch (LOWORD(wParam)) { case 250: if (FCEUDnetplay) { FCEUD_NetworkClose(); SetDlgItemText(hwndDlg, 250, "Connect"); FixCDis(hwndDlg, 1); } else if (GI) { GetSettings(hwndDlg); if (FCEUD_NetworkConnect()) { SetDlgItemText(hwndDlg, 250, "Disconnect"); FixCDis(hwndDlg, 0); } } break; } } else if (HIWORD(wParam) == EN_CHANGE && Socket != INVALID_SOCKET) { char buf[1024]; int t; t = GetDlgItemText(hwndDlg, 102, buf, 1024); buf[1023] = 0; if (strchr(buf, '\r')) { char *src, *dest; src = dest = buf; while (*src) { if (*src != '\n' && *src != '\r') { *dest = *src; dest++; } src++; } *dest = 0; FCEUI_NetplayText(buf); SetDlgItemText(hwndDlg, 102, ""); } } break; case WM_INITDIALOG: if (netplayhost) SetDlgItemText(hwndDlg, 200, netplayhost); SetDlgItemInt(hwndDlg, 201, remotetport, 0); if (netplaynick) SetDlgItemText(hwndDlg, 203, netplaynick); if (netgamekey) SetDlgItemText(hwndDlg, 205, netgamekey); if (netpassword) SetDlgItemText(hwndDlg, 206, netpassword); { int x; char buf[8]; for (x = 0; x < 4; x++) { sprintf(buf, "%d", x + 1); SendDlgItemMessage(hwndDlg, 204, CB_ADDSTRING, 0, (LPARAM)(LPSTR)buf); } SendDlgItemMessage(hwndDlg, 204, CB_SETCURSEL, netlocalplayers - 1, (LPARAM)(LPSTR)0); } break; } return 0; }