Files
UnrealEngineUWP/Engine/Source/Developer/Windows/LiveCodingServer/Private/External/LC_Hook.h
Tim Smith b48b94b010 Integration of Live++ 1.6.3
#rb none
#rnx

[CL 14926202 by Tim Smith in ue5-main branch]
2020-12-15 09:27:44 -04:00

72 lines
1.7 KiB
C++

// Copyright 2011-2020 Molecular Matters GmbH, all rights reserved.
#pragma once
// BEGIN EPIC MOD
#include "CoreTypes.h"
#include <stdint.h>
// END EPIC MOD
class ImmutableString;
namespace symbols
{
struct ImageSectionDB;
}
namespace hook
{
struct Type
{
enum Enum
{
PREPATCH = 0,
POSTPATCH,
COMPILE_START,
COMPILE_SUCCESS,
COMPILE_ERROR,
COMPILE_ERROR_MESSAGE,
// BEGIN EPIC MOD - Add the ability for pre and post compile notifications
PRECOMPILE,
POSTCOMPILE
// END EPIC MOD
};
};
typedef void (*PrepatchFunction)(void);
typedef void (*PostpatchFunction)(void);
typedef void (*CompileStartFunction)(void);
typedef void (*CompileSuccessFunction)(void);
typedef void (*CompileErrorFunction)(void);
typedef void (*CompileErrorMessageFunction)(const wchar_t*);
// BEGIN EPIC MOD - Add the ability for pre and post compile notifications
typedef void (*PrecompileFunction)(void);
typedef void (*PostcompileFunction)(void);
// END EPIC MOD
uint32_t FindFirstInSection(const symbols::ImageSectionDB* imageSectionDb, const ImmutableString& sectionName);
uint32_t FindLastInSection(const symbols::ImageSectionDB* imageSectionDb, const ImmutableString& sectionName);
// calls arbitrary hooks in a given range
template <typename T, typename... Args>
void CallHooksInRange(const void* rangeBegin, const void* rangeEnd, Args&&... args)
{
const T* firstHook = static_cast<const T*>(rangeBegin);
const T* lastHook = static_cast<const T*>(rangeEnd);
for (const T* hook = firstHook; hook < lastHook; ++hook)
{
// note that sections are often padded with zeroes, so skip everything that's zero
T function = *hook;
if (function)
{
function(args...);
}
}
}
}