Skip to content

Commit e4f349a

Browse files
committed
Code Cleanup
1 parent 1ffe31c commit e4f349a

File tree

7 files changed

+35
-59
lines changed

7 files changed

+35
-59
lines changed

Diff for: src/d3d12/D3D12.h

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
#include "common/D3D12Downlevel.h"
44
#include "window/Window.h"
55

6-
extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
7-
86
using TPresentD3D12Downlevel = HRESULT(ID3D12CommandQueueDownlevel*, ID3D12GraphicsCommandList*, ID3D12Resource*, HWND, D3D12_DOWNLEVEL_PRESENT_FLAGS);
97
using TCreateCommittedResource =
108
HRESULT(ID3D12Device*, const D3D12_HEAP_PROPERTIES*, D3D12_HEAP_FLAGS, const D3D12_RESOURCE_DESC*, D3D12_RESOURCE_STATES, const D3D12_CLEAR_VALUE*, const IID*, void**);

Diff for: src/d3d12/D3D12_Functions.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ void D3D12::PrepareUpdate()
504504

505505
for (auto i = 0; i < drawData.CmdListsCount; ++i)
506506
copiedDrawLists[i] = drawData.CmdLists[i]->CloneOutput();
507-
drawData.CmdLists = copiedDrawLists;
507+
drawData.CmdLists = std::move(copiedDrawLists);
508508

509509
std::swap(m_imguiDrawDataBuffers[1], m_imguiDrawDataBuffers[2]);
510510
}

Diff for: src/imgui_impl/imgui_user_config.h

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// global declaration "Enable ImGui Assertions"
44
extern bool g_ImGuiAssertionsEnabled;
55

6+
#define IMGUI_IMPL_WIN32_DISABLE_GAMEPAD
7+
68
// runtime assertions which can be enabled/disabled inside CET options
79
void ImGuiAssert(wchar_t const* acpMessage, wchar_t const* acpFile, unsigned aLine);
810

Diff for: src/imgui_impl/win32.h

-6
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,7 @@ IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown();
2828
IMGUI_IMPL_API void ImGui_ImplWin32_NewFrame(SIZE aOutSize);
2929

3030
// Win32 message handler your application need to call.
31-
// - Intentionally commented out in a '#if 0' block to avoid dragging dependencies on <windows.h> from this helper.
32-
// - You should COPY the line below into your .cpp code to forward declare the function and then you can call it.
33-
// - Call from your application's message handler. Keep calling your message handler unless this function returns TRUE.
34-
35-
#if 0
3631
extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
37-
#endif
3832

3933
// DPI-related helpers (optional)
4034
// - Use to enable DPI awareness without having to create an application manifest.

Diff for: src/overlay/widgets/Settings.cpp

+10-7
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ Settings::Settings(Options& aOptions, LuaVM& aVm)
1616

1717
WidgetResult Settings::OnPopup()
1818
{
19-
const auto ret = UnsavedChangesPopup(
20-
"Settings", m_openChangesModal, m_madeChanges, [this] { Save(); }, [this] { Load(); });
19+
const auto ret = UnsavedChangesPopup("Settings", m_openChangesModal, m_madeChanges, [this] { Save(); }, [this] { Load(); });
2120
m_madeChanges = ret == TChangedCBResult::CHANGED;
2221
m_popupResult = ret;
2322

@@ -54,7 +53,7 @@ void Settings::OnUpdate()
5453
m_madeChanges = false;
5554
if (ImGui::CollapsingHeader("Patches", ImGuiTreeNodeFlags_DefaultOpen))
5655
{
57-
ImGui::TreePush((void*)nullptr);
56+
ImGui::TreePush("##PATCHES");
5857
if (ImGui::BeginTable("##SETTINGS_PATCHES", 2, ImGuiTableFlags_Sortable | ImGuiTableFlags_SizingStretchSame, ImVec2(-ImGui::GetStyle().IndentSpacing, 0)))
5958
{
6059
const auto& patchesSettings = m_options.Patches;
@@ -78,7 +77,9 @@ void Settings::OnUpdate()
7877
UpdateAndDrawSetting(
7978
"Disable Boundary Teleport", "Allows players to access out-of-bounds locations (requires restart to take effect).", m_patches.DisableBoundaryTeleport,
8079
patchesSettings.DisableBoundaryTeleport);
81-
UpdateAndDrawSetting("Disable V-Sync (Windows 7 only)", "Disables VSync on Windows 7 to bypass the 60 FPS limit (requires restart to take effect).", m_patches.DisableWin7Vsync, patchesSettings.DisableWin7Vsync);
80+
UpdateAndDrawSetting(
81+
"Disable V-Sync (Windows 7 only)", "Disables VSync on Windows 7 to bypass the 60 FPS limit (requires restart to take effect).", m_patches.DisableWin7Vsync,
82+
patchesSettings.DisableWin7Vsync);
8283
UpdateAndDrawSetting(
8384
"Fix Minimap Flicker", "Fixes Minimap flicker caused by some mods (requires restart to take effect).", m_patches.MinimapFlicker,
8485
patchesSettings.MinimapFlicker);
@@ -89,7 +90,7 @@ void Settings::OnUpdate()
8990
}
9091
if (ImGui::CollapsingHeader("CET Development Settings", ImGuiTreeNodeFlags_DefaultOpen))
9192
{
92-
ImGui::TreePush((void*)nullptr);
93+
ImGui::TreePush("##DEV");
9394
if (ImGui::BeginTable("##SETTINGS_DEV", 2, ImGuiTableFlags_Sortable | ImGuiTableFlags_SizingStretchSame, ImVec2(-ImGui::GetStyle().IndentSpacing, 0)))
9495
{
9596
const auto& developerSettings = m_options.Developer;
@@ -108,8 +109,10 @@ void Settings::OnUpdate()
108109
"Dump Game Options", "Dumps all game options into main log file (requires restart to take effect).", m_developer.DumpGameOptions,
109110
developerSettings.DumpGameOptions);
110111
UpdateAndDrawSetting(
111-
"Enable JIT for Lua", "Enables JIT compiler for Lua VM, which may majorly speed up the mods. Disable it in case you experience issues as a troubleshooting step (requires restart to take effect).", m_developer.EnableJIT,
112-
developerSettings.EnableJIT);
112+
"Enable JIT for Lua",
113+
"Enables JIT compiler for Lua VM, which may majorly speed up the mods. Disable it in case you experience issues as a troubleshooting step (requires restart to "
114+
"take effect).",
115+
m_developer.EnableJIT, developerSettings.EnableJIT);
113116

114117
ImGui::EndTable();
115118
}

Diff for: src/sol_imgui/sol_imgui.h

+21-42
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@
22

33
namespace sol_ImGui
44
{
5-
6-
// Version
7-
inline std::string GetVersion()
8-
{
9-
return std::string(ImGui::GetVersion());
10-
}
11-
125
// Windows
136
inline bool Begin(const std::string& name)
147
{
@@ -50,6 +43,15 @@ inline bool BeginChild(const std::string& name, float sizeX, float sizeY)
5043
{
5144
return ImGui::BeginChild(name.c_str(), {sizeX, sizeY});
5245
}
46+
inline bool BeginChild(const std::string& name, float sizeX, float sizeY, int child_flags)
47+
{
48+
return ImGui::BeginChild(name.c_str(), {sizeX, sizeY}, static_cast<ImGuiChildFlags>(child_flags));
49+
}
50+
51+
inline bool BeginChild(const std::string& name, float sizeX, float sizeY, int child_flags, int window_flags)
52+
{
53+
return ImGui::BeginChild(name.c_str(), {sizeX, sizeY}, static_cast<ImGuiChildFlags>(child_flags), static_cast<ImGuiWindowFlags>(window_flags));
54+
}
5355

5456
// DEPRECATED
5557
inline bool BeginChild(const std::string& name, float sizeX, float sizeY, bool border)
@@ -61,17 +63,6 @@ inline bool BeginChild(const std::string& name, float sizeX, float sizeY, bool b
6163
return ImGui::BeginChild(name.c_str(), {sizeX, sizeY}, border, flags);
6264
}
6365

64-
// new
65-
inline bool BeginChild(const std::string& name, float sizeX, float sizeY, int child_flags)
66-
{
67-
return ImGui::BeginChild(name.c_str(), {sizeX, sizeY}, static_cast<ImGuiChildFlags>(child_flags));
68-
}
69-
70-
inline bool BeginChild(const std::string& name, float sizeX, float sizeY, int child_flags, int window_flags)
71-
{
72-
return ImGui::BeginChild(name.c_str(), {sizeX, sizeY}, static_cast<ImGuiChildFlags>(child_flags), static_cast<ImGuiWindowFlags>(window_flags));
73-
}
74-
7566
inline void EndChild()
7667
{
7768
ImGui::EndChild();
@@ -2676,30 +2667,25 @@ inline int GetKeyPressedAmount(int key_index, float repeat_delay, float rate)
26762667
{
26772668
return ImGui::GetKeyPressedAmount(static_cast<ImGuiKey>(key_index), repeat_delay, rate);
26782669
}
2670+
inline void SetNextFrameWantCaptureKeyboard(bool want_capture_keyboard_value)
2671+
{
2672+
ImGui::SetNextFrameWantCaptureKeyboard(want_capture_keyboard_value);
2673+
}
26792674

26802675
// DEPRECATED
26812676
inline int GetKeyIndex(int imgui_key)
26822677
{
26832678
return ImGui::GetKeyIndex(static_cast<ImGuiKey>(imgui_key));
26842679
}
2685-
2686-
// DEPRECATED
26872680
inline void CaptureKeyboardFromApp()
26882681
{
26892682
ImGui::SetNextFrameWantCaptureKeyboard(true);
26902683
}
2691-
// DEPRECTED
26922684
inline void CaptureKeyboardFromApp(bool want_capture_keyboard_value)
26932685
{
26942686
ImGui::SetNextFrameWantCaptureKeyboard(want_capture_keyboard_value);
26952687
}
26962688

2697-
// new
2698-
inline void SetNextFrameWantCaptureKeyboard(bool want_capture_keyboard_value)
2699-
{
2700-
ImGui::SetNextFrameWantCaptureKeyboard(want_capture_keyboard_value);
2701-
}
2702-
27032689
// Inputs Utilities: Mouse
27042690

27052691
inline bool IsMouseDown(int button)
@@ -2784,23 +2770,21 @@ inline void SetMouseCursor(int cursor_type)
27842770
{
27852771
ImGui::SetMouseCursor(static_cast<ImGuiMouseCursor>(cursor_type));
27862772
}
2773+
inline void SetNextFrameWantCaptureMouse(bool want_capture_mouse_value)
2774+
{
2775+
ImGui::SetNextFrameWantCaptureMouse(want_capture_mouse_value);
2776+
}
27872777

27882778
// DEPRECATED
27892779
inline void CaptureMouseFromApp()
27902780
{
27912781
ImGui::SetNextFrameWantCaptureMouse(true);
27922782
}
2793-
// DEPRECATED
27942783
inline void CaptureMouseFromApp(bool want_capture_mouse_value)
27952784
{
27962785
ImGui::SetNextFrameWantCaptureMouse(want_capture_mouse_value);
27972786
}
27982787

2799-
inline void SetNextFrameWantCaptureMouse(bool want_capture_mouse_value)
2800-
{
2801-
ImGui::SetNextFrameWantCaptureMouse(want_capture_mouse_value);
2802-
}
2803-
28042788
// Clipboard Utilities
28052789
inline std::string GetClipboardText()
28062790
{
@@ -3128,13 +3112,12 @@ inline void InitEnums(sol::table luaGlobals)
31283112

31293113
#pragma region Selectable Flags
31303114
luaGlobals.new_enum(
3131-
"ImGuiSelectableFlags", "None", ImGuiSelectableFlags_None, "NoAutoClosePopups", ImGuiSelectableFlags_NoAutoClosePopups, "SpanAllColumns", ImGuiSelectableFlags_SpanAllColumns,
3132-
"AllowDoubleClick", ImGuiSelectableFlags_AllowDoubleClick, "Disabled", ImGuiSelectableFlags_Disabled, "AllowOverlap", ImGuiSelectableFlags_AllowOverlap,
3115+
"ImGuiSelectableFlags", "None", ImGuiSelectableFlags_None, "NoAutoClosePopups", ImGuiSelectableFlags_NoAutoClosePopups, "SpanAllColumns",
3116+
ImGuiSelectableFlags_SpanAllColumns, "AllowDoubleClick", ImGuiSelectableFlags_AllowDoubleClick, "Disabled", ImGuiSelectableFlags_Disabled, "AllowOverlap",
3117+
ImGuiSelectableFlags_AllowOverlap,
31333118

31343119
// DEPRECATED
3135-
"DontClosePopups", ImGuiSelectableFlags_DontClosePopups,
3136-
"AllowItemOverlap", ImGuiSelectableFlags_AllowItemOverlap
3137-
);
3120+
"DontClosePopups", ImGuiSelectableFlags_DontClosePopups, "AllowItemOverlap", ImGuiSelectableFlags_AllowItemOverlap);
31383121
#pragma endregion Selectable Flags
31393122

31403123
#pragma region Popup Flags
@@ -3269,10 +3252,6 @@ inline void InitBindings(sol::state& lua, sol::table luaGlobals)
32693252

32703253
sol::table ImGui(lua, sol::create);
32713254

3272-
#pragma region Version
3273-
ImGui.set_function("GetVersion", GetVersion);
3274-
#pragma endregion Version
3275-
32763255
#pragma region Windows
32773256
ImGui.set_function(
32783257
"Begin", sol::overload(

Diff for: xmake.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ target("RED4ext.SDK")
6464
on_install(function() end)
6565

6666
target("cyber_engine_tweaks")
67-
add_defines("WIN32_LEAN_AND_MEAN", "NOMINMAX", "WINVER=0x0601", "SOL_ALL_SAFETIES_ON", "SOL_LUAJIT=1", "SOL_EXCEPTIONS_SAFE_PROPAGATION", "SPDLOG_WCHAR_TO_UTF8_SUPPORT", "SPDLOG_WCHAR_FILENAMES", "SPDLOG_WCHAR_SUPPORT", "IMGUI_USER_CONFIG=\""..imguiUserConfig.."\", IMGUI_IMPL_WIN32_DISABLE_GAMEPAD") -- WINVER=0x0601 == Windows 7xmake
67+
add_defines("WIN32_LEAN_AND_MEAN", "NOMINMAX", "WINVER=0x0601", "SOL_ALL_SAFETIES_ON", "SOL_LUAJIT=1", "SOL_EXCEPTIONS_SAFE_PROPAGATION", "SPDLOG_WCHAR_TO_UTF8_SUPPORT", "SPDLOG_WCHAR_FILENAMES", "SPDLOG_WCHAR_SUPPORT", "IMGUI_USER_CONFIG=\""..imguiUserConfig.."\"") -- WINVER=0x0601 == Windows 7xmake
6868
set_pcxxheader("src/stdafx.h")
6969
set_kind("shared")
7070
set_filename("cyber_engine_tweaks.asi")

0 commit comments

Comments
 (0)