#pragma once #include "Engine/Game/Build/fingerprint.h" // The game's Lua is stock Lua 5.2 with every standard library open. These are the functions in // it that reach outside Lua (Extension/Scripting/lua_native_block.h). Found from the libraries' // registration tables in .rodata (package at 0x6445c30, os at 0x6445f90, io at 0x6446150). namespace dingosdk::game::build::v20260929::lua_natives { // int ll_loadfunc(lua_State*, const char* path, const char* symbol): the one place Lua loads a // DLL (LoadLibraryExA). package.loadlib calls it, and so does require through both C searchers // (by way of loadfunc at 0x334cfa0). 0 on success; 1 with a message pushed when the DLL does // not load. inline constexpr Fingerprint load_library{0x334d4d0, {0x48,0x89,0x5c,0x24,0x10,0x48,0x89,0x6c,0x24,0x18,0x56,0x57,0x41,0x54,0x41,0x56,0x41,0x57,0x48,0x83,0xec,0x30,0x48,0x8b,0x59,0x10,0x4c,0x8d,0x25,0xdb,0x91,0x0f}}; // const char* lua_pushfstring(lua_State*, const char* format, ...). inline constexpr Fingerprint push_format{0x33663f0, {0x48,0x89,0x54,0x24,0x10,0x4c,0x89,0x44,0x24,0x18,0x4c,0x89,0x4c,0x24,0x20,0x53,0x48,0x83,0xec,0x20,0x48,0x8b,0x41,0x18,0x48,0x8b,0xd9,0x48,0x83,0x78,0x18,0x00}}; // void f_parser(lua_State*, SParser*): compiles a chunk, or undumps one that starts with the // bytecode signature. It checks the chunk's kind against SParser::mode. inline constexpr Fingerprint parse_chunk{0x3347400, {0x40,0x53,0x55,0x56,0x57,0x48,0x83,0xec,0x38,0x4c,0x8b,0x02,0x48,0x8b,0xda,0x48,0x8b,0xf1,0x45,0x8b,0x08,0x41,0x8d,0x41,0xff,0x41,0x89,0x00,0x48,0x8b,0x3a,0x45}}; // const char* SParser::mode ("b", "t", "bt" or null for both); name follows at 0x50. inline constexpr std::uintptr_t parser_mode_offset = 0x48; // lua_CFunctions of the os and io libraries. inline constexpr Fingerprint os_execute{0x33379b0, {0x48,0x89,0x5c,0x24,0x08,0x57,0x48,0x83,0xec,0x20,0x48,0x8b,0x41,0x20,0x48,0x8b,0xd9,0x48,0x8b,0x10,0x48,0x83,0xc2,0x10,0x48,0x3b,0x51,0x10,0x73,0x7c,0x48,0x8d}}; inline constexpr Fingerprint os_remove{0x3337a90, {0x48,0x89,0x5c,0x24,0x08,0x48,0x89,0x74,0x24,0x10,0x57,0x48,0x83,0xec,0x20,0x48,0x8b,0x41,0x20,0x48,0x8d,0x1d,0x56,0xdf,0x10,0x03,0x48,0x8b,0xf9,0x48,0x8b,0x10}}; inline constexpr Fingerprint os_rename{0x3337ba0, {0x48,0x89,0x5c,0x24,0x08,0x48,0x89,0x74,0x24,0x10,0x57,0x48,0x83,0xec,0x20,0x48,0x8b,0x41,0x20,0x48,0x8d,0x3d,0x46,0xde,0x10,0x03,0x48,0x8b,0xf7,0x48,0x8b,0xd9}}; inline constexpr Fingerprint io_popen{0x333bc00, {0x40,0x53,0x55,0x56,0x57,0x48,0x83,0xec,0x28,0x48,0x8b,0x41,0x20,0x48,0x8d,0x1d,0xec,0x9d,0x10,0x03,0x48,0x8b,0xf3,0x48,0x8b,0xf9,0x48,0x8b,0x10,0x48,0x83,0xc2}}; inline constexpr Fingerprint io_open{0x333b9f0, {0x40,0x53,0x55,0x56,0x57,0x48,0x83,0xec,0x28,0x48,0x8b,0x41,0x20,0x48,0x8d,0x1d,0xfc,0x9f,0x10,0x03,0x48,0x8b,0xf3,0x48,0x8b,0xf9,0x48,0x8b,0x10,0x48,0x83,0xc2}}; inline constexpr Fingerprint io_output{0x333be90, {0x4c,0x8d,0x05,0xa1,0x15,0xe6,0x02,0x48,0x8d,0x15,0x4a,0xb8,0x10,0x03,0xe9,0xcd,0xd8,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc}}; }