fix lua random crash / unreliability introduced by commit 43fcaf68f1

fix strange non-functional static-assert-likes designed to prevent this problem, by turning them into actual static asserts
This commit is contained in:
zeromus 2019-04-19 16:18:29 -04:00
parent ce8275fca1
commit 55c158d305
1 changed files with 8 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2009-2017 DeSmuME team Copyright (C) 2009-2019 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -203,6 +203,7 @@ static const char* luaCallIDStrings [] =
"CALL_AFTERLOAD", "CALL_AFTERLOAD",
"CALL_ONSTART", "CALL_ONSTART",
"CALL_ONINITMENU", "CALL_ONINITMENU",
"CALL_REGISTER3DEVENT",
"CALL_HOTKEY_1", "CALL_HOTKEY_1",
"CALL_HOTKEY_2", "CALL_HOTKEY_2",
@ -221,7 +222,9 @@ static const char* luaCallIDStrings [] =
"CALL_HOTKEY_15", "CALL_HOTKEY_15",
"CALL_HOTKEY_16", "CALL_HOTKEY_16",
}; };
static const int _makeSureWeHaveTheRightNumberOfStrings = (sizeof(luaCallIDStrings)/sizeof(*luaCallIDStrings) == LUACALL_COUNT) ? 1 : 0;
//make Sure We Have The Right Number Of Strings
CTASSERT(ARRAY_SIZE(luaCallIDStrings) == LUACALL_COUNT);
static const char* luaMemHookTypeStrings [] = static const char* luaMemHookTypeStrings [] =
{ {
@ -233,7 +236,9 @@ static const char* luaMemHookTypeStrings [] =
"MEMHOOK_READ_SUB", "MEMHOOK_READ_SUB",
"MEMHOOK_EXEC_SUB", "MEMHOOK_EXEC_SUB",
}; };
static const int _makeSureWeHaveTheRightNumberOfStrings2 = (sizeof(luaMemHookTypeStrings)/sizeof(*luaMemHookTypeStrings) == LUAMEMHOOK_COUNT) ? 1 : 0;
//make Sure We Have The Right Number Of Strings 2
CTASSERT(ARRAY_SIZE(luaMemHookTypeStrings) == LUAMEMHOOK_COUNT);
void StopScriptIfFinished(int uid, bool justReturned = false); void StopScriptIfFinished(int uid, bool justReturned = false);
void SetSaveKey(LuaContextInfo& info, const char* key); void SetSaveKey(LuaContextInfo& info, const char* key);