From 3482a1a1cfbc7bedc87d6ca52756a2c1f5d2b856 Mon Sep 17 00:00:00 2001 From: Vincent Cunningham Date: Mon, 1 Feb 2021 23:42:54 -0500 Subject: [PATCH 1/2] Call RunLoadedImage when manually starting emulation RunLoadedImage is skipped in the Run*Image methods in CN64System if AutoStart is disabled. If the check for if there is a current g_BaseSystem fails, these changes run RunLoadedImage to create one and StartEmulation. I'm not sure the extra NULL guard is necessary, but I don't want to skip the first g_BaseSystem check altogether. I added it as a "just in case." --- Source/Project64/UserInterface/MainMenu.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Source/Project64/UserInterface/MainMenu.cpp b/Source/Project64/UserInterface/MainMenu.cpp index 0cee54773..dfaae0a83 100644 --- a/Source/Project64/UserInterface/MainMenu.cpp +++ b/Source/Project64/UserInterface/MainMenu.cpp @@ -304,6 +304,15 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI { g_BaseSystem->StartEmulation(true); } + else if (g_Settings->LoadBool(Setting_AutoStart) == 0) + { + WriteTrace(TraceN64System, TraceDebug, "Manually starting rom"); + CN64System::RunLoadedImage(); + if (g_BaseSystem == NULL) + { + g_Notify->BreakPoint(__FILE__, __LINE__); + } + } else { g_Notify->BreakPoint(__FILE__, __LINE__); From 678c5819e8a88640a32010eec7dd7bf27b5e8dbb Mon Sep 17 00:00:00 2001 From: Vincent Cunningham Date: Tue, 2 Feb 2021 10:27:23 -0500 Subject: [PATCH 2/2] Only skip StartEmulation in RunLoadedImage when AutoStart disabled --- Source/Project64-core/N64System/N64Class.cpp | 24 +++++++------------- Source/Project64/UserInterface/MainMenu.cpp | 13 ++++------- 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/Source/Project64-core/N64System/N64Class.cpp b/Source/Project64-core/N64System/N64Class.cpp index a0e3a6a3b..06ce73ae1 100644 --- a/Source/Project64-core/N64System/N64Class.cpp +++ b/Source/Project64-core/N64System/N64Class.cpp @@ -515,11 +515,7 @@ bool CN64System::RunFileImage(const char * FileLoc) g_Settings->SaveString(File_DiskIPLTOOLPath, FileLoc); } - if (g_Settings->LoadBool(Setting_AutoStart) != 0) - { - WriteTrace(TraceN64System, TraceDebug, "Automattically starting rom"); - RunLoadedImage(); - } + RunLoadedImage(); return true; } @@ -537,11 +533,7 @@ bool CN64System::RunDiskImage(const char * FileLoc) } g_Settings->SaveBool(Setting_EnableDisk, true); - if (g_Settings->LoadBool(Setting_AutoStart) != 0) - { - WriteTrace(TraceN64System, TraceDebug, "Automattically starting rom"); - RunLoadedImage(); - } + RunLoadedImage(); return true; } @@ -563,11 +555,7 @@ bool CN64System::RunDiskComboImage(const char * FileLoc, const char * FileLocDis } g_Settings->SaveBool(Setting_EnableDisk, true); - if (g_Settings->LoadBool(Setting_AutoStart) != 0) - { - WriteTrace(TraceN64System, TraceDebug, "Automattically starting rom"); - RunLoadedImage(); - } + RunLoadedImage(); return true; } @@ -577,7 +565,11 @@ void CN64System::RunLoadedImage(void) g_BaseSystem = new CN64System(g_Plugins, (uint32_t)time(NULL), false, false); if (g_BaseSystem) { - g_BaseSystem->StartEmulation(true); + if (g_Settings->LoadBool(Setting_AutoStart) != 0) + { + WriteTrace(TraceN64System, TraceDebug, "Automattically starting rom"); + g_BaseSystem->StartEmulation(true); + } } else { diff --git a/Source/Project64/UserInterface/MainMenu.cpp b/Source/Project64/UserInterface/MainMenu.cpp index dfaae0a83..bf4e6651d 100644 --- a/Source/Project64/UserInterface/MainMenu.cpp +++ b/Source/Project64/UserInterface/MainMenu.cpp @@ -302,17 +302,12 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI //Now we have created again, we can start up emulation if (g_BaseSystem) { + if (g_Settings->LoadBool(Setting_AutoStart) == 0) + { + WriteTrace(TraceN64System, TraceDebug, "Manually starting rom"); + } g_BaseSystem->StartEmulation(true); } - else if (g_Settings->LoadBool(Setting_AutoStart) == 0) - { - WriteTrace(TraceN64System, TraceDebug, "Manually starting rom"); - CN64System::RunLoadedImage(); - if (g_BaseSystem == NULL) - { - g_Notify->BreakPoint(__FILE__, __LINE__); - } - } else { g_Notify->BreakPoint(__FILE__, __LINE__);