Reverse-engineered class, structure, enum, virtual-function and member-function definitions for Fallout: New Vegas (FalloutNV.exe 1.4.0.525, 32-bit) in the style of CommonLibF4, plus the small NVSE layer a plugin needs to load into xNVSE.
Names, types, member offsets and sizes are checked against the x86 executable (allocation sizes, constructors, accessed offsets). Offset comments show how much evidence a position has (see Conventions).
CommonLibNV is a port of the CommonLib family to Fallout: New Vegas:
- CommonLibF4 is the model for the game definitions: the
include/RE/<first letter>/<Class>.htree withRE/Fallout.has the aggregate header, one header per class/struct/enum, member functions asREL::Relocationforwarders, numbered virtual functions withUnk_XXfillers,// memberssections with offset comments,static_assert(sizeof)where a size is known, nested types defined inside their class, theOffsets/RTTI/VTABLEconstant tables, the NVSE plugin layer shaped like F4SE's (Init,QueryInterface/LoadInterface, messaging, serialization) and the xmake plugin rule used by the template. Fallout: New Vegas has no Address Library and is a 32-bit game, so IDs are replaced by plain image-relative offsets. - CommonLib-Shared supplies the runtime that CommonLibF4 itself builds on (
REL: relocation, offsets, version, trampoline;REX: logging, settings, Windows wrappers). It is folded into this repository (include/REL,include/REX,src/REL,src/REX) and reduced to x86, see Layout. - xNVSE is the plugin host: the plugin API and ABI (
PluginAPI) are the ones it defines; its sources are only a cross-check for names and offsets, not a source of the definitions.
Like those projects, CommonLibNV is licensed GPL-3.0 with the modding exception (see License).
| Path | Content |
|---|---|
include/RE, src/RE |
game classes, structs, enums, templates, Offsets*.h |
include/NVSE, src/NVSE |
plugin API for NVSE: Init, QueryInterface/LoadInterface, PluginInfo, messaging, serialization, console, command table, string/array variables, script, event manager, command definitions |
include/REL, include/REX, src/REL, src/REX |
the shared CommonLib runtime (Relocation, Offset, Version, logging, settings, W32 wrappers), folded in from libxse/commonlib-shared and converted to x86 only: the Address Library (ID/IDDB) code and every x64 code path (64-bit PE headers and thunks, the 14-byte jump stubs JMP14/CALL16, the x64 call-convention helpers, __readgsqword, ±2GB trampoline placement) have been removed |
- There is no Address Library: member-function forwarders use
REL::Offset(relative to the image base0x400000), seeRE/Offsets.h,RE/Offsets_RTTI.h,RE/Offsets_VTABLE.h. - Member-function forwarders take their type from the declaration:
using func_t = decltype(&Class::Func); static REL::Relocation<func_t> func{ Offsets::Class::Func }; return func(this, ...);.REL::invokeisstd::invoke, and member function pointers arethiscallon x86 (also for classes with multiple inheritance: the address is placed in a zero-filled member pointer). Overloaded functions spell the member pointer type (Ret (Class::*)(Args)), static functions get their__cdeclpointer type from the samedecltype; constructors, destructors and variadic functions, whose address cannot be taken or is called differently, spell the free function type with__thiscall/__cdeclandthisas the first parameter. - Offset comments:
// 1Cderived from the x86 binary,// 1C?extrapolated (unverified).// not placed:lists members of the class that could not be placed; their space is covered bypadXX. static_assert(sizeof(...))is only present where the size was measured (allocation sites, sized deletes, array construction); every one of them compiles.// not confirmed: ...marks a type that no named code in the executable refers to, so its layout could not be checked.- The game was built with Visual Studio 2010, whose
std::vector(24 bytes) andstd::string(28 bytes) have a different layout from the standard library of current toolsets. Members therefore use the read-only layout viewsRE::stl::vector<T>/RE::stl::string(NVSE/Impl/STL.h) instead of thestd::types. - Virtual functions are numbered with the x86 vtable slot;
Unk_XXfills slots that have no known name. - Nested types that only their outer class uses are defined inside it (
Projectile::ImpactData); nested types that other headers share are separate headers (Parent_Child, withusing Child = Parent_Child;in the parent). Anonymous types are folded into their owners as inline unions/structs. Platform and library internals that are not part of the game interface are not generated; members that pointed at them arevoid*or opaque byte arrays. RE/Fallout.hincludes everything that compiles on its own; headers that do not compile on their own are present in the tree but not aggregated.- The game headers include
NVSE/Impl/Windows.h, which includes<Windows.h>after CommonLib and#undefs theA/Walias macros (LoadString,CreateFile, …) because they rename game member functions. Call the explicit…A/…WWindows functions, or useREX::W32. - Hooking is ported to x86: rel32 branches (
CALL5/JMP5) reach every address and need no stub,call/jmp [mem](CALL6/JMP6) use an absolute pointer cell allocated in the trampoline (created lazily if you did not size one),Relocation::replace_funcwrites aJMP5, andREX::FModulereads PE32 headers.NVSE::InitInfohastrampoline,trampolineSizeandhooklike F4SE.
- XMake 3.0.0+
- MSVC (Visual Studio 2022) for x86
xmake f -p windows -a x86 -m releasedbg
xmake build commonlibnvUse it from a plugin project (see commonlibnv-template); the plugin version is the xmake set_version (reported to NVSE, logged as major.minor.patch and written to the dll's version resource):
includes("lib/commonlibnv")
set_version("1.0.0")
target("my-plugin")
add_rules("commonlibnv.plugin", { name = "my-plugin", author = "me" })
add_files("src/**.cpp")
set_pcxxheader("src/pch.h")with a precompiled header containing #include <RE/Fallout.h> and #include <NVSE/NVSE.h>. Optional build outputs go to XSE_FNV_MODS_PATH (a mod manager mods folder) or XSE_FNV_GAME_PATH (the game folder).
GPL-3.0 with the modding exception, see LICENSE and EXCEPTIONS.