/* Copyright (C) 2003 Rice1964 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "stdafx.h" #include "_BldNum.h" #ifndef _WIN32 #define const #endif void GetPluginDir(char *Directory); char *frameBufferSettings[] = { "Disable (default)", "Ignore", "Copy", "Faster", "Faster+Recheck", "Complete", "Copy & Back", "With Emulator", }; const char *screenUpdateSettings[] = { "At VI origin update (default)", "At VI origin change", "At CI change", "At the 1st CI change", "At the 1st drawing" }; const char *gammaCorrectionSettings[] = { "Disable", "1 - brighter", "2 - brighter more", "3 - brighter more", "4 - brighter more", "Darker", "Darker more" }; const char *openGLDepthBufferSettings[] = { "Default", "16 bits", "32 bits" }; WindowSettingStruct windowSetting; GlobalOptions options; RomOptions defaultRomOptions; RomOptions currentRomOptions; //======================================================= BYTE g_gammaValues[256]; extern IniFile *g_pIniFile; const char *resolutions[] = { "320 x 240", "400 x 300", "480 x 360", "512 x 384", "640 x 480", "800 x 600", "1024 x 768", "1152 x 864", "1280 x 1024", "1400 x 1050", "1600 x 1200", "1920 x 1440", "2048 x 1536" }; const int numberOfResolutions = sizeof(resolutions)/sizeof(char*); const RenderEngineSetting RenderEngineSettings[] = { "DirectX", DIRECTX_DEVICE, "OpenGL", OGL_DEVICE, }; const SettingInfo ForceTextureFilterSettings[] = { "N64 Default Texture Filter", FORCE_DEFAULT_FILTER, "Force Nearest Filter (faster, low quality)", FORCE_POINT_FILTER, "Force Linear Filter (slower, better quality)", FORCE_LINEAR_FILTER, //"Force Bilinear Filter (slower, best quality)", FORCE_BILINEAR_FILTER, }; const SettingInfo TextureEnhancementSettings[] = { "N64 original texture (No enhancement)", TEXTURE_NO_ENHANCEMENT, "2x (Double the texture size)", TEXTURE_2X_ENHANCEMENT, "2x - texture rectangle only", TEXTURE_2X_TEXRECT_ENHANCEMENT, "2xSaI", TEXTURE_2XSAI_ENHANCEMENT, "2xSaI - texture rectangle only", TEXTURE_2XSAI_TEXRECT_ENHANCEMENT, "Sharpen", TEXTURE_SHARPEN_ENHANCEMENT, "Sharpen More", TEXTURE_SHARPEN_MORE_ENHANCEMENT, }; const SettingInfo TextureEnhancementControlSettings[] = { "Normal", TEXTURE_ENHANCEMENT_NORMAL, "Enhance small textures only", TEXTURE_ENHANCEMENT_SMALL_TEXTURE_ONLY, "Smooth", TEXTURE_ENHANCEMENT_WITH_SMOOTH_FILTER_1, "Less smooth", TEXTURE_ENHANCEMENT_WITH_SMOOTH_FILTER_2, "2xSaI smooth", TEXTURE_ENHANCEMENT_WITH_SMOOTH_FILTER_3, "Less 2xSaI smooth", TEXTURE_ENHANCEMENT_WITH_SMOOTH_FILTER_4, }; const SettingInfo openGLColorBufferSettings[] = { "16 bits", TEXTURE_FMT_A4R4G4B4, "32 bits", TEXTURE_FMT_A8R8G8B8, }; const RenderEngineSetting OpenGLRenderSettings[] = { "OpenGL best fit to your video card ", OGL_DEVICE, "OpenGL 1.1 (Lowest)", OGL_1_1_DEVICE, "OpenGL 1.2/1.3/1.4 for ATI, Nvidia and others", OGL_1_2_DEVICE, "OpenGL for Nvidia TNT or better", OGL_TNT2_DEVICE, "OpenGL for Nvidia Geforce or better ", NVIDIA_OGL_DEVICE, }; const int numberOfRenderEngineSettings = sizeof(RenderEngineSettings)/sizeof(RenderEngineSetting); const int numberOfOpenGLRenderEngineSettings = sizeof(OpenGLRenderSettings)/sizeof(RenderEngineSetting); #define MAIN_RICE_DAEDALUS_4 "Software\\RICEDAEDALUS510\\WINDOW" #define RICE_DAEDALUS_INI_FILE "RiceDaedalus5.1.0.ini" #define CONFIG_FILE "RiceDaedalus.cfg" void WriteConfiguration(void); void GenerateCurrentRomOptions(); #ifdef _WIN32 HWND g_hwndTT=NULL; HWND g_hwndDlg=NULL; HHOOK g_hhk = NULL; extern HINSTANCE myhInst; extern "C" BOOL __stdcall EnumChildProc(HWND hwndCtrl, LPARAM lParam); LRESULT CALLBACK GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam); VOID OnWMNotify(LPARAM lParam); BOOL CreateDialogTooltip(void); //======================================================================== LRESULT APIENTRY ConfigDialog(HWND hDlg, unsigned message, LONG wParam, LONG lParam) { int i; BOOL flag; HWND item; int setting; //DebuggerAppendMsg("Msg=%d, wParam=%08X, lParam=%08X",message, wParam, lParam); switch (message) { case WM_INITDIALOG: g_hwndDlg = hDlg; if (!g_hhk) { g_hwndTT = NULL; g_hhk = NULL; CreateDialogTooltip(); } item = GetDlgItem(hDlg, IDC_OPTION_GROUP ); if( status.bGameIsRunning ) { DWORD state; SetWindowText(item, "Setting Of Current Game"); state = g_curRomInfo.dwNormalBlender==2 ? BST_CHECKED : (g_curRomInfo.dwNormalBlender==1?BST_UNCHECKED:BST_INDETERMINATE); SendDlgItemMessage(hDlg, IDC_ALPHA_BLENDER, BM_SETSTYLE, BS_AUTO3STATE, TRUE); SendDlgItemMessage(hDlg, IDC_ALPHA_BLENDER, BM_SETCHECK, state, 0); state = g_curRomInfo.dwEnableObjBG==2 ? BST_CHECKED : (g_curRomInfo.dwEnableObjBG ==1?BST_UNCHECKED:BST_INDETERMINATE); SendDlgItemMessage(hDlg, IDC_ENABLE_BG, BM_SETSTYLE, BS_AUTO3STATE, TRUE); SendDlgItemMessage(hDlg, IDC_ENABLE_BG, BM_SETCHECK, state, 0); state = g_curRomInfo.dwNormalCombiner ==2 ? BST_CHECKED : (g_curRomInfo.dwNormalCombiner ==1?BST_UNCHECKED:BST_INDETERMINATE); SendDlgItemMessage(hDlg, IDC_NORMAL_COMBINER, BM_SETSTYLE, BS_AUTO3STATE, TRUE); SendDlgItemMessage(hDlg, IDC_NORMAL_COMBINER, BM_SETCHECK, state, 0); state = g_curRomInfo.dwFastTextureCRC ==2 ? BST_CHECKED : (g_curRomInfo.dwFastTextureCRC ==1?BST_UNCHECKED:BST_INDETERMINATE); SendDlgItemMessage(hDlg, IDC_FAST_TEX_CRC, BM_SETSTYLE, BS_AUTO3STATE, TRUE); SendDlgItemMessage(hDlg, IDC_FAST_TEX_CRC, BM_SETCHECK, state, 0); state = g_curRomInfo.dwForceScreenClear ==2 ? BST_CHECKED : (g_curRomInfo.dwForceScreenClear ==1?BST_UNCHECKED:BST_INDETERMINATE); SendDlgItemMessage(hDlg, IDC_FORCE_BUFFER_CLEAR, BM_SETSTYLE, BS_AUTO3STATE, TRUE); SendDlgItemMessage(hDlg, IDC_FORCE_BUFFER_CLEAR, BM_SETCHECK, state, 0); state = g_curRomInfo.dwAccurateTextureMapping ==2 ? BST_CHECKED : (g_curRomInfo.dwAccurateTextureMapping ==1?BST_UNCHECKED:BST_INDETERMINATE); SendDlgItemMessage(hDlg, IDC_ACCURATE_TEXTURE_MAPPING, BM_SETSTYLE, BS_AUTO3STATE, TRUE); SendDlgItemMessage(hDlg, IDC_ACCURATE_TEXTURE_MAPPING, BM_SETCHECK, state, 0); SendDlgItemMessage(hDlg, IDC_FRAME_BUFFER_SETTING, CB_RESETCONTENT, 0, 0); SendDlgItemMessage(hDlg, IDC_FRAME_BUFFER_SETTING, CB_INSERTSTRING, 0, (LPARAM) "Default"); for( i=0; i= TEXTURE_SHARPEN_ENHANCEMENT ) EnableWindow(item, FALSE); if( status.bGameIsRunning ) { item = GetDlgItem(hDlg, IDC_RENDER_ENGINE_SELECTION); EnableWindow(item, FALSE); item = GetDlgItem(hDlg, IDC_BUFFER_SETTING1); EnableWindow(item, FALSE); item = GetDlgItem(hDlg, IDC_BUFFER_SETTING2 ); EnableWindow(item, FALSE); item = GetDlgItem(hDlg, IDC_BUFFER_SETTING3 ); EnableWindow(item, FALSE); item = GetDlgItem(hDlg, IDC_RESOLUTION_WINDOW_MODE); EnableWindow(item, FALSE); item = GetDlgItem(hDlg, IDC_RESOLUTION_FULL_SCREEN_MODE); EnableWindow(item, FALSE); item = GetDlgItem(hDlg, IDC_DX_COMBINER_SELECTION); EnableWindow(item, FALSE); item = GetDlgItem(hDlg, IDC_SCREEN_UPDATE_AT); EnableWindow(item, TRUE); item = GetDlgItem(hDlg, IDC_ENABLE_BG); EnableWindow(item, TRUE); } else { item = GetDlgItem(hDlg, IDC_SCREEN_UPDATE_AT); EnableWindow(item, FALSE); item = GetDlgItem(hDlg, IDC_ENABLE_BG); EnableWindow(item, FALSE); //item = GetDlgItem(hDlg, IDC_ENABLE_BG); //ShowWindow(item, SW_HIDE); } char str[200]; sprintf(str, "Rice's Daedalus %d.%d.%d Configuration",FILE_VERSION0,FILE_VERSION1,FILE_VERSION2); SetWindowText(hDlg, str); return TRUE; case WM_DESTROY: if (g_hwndDlg == hDlg) { if (g_hhk) UnhookWindowsHookEx (g_hhk); g_hhk = NULL; g_hwndDlg = NULL; } return 0; case WM_NOTIFY: OnWMNotify (lParam); return 0; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_BUFFER_SETTING1: if( HIWORD(wParam) == CBN_CLOSEUP ) { setting = SendDlgItemMessage(hDlg, IDC_BUFFER_SETTING1, CB_GETCURSEL, 0, 0); break; } return(TRUE); break; case IDC_TEXTURE_ENHANCEMENT: if( HIWORD(wParam) == CBN_CLOSEUP ) { setting = SendDlgItemMessage(hDlg, IDC_TEXTURE_ENHANCEMENT, CB_GETCURSEL, 0, 0); item = GetDlgItem(hDlg, IDC_TEXTURE_ENHANCEMENT_CONTROL ); if( TextureEnhancementSettings[setting].setting == TEXTURE_NO_ENHANCEMENT || TextureEnhancementSettings[setting].setting >= TEXTURE_SHARPEN_ENHANCEMENT ) { EnableWindow(item, FALSE); } else { EnableWindow(item, TRUE); } break; } return(TRUE); break; case IDC_RENDER_ENGINE_SELECTION: if( HIWORD(wParam) == CBN_CLOSEUP ) { setting = SendDlgItemMessage(hDlg, IDC_RENDER_ENGINE_SELECTION, CB_GETCURSEL, 0, 0); flag = (RenderEngineSettings[setting].type == DIRECTX_DEVICE ); SendDlgItemMessage(hDlg, IDC_BUFFER_SETTING2, CB_RESETCONTENT, 0, 0); SendDlgItemMessage(hDlg, IDC_DX_COMBINER_SELECTION, CB_RESETCONTENT, 0, 0); SendDlgItemMessage(hDlg, IDC_BUFFER_SETTING3, CB_RESETCONTENT, 0, 0); if( flag ) { item = GetDlgItem(hDlg, IDC_BUFFER_SETTING3 ); EnableWindow(item, FALSE); for( i=0; iReadIniFile()) { ErrorMsg("Unable to read Daedalus.ini file from disk"); return FALSE; } } ReadConfiguration(); return TRUE; } void GenerateCurrentRomOptions() { currentRomOptions.N64FrameBufferEmuType =g_curRomInfo.dwFrameBufferOption; currentRomOptions.screenUpdateSetting =g_curRomInfo.dwScreenUpdateSetting; currentRomOptions.normalColorCombiner =g_curRomInfo.dwNormalCombiner; currentRomOptions.normalAlphaBlender =g_curRomInfo.dwNormalBlender; currentRomOptions.bFastTexCRC =g_curRomInfo.dwFastTextureCRC; currentRomOptions.forceBufferClear =g_curRomInfo.dwForceScreenClear; currentRomOptions.dwEnableObjBG =g_curRomInfo.dwEnableObjBG; currentRomOptions.accurateTextureMapping =g_curRomInfo.dwAccurateTextureMapping; if( currentRomOptions.N64FrameBufferEmuType == 0 ) currentRomOptions.N64FrameBufferEmuType = defaultRomOptions.N64FrameBufferEmuType; else currentRomOptions.N64FrameBufferEmuType--; if( currentRomOptions.screenUpdateSetting == 0 ) currentRomOptions.screenUpdateSetting = defaultRomOptions.screenUpdateSetting; else currentRomOptions.screenUpdateSetting--; if( currentRomOptions.normalColorCombiner == 0 ) currentRomOptions.normalColorCombiner = defaultRomOptions.normalColorCombiner; else currentRomOptions.normalColorCombiner--; if( currentRomOptions.normalAlphaBlender == 0 ) currentRomOptions.normalAlphaBlender = defaultRomOptions.normalAlphaBlender; else currentRomOptions.normalAlphaBlender--; if( currentRomOptions.bFastTexCRC == 0 ) currentRomOptions.bFastTexCRC = defaultRomOptions.bFastTexCRC; else currentRomOptions.bFastTexCRC--; if( currentRomOptions.forceBufferClear == 0 ) currentRomOptions.forceBufferClear = defaultRomOptions.forceBufferClear; else currentRomOptions.forceBufferClear--; if( currentRomOptions.dwEnableObjBG == 0 ) currentRomOptions.dwEnableObjBG = defaultRomOptions.dwEnableObjBG; else currentRomOptions.dwEnableObjBG--; if( currentRomOptions.accurateTextureMapping == 0 ) currentRomOptions.accurateTextureMapping = defaultRomOptions.accurateTextureMapping; else currentRomOptions.accurateTextureMapping--; } extern IniFile * g_pIniFile; void Ini_GetRomOptions(LPROMINFO pRomInfo) { LONG i; i = g_pIniFile->FindEntry(pRomInfo->rh.dwCRC1, pRomInfo->rh.dwCRC2, pRomInfo->rh.nCountryID, (char*)pRomInfo->szGameName); pRomInfo->ucode = g_pIniFile->sections[i].ucode; strncpy((char*)pRomInfo->szGameName, g_pIniFile->sections[i].name, 50); strncpy((char*)pRomInfo->szComment, g_pIniFile->sections[i].comment, 100); strncpy((char*)pRomInfo->szInfo, g_pIniFile->sections[i].info, 100); pRomInfo->bDisablePatches = g_pIniFile->sections[i].bDisablePatches; pRomInfo->bDisableTextureCRC = g_pIniFile->sections[i].bDisableTextureCRC; pRomInfo->bDisableEeprom = g_pIniFile->sections[i].bDisableEeprom; pRomInfo->bIncTexRectEdge = g_pIniFile->sections[i].bIncTexRectEdge; pRomInfo->bTextureScaleHack = g_pIniFile->sections[i].bTextureScaleHack; pRomInfo->bDisableSpeedSync = g_pIniFile->sections[i].bDisableSpeedSync; pRomInfo->bDisableDynarec = g_pIniFile->sections[i].bDisableDynarec; pRomInfo->bExpansionPak = g_pIniFile->sections[i].bExpansionPak; pRomInfo->bPrimaryDepthHack = g_pIniFile->sections[i].bPrimaryDepthHack; pRomInfo->bTexture1Hack = g_pIniFile->sections[i].bTexture1Hack; pRomInfo->bFastLoadTile = g_pIniFile->sections[i].bFastLoadTile; pRomInfo->VIWidth = g_pIniFile->sections[i].VIWidth; pRomInfo->VIHeight = g_pIniFile->sections[i].VIHeight; pRomInfo->dwEepromSize = g_pIniFile->sections[i].dwEepromSize; pRomInfo->dwRescanCount = g_pIniFile->sections[i].dwRescanCount; pRomInfo->dwFastTextureCRC = g_pIniFile->sections[i].dwFastTextureCRC; pRomInfo->dwForceScreenClear = g_pIniFile->sections[i].dwForceScreenClear; pRomInfo->dwAccurateTextureMapping = g_pIniFile->sections[i].dwAccurateTextureMapping; pRomInfo->dwNormalBlender = g_pIniFile->sections[i].dwNormalBlender; pRomInfo->dwNormalCombiner = g_pIniFile->sections[i].dwNormalCombiner; pRomInfo->dwEnableObjBG = g_pIniFile->sections[i].dwEnableObjBG; pRomInfo->dwFrameBufferOption = g_pIniFile->sections[i].dwFrameBufferOption; pRomInfo->dwScreenUpdateSetting = g_pIniFile->sections[i].dwScreenUpdateSetting; } void Ini_StoreRomOptions(LPROMINFO pRomInfo) { LONG i; i = g_pIniFile->FindEntry(pRomInfo->rh.dwCRC1, pRomInfo->rh.dwCRC2, pRomInfo->rh.nCountryID, (char*)pRomInfo->szGameName); if( g_pIniFile->sections[i].bDisablePatches !=pRomInfo->bDisablePatches ) { g_pIniFile->sections[i].bDisablePatches =pRomInfo->bDisablePatches ; g_pIniFile->bChanged=true; } if( g_pIniFile->sections[i].bDisableTextureCRC !=pRomInfo->bDisableTextureCRC ) { g_pIniFile->sections[i].bDisableTextureCRC =pRomInfo->bDisableTextureCRC ; g_pIniFile->bChanged=true; } g_pIniFile->sections[i].bDisableEeprom =pRomInfo->bDisableEeprom ; g_pIniFile->sections[i].bIncTexRectEdge =pRomInfo->bIncTexRectEdge ; g_pIniFile->sections[i].bTextureScaleHack =pRomInfo->bTextureScaleHack ; g_pIniFile->sections[i].bDisableSpeedSync =pRomInfo->bDisableSpeedSync ; g_pIniFile->sections[i].bDisableDynarec =pRomInfo->bDisableDynarec ; g_pIniFile->sections[i].bExpansionPak =pRomInfo->bExpansionPak ; g_pIniFile->sections[i].bPrimaryDepthHack =pRomInfo->bPrimaryDepthHack ; g_pIniFile->sections[i].bTexture1Hack =pRomInfo->bTexture1Hack ; g_pIniFile->sections[i].bFastLoadTile =pRomInfo->bFastLoadTile ; g_pIniFile->sections[i].VIWidth =pRomInfo->VIWidth ; g_pIniFile->sections[i].VIHeight =pRomInfo->VIHeight ; g_pIniFile->sections[i].dwEepromSize =pRomInfo->dwEepromSize ; g_pIniFile->sections[i].dwRescanCount =pRomInfo->dwRescanCount ; if( g_pIniFile->sections[i].dwFastTextureCRC !=pRomInfo->dwFastTextureCRC ) { g_pIniFile->sections[i].dwFastTextureCRC =pRomInfo->dwFastTextureCRC ; g_pIniFile->bChanged=true; } if( g_pIniFile->sections[i].dwNormalBlender !=pRomInfo->dwNormalBlender ) { g_pIniFile->sections[i].dwNormalBlender =pRomInfo->dwNormalBlender ; g_pIniFile->bChanged=true; } if( g_pIniFile->sections[i].dwForceScreenClear !=pRomInfo->dwForceScreenClear ) { g_pIniFile->sections[i].dwForceScreenClear =pRomInfo->dwForceScreenClear ; g_pIniFile->bChanged=true; } if( g_pIniFile->sections[i].dwAccurateTextureMapping !=pRomInfo->dwAccurateTextureMapping ) { g_pIniFile->sections[i].dwAccurateTextureMapping =pRomInfo->dwAccurateTextureMapping ; g_pIniFile->bChanged=true; } if( g_pIniFile->sections[i].dwNormalCombiner !=pRomInfo->dwNormalCombiner ) { g_pIniFile->sections[i].dwNormalCombiner =pRomInfo->dwNormalCombiner ; g_pIniFile->bChanged=true; } if( g_pIniFile->sections[i].dwEnableObjBG !=pRomInfo->dwEnableObjBG ) { g_pIniFile->sections[i].dwEnableObjBG =pRomInfo->dwEnableObjBG ; g_pIniFile->bChanged=true; } if( g_pIniFile->sections[i].dwFrameBufferOption !=pRomInfo->dwFrameBufferOption ) { g_pIniFile->sections[i].dwFrameBufferOption =pRomInfo->dwFrameBufferOption ; g_pIniFile->bChanged=true; } if( g_pIniFile->sections[i].dwScreenUpdateSetting !=pRomInfo->dwScreenUpdateSetting ) { g_pIniFile->sections[i].dwScreenUpdateSetting =pRomInfo->dwScreenUpdateSetting ; g_pIniFile->bChanged=true; } } #ifndef _WIN32 #define IDC_RENDER_ENGINE_SELECTION 0 #define IDC_DX_COMBINER_SELECTION 0 #define IDC_BUFFER_SETTING1 0 #define IDC_BUFFER_SETTING2 0 #define IDC_BUFFER_SETTING3 0 #define IDC_RESOLUTION_WINDOW_MODE 0 #define IDC_RESOLUTION_FULL_SCREEN_MODE 0 #define IDC_GAMMA_SELECTION 0 #define IDC_TEXTURE_ENHANCEMENT 0 #define IDC_TEXTURE_ENHANCEMENT_CONTROL 0 #define IDC_FORCE_TEXTURE_FILTER 0 #define IDC_EMULATOR_TOOLBAR 0 #define IDC_FOG 0 #define IDC_SSE 0 #define IDC_SKIP_FRAME 0 #define IDC_ALPHA_BLENDER 0 #define IDC_NORMAL_COMBINER 0 #define IDC_FAST_TEX_CRC 0 #define IDC_ACCURATE_TEXTURE_MAPPING 0 #define IDC_FORCE_BUFFER_CLEAR 0 #define IDC_ENABLE_BG 0 #define IDC_SCREEN_UPDATE_AT 0 #define IDC_SCREEN_UPDATE_LABEL 0 #define IDC_FRAME_BUFFER_SETTING 0 #define IDC_OPTION_GROUP 0 #endif // Tooltip functions from Glide64 project, original from MSDN library typedef struct { int id; char *title; char *text; } ToolTipMsg; ToolTipMsg ttmsg[] = { { IDC_RENDER_ENGINE_SELECTION, "Render Engine", "Select which render engine to use, DirectX or OpenGL.\n" }, { IDC_DX_COMBINER_SELECTION, "Choose a color combiner to use with the render engine.\n", "The default [To best fit your video card] should work just fine for you, or you can change:\n\n" "For DirectX, you can use low end, mid end, high end or Nvidia TNT combiner.\n" "- Low-end combiner is for video cards which can only do 1 combiner cycle or has only 1 texture unit." " It is for old or low-end video cards, and most onboard ones\n" "- Mid-end combiner is for video cards which can do more than 1 combiner cycles and/or has more than" "1 texture units, but with limited combiner modes (only supporting LERP, MULTIPLYADD). For video" " cards such as Rage 128, Voodoos, etc\n" "- High-end combiner is for video cards over mid-end ones, which can do LERP, MULTIPLYADD etc. " "It is for Radeon, Geforce 2/3/4 ti (not GF2 MX, or GF4 MX)\n" "- Nvidia TNT combiner is for TNT, TNT2, Geforce2 MX (not TI), Geforce 4 MX (not ti)\n" "\nFor OpenGL, you can use Ogl 1.1, Ogl 1.2/1.3/1.4, Nvidia TNT, Nvidia Geforce Register combiner\n" "- Ogl 1.1, most video cards support this\n" "- Ogl 1.2/1.3/1.4, is for Nvidia TNT/Geforce and ATI Radeon video cards\n" "- Nvidia TNT, is good for all Nvidia video cards from TNT\n" "- Nvidia Register Combiner, is for all Nvidia video cards from Geforce 256. This combiner is " "better than the Nvidia TNT one\n" }, { IDC_BUFFER_SETTING1, "Render buffer setting (for DirectX only)", "This setting should not matter very much for you.\n\n" "Double buffer copy [default]\n" "Double buffer copy and sync, this is the slowest\n" "Double buffer flip, similar to Double Buffer Copy, should be a little faster\n" "Triple buffer flip, not necessary to use triple buffer, even it is actually used by some N64 games in the N64 console\n" "Quadruple buffer flip, not necessary, will be removed" }, { IDC_BUFFER_SETTING2, "Depth buffer setting", "You don't need to modify this setting.\n" }, { IDC_BUFFER_SETTING3, "OpenGL color buffer depth", "16 bits or 32 bits\n16 bits should be faster and 32 bits should be better.\n" }, { IDC_RESOLUTION_WINDOW_MODE, "Window mode display resolution", "Window mode display resolution" }, { IDC_RESOLUTION_FULL_SCREEN_MODE, "Full screen mode display resolution", "Full screen mode display resolution" }, { IDC_GAMMA_SELECTION, "Gamma correction", "Apply color gamma correction. It is not necessary for most games. It may help " "with a few games which are very dim in game.\n" "Try it by your own.\n" }, { IDC_TEXTURE_ENHANCEMENT, "Texture enhancement", "Enhance texture when loading the texture.\n\n" "- 2x double the texture size\n" "- 2x texture rectangle only, double the texture size, only for textRect, not for triangle primitives\n" "- 2xSai, double the texture size and apply 2xSai algorithm\n" "- 2xSai for texture rectangle only\n" "- Sharpen, apply sharpen filter (cool effects)\n" "- Sharpen more, do more sharpening" }, { IDC_TEXTURE_ENHANCEMENT_CONTROL, "Teture enhancement control", "Control the texture enhancement filters.\n\n" "- Normal without control\n" "- small texture only, to enhance the texture for small textures only\n" "- Smooth to apply a smooth filter after enhancement\n" "- Less smooth to apply a (less) smooth filter\n" "- 2xSai smooth to apply smooth filter for 2xSai artifacts effects\n" "- sxSai less smooth again, this is for 2xSai, but with less smooth" }, { IDC_FORCE_TEXTURE_FILTER, "Force texture filter", "Force Nearest filter and force bilinear filter\n" }, { IDC_EMULATOR_TOOLBAR, "Allocate extra space for emulator toolbar", "This option should be enabled for emulators with toolbar." "should be disabled for others without toolbar, otherwise there will be a black space " "left on the top of the screen.\n" "This option should be enabled for 1964, and disabled for most other emulators." }, { IDC_FOG, "Enable/Disable Fog", "Enable or disable fog by this option\n" }, { IDC_SSE, "Enable/Disable SSE for Intel P3/P4 CPU", "SSE (Intel Streaming SMID Extension) can speed up 3D transformation, vertex and matrix processing. " "It is only available with Intel P3 and P4 CPU, not with AMD CPUs. P3 is actually much faster than P4 " "with SSE instructions\n" }, { IDC_SKIP_FRAME, "Frame skipping", "If this option is on, the plugin will skip every other frames. This could help to improve " "speed for some games, and could cause flickering for other games.\n" }, { IDC_ALPHA_BLENDER, "Force to use normal alpha blender", "Use this option if you have opaque/transparency problems with certain games.\n" "\nWhen a game is not running, it is the default value (for all games), available values are on/off.\n" "When a game is running, it is the game setting. Three available setting are on/off/as_default." }, { IDC_NORMAL_COMBINER, "Normal color combiner", "Force to use normal color combiner\n" "Normal color combiner is:\n" "- Texture * Shade, if both texture and shade are used\n" "- Texture only, if texture is used and shade is not used\n" "- shade only, if texture is not used\n\n" "Try to use this option if you have ingame texture color problems, transparency problems, " "or black/white texture problems\n" "\nWhen a game is not running, it is the default value (for all games), available values are on/off.\n" "When a game is running, it is the game setting. Three available setting are on/off/as_default." }, { IDC_FAST_TEX_CRC, "Fast texture loading", "Using a faster algorithm to speed up texture loading and CRC computation.\n" "\nWhen a game is not running, it is the default value (for all games), available values are on/off.\n" "When a game is running, it is the game setting. Three available setting are on/off/as_default." }, { IDC_ACCURATE_TEXTURE_MAPPING, "Force Buffer Clear", "This option helps to reduce thin black lines in some games\n" "\nWhen a game is not running, it is the default value (for all games), available values are on/off.\n" "When a game is running, it is the game setting. Three available setting are on/off/as_default." }, { IDC_FORCE_BUFFER_CLEAR, "Force Buffer Clear", "Force to clear screen before drawing any primitives.\n" "This is in fact a hack, only for a few games, including KI Gold\n" "\nWhen a game is not running, it is the default value (for all games), available values are on/off.\n" "When a game is running, it is the game setting. Three available setting are on/off/as_default." }, { IDC_ENABLE_BG, "Enable BG primitive", "Disable this option for Zelda MM, otherwise its intro will be covered by a black layer (by drawing of a black BG texture).\n" "\nWhen a game is not running, it is the default value (for all games), available values are on/off.\n" "When a game is running, it is the game setting. Three available setting are on/off/as_default." }, { IDC_SCREEN_UPDATE_AT, "Control when the screen will be updated", "\n" "At VI origin update (default)\n" "At VI origin change\n" "At CI change\n" "At the 1st CI change\n" "At the 1st drawing\n" "\nWhen a game is not running, it is the default value (for all games).\n" "When a game is running, it is the game setting." }, { IDC_SCREEN_UPDATE_LABEL, "Control when the screen will be updated", "This option is to prevent or reduce flicking in certain games by controlling when the screen will be updated\n\n" "At VI origin update (default)\n" "At VI origin change\n" "At CI change\n" "At the 1st CI change\n" "At the 1st drawing\n" "\nWhen a game is not running, it is the default value (for all games).\n" "When a game is running, it is the game setting." }, { IDC_FRAME_BUFFER_SETTING, "N64 CPU frame buffer emulating", "CPU frame buffer is referred to N64 drawing buffers in RDRAM." "Games could draw into a frame buffer other than a displayed render buffer and use the result as textures for further drawing into rendering buffer. " "It is very difficult to emulate N64 frame buffer through either DirectX or OpenGL\n\n" "- Disable, don't do any frame buffer emulating\n" "- Ignore, ignore frame buffer drawing, at least such drawing won't draw to the current rendering buffer\n" "- Copy, copy frame buffer drawing result back to N64 RDRAM\n" "- Faster [default], A faster approach, for most games that are not really heavily useing frame buffers\n" "- Faster+Recheck, will also recheck texture loading address to see if the address is within the frame buffer\n" "- Complete, a complete emulation, very slow\n" "- Copy & Back, especially for Dr. Mario, will copy the frame buffer result back to N64 RDRAM and will also check N64 RDRAM changes (direct CPU frame buffer memory write, the Dr. Mario dropping pills) and redraw the frame buffer to render buffer\n" "- With Emulator, new 1964 will inform the plugin about CPU frame buffer memory direct read/write\n" "\nWhen a game is not running, it is the default value (for all games).\n" "When a game is running, it is the game setting." }, { IDC_OPTION_GROUP, "Default options or Rom specific settings", "\nWhen a game is not running, it is the default value (for all games).\n" "When a game is running, it is the game setting." }, }; int numOfTTMsgs = sizeof(ttmsg)/sizeof(ToolTipMsg); #ifdef _WIN32 // ** TOOLTIP CODE FROM MSDN LIBRARY SAMPLE WITH SEVERAL MODIFICATIONS ** // DoCreateDialogTooltip - creates a tooltip control for a dialog box, // enumerates the child control windows, and installs a hook // procedure to monitor the message stream for mouse messages posted // to the control windows. // Returns TRUE if successful, or FALSE otherwise. // // Global variables // g_hinst - handle to the application instance. // g_hwndTT - handle to the tooltip control. // g_hwndDlg - handle to the dialog box. // g_hhk - handle to the hook procedure. BOOL CreateDialogTooltip(void) { // Ensure that the common control DLL is loaded, and create // a tooltip control. InitCommonControls(); g_hwndTT = CreateWindowEx(0, TOOLTIPS_CLASS, (LPSTR) NULL, TTS_ALWAYSTIP|/*TTS_BALLOON*/0x40, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, g_hwndDlg, (HMENU) NULL, myhInst, NULL); if (g_hwndTT == NULL) return FALSE; // Enumerate the child windows to register them with the tooltip // control. if (!EnumChildWindows(g_hwndDlg, (WNDENUMPROC) EnumChildProc, 0)) return FALSE; /* TOOLINFO ti; HWND boxhwnd = GetDlgItem(g_hwndDlg,IDC_OPTION_GROUP); GetWindowRect(boxhwnd, &ti.rect); ScreenToClient(g_hwndDlg, (LPPOINT)&ti.rect); ti.cbSize = sizeof(TOOLINFO); ti.uFlags = 0; ti.hwnd = g_hwndDlg; ti.uId = IDC_OPTION_GROUP; ti.hinst = 0; ti.lpszText = LPSTR_TEXTCALLBACK; SendMessage(g_hwndTT, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti); ti.hwnd = boxhwnd; SendMessage(g_hwndTT, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti); */ // Install a hook procedure to monitor the message stream for mouse // messages intended for the controls in the dialog box. g_hhk = SetWindowsHookEx(WH_GETMESSAGE, GetMsgProc, (HINSTANCE) NULL, GetCurrentThreadId()); if (g_hhk == (HHOOK) NULL) return FALSE; return TRUE; } // EmumChildProc - registers control windows with a tooltip control by // using the TTM_ADDTOOL message to pass the address of a // TOOLINFO structure. // Returns TRUE if successful, or FALSE otherwise. // hwndCtrl - handle of a control window. // lParam - application-defined value (not used). extern "C" BOOL __stdcall EnumChildProc(HWND hwndCtrl, LPARAM lParam) { TOOLINFO ti; ti.cbSize = sizeof(TOOLINFO); ti.uFlags = TTF_IDISHWND; ti.hwnd = g_hwndDlg; ti.uId = (UINT) hwndCtrl; ti.hinst = 0; ti.lpszText = LPSTR_TEXTCALLBACK; SendMessage(g_hwndTT, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti); return TRUE; } // GetMsgProc - monitors the message stream for mouse messages intended // for a control window in the dialog box. // Returns a message-dependent value. // nCode - hook code. // wParam - message flag (not used). // lParam - address of an MSG structure. LRESULT CALLBACK GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam) { MSG *lpmsg; lpmsg = (MSG *) lParam; if (nCode < 0 || !(IsChild(g_hwndDlg, lpmsg->hwnd))) return (CallNextHookEx(g_hhk, nCode, wParam, lParam)); switch (lpmsg->message) { case WM_MOUSEMOVE: case WM_LBUTTONDOWN: case WM_LBUTTONUP: case WM_RBUTTONDOWN: case WM_RBUTTONUP: if (g_hwndTT != NULL) { MSG msg; int idCtrl = GetDlgCtrlID((HWND)lpmsg->hwnd); msg.lParam = lpmsg->lParam; msg.wParam = lpmsg->wParam; msg.message = lpmsg->message; msg.hwnd = lpmsg->hwnd; SendMessage(g_hwndTT, TTM_RELAYEVENT, 0, (LPARAM) (LPMSG) &msg); SendMessage(g_hwndTT, TTM_SETMAXTIPWIDTH, 0, 300); SendMessage(g_hwndTT, TTM_SETDELAYTIME, TTDT_INITIAL, (LPARAM)MAKELONG(500,0)); SendMessage(g_hwndTT, TTM_SETDELAYTIME, TTDT_AUTOPOP, (LPARAM)MAKELONG(32000,0)); for (int i=0; icode) == TTN_NEEDTEXT) { idCtrl = GetDlgCtrlID((HWND) ((LPNMHDR) lParam)->idFrom); lpttt = (LPTOOLTIPTEXT) lParam; for (int i=0; ilpszText = ttmsg[i].text; return; } } } return; } #endif // _WIN32 #ifndef _WIN32 #include #include "messagebox.h" typedef struct { GtkWidget *dialog; GtkWidget *combinerTypeCombo; GtkWidget *depthBufferSettingCombo; GtkWidget *openGLColorBufferDepthCombo; GtkWidget *gammaCorrectionCombo; GtkWidget *textureEnhancementCombo; GtkWidget *enhancementControlCombo; GtkWidget *forceTextureFilterCombo; GtkWidget *windowModeCombo; GtkWidget *fullScreenCombo; GtkWidget *enableFogCheckButton; GtkWidget *enableSSECheckButton; GtkWidget *showFPSCheckButton; GtkWidget *skipFrameCheckButton; GtkWidget *normalBlenderCheckButton; GtkWidget *normalCombinerCheckButton; GtkWidget *fastTextureCheckButton; GtkWidget *fineTextureMappingCheckButton; GtkWidget *forceBufferClearCheckButton; GtkWidget *drawBigTexturesCheckButton; GtkWidget *frameUpdateAtCombo; GtkWidget *frameBufferEmuCombo; } ConfigDialog; static void textureEnhancementCallback(GtkWidget *widget, void *data) { ConfigDialog *configDialog = (ConfigDialog*)data; int i; for (i=0; i= TEXTURE_SHARPEN_ENHANCEMENT) gtk_widget_set_sensitive(configDialog->enhancementControlCombo, FALSE); else gtk_widget_set_sensitive(configDialog->enhancementControlCombo, TRUE); } static void okButtonCallback(GtkWidget *widget, void *data) { ConfigDialog *configDialog = (ConfigDialog*)data; char *s; int i; defaultRomOptions.normalAlphaBlender = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->normalBlenderCheckButton)); defaultRomOptions.bFastTexCRC = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->fastTextureCheckButton)); defaultRomOptions.normalColorCombiner = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->normalCombinerCheckButton)); defaultRomOptions.forceBufferClear = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->forceBufferClearCheckButton)); defaultRomOptions.accurateTextureMapping = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->fineTextureMappingCheckButton));; defaultRomOptions.dwEnableObjBG = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->drawBigTexturesCheckButton)); s = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(configDialog->frameBufferEmuCombo)->entry)); for (i=0; iframeUpdateAtCombo)->entry)); for (i=0; ienableFogCheckButton)); options.enableSSE = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->enableSSECheckButton)); options.showFPS = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->showFPSCheckButton)); status.isSSEEnabled = status.isSSESupported && options.enableSSE; if (status.isSSEEnabled) SetNewVertexInfo = SetNewVertexInfoSSE; else SetNewVertexInfo = SetNewVertexInfoNoSSE; options.skipFrame = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configDialog->skipFrameCheckButton)); s = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(configDialog->gammaCorrectionCombo)->entry)); for (i=0; itextureEnhancementCombo)->entry)); for (i=0; ienhancementControlCombo)->entry)); for (i=0; iforceTextureFilterCombo)->entry)); for (i=0; icombinerTypeCombo)->entry)); for (i=0; idepthBufferSettingCombo)->entry)); for (i=0; i<3; i++) if (!strcmp(openGLDepthBufferSettings[i], s)) break; options.OpenglColorBufferSetting = i; s = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(configDialog->openGLColorBufferDepthCombo)->entry)); for (i=0; i<2; i++) if (!strcmp(openGLColorBufferSettings[i].description, s)) break; options.OpenglColorBufferSetting = openGLColorBufferSettings[i].setting; s = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(configDialog->windowModeCombo)->entry)); for (i=0; ifullScreenCombo)->entry)); for (i=0; idialog); } static void aboutButtonCallback(GtkWidget *widget, void *data) { DllAbout(NULL); } static void moreButtonCallback(GtkWidget *widget, void *data) { messagebox("Rice's Daedalus", MB_OK, "There are a few more options that are not covered here. They are advanced options, " "can be set in the INI file.\nThey are only used in very few games, see the INI file for more information.\n" "IncTexRectEdge\n" "FastLoadTile\n" "PrimaryDepthHack\n" "Texture1Hack\n" "TexRectScaleHack\n" "VIWidth, VIHeight: to set N64 screen resolution\n") ; } static ConfigDialog *CreateConfigDialog() { // objects creation // dialog GtkWidget *dialog; dialog = gtk_dialog_new(); char str[200]; sprintf(str, "Rice's Daedalus %d.%d.%d Configuration",FILE_VERSION0,FILE_VERSION1,FILE_VERSION2); gtk_window_set_title(GTK_WINDOW(dialog), str); // ok button GtkWidget *okButton; okButton = gtk_button_new_with_label("OK"); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), okButton); // cancel button GtkWidget *cancelButton; cancelButton = gtk_button_new_with_label("Cancel"); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), cancelButton); // about button GtkWidget *aboutButton; aboutButton = gtk_button_new_with_label("About"); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), aboutButton); // More Options button GtkWidget *moreButton; moreButton = gtk_button_new_with_label("More Options"); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), moreButton); // render setting frame GtkWidget *renderSettingFrame; renderSettingFrame = gtk_frame_new("Render Setting"); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), renderSettingFrame); // render setting container GtkWidget *renderSettingContainer; renderSettingContainer = gtk_hbox_new(TRUE, 0); gtk_container_add(GTK_CONTAINER(renderSettingFrame), renderSettingContainer); // render setting left container GtkWidget *renderSettingLContainer; renderSettingLContainer = gtk_vbox_new(TRUE, 0); gtk_container_add(GTK_CONTAINER(renderSettingContainer), renderSettingLContainer); // combiner type label GtkWidget *combinerTypeLabel; combinerTypeLabel = gtk_label_new("Combiner Type:"); gtk_misc_set_alignment(GTK_MISC(combinerTypeLabel), 0, 0.5); gtk_container_add(GTK_CONTAINER(renderSettingLContainer), combinerTypeLabel); // depth buffer setting label GtkWidget *depthBufferSettingLabel; depthBufferSettingLabel = gtk_label_new("Depth Buffer Setting:"); gtk_misc_set_alignment(GTK_MISC(depthBufferSettingLabel), 0, 0.5); gtk_container_add(GTK_CONTAINER(renderSettingLContainer), depthBufferSettingLabel); // OpenGL Color Buffer Depth GtkWidget *openGLColorBufferDepthLabel; openGLColorBufferDepthLabel = gtk_label_new("OpenGL Color Buffer Depth:"); gtk_misc_set_alignment(GTK_MISC(openGLColorBufferDepthLabel), 0, 0.5); gtk_container_add(GTK_CONTAINER(renderSettingLContainer), openGLColorBufferDepthLabel); // render setting right container GtkWidget *renderSettingRContainer; renderSettingRContainer = gtk_vbox_new(TRUE, 0); gtk_container_add(GTK_CONTAINER(renderSettingContainer), renderSettingRContainer); // combiner type combo GtkWidget *combinerTypeCombo; combinerTypeCombo = gtk_combo_new(); gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(combinerTypeCombo)->entry), FALSE); gtk_container_add(GTK_CONTAINER(renderSettingRContainer), combinerTypeCombo); // depth buffer setting combo GtkWidget *depthBufferSettingCombo; depthBufferSettingCombo = gtk_combo_new(); gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(depthBufferSettingCombo)->entry), FALSE); gtk_container_add(GTK_CONTAINER(renderSettingRContainer), depthBufferSettingCombo); // OpenGL Color Buffer Depth combo GtkWidget *openGLColorBufferDepthCombo; openGLColorBufferDepthCombo = gtk_combo_new(); gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(openGLColorBufferDepthCombo)->entry), FALSE); gtk_container_add(GTK_CONTAINER(renderSettingRContainer), openGLColorBufferDepthCombo); // Screen Resolution frame GtkWidget *screenResolutionFrame; screenResolutionFrame = gtk_frame_new("Screen Resolution"); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), screenResolutionFrame); // Screen Resolution container GtkWidget *screenResolutionContainer; screenResolutionContainer = gtk_hbox_new(TRUE, 0); gtk_container_add(GTK_CONTAINER(screenResolutionFrame), screenResolutionContainer); // Window Mode label GtkWidget *windowModeLabel; windowModeLabel = gtk_label_new("Window Mode:"); gtk_container_add(GTK_CONTAINER(screenResolutionContainer), windowModeLabel); // Window Mode combo GtkWidget *windowModeCombo; windowModeCombo = gtk_combo_new(); gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(windowModeCombo)->entry), FALSE); gtk_container_add(GTK_CONTAINER(screenResolutionContainer), windowModeCombo); // Full Screen label GtkWidget *fullScreenLabel; fullScreenLabel = gtk_label_new("Full Screen:"); gtk_container_add(GTK_CONTAINER(screenResolutionContainer), fullScreenLabel); // Full Screen combo GtkWidget *fullScreenCombo; fullScreenCombo = gtk_combo_new(); gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(fullScreenCombo)->entry), FALSE); gtk_container_add(GTK_CONTAINER(screenResolutionContainer), fullScreenCombo); // Center Container GtkWidget *centerContainer; centerContainer = gtk_hbox_new(TRUE,0); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), centerContainer); // Center left container GtkWidget *centerLContainer; centerLContainer = gtk_vbox_new(TRUE,0); gtk_container_add(GTK_CONTAINER(centerContainer), centerLContainer); // Gamma Correction Label GtkWidget *gammaCorrectionLabel; gammaCorrectionLabel = gtk_label_new("Gamma Correction:"); gtk_misc_set_alignment(GTK_MISC(gammaCorrectionLabel), 0, 0.5); gtk_container_add(GTK_CONTAINER(centerLContainer), gammaCorrectionLabel); // Texture Enhancement Label GtkWidget *textureEnhancementLabel; textureEnhancementLabel = gtk_label_new("Texture Enhancement:"); gtk_misc_set_alignment(GTK_MISC(textureEnhancementLabel), 0, 0.5); gtk_container_add(GTK_CONTAINER(centerLContainer), textureEnhancementLabel); // Enhancement Control Label GtkWidget *enhancementControlLabel; enhancementControlLabel = gtk_label_new("Enhancement Control:"); gtk_misc_set_alignment(GTK_MISC(enhancementControlLabel), 0, 0.5); gtk_container_add(GTK_CONTAINER(centerLContainer), enhancementControlLabel); // Force Texture Filter Label GtkWidget *forceTextureFilterLabel; forceTextureFilterLabel = gtk_label_new("Force Texture Filter:"); gtk_misc_set_alignment(GTK_MISC(forceTextureFilterLabel), 0, 0.5); gtk_container_add(GTK_CONTAINER(centerLContainer), forceTextureFilterLabel); // Center right container GtkWidget *centerRContainer; centerRContainer = gtk_vbox_new(TRUE,0); gtk_container_add(GTK_CONTAINER(centerContainer), centerRContainer); // Gamma Correction Combo GtkWidget *gammaCorrectionCombo; gammaCorrectionCombo = gtk_combo_new(); gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(gammaCorrectionCombo)->entry), FALSE); gtk_container_add(GTK_CONTAINER(centerRContainer), gammaCorrectionCombo); // Texture Enhancement Combo GtkWidget *textureEnhancementCombo; textureEnhancementCombo = gtk_combo_new(); gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(textureEnhancementCombo)->entry), FALSE); gtk_container_add(GTK_CONTAINER(centerRContainer), textureEnhancementCombo); // Enhancement Control Combo GtkWidget *enhancementControlCombo; enhancementControlCombo = gtk_combo_new(); gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(enhancementControlCombo)->entry), FALSE); gtk_container_add(GTK_CONTAINER(centerRContainer), enhancementControlCombo); // Force Texture Filter Combo GtkWidget *forceTextureFilterCombo; forceTextureFilterCombo = gtk_combo_new(); gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(forceTextureFilterCombo)->entry), FALSE); gtk_container_add(GTK_CONTAINER(centerRContainer), forceTextureFilterCombo); // Bottom Container GtkWidget *bottomContainer; bottomContainer = gtk_hbox_new(TRUE,0); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), bottomContainer); // General Options Frame GtkWidget *generalOptionsFrame; generalOptionsFrame = gtk_frame_new("General Options"); gtk_container_add(GTK_CONTAINER(bottomContainer), generalOptionsFrame); // General Options Container GtkWidget *generalOptionsContainer; generalOptionsContainer = gtk_vbox_new(TRUE,0); gtk_container_add(GTK_CONTAINER(generalOptionsFrame), generalOptionsContainer); // Emulator toolbar CheckButton GtkWidget *emulatorToolbarCheckButton; emulatorToolbarCheckButton = gtk_check_button_new_with_label("Emulator toolbar"); //gtk_container_add(GTK_CONTAINER(generalOptionsContainer), emulatorToolbarCheckButton); // Enable Fog CheckButton GtkWidget *enableFogCheckButton; enableFogCheckButton = gtk_check_button_new_with_label("Enable Fog"); gtk_container_add(GTK_CONTAINER(generalOptionsContainer), enableFogCheckButton); // Enable SSE CheckButton GtkWidget *enableSSECheckButton; enableSSECheckButton = gtk_check_button_new_with_label("Enable SSE"); gtk_container_add(GTK_CONTAINER(generalOptionsContainer), enableSSECheckButton); // Show FPS CheckButton GtkWidget *showFPSCheckButton; showFPSCheckButton = gtk_check_button_new_with_label("Show FPS"); gtk_container_add(GTK_CONTAINER(generalOptionsContainer), showFPSCheckButton); // Skip Frame CheckButton GtkWidget *skipFrameCheckButton; skipFrameCheckButton = gtk_check_button_new_with_label("Skip frame"); gtk_container_add(GTK_CONTAINER(generalOptionsContainer), skipFrameCheckButton); // Default Game Options Frame GtkWidget *defaultGameOptionsFrame; defaultGameOptionsFrame = gtk_frame_new("Default Game Options"); gtk_container_add(GTK_CONTAINER(bottomContainer), defaultGameOptionsFrame); // Default Game Options Container GtkWidget *defaultGameOptionsContainer; defaultGameOptionsContainer = gtk_vbox_new(TRUE,0); gtk_container_add(GTK_CONTAINER(defaultGameOptionsFrame), defaultGameOptionsContainer); // Default Game Options Top Container GtkWidget *defaultGameOptionsTContainer; defaultGameOptionsTContainer = gtk_hbox_new(TRUE,0); gtk_container_add(GTK_CONTAINER(defaultGameOptionsContainer), defaultGameOptionsTContainer); // Default Game Options Left Container GtkWidget *defaultGameOptionsLContainer; defaultGameOptionsLContainer = gtk_vbox_new(TRUE,0); gtk_container_add(GTK_CONTAINER(defaultGameOptionsTContainer), defaultGameOptionsLContainer); // Normal Blender CheckButton GtkWidget *normalBlenderCheckButton; normalBlenderCheckButton = gtk_check_button_new_with_label("Normal Blender"); gtk_container_add(GTK_CONTAINER(defaultGameOptionsLContainer), normalBlenderCheckButton); // Normal Combiner CheckButton GtkWidget *normalCombinerCheckButton; normalCombinerCheckButton = gtk_check_button_new_with_label("Normal Combiner"); gtk_container_add(GTK_CONTAINER(defaultGameOptionsLContainer), normalCombinerCheckButton); // Fast Texture CheckButton GtkWidget *fastTextureCheckButton; fastTextureCheckButton = gtk_check_button_new_with_label("Fast Texture"); gtk_container_add(GTK_CONTAINER(defaultGameOptionsLContainer), fastTextureCheckButton); // Frame Update at Label GtkWidget *frameUpdateAtLabel; frameUpdateAtLabel = gtk_label_new("Frame Update at:"); gtk_misc_set_alignment(GTK_MISC(frameUpdateAtLabel), 0, 0.5); gtk_container_add(GTK_CONTAINER(defaultGameOptionsLContainer), frameUpdateAtLabel); // Frame Buffer Emu Label GtkWidget *frameBufferEmuLabel; frameBufferEmuLabel = gtk_label_new("Frame Buffer Emu:"); gtk_misc_set_alignment(GTK_MISC(frameBufferEmuLabel), 0, 0.5); gtk_container_add(GTK_CONTAINER(defaultGameOptionsLContainer), frameBufferEmuLabel); // Default Game Options Right Container GtkWidget *defaultGameOptionsRContainer; defaultGameOptionsRContainer = gtk_vbox_new(TRUE,0); gtk_container_add(GTK_CONTAINER(defaultGameOptionsTContainer), defaultGameOptionsRContainer); // Fine Texture Mapping CheckButton GtkWidget *fineTextureMappingCheckButton; fineTextureMappingCheckButton = gtk_check_button_new_with_label("Fine Texture Mapping"); gtk_container_add(GTK_CONTAINER(defaultGameOptionsRContainer), fineTextureMappingCheckButton); // Force Buffer Clear CheckButton GtkWidget *forceBufferClearCheckButton; forceBufferClearCheckButton = gtk_check_button_new_with_label("Force Buffer Clear"); gtk_container_add(GTK_CONTAINER(defaultGameOptionsRContainer), forceBufferClearCheckButton); // Draw Big Textures CheckButton GtkWidget *drawBigTexturesCheckButton; drawBigTexturesCheckButton = gtk_check_button_new_with_label("Draw Big Textures"); gtk_container_add(GTK_CONTAINER(defaultGameOptionsRContainer), drawBigTexturesCheckButton); // Frame Update at Combo GtkWidget *frameUpdateAtCombo; frameUpdateAtCombo = gtk_combo_new(); gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(frameUpdateAtCombo)->entry), FALSE); gtk_container_add(GTK_CONTAINER(defaultGameOptionsRContainer), frameUpdateAtCombo); // Frame Buffer Emu Combo GtkWidget *frameBufferEmuCombo; frameBufferEmuCombo = gtk_combo_new(); gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(frameBufferEmuCombo)->entry), FALSE); gtk_container_add(GTK_CONTAINER(defaultGameOptionsRContainer), frameBufferEmuCombo); // Filling lists // frameUpdateAtCombo list GList *frameBufferSettingsList = NULL; for (int i=0; ientry, ttmsg[1].text, NULL); gtk_tooltips_set_tip(toolTips, GTK_COMBO(depthBufferSettingCombo)->entry, ttmsg[3].text, NULL); gtk_tooltips_set_tip(toolTips, GTK_COMBO(openGLColorBufferDepthCombo)->entry, ttmsg[4].text, NULL); gtk_tooltips_set_tip(toolTips, GTK_COMBO(windowModeCombo)->entry, ttmsg[5].text, NULL); gtk_tooltips_set_tip(toolTips, GTK_COMBO(fullScreenCombo)->entry, ttmsg[6].text, NULL); gtk_tooltips_set_tip(toolTips, GTK_COMBO(gammaCorrectionCombo)->entry, ttmsg[7].text, NULL); gtk_tooltips_set_tip(toolTips, GTK_COMBO(textureEnhancementCombo)->entry, ttmsg[8].text, NULL); gtk_tooltips_set_tip(toolTips, GTK_COMBO(enhancementControlCombo)->entry, ttmsg[9].text, NULL); gtk_tooltips_set_tip(toolTips, GTK_COMBO(forceTextureFilterCombo)->entry, ttmsg[10].text, NULL); gtk_tooltips_set_tip(toolTips, enableFogCheckButton, ttmsg[12].text, NULL); gtk_tooltips_set_tip(toolTips, enableSSECheckButton, ttmsg[13].text, NULL); gtk_tooltips_set_tip(toolTips, skipFrameCheckButton, ttmsg[14].text, NULL); gtk_tooltips_set_tip(toolTips, normalBlenderCheckButton, ttmsg[15].text, NULL); gtk_tooltips_set_tip(toolTips, normalCombinerCheckButton, ttmsg[16].text, NULL); gtk_tooltips_set_tip(toolTips, fastTextureCheckButton, ttmsg[17].text, NULL); gtk_tooltips_set_tip(toolTips, fineTextureMappingCheckButton, ttmsg[18].text, NULL); gtk_tooltips_set_tip(toolTips, forceBufferClearCheckButton, ttmsg[19].text, NULL); gtk_tooltips_set_tip(toolTips, drawBigTexturesCheckButton, ttmsg[20].text, NULL); gtk_tooltips_set_tip(toolTips, GTK_COMBO(frameUpdateAtCombo)->entry, ttmsg[21].text, NULL); gtk_tooltips_set_tip(toolTips, GTK_COMBO(frameBufferEmuCombo)->entry, ttmsg[22].text, NULL); // ConfigDialog structure creation ConfigDialog *configDialog = new ConfigDialog; // signal callbacks gtk_signal_connect_object(GTK_OBJECT(dialog), "delete-event", GTK_SIGNAL_FUNC(gtk_widget_hide_on_delete), GTK_OBJECT(dialog)); gtk_signal_connect(GTK_OBJECT(GTK_COMBO(textureEnhancementCombo)->entry), "changed", GTK_SIGNAL_FUNC(textureEnhancementCallback), (void*)configDialog); gtk_signal_connect(GTK_OBJECT(okButton), "clicked", GTK_SIGNAL_FUNC(okButtonCallback), (void*)configDialog); gtk_signal_connect_object(GTK_OBJECT(cancelButton), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(dialog)); gtk_signal_connect(GTK_OBJECT(aboutButton), "clicked", GTK_SIGNAL_FUNC(aboutButtonCallback), NULL); gtk_signal_connect(GTK_OBJECT(moreButton), "clicked", GTK_SIGNAL_FUNC(moreButtonCallback), NULL); // Outputing ConfigDialog structure configDialog->dialog = dialog; configDialog->combinerTypeCombo = combinerTypeCombo; configDialog->depthBufferSettingCombo = depthBufferSettingCombo; configDialog->openGLColorBufferDepthCombo = openGLColorBufferDepthCombo; configDialog->gammaCorrectionCombo = gammaCorrectionCombo; configDialog->textureEnhancementCombo = textureEnhancementCombo; configDialog->enhancementControlCombo = enhancementControlCombo; configDialog->forceTextureFilterCombo = forceTextureFilterCombo; configDialog->windowModeCombo = windowModeCombo; configDialog->fullScreenCombo = fullScreenCombo; configDialog->enableFogCheckButton = enableFogCheckButton; configDialog->enableSSECheckButton = enableSSECheckButton; configDialog->showFPSCheckButton = showFPSCheckButton; configDialog->skipFrameCheckButton = skipFrameCheckButton; configDialog->normalBlenderCheckButton = normalBlenderCheckButton; configDialog->normalCombinerCheckButton = normalCombinerCheckButton; configDialog->fastTextureCheckButton = fastTextureCheckButton; configDialog->fineTextureMappingCheckButton = fineTextureMappingCheckButton; configDialog->forceBufferClearCheckButton = forceBufferClearCheckButton; configDialog->drawBigTexturesCheckButton = drawBigTexturesCheckButton; configDialog->frameUpdateAtCombo = frameUpdateAtCombo; configDialog->frameBufferEmuCombo = frameBufferEmuCombo; return configDialog; } void ShowConfigBox() { static ConfigDialog *configDialog = NULL; if (configDialog == NULL) configDialog = CreateConfigDialog(); InitConfiguration(); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->normalBlenderCheckButton), defaultRomOptions.normalAlphaBlender); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->drawBigTexturesCheckButton), defaultRomOptions.dwEnableObjBG); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->normalCombinerCheckButton), defaultRomOptions.normalColorCombiner); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->fastTextureCheckButton), defaultRomOptions.bFastTexCRC); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->forceBufferClearCheckButton), defaultRomOptions.forceBufferClear); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->fineTextureMappingCheckButton), defaultRomOptions.accurateTextureMapping); gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(configDialog->frameUpdateAtCombo)->entry), screenUpdateSettings[defaultRomOptions.screenUpdateSetting-1]); gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(configDialog->frameBufferEmuCombo)->entry), frameBufferSettings[defaultRomOptions.N64FrameBufferEmuType]); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->enableFogCheckButton), options.enableFog); if(status.isSSESupported) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->enableSSECheckButton), options.enableSSE); } else { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->enableSSECheckButton), FALSE); gtk_widget_set_sensitive(configDialog->enableSSECheckButton, FALSE); } gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->showFPSCheckButton), options.showFPS); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configDialog->skipFrameCheckButton), options.skipFrame); for (int i=0; iwindowModeCombo)->entry), resolutions[i]); if (windowSetting.uFullScreenDisplayWidth == atoi(resolutions[i])) gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(configDialog->fullScreenCombo)->entry), resolutions[i]); } for (int i=0; icombinerTypeCombo)->entry), OpenGLRenderSettings[i].name); } gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(configDialog->gammaCorrectionCombo)->entry), gammaCorrectionSettings[options.gamma_correction]); for (int i=0; itextureEnhancementCombo)->entry), TextureEnhancementSettings[i].description); } for (int i=0; ienhancementControlCombo)->entry), TextureEnhancementControlSettings[i].description); } gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(configDialog->forceTextureFilterCombo)->entry), ForceTextureFilterSettings[options.forceTextureFilter].description); gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(configDialog->depthBufferSettingCombo)->entry), openGLDepthBufferSettings[options.OpenglDepthBufferSetting]); for (int i=0; i<2; i++) { if (openGLColorBufferSettings[i].setting == options.OpenglColorBufferSetting) gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(configDialog->openGLColorBufferDepthCombo)->entry), openGLColorBufferSettings[i].description); } if (options.textureEnhancement == TEXTURE_NO_ENHANCEMENT || options.textureEnhancement >= TEXTURE_SHARPEN_ENHANCEMENT) gtk_widget_set_sensitive(configDialog->enhancementControlCombo, FALSE); gtk_widget_set_sensitive(configDialog->frameUpdateAtCombo, FALSE); gtk_widget_set_sensitive(configDialog->drawBigTexturesCheckButton, FALSE); gtk_widget_show_all(configDialog->dialog); } #endif