Rename to HookableEvent. Because naming conflict

This commit is contained in:
Scott Mansell 2023-02-03 13:37:42 +13:00
parent 60f2b5af7b
commit 8c8bd0e7ac
5 changed files with 12 additions and 12 deletions

View File

@ -46,7 +46,6 @@ add_library(common
EnumFormatter.h
EnumMap.h
Event.h
EventHook.h
FatFsUtil.cpp
FatFsUtil.h
FileSearch.cpp
@ -63,6 +62,7 @@ add_library(common
GekkoDisassembler.h
Hash.cpp
Hash.h
HookableEvent.h
HttpRequest.cpp
HttpRequest.h
Image.cpp

View File

@ -19,7 +19,7 @@ namespace Common
// Define Events in a header as:
//
// using MyLoveyEvent = Event<"My lovely event", std::string>;
// using MyLoveyEvent = HookableEvent<"My lovely event", std::string>;
//
// Register listeners anywhere you need them as:
// EventHook myHook = MyLoveyEvent::Register([](std::string foo) {
@ -40,7 +40,7 @@ struct HookBase
using EventHook = std::unique_ptr<HookBase>;
template <StringLiteral EventName, typename... CallbackArgs>
class Event
class HookableEvent
{
public:
using CallbackType = std::function<void(CallbackArgs...)>;
@ -48,7 +48,7 @@ public:
private:
struct HookImpl final : public HookBase
{
~HookImpl() override { Event::Remove(this); }
~HookImpl() override { HookableEvent::Remove(this); }
HookImpl(CallbackType callback, std::string name)
: m_fn(std::move(callback)), m_name(std::move(name))
{

View File

@ -9,7 +9,7 @@
#include <vector>
#include "Common/Assert.h"
#include "Common/EventHook.h"
#include "Common/HookableEvent.h"
#include "Core/FifoPlayer/FifoDataFile.h"
class FifoRecorder

View File

@ -46,7 +46,6 @@
<ClInclude Include="Common\EnumFormatter.h" />
<ClInclude Include="Common\EnumMap.h" />
<ClInclude Include="Common\Event.h" />
<ClInclude Include="Common\EventHook.h" />
<ClInclude Include="Common\FatFsUtil.h" />
<ClInclude Include="Common\FileSearch.h" />
<ClInclude Include="Common\FileUtil.h" />
@ -110,6 +109,7 @@
<ClInclude Include="Common\GL\GLUtil.h" />
<ClInclude Include="Common\GL\GLX11Window.h" />
<ClInclude Include="Common\Hash.h" />
<ClInclude Include="Common\HookableEvent.h" />
<ClInclude Include="Common\HRWrap.h" />
<ClInclude Include="Common\HttpRequest.h" />
<ClInclude Include="Common\Image.h" />

View File

@ -4,19 +4,19 @@
#pragma once
#include "Common/CommonTypes.h"
#include "Common/EventHook.h"
#include "Common/HookableEvent.h"
// Called when certain video config setting are changed
using ConfigChangedEvent = Common::Event<"ConfigChanged", u32>;
using ConfigChangedEvent = Common::HookableEvent<"ConfigChanged", u32>;
// An event called just before the first draw call of a frame
using BeforeFrameEvent = Common::Event<"BeforeFrame">;
using BeforeFrameEvent = Common::HookableEvent<"BeforeFrame">;
// An event called after the frame XFB copy begins processing on the host GPU.
// Useful for "once per frame" usecases.
// Note: In a few rare cases, games do multiple XFB copies per frame and join them while presenting.
// If this matters to your usecase, you should use BeforePresent instead.
using AfterFrameEvent = Common::Event<"AfterFrame">;
using AfterFrameEvent = Common::HookableEvent<"AfterFrame">;
struct PresentInfo
{
@ -76,8 +76,8 @@ struct PresentInfo
// frame.
//
// frame_count: The number of frames
using BeforePresentEvent = Common::Event<"BeforePresent", PresentInfo&>;
using BeforePresentEvent = Common::HookableEvent<"BeforePresent", PresentInfo&>;
// An event that is triggered after a frame is presented.
// The exact timing of this event depends on backend/driver support.
using AfterPresentEvent = Common::Event<"AfterPresent", PresentInfo&>;
using AfterPresentEvent = Common::HookableEvent<"AfterPresent", PresentInfo&>;