static int InpDIPSWExit() { hInpDIPSWList = NULL; hInpDIPSWDlg = NULL; if(!bAltPause && bRunPause) { bRunPause = 0; } GameInpCheckMouse(); return 0; }
static int SFactdExit() { nBurnLayer = layerBackup; nSpriteEnable = 0xFF; hSFactdlg = NULL; bShotsFactory = 0; bRunPause = bOldPause; GameInpCheckMouse(); return 0; }
static int InpCheatExit() { free(nPrevCheatSettings); nPrevCheatSettings = NULL; hInpCheatList = NULL; hInpCheatDlg = NULL; if(!bAltPause && bRunPause) { bRunPause = 0; } GameInpCheckMouse(); return 0; }
void setPauseMode(bool bPause) { bRunPause = bPause; bAltPause = bPause; if (bPause) { audio.blank(); if (useDialogs()) { InputSetCooperativeLevel(false, !bAlwaysProcessKey); } } else { GameInpCheckMouse(); } }
// ==> switch fullscreen, added by regret int scrnSwitchFull() { if (!hScrnWnd) { return 1; } DWORD styles, exStyles; if (nVidFullscreen) { styles = WS_POPUP; exStyles = 0; SetWindowLongPtr(hScrnWnd, GWL_STYLE, styles); SetWindowLongPtr(hScrnWnd, GWL_EXSTYLE, exStyles); SetMenu(hScrnWnd, NULL); bFakeFullscreen = false; } else { if (bMenuEnabled) { styles = WS_OVERLAPPEDWINDOW; exStyles = 0; } else { styles = WS_MINIMIZEBOX | WS_POPUP | WS_SYSMENU | WS_THICKFRAME; exStyles = WS_EX_CLIENTEDGE; } SetWindowLongPtr(hScrnWnd, GWL_STYLE, styles); SetWindowLongPtr(hScrnWnd, GWL_EXSTYLE, exStyles); menuCreate(); if (bMenuEnabled) { SetMenu(hScrnWnd, hMainMenu); } else { SetMenu(hScrnWnd, NULL); } scrnTitle(); scrnSize(); ShowWindow(hScrnWnd, SW_NORMAL); } VidReinit(); GameInpCheckMouse(); return 0; }
// The main message loop int RunMessageLoop() { int bRestartVideo; int finished= 0; video_fskipcounter=0; SDL_StartTicks(); do { bRestartVideo = 0; //MediaInit(); if (!bVidOkay) { // Reinit the video plugin VidInit(); if (!bVidOkay && nVidFullscreen) { nVidFullscreen = 0; VidInit(); } } RunInit(); GameInpCheckMouse(); // Hide the cursor done=0;timer = 0;ticks=0;tick=0;sdl_fps = 0; while (!finished) { if (nShouldExit==1) { finished=1; } if (nShouldExit==0) { RunIdle(); } else { usleep(10000); //10ms } } RunExit(); } while (bRestartVideo); return 0; }
// The main message loop int RunMessageLoop() { int bRestartVideo; int finished= 0; do { bRestartVideo = 0; //MediaInit(); if (!bVidOkay) { // Reinit the video plugin VidInit(); if (!bVidOkay && nVidFullscreen) { nVidFullscreen = 0; VidInit(); } } RunInit(); GameInpCheckMouse(); // Hide the cursor while (!finished) { SDL_Event event; if ( SDL_PollEvent(&event) ) { switch (event.type) { case SDL_QUIT: /* Windows was closed */ finished=1; break; } } else { RunIdle(); } } RunExit(); } while (bRestartVideo); return 0; }
static void onActivateApp(HWND hwnd, BOOL fActivate, DWORD /* dwThreadId */) { if (!kNetGame && bAutoPause && !bAltPause && dialogIsEmpty()) { bRunPause = fActivate? 0 : 1; } if (fActivate == false && hwnd == hScrnWnd) { EndMenu(); } if (fActivate == false && bRunPause) { audio.blank(); } if (fActivate) { if (!dialogIsEmpty()) { InputSetCooperativeLevel(false, !bAlwaysProcessKey); } else { GameInpCheckMouse(); } } }
// The main message loop int RunMessageLoop() { int bRestartVideo; MSG Msg; do { bRestartVideo = 0; // Remove pending initialisation messages from the queue while (PeekMessage(&Msg, NULL, WM_APP + 0, WM_APP + 0, PM_NOREMOVE)) { if (Msg.message != WM_QUIT) { PeekMessage(&Msg, NULL, WM_APP + 0, WM_APP + 0, PM_REMOVE); } } RunInit(); ShowWindow(hScrnWnd, nAppShowCmd); // Show the screen window nAppShowCmd = SW_NORMAL; SetForegroundWindow(hScrnWnd); GameInpCheckLeftAlt(); GameInpCheckMouse(); // Hide the cursor while (1) { if (PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE)) { // A message is waiting to be processed if (Msg.message == WM_QUIT) { // Quit program break; } if (Msg.message == (WM_APP + 0)) { // Restart video bRestartVideo = 1; break; } if (bMenuEnabled && nVidFullscreen == 0) { // Handle keyboard messages for the menu if (MenuHandleKeyboard(&Msg)) { continue; } } if (Msg.message == WM_SYSKEYDOWN || Msg.message == WM_KEYDOWN) { if (Msg.lParam & 0x20000000) { // An Alt/AltGr-key was pressed switch (Msg.wParam) { #if defined (FBA_DEBUG) case 'C': { static int count = 0; if (count == 0) { count++; { char* p = NULL; if (*p) { printf("crash...\n"); } } } break; } #endif case VK_OEM_PLUS: { TCHAR buffer[15]; nAudVolume += 100; if (GetAsyncKeyState(VK_CONTROL) & 0x80000000) { nAudVolume += 900; } if (nAudVolume > 10000) { nAudVolume = 10000; } if (AudSoundSetVolume() == 0) { VidSNewShortMsg(FBALoadStringEx(hAppInst, IDS_SOUND_NOVOLUME, true)); } else { _stprintf(buffer, FBALoadStringEx(hAppInst, IDS_SOUND_VOLUMESET, true), nAudVolume / 100); VidSNewShortMsg(buffer); } break; } case VK_OEM_MINUS: { TCHAR buffer[15]; nAudVolume -= 100; if (GetAsyncKeyState(VK_CONTROL) & 0x80000000) { nAudVolume -= 900; } if (nAudVolume < 0) { nAudVolume = 0; } if (AudSoundSetVolume() == 0) { VidSNewShortMsg(FBALoadStringEx(hAppInst, IDS_SOUND_NOVOLUME, true)); } else { _stprintf(buffer, FBALoadStringEx(hAppInst, IDS_SOUND_VOLUMESET, true), nAudVolume / 100); VidSNewShortMsg(buffer); } break; } case VK_MENU: { continue; } } } else { switch (Msg.wParam) { #if defined (FBA_DEBUG) case 'N': counter--; bprintf(PRINT_IMPORTANT, _T("*** New counter value: %04X.\n"), counter); break; case 'M': counter++; bprintf(PRINT_IMPORTANT, _T("*** New counter value: %04X.\n"), counter); break; #endif case VK_ESCAPE: { if (hwndChat) { DeActivateChat(); } else { if (bCmdOptUsed) { PostQuitMessage(0); } else { if (nVidFullscreen) { nVidFullscreen = 0; POST_INITIALISE_MESSAGE; } } } break; } case VK_RETURN: { if (hwndChat) { int i = 0; while (EditText[i]) { if (EditText[i++] != 0x20) { break; } } if (i) { Kaillera_Chat_Send(TCHARToANSI(EditText, NULL, 0)); //kailleraChatSend(TCHARToANSI(EditText, NULL, 0)); } DeActivateChat(); break; } if (GetAsyncKeyState(VK_CONTROL) & 0x80000000) { bMenuEnabled = !bMenuEnabled; POST_INITIALISE_MESSAGE; break; } break; } case VK_F1: { if (kNetGame) { break; } if (((GetAsyncKeyState(VK_CONTROL) | GetAsyncKeyState(VK_SHIFT)) & 0x80000000) == 0) { if (bRunPause) { bAppDoStep = 1; } else { bAppDoFast = 1; } } break; } case VK_BACK: { bShowFPS = !bShowFPS; if (bShowFPS) { DisplayFPS(); } else { VidSKillShortMsg(); VidSKillOSDMsg(); } break; } case 'T': { if (kNetGame && hwndChat == NULL) { if (AppMessage(&Msg)) { ActivateChat(); } } break; } } } } else { if (Msg.message == WM_SYSKEYUP || Msg.message == WM_KEYUP) { switch (Msg.wParam) { case VK_MENU: continue; case VK_F1: bAppDoFast = 0; break; } } } // Check for messages for dialogs etc. if (AppMessage(&Msg)) { if (TranslateAccelerator(hScrnWnd, hAccel, &Msg) == 0) { if (hwndChat) { TranslateMessage(&Msg); } DispatchMessage(&Msg); } } } else { // No messages are waiting SplashDestroy(0); RunIdle(); } } RunExit(); MediaExit(); if (bRestartVideo) { MediaInit(); } } while (bRestartVideo); return 0; }
static void onCommand(HWND hDlg, int id, HWND /*hwndCtl*/, UINT codeNotify) { if (bLoading) { return; } switch (id) { case MENU_LOAD: HK_openGame(0); break; case MENU_LOAD_QUICK: HK_quickOpenGame(0); break; case MENU_QUIT: HK_exitGame(0); break; case MENU_EXIT: StopReplay(); AviStop(); FBA_KailleraEnd(); PostQuitMessage(0); menuSync(MENUT_ALL); return; case MENU_PAUSE: HK_pause(0); break; case MENU_CARTR_MOUNT: mountCartridge(true); menuSync(MENUT_FILE); break; case MENU_CARTR_UNMOUNT: mountCartridge(false); menuSync(MENUT_FILE); break; case MENU_STARTNET: if (!kNetGame) { InputSetCooperativeLevel(false, !bAlwaysProcessKey); audio.blank(); SplashDestroy(1); StopReplay(); AviStop(); BurnerDrvExit(); // load kaillera.dll if (FBA_KailleraInit()) { DoNetGame(); } menuSync(MENUT_ALL); InputSetCooperativeLevel(false, !bAlwaysProcessKey); } break; case MENU_STARTREPLAY: HK_playRec(0); break; case MENU_STARTRECORD: HK_startRec(0); break; case MENU_STOPREPLAY: HK_stopRec(0); break; case MENU_AVISTART: HK_startAvi(0); break; case MENU_AVISTOP: HK_stopAvi(0); break; case MENU_AVIINTAUD: nAviIntAudio = !nAviIntAudio; menuSync(MENUT_FILE); break; case MENU_MEMCARD_CREATE: if (useDialogs() && bDrvOkay && !kNetGame && (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_NEOGEO) { InputSetCooperativeLevel(false, !bAlwaysProcessKey); audio.blank(); MemCardEject(); MemCardCreate(); MemCardInsert(); menuSync(MENUT_FILE); GameInpCheckMouse(); } break; case MENU_MEMCARD_SELECT: if (useDialogs() && bDrvOkay && !kNetGame && (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_NEOGEO) { InputSetCooperativeLevel(false, !bAlwaysProcessKey); audio.blank(); MemCardEject(); MemCardSelect(); MemCardInsert(); menuSync(MENUT_FILE); GameInpCheckMouse(); } break; case MENU_MEMCARD_INSERT: if (bDrvOkay && !kNetGame && (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_NEOGEO) { MemCardInsert(); } break; case MENU_MEMCARD_EJECT: if (bDrvOkay && !kNetGame && (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_NEOGEO) { MemCardEject(); } break; case MENU_MEMCARD_TOGGLE: if (bDrvOkay && !kNetGame && (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_NEOGEO) { MemCardToggle(); } break; case MENU_STATE_LOAD_DIALOG: HK_loadStateDialog(0); break; case MENU_STATE_SAVE_DIALOG: HK_saveStateDialog(0); return; case MENU_STATE_PREVSLOT: HK_prevState(0); break; case MENU_STATE_NEXTSLOT: HK_nextState(0); break; case MENU_STATE_LOAD_SLOT: HK_loadCurState(0); break; case MENU_STATE_SAVE_SLOT: HK_saveCurState(0); break; case MENU_STATE_ALLRAM: bDrvSaveAll = !bDrvSaveAll; menuSync(MENUT_FILE); break; case MENU_WLOGSTART: audio.blank(); waveLogStart(); break; case MENU_WLOGEND: audio.blank(); waveLogStop(); break; case MENU_NOSTRETCH: bVidCorrectAspect = 0; bVidFullStretch = 0; simpleReinitScrn(false); menuSync(MENUT_SETTING); break; case MENU_STRETCH: bVidFullStretch = 1; bVidCorrectAspect = 0; simpleReinitScrn(false); menuSync(MENUT_SETTING); break; case MENU_ASPECT: bVidCorrectAspect = 1; bVidFullStretch = 0; simpleReinitScrn(false); menuSync(MENUT_SETTING); break; case MENU_FULL: HK_fullscreen(0); return; case MENU_AUTOSIZE: if (nWindowSize != 0) { nWindowSize = 0; simpleReinitScrn(false); menuSync(MENUT_SETTING); } break; case MENU_WINDOWSIZE1X: HK_windowSize(1); break; case MENU_WINDOWSIZE2X: HK_windowSize(2); break; case MENU_WINDOWSIZE3X: HK_windowSize(3); break; case MENU_WINDOWSIZE4X: HK_windowSize(4); break; case MENU_WINDOWSIZEMAX: HK_windowSizeMax(0); break; case MENU_HOTKEYS: MHkeysCreate(hDlg); break; case MENU_INPUT: HK_configPad(0); break; case MENU_DIPSW: HK_setDips(0); break; case MENU_SETCPUCLOCK: audio.blank(); CPUClockDialog(hDlg); menuSync(MENUT_GAME); GameInpCheckMouse(); break; case MENU_RESETCPUCLOCK: nBurnCPUSpeedAdjust = 0x0100; menuSync(MENUT_GAME); break; // ==> rom save case MENU_SAVEC: bsavedecryptedcs = !bsavedecryptedcs; menuSync(MENUT_GAME); break; case MENU_SAVEP: bsavedecryptedps = !bsavedecryptedps; menuSync(MENUT_GAME); break; case MENU_SAVES: bsavedecrypteds1 = !bsavedecrypteds1; menuSync(MENUT_GAME); break; case MENU_SAVEV: bsavedecryptedvs = !bsavedecryptedvs; menuSync(MENUT_GAME); break; case MENU_SAVEM: bsavedecryptedm1 = !bsavedecryptedm1; menuSync(MENUT_GAME); break; case MENU_SAVEXOR: bsavedecryptedxor = !bsavedecryptedxor; menuSync(MENUT_GAME); break; case MENU_SAVEDPROM: bsavedecryptedprom = !bsavedecryptedprom; menuSync(MENUT_GAME); break; // <== rom save case MENU_LANGUAGE_SELECT: if (useDialogs()) { if (!FBALocaliseLoad()) { menuReinit(); } } break; case MENU_LANGUAGE_UNLOAD: _tcsncpy(szLanguage, _T(""), sizearray(szLanguage)); FBALocaliseExit(); menuReinit(); break; case MENU_GAMELIST_SELECT: if (useDialogs()) { loadGamelist(); } break; case MENU_GAMELIST_EXPORT: if (useDialogs()) { createGamelist(); } break; case MENU_MISCDIR_EDIT: if (useDialogs()) { pathSheetCreate(hDlg); } break; case MENU_ROMDIR_EDIT: if (useDialogs()) { RomsDirCreate(hDlg); } break; case MENU_ENABLECHEAT: HK_cheatEditor(0); break; #ifndef NO_CHEATSEARCH case MENU_CHEATSEARCH: HK_cheatSearch(0); break; #endif // ==> simple jukebox, added by regret case MENU_JUKEBOX: if (useDialogs()) { jukeCreate(); InputSetCooperativeLevel(false, !bAlwaysProcessKey); } break; // <== simple jukebox case MENU_DEBUG: if (useDialogs()) { InputSetCooperativeLevel(false, !bAlwaysProcessKey); DebugCreate(); } break; case MENU_SAVESNAP: { HK_screenShot(0); break; } case MENU_SNAPFACT: HK_shotFactory(0); break; case MENU_SKIN_SELECT: if (useDialogs()) { if (selectSkin() == 0) { simpleReinitScrn(true); } } break; case MENU_SKIN_UNLOAD: _tcsncpy(szPlaceHolder, _T(""), sizearray(szPlaceHolder)); simpleReinitScrn(true); break; case MENU_CLRMAMEPRO_XML: if (useDialogs()) { createDatfileWindows(1); } break; case MENU_CLRMAME_PRO: if (useDialogs()) { createDatfileWindows(0); } break; case MENU_SAVESET: configAppSaveXml(); break; case MENU_LOADSET: configAppLoadXml(); POST_INITIALISE_MESSAGE; break; case MENU_ABOUT: if (useDialogs()) { InputSetCooperativeLevel(false, !bAlwaysProcessKey); audio.blank(); AboutCreate(hDlg); GameInpCheckMouse(); } break; case MENU_SYSINFO: if (useDialogs()) { InputSetCooperativeLevel(false, !bAlwaysProcessKey); audio.blank(); SystemInfoCreate(hDlg); GameInpCheckMouse(); } break; case MENU_CONTENTS: { if (useDialogs()) { FILE* fp = _tfopen(_T("readme.txt"), _T("r")); if (fp) { fclose(fp); ShellExecute(NULL, _T("open"), _T("readme.txt"), NULL, NULL, SW_SHOWNORMAL); } } break; } case MENU_WWW_HOME: ShellExecute(NULL, _T("open"), _T("http://www.barryharris.me.uk/"), NULL, NULL, SW_SHOWNORMAL); break; case MENU_WWW_FORUM: ShellExecute(NULL, _T("open"), _T("http://neosource.1emulation.com/forums/"), NULL, NULL, SW_SHOWNORMAL); break; case MENU_WWW_FORUM1: ShellExecute(NULL, _T("open"), _T("http://www.egcg.com.cn/bbs/"), NULL, NULL, SW_SHOWNORMAL); break; // filters case MENU_SOFT_NONE: vidUseFilter = 0; nVidFilter = 0; VidReinit(); menuSync(MENUT_SETTING); break; case MENU_SOFT_EPXB: case MENU_SOFT_EPXC: case MENU_SOFT_SCALE2X: case MENU_SOFT_SCALE3X: case MENU_SOFT_2XSAI: case MENU_SOFT_SUPER2XSAI: case MENU_SOFT_SUPEREAGLE: case MENU_SOFT_2XPMHQ: case MENU_SOFT_HQ2X: case MENU_SOFT_HQ2XS: case MENU_SOFT_HQ2XBOLD: case MENU_SOFT_HQ3X: case MENU_SOFT_HQ3XS: case MENU_SOFT_HQ3XBOLD: case MENU_SOFT_SCANLINE: case MENU_SOFT_SCANLINE50: case MENU_SOFT_SCANLINE25: case MENU_SOFT_INTERSCANLINE: case MENU_SOFT_INTERSCANLINE50: case MENU_SOFT_INTERSCANLINE25: vidUseFilter = 1; nVidFilter = id - MENU_SOFT_NONE; scrnSize(); VidSwitchFilter(nVidFilter); menuSync(MENUT_SETTING); break; case MENU_FILTER_AUTOSIZE: vidForceFilterSize = !vidForceFilterSize; simpleReinitScrn(true); menuSync(MENUT_SETTING); break; // Options for blitters case MENU_FILTER_POINT: if (vidFilterLinear) { vidFilterLinear = 0; VidReinit(); menuSync(MENUT_SETTING); } break; case MENU_FILTER_LINEAR: if (!vidFilterLinear) { vidFilterLinear = 1; VidReinit(); menuSync(MENUT_SETTING); } break; case MENU_CONFIGALL: if (useDialogs()) { preferenceCreate(hDlg); setWindowAspect(); menuReinit(); simpleReinitScrn(true); mediaReInitAudio(); } break; case MENU_VIDEOCONFIG: if (useDialogs()) { prefVideoCreate(hDlg); setWindowAspect(); simpleReinitScrn(true); } break; case MENU_AUDIOCONFIG: if (useDialogs()) { prefAudioCreate(hDlg); mediaReInitAudio(); } break; case MENU_MISCCONFIG: if (useDialogs()) { prefMiscCreate(hDlg); menuReinit(); VidReinit(); } break; // default: // printf(" * Command %i sent.\n"); } if (ChatActivated()) { switch (codeNotify) { case EN_CHANGE: { bEditTextChanged = true; SendMessage(GetChatWindow(), WM_GETTEXT, (WPARAM)MAX_CHAT_SIZE + 1, (LPARAM)EditText); break; } case EN_KILLFOCUS: { ActivateChat(); break; } case EN_MAXTEXT: { VidSNewShortMsg(FBALoadStringEx(IDS_NETPLAY_TOOMUCH), 0xFF3F3F); break; } } } }
static int InpDIPSWExit() { GameInpCheckMouse(); return 0; }