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,110 +1003,180 @@ 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",
"Power Pad B",
"Arkanoid Paddle"
};
const unsigned int NUMBER_OF_PORTS = 2;
const unsigned int NUMBER_OF_NES_DEVICES = sizeof(nes_description) / sizeof(*nes_description);
const char * const famicom_description[14] =
{
"<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"}; "Top Rider"};
static const int haven[6]={0,1,0,1,1,0};
static const int havef[14]={0,0,0,0, 1,1,0,0, 1,1,1,0, 0,0};
int x;
switch(uMsg) { 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 };
static const int havef[14]= { 0,0,0,0, 1,1,0,0, 1,1,1,0, 0,0 };
int port;
switch(uMsg)
{
case WM_INITDIALOG: 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++) 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.");
int current_device;
for(port = 0; port < NUMBER_OF_PORTS; port++)
{ {
int y; for(current_device = 0; current_device < NUMBER_OF_NES_DEVICES; current_device++)
{
for(y=0;y<6;y++) SendDlgItemMessage(hwndDlg, COMBO_PAD1 + port, CB_ADDSTRING, 0, (LPARAM)(LPSTR)nes_description[current_device]);
SendDlgItemMessage(hwndDlg,104+x,CB_ADDSTRING,0,(LPARAM)(LPSTR)strn[y]);
SendDlgItemMessage(hwndDlg,104+x,CB_SETCURSEL,UsrInputType[x],(LPARAM)(LPSTR)0);
EnableWindow(GetDlgItem(hwndDlg,106+x),haven[InputType[x]]);
SetDlgItemText(hwndDlg,200+x,(LPTSTR)strn[InputType[x]]);
} }
SendDlgItemMessage(hwndDlg, COMBO_PAD1 + port, CB_SETCURSEL, UsrInputType[port],(LPARAM)(LPSTR)0);
{ EnableWindow(GetDlgItem(hwndDlg,BTN_PORT1 + port) ,haven[InputType[port]]);
int y; SetDlgItemText(hwndDlg, TXT_PAD1 + port, (LPTSTR)nes_description[InputType[port]]);
for(y=0;y<13;y++)
SendDlgItemMessage(hwndDlg,110,CB_ADDSTRING,0,(LPARAM)(LPSTR)strf[y]);
SendDlgItemMessage(hwndDlg,110,CB_SETCURSEL,UsrInputType[2],(LPARAM)(LPSTR)0);
EnableWindow(GetDlgItem(hwndDlg,111),havef[InputType[2]]);
SetDlgItemText(hwndDlg,202,(LPTSTR)strf[InputType[2]]);
} }
for(current_device = 0; current_device < NUMBER_OF_FAMICOM_DEVICES; current_device++)
{
SendDlgItemMessage(hwndDlg, COMBO_FAM, CB_ADDSTRING, 0, (LPARAM)(LPSTR)famicom_description[current_device]);
}
SendDlgItemMessage(hwndDlg, COMBO_FAM, CB_SETCURSEL, UsrInputType[2], (LPARAM)(LPSTR)0);
EnableWindow(GetDlgItem(hwndDlg, BTN_FAM), havef[InputType[2]]);
SetDlgItemText(hwndDlg, TXT_FAM, (LPTSTR)famicom_description[InputType[2]]);
extern int autoHoldKey, autoHoldClearKey; extern int autoHoldKey, autoHoldClearKey;
char btext[128]; char btext[128];
if(autoHoldKey) if(autoHoldKey)
{ {
if(!GetKeyNameText(autoHoldKey<<16,btext,128)) if(!GetKeyNameText(autoHoldKey << 16, btext, 128))
{
sprintf(btext, "KB: %d", autoHoldKey); sprintf(btext, "KB: %d", autoHoldKey);
} }
}
else else
{
sprintf(btext, "not assigned"); sprintf(btext, "not assigned");
SetDlgItemText(hwndDlg, 115, btext); }
SetDlgItemText(hwndDlg, LBL_AUTO_HOLD, btext);
if(autoHoldClearKey) if(autoHoldClearKey)
{ {
if(!GetKeyNameText(autoHoldClearKey<<16,btext,128)) if(!GetKeyNameText(autoHoldClearKey << 16, btext, 128))
{
sprintf(btext, "KB: %d", autoHoldClearKey); sprintf(btext, "KB: %d", autoHoldClearKey);
} }
}
else else
{
sprintf(btext, "not assigned"); sprintf(btext, "not assigned");
SetDlgItemText(hwndDlg, 116, btext); }
SetDlgItemText(hwndDlg, LBL_CLEAR_AH, btext);
break; break;
case WM_CLOSE: case WM_CLOSE:
case WM_QUIT: goto gornk; case WM_QUIT:
EndDialog(hwndDlg, 0);
case WM_COMMAND: case WM_COMMAND:
if(HIWORD(wParam)==CBN_SELENDOK) if(HIWORD(wParam)==CBN_SELENDOK)
{ {
switch(LOWORD(wParam)) switch(LOWORD(wParam))
{ {
case 104: case COMBO_PAD1:
case 105:UsrInputType[LOWORD(wParam)-104]=InputType[LOWORD(wParam)-104]=SendDlgItemMessage(hwndDlg,LOWORD(wParam),CB_GETCURSEL,0,(LPARAM)(LPSTR)0); case COMBO_PAD2:
EnableWindow( GetDlgItem(hwndDlg,LOWORD(wParam)+2),haven[InputType[LOWORD(wParam)-104]]); {
SetDlgItemText(hwndDlg,200+LOWORD(wParam)-104,(LPTSTR)strn[InputType[LOWORD(wParam)-104]]); 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; break;
case 110:UsrInputType[2]=InputType[2]=SendDlgItemMessage(hwndDlg,110,CB_GETCURSEL,0,(LPARAM)(LPSTR)0);
EnableWindow(GetDlgItem(hwndDlg,111),havef[InputType[2]]); case COMBO_FAM:
SetDlgItemText(hwndDlg,202,(LPTSTR)strf[InputType[2]]); 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; break;
} }
} }
if(!(wParam>>16))
switch(wParam&0xFFFF) if( !(wParam >> 16) )
{ {
case 111: switch(wParam & 0xFFFF)
{ {
const char *text = strf[InputType[2]]; case BTN_FAM:
DoTBType=DoTBPort=0; {
const char *text = famicom_description[InputType[2]];
DoTBType = DoTBPort = 0;
switch(InputType[2]) switch(InputType[2])
{ {
case SIFC_FTRAINERA: case SIFC_FTRAINERA:
case SIFC_FTRAINERB:DoTBConfig(hwndDlg, text, "POWERPADDIALOG", FTrainerButtons, 12); break; case SIFC_FTRAINERB:
case SIFC_FKB:DoTBConfig(hwndDlg, text, "FKBDIALOG",fkbmap,0x48);break; DoTBConfig(hwndDlg, text, "POWERPADDIALOG", FTrainerButtons, 12);
case SIFC_SUBORKB:DoTBConfig(hwndDlg, text, "SUBORKBDIALOG",suborkbmap,0x60);break; break;
case SIFC_QUIZKING:DoTBConfig(hwndDlg, text, "QUIZKINGDIALOG",QuizKingButtons,6);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; break;
case 107: case BTN_PORT2:
case 106: case BTN_PORT1:
{ {
int which=(wParam&0xFFFF)-106; int which = (wParam & 0xFFFF) - BTN_PORT1;
const char *text = strn[InputType[which]]; const char *text = nes_description[InputType[which]];
DoTBType = DoTBPort = 0;
DoTBType=DoTBPort=0;
switch(InputType[which]) switch(InputType[which])
{ {
case SI_GAMEPAD: case SI_GAMEPAD:
@ -1114,76 +1184,100 @@ static BOOL CALLBACK InputConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
ButtConfig tmp[10 + 10]; ButtConfig tmp[10 + 10];
memcpy(tmp, GamePadConfig[which], 10 * sizeof(ButtConfig)); memcpy(tmp, GamePadConfig[which], 10 * sizeof(ButtConfig));
memcpy(&tmp[10], GamePadConfig[which+2], 10 * sizeof(ButtConfig)); memcpy(&tmp[10], GamePadConfig[which + 2], 10 * sizeof(ButtConfig));
DoTBType=SI_GAMEPAD; DoTBType = SI_GAMEPAD;
DoTBPort=which; DoTBPort = which;
DoTBConfig(hwndDlg, text, "GAMEPADDIALOG", tmp, 10 + 10); DoTBConfig(hwndDlg, text, "GAMEPADDIALOG", tmp, 10 + 10);
memcpy(GamePadConfig[which], tmp, 10 * sizeof(ButtConfig)); memcpy(GamePadConfig[which], tmp, 10 * sizeof(ButtConfig));
memcpy(GamePadConfig[which+2], &tmp[10], 10 * sizeof(ButtConfig)); memcpy(GamePadConfig[which + 2], &tmp[10], 10 * sizeof(ButtConfig));
} }
break; break;
case SI_POWERPADA: case SI_POWERPADA:
case SI_POWERPADB: case SI_POWERPADB:
DoTBConfig(hwndDlg, text, "POWERPADDIALOG",powerpadsc[which],12); DoTBConfig(hwndDlg, text, "POWERPADDIALOG", powerpadsc[which], 12);
break; break;
} }
} }
break; break;
case 112: // auto-hold button case BTN_AUTO_HOLD: // auto-hold button
{ {
char btext[128]; char btext[128] = { 0 };
btext[0]=0;
GetDlgItemText(hwndDlg, 112, btext, 128); GetDlgItemText(hwndDlg, BTN_AUTO_HOLD, btext, sizeof(btext) );
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);
SetDlgItemText(hwndDlg, LBL_CLEAR_AH, btext);
} }
break; break;
case 1: case BTN_CLOSE:
gornk: EndDialog(hwndDlg, 0);
EndDialog(hwndDlg,0);
break; break;
} }
} }
}
return 0; 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) if(GameInfo)
{
InitOtherInput(); InitOtherInput();
}
} }
@ -1816,14 +1910,19 @@ 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);
} }

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); {
uug = CreateDialog(fceu_hInstance, "SOUNDCONFIG", 0, SoundConCallB);
}
else else
{
SetFocus(uug); SetFocus(uug);
}
} }
void FCEUD_SoundToggle(void) void FCEUD_SoundToggle(void)

View File

@ -1115,17 +1115,23 @@ 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) if(fullscreen)
{
SetFSVideoMode(); SetFSVideoMode();
}
else else
{ {
changerecursive=1; changerecursive = 1;
SetVideoMode(0); SetVideoMode(0);
changerecursive=0; changerecursive = 0;
} }
//SetMainWindowStuff(); //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) {
switch(uMsg)
{
case WM_INITDIALOG: case WM_INITDIALOG:
if(ntsccol) if(ntsccol)
CheckDlgButton(hwndDlg,100,BST_CHECKED); {
SendDlgItemMessage(hwndDlg,500,TBM_SETRANGE,1,MAKELONG(0,128)); CheckDlgButton(hwndDlg, 100, BST_CHECKED);
SendDlgItemMessage(hwndDlg,501,TBM_SETRANGE,1,MAKELONG(0,128)); }
FCEUI_GetNTSCTH(&ntsctint,&ntschue);
SendDlgItemMessage(hwndDlg,500,TBM_SETPOS,1,ntsctint); SendDlgItemMessage(hwndDlg, 500, TBM_SETRANGE, 1, MAKELONG(0, 128));
SendDlgItemMessage(hwndDlg,501,TBM_SETPOS,1,ntschue); SendDlgItemMessage(hwndDlg, 501, TBM_SETRANGE, 1, MAKELONG(0, 128));
EnableWindow(GetDlgItem(hwndDlg,201),(eoptions&EO_CPALETTE)?1:0);
FCEUI_GetNTSCTH(&ntsctint, &ntschue);
SendDlgItemMessage(hwndDlg, 500, TBM_SETPOS, 1, ntsctint);
SendDlgItemMessage(hwndDlg, 501, TBM_SETPOS, 1, ntschue);
EnableWindow(GetDlgItem(hwndDlg, 201), (eoptions & EO_CPALETTE) ? 1 : 0);
break; break;
case WM_HSCROLL: case WM_HSCROLL:
ntsctint=SendDlgItemMessage(hwndDlg,500,TBM_GETPOS,0,(LPARAM)(LPSTR)0); ntsctint = SendDlgItemMessage(hwndDlg, 500, TBM_GETPOS, 0, (LPARAM)(LPSTR)0);
ntschue=SendDlgItemMessage(hwndDlg,501,TBM_GETPOS,0,(LPARAM)(LPSTR)0); ntschue = SendDlgItemMessage(hwndDlg, 501, TBM_GETPOS, 0, (LPARAM)(LPSTR)0);
FCEUI_SetNTSCTH(ntsccol,ntsctint,ntschue); FCEUI_SetNTSCTH(ntsccol, ntsctint, ntschue);
break; break;
case WM_CLOSE: case WM_CLOSE:
case WM_QUIT: goto gornk; case WM_QUIT:
goto gornk;
case WM_COMMAND: case WM_COMMAND:
if(!(wParam>>16)) if(!(wParam>>16))
{
switch(wParam&0xFFFF) switch(wParam&0xFFFF)
{ {
case 100:ntsccol^=1;FCEUI_SetNTSCTH(ntsccol,ntsctint,ntschue);break; case 100:
case 200: ntsccol ^= 1;
FCEUI_SetNTSCTH(ntsccol, ntsctint, ntschue);
break;
case 200:
if(LoadPaletteFile()) if(LoadPaletteFile())
EnableWindow(GetDlgItem(hwndDlg,201),1); {
EnableWindow(GetDlgItem(hwndDlg, 201), 1);
}
break; break;
case 201:FCEUI_SetPaletteArray(0);
eoptions&=~EO_CPALETTE; case 201:
EnableWindow(GetDlgItem(hwndDlg,201),0); FCEUI_SetPaletteArray(0);
eoptions &= ~EO_CPALETTE;
EnableWindow(GetDlgItem(hwndDlg, 201), 0);
break; break;
case 1: case 1:
gornk: gornk:
DestroyWindow(hwndDlg); DestroyWindow(hwndDlg);
pwindow=0; // Yay for user race conditions. pwindow = 0; // Yay for user race conditions.
break; break;
} }
} }
}
return 0; return 0;
} }
static void ConfigPalette(void) /**
* Shows palette configuration dialog.
**/
void ConfigPalette(void)
{ {
if(!pwindow) if(!pwindow)
pwindow=CreateDialog(fceu_hInstance,"PALCONFIG",0,PaletteConCallB); {
pwindow=CreateDialog(fceu_hInstance, "PALCONFIG" ,0 , PaletteConCallB);
}
else else
{
SetFocus(pwindow); 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,9 +1507,12 @@ 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();
} }