mirror of
https://github.com/YimMenu/YimMenuV2.git
synced 2026-10-10 03:43:15 +08:00
fix MSVC build
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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
Reference in New Issue
Block a user