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

feat: a lot of additions, some 1.10.31.0 updates #245

Merged
merged 1 commit into from
Jul 13, 2024
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
8 changes: 5 additions & 3 deletions CommonLibSF/include/RE/A/Actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ namespace RE
virtual void Unk_133(); // 133
virtual void Unk_134(); // 134
virtual void Unk_135(); // 135
virtual void Unk_136(); // 136
virtual void Unk_137(); // 137
virtual void DrawWeaponMagicHands(bool a_draw); // 136
virtual void SetPosition(const NiPoint3& a_pos, bool a_updateCharController); // 137
virtual void Unk_138(); // 138
virtual void Resurrect(bool a_resetInventory, bool a_attach3D); // 139
virtual void Unk_13A(); // 13A
Expand Down Expand Up @@ -320,6 +320,7 @@ namespace RE
std::uint64_t unk350; // 350
std::uint64_t unk358; // 358
std::uint64_t unk360; // 360
std::uint64_t unk368; // 368
TESRace* race; // 368
Perks* perks; // 370
std::uint32_t unk378; // 378
Expand Down Expand Up @@ -379,6 +380,7 @@ namespace RE
std::uint64_t unk518; // 518
std::uint64_t unk520; // 520
std::uint64_t unk528; // 528
std::uint8_t unk530[88]; // 530
};
static_assert(sizeof(Actor) == 0x530);
static_assert(sizeof(Actor) == 0x570);
}
2 changes: 1 addition & 1 deletion CommonLibSF/include/RE/A/ArrowProjectile.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ namespace RE
// members
AlchemyItem* poison; // 2B0
};
static_assert(sizeof(ArrowProjectile) == 0x2C0);
static_assert(sizeof(ArrowProjectile) == 0x2B0);
}
20 changes: 20 additions & 0 deletions CommonLibSF/include/RE/B/BGSSaveLoadManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#pragma once

namespace RE
{
class BGSSaveLoadManager
{
static BGSSaveLoadManager* GetSingleton()
{
static REL::Relocation<BGSSaveLoadManager**> singleton{ REL::ID(880997) };
return *singleton;
}

bool DeleteSaveFile(const char* a_filename, void* a_unk1, bool a_unk2)
{
using func_t = decltype(&BGSSaveLoadManager::DeleteSaveFile);
REL::Relocation<func_t> func{ REL::ID(147844) };
return func(this, a_filename, a_unk1, a_unk2);
}
};
}
120 changes: 120 additions & 0 deletions CommonLibSF/include/RE/B/BSInputEnableLayer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#pragma once

#include "RE/B/BSInputEnableManager.h"

namespace RE
{
struct BSInputEnableLayer
{
enum UserFlag
{
Walking = (1 << 0),
Looking = (1 << 1),
Activation = (1 << 2), //Unconfirmed
TabMenuMaybe = (1 << 3), //Unconfirmed
Console = (1 << 4), //Unconfirmed
POVSwitch = (1 << 5), //Unconfirmed
Fighting = (1 << 6),
Sneaking = (1 << 7),
Menu = (1 << 8),
WheelZoom = (1 << 9), //Unconfirmed
Jumping = (1 << 10),
Movement = Walking | Jumping,
};

enum OtherFlag
{
Journal = (1 << 0),
Activate = (1 << 1),
FastTravel = (1 << 2),
CamSwitch = (1 << 3),
VATS = (1 << 4),
Favorites = (1 << 5),
PipboyLight = (1 << 6), //Unconfirmed
ZKey = (1 << 7),
Running = (1 << 8),
Unk = (1 << 9), //??
Sprinting = (1 << 10),
HandScanner = (1 << 11),
Takeoff = (1 << 12),
Inventory = (1 << 13),
Gravjump = (1 << 14),
FarTravel = (1 << 15),
LocationDiscovery = (1 << 16),
Others = HandScanner | Takeoff | Inventory | Gravjump | FarTravel,
};

uint32_t index;
uint32_t state;
uint64_t unk08;
uint64_t unk10;
uint64_t unk18;

uint64_t SetUserFlags(uint64_t flags, bool enabled)
{
using func_t = decltype(&BSInputEnableLayer::SetUserFlags);
REL::Relocation<func_t> func(REL::ID(106486));
return func(this, flags, enabled);
}

uint64_t SetOtherFlags(uint64_t flags, bool enabled)
{
using func_t = decltype(&BSInputEnableLayer::SetOtherFlags);
REL::Relocation<func_t> func(REL::ID(109447));
return func(this, flags, enabled);
}
};

class InputEnableLayer
{
public:
InputEnableLayer() {}

InputEnableLayer(const char* layerName)
{
Create(layerName);
}

~InputEnableLayer()
{
Free();
}

bool Create(const char* layerName)
{
bool result = true;
if (!data) {
result = BSInputEnableManager::GetSingleton()->CreateLayer(this, layerName);
if (!result)
data = nullptr;
}
return result;
}

bool Free()
{
bool result = true;
if (data) {
using func_t = decltype(&InputEnableLayer::Free);
REL::Relocation<func_t> func(REL::ID(36626));
result = func(this);
data = nullptr;
}
return result;
}

void SetUserFlags(uint64_t flags, bool enabled)
{
if (data)
data->SetUserFlags(flags, enabled);
}

void SetOtherFlags(uint64_t flags, bool enabled)
{
if (data)
data->SetOtherFlags(flags, enabled);
}

BSInputEnableLayer* data{ nullptr };
};
}
25 changes: 25 additions & 0 deletions CommonLibSF/include/RE/B/BSInputEnableManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#pragma once

namespace RE
{
class InputEnableLayer;

class BSInputEnableManager
{
public:
virtual ~BSInputEnableManager() = 0;

static BSInputEnableManager* GetSingleton()
{
REL::Relocation<BSInputEnableManager**> singleton{ REL::ID(878792) };
return *singleton;
}

bool CreateLayer(InputEnableLayer* a_layer, const char* a_layerName)
{
using func_t = decltype(&BSInputEnableManager::CreateLayer);
REL::Relocation<func_t> func(REL::ID(179101));
return func(this, a_layer, a_layerName);
}
};
}
72 changes: 71 additions & 1 deletion CommonLibSF/include/RE/B/BSInputEventUser.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "RE/M/MemoryManager.h"
#include "RE/B/BSFixedString.h"

namespace RE
{
Expand All @@ -13,6 +14,70 @@ namespace RE
class MouseMoveEvent;
class ThumbstickEvent;

class InputEvent
{
public:
enum DeviceType : uint32_t
{
DeviceKeyboard = 0,
DeviceMouse,
DeviceGamepad,
DeviceKinect,
};

enum EventType : uint32_t
{
Button = 0,
MouseMove,
CursorMove,
Char,
Thumbstick,
DeviceConnect,
Kinect,
None,
};

enum Status : uint32_t
{
Unhandled = 0,
Continue,
Stop,
};

virtual ~InputEvent() = default; //00
virtual bool Unk01() { return false; }
virtual BSFixedString GetUserEventOrDisabled() { return ""; }

uint32_t deviceType; //08
uint32_t deviceId;
uint32_t eventType; //10
uint32_t pad14;
InputEvent* next; //18
uint32_t timeCode; //20
uint32_t status;
};

class IDEvent : public InputEvent
{
public:
virtual ~IDEvent() = default;
BSFixedString userEvent; //28
uint32_t idCode; //30
bool disabled; //34
};

class ButtonEvent : public IDEvent
{
public:
virtual ~ButtonEvent() = default;
void* iCanBeDebounced; //38
void* iCanBeChorded; //40
float value; //48
float held; //4C
void* unk50;
void* bsDebounceManager;
};

class BSInputEventUser
{
public:
Expand All @@ -29,7 +94,12 @@ namespace RE
virtual void HandleEvent(const MouseMoveEvent*) { return; } // 06
virtual void HandleEvent(const CharacterEvent*) { return; } // 07
virtual void HandleEvent(const ButtonEvent*) { return; } // 08
virtual void Unk_09(const InputEvent*); // 09
virtual void InputEventUser_Unk_09(const InputEvent* a_event) // 09
{
using func_t = decltype(&BSInputEventUser::InputEventUser_Unk_09);
REL::Relocation<func_t> func(REL::ID(178899));
return func(this, a_event);
}

SF_HEAP_REDEFINE_NEW(BSInputEventUser);

Expand Down
3 changes: 1 addition & 2 deletions CommonLibSF/include/RE/B/BSTEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ namespace RE
public:
// members
BSTEventSource<Event>* eventSource; // 00
std::uint64_t unk08; // 08
};
static_assert(sizeof(BSTEventSourceLazyInit<void*>) == 0x10);
static_assert(sizeof(BSTEventSourceLazyInit<void*>) == 0x8);
}
Loading
Loading