fix MSVC build

This commit is contained in:
maybegreat48
2025-06-28 08:46:59 -04:00
parent 59ae786c39
commit 96a7636851
3 changed files with 25 additions and 16 deletions
+12 -3
View File
@@ -200,12 +200,21 @@ def create_lua_func(native: NativeFunc):
return f"{native.name}=function()error('{blacklist_reason}')end,"
return f"{native.name}=function({"..." if using_varargs else generate_lua_func_signature(native)}){"" if native.return_type == "void" else "return "}_I({native.native_index},'{generate_lua_param_string(native)}'{",..." if using_varargs else sign})end,"
# does MSVC still live in the 2000s?
def chunkstring(string, length):
return (string[0+i:length+i] for i in range(0, len(string), length))
def create_lua_namespace(name: str, natives: list[NativeFunc]):
string = f"\t\"{name}={{"
string = f"{name}={{"
for native in natives:
string += create_lua_func(native)
string = string[:-1] + "}\",\n"
return string
string = string[:-1] + "}"
chunks = chunkstring(string, 15000)
real_string = "\t"
for chunk in chunks:
real_string += '"' + chunk + '"'
real_string += ",\n"
return real_string
def create_lua_defs():
with open("../../scripting/libraries/NativeDefs.cpp", "w+") as file:
+1 -1
View File
@@ -133,7 +133,7 @@ namespace YimMenu::Lua
virtual void Register(lua_State* state) override
{
lua_pushcfunction(state, InvokeNative);
lua_setglobal(state, "_I"); // we're trying to keep the invoker code as short as possible
lua_setglobal(state, "_I"); // we're trying to keep the auto-generated natives code as short as possible to fit under 65535 characters per namespace
}
};
File diff suppressed because one or more lines are too long