-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- the fast and furious series has a lot of sequels
- Loading branch information
Showing
7 changed files
with
169 additions
and
13 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,40 +1,66 @@ | ||
#pragma once | ||
|
||
#include "RE/B/BSTEvent.h" | ||
#include "RE/B/BSTSingleton.h" | ||
#include "RE/B/BSStringT.h" | ||
|
||
namespace RE | ||
{ | ||
class ConsoleLog | ||
struct ConsoleLogAddEvent; | ||
|
||
class __declspec(novtable) ConsoleLog : | ||
public BSTSingletonSDM<ConsoleLog>, | ||
public BSTEventSource<ConsoleLogAddEvent> | ||
{ | ||
public: | ||
SF_RTTI_VTABLE(ConsoleLog); | ||
|
||
// BSTSDM | ||
virtual ~ConsoleLog(); // 00 | ||
|
||
[[nodiscard]] static ConsoleLog* GetSingleton() | ||
{ | ||
static REL::Relocation<ConsoleLog**> singleton{ ID::ConsoleLog::singleton }; | ||
static REL::Relocation<ConsoleLog**> singleton{ ID::ConsoleLog::Singleton }; | ||
return *singleton; | ||
} | ||
|
||
void VPrint(const char* a_fmt, std::va_list a_args) | ||
void AddString(const char* a_str) | ||
{ | ||
using func_t = decltype(&ConsoleLog::AddString); | ||
static REL::Relocation<func_t> func{ ID::ConsoleLog::AddString }; | ||
func(this, a_str); | ||
} | ||
|
||
void Print(const char* a_fmt, std::va_list a_args) | ||
{ | ||
using func_t = decltype(&ConsoleLog::VPrint); | ||
static REL::Relocation<func_t> func{ ID::ConsoleLog::VPrint }; | ||
using func_t = decltype(&ConsoleLog::Print); | ||
static REL::Relocation<func_t> func{ ID::ConsoleLog::Print }; | ||
func(this, a_fmt, a_args); | ||
} | ||
|
||
// printf format rules, no compile time checking | ||
void Print(const char* a_fmt, ...) | ||
// std::printf rules, no compile time checking | ||
void PrintLine(const char* a_fmt, ...) | ||
{ | ||
std::va_list args; | ||
va_start(args, a_fmt); | ||
VPrint(a_fmt, args); | ||
Print(a_fmt, args); | ||
va_end(args); | ||
} | ||
|
||
// std::format rules, compile time checking | ||
// std::format rules, has compile time checking | ||
template <class... Args> | ||
void Log(const std::format_string<Args...> a_fmt, Args&&... a_args) | ||
{ | ||
Print(std::vformat(a_fmt.get(), std::make_format_args(a_args...)).c_str()); | ||
AddString(std::vformat(a_fmt.get(), std::make_format_args(a_args...)).c_str()); | ||
} | ||
|
||
void SetUseConsoleOverlay(bool a_value) | ||
{ | ||
useConsoleOverlay = a_value; | ||
} | ||
|
||
// members | ||
BSStringT<char> buffer; // 38 | ||
bool useConsoleOverlay; // 48 | ||
}; | ||
static_assert(sizeof(ConsoleLog) == 0x48); | ||
} |
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#pragma once | ||
|
||
#include "REX/W32/BASE.h" | ||
|
||
namespace REX::W32 | ||
{ | ||
struct EXCEPTION_REGISTRATION_RECORD; | ||
struct PEB_LDR_DATA; | ||
struct RTL_USER_PROCESS_PARAMETERS; | ||
struct UNICODE_STRING; | ||
|
||
using PS_POST_PROCESS_INIT_ROUTINE = void(*)(); | ||
|
||
struct LIST_ENTRY | ||
{ | ||
struct LIST_ENTRY* fLink; | ||
struct LIST_ENTRY* bLink; | ||
}; | ||
|
||
struct NT_TIB | ||
{ | ||
EXCEPTION_REGISTRATION_RECORD* exceptionList; | ||
void* stackBase; | ||
void* stackLimit; | ||
void* subSystemTib; | ||
union | ||
{ | ||
void* fiberData; | ||
std::uint32_t version; | ||
}; | ||
void* arbitraryUserPointer; | ||
struct NT_TIB* self; | ||
}; | ||
|
||
struct PEB | ||
{ | ||
std::byte reserved1[2]; | ||
std::byte beingDebugged; | ||
std::byte reserved2[1]; | ||
void* reserved3[2]; | ||
PEB_LDR_DATA* ldr; | ||
RTL_USER_PROCESS_PARAMETERS* processParameters; | ||
void* reserved4[3]; | ||
void* atlThunkSListPtr; | ||
void* reserved5; | ||
std::uint32_t reserved6; | ||
void* reserved7; | ||
std::uint32_t reserved8; | ||
std::uint32_t atlThunkSListPtr32; | ||
void* reserved9[45]; | ||
std::byte reserved10[96]; | ||
PS_POST_PROCESS_INIT_ROUTINE postProcessInitRoutine; | ||
std::byte reserved11[128]; | ||
void* reserved12[1]; | ||
std::uint32_t sessionID; | ||
}; | ||
|
||
struct PEB_LDR_DATA | ||
{ | ||
std::byte reserved1[8]; | ||
void* reserved2[3]; | ||
LIST_ENTRY inMemoryOrderModuleList; | ||
}; | ||
|
||
struct RTL_USER_PROCESS_PARAMETERS | ||
{ | ||
std::byte reserved1[16]; | ||
void* reserved2[10]; | ||
UNICODE_STRING imagePathName; | ||
UNICODE_STRING commandLine; | ||
}; | ||
|
||
struct TEB | ||
{ | ||
void* reserved1[11]; | ||
void* threadLocalStoragePointer; | ||
PEB* processEnvironmentBlock; | ||
void* reserved2[399]; | ||
std::byte reserved3[1952]; | ||
void* tlsSlots[64]; | ||
std::byte reserved4[8]; | ||
void* reserved5[26]; | ||
void* reservedForOle; | ||
void* reserved6[4]; | ||
void* tlsExpansionSlots; | ||
}; | ||
} | ||
|
||
namespace REX::W32 | ||
{ | ||
TEB* NtCurrentTeb() noexcept; | ||
} |
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