Skip to content
This repository was archived by the owner on Mar 23, 2024. It is now read-only.

respond to Dbghelp.SymGetTypeFromName correctly#6

Open
pancelor wants to merge 4 commits intoManuelBlanc:masterfrom
pancelor:errcode
Open

respond to Dbghelp.SymGetTypeFromName correctly#6
pancelor wants to merge 4 commits intoManuelBlanc:masterfrom
pancelor:errcode

Conversation

@pancelor
Copy link
Collaborator

@pancelor pancelor commented Sep 2, 2019

I think this is partially why necrolua.get was failing (#5)

I'm not sure why Dbghelp.SymFromName is failing, but I'm pretty sure it is

@pancelor
Copy link
Collaborator Author

pancelor commented Sep 2, 2019

Update:

I have git checked out to d994e81, and I rebuilt necrolua.

This is my mod:

necrolua.hook("c_Player::p_UseBomb", function(func, self)
  print "c_Player::p_UseBomb"

  print "inside mod 1"
  local cls = necrolua.get("c_Enemy")
  print "inside mod 2"
  local obj = cls:m_GetRandomEnemy()
  print "inside mod 3"
end)

When the game loads, I press the bomb button and the game crashes:

$ ./NecroLua
[NecroLua.exe] nl_launcher.c: 27: DetourCreateProcessWithDlls on NecroDancer.exe with NecroLuaAPI.dll ...
[NecroLua.exe] nl_launcher.c: 46: Game started.
[NecroLua.exe] nl_launcher.c: 52: WaitForSingleObject ...
[←[33mNecroLuaAPI.dll←[0m] nl_payload.c:125: Loading symbol information ...
[←[33mNecroLuaAPI.dll←[0m] nl_payload.c:134: BaseOfExe is 0x010C0000
[←[33mNecroLuaAPI.dll←[0m] nl_payload.c:136: Opening the Lua state ...
[←[33mNecroLuaAPI.dll←[0m] nl_payload.c:142: Initializing the Lua API ...
[←[33mNecroLuaAPI.dll←[0m][←[32mLua←[0m] nl_luainit.lua:478: NecroLuaAPI.init mod API loaded.
[←[33mNecroLuaAPI.dll←[0m] nl_payload.c:153: (Re)loading mods. ...
[←[33mNecroLuaAPI.dll←[0m] nl_payload.c: 88: Scanning mods in 'mods' ...
[←[33mNecroLuaAPI.dll←[0m][←[32mLua←[0m] nl_luainit.lua:469: Reloading 1 mods ...
[←[33mNecroLuaAPI.dll←[0m][←[32mLua←[0m] nl_luainit.lua:472: Reload mods\0luatest\lua\init.lua
-----------------------------------
-----------------------------------
calling nl_symbol("c_Player::p_UseBomb")
calling nl_type("c_Player")
[←[33mNecroLuaAPI.dll←[0m][←[32mLua←[0m] nl_luainit.lua:442: nl_attach :: NLAPI.nl_attach(cast("__thiscall bool (*)(c_Player*)", 18788416), function: 0x001742d8)
[←[33mNecroLuaAPI.dll←[0m][←[32mLua←[0m] nl_luainit.lua:444: typedef : "__thiscall bool (*)(c_Player*)"
[←[33mNecroLuaAPI.dll←[0m] nl_payload.c:164: Mods initialized.
Setting breakpad minidump AppID = 247080
Steam_SetMinidumpSteamID:  Caching Steam ID:  76561198034369998 [API loaded no]
Steam: Successful init
Steam: Initializing leaderboard object
Steam Leaderboards: Constructor
Steam: Initializing UGC remote storage object
Steam: Initializing stats object

<... other game startup logging here ...>

c_Player::p_UseBomb
inside mod 1
calling nl_symbol("c_Enemy")
Error 126: The specified module could not be found.
nl_luainit.lua:425: Symbol not found: c_Enemy
stack traceback:
        [C]: in function 'assert'
        nl_luainit.lua:425: in function 'get'
        mods\0luatest\lua\init.lua:17: in function <mods\0luatest\lua\init.lua:13>
        [C]: in function 'xpcall'
        nl_luainit.lua:456: in function <nl_luainit.lua:455>
[←[33mNecroLuaAPI.dll←[0m] nl_payload.c:176: Mod API finalized.
[NecroLua.exe] nl_launcher.c: 58: Done with exit code 0x00000001

Any idea what's happening here? Notice that nl_symbol("c_Player::p_UseBomb") and nl_type("c_Player") get called early on in the log output, and they succeed, but calling nl_symbol("c_Enemy") later results in Error 126: The specified module could not be found. ??

@pancelor
Copy link
Collaborator Author

pancelor commented Sep 2, 2019

hmm, changing necrolua.get("c_Enemy") to necrolua.type("c_Enemy") makes this error go away. That makes some sense I guess? Error 126: The specified module could not be found. was very confusing though.

I guess I don't understand exactly how to use necrolua.get

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant