Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch 2.0 #88

Merged
merged 5 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions include/RED4ext/Addresses.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,6 @@ constexpr uintptr_t TTypedClass_IsEqual = 0x140218000 - ImageBase; // 48 8B C4 4

#pragma region TweakDB
constexpr uintptr_t TweakDB_Get = 0x140124624 - ImageBase; // 48 83 EC ? 48 8B 05 ? ? ? ? 48 85 C0 74 0C, expected: 1, index: 0
constexpr uintptr_t TweakDB_StaticFlatDataBuffer = ImageBase;
constexpr uintptr_t TweakDB_InitFlatValue_ExceptInt32 = ImageBase;
constexpr uintptr_t TweakDB_FlatInt32ValueVftable = 0x141039432 - ImageBase; // 48 8D 05 ? ? ? ? 48 83 C2 07 4C 8D 4C 24 ? 48 83 E2 ? 4C 8D 44 24 50, expected: 9, index: 5
constexpr uintptr_t TweakDB_FlatArrayInt32ValueVftable = 0x1421CE864 - ImageBase; // 48 8D 05 ? ? ? ? 48 8B D3 48 89 07 E8 ? ? ? ?, expected: 29, index: 16
constexpr uintptr_t TweakDB_CreateRecord = 0x14028C938 - ImageBase; // 48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC ? 8B C2, expected: 6, index: 0
#pragma endregion

Expand Down
82 changes: 42 additions & 40 deletions include/RED4ext/GameEngine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ RED4EXT_ASSERT_SIZE(GameInstance, 0x138);
struct CBaseEngine
{
// https://github.com/yamashi/RED4ext/commit/2d30f32826276458f86da8b4c26940924044564d
struct UnkC0
struct UnkD0
{
uint8_t pad0[0x140];
uint32_t unk140;
Expand All @@ -66,10 +66,10 @@ struct CBaseEngine
uint8_t pad170[0x9];
uint8_t isClipped;
};
RED4EXT_ASSERT_OFFSET(UnkC0, unk154, 0x154);
RED4EXT_ASSERT_OFFSET(UnkC0, unk164, 0x164);
RED4EXT_ASSERT_OFFSET(UnkC0, hWnd, 0x168);
RED4EXT_ASSERT_OFFSET(UnkC0, isClipped, 0x179);
RED4EXT_ASSERT_OFFSET(UnkD0, unk154, 0x154);
RED4EXT_ASSERT_OFFSET(UnkD0, unk164, 0x164);
RED4EXT_ASSERT_OFFSET(UnkD0, hWnd, 0x168);
RED4EXT_ASSERT_OFFSET(UnkD0, isClipped, 0x179);

struct Unk108
{
Expand Down Expand Up @@ -150,55 +150,59 @@ struct CBaseEngine
int8_t unk58; // 58
int16_t unk5A; // 5A
int32_t interopStartingPort; // 5C
CString scriptsCompilationErrors; // 60
DynArray<CString> scriptsValidationErrors; // 80
int64_t unk90; // 90
int64_t unk98; // 98
int64_t unk60; // 60
int64_t unk68; // 68
CString scriptsCompilationErrors; // 70
DynArray<CString> scriptsValidationErrors; // 90
int64_t unkA0; // A0
int64_t unkA8; // A8
int64_t unkB0; // B0
int64_t unkB8; // B8
UnkC0* unkC0; // C0
double unkC8; // C8
double unkD0; // D0
int32_t unkD8; // D8
int64_t unkE0; // E0
int64_t unkE8; // E8
uint8_t padC0[0x10]; // C0
UnkD0* unkD0; // D0
double unkD8; // D8
double unkE0; // E0
int32_t unkE8; // E8
int64_t unkF0; // F0
volatile EEngineState engineState; // F8
int32_t unkFC; // FC
int32_t unk100; // 100
Unk108* unk108; // 108
Unk110 unk110; // 110
CString buildString; // 120
CString scriptsBlobPath; // 140
int32_t unk160; // 160
int8_t unk164; // 164
int64_t unk168; // 168
int64_t unk170; // 170
int64_t unkF8; // F8
int64_t unk100; // 100
volatile EEngineState engineState; // 108
int32_t unk10C; // 10C
int32_t unk110; // 110
Unk108* unk118; // 118
Unk110 unk120; // 120
CString buildString; // 130
CString scriptsBlobPath; // 150
int32_t unk170; // 170
int8_t unk174; // 174
int64_t unk178; // 178
int64_t unk180; // 180
int8_t unk188[178]; // 188
int32_t unk23C; // 23C
int8_t unk240[64]; // 240
DynArray<void*> unk280; // 280
int64_t unk188; // 188
int64_t unk190; // 190
int8_t unk198[178]; // 198
int32_t unk24C; // 24C
int8_t unk250[64]; // 250
DynArray<void*> unk290; // 290
int64_t unk2A0; // 2A0
int64_t unk2A8; // 2A8
DynArray<void*> unk2A0; // 2A0
int64_t unk2B0; // 2B0
int64_t unk2B8; // 2B8
int32_t unk2C0; // 2C0
int64_t unk2C0; // 2C0
int64_t unk2C8; // 2C8
int64_t unk2D0; // 2D0
int32_t unk2D0; // 2D0
int64_t unk2D8; // 2D8
int64_t unk2E0; // 2E0
};
RED4EXT_ASSERT_SIZE(CBaseEngine, 0x2D8);
RED4EXT_ASSERT_OFFSET(CBaseEngine, unkC0, 0xC0);
RED4EXT_ASSERT_SIZE(CBaseEngine, 0x2E8);
RED4EXT_ASSERT_OFFSET(CBaseEngine, scriptsLoaded, 0x54);
RED4EXT_ASSERT_OFFSET(CBaseEngine, unkD0, 0xD0);
RED4EXT_ASSERT_OFFSET(CBaseEngine, scriptsValidationErrors, 0x90);
RED4EXT_ASSERT_OFFSET(CBaseEngine, scriptsBlobPath, 0x150);

struct BaseGameEngine : CBaseEngine
{
int64_t unk2D8; // 2D8
int64_t unk2E8; // 2E8
};
RED4EXT_ASSERT_SIZE(BaseGameEngine, 0x2E0);
RED4EXT_ASSERT_SIZE(BaseGameEngine, 0x2F0);

struct CGameEngine : BaseGameEngine
{
Expand All @@ -215,8 +219,6 @@ struct CGameEngine : BaseGameEngine

static CGameEngine* Get();

int64_t unk2E0; // 2E0
int64_t unk2E8; // 2E8
int64_t unk2F0; // 2F0
int64_t unk2F8; // 2F8
int32_t unk300; // 300
Expand Down
42 changes: 22 additions & 20 deletions include/RED4ext/RTTISystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,32 +36,34 @@ struct IRTTISystem
virtual void GetDerivedClasses(CClass* aBaseClass, DynArray<CClass*>& aClasses) = 0; // 78
virtual void RegisterType(CBaseRTTIType* aType, uint32_t aAsyncId) = 0; // 80
virtual void sub_88() = 0; // 88
virtual void UnregisterType(CBaseRTTIType* aType) = 0; // 90
virtual void RegisterFunction(CGlobalFunction* aFunc) = 0; // 98
virtual void UnregisterFunction(CGlobalFunction* aFunc) = 0; // A0
virtual void sub_A8() = 0; // A8
virtual void AddRegisterCallback(Callback<void (*)()>) = 0; // B0
virtual void AddPostRegisterCallback(Callback<void (*)()>) = 0; // B8
virtual void sub_C0() = 0; // C0
virtual void sub_C8() = 0; // C8
virtual void CreateScriptedClass(CName aName, CClass::Flags aFlags, CClass* aParent) = 0; // D0
virtual void sub_90() = 0; // 90 - added in 2.0
virtual void UnregisterType(CBaseRTTIType* aType) = 0; // 98
virtual void RegisterFunction(CGlobalFunction* aFunc) = 0; // A0
virtual void UnregisterFunction(CGlobalFunction* aFunc) = 0; // A8
virtual void sub_B0() = 0; // B0
virtual void sub_B8() = 0; // B8 - added in 2.0
virtual void AddRegisterCallback(Callback<void (*)()>) = 0; // C0
virtual void AddPostRegisterCallback(Callback<void (*)()>) = 0; // C8
virtual void sub_D0() = 0; // D0
virtual void sub_D8() = 0; // D8
virtual void CreateScriptedClass(CName aName, CClass::Flags aFlags, CClass* aParent) = 0; // E0
virtual void CreateScriptedEnum(
CName aName, int8_t aSize,
DynArray<uint64_t>& aMembers) = 0; // D8 - The members array is not of type "uint64_t", it is a struct
DynArray<uint64_t>& aMembers) = 0; // E8 - The members array is not of type "uint64_t", it is a struct
// containing the name and the value of the enumerator.
virtual void CreateScriptedBitfield(
CName aName, DynArray<uint64_t>& aBits) = 0; // E0 - The bits array is not of type "uint64_t", it is a struct
CName aName, DynArray<uint64_t>& aBits) = 0; // F0 - The bits array is not of type "uint64_t", it is a struct
// containing the name and the bit.
virtual void InitializeScriptRuntime() = 0; // E8 - Called by script loader at the very end
virtual void RegisterScriptName(CName aNativeName, CName aScriptedName) = 0; // F0
virtual CClass* GetClassByScriptName(CName aName) = 0; // F8
virtual CEnum* GetEnumByScriptName(CName aName) = 0; // 100
virtual CName ConvertNativeToScriptName(CName aName) = 0; // 108
virtual CName ConvertScriptToNativeName(CName aName) = 0; // 110
virtual CString* GetStringConst(uint32_t aIndex) = 0; // 118 - Used by StringConst opcode (0x10)
virtual void SetStringTable(DynArray<CString>& aStrings) = 0; // 120 - Called by script loader
virtual void InitializeScriptRuntime() = 0; // F8 - Called by script loader at the very end
virtual void RegisterScriptName(CName aNativeName, CName aScriptedName) = 0; // 100
virtual CClass* GetClassByScriptName(CName aName) = 0; // 108
virtual CEnum* GetEnumByScriptName(CName aName) = 0; // 110
virtual CName ConvertNativeToScriptName(CName aName) = 0; // 118
virtual CName ConvertScriptToNativeName(CName aName) = 0; // 120
virtual CString* GetStringConst(uint32_t aIndex) = 0; // 128 - Used by StringConst opcode (0x10)
virtual void SetStringTable(DynArray<CString>& aStrings) = 0; // 130 - Called by script loader

virtual ~IRTTISystem() = 0; // 128
virtual ~IRTTISystem() = 0; // 138
};
RED4EXT_ASSERT_SIZE(IRTTISystem, 0x8);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@

// This file is generated from the Game's Reflection data

#include <RED4ext/Scripting/Natives/gameAppearanceNameVisualTagsPreset.hpp>

namespace RED4ext
{
RED4EXT_ASSERT_SIZE(game::AppearanceNameVisualTagsPreset, 0x40);
using gameAppearanceNameVisualTagsPreset = game::AppearanceNameVisualTagsPreset;
} // namespace RED4ext

/*
#include <cstdint>
#include <RED4ext/Common.hpp>
#include <RED4ext/DynArray.hpp>
Expand All @@ -34,6 +25,5 @@ RED4EXT_ASSERT_SIZE(AppearanceNameVisualTagsPreset, 0x40);
} // namespace game
using gameAppearanceNameVisualTagsPreset = game::AppearanceNameVisualTagsPreset;
} // namespace RED4ext
*/

// clang-format on

This file was deleted.

37 changes: 20 additions & 17 deletions include/RED4ext/Scripting/Natives/gameITransactionSystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,43 +81,46 @@ struct ITransactionSystem : IGameSystem
virtual void sub_388() = 0; // 388
virtual void sub_390() = 0; // 390
virtual void sub_398() = 0; // 398
virtual bool IsSlotEmpty(IScriptable* aOwner, TweakDBID aSlotID) = 0; // 3A0
virtual bool IsSlotSpawning(IScriptable* aOwner, TweakDBID aSlotID) = 0; // 3A8
virtual void sub_3A0() = 0; // 3A0
virtual void sub_3A8() = 0; // 3A8
virtual void sub_3B0() = 0; // 3B0
virtual void sub_3B8() = 0; // 3B8
virtual void sub_3C0() = 0; // 3C0
virtual bool IsSlotEmpty(IScriptable* aOwner, TweakDBID aSlotID) = 0; // 3B8
virtual bool IsSlotSpawning(IScriptable* aOwner, TweakDBID aSlotID) = 0; // 3C0
virtual void sub_3C8() = 0; // 3C8
virtual void sub_3D0() = 0; // 3D0
virtual void sub_3D8() = 0; // 3D8
virtual void sub_3E0() = 0; // 3E0
virtual void sub_3E8() = 0; // 3E8
virtual bool GetItemInSlot(IScriptable* aOwner, TweakDBID aSlotID, const Handle<IScriptable>& aItem) = 0; // 3F0
virtual void sub_3F0() = 0; // 3F0
virtual void sub_3F8() = 0; // 3F8
virtual void GetSlotDataList(IScriptable* aOwner, DynArray<AttachmentSlotData>& aList) = 0; // 400
virtual void sub_408() = 0; // 408
virtual void sub_400() = 0; // 400
virtual bool GetItemInSlot(IScriptable* aOwner, TweakDBID aSlotID, const Handle<IScriptable>& aItem) = 0; // 408
virtual void sub_410() = 0; // 410
virtual AttachmentSlotData* FindSlotData(IScriptable* aOwner, AttachmentSlotDataPredicate&& aPredicate) = 0; // 418
virtual void GetSlotDataList(IScriptable* aOwner, DynArray<AttachmentSlotData>& aList) = 0; // 418
virtual void sub_420() = 0; // 420
virtual void sub_428() = 0; // 428
virtual void sub_430() = 0; // 430
virtual AttachmentSlotData* FindSlotData(IScriptable* aOwner, AttachmentSlotDataPredicate&& aPredicate) = 0; // 430
virtual void sub_438() = 0; // 438
virtual void sub_440() = 0; // 440
virtual void sub_448() = 0; // 448
virtual void sub_450() = 0; // 450
virtual void sub_458() = 0; // 458
virtual void RegisterSlotListener(IScriptable* aOwner, Handle<IAttachmentSlotsListener> aListener) = 0; // 460
virtual void UnregisterSlotListener(IScriptable* aOwner, Handle<IAttachmentSlotsListener> aListener) = 0; // 468
virtual void sub_460() = 0; // 460
virtual void sub_468() = 0; // 468
virtual void sub_470() = 0; // 470
virtual void sub_478() = 0; // 478
virtual void sub_480() = 0; // 480
virtual void RegisterSlotListener(IScriptable* aOwner, Handle<IAttachmentSlotsListener> aListener) = 0; // 478
virtual void UnregisterSlotListener(IScriptable* aOwner, Handle<IAttachmentSlotsListener> aListener) = 0; // 480
virtual void sub_488() = 0; // 488
virtual void sub_490() = 0; // 490
virtual void sub_498() = 0; // 498
virtual void sub_4A0() = 0; // 4A0
virtual void sub_4A8() = 0; // 4A8
virtual void sub_4B0() = 0; // 4B0
virtual bool MatchVisualTagByItemID(const ItemID& aItemID, const Handle<IScriptable>& aOwner,
CName aTag) = 0; // 4A0
virtual bool MatchVisualTag(const Handle<IScriptable>& aItem, CName aTag, bool aUseDefaultAppearance) = 0; // 4A8
virtual void sub_4B0() = 0; // 4B0
virtual void sub_4B8() = 0; // 4B8
CName aTag) = 0; // 4B8
virtual bool MatchVisualTag(const Handle<IScriptable>& aItem, CName aTag, bool aUseDefaultAppearance) = 0; // 4C0
virtual void sub_4C8() = 0; // 4C8
virtual void sub_4D0() = 0; // 4D0
};
RED4EXT_ASSERT_SIZE(ITransactionSystem, 0x48);
} // namespace game
Expand Down
Loading