void LoadIniSettings(){ MixVideoOutput = GetPrivateProfileBool("Display","MixLeftRight", false, IniName); MDFN_IEN_VB::SetSplitMode(GetPrivateProfileInt("Display","SplitMode", 0, IniName)); MDFN_IEN_VB::SetColorMode(GetPrivateProfileInt("Display","ColorMode", 0, IniName)); SideBySidePixels = GetPrivateProfileInt("Display","SideBySidePixels", 16, IniName); if (abs(SideBySidePixels) > 96) SideBySidePixels = 96; MDFN_IEN_VB::SetSideBySidePixels(abs(SideBySidePixels)); MDFN_IEN_VB::SetMixVideoOutput(MixVideoOutput); DisplayLeftRightOutput = GetPrivateProfileInt("Display","ViewDisplay", 0, IniName); if (DisplayLeftRightOutput > 3) DisplayLeftRightOutput = 3; MDFN_IEN_VB::SetViewDisp(DisplayLeftRightOutput); Hud.FrameCounterDisplay = GetPrivateProfileBool("Display","FrameCounter", false, IniName); Hud.ShowInputDisplay = GetPrivateProfileBool("Display","Display Input", false, IniName); Hud.ShowLagFrameCounter = GetPrivateProfileBool("Display","Display Lag Counter", false, IniName); Hud.DisplayStateSlots = GetPrivateProfileBool("Display","Display State Slots", false, IniName); soundDriver->userMute = (GetPrivateProfileBool("Main", "Muted", false, IniName)); if(soundDriver->userMute) soundDriver->mute(); //RamWatch Settings AutoRWLoad = GetPrivateProfileBool("RamWatch", "AutoRWLoad", 0, IniName); RWSaveWindowPos = GetPrivateProfileBool("RamWatch", "SaveWindowPos", 0, IniName); ramw_x = GetPrivateProfileInt("RamWatch", "WindowX", 0, IniName); ramw_y = GetPrivateProfileInt("RamWatch", "WindowY", 0, IniName); for(int i = 0; i < MAX_RECENT_WATCHES; i++) { char str[256]; sprintf(str, "Recent Watch %d", i+1); GetPrivateProfileString("Watches", str, "", &rw_recent_files[i][0], 1024, IniName); } }
void LoadIniSettings(){ Hud.FrameCounterDisplay = GetPrivateProfileBool("Display","FrameCounter", false, IniName); Hud.ShowInputDisplay = GetPrivateProfileBool("Display","Display Input", false, IniName); Hud.ShowLagFrameCounter = GetPrivateProfileBool("Display","Display Lag Counter", false, IniName); Hud.DisplayStateSlots = GetPrivateProfileBool("Display","Display State Slots", false, IniName); soundDriver->userMute = (GetPrivateProfileBool("Main", "Muted", false, IniName)); if(soundDriver->userMute) soundDriver->mute(); //RamWatch Settings AutoRWLoad = GetPrivateProfileBool("RamWatch", "AutoRWLoad", 0, IniName); RWSaveWindowPos = GetPrivateProfileBool("RamWatch", "SaveWindowPos", 0, IniName); ramw_x = GetPrivateProfileInt("RamWatch", "WindowX", 0, IniName); ramw_y = GetPrivateProfileInt("RamWatch", "WindowY", 0, IniName); for(int i = 0; i < MAX_RECENT_WATCHES; i++) { char str[256]; sprintf(str, "Recent Watch %d", i+1); GetPrivateProfileString("Watches", str, "", &rw_recent_files[i][0], 1024, IniName); } }
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) { MSG uMsg; memset(&uMsg,0,sizeof(uMsg)); winClass.lpszClassName = "MY_WINDOWS_CLASS"; winClass.cbSize = sizeof(WNDCLASSEX); winClass.style = CS_HREDRAW | CS_VREDRAW; winClass.lpfnWndProc = WndProc; winClass.hInstance = hInstance; winClass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1)); winClass.hIconSm = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1)); winClass.hCursor = LoadCursor(NULL, IDC_ARROW); winClass.lpszMenuName = MAKEINTRESOURCE(IDC_CV); winClass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); winClass.cbClsExtra = 0; winClass.cbWndExtra = 0; if( !RegisterClassEx(&winClass) ) return E_FAIL; GetINIPath(); OpenConsoleWindow = GetPrivateProfileBool("Display", "OpenConsoleWindow", true, IniName); if (OpenConsoleWindow) OpenConsole(); pcejin.aspectRatio = GetPrivateProfileBool("Video", "aspectratio", false, IniName); pcejin.windowSize = GetPrivateProfileInt("Video", "pcejin.windowSize", 1, IniName); WndX = GetPrivateProfileInt("Main", "WndX", 0, IniName); WndY = GetPrivateProfileInt("Main", "WndY", 0, IniName); g_hWnd = CreateWindowEx( NULL, "MY_WINDOWS_CLASS", pcejin.versionName.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE, WndX, WndY, 348, 224, NULL, NULL, hInstance, NULL ); if( g_hWnd == NULL ) return E_FAIL; ScaleScreen((float)pcejin.windowSize); soundInit(); LoadIniSettings(); InitSpeedThrottle(); DirectDrawInit(); InitCustomControls(); InitCustomKeys(&CustomKeys); LoadHotkeyConfig(); LoadInputConfig(); DragAcceptFiles(g_hWnd, true); extern void Agg_init(); Agg_init(); if (osd) {delete osd; osd =NULL; } osd = new OSDCLASS(-1); di_init(); DWORD wmTimerRes; TIMECAPS tc; if (timeGetDevCaps(&tc, sizeof(TIMECAPS))== TIMERR_NOERROR) { wmTimerRes = std::min(std::max(tc.wPeriodMin, (UINT)1), tc.wPeriodMax); timeBeginPeriod (wmTimerRes); } else { wmTimerRes = 5; timeBeginPeriod (wmTimerRes); } if (KeyInDelayMSec == 0) { DWORD dwKeyboardDelay; SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0, &dwKeyboardDelay, 0); KeyInDelayMSec = 250 * (dwKeyboardDelay + 1); } if (KeyInRepeatMSec == 0) { DWORD dwKeyboardSpeed; SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &dwKeyboardSpeed, 0); KeyInRepeatMSec = (int)(1000.0/(((30.0-2.5)/31.0)*dwKeyboardSpeed+2.5)); } if (KeyInRepeatMSec < (int)wmTimerRes) KeyInRepeatMSec = (int)wmTimerRes; if (KeyInDelayMSec < KeyInRepeatMSec) KeyInDelayMSec = KeyInRepeatMSec; hKeyInputTimer = timeSetEvent (KeyInRepeatMSec, 0, KeyInputTimer, 0, TIME_PERIODIC); ShowWindow( g_hWnd, nCmdShow ); UpdateWindow( g_hWnd ); initialize(); if (lpCmdLine[0])ParseCmdLine(lpCmdLine, g_hWnd); while( uMsg.message != WM_QUIT ) { if( PeekMessage( &uMsg, NULL, 0, 0, PM_REMOVE ) ) { TranslateMessage( &uMsg ); DispatchMessage( &uMsg ); } else { emulate(); render(); } if(!pcejin.started) Sleep(1); } // shutDown(); timeEndPeriod (wmTimerRes); CloseAllToolWindows(); UnregisterClass( "MY_WINDOWS_CLASS", winClass.hInstance ); return uMsg.wParam; }