Fix #3616
This had two issues. One, relative pathing with dlls is a no-go. Our hackery with changing cwd seems to confuse lua, and while it can find the dll, it fails to load as Windows (at least) does not consider cwd for loading up dlls it appears. Secondly, people using luasockets never actually loaded up the luasockets dll, rather we were bundling it ourselves. From history it seems this was due to our lua being compiled with CLR/.NET and that didn't play nice with exceptions? Doesn't seem to be an issue anymore, but we should probably still bundle luasockets for the time being given it used in many different projects which use the same script with multiple different emulators (thus our own sockets are simply not usable).
This commit is contained in:
parent
8ef8d4efb9
commit
5f0683c1ae
Binary file not shown.
Binary file not shown.
|
@ -103,13 +103,24 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
_lua.RegisterFunction("print", this, typeof(LuaLibraries).GetMethod(nameof(Print)));
|
||||
|
||||
var packageTable = (LuaTable) _lua["package"];
|
||||
var luaPath = PathEntries.LuaAbsolutePath();
|
||||
if (OSTailoredCode.IsUnixHost)
|
||||
{
|
||||
// add %exe%/Lua to library resolution pathset (LUA_PATH)
|
||||
// this is done already on windows, but not on linux it seems?
|
||||
var packageTable = (LuaTable) _lua["package"];
|
||||
var luaPath = PathEntries.LuaAbsolutePath();
|
||||
packageTable["path"] = $"{luaPath}/?.lua;{luaPath}?/init.lua;{packageTable["path"]}";
|
||||
// we need to modifiy the cpath so it looks at our lua dir too, and remove the relative pathing
|
||||
// we do this on Windows too, but keep in mind Linux uses .so and Windows use .dll
|
||||
// TODO: Does the relative pathing issue Windows has also affect Linux? I'd assume so...
|
||||
packageTable["cpath"] = $"{luaPath}/?.so;{luaPath}/loadall.so;{packageTable["cpath"]}";
|
||||
packageTable["cpath"] = ((string)packageTable["cpath"]).Replace(";./?.so", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
packageTable["cpath"] = $"{luaPath}\\?.dll;{luaPath}\\loadall.dll;{packageTable["cpath"]}";
|
||||
packageTable["cpath"] = ((string)packageTable["cpath"]).Replace(";.\\?.dll", "");
|
||||
}
|
||||
|
||||
EmulationLuaLibrary.FrameAdvanceCallback = FrameAdvance;
|
||||
|
|
Loading…
Reference in New Issue