From 55c158d305166128a3c2bad4419033c974fdc14a Mon Sep 17 00:00:00 2001 From: zeromus Date: Fri, 19 Apr 2019 16:18:29 -0400 Subject: [PATCH] fix lua random crash / unreliability introduced by commit 43fcaf68f1518b9dbb26a06b51a57440c701d2fe fix strange non-functional static-assert-likes designed to prevent this problem, by turning them into actual static asserts --- desmume/src/lua-engine.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/desmume/src/lua-engine.cpp b/desmume/src/lua-engine.cpp index cd2cb6afd..a75fdbef2 100644 --- a/desmume/src/lua-engine.cpp +++ b/desmume/src/lua-engine.cpp @@ -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 it under the terms of the GNU General Public License as published by @@ -203,6 +203,7 @@ static const char* luaCallIDStrings [] = "CALL_AFTERLOAD", "CALL_ONSTART", "CALL_ONINITMENU", + "CALL_REGISTER3DEVENT", "CALL_HOTKEY_1", "CALL_HOTKEY_2", @@ -221,7 +222,9 @@ static const char* luaCallIDStrings [] = "CALL_HOTKEY_15", "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 [] = { @@ -233,7 +236,9 @@ static const char* luaMemHookTypeStrings [] = "MEMHOOK_READ_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 SetSaveKey(LuaContextInfo& info, const char* key);