Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
// Copyright 2011-2019 Molecular Matters GmbH, all rights reserved.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
/* HOOKS */
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
|
|
|
// concatenates two preprocessor tokens, even when the tokens themselves are macros
|
|
|
|
|
#define LPP_CONCATENATE_HELPER_HELPER(_a, _b) _a##_b
|
|
|
|
|
#define LPP_CONCATENATE_HELPER(_a, _b) LPP_CONCATENATE_HELPER_HELPER(_a, _b)
|
|
|
|
|
#define LPP_CONCATENATE(_a, _b) LPP_CONCATENATE_HELPER(_a, _b)
|
|
|
|
|
|
|
|
|
|
// generates a unique identifier inside a translation unit
|
|
|
|
|
#define LPP_IDENTIFIER(_identifier) LPP_CONCATENATE(_identifier, __LINE__)
|
|
|
|
|
|
|
|
|
|
// custom section names for hooks
|
2019-05-24 11:51:54 -04:00
|
|
|
#define LPP_PREPATCH_SECTION ".lpp_prepatch_hooks"
|
|
|
|
|
#define LPP_POSTPATCH_SECTION ".lpp_postpatch_hooks"
|
|
|
|
|
#define LPP_COMPILE_START_SECTION ".lpp_compile_start_hooks"
|
|
|
|
|
#define LPP_COMPILE_SUCCESS_SECTION ".lpp_compile_success_hooks"
|
|
|
|
|
#define LPP_COMPILE_ERROR_SECTION ".lpp_compile_error_hooks"
|
|
|
|
|
#define LPP_COMPILE_ERROR_MESSAGE_SECTION ".lpp_compile_error_message_hooks"
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
|
|
|
|
|
// register a pre-patch hook in a custom section
|
|
|
|
|
#define LPP_PREPATCH_HOOK(_function) \
|
|
|
|
|
__pragma(section(LPP_PREPATCH_SECTION, read)) \
|
|
|
|
|
__declspec(allocate(LPP_PREPATCH_SECTION)) extern void (*LPP_IDENTIFIER(lpp_prepatch_hook_function))(void) = &_function
|
|
|
|
|
|
|
|
|
|
// register a post-patch hook in a custom section
|
|
|
|
|
#define LPP_POSTPATCH_HOOK(_function) \
|
|
|
|
|
__pragma(section(LPP_POSTPATCH_SECTION, read)) \
|
|
|
|
|
__declspec(allocate(LPP_POSTPATCH_SECTION)) extern void (*LPP_IDENTIFIER(lpp_postpatch_hook_function))(void) = &_function
|
|
|
|
|
|
|
|
|
|
// register a compile start hook in a custom section
|
|
|
|
|
#define LPP_COMPILE_START_HOOK(_function) \
|
|
|
|
|
__pragma(section(LPP_COMPILE_START_SECTION, read)) \
|
|
|
|
|
__declspec(allocate(LPP_COMPILE_START_SECTION)) extern void (*LPP_IDENTIFIER(lpp_compile_start_hook_function))(void) = &_function
|
|
|
|
|
|
|
|
|
|
// register a compile success hook in a custom section
|
|
|
|
|
#define LPP_COMPILE_SUCCESS_HOOK(_function) \
|
|
|
|
|
__pragma(section(LPP_COMPILE_SUCCESS_SECTION, read)) \
|
|
|
|
|
__declspec(allocate(LPP_COMPILE_SUCCESS_SECTION)) extern void (*LPP_IDENTIFIER(lpp_compile_success_hook_function))(void) = &_function
|
|
|
|
|
|
|
|
|
|
// register a compile error hook in a custom section
|
2019-05-24 11:51:54 -04:00
|
|
|
#define LPP_COMPILE_ERROR_HOOK(_function) \
|
|
|
|
|
__pragma(section(LPP_COMPILE_ERROR_SECTION, read)) \
|
Integrating live coding feature (aka Live++) into UE4.
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
[FYI] Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
#ROBOMERGE-SOURCE: CL 5304722 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 5309051 by ben marsh in Main branch]
2019-03-05 18:49:25 -05:00
|
|
|
__declspec(allocate(LPP_COMPILE_ERROR_SECTION)) extern void (*LPP_IDENTIFIER(lpp_compile_error_hook_function))(void) = &_function
|
2019-05-24 11:51:54 -04:00
|
|
|
|
|
|
|
|
// register a compile error message hook in a custom section
|
|
|
|
|
#define LPP_COMPILE_ERROR_MESSAGE_HOOK(_function) \
|
|
|
|
|
__pragma(section(LPP_COMPILE_ERROR_MESSAGE_SECTION, read)) \
|
|
|
|
|
__declspec(allocate(LPP_COMPILE_ERROR_MESSAGE_SECTION)) extern void (*LPP_IDENTIFIER(lpp_compile_error_message_hook_function))(const wchar_t*) = &_function
|
|
|
|
|
|
2019-07-16 08:43:32 -04:00
|
|
|
/******************************************************************************/
|
|
|
|
|
/* API */
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
|
|
|
// version string
|
2020-01-29 14:48:18 -05:00
|
|
|
#define LPP_VERSION "1.5.2"
|
2019-07-16 08:43:32 -04:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
# define LPP_NS_BEGIN namespace lpp {
|
|
|
|
|
# define LPP_NS_END }
|
|
|
|
|
# define LPP_API inline
|
|
|
|
|
#else
|
|
|
|
|
# define LPP_NS_BEGIN
|
|
|
|
|
# define LPP_NS_END
|
|
|
|
|
# define LPP_API static inline
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// helper macros to call a function in a DLL with an arbitrary signature without a compiler warning
|
|
|
|
|
#define LPP_CALL1(_module, _functionName, _return, _args1) ((_return (__cdecl*)(_args1))((uintptr_t)GetProcAddress(_module, _functionName)))
|
|
|
|
|
#define LPP_CALL2(_module, _functionName, _return, _args1, _args2) ((_return (__cdecl*)(_args1, _args2))((uintptr_t)GetProcAddress(_module, _functionName)))
|
|
|
|
|
#define LPP_CALL3(_module, _functionName, _return, _args1, _args2, _args3) ((_return (__cdecl*)(_args1, _args2, _args3))((uintptr_t)GetProcAddress(_module, _functionName)))
|
|
|
|
|
#define LPP_CALL4(_module, _functionName, _return, _args1, _args2, _args3, _args4) ((_return (__cdecl*)(_args1, _args2, _args3, _args4))((uintptr_t)GetProcAddress(_module, _functionName)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LPP_NS_BEGIN
|
|
|
|
|
|
|
|
|
|
enum RestartBehaviour
|
|
|
|
|
{
|
2019-08-04 11:01:49 -04:00
|
|
|
// BEGIN EPIC MODS - Use UE4 codepath for termination to ensure logs are flushed and session analytics are sent
|
|
|
|
|
LPP_RESTART_BEHAVIOR_REQUEST_EXIT, // FPlatforMisc::RequestExit(true)
|
|
|
|
|
// END EPIC MODS
|
2019-07-16 08:43:32 -04:00
|
|
|
LPP_RESTART_BEHAVIOUR_DEFAULT_EXIT, // ExitProcess()
|
|
|
|
|
LPP_RESTART_BEHAVIOUR_EXIT_WITH_FLUSH, // exit()
|
|
|
|
|
LPP_RESTART_BEHAVIOUR_EXIT, // _Exit()
|
|
|
|
|
LPP_RESTART_BEHAVIOUR_INSTANT_TERMINATION // TerminateProcess
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
LPP_NS_END
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#undef LPP_CALL1
|
|
|
|
|
#undef LPP_CALL2
|
|
|
|
|
#undef LPP_CALL3
|