Beispiel #1
0
/**
 * Restore 'snapshot' of memory/chips/emulation variables
 */
void MemorySnapShot_Restore(const char *pszFileName, bool bConfirm)
{
	/* Set to 'restore' */
	if (MemorySnapShot_OpenFile(pszFileName, false))
	{
		Configuration_MemorySnapShot_Capture(false);

		/* Reset emulator to get things running */
		IoMem_UnInit();  IoMem_Init();
		Reset_Cold();

		/* Capture each files details */
//		STMemory_MemorySnapShot_Capture(false);
		CycInt_MemorySnapShot_Capture(false);
		Cycles_MemorySnapShot_Capture(false);
		M68000_MemorySnapShot_Capture(false);
		Video_MemorySnapShot_Capture(false);
		DebugUI_MemorySnapShot_Capture(pszFileName, false);
//		IoMem_MemorySnapShot_Capture(false);

		/* And close */
		MemorySnapShot_CloseFile();

		/* changes may affect also info shown in statusbar */
		Statusbar_UpdateInfo();
	}

	/* Did error? */
	if (bCaptureError)
		Log_AlertDlg(LOG_ERROR, "Unable to restore memory state from file.");
	else if (bConfirm)
		Log_AlertDlg(LOG_INFO, "Memory state file restored.");
}
Beispiel #2
0
/**
 * This function is called to fix falconBusMode (0 = Falcon STe bus compatibility, other value = Falcon only bus compatibility)
 * This value comes from register $ff8007.b (Bit 5) and is called by ioMemTabFalcon
 */
void IoMem_Init_FalconInSTeBuscompatibilityMode(Uint8 value)
{
	if (value == 0)
		falconBusMode = STE_BUS_COMPATIBLE;
	else
		falconBusMode = FALCON_ONLY_BUS;

	IoMem_Init();
}
Beispiel #3
0
/**
 * Copy details back to configuration and perform reset.
 */
bool Change_CopyChangedParamsToConfiguration(CNF_PARAMS *current, CNF_PARAMS *changed, bool bForceReset)
{
	bool NeedReset;
	bool bReInitSCSIEmu = false;
	bool bReInitEnetEmu = false;
    bool bReInitSoundEmu = false;
	bool bReInitIoMem = false;
	bool bScreenModeChange = false;
	int i;

	Dprintf("Changes for:\n");
	/* Do we need to warn user that changes will only take effect after reset? */
	if (bForceReset)
		NeedReset = bForceReset;
	else
		NeedReset = Change_DoNeedReset(current, changed);
    
    /* Do we need to change SCSI disks? */
    for (i = 0; i < ESP_MAX_DEVS; i++) {
        if (!NeedReset &&
            (current->SCSI.target[i].bDiskInserted != changed->SCSI.target[i].bDiskInserted ||
             current->SCSI.target[i].bWriteProtected != changed->SCSI.target[i].bWriteProtected ||
             strcmp(current->SCSI.target[i].szImageName, changed->SCSI.target[i].szImageName))) {
            bReInitSCSIEmu = true;
            break;
        }
    }
    
    /* Note: MO and floppy disk insert/eject called from GUI */
    
    /* Do we need to change Ethernet connection? */
    if (!NeedReset && current->Ethernet.bEthernetConnected != changed->Ethernet.bEthernetConnected) {
        bReInitEnetEmu = true;
    }
    
    /* Do we need to change Sound configuration? */
    if (!NeedReset &&
        (current->Sound.bEnableSound != changed->Sound.bEnableSound ||
         current->Sound.bEnableMicrophone != changed->Sound.bEnableMicrophone)) {
        bReInitSoundEmu = true;
    }

	/* Copy details to configuration,
	 * so it can be saved out or set on reset
	 */
	if (changed != &ConfigureParams)
	{
		ConfigureParams = *changed;
	}

	/* Copy details to global, if we reset copy them all */
	Configuration_Apply(NeedReset);
    
    /* Check if all necessary files exist */
    Dialog_CheckFiles();
    if (bQuitProgram)
    {
        SDL_Quit();
        exit(-2);
    }

	/* Re-init IO memory map? */
	if (bReInitIoMem)
	{
		Dprintf("- IO mem<\n");
		IoMem_Init();
	}
    
    /* Re-init SCSI disks? */
    if (bReInitSCSIEmu) {
        Dprintf("- SCSI disks<\n");
        SCSI_Reset();
    }
    
    /* Re-init Ethernet? */
    if (bReInitEnetEmu) {
        Dprintf("- Ethernet<\n");
        Ethernet_Reset(false);
    }
    
    /* Re-init Sound? */
    if (bReInitSoundEmu) {
        Dprintf("- Sound<\n");
        Sound_Reset();
    }

	/* Force things associated with screen change */
	if (bScreenModeChange)
	{
		Dprintf("- screenmode<\n");
		Screen_ModeChanged();
	}

	/* Do we need to perform reset? */
	if (NeedReset)
	{
		const char *err_msg;
		Dprintf("- reset\n");
		err_msg=Reset_Cold();
//		if (err_msg!=NULL) {
//			DlgAlert_Notice(err_msg);
//			return false;
//		}
	}

	/* Go into/return from full screen if flagged */
	if (!bInFullScreen && ConfigureParams.Screen.bFullScreen)
		Screen_EnterFullScreen();
	else if (bInFullScreen && !ConfigureParams.Screen.bFullScreen)
		Screen_ReturnFromFullScreen();

	/* update statusbar info (CPU, MHz, mem etc) */
	Statusbar_UpdateInfo();
	Dprintf("done.\n");
	return true;
}
Beispiel #4
0
/**
 * Initialise emulation
 */
static void Main_Init(void)
{
	/* Open debug log file */
	if (!Log_Init())
	{
		fprintf(stderr, "Logging/tracing initialization failed\n");
		exit(-1);
	}
	Log_Printf(LOG_INFO, PROG_NAME ", compiled on:  " __DATE__ ", " __TIME__ "\n");

	/* Init SDL's video subsystem. Note: Audio and joystick subsystems
	   will be initialized later (failures there are not fatal). */
	if (SDL_Init(SDL_INIT_VIDEO | Opt_GetNoParachuteFlag()) < 0)
	{
		fprintf(stderr, "Could not initialize the SDL library:\n %s\n", SDL_GetError() );
		exit(-1);
	}
	ClocksTimings_InitMachine ( ConfigureParams.System.nMachineType );
	Resolution_Init();
	SDLGui_Init();
	Screen_Init();
	Main_SetTitle(NULL);
//	HostScreen_Init();
	DSP_Init();
//	Floppy_Init();
	M68000_Init();                /* Init CPU emulation */
//	Audio_Init();
//	DmaSnd_Init();
	Keymap_Init();


    /* call menu at startup */
    if (!File_Exists(sConfigFileName) || ConfigureParams.ConfigDialog.bShowConfigDialogAtStartup)
        Dialog_DoProperty();
    else
        Dialog_CheckFiles();
    
    if (bQuitProgram)
    {
        SDL_Quit();
        exit(-2);
    }
    
    
//    const char *err_msg;
//    
//    while ((err_msg=Reset_Cold())!=NULL)
//    {
//        DlgMissing_Rom();
//        if (bQuitProgram) {
//            Main_RequestQuit();
//            break;
//        }
//    }

    Reset_Cold();
    
//    if (bQuitProgram) {
//        SDL_Quit();
//        exit(-2);
//    }
	IoMem_Init();
	
	/* done as last, needs CPU & DSP running... */
	DebugUI_Init();
}