Skip to content
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
25 changes: 25 additions & 0 deletions include/RE/B/BlurEvent.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#pragma once

#include "RE/B/BSTEvent.h"

namespace RE
{
struct BlurEvent
{
public:
enum class Type : std::uint32_t
{
kIncrement = 0,
kDecrement = 1
};

[[nodiscard]] static BSTEventSource<BlurEvent>* GetEventSource()
{
static REL::Relocation<BSTEventSource<BlurEvent>*> source{ ID::BlurEvent::GetEventSource };
return source.get();
}

Type type; // 00
};
static_assert(sizeof(BlurEvent) == 0x4);
}
12 changes: 12 additions & 0 deletions include/RE/IDs.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ namespace RE::ID
inline constexpr REL::ID GetEventSource{ 0 }; // 131237
}

namespace BlurEvent
{
inline constexpr REL::ID GetEventSource{ 940149 };
}

namespace BooksRead::Event
{
inline constexpr REL::ID GetEventSource{ 0 }; // 103540
Expand Down Expand Up @@ -2401,6 +2406,13 @@ namespace RE::ID
inline constexpr REL::ID RegisterMenu{ 0 }; // 80375
}

namespace UIBlurManager
{
inline constexpr REL::ID Singleton{ 949563 };
inline constexpr REL::ID ProcessDefaultObjectsReadyEvent{ 114425 };
inline constexpr REL::ID ProcessBlurEvent{ 114426 };
}

namespace UIMenuChargenMenuDisablePaperdoll
{
inline constexpr REL::ID GetEventSource{ 0 }; // 141232
Expand Down
1 change: 1 addition & 0 deletions include/RE/Starfield.h
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@
#include "RE/T/TLS.h"
#include "RE/T/TypeInfo.h"
#include "RE/U/UI.h"
#include "RE/U/UIBlurManager.h"
#include "RE/U/UICellRenderer.h"
#include "RE/U/UIMessageQueue.h"
#include "RE/V/Variable.h"
Expand Down
68 changes: 68 additions & 0 deletions include/RE/U/UIBlurManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#pragma once

#include "RE/B/BSTEvent.h"
#include "RE/B/BSTSingleton.h"

namespace RE
{
struct BlurEvent;

class TESImageSpaceModifier;
class UIBlurManager;

template <>
struct BSTSingletonSDM<UIBlurManager, BSTSingletonSDMOpStaticBuffer> :
public BSTSingletonSDMBase<BSTSDMTraits<UIBlurManager, BSTSingletonSDMOpStaticBuffer<UIBlurManager>>>
{
public:
using value_type = UIBlurManager;

virtual ~BSTSingletonSDM(); // 00
};
static_assert(sizeof(BSTSingletonSDM<UIBlurManager>) == 0x10);

struct DefaultObjectsReadyEvent
{
public:
struct Event
{
public:
};
};

class UIBlurManager :
public BSTSingletonSDM<UIBlurManager>, // 00
public BSTEventSink<DefaultObjectsReadyEvent::Event>, // 10
public BSTEventSink<BlurEvent> // 18
{
public:
SF_RTTI_VTABLE(UIBlurManager);

~UIBlurManager() override; // 00

[[nodiscard]] static UIBlurManager* GetSingleton()
{
static REL::Relocation<UIBlurManager*> singleton{ ID::UIBlurManager::Singleton };
return singleton.get();
}

void DecrementBlurCount();
void IncrementBlurCount();

BSEventNotifyControl ProcessEvent(
const DefaultObjectsReadyEvent::Event& a_event,
BSTEventSource<DefaultObjectsReadyEvent::Event>* a_source) override;

BSEventNotifyControl ProcessEvent(
const BlurEvent& a_event,
BSTEventSource<BlurEvent>* a_source) override;

// members
TESImageSpaceModifier* blurEffect; // 020
std::uint32_t blurCount; // 028
std::uint32_t pad02C; // 02C
};
static_assert(offsetof(UIBlurManager, blurEffect) == 0x20);
static_assert(offsetof(UIBlurManager, blurCount) == 0x28);
static_assert(sizeof(UIBlurManager) == 0x30);
}
34 changes: 34 additions & 0 deletions src/RE/U/UIBlurManager.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include "RE/U/UIBlurManager.h"
#include "RE/B/BlurEvent.h"

namespace RE
{
namespace
{
using process_blur_event_t = BSEventNotifyControl (*)(
BSTEventSink<BlurEvent>*,
const BlurEvent&,
BSTEventSource<BlurEvent>*);

void SendBlurEvent(UIBlurManager* a_manager, const BlurEvent::Type a_type)
{
if (!a_manager) {
return;
}

static REL::Relocation<process_blur_event_t> processEvent{ ID::UIBlurManager::ProcessBlurEvent };
const BlurEvent event{ a_type };
processEvent(static_cast<BSTEventSink<BlurEvent>*>(a_manager), event, BlurEvent::GetEventSource());
}
}

void UIBlurManager::DecrementBlurCount()
{
SendBlurEvent(this, BlurEvent::Type::kDecrement);
}

void UIBlurManager::IncrementBlurCount()
{
SendBlurEvent(this, BlurEvent::Type::kIncrement);
}
}
Loading