int Atari_Exit(int run_monitor) { /* restore to text mode */ ShutdownVgaEnvironment(); key_delete(); /* enable keyboard in monitor */ if (run_monitor) { #ifdef SOUND Sound_Pause(); #endif if (monitor()) { #ifdef MONITOR_BREAK if (!break_step) /*do not enter videomode when stepping through the code*/ #endif SetupVgaEnvironment(); #ifdef SOUND Sound_Continue(); #endif return 1; /* return to emulation */ } } #ifdef SOUND Sound_Exit(); #endif Aflushlog(); return 0; }
void OnActivateApp(HWND hWnd, BOOL fActivate, DWORD dwThreadId) { bActive = fActivate; if (bActive) { kbreacquire(); #ifdef SOUND Sound_Continue(); #endif } }
int PLATFORM_Exit(int run_monitor) { int restart; if (run_monitor) { #ifdef SOUND Sound_Pause(); #endif restart = MONITOR_Run(); #ifdef SOUND Sound_Continue(); #endif } else { restart = FALSE; } if (restart) { return 1; } return restart; }
int PLATFORM_Exit(int run_monitor) { SDL_INPUT_Exit(); /* If the SDL window was left not closed, it would be unusable and hanging for the time the monitor is active. Also, with SDL_VIDEODRIVER=directx all keyboard presses in console would be still fetched by the SDL window after leaving the monitor. To avoid the problems, close the video subsystem. */ SDL_VIDEO_Exit(); Log_flushlog(); if (run_monitor) { #ifdef SOUND Sound_Pause(); #endif if (MONITOR_Run()) { /* Reinitialise the SDL subsystem. */ #ifdef MONITOR_BREAK if (!MONITOR_break_step) /*Do not initialise videomode when stepping through code */ #endif { SDL_VIDEO_InitSDL(); SDL_INPUT_Restart(); /* This call reopens the SDL window. */ VIDEOMODE_Update(); } #ifdef SOUND Sound_Continue(); #endif return 1; } } #ifdef SOUND Sound_Exit(); #endif return 0; }
int PLATFORM_Exit(int run_monitor) { int restart; SDL_INPUT_Exit(); /* If the SDL window was left not closed, it would be unusable and hanging for the time the monitor is active. Also, with SDL_VIDEODRIVER=directx all keyboard presses in console would be still fetched by the SDL window after leaving the monitor. To avoid the problems, close the video subsystem. */ SDL_VIDEO_Exit(); if (run_monitor) { #ifdef SOUND Sound_Pause(); #endif restart = MONITOR_Run(); #ifdef SOUND Sound_Continue(); #endif } else { restart = FALSE; } if (restart) { /* Reinitialise the SDL subsystem. */ SDL_VIDEO_InitSDL(); SDL_INPUT_Restart(); /* This call reopens the SDL window. */ VIDEOMODE_Update(); return 1; } SDL_Quit(); Log_flushlog(); return restart; }
extern "C" LRESULT CALLBACK Atari_WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int nx, ny; switch (message) { HANDLE_MSG(hWnd, WM_SIZE, OnSize); HANDLE_MSG(hWnd, WM_ACTIVATEAPP, OnActivateApp); HANDLE_MSG(hWnd, WM_SYSCHAR, OnSysChar); HANDLE_MSG(hWnd, WM_CLOSE, OnClose); HANDLE_MSG(hWnd, WM_DESTROY, OnDestroy); HANDLE_MSG(hWnd, WM_COMMAND, OnCommand); case WM_LBUTTONDOWN: case WM_LBUTTONUP: case WM_MBUTTONDOWN: case WM_MBUTTONUP: case WM_RBUTTONDOWN: case WM_RBUTTONUP: INPUT_mouse_buttons = ((wParam & MK_LBUTTON) ? 1 : 0) | ((wParam & MK_RBUTTON) ? 2 : 0) | ((wParam & MK_MBUTTON) ? 4 : 0); // handle mouse clicks in the config UI if (UI_is_active) { switch (INPUT_mouse_buttons) { case 1: getnativecoords(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), &nx, &ny); SetMouseIndex(nx, ny); keycommand.keystroke = AKEY32_UI_MOUSE_CLICK; break; case 2: keycommand.keystroke = AKEY_ESCAPE; keycommand.function = -1; break; case 4: keycommand.keystroke = AKEY_RETURN; keycommand.function = -1; break; } } break; case WM_LBUTTONDBLCLK: if (UI_is_active && UI_mouse_click.y != -1) { keycommand.keystroke = AKEY_RETURN; keycommand.function = -1; } break; case WM_MOUSEWHEEL: if (UI_is_active) { if (GET_WHEEL_DELTA_WPARAM(wParam) / WHEEL_DELTA > 0) keycommand.keystroke = AKEY_UP; else if (GET_WHEEL_DELTA_WPARAM(wParam) / WHEEL_DELTA < 0) keycommand.keystroke = AKEY_DOWN; } break; case WM_MOUSEHWHEEL: if (UI_is_active) { if (GET_WHEEL_DELTA_WPARAM(wParam) / WHEEL_DELTA > 0) keycommand.keystroke = AKEY_RIGHT; else if (GET_WHEEL_DELTA_WPARAM(wParam) / WHEEL_DELTA < 0) keycommand.keystroke = AKEY_LEFT; } break; case WM_SETCURSOR: if (GetRenderMode() == DIRECTDRAW) { SetCursor(NULL); return TRUE; } break; case WM_ENTERMENULOOP: Sound_Pause(); break; case WM_EXITMENULOOP: if (!UI_is_active) Sound_Continue(); break; } return DefWindowProc(hWnd, message, wParam, lParam); }
int main(int argc, char **argv) { /* initialise Atari800 core */ if (!Atari800_Initialise(&argc, argv)) return 3; /* main loop */ while (TRUE) { int refresh_counter = 0; int keycode = Atari_Keyboard(); switch (keycode) { case AKEY_COLDSTART: Coldstart(); break; case AKEY_WARMSTART: Warmstart(); break; case AKEY_EXIT: Atari800_Exit(FALSE); exit(1); case AKEY_UI: #ifdef SOUND Sound_Pause(); #endif ui((UBYTE *)atari_screen); #ifdef SOUND Sound_Continue(); #endif break; case AKEY_SCREENSHOT: Save_PCX_file(FALSE, Find_PCX_name()); break; case AKEY_SCREENSHOT_INTERLACE: Save_PCX_file(TRUE, Find_PCX_name()); break; case AKEY_BREAK: key_break = 1; break; default: key_break = 0; key_code = keycode; break; } if (mouse_mode != MOUSE_OFF) { union REGS rg; rg.x.ax = 0x0b; int86(0x33, &rg, &rg); mouse_delta_x = (short) rg.x.cx; /* signed! */ mouse_delta_y = (short) rg.x.dx; /* signed! */ rg.x.ax = 0x03; int86(0x33, &rg, &rg); mouse_buttons = rg.x.bx; } if (++refresh_counter == refresh_rate) { Atari800_Frame(EMULATE_FULL); #ifndef DONT_SYNC_WITH_HOST atari_sync(); /* here seems to be the best place to sync */ #endif update_disk_led(); Atari_DisplayScreen((UBYTE *) atari_screen); refresh_counter = 0; } else { #ifdef VERY_SLOW Atari800_Frame(EMULATE_BASIC); #else /* VERY_SLOW */ Atari800_Frame(EMULATE_NO_SCREEN); #ifndef DONT_SYNC_WITH_HOST atari_sync(); #endif #endif /* VERY_SLOW */ } } }