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.
This commit is contained in:
RSDuck
2019-08-17 16:50:48 +02:00
parent ec21172cd9
commit 3001d9492c
10 changed files with 116 additions and 48 deletions

View File

@ -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

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}