Skip to content

Commit

Permalink
update signatures 0330 for luaopen_* and lua_typename
Browse files Browse the repository at this point in the history
  • Loading branch information
MoeMod committed Apr 22, 2023
1 parent 8210565 commit 915b769
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 136 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# vscript_lua51
This extension enables Lua VScript from CS2 to load external lua module dll. Tested on Mar 22nd version.
This extension enables Lua VScript from CS2 to load external lua module dll. Tested on Mar 24th (9640) and Mar 30th (9652) version.

# Usage
1. Prepare build environment: VS2022 + CMake
2. Build lua51.dll and vscript.dll
3. Rename vscript.dll to vscript2.dll in CAGO\game\bin\win64
4. Copy lua51.dll and vscript.dll into CAGO\game\bin\win64
5. Put any other external lua module dll (like luasocket.dll) into CAGO\game\bin\win64
6. Load module by `local luasocket = require("luasocket")`
6. Load module by `local luasocket = require("luasocket")` \
Warning: This is a client-side hack, NEVER install it under VAC, or you may get banned.

# Support
Expand Down
134 changes: 134 additions & 0 deletions signatures.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
F_DEF(index2adr, "\x4C\x8B\xC1\x85\xD2\x7E\x2A\x48\x8B\x41\x20\x48\x63\xD2")
F_DEF(lj_obj_equal, "\x4C\x8B\x09\x4C\x8B\x12")
F_DEF(lj_err_callermsg, "\x40\x53\x48\x83\xEC\x20\x48\x8B\x41\x10\x45\x33\xC9")
F_DEF(luaL_loadbufferx, "\x4C\x8B\xDC\x49\x89\x5B\x08\x57\x48\x81\xEC\xF0\x00\x00\x00\x4D\x85\xC9\x48\x89\x54\x24\x20\x48\x8D\x05\x32\x06\x00\x00")
F_DEF(lj_err_run, "\x48\x89\x5C\x24\x08\x57\x48\x83\xEC\x20\x4C\x8B\x51\x10")
F_DEF(lj_err_argtype, "\x48\x89\x5C\x24\x08\x57\x48\x83\xEC\x20\x48\x63\xDA")
F_DEF(err_argmsg, "\x48\x89\x5C\x24\x10\x48\x89\x74\x24\x18\x57\x48\x83\xEC\x30\x8B\xDA")

F_DEF(lua_newstate, "\x48\x89\x5C\x24\x20\x55\x56\x41\x56\x48\x83\xEC\x50")
F_DEF(lua_close, "\x48\x89\x5C\x24\x08\x48\x89\x6C\x24\x10\x48\x89\x74\x24\x18\x57\x48\x83\xEC\x20\x48\x8B\x79\x10\x48\x8B\x9F\xC0\x00\x00\x00")
F_DEF(lua_newthread, "\x48\x89\x5C\x24\x08\x57\x48\x83\xEC\x20\x48\x8B\x51\x10")
F_DEF(lua_atpanic, "\x4C\x8B\x41\x10\x49\x8B\x80\x60\x01\x00\x00")

F_DEF(lua_gettop, "\x48\x8B\x41\x28\x48\x2B\x41\x20")
F_DEF(lua_settop, "\x48\x89\x5C\x24\x08\x57\x48\x83\xEC\x20\x48\x63\xFA")
F_DEF(lua_pushvalue, "\x48\x83\xEC\x28\x4C\x8B\xD1\xE8\x2A\x2A\x2A\x2A\x49\x8B\x52\x28")
F_DEF(lua_remove, "\x4C\x8B\xC1\x85\xD2\x7E\x2A\x48\x8B\x41\x20\x48\x8B\x49\x28")
F_DEF(lua_insert, "\x4C\x8B\xC9\x85\xD2")
//F_N(lua_replace, 2, ?)
F_DEF(lua_checkstack, "\x48\x83\xEC\x28\x4C\x8B\xC9")
F_DEF(lua_xmove, "\x48\x3B\xCA\x74\x2A\x48\x89\x5C\x24\x08")

F_DEF(lua_isnumber, "\x48\x83\xEC\x28\xE8\x2A\x2A\x2A\x2A\x48\x8B\x08\x48\x8B\xC1\x48\xC1\xF8\x2F\x83\xF8\xF2")
F_DEF(lua_isstring, "\x48\x83\xEC\x28\xE8\x2A\x2A\x2A\x2A\x48\x8B\x08\x48\xC1\xF9\x2F")
F_DEF(lua_iscfunction, "\x48\x83\xEC\x28\xE8\x2A\x2A\x2A\x2A\x48\x8B\x08\x48\x8B\xC1\x48\xC1\xF8\x2F\x83\xF8\xF7")
//F_N(lua_isuserdata, 2, ?)
F_DEF(lua_type, "\x48\x83\xEC\x28\x4C\x8B\xD1\xE8\x2A\x2A\x2A\x2A\x4C\x8B\xD8")
F_DEF(lua_typename, "\x48\x63\xC2\x48\x8D\x0D\x2A\x2A\x0B\x00")

F_DEF(lua_equal, "\x48\x89\x5C\x24\x08\x57\x48\x83\xEC\x20\x45\x8B\xD0\x48\x8B\xD9")
//F_N(lua_rawequal, 3, ?)
F_DEF(lua_lessthan, "\x40\x53\x48\x83\xEC\x20\x45\x8B\xD0")

F_DEF(lua_tonumber, "\x48\x83\xEC\x28\xE8\x2A\x2A\x2A\x2A\x48\x8B\x08\x48\x8B\xD1\x48\xC1\xFA\x2F\x83\xFA\xF2\x77\x2A")
F_DEF(lua_tointeger, "\x48\x83\xEC\x28\xE8\x2A\x2A\x2A\x2A\x48\x8B\x08\x48\x8B\xD1\x48\xC1\xFA\x2F\x83\xFA\xF2\x73\x2A")
F_DEF(lua_toboolean, "\x48\x83\xEC\x28\xE8\x2A\x2A\x2A\x2A\x48\x8B\x08\x33\xC0")
F_DEF(lua_tolstring, "\x48\x89\x5C\x24\x08\x48\x89\x74\x24\x10\x57\x48\x83\xEC\x20\x49\x8B\xF8\x8B\xDA\x48\x8B\xF1\xE8\x2A\x2A\x2A\x2A")
F_DEF(lua_objlen, "\x40\x53\x48\x83\xEC\x20\x4C\x8B\xD1\xE8\x2A\x2A\x2A\x2A")
//F_N(lua_tocfunction, 2, ?)
F_DEF(lua_touserdata, "\x48\x83\xEC\x28\x4C\x8B\xD1\xE8\x2A\x2A\x2A\x2A\x48\x8B\x10")
//F_N(lua_tothread, 2, ?)
//F_N(lua_topointer, 2, ?)

F_DEF(lua_pushnil, "\x48\x8B\x41\x28\x48\xC7\x00\xFF\xFF\xFF\xFF\x48\x83\x41\x28\x08")
F_DEF(lua_pushnumber, "\x48\x8B\x41\x28\xF2\x0F\x11\x08")
F_DEF(lua_pushinteger, "\x48\x8B\x41\x28\x0F\x57\xC0")
F_DEF(lua_pushlstring, "\x48\x89\x5C\x24\x08\x48\x89\x74\x24\x10\x57\x48\x83\xEC\x20\x4C\x8B\x49\x10\x49\x8B\xF8")
F_DEF(lua_pushstring, "\x48\x89\x5C\x24\x08\x57\x48\x83\xEC\x20\x48\x8B\xFA\x48\x8B\xD9\x48\x85\xD2")
F_DEF(lua_pushvfstring, "\x40\x53\x55\x48\x83\xEC\x48\x48\x8B\x59\x10")
// F_N(lua_pushfstring, 2, "\x48\x89\x54\x24\x10\x4C\x89\x44\x24\x18\x4C\x89\x4C\x24\x20\x53\x48\x83\xEC\x20\x4C\x8B\x41\x10")
F_DEF(lua_pushcclosure, "\x48\x89\x5C\x24\x08\x48\x89\x74\x24\x10\x57\x48\x83\xEC\x20\x48\x8B\xD9\x49\x63\xF8")
F_DEF(lua_pushboolean, "\x48\x8B\x41\x28\x45\x33\xC0")
F_DEF(lua_pushlightuserdata, "\x40\x53\x48\x83\xEC\x20\x48\x8B\xD9\xE8\x2A\x2A\x2A\x2A\x48\x8B\x53\x28")
F_DEF(lua_pushthread, "\x40\x53\x48\x83\xEC\x20\x48\xB8\x00\x00\x00\x00\x00\x80\xFC\xFF")

F_DEF(lua_gettable, "\x40\x53\x48\x83\xEC\x20\x48\x8B\xD9\xE8\x2A\x2A\x2A\x2A\x4C\x8B\x43\x28\x48\x8B\xD0\x49\x83\xE8\x08")
F_DEF(lua_getfield, "\x48\x89\x5C\x24\x10\x57\x48\x83\xEC\x20\x4D\x8B\xD0")
F_DEF(lua_rawget, "\x40\x53\x48\x83\xEC\x20\x48\x8B\xD9\xE8\x2A\x2A\x2A\x2A\x4C\x8B\x43\x28\x48\x8B\xCB")
F_DEF(lua_rawgeti, "\x40\x53\x48\x83\xEC\x20\x4D\x63\xD0")
F_DEF(lua_createtable, "\x48\x89\x5C\x24\x08\x48\x89\x74\x24\x10\x57\x48\x83\xEC\x20\x4C\x8B\x49\x10\x41\x8B\xF8")
F_DEF(lua_newuserdata, "\x48\x89\x5C\x24\x08\x57\x48\x83\xEC\x20\x4C\x8B\x41\x10")
F_DEF(lua_getmetatable, "\x48\x83\xEC\x28\x4C\x8B\xD1\xE8\x2A\x2A\x2A\x2A\x48\x8B\x08\x48\x8B\xC1\x48\xC1\xF8\x2F\x83\xF8\xF4")
F_DEF(lua_getfenv, "\x48\x83\xEC\x28\x4C\x8B\xD1\xE8\x2A\x2A\x2A\x2A\x48\x8B\x08\x48\x8B\xC1\x48\xC1\xF8\x2F\x83\xF8\xF7")

F_DEF(lua_settable, "\x40\x53\x48\x83\xEC\x20\x48\x8B\xD9\xE8\x2A\x2A\x2A\x2A\x4C\x8B\x43\x28\x48\x8B\xD0\x49\x83\xE8\x10")
F_DEF(lua_setfield, "\x48\x89\x5C\x24\x08\x57\x48\x83\xEC\x20\x4D\x8B\xD0\x48\x8B\xD9")
F_DEF(lua_rawset, "\x48\x89\x5C\x24\x08\x48\x89\x74\x24\x10\x57\x48\x83\xEC\x20\x48\x8B\xD9\xE8\x2A\x2A\x2A\x2A")
F_DEF(lua_rawseti, "\x48\x89\x5C\x24\x08\x48\x89\x74\x24\x10\x57\x48\x83\xEC\x20\x4D\x63\xD0")
F_DEF(lua_setmetatable, "\x48\x89\x5C\x24\x08\x48\x89\x74\x24\x10\x48\x89\x7C\x24\x18\x41\x56\x48\x83\xEC\x20\x48\x8B\xF9\xE8\x2A\x2A\x2A\x2A")
F_DEF(lua_setfenv, "\x40\x53\x48\x83\xEC\x20\x48\x8B\xD9\xE8\x2A\x2A\x2A\x2A\x4C\x8B\x4B\x28")

F_DEF(lua_call, "\x48\x63\xC2\x4C\x8B\xD1")
F_DEF(lua_pcall, "\x48\x89\x5C\x24\x08\x48\x89\x74\x24\x10\x57\x48\x83\xEC\x20\x48\x8B\x59\x10\x41\x8B\xF0")
F_DEF(lua_cpcall, "\x48\x89\x5C\x24\x08\x57\x48\x83\xEC\x20\x48\x8B\x59\x10\x4C\x8D\x0D\xDB\xF4\xFF\xFF")
F_DEF(lua_load, "\x4C\x8B\xDC\x49\x89\x5B\x08\x57\x48\x81\xEC\xF0\x00\x00\x00\x4D\x85\xC9\x48\x89\x54\x24\x20\x48\x8D\x05\xE2\x06\x00\x00")
//F_N(lua_dump, 3, ?)

//F_N(lua_yield, 2, ?)
//F_N(lua_resume, 2, ?)
//F_N(lua_status, 1, ?)

F_DEF(lua_gc, "\x48\x89\x5C\x24\x08\x48\x89\x74\x24\x10\x57\x48\x83\xEC\x20\x48\x8B\x59\x10\x33\xFF")
//F_DEF(lua_error, 0x58170) // "\x48\x83\xEC\x28\xE8\x2A\x2A\x2A\x2A\xCC" function is too short...
F_DEF(lua_next, "\x48\x89\x5C\x24\x08\x57\x48\x83\xEC\x20\x48\x8B\xD9\xE8\x2A\x2A\x2A\x2A\x48\x8B\x53\x28")
F_DEF(lua_concat, "\x48\x89\x5C\x24\x08\x57\x48\x83\xEC\x20\x8B\xFA\x48\x8B\xD9\x83\xFA\x02")
//F_N(lua_getallocf, 2, ?)
//F_N(lua_setallocf, 3, ? )

F_DEF(luaL_openlib, "\x48\x89\x5C\x24\x20\x55\x56\x41\x56\x48\x83\xEC\x20")
//F_DEF(luaL_register, 0x5BDB0) // "\x45\x33\xC9\xE9\x2A\x2A\x2A\x2A\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC" function is too short...
//F_N(luaL_getmetafield, 3, ?)
F_DEF(luaL_callmeta, "\x48\x89\x5C\x24\x10\x48\x89\x6C\x24\x18\x56\x57\x41\x56\x48\x83\xEC\x20\x48\x8B\x59\x10\x48\x8B\xF1")
//F_DEF(luaL_typerror, 0x58100) // "\x48\x83\x23\xEC\x28\xE8\x2A\x2A\x2A\x2A\xCC" function is too short...
//F_DEF(luaL_argerror, 0x580C0) // "\x48\x83\xEC\x28\xE8\x2A\x2A\x2A\x2A\xCC" function is too short...
F_DEF(luaL_checklstring, "\x48\x89\x5C\x24\x08\x48\x89\x74\x24\x10\x57\x48\x83\xEC\x20\x49\x8B\xF0")
F_DEF(luaL_optlstring, "\x48\x89\x5C\x24\x08\x48\x89\x74\x24\x10\x57\x48\x83\xEC\x20\x49\x8B\xF1")
F_DEF(luaL_checknumber, "\x48\x89\x5C\x24\x08\x57\x48\x83\xEC\x20\x8B\xDA\x48\x8B\xF9\xE8\x2A\x2A\x2A\x2A\x48\x8B\x08\x4C\x8B\xC1\x49\xC1\xF8\x2F\x41\x83\xF8\xF2\x77\x2A\xF2\x0F\x10\x00\x48\x8B\x5C\x24\x30\x48\x83\xC4\x20\x5F\xC3\x41\x83\xF8\xFB")
F_DEF(luaL_optnumber, "\x48\x89\x5C\x24\x08\x57\x48\x83\xEC\x20\x8B\xDA\x48\x8B\xF9\xE8\x2A\x2A\x2A\x2A\x48\x8B\x08\x4C\x8B\xC1\x49\xC1\xF8\x2F\x41\x83\xF8\xF2\x77\x2A\xF2\x0F\x10\x00\x48\x8B\x5C\x24\x30\x48\x83\xC4\x20\x5F\xC3\x48\x83\xF9\xFF")
//F_N(luaL_checkinteger, 2, ?)
F_DEF(luaL_optinteger, "\x48\x89\x5C\x24\x08\x57\x48\x83\xEC\x20\x4D\x8B\xD0\x8B\xDA")

F_DEF(luaL_checkstack, "\x48\x83\xEC\x28\x4C\x8B\xD1\x81\xFA\x40\x1F\x00\x00")
F_DEF(luaL_checktype, "\x40\x53\x48\x83\xEC\x20\x45\x8B\xD8")
//F_N(luaL_checkany, 3, ?)
F_DEF(luaL_newmetatable, "\x48\x89\x5C\x24\x08\x48\x89\x74\x24\x10\x57\x48\x83\xEC\x20\x48\x8B\x41\x10\x48\x8B\xD9")
F_DEF(luaL_checkudata, "\x48\x89\x5C\x24\x08\x48\x89\x6C\x24\x10\x48\x89\x74\x24\x18\x48\x89\x7C\x24\x20\x41\x56\x48\x83\xEC\x20\x49\x8B\xD8")
F_DEF(luaL_where, "\x40\x53\x48\x83\xEC\x20\x4C\x8D\x44\x24\x40")
//F_N(luaL_error, 2, "\x40\x53\x48\x83\xEC\x20\x4C\x8D\x44\x24\x40")
//F_N(luaL_checkoption, 4, ?)
F_DEF(luaL_ref, "\x48\x89\x5C\x24\x10\x57\x48\x83\xEC\x20\x8D\x82\x0F\x27\x00\x00")
F_DEF(luaL_unref, "\x45\x85\xC0\x78\x2A\x48\x89\x5C\x24\x08")
F_DEF(luaL_loadfile, "\x40\x53\x56\x57\x48\x81\xEC\x00\x03\x00\x00")
//F_N(luaL_loadbuffer, 4, ?)
F_DEF(luaL_loadstring, "\x48\x89\x5C\x24\x08\x57\x48\x81\xEC\xF0\x00\x00\x00")
F_DEF(luaL_newstate, "\x48\x83\xEC\x28\x33\xD2\xB9\x50\x4D\x00\x00")
F_DEF(luaL_gsub, "\x40\x55\x53\x56\x57\x41\x54\x41\x55\x41\x56\x41\x57\x48\x8D\xAC\x24\xA8\xFE\xFF\xFF")
F_DEF(luaL_findtable, "\x48\x89\x5C\x24\x08\x48\x89\x6C\x24\x10\x48\x89\x74\x24\x18\x57\x41\x56\x41\x57\x48\x83\xEC\x20\x45\x8B\xF1")

F_DEF(luaL_buffinit, "\x48\x8D\x42\x18\x48\x89\x4A\x10")
F_DEF(luaL_prepbuffer, "\x48\x89\x5C\x24\x08\x57\x48\x83\xEC\x20\x4C\x8B\x01")
F_DEF(luaL_addlstring, "\x40\x55\x57\x41\x57\x48\x83\xEC\x20\x48\x8B\xF9")
//F_N(luaL_addstring, 2, ?)
F_DEF(luaL_addvalue, "\x48\x89\x6C\x24\x20\x57\x48\x83\xEC\x20\x48\x8B\x69\x10")
F_DEF(luaL_pushresult, "\x48\x89\x74\x24\x10\x48\x89\x7C\x24\x18\x41\x56\x48\x83\xEC\x20\x4C\x8B\x01")

F_DEF(luaopen_base, "\x48\x89\x5C\x24\x08\x48\x89\x6C\x24\x10\x48\x89\x74\x24\x18\x57\x48\x83\xEC\x20\x48\x8B\x71\x48")
F_DEF(luaopen_io, "\x48\x89\x5C\x24\x08\x48\x89\x6C\x24\x10\x48\x89\x74\x24\x18\x57\x48\x83\xEC\x20\x4C\x8D\x0D\x2A\x2A\x0A\x00")
//F_N(luaopen_os, 1, ?)
F_DEF(luaopen_string, "\x48\x89\x5C\x24\x08\x48\x89\x6C\x24\x10\x48\x89\x74\x24\x18\x57\x48\x83\xEC\x20\x4C\x8D\x0D\x2A\x2A\x0A\x00")
F_DEF(luaopen_math, "\x40\x53\x48\x83\xEC\x20\xBA\x20\x00\x00\x00")
F_DEF(luaopen_debug, "\x48\x83\xEC\x28\x4C\x8D\x0D\x2A\x2A\x0A\x00")
F_DEF(luaopen_package, "\x48\x89\x5C\x24\x08\x48\x89\x74\x24\x10\x48\x89\x7C\x24\x18\x41\x56\x48\x83\xEC\x30\x48\x8D\x15\x2A\x2A\x0A\x00")

//F_N(luaL_openlibs, 1, ?)
Loading

0 comments on commit 915b769

Please sign in to comment.