aboutsummaryrefslogtreecommitdiff
path: root/src/libui_sdl
diff options
context:
space:
mode:
authorRSDuck <rsduck@users.noreply.github.com>2019-08-17 16:50:48 +0200
committerRSDuck <rsduck@users.noreply.github.com>2020-04-26 13:04:59 +0200
commit3001d9492c6e7e83e82843a4b9c6186b0b58f5e5 (patch)
tree87ba6724548a3711ba59776e01e01e9102b920e8 /src/libui_sdl
parentec21172cd9932805f02d84f41599c7a23e3b23f5 (diff)
abandon pipelining on jit
fixes Golden Sun Dawn this makes the cpu state incompatible between interpreter and JIT. That's why switching cpu mode requires a restart(not requiring is stupid anyway) and the pipeline is manually filled when making a save state.
Diffstat (limited to 'src/libui_sdl')
-rw-r--r--src/libui_sdl/DlgEmuSettings.cpp28
-rw-r--r--src/libui_sdl/libui/ui.h1
-rw-r--r--src/libui_sdl/libui/windows/stddialogs.cpp17
-rw-r--r--src/libui_sdl/main.cpp16
4 files changed, 47 insertions, 15 deletions
diff --git a/src/libui_sdl/DlgEmuSettings.cpp b/src/libui_sdl/DlgEmuSettings.cpp
index 46f5f9f..2f5ee2d 100644
--- a/src/libui_sdl/DlgEmuSettings.cpp
+++ b/src/libui_sdl/DlgEmuSettings.cpp
@@ -29,6 +29,7 @@
void ApplyNewSettings(int type);
+extern bool RunningSomething;
namespace DlgEmuSettings
{
@@ -57,10 +58,10 @@ void OnCancel(uiButton* btn, void* blarg)
void OnOk(uiButton* btn, void* blarg)
{
- Config::DirectBoot = uiCheckboxChecked(cbDirectBoot);
-
#ifdef JIT_ENABLED
- Config::JIT_Enable = uiCheckboxChecked(cbJITEnabled);
+ bool restart = false;
+
+ bool enableJit = uiCheckboxChecked(cbJITEnabled);
char* maxBlockSizeStr = uiEntryText(enJITMaxBlockSize);
long blockSize = strtol(maxBlockSizeStr, NULL, 10);
uiFreeText(maxBlockSizeStr);
@@ -68,15 +69,32 @@ void OnOk(uiButton* btn, void* blarg)
blockSize = 1;
if (blockSize > 32)
blockSize = 32;
- Config::JIT_MaxBlockSize = blockSize;
+
+ if (enableJit != Config::JIT_Enable || blockSize != Config::JIT_MaxBlockSize)
+ {
+ if (RunningSomething &&
+ !uiMsgBoxConfirm(win, "Reset emulator",
+ "Changing JIT settings requires a reset.\n\nDo you want to continue?"))
+ return;
+
+ Config::JIT_Enable = enableJit;
+ Config::JIT_MaxBlockSize = Config::JIT_MaxBlockSize;
+
+ restart = true;
+ }
#endif
+ Config::DirectBoot = uiCheckboxChecked(cbDirectBoot);
+
Config::Save();
uiControlDestroy(uiControl(win));
opened = false;
- ApplyNewSettings(4);
+#ifdef JIT_ENABLED
+ if (restart)
+ ApplyNewSettings(4);
+#endif
}
#ifdef JIT_ENABLED
diff --git a/src/libui_sdl/libui/ui.h b/src/libui_sdl/libui/ui.h
index 03aef5d..e45fe91 100644
--- a/src/libui_sdl/libui/ui.h
+++ b/src/libui_sdl/libui/ui.h
@@ -289,6 +289,7 @@ _UI_EXTERN char *uiOpenFile(uiWindow *parent, const char* filter, const char* in
_UI_EXTERN char *uiSaveFile(uiWindow *parent, const char* filter, const char* initpath);
_UI_EXTERN void uiMsgBox(uiWindow *parent, const char *title, const char *description);
_UI_EXTERN void uiMsgBoxError(uiWindow *parent, const char *title, const char *description);
+_UI_EXTERN int uiMsgBoxConfirm(uiWindow * parent, const char *title, const char *description);
typedef struct uiArea uiArea;
typedef struct uiAreaHandler uiAreaHandler;
diff --git a/src/libui_sdl/libui/windows/stddialogs.cpp b/src/libui_sdl/libui/windows/stddialogs.cpp
index d0fd506..7537015 100644
--- a/src/libui_sdl/libui/windows/stddialogs.cpp
+++ b/src/libui_sdl/libui/windows/stddialogs.cpp
@@ -136,7 +136,7 @@ char *uiSaveFile(uiWindow *parent, const char* filter, const char* initpath)
// TODO switch to TaskDialogIndirect()?
-static void msgbox(HWND parent, const char *title, const char *description, TASKDIALOG_COMMON_BUTTON_FLAGS buttons, PCWSTR icon)
+static int msgbox(HWND parent, const char *title, const char *description, TASKDIALOG_COMMON_BUTTON_FLAGS buttons, PCWSTR icon)
{
WCHAR *wtitle, *wdescription;
HRESULT hr;
@@ -144,12 +144,15 @@ static void msgbox(HWND parent, const char *title, const char *description, TASK
wtitle = toUTF16(title);
wdescription = toUTF16(description);
- hr = TaskDialog(parent, NULL, NULL, wtitle, wdescription, buttons, icon, NULL);
+ int result;
+ hr = TaskDialog(parent, NULL, NULL, wtitle, wdescription, buttons, icon, &result);
if (hr != S_OK)
logHRESULT(L"error showing task dialog", hr);
uiFree(wdescription);
uiFree(wtitle);
+
+ return result;
}
void uiMsgBox(uiWindow *parent, const char *title, const char *description)
@@ -165,3 +168,13 @@ void uiMsgBoxError(uiWindow *parent, const char *title, const char *description)
msgbox(windowHWND(parent), title, description, TDCBF_OK_BUTTON, TD_ERROR_ICON);
enableAllWindowsExcept(parent);
}
+
+int uiMsgBoxConfirm(uiWindow * parent, const char *title, const char *description)
+{
+ disableAllWindowsExcept(parent);
+ int result =
+ msgbox(windowHWND(parent), title, description, TDCBF_OK_BUTTON | TDCBF_CANCEL_BUTTON, TD_WARNING_ICON);
+ enableAllWindowsExcept(parent);
+
+ return result == IDOK;
+} \ No newline at end of file
diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp
index af05d7a..0066668 100644
--- a/src/libui_sdl/main.cpp
+++ b/src/libui_sdl/main.cpp
@@ -2355,6 +2355,14 @@ void OnSetShowOSD(uiMenuItem* item, uiWindow* window, void* blarg)
void ApplyNewSettings(int type)
{
+#ifdef JIT_ENABLED
+ if (type == 4)
+ {
+ Reset(NULL);
+ return;
+ }
+#endif
+
if (!RunningSomething)
{
if (type == 1) return;
@@ -2409,14 +2417,6 @@ void ApplyNewSettings(int type)
GPU3D::InitRenderer(Screen_UseGL);
if (Screen_UseGL) uiGLMakeContextCurrent(NULL);
}
- else if (type == 4)
- {
-#ifdef JIT_ENABLED
- if (Config::JIT_Enable)
- ARMJIT::InvalidateBlockCache();
-#endif
- }
-
EmuRunning = prevstatus;
}