Cleaned up some code.

This commit is contained in:
rheiny 2007-02-09 19:02:13 +00:00
parent 5befd8b8be
commit c4d9cfe679
8 changed files with 441 additions and 227 deletions

View File

@ -1003,187 +1003,281 @@ static void DoTBConfig(HWND hParent, const char *text, char *_template, ButtConf
DialogBox(fceu_hInstance,_template,hParent,DoTBCallB); DialogBox(fceu_hInstance,_template,hParent,DoTBCallB);
} }
static BOOL CALLBACK InputConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) /**
* Callback function of the input configuration dialog.
**/
BOOL CALLBACK InputConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
static const char *strn[6]={"<none>","Gamepad","Zapper","Power Pad A","Power Pad B","Arkanoid Paddle"}; const char * const nes_description[6] = {
static const char *strf[14]= "<none>",
{"<none>","Arkanoid Paddle","Hyper Shot gun","4-Player Adapter", "Gamepad",
"Family Keyboard","Subor Keyboard","HyperShot Pads", "Mahjong", "Quiz King Buzzers", "Zapper",
"Family Trainer A","Family Trainer B", "Oeka Kids Tablet", "Barcode World", "Power Pad A",
"Top Rider"}; "Power Pad B",
static const int haven[6]={0,1,0,1,1,0}; "Arkanoid Paddle"
static const int havef[14]={0,0,0,0, 1,1,0,0, 1,1,1,0, 0,0}; };
int x;
switch(uMsg) {
case WM_INITDIALOG:
SetDlgItemText(hwndDlg,65488,"Select the device you want to be enabled on input ports 1 and 2, and the Famicom expansion port. You may configure the device listed above each drop-down list by pressing \"Configure\", if applicable. The device currently being emulated on the each port is listed above the drop down list; loading certain games will override your settings, but only temporarily. If you select a device to be on the emulated Famicom Expansion Port, you should probably have emulated gamepads on the emulated NES-style input ports.");
for(x=0;x<2;x++)
{
int y;
for(y=0;y<6;y++) const unsigned int NUMBER_OF_PORTS = 2;
SendDlgItemMessage(hwndDlg,104+x,CB_ADDSTRING,0,(LPARAM)(LPSTR)strn[y]); const unsigned int NUMBER_OF_NES_DEVICES = sizeof(nes_description) / sizeof(*nes_description);
SendDlgItemMessage(hwndDlg,104+x,CB_SETCURSEL,UsrInputType[x],(LPARAM)(LPSTR)0); const char * const famicom_description[14] =
EnableWindow(GetDlgItem(hwndDlg,106+x),haven[InputType[x]]); {
SetDlgItemText(hwndDlg,200+x,(LPTSTR)strn[InputType[x]]); "<none>",
} "Arkanoid Paddle",
"Hyper Shot gun",
"4-Player Adapter",
"Family Keyboard",
"Subor Keyboard",
"HyperShot Pads",
"Mahjong",
"Quiz King Buzzers",
"Family Trainer A",
"Family Trainer B",
"Oeka Kids Tablet",
"Barcode World",
"Top Rider"};
const static unsigned int NUMBER_OF_FAMICOM_DEVICES = sizeof(famicom_description) / sizeof(*famicom_description);
{ static const int haven[6]= { 0, 1, 0, 1, 1, 0 };
int y;
for(y=0;y<13;y++) static const int havef[14]= { 0,0,0,0, 1,1,0,0, 1,1,1,0, 0,0 };
SendDlgItemMessage(hwndDlg,110,CB_ADDSTRING,0,(LPARAM)(LPSTR)strf[y]);
SendDlgItemMessage(hwndDlg,110,CB_SETCURSEL,UsrInputType[2],(LPARAM)(LPSTR)0); int port;
EnableWindow(GetDlgItem(hwndDlg,111),havef[InputType[2]]);
SetDlgItemText(hwndDlg,202,(LPTSTR)strf[InputType[2]]); switch(uMsg)
} {
case WM_INITDIALOG:
extern int autoHoldKey, autoHoldClearKey;
char btext[128]; SetDlgItemText(hwndDlg, LBL_INPUT_HELP, "Select the device you want to be enabled on input ports 1 and 2, and the Famicom expansion port. You may configure the device listed above each drop-down list by pressing \"Configure\", if applicable. The device currently being emulated on the each port is listed above the drop down list; loading certain games will override your settings, but only temporarily. If you select a device to be on the emulated Famicom Expansion Port, you should probably have emulated gamepads on the emulated NES-style input ports.");
if(autoHoldKey)
int current_device;
for(port = 0; port < NUMBER_OF_PORTS; port++)
{ {
if(!GetKeyNameText(autoHoldKey<<16,btext,128)) for(current_device = 0; current_device < NUMBER_OF_NES_DEVICES; current_device++)
sprintf(btext, "KB: %d", autoHoldKey); {
} SendDlgItemMessage(hwndDlg, COMBO_PAD1 + port, CB_ADDSTRING, 0, (LPARAM)(LPSTR)nes_description[current_device]);
else }
sprintf(btext, "not assigned");
SetDlgItemText(hwndDlg, 115, btext);
if(autoHoldClearKey) SendDlgItemMessage(hwndDlg, COMBO_PAD1 + port, CB_SETCURSEL, UsrInputType[port],(LPARAM)(LPSTR)0);
EnableWindow(GetDlgItem(hwndDlg,BTN_PORT1 + port) ,haven[InputType[port]]);
SetDlgItemText(hwndDlg, TXT_PAD1 + port, (LPTSTR)nes_description[InputType[port]]);
}
for(current_device = 0; current_device < NUMBER_OF_FAMICOM_DEVICES; current_device++)
{ {
if(!GetKeyNameText(autoHoldClearKey<<16,btext,128)) SendDlgItemMessage(hwndDlg, COMBO_FAM, CB_ADDSTRING, 0, (LPARAM)(LPSTR)famicom_description[current_device]);
sprintf(btext, "KB: %d", autoHoldClearKey);
} }
else
sprintf(btext, "not assigned");
SetDlgItemText(hwndDlg, 116, btext);
break; SendDlgItemMessage(hwndDlg, COMBO_FAM, CB_SETCURSEL, UsrInputType[2], (LPARAM)(LPSTR)0);
case WM_CLOSE: EnableWindow(GetDlgItem(hwndDlg, BTN_FAM), havef[InputType[2]]);
case WM_QUIT: goto gornk; SetDlgItemText(hwndDlg, TXT_FAM, (LPTSTR)famicom_description[InputType[2]]);
case WM_COMMAND:
if(HIWORD(wParam)==CBN_SELENDOK)
{
switch(LOWORD(wParam))
{
case 104:
case 105:UsrInputType[LOWORD(wParam)-104]=InputType[LOWORD(wParam)-104]=SendDlgItemMessage(hwndDlg,LOWORD(wParam),CB_GETCURSEL,0,(LPARAM)(LPSTR)0);
EnableWindow( GetDlgItem(hwndDlg,LOWORD(wParam)+2),haven[InputType[LOWORD(wParam)-104]]);
SetDlgItemText(hwndDlg,200+LOWORD(wParam)-104,(LPTSTR)strn[InputType[LOWORD(wParam)-104]]);
break;
case 110:UsrInputType[2]=InputType[2]=SendDlgItemMessage(hwndDlg,110,CB_GETCURSEL,0,(LPARAM)(LPSTR)0);
EnableWindow(GetDlgItem(hwndDlg,111),havef[InputType[2]]);
SetDlgItemText(hwndDlg,202,(LPTSTR)strf[InputType[2]]);
break;
}
} extern int autoHoldKey, autoHoldClearKey;
if(!(wParam>>16)) char btext[128];
switch(wParam&0xFFFF)
{
case 111:
{
const char *text = strf[InputType[2]];
DoTBType=DoTBPort=0;
switch(InputType[2]) if(autoHoldKey)
{ {
case SIFC_FTRAINERA: if(!GetKeyNameText(autoHoldKey << 16, btext, 128))
case SIFC_FTRAINERB:DoTBConfig(hwndDlg, text, "POWERPADDIALOG", FTrainerButtons, 12); break; {
case SIFC_FKB:DoTBConfig(hwndDlg, text, "FKBDIALOG",fkbmap,0x48);break; sprintf(btext, "KB: %d", autoHoldKey);
case SIFC_SUBORKB:DoTBConfig(hwndDlg, text, "SUBORKBDIALOG",suborkbmap,0x60);break; }
case SIFC_QUIZKING:DoTBConfig(hwndDlg, text, "QUIZKINGDIALOG",QuizKingButtons,6);break; }
} else
} {
break; sprintf(btext, "not assigned");
}
case 107: SetDlgItemText(hwndDlg, LBL_AUTO_HOLD, btext);
case 106:
{
int which=(wParam&0xFFFF)-106;
const char *text = strn[InputType[which]];
DoTBType=DoTBPort=0; if(autoHoldClearKey)
switch(InputType[which]) {
{ if(!GetKeyNameText(autoHoldClearKey << 16, btext, 128))
case SI_GAMEPAD: {
{ sprintf(btext, "KB: %d", autoHoldClearKey);
ButtConfig tmp[10 + 10]; }
}
else
{
sprintf(btext, "not assigned");
}
memcpy(tmp, GamePadConfig[which], 10 * sizeof(ButtConfig)); SetDlgItemText(hwndDlg, LBL_CLEAR_AH, btext);
memcpy(&tmp[10], GamePadConfig[which+2], 10 * sizeof(ButtConfig));
DoTBType=SI_GAMEPAD; break;
DoTBPort=which;
DoTBConfig(hwndDlg, text, "GAMEPADDIALOG", tmp, 10 + 10);
memcpy(GamePadConfig[which], tmp, 10 * sizeof(ButtConfig)); case WM_CLOSE:
memcpy(GamePadConfig[which+2], &tmp[10], 10 * sizeof(ButtConfig)); case WM_QUIT:
} EndDialog(hwndDlg, 0);
break;
case SI_POWERPADA: case WM_COMMAND:
case SI_POWERPADB:
DoTBConfig(hwndDlg, text, "POWERPADDIALOG",powerpadsc[which],12); if(HIWORD(wParam)==CBN_SELENDOK)
break; {
} switch(LOWORD(wParam))
} {
break; case COMBO_PAD1:
case COMBO_PAD2:
{
unsigned int sel_input = LOWORD(wParam) - COMBO_PAD1;
UsrInputType[sel_input] = InputType[sel_input] = SendDlgItemMessage(hwndDlg, LOWORD(wParam), CB_GETCURSEL, 0, (LPARAM)(LPSTR)0);
EnableWindow( GetDlgItem(hwndDlg, LOWORD(wParam) + 2), haven[InputType[sel_input]]);
SetDlgItemText(hwndDlg, TXT_PAD1 + sel_input, (LPTSTR)nes_description[InputType[sel_input]]);
}
break;
case COMBO_FAM:
UsrInputType[2] =
InputType[2] =
SendDlgItemMessage(hwndDlg, COMBO_FAM, CB_GETCURSEL, 0, (LPARAM)(LPSTR)0);
EnableWindow(GetDlgItem(hwndDlg, BTN_FAM), havef[InputType[2]]);
SetDlgItemText(hwndDlg, TXT_FAM, (LPTSTR)famicom_description[InputType[2]]);
break;
}
}
if( !(wParam >> 16) )
{
switch(wParam & 0xFFFF)
{
case BTN_FAM:
{
const char *text = famicom_description[InputType[2]];
DoTBType = DoTBPort = 0;
switch(InputType[2])
{
case SIFC_FTRAINERA:
case SIFC_FTRAINERB:
DoTBConfig(hwndDlg, text, "POWERPADDIALOG", FTrainerButtons, 12);
break;
case SIFC_FKB:
DoTBConfig(hwndDlg, text, "FKBDIALOG", fkbmap, 0x48);
break;
case SIFC_SUBORKB:
DoTBConfig(hwndDlg, text, "SUBORKBDIALOG", suborkbmap, 0x60);
break;
case SIFC_QUIZKING:
DoTBConfig(hwndDlg, text, "QUIZKINGDIALOG", QuizKingButtons, 6);
break;
}
}
break;
case BTN_PORT2:
case BTN_PORT1:
{
int which = (wParam & 0xFFFF) - BTN_PORT1;
const char *text = nes_description[InputType[which]];
DoTBType = DoTBPort = 0;
switch(InputType[which])
{
case SI_GAMEPAD:
{
ButtConfig tmp[10 + 10];
memcpy(tmp, GamePadConfig[which], 10 * sizeof(ButtConfig));
memcpy(&tmp[10], GamePadConfig[which + 2], 10 * sizeof(ButtConfig));
DoTBType = SI_GAMEPAD;
DoTBPort = which;
DoTBConfig(hwndDlg, text, "GAMEPADDIALOG", tmp, 10 + 10);
memcpy(GamePadConfig[which], tmp, 10 * sizeof(ButtConfig));
memcpy(GamePadConfig[which + 2], &tmp[10], 10 * sizeof(ButtConfig));
}
break;
case SI_POWERPADA:
case SI_POWERPADB:
DoTBConfig(hwndDlg, text, "POWERPADDIALOG", powerpadsc[which], 12);
break;
}
}
break;
case BTN_AUTO_HOLD: // auto-hold button
{
char btext[128] = { 0 };
GetDlgItemText(hwndDlg, BTN_AUTO_HOLD, btext, sizeof(btext) );
case 112: // auto-hold button
{
char btext[128];
btext[0]=0;
GetDlgItemText(hwndDlg, 112, btext, 128);
int button = DWaitSimpleButton(hwndDlg, (uint8*)btext); //mbg merge 7/17/06 int button = DWaitSimpleButton(hwndDlg, (uint8*)btext); //mbg merge 7/17/06
if(button) if(button)
{ {
if(!GetKeyNameText(button<<16,btext,128)) if(!GetKeyNameText(button << 16, btext, 128))
{
sprintf(btext, "KB: %d", button); sprintf(btext, "KB: %d", button);
}
} }
else else
{
sprintf(btext, "not assigned"); sprintf(btext, "not assigned");
}
extern int autoHoldKey; extern int autoHoldKey;
autoHoldKey = button; autoHoldKey = button;
SetDlgItemText(hwndDlg, 115, btext); SetDlgItemText(hwndDlg, LBL_AUTO_HOLD, btext);
} }
break; break;
case 114: // auto-hold clear button case BTN_CLEAR_AH: // auto-hold clear button
{ {
char btext[128]; char btext[128] = { 0 };
btext[0]=0;
GetDlgItemText(hwndDlg, 114, btext, 128); GetDlgItemText(hwndDlg, BTN_CLEAR_AH, btext, 128);
int button = DWaitSimpleButton(hwndDlg, (uint8*)btext); //mbg merge 7/17/06 added cast int button = DWaitSimpleButton(hwndDlg, (uint8*)btext); //mbg merge 7/17/06 added cast
if(button) if(button)
{ {
if(!GetKeyNameText(button<<16,btext,128)) if( !GetKeyNameText(button << 16, btext, sizeof(btext)))
{
sprintf(btext, "KB: %d", button); sprintf(btext, "KB: %d", button);
}
} }
else else
{
sprintf(btext, "not assigned"); sprintf(btext, "not assigned");
}
extern int autoHoldClearKey; extern int autoHoldClearKey;
autoHoldClearKey = button; autoHoldClearKey = button;
SetDlgItemText(hwndDlg, 116, btext);
}
break;
case 1: SetDlgItemText(hwndDlg, LBL_CLEAR_AH, btext);
gornk: }
EndDialog(hwndDlg,0); break;
break;
} case BTN_CLOSE:
} EndDialog(hwndDlg, 0);
return 0; break;
}
}
}
return 0;
} }
/**
* Shows the input configuration dialog.
*
* @param hParent Handle of the parent window.
**/
void ConfigInput(HWND hParent) void ConfigInput(HWND hParent)
{ {
DialogBox(fceu_hInstance,"INPUTCONFIG",hParent,InputConCallB); DialogBox(fceu_hInstance, "INPUTCONFIG", hParent, InputConCallB);
if(GameInfo)
InitOtherInput(); if(GameInfo)
{
InitOtherInput();
}
} }
@ -1816,16 +1910,21 @@ static BOOL CALLBACK MapInputDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
return FALSE; return FALSE;
} }
/**
* Show input mapping configuration dialog.
**/
void MapInput(void) void MapInput(void)
{ {
// Make a backup of the current mappings, in case the user changes their mind. // Make a backup of the current mappings, in case the user changes their mind.
int* backupmapping = (int*)malloc(sizeof(FCEUD_CommandMapping)); int* backupmapping = (int*)malloc(sizeof(FCEUD_CommandMapping));
memcpy(backupmapping, FCEUD_CommandMapping, sizeof(FCEUD_CommandMapping)); memcpy(backupmapping, FCEUD_CommandMapping, sizeof(FCEUD_CommandMapping));
if(!DialogBox(fceu_hInstance,"MAPINPUT",hAppWnd,MapInputDialogProc)) if(!DialogBox(fceu_hInstance, "MAPINPUT", hAppWnd, MapInputDialogProc))
memcpy(FCEUD_CommandMapping, backupmapping, sizeof(FCEUD_CommandMapping)); {
memcpy(FCEUD_CommandMapping, backupmapping, sizeof(FCEUD_CommandMapping));
}
free(backupmapping); free(backupmapping);
} }
void FCEUD_TurboOn(void) void FCEUD_TurboOn(void)

View File

@ -306,7 +306,7 @@ char *FCEUD_GetCompilerString() {
**/ **/
void ShowAboutBox(void) void ShowAboutBox(void)
{ {
MessageBox(hAppWnd,FCEUI_GetAboutString(),FCEU_NAME,MB_OK); MessageBox(hAppWnd, FCEUI_GetAboutString(), FCEU_NAME, MB_OK);
} }
//mbg 6/30/06 - indicates that the main loop should close the game as soon as it can //mbg 6/30/06 - indicates that the main loop should close the game as soon as it can

View File

@ -486,9 +486,13 @@ static BOOL CALLBACK NetCon(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
return 0; return 0;
} }
/**
* Shows Netplay dialog.
**/
void ShowNetplayConsole(void) void ShowNetplayConsole(void)
{ {
if(!netwin) if(!netwin)
netwin=CreateDialog(fceu_hInstance,"NETMOO",0,NetCon); {
netwin = CreateDialog(fceu_hInstance, "NETMOO", 0, NetCon);
}
} }

Binary file not shown.

View File

@ -5,6 +5,7 @@
#define GUI_BOT_CLOSE 1 #define GUI_BOT_CLOSE 1
#define CLOSE_BUTTON 1 #define CLOSE_BUTTON 1
#define BUTTON_CLOSE 1 #define BUTTON_CLOSE 1
#define BTN_CLOSE 1
#define GUI_BOT_VALUES 2 #define GUI_BOT_VALUES 2
#define MENU_OPEN_FILE 100 #define MENU_OPEN_FILE 100
#define EDIT_CHEATS 100 #define EDIT_CHEATS 100
@ -14,10 +15,20 @@
#define MENU_RECENT_FILES 102 #define MENU_RECENT_FILES 102
#define CB_LOAD_FILE_OPEN 102 #define CB_LOAD_FILE_OPEN 102
#define CB_AUTO_HIDE_MENU 104 #define CB_AUTO_HIDE_MENU 104
#define COMBO_PAD1 104
#define COMBO_PAD2 105
#define BTN_PORT1 106
#define BTN_PORT2 107
#define MENU_SAVE_STATE 110 #define MENU_SAVE_STATE 110
#define CB_ASK_EXIT 110 #define CB_ASK_EXIT 110
#define COMBO_FAM 110
#define MENU_LOAD_STATE 111 #define MENU_LOAD_STATE 111
#define CB_DISABLE_SCREEN_SAVER 111 #define CB_DISABLE_SCREEN_SAVER 111
#define BTN_FAM 111
#define BTN_AUTO_HOLD 112
#define BTN_CLEAR_AH 114
#define LBL_AUTO_HOLD 115
#define LBL_CLEAR_AH 116
#define MENU_RECORD_MOVIE 141 #define MENU_RECORD_MOVIE 141
#define MENU_REPLAY_MOVIE 142 #define MENU_REPLAY_MOVIE 142
#define MENU_STOP_MOVIE 143 #define MENU_STOP_MOVIE 143
@ -26,8 +37,11 @@
#define MENU_EXIT 153 #define MENU_EXIT 153
#define MENU_RESET 200 #define MENU_RESET 200
#define BUTTON_CHEATS 200 #define BUTTON_CHEATS 200
#define TXT_PAD1 200
#define MENU_POWER 201 #define MENU_POWER 201
#define TXT_PAD2 201
#define MENU_EJECT_DISK 202 #define MENU_EJECT_DISK 202
#define TXT_FAM 202
#define MENU_SWITCH_DISK 203 #define MENU_SWITCH_DISK 203
#define MENU_INSERT_COIN 204 #define MENU_INSERT_COIN 204
#define MENU_HIDE_MENU 300 #define MENU_HIDE_MENU 300
@ -39,6 +53,7 @@
#define MENU_GAME_GENIE 310 #define MENU_GAME_GENIE 310
#define MENU_PAL 311 #define MENU_PAL 311
#define MENU_DIRECTORIES 320 #define MENU_DIRECTORIES 320
#define MENU_INPUT 321
#define MENU_GUI_OPTIONS 327 #define MENU_GUI_OPTIONS 327
#define GUI_BOT_A_1 1000 #define GUI_BOT_A_1 1000
#define GUI_BOT_B_1 1001 #define GUI_BOT_B_1 1001
@ -160,6 +175,14 @@
#define GUI_BOT_TITLEL5 1112 #define GUI_BOT_TITLEL5 1112
#define GUI_BOT_TITLEL6 1113 #define GUI_BOT_TITLEL6 1113
#define GUI_BOT_COUNTERS 1114 #define GUI_BOT_COUNTERS 1114
#define MENU_NETWORK 40040
#define MENU_PALETTE 40041
#define MENU_SOUND 40042
#define MENU_TIMING 40043
#define MENU_VIDEO 40044
#define MENU_HOTKEYS 40045
#define MENU_ABOUT 40046
#define MENU_MSGLOG 40047
#define ID_DEBUG_DEBUGGER 40053 #define ID_DEBUG_DEBUGGER 40053
#define ID_DEBUG_PPUVIEWER 40054 #define ID_DEBUG_PPUVIEWER 40054
#define ID_DEBUG_NAMETABLEVIEWER 40055 #define ID_DEBUG_NAMETABLEVIEWER 40055
@ -170,13 +193,14 @@
#define MENU_LOG_SOUND 40120 #define MENU_LOG_SOUND 40120
#define GUI_BOT_DEBUG 65436 #define GUI_BOT_DEBUG 65436
#define GUI_BOT_ERROR 65438 #define GUI_BOT_ERROR 65438
#define LBL_INPUT_HELP 65488
// Next default values for new objects // Next default values for new objects
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 103 #define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_COMMAND_VALUE 40039 #define _APS_NEXT_COMMAND_VALUE 40048
#define _APS_NEXT_CONTROL_VALUE 1117 #define _APS_NEXT_CONTROL_VALUE 1117
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif

View File

@ -499,13 +499,19 @@ BOOL CALLBACK SoundConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
return 0; return 0;
} }
/**
* Shows the sounds configuration dialog.
**/
void ConfigSound(void) void ConfigSound(void)
{ {
if(!uug) if(!uug)
uug=CreateDialog(fceu_hInstance,"SOUNDCONFIG",0,SoundConCallB); {
else uug = CreateDialog(fceu_hInstance, "SOUNDCONFIG", 0, SoundConCallB);
SetFocus(uug); }
else
{
SetFocus(uug);
}
} }
void FCEUD_SoundToggle(void) void FCEUD_SoundToggle(void)

View File

@ -1115,18 +1115,24 @@ void DoVideoConfigFix(void)
UpdateRendBounds(); UpdateRendBounds();
} }
/**
* Shows the Video configuration dialog.
**/
void ConfigVideo(void) void ConfigVideo(void)
{ {
DialogBox(fceu_hInstance,"VIDEOCONFIG",hAppWnd,VideoConCallB); DialogBox(fceu_hInstance, "VIDEOCONFIG", hAppWnd, VideoConCallB);
DoVideoConfigFix(); DoVideoConfigFix();
if(fullscreen)
SetFSVideoMode(); if(fullscreen)
else {
{ SetFSVideoMode();
changerecursive=1; }
SetVideoMode(0); else
changerecursive=0; {
} changerecursive = 1;
//SetMainWindowStuff(); SetVideoMode(0);
changerecursive = 0;
}
//SetMainWindowStuff();
} }

View File

@ -856,13 +856,40 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
ConfigGUI(); ConfigGUI();
break; break;
case 321:ConfigInput(hWnd);break; case MENU_INPUT:
case 322:ConfigTiming();break; // Input menu was selected
case 323:ShowNetplayConsole();break; ConfigInput(hWnd);
case 324:ConfigPalette();break; break;
case 325:ConfigSound();break;
case 326:ConfigVideo();break; case MENU_TIMING:
case 328:MapInput();break; // Timing menu was selected
ConfigTiming();
break;
case MENU_NETWORK:
// Network Play menu was selected
ShowNetplayConsole();
break;
case MENU_PALETTE:
// Palette menu was selected
ConfigPalette();
break;
case MENU_SOUND:
// Sound menu was selected
ConfigSound();
break;
case MENU_VIDEO:
// Video menu was selected
ConfigVideo();
break;
case MENU_HOTKEYS:
// Hotkeys menu was selected
MapInput();
break;
case MENU_RESET: case MENU_RESET:
// The reset menu was selected // The reset menu was selected
@ -972,8 +999,15 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
FCEUD_AviStop(); FCEUD_AviStop();
break; break;
case 400:ShowAboutBox();break; case MENU_ABOUT:
case 401:MakeLogWindow();break; // About menu was selected
ShowAboutBox();
break;
case MENU_MSGLOG:
// Message Log menu was selected
MakeLogWindow();
break;
} }
} }
break; break;
@ -1329,61 +1363,99 @@ int LoadPaletteFile(void)
return(0); return(0);
} }
static HWND pwindow; static HWND pwindow;
static BOOL CALLBACK PaletteConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
/**
* Callback function for the palette configuration dialog.
**/
BOOL CALLBACK PaletteConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
DSMFix(uMsg); DSMFix(uMsg);
switch(uMsg) {
case WM_INITDIALOG: switch(uMsg)
if(ntsccol) {
CheckDlgButton(hwndDlg,100,BST_CHECKED); case WM_INITDIALOG:
SendDlgItemMessage(hwndDlg,500,TBM_SETRANGE,1,MAKELONG(0,128));
SendDlgItemMessage(hwndDlg,501,TBM_SETRANGE,1,MAKELONG(0,128)); if(ntsccol)
FCEUI_GetNTSCTH(&ntsctint,&ntschue); {
SendDlgItemMessage(hwndDlg,500,TBM_SETPOS,1,ntsctint); CheckDlgButton(hwndDlg, 100, BST_CHECKED);
SendDlgItemMessage(hwndDlg,501,TBM_SETPOS,1,ntschue); }
EnableWindow(GetDlgItem(hwndDlg,201),(eoptions&EO_CPALETTE)?1:0);
break; SendDlgItemMessage(hwndDlg, 500, TBM_SETRANGE, 1, MAKELONG(0, 128));
case WM_HSCROLL: SendDlgItemMessage(hwndDlg, 501, TBM_SETRANGE, 1, MAKELONG(0, 128));
ntsctint=SendDlgItemMessage(hwndDlg,500,TBM_GETPOS,0,(LPARAM)(LPSTR)0);
ntschue=SendDlgItemMessage(hwndDlg,501,TBM_GETPOS,0,(LPARAM)(LPSTR)0); FCEUI_GetNTSCTH(&ntsctint, &ntschue);
FCEUI_SetNTSCTH(ntsccol,ntsctint,ntschue);
break; SendDlgItemMessage(hwndDlg, 500, TBM_SETPOS, 1, ntsctint);
case WM_CLOSE: SendDlgItemMessage(hwndDlg, 501, TBM_SETPOS, 1, ntschue);
case WM_QUIT: goto gornk;
case WM_COMMAND: EnableWindow(GetDlgItem(hwndDlg, 201), (eoptions & EO_CPALETTE) ? 1 : 0);
if(!(wParam>>16))
switch(wParam&0xFFFF) break;
{
case 100:ntsccol^=1;FCEUI_SetNTSCTH(ntsccol,ntsctint,ntschue);break; case WM_HSCROLL:
case 200: ntsctint = SendDlgItemMessage(hwndDlg, 500, TBM_GETPOS, 0, (LPARAM)(LPSTR)0);
ntschue = SendDlgItemMessage(hwndDlg, 501, TBM_GETPOS, 0, (LPARAM)(LPSTR)0);
if(LoadPaletteFile()) FCEUI_SetNTSCTH(ntsccol, ntsctint, ntschue);
EnableWindow(GetDlgItem(hwndDlg,201),1); break;
break;
case 201:FCEUI_SetPaletteArray(0); case WM_CLOSE:
eoptions&=~EO_CPALETTE; case WM_QUIT:
EnableWindow(GetDlgItem(hwndDlg,201),0); goto gornk;
break;
case 1: case WM_COMMAND:
gornk: if(!(wParam>>16))
DestroyWindow(hwndDlg); {
pwindow=0; // Yay for user race conditions. switch(wParam&0xFFFF)
break; {
} case 100:
} ntsccol ^= 1;
return 0; FCEUI_SetNTSCTH(ntsccol, ntsctint, ntschue);
break;
case 200:
if(LoadPaletteFile())
{
EnableWindow(GetDlgItem(hwndDlg, 201), 1);
}
break;
case 201:
FCEUI_SetPaletteArray(0);
eoptions &= ~EO_CPALETTE;
EnableWindow(GetDlgItem(hwndDlg, 201), 0);
break;
case 1:
gornk:
DestroyWindow(hwndDlg);
pwindow = 0; // Yay for user race conditions.
break;
}
}
}
return 0;
} }
static void ConfigPalette(void) /**
* Shows palette configuration dialog.
**/
void ConfigPalette(void)
{ {
if(!pwindow) if(!pwindow)
pwindow=CreateDialog(fceu_hInstance,"PALCONFIG",0,PaletteConCallB); {
else pwindow=CreateDialog(fceu_hInstance, "PALCONFIG" ,0 , PaletteConCallB);
SetFocus(pwindow); }
else
{
SetFocus(pwindow);
}
} }
/**
static BOOL CALLBACK TimingConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) * Callback function of the Timing configuration dialog.
**/
BOOL CALLBACK TimingConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
int x; int x;
@ -1435,10 +1507,13 @@ void DoTimingConfigFix(void)
DoPriority(); DoPriority();
} }
static void ConfigTiming(void) /**
* Shows the Timing configuration dialog.
**/
void ConfigTiming(void)
{ {
DialogBox(fceu_hInstance,"TIMINGCONFIG",hAppWnd,TimingConCallB); DialogBox(fceu_hInstance, "TIMINGCONFIG", hAppWnd, TimingConCallB);
DoTimingConfigFix(); DoTimingConfigFix();
} }
/** /**