--- previous/src/change.c 2018/04/24 19:30:00 1.1.1.4 +++ previous/src/change.c 2018/04/24 19:33:22 1.1.1.6 @@ -19,7 +19,6 @@ const char Change_fileid[] = "Hatari cha #include "dialog.h" #include "ioMem.h" #include "m68000.h" -#include "options.h" #include "reset.h" #include "screen.h" #include "statusbar.h" @@ -45,7 +44,7 @@ const char Change_fileid[] = "Hatari cha */ bool Change_DoNeedReset(CNF_PARAMS *current, CNF_PARAMS *changed) { - int i; + int i, j; /* Did we change ROM file? */ if (current->System.nMachineType == NEXT_CUBE030 && strcmp(current->Rom.szRom030FileName, changed->Rom.szRom030FileName)) { @@ -83,7 +82,13 @@ bool Change_DoNeedReset(CNF_PARAMS *curr printf("cpu type reset\n"); return true; } - + + /* Did we change the realtime flag? */ + if(current->System.bRealtime != changed->System.bRealtime) { + printf("realtime flag reset\n"); + return true; + } + /* Did we change FPU type? */ if (current->System.n_FPUType != changed->System.n_FPUType) { printf("fpu type reset\n"); @@ -167,6 +172,10 @@ bool Change_DoNeedReset(CNF_PARAMS *curr return true; } } + if(current->SCSI.nWriteProtection != changed->SCSI.nWriteProtection) { + printf("scsi disk reset\n"); + return true; + } /* Did we change MO drive? */ for (i = 0; i < MO_MAX_DRIVES; i++) { @@ -191,16 +200,24 @@ bool Change_DoNeedReset(CNF_PARAMS *curr } /* Did we change NeXTdimension? */ - if (current->Dimension.bEnabled != changed->Dimension.bEnabled || - strcmp(current->Dimension.szRomFileName, changed->Dimension.szRomFileName)) { - printf("dimension reset\n"); - return true; - } - for (i = 0; i < 4; i++) { - if (current->Dimension.nMemoryBankSize[i] != changed->Dimension.nMemoryBankSize[i]) { - printf("dimension memory size reset\n"); + for (i = 0; i < ND_MAX_BOARDS; i++) { + if (current->Dimension.board[i].bEnabled != changed->Dimension.board[i].bEnabled || + strcmp(current->Dimension.board[i].szRomFileName, changed->Dimension.board[i].szRomFileName)) { + printf("dimension reset\n"); return true; } + for (j = 0; j < 4; j++) { + if (current->Dimension.board[i].nMemoryBankSize[j] != changed->Dimension.board[i].nMemoryBankSize[j]) { + printf("dimension memory size reset\n"); + return true; + } + } + } + if (current->Dimension.bI860Thread != changed->Dimension.bI860Thread || + current->Dimension.bMainDisplay != changed->Dimension.bMainDisplay || + current->Dimension.nMainDisplay != changed->Dimension.nMainDisplay) { + printf("dimension display reset\n"); + return true; } /* Did we change monitor count? */ @@ -224,13 +241,9 @@ bool Change_DoNeedReset(CNF_PARAMS *curr 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 bReInitScreen = false; bool bScreenModeChange = false; - int i; Dprintf("Changes for:\n"); /* Do we need to warn user that changes will only take effect after reset? */ @@ -239,21 +252,13 @@ bool Change_CopyChangedParamsToConfigura 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 */ + /* Note: SCSI, MO and floppy disk insert/eject called from GUI */ /* Do we need to change Ethernet connection? */ - if (!NeedReset && current->Ethernet.bEthernetConnected != changed->Ethernet.bEthernetConnected) { + if (!NeedReset && + (current->Ethernet.bEthernetConnected != changed->Ethernet.bEthernetConnected || + current->Ethernet.nHostInterface != changed->Ethernet.nHostInterface || + strcmp(current->Ethernet.szInterfaceName, changed->Ethernet.szInterfaceName))) { bReInitEnetEmu = true; } @@ -267,7 +272,6 @@ bool Change_CopyChangedParamsToConfigura /* Do we need to change Screen configuration? */ if (!NeedReset && current->Screen.nMonitorType != changed->Screen.nMonitorType) { - bReInitScreen = true; } /* Copy details to configuration, @@ -281,27 +285,6 @@ bool Change_CopyChangedParamsToConfigura /* 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"); @@ -314,12 +297,6 @@ bool Change_CopyChangedParamsToConfigura Sound_Reset(); } - /* Re-init Screen */ - if (bReInitScreen) { - Dprintf("- Screen<\n"); - Screen_SetFullUpdate(); - } - /* Force things associated with screen change */ if (bScreenModeChange) { @@ -330,13 +307,16 @@ bool Change_CopyChangedParamsToConfigura /* Do we need to perform reset? */ if (NeedReset) { - const char *err_msg; + /* Check if all necessary files exist */ + Dialog_CheckFiles(); + if (bQuitProgram) + { + SDL_Quit(); + exit(-2); + } + Dprintf("- reset\n"); - err_msg=Reset_Cold(); -// if (err_msg!=NULL) { -// DlgAlert_Notice(err_msg); -// return false; -// } + Reset_Cold(); } /* Go into/return from full screen if flagged */ @@ -359,7 +339,7 @@ bool Change_CopyChangedParamsToConfigura */ static bool Change_Options(int argc, const char *argv[]) { - bool bOK; + bool bOK = false; CNF_PARAMS current; Main_PauseEmulation(false); @@ -367,10 +347,9 @@ static bool Change_Options(int argc, con /* get configuration changes */ current = ConfigureParams; ConfigureParams.Screen.bFullScreen = bInFullScreen; - bOK = Opt_ParseParameters(argc, argv); /* Check if reset is required and ask user if he really wants to continue */ - if (bOK && Change_DoNeedReset(¤t, &ConfigureParams) + if (Change_DoNeedReset(¤t, &ConfigureParams) && current.Log.nAlertDlgLogLevel > LOG_FATAL) { bOK = DlgAlert_Query("The emulated system must be " "reset to apply these changes. "