Skip to content

Commit

Permalink
fix xmake compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
localcc committed May 22, 2024
1 parent b4e4b6d commit b1ff654
Show file tree
Hide file tree
Showing 17 changed files with 144 additions and 593 deletions.
4 changes: 2 additions & 2 deletions UE4SS/include/GUI/LiveView/Filter/ClassNamesFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ namespace RC::GUI::Filter
class ClassNamesFilter
{
public:
static inline StringType s_debug_name{STR("ClassNamesFilter")};
static inline UEStringType s_debug_name{STR("ClassNamesFilter")};
static inline std::string s_internal_class_names{};
static inline std::vector<StringType> list_class_names;
static inline std::vector<UEStringType> list_class_names;
static inline bool b_is_exclude{true};

static auto post_eval(UObject* object) -> bool
Expand Down
4 changes: 2 additions & 2 deletions UE4SS/include/GUI/LiveView/Filter/HasProperty.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace RC::GUI::Filter
{
public:
static inline UEStringType s_debug_name{STR("HasProperty")};
static inline UEStringType s_internal_properties{};
static inline std::vector<StringType> list_properties{};
static inline std::string s_internal_properties{};
static inline std::vector<UEStringType> list_properties{};

static auto post_eval(UObject* object) -> bool
{
Expand Down
2 changes: 1 addition & 1 deletion UE4SS/include/GUI/LiveView/Filter/HasPropertyType.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace RC::GUI::Filter
{
public:
static inline UEStringType s_debug_name{STR("HasPropertyType")};
static inline UEStringType s_internal_property_types{};
static inline std::string s_internal_property_types{};
static inline std::vector<FName> list_property_types{};

static auto post_eval(UObject* object) -> bool
Expand Down
1 change: 1 addition & 0 deletions UE4SS/include/GUI/NerdFont.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#define ICON_FA_FILE_ALT "\uf15b"
#define ICON_FA_EYE "\uf06e"
#define ICON_FA_PUZZLE_PIECE "\uf12e"
#define ICON_FA_SAVE "\ueb4b"

#define ICON_FA_ANGLE_DOUBLE_LEFT "<<"
#define ICON_FA_ANGLE_DOUBLE_RIGHT ">>"
Expand Down
1 change: 1 addition & 0 deletions UE4SS/src/GUI/GUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ namespace RC::GUI

auto DebuggingGUI::set_gfx_backend(GfxBackend backend) -> void
{
Output::send(SYSSTR("Setting gfx backend!\n"));
switch (backend)
{
#ifdef HAS_D3D11
Expand Down
40 changes: 0 additions & 40 deletions UE4SS/src/GUI/LiveView.1.PVS-Studio.cfg

This file was deleted.

143 changes: 78 additions & 65 deletions UE4SS/src/GUI/LiveView.cpp

Large diffs are not rendered by default.

40 changes: 20 additions & 20 deletions UE4SS/src/Mod/CppUserModBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#include <Mod/CppUserModBase.hpp>
#include <UE4SSProgram.hpp>

#include <vector>

namespace RC
{
CppUserModBase::CppUserModBase()
Expand All @@ -24,27 +26,25 @@ namespace RC
}
GUITabs.clear();

UE4SSProgram::get_program().m_input_handler.get_events_safe([&](auto& key_events) {
std::erase_if(key_events, [&](Input::KeySet& input_event) -> bool {
UE4SSProgram::get_program().m_input_handler.get_events_safe([&](auto& key_set) {
std::erase_if(key_set.key_data, [&](auto& item) -> bool {
auto& [_, key_data] = item;
bool were_all_events_registered_from_this_mod = true;
for (auto& [key, vector_of_key_data] : input_event.key_data)
{
std::erase_if(vector_of_key_data, [&](Input::KeyData& key_data) -> bool {
// custom_data == 1: Bind came from Lua, and custom_data2 is nullptr.
// custom_data == 2: Bind came from C++, and custom_data2 is a pointer to KeyDownEventData. Must free it.
auto event_data = static_cast<KeyDownEventData*>(key_data.custom_data2);
if (key_data.custom_data == 2 && event_data && event_data->mod == this)
{
delete event_data;
return true;
}
else
{
were_all_events_registered_from_this_mod = false;
return false;
}
});
}
std::erase_if(key_data, [&](Input::KeyData& key_data) -> bool {
// custom_data == 1: Bind came from Lua, and custom_data2 is nullptr.
// custom_data == 2: Bind came from C++, and custom_data2 is a pointer to KeyDownEventData. Must free it.
auto event_data = static_cast<KeyDownEventData*>(key_data.custom_data2);
if (key_data.custom_data == 2 && event_data && event_data->mod == this)
{
delete event_data;
return true;
}
else
{
were_all_events_registered_from_this_mod = false;
return false;
}
});

return were_all_events_registered_from_this_mod;
});
Expand Down
22 changes: 13 additions & 9 deletions UE4SS/src/UE4SSProgram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ namespace RC
Output::send(SYSSTR("\n\nFound string '{}' at {}\n\n"), SystemStringViewType{str_to_find}, string_address);
//*/

Output::send(SYSSTR("dir: {}\n"), (m_log_directory / m_log_file_name));

Output::send(SYSSTR("Console created\n"));
Output::send(SYSSTR("UE4SS - v{}.{}.{}{}{} - Git SHA #{}\n"),
UE4SS_LIB_VERSION_MAJOR,
Expand Down Expand Up @@ -335,6 +337,8 @@ namespace RC
ProfilerSetThreadName("UE4SS-InitThread");
ProfilerScope();

Output::send(SYSSTR("Initializing ue4ss program\n"));

try
{
setup_unreal();
Expand Down Expand Up @@ -525,6 +529,8 @@ namespace RC
auto UE4SSProgram::setup_unreal() -> void
{
ProfilerScope();
Output::send(SYSSTR("Setting up unreal\n"));

// Retrieve offsets from the config file
const SystemStringType offset_overrides_section{SYSSTR("OffsetOverrides")};

Expand Down Expand Up @@ -1366,10 +1372,11 @@ namespace RC

// Remove key binds that were set from Lua scripts
#ifdef HAS_INPUT
m_input_handler.get_events_safe([&](Input::KeySet& input_event) -> void {
for (auto& [key, vector_of_key_data] : input_event.key_data)
{
std::erase_if(vector_of_key_data, [&](Input::KeyData& key_data) -> bool {
m_input_handler.get_events_safe([&](auto& key_set) {
std::erase_if(key_set.key_data, [&](auto& item) -> bool {
auto& [_, key_data] = item;
bool were_all_events_registered_from_lua = true;
std::erase_if(key_data, [&](Input::KeyData& key_data) -> bool {
// custom_data == 1: Bind came from Lua, and custom_data2 is nullptr.
// custom_data == 2: Bind came from C++, and custom_data2 is a pointer to KeyDownEventData. Must free it.
if (key_data.custom_data == 1)
Expand All @@ -1383,11 +1390,8 @@ namespace RC
}
});

if (vector_of_key_data.empty())
{
m_input_handler.clear_subscribed_key(key);
}
}
return were_all_events_registered_from_lua;
});
});
#endif

Expand Down
20 changes: 16 additions & 4 deletions UE4SS/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ if uiMode ~= nil and uiMode ~= "None" then
add_requires("ImGuiTextEdit v1.0", { debug = is_mode_debug(), configs = { tui = isTUI, runtimes = get_mode_runtimes() } })

if uiMode == "GUI" then
add_requires("imgui v1.89", { debug = is_mode_debug(), configs = { win32 = hasWindows, dx11 = hasWindows, opengl3 = true, glfw_opengl3 = true , runtimes = get_mode_runtimes()} } )
local imguiConfig = { win32 = hasWindows, dx11 = hasWindows, opengl3 = true, glfw = true , runtimes = get_mode_runtimes()}
add_requires("imgui v1.89", { alias = "ue4ssImGui", debug = is_mode_debug(), configs = imguiConfig } )
add_requireconfs("ImGuiTextEdit.imgui", { configs = imguiConfig })

add_requires("IconFontCppHeaders v1.0", { debug = is_mode_debug(), configs = {runtimes = get_mode_runtimes()}})
add_requires("glfw 3.3.9", { debug = is_mode_debug() , configs = {runtimes = get_mode_runtimes()}})
add_requires("opengl", { debug = is_mode_debug(), configs = {runtimes = get_mode_runtimes()} })
Expand Down Expand Up @@ -104,23 +107,32 @@ target(projectName)

add_files("src/**.cpp|Platform/**.cpp|GUI/**.cpp")

if is_plat("windows") then
add_files("src/Platform/Win32/CrashDumper.cpp", "src/Platform/Win32/EntryWin32.cpp")
elseif is_plat("linux") then
add_files("src/Platform/Linux/EntryLinux.cpp")
end

if uiMode ~= "None" then
add_files("src/GUI/*.cpp")

add_packages("ImGuiTextEdit", { public = true })

if uiMode == "GUI" then
add_files("src/GUI/Platform/GLFW/**.cpp")
add_files("src/GUI/Platform/GUI/**.cpp")

add_deps("glad")
add_defines("HAS_GLFW", { public = true })

add_packages("ImGui", "IconFontCppHeaders", "glfw", "opengl", { public = true })
add_deps("glad", { public = true })

add_packages("ue4ssImGui", "IconFontCppHeaders", "glfw", "opengl", { public = true })

if is_plat("windows") then
add_files("src/GUI/Platform/D3D11/**.cpp")
add_files("src/GUI/Platform/Windows/**.cpp")

add_defines("HAS_D3D11", { public = true })

add_links("d3d11", { public = true })
end
elseif uiMode == "TUI" then
Expand Down
28 changes: 0 additions & 28 deletions deps/imtui/xmake.lua

This file was deleted.

2 changes: 0 additions & 2 deletions deps/third-repo/packages/i/imguitextedit/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ package("ImGuiTextEdit")

add_configs("tui", { description = "Enable TUI.", default = false, type = "boolean" })

add_deps("cmake")

add_includedirs("include", { public = true })

local function _get_imgui_name(isTUI)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package("imtui")
add_urls("https://github.com/ggerganov/imtui.git")

set_policy("package.install_always", true)

add_versions("v1.0.5", "9f39c3e090c9b1e15557eac38a2f4389462f59df")
local root = get_config("ue4ssRoot")
-- add_patches("v1.0.5", path.join(root, "deps", "third", "imtui", "fix-size-cjk-and-mouse.patch"))
add_patches("v1.0.5", "fix-size-cjk-and-mouse.patch")

-- WARN: xmake cannot distinguish ncursesw and ncurses, this may cause problem on other systems
add_deps("cmake", "ncurses")

add_includedirs("include", "include/imgui-for-imtui/", "include/imgui-for-imtui/imgui", "include/imtui", {public = true})
add_includedirs("include", "include/imgui", "include/imgui-for-imtui/", "include/imgui-for-imtui/imgui", "include/imtui", {public = true})

-- imtui, imtui-ncurses and imgui-for-imtui
on_install(function (package)
Expand Down
Loading

0 comments on commit b1ff654

Please sign in to comment.