Exemplo n.º 1
0
static bool nf_shutdown(Uint32 stack, Uint32 subid, Uint32 *retval)
{
	Dprintf(("NF shutdown()\n"));
	ConfigureParams.Log.bConfirmQuit = false;
	Main_RequestQuit();
	return true;
}
Exemplo n.º 2
0
/**
 * NF_SHUTDOWN - exit emulator normally
 * Needs to be called from supervisor mode
 */
static bool nf_shutdown(Uint32 stack, Uint32 subid, Uint32 *retval)
{
    LOG_TRACE(TRACE_NATFEATS, "NF_SHUTDOWN()\n");
    ConfigureParams.Log.bConfirmQuit = false;
    Main_RequestQuit(0);
    return true;
}
Exemplo n.º 3
0
/**
 * NF_EXIT - exit emulator with given exit code
 * Stack arguments are:
 * - emulator's int32_t exit value
 */
static bool nf_exit(Uint32 stack, Uint32 subid, Uint32 *retval)
{
    Sint32 exitval;

    ConfigureParams.Log.bConfirmQuit = false;
    exitval = STMemory_ReadLong(stack);
    LOG_TRACE(TRACE_NATFEATS, "NF_EXIT(%d)\n", exitval);
    Main_RequestQuit(exitval);
    return true;
}
Exemplo n.º 4
0
/**
 * Command: Quit emulator
 */
static int DebugUI_QuitEmu(int nArgc, char *psArgv[])
{
	int exitval;

	if (nArgc > 2)
		return DebugUI_PrintCmdHelp(psArgv[0]);

	if (nArgc == 2)
		exitval = atoi(psArgv[1]);
	else
		exitval = 0;

	ConfigureParams.Log.bConfirmQuit = false;
	Main_RequestQuit(exitval);
	return DEBUGGER_END;
}
Exemplo n.º 5
0
/**
 * Open Property sheet Options dialog.
 * 
 * We keep all our configuration details in a structure called
 * 'ConfigureParams'. When we open our dialog we make a backup
 * of this structure. When the user finally clicks on 'OK',
 * we can compare and makes the necessary changes.
 * 
 * Return true if user chooses OK, or false if cancel!
 */
bool Dialog_DoProperty(void)
{
	bool bOKDialog;  /* Did user 'OK' dialog? */
	bool bForceReset;
	bool bLoadedSnapshot;
	CNF_PARAMS current;

	Main_PauseEmulation(true);
	bForceReset = false;

	/* Copy details (this is so can restore if 'Cancel' dialog) */
	current = ConfigureParams;
	ConfigureParams.Screen.bFullScreen = bInFullScreen;
	bOKDialog = Dialog_MainDlg(&bForceReset, &bLoadedSnapshot);

	/* If a memory snapshot has been loaded, no further changes are required */
	if (bLoadedSnapshot)
	{
		Main_UnPauseEmulation();
		return true;
	}

	/* Check if reset is required and ask user if he really wants to continue then */
	if (bOKDialog && !bForceReset
	    && Change_DoNeedReset(&current, &ConfigureParams)
	    && ConfigureParams.Log.nAlertDlgLogLevel > LOG_FATAL) {
		bOKDialog = DlgAlert_Query("The emulated system must be "
		                           "reset to apply these changes. "
		                           "Apply changes now and reset "
		                           "the emulator?");
	}

	/* Copy details to configuration */
	if (bOKDialog) {
		Change_CopyChangedParamsToConfiguration(&current, &ConfigureParams, bForceReset);
	} else {
		ConfigureParams = current;
	}

	Main_UnPauseEmulation();
    
	if (bQuitProgram)
		Main_RequestQuit();
 
	return bOKDialog;
}
Exemplo n.º 6
0
/**
 * Check to see if pressed any shortcut keys, and call handling function
 */
void ShortCut_ActKey(void)
{
	if (ShortCutKey == SHORTCUT_NONE)
		return;

	switch (ShortCutKey)
	{
	 case SHORTCUT_OPTIONS:
		Dialog_DoProperty();           /* Show options dialog */
		break;
	 case SHORTCUT_FULLSCREEN:
		ShortCut_FullScreen();         /* Switch between fullscreen/windowed mode */
		break;
	 case SHORTCUT_MOUSEGRAB:
		ShortCut_MouseGrab();          /* Toggle mouse grab */
		break;
	 case SHORTCUT_COLDRESET:
		Main_UnPauseEmulation();
		Reset_Cold();                  /* Reset emulator with 'cold' (clear all) */
		break;
#if 0
	 case SHORTCUT_WARMRESET:
		Main_UnPauseEmulation();
		Reset_Warm();                  /* Emulator 'warm' reset */
		break;
	 case SHORTCUT_SCREENSHOT:
		ScreenSnapShot_SaveScreen();   /* Grab screenshot */
		break;
	 case SHORTCUT_BOSSKEY:
		ShortCut_BossKey();            /* Boss key */
		break;
	 case SHORTCUT_CURSOREMU:          /* Toggle joystick emu on/off */
		Joy_ToggleCursorEmulation();
		break;
	 case SHORTCUT_FASTFORWARD:
		ShortCut_FastForward();       /* Toggle Min/Max speed */
		break;
	 case SHORTCUT_RECANIM:
		ShortCut_RecordAnimation();    /* Record animation */
		break;
	 case SHORTCUT_RECSOUND:
		ShortCut_RecordSound();        /* Toggle sound recording */
		break;
#endif
	 case SHORTCUT_SOUND:
		ShortCut_SoundOnOff();         /* Enable/disable sound */
		break;
#if 0
	 case SHORTCUT_DEBUG:
		ShortCut_Debug();              /* Invoke the Debug UI */
		break;
#endif
	 case SHORTCUT_PAUSE:
		ShortCut_Pause();              /* Invoke Pause */
		break;
	 case SHORTCUT_QUIT:
		Main_RequestQuit();
		break;
#if 0
	 case SHORTCUT_LOADMEM:
		MemorySnapShot_Restore(ConfigureParams.Memory.szMemoryCaptureFileName, true);
		break;
	 case SHORTCUT_SAVEMEM:
		MemorySnapShot_Capture(ConfigureParams.Memory.szMemoryCaptureFileName, true);
		break;
#endif
	 case SHORTCUT_DIMENSION:
		ShortCut_Dimension();
		break;
	 case SHORTCUT_KEYS:
	 case SHORTCUT_NONE:
		/* ERROR: cannot happen, just make compiler happy */
	 default:
		break;
	}
	ShortCutKey = SHORTCUT_NONE;
}
Exemplo n.º 7
0
void Dialog_CheckFiles(void) {
    bool bOldMouseVisibility;
    int i;
    bOldMouseVisibility = SDL_ShowCursor(SDL_QUERY);
    SDL_ShowCursor(SDL_ENABLE);
    
    /* Check if ROM file exists. If it is missing present a dialog to select a new ROM file. */
    switch (ConfigureParams.System.nMachineType) {
        case NEXT_CUBE030:
            while (!File_Exists(ConfigureParams.Rom.szRom030FileName)) {
                DlgMissing_Rom();
                if (bQuitProgram) {
                    Main_RequestQuit();
                    if (bQuitProgram)
                        return;
                }
            }
            break;
        case NEXT_CUBE040:
        case NEXT_STATION:
            if (ConfigureParams.System.bTurbo) {
                while (!File_Exists(ConfigureParams.Rom.szRomTurboFileName)) {
                    DlgMissing_Rom();
                    if (bQuitProgram) {
                        Main_RequestQuit();
                        if (bQuitProgram)
                            return;
                    }
                }
            } else {
                while (!File_Exists(ConfigureParams.Rom.szRom040FileName)) {
                    DlgMissing_Rom();
                    if (bQuitProgram) {
                        Main_RequestQuit();
                        if (bQuitProgram)
                            return;
                    }
                }
            }
            break;
            
        default:
            break;
    }
    
    /* Check if SCSI disk images exist. Present a dialog to select missing files. */
    for (i = 0; i < ESP_MAX_DEVS; i++) {
        while ((ConfigureParams.SCSI.target[i].nDeviceType!=DEVTYPE_NONE) &&
               ConfigureParams.SCSI.target[i].bDiskInserted &&
               !File_Exists(ConfigureParams.SCSI.target[i].szImageName)) {
            DlgMissing_Disk("SCSI disk", i,
                            ConfigureParams.SCSI.target[i].szImageName,
                            &ConfigureParams.SCSI.target[i].bDiskInserted,
                            &ConfigureParams.SCSI.target[i].bWriteProtected);
            if (ConfigureParams.SCSI.target[i].nDeviceType==DEVTYPE_HARDDISK &&
                !ConfigureParams.SCSI.target[i].bDiskInserted) {
                ConfigureParams.SCSI.target[i].nDeviceType=DEVTYPE_NONE;
            }
            if (bQuitProgram) {
                Main_RequestQuit();
                if (bQuitProgram)
                    return;
            }
        }
    }
    
    /* Check if MO disk images exist. Present a dialog to select missing files. */
    for (i = 0; i < MO_MAX_DRIVES; i++) {
        while (ConfigureParams.MO.drive[i].bDriveConnected &&
               ConfigureParams.MO.drive[i].bDiskInserted &&
               !File_Exists(ConfigureParams.MO.drive[i].szImageName)) {
            DlgMissing_Disk("MO disk", i,
                            ConfigureParams.MO.drive[i].szImageName,
                            &ConfigureParams.MO.drive[i].bDiskInserted,
                            &ConfigureParams.MO.drive[i].bWriteProtected);
            if (bQuitProgram) {
                Main_RequestQuit();
                if (bQuitProgram)
                    return;
            }
        }
    }

    /* Check if Floppy disk images exist. Present a dialog to select missing files. */
    for (i = 0; i < FLP_MAX_DRIVES; i++) {
        while (ConfigureParams.Floppy.drive[i].bDriveConnected &&
               ConfigureParams.Floppy.drive[i].bDiskInserted &&
               !File_Exists(ConfigureParams.Floppy.drive[i].szImageName)) {
            DlgMissing_Disk("Floppy", i,
                            ConfigureParams.Floppy.drive[i].szImageName,
                            &ConfigureParams.Floppy.drive[i].bDiskInserted,
                            &ConfigureParams.Floppy.drive[i].bWriteProtected);
            if (bQuitProgram) {
                Main_RequestQuit();
                if (bQuitProgram)
                    return;
            }
        }
    }

    SDL_ShowCursor(bOldMouseVisibility);
}
Exemplo n.º 8
0
Arquivo: main.c Projeto: jsdf/previous
/**
 * SDL message handler.
 * Here we process the SDL events (keyboard, mouse, ...) and map it to
 * Atari IKBD events.
 */
void Main_EventHandler(void)
{
	bool bContinueProcessing;
	SDL_Event event;
	int events;
	int remotepause;

	do
	{
		bContinueProcessing = false;

		/* check remote process control */
		remotepause = Control_CheckUpdates();

		if ( bEmulationActive || remotepause )
		{
			events = SDL_PollEvent(&event);
		}
		else
		{
			ShortCut_ActKey();
			/* last (shortcut) event activated emulation? */
			if ( bEmulationActive )
				break;
			events = SDL_WaitEvent(&event);
		}
		if (!events)
		{
			/* no events -> if emulation is active or
			 * user is quitting -> return from function.
			 */
			continue;
		}
		switch (event.type)
		{

		 case SDL_QUIT:
			Main_RequestQuit();
			break;
			
		 case SDL_MOUSEMOTION:               /* Read/Update internal mouse position */
			Main_HandleMouseMotion(&event);
			bContinueProcessing = false;
			break;

		 case SDL_MOUSEBUTTONDOWN:
			if (event.button.button == SDL_BUTTON_LEFT)
			{
				if (ConfigureParams.Mouse.bEnableAutoGrab && !bGrabMouse) {
					bGrabMouse = true;        /* Toggle flag */

					/* If we are in windowed mode, toggle the mouse cursor mode now: */
					if (!bInFullScreen)
					{
						SDL_SetRelativeMouseMode(SDL_TRUE);
                        SDL_SetWindowGrab(sdlWindow, SDL_TRUE);
						Main_SetTitle(MOUSE_LOCK_MSG);
					}
				}
                
                Keymap_MouseDown(true);
			}
			else if (event.button.button == SDL_BUTTON_RIGHT)
			{
                Keymap_MouseDown(false);
//				Keyboard.bRButtonDown |= BUTTON_MOUSE;
			}
			else if (event.button.button == SDL_BUTTON_MIDDLE)
			{
				/* Start double-click sequence in emulation time */
//				Keyboard.LButtonDblClk = 1;
			}
			break;

		 case SDL_MOUSEBUTTONUP:
			if (event.button.button == SDL_BUTTON_LEFT)
			{
                Keymap_MouseUp(true);
//				Keyboard.bLButtonDown &= ~BUTTON_MOUSE;
			}
			else if (event.button.button == SDL_BUTTON_RIGHT)
			{
                Keymap_MouseUp(false);
//				Keyboard.bRButtonDown &= ~BUTTON_MOUSE;
			}
			break;

		 case SDL_KEYDOWN:
            if (ConfigureParams.Keyboard.bDisableKeyRepeat && event.key.repeat)
                break;

            Keymap_KeyDown(&event.key.keysym);
			break;

		 case SDL_KEYUP:
			Keymap_KeyUp(&event.key.keysym);
			break;
                

		default:
			/* don't let unknown events delay event processing */
			bContinueProcessing = true;
			break;
		}
	} while (bContinueProcessing || !(bEmulationActive || bQuitProgram));
}