-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0279a56
commit f540e01
Showing
7 changed files
with
476 additions
and
479 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,67 @@ | ||
#pragma once | ||
|
||
class Forms | ||
{ | ||
private: | ||
static std::uint32_t HookInitializer_DefaultObject() | ||
{ | ||
// Initializer Override | ||
UnarmedPlayerWeapon_DO = | ||
RE::DefaultObjectFormFactory::Create( | ||
"UnarmedPlayerWeapon_DO", | ||
"The unarmed weapon used to calculate the player's displayed attack stats when no weapon is equipped.", | ||
RE::ENUM_FORM_ID::kWEAP); | ||
|
||
// Add new | ||
BWA_bEnabled_DO = | ||
RE::DefaultObjectFormFactory::Create( | ||
"BWA_bEnabled_DO", | ||
RE::ENUM_FORM_ID::kGLOB); | ||
|
||
BWA_bOverrideInAir_DO = | ||
RE::DefaultObjectFormFactory::Create( | ||
"BWA_bOverrideInAir_DO", | ||
RE::ENUM_FORM_ID::kGLOB); | ||
|
||
BWA_bOverrideInCombat_DO = | ||
RE::DefaultObjectFormFactory::Create( | ||
"BWA_bOverrideInCombat_DO", | ||
RE::ENUM_FORM_ID::kGLOB); | ||
|
||
BWA_bOverrideTrespassing_DO = | ||
RE::DefaultObjectFormFactory::Create( | ||
"BWA_bOverrideTrespassing_DO", | ||
RE::ENUM_FORM_ID::kGLOB); | ||
|
||
BWA_bOverrideTakingHealthDamage_DO = | ||
RE::DefaultObjectFormFactory::Create( | ||
"BWA_bOverrideTakingHealthDamage_DO", | ||
RE::ENUM_FORM_ID::kGLOB); | ||
|
||
BWA_bOverrideTakingRadDamage_DO = | ||
RE::DefaultObjectFormFactory::Create( | ||
"BWA_bOverrideTakingRadDamage_DO", | ||
RE::ENUM_FORM_ID::kGLOB); | ||
|
||
logger::debug("Injected DefaultObjects"sv); | ||
return 1; | ||
} | ||
|
||
// members | ||
inline static RE::BGSDefaultObject* UnarmedPlayerWeapon_DO{ nullptr }; | ||
|
||
public: | ||
static void InstallHooks() | ||
{ | ||
REL::Relocation<std::uintptr_t> targetDefault{ REL::ID(1158572) }; | ||
stl::asm_replace(targetDefault.address(), 0x31, reinterpret_cast<std::uintptr_t>(HookInitializer_DefaultObject)); | ||
} | ||
|
||
// members | ||
inline static RE::BGSDefaultObject* BWA_bEnabled_DO{ nullptr }; | ||
inline static RE::BGSDefaultObject* BWA_bOverrideInAir_DO{ nullptr }; | ||
inline static RE::BGSDefaultObject* BWA_bOverrideInCombat_DO{ nullptr }; | ||
inline static RE::BGSDefaultObject* BWA_bOverrideTrespassing_DO{ nullptr }; | ||
inline static RE::BGSDefaultObject* BWA_bOverrideTakingHealthDamage_DO{ nullptr }; | ||
inline static RE::BGSDefaultObject* BWA_bOverrideTakingRadDamage_DO{ nullptr }; | ||
}; | ||
#pragma once | ||
|
||
class Forms | ||
{ | ||
private: | ||
static std::uint32_t HookInitializer_DefaultObject() | ||
{ | ||
// Initializer Override | ||
UnarmedPlayerWeapon_DO = | ||
RE::DefaultObjectFormFactory::Create( | ||
"UnarmedPlayerWeapon_DO", | ||
"The unarmed weapon used to calculate the player's displayed attack stats when no weapon is equipped.", | ||
RE::ENUM_FORM_ID::kWEAP); | ||
|
||
// Add new | ||
BWA_bEnabled_DO = | ||
RE::DefaultObjectFormFactory::Create( | ||
"BWA_bEnabled_DO", | ||
RE::ENUM_FORM_ID::kGLOB); | ||
|
||
BWA_bOverrideInAir_DO = | ||
RE::DefaultObjectFormFactory::Create( | ||
"BWA_bOverrideInAir_DO", | ||
RE::ENUM_FORM_ID::kGLOB); | ||
|
||
BWA_bOverrideInCombat_DO = | ||
RE::DefaultObjectFormFactory::Create( | ||
"BWA_bOverrideInCombat_DO", | ||
RE::ENUM_FORM_ID::kGLOB); | ||
|
||
BWA_bOverrideTrespassing_DO = | ||
RE::DefaultObjectFormFactory::Create( | ||
"BWA_bOverrideTrespassing_DO", | ||
RE::ENUM_FORM_ID::kGLOB); | ||
|
||
BWA_bOverrideTakingHealthDamage_DO = | ||
RE::DefaultObjectFormFactory::Create( | ||
"BWA_bOverrideTakingHealthDamage_DO", | ||
RE::ENUM_FORM_ID::kGLOB); | ||
|
||
BWA_bOverrideTakingRadDamage_DO = | ||
RE::DefaultObjectFormFactory::Create( | ||
"BWA_bOverrideTakingRadDamage_DO", | ||
RE::ENUM_FORM_ID::kGLOB); | ||
|
||
logger::debug("Injected DefaultObjects"sv); | ||
return 1; | ||
} | ||
|
||
// members | ||
inline static RE::BGSDefaultObject* UnarmedPlayerWeapon_DO{ nullptr }; | ||
|
||
public: | ||
static void InstallHooks() | ||
{ | ||
REL::Relocation<std::uintptr_t> targetDefault{ REL::ID(1158572) }; | ||
stl::asm_replace(targetDefault.address(), 0x31, reinterpret_cast<std::uintptr_t>(HookInitializer_DefaultObject)); | ||
} | ||
|
||
// members | ||
inline static RE::BGSDefaultObject* BWA_bEnabled_DO{ nullptr }; | ||
inline static RE::BGSDefaultObject* BWA_bOverrideInAir_DO{ nullptr }; | ||
inline static RE::BGSDefaultObject* BWA_bOverrideInCombat_DO{ nullptr }; | ||
inline static RE::BGSDefaultObject* BWA_bOverrideTrespassing_DO{ nullptr }; | ||
inline static RE::BGSDefaultObject* BWA_bOverrideTakingHealthDamage_DO{ nullptr }; | ||
inline static RE::BGSDefaultObject* BWA_bOverrideTakingRadDamage_DO{ nullptr }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,37 @@ | ||
#include "PCH.h" | ||
|
||
namespace stl | ||
{ | ||
namespace detail | ||
{ | ||
struct asm_patch : | ||
Xbyak::CodeGenerator | ||
{ | ||
asm_patch(std::uintptr_t a_dst) | ||
{ | ||
Xbyak::Label dst; | ||
|
||
jmp(ptr[rip + dst]); | ||
|
||
L(dst); | ||
dq(a_dst); | ||
} | ||
}; | ||
} | ||
|
||
void asm_jump(std::uintptr_t a_from, [[maybe_unused]] std::size_t a_size, std::uintptr_t a_to) | ||
{ | ||
detail::asm_patch p{ a_to }; | ||
p.ready(); | ||
assert(p.getSize() <= a_size); | ||
REL::safe_write( | ||
a_from, | ||
std::span{ p.getCode<const std::byte*>(), p.getSize() }); | ||
} | ||
|
||
void asm_replace(std::uintptr_t a_from, std::size_t a_size, std::uintptr_t a_to) | ||
{ | ||
REL::safe_fill(a_from, REL::INT3, a_size); | ||
asm_jump(a_from, a_size, a_to); | ||
} | ||
} | ||
#include "PCH.h" | ||
|
||
namespace stl | ||
{ | ||
namespace detail | ||
{ | ||
struct asm_patch : | ||
Xbyak::CodeGenerator | ||
{ | ||
asm_patch(std::uintptr_t a_dst) | ||
{ | ||
Xbyak::Label dst; | ||
|
||
jmp(ptr[rip + dst]); | ||
|
||
L(dst); | ||
dq(a_dst); | ||
} | ||
}; | ||
} | ||
|
||
void asm_jump(std::uintptr_t a_from, [[maybe_unused]] std::size_t a_size, std::uintptr_t a_to) | ||
{ | ||
detail::asm_patch p{ a_to }; | ||
p.ready(); | ||
assert(p.getSize() <= a_size); | ||
REL::safe_write( | ||
a_from, | ||
std::span{ p.getCode<const std::byte*>(), p.getSize() }); | ||
} | ||
|
||
void asm_replace(std::uintptr_t a_from, std::size_t a_size, std::uintptr_t a_to) | ||
{ | ||
REL::safe_fill(a_from, REL::INT3, a_size); | ||
asm_jump(a_from, a_size, a_to); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
#pragma once | ||
|
||
#define WIN32_LEAN_AND_MEAN | ||
#define NOMINMAX | ||
|
||
#include "F4SE/F4SE.h" | ||
#include "RE/Fallout.h" | ||
|
||
#include <AutoTOML.hpp> | ||
#include <spdlog/sinks/basic_file_sink.h> | ||
#include <xbyak/xbyak.h> | ||
|
||
#define DLLEXPORT __declspec(dllexport) | ||
|
||
using namespace std::literals; | ||
|
||
namespace logger = F4SE::log; | ||
|
||
namespace stl | ||
{ | ||
using namespace F4SE::stl; | ||
|
||
void asm_replace(std::uintptr_t a_from, std::size_t a_size, std::uintptr_t a_to); | ||
} | ||
|
||
#pragma once | ||
|
||
#define WIN32_LEAN_AND_MEAN | ||
#define NOMINMAX | ||
|
||
#include "F4SE/F4SE.h" | ||
#include "RE/Fallout.h" | ||
|
||
#include <AutoTOML.hpp> | ||
#include <spdlog/sinks/basic_file_sink.h> | ||
#include <xbyak/xbyak.h> | ||
|
||
#define DLLEXPORT __declspec(dllexport) | ||
|
||
using namespace std::literals; | ||
|
||
namespace logger = F4SE::log; | ||
|
||
namespace stl | ||
{ | ||
using namespace F4SE::stl; | ||
|
||
void asm_replace(std::uintptr_t a_from, std::size_t a_size, std::uintptr_t a_to); | ||
} | ||
|
||
// clang-format off | ||
#include "Version.h" | ||
#include "Settings.h" | ||
// clang-format on | ||
#include "Settings.h" | ||
// clang-format on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
#pragma once | ||
|
||
#include "Papyrus/BakaWaitAnywhere.h" | ||
|
||
namespace Papyrus | ||
{ | ||
bool RegisterFunctions(RE::BSScript::IVirtualMachine* a_VM) | ||
{ | ||
a_VM->BindNativeMethod("BakaWaitAnywhere", "Wait", BakaWaitAnywhere::Wait, true); | ||
return true; | ||
} | ||
} | ||
#pragma once | ||
|
||
#include "Papyrus/BakaWaitAnywhere.h" | ||
|
||
namespace Papyrus | ||
{ | ||
bool RegisterFunctions(RE::BSScript::IVirtualMachine* a_VM) | ||
{ | ||
a_VM->BindNativeMethod("BakaWaitAnywhere", "Wait", BakaWaitAnywhere::Wait, true); | ||
return true; | ||
} | ||
} |
Oops, something went wrong.