fix various minor issues causing compilation failure with clang (#567)

- Include order and forward decls were breaking button.h because a
declared but not defined struct can't be initiated (honestly this file
was cooked, crazy include order).
- `MAXINT` is GCC specific, `INT_MAX` is portable.
- InterlockedDecrement takes a LONG, not ULONG
- an imgui printf-style call using a direct string instead of %s (let's
ignore the fact that it's actually safe based on how the str is
constructed)
- missing `override` on a virtual subclass
- `CALLBACK` on a lambda threw me for a loop, but I believe moving it
after the arg list is the correct approach (see if it builds on gcc I
guess)
- `std::result_of` was removed in C++20, which the project is built with
This commit is contained in:
Will
2026-03-07 08:21:10 +10:00
committed by GitHub
parent e4b08064b7
commit 22aeb64ff9
11 changed files with 41 additions and 40 deletions
+4 -12
View File
@@ -6,24 +6,20 @@
#include <windows.h> #include <windows.h>
#include "option.h" #include "option.h"
#include "button.h"
#include "analog.h"
#include "light.h"
namespace rawinput { namespace rawinput {
class RawInputManager; class RawInputManager;
struct Device; struct Device;
} }
class Button;
class Analog;
class Light;
class Game; class Game;
class Option; class Option;
namespace GameAPI { namespace GameAPI {
namespace Buttons { namespace Buttons {
enum State {
BUTTON_PRESSED = true,
BUTTON_NOT_PRESSED = false
};
/** /**
* Parses the config and returns the buttons set by the user. * Parses the config and returns the buttons set by the user.
* *
@@ -152,7 +148,3 @@ namespace GameAPI {
void sortOptions(std::vector<Option> &, const std::vector<OptionDefinition> &); void sortOptions(std::vector<Option> &, const std::vector<OptionDefinition> &);
} }
} }
#include "button.h"
#include "analog.h"
#include "light.h"
+10 -2
View File
@@ -1,15 +1,23 @@
#pragma once #pragma once
#include <cstdint>
#include <string> #include <string>
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "api.h"
namespace rawinput { namespace rawinput {
class RawInputManager; class RawInputManager;
} }
namespace GameAPI {
namespace Buttons {
enum State {
BUTTON_PRESSED = true,
BUTTON_NOT_PRESSED = false
};
}
}
enum ButtonAnalogType { enum ButtonAnalogType {
BAT_NONE = 0, BAT_NONE = 0,
BAT_POSITIVE = 1, BAT_POSITIVE = 1,
+2 -2
View File
@@ -818,7 +818,7 @@ namespace games::iidx {
} }
bool is_tdj_fhd() { bool is_tdj_fhd() {
return TDJ_MODE && avs::game::is_ext(2022101900, MAXINT); return TDJ_MODE && avs::game::is_ext(2022101900, INT_MAX);
} }
void apply_audio_hacks() { void apply_audio_hacks() {
@@ -886,7 +886,7 @@ namespace games::iidx {
// only do this if NOT wasapi (as opposed to checking if it's asio) // only do this if NOT wasapi (as opposed to checking if it's asio)
// the patch is only really needed for (some) non-XONAR devices but since people sometimes disguise // the patch is only really needed for (some) non-XONAR devices but since people sometimes disguise
// other devices as a XONAR, don't check for the exact string (common ASIO workaround for INF) // other devices as a XONAR, don't check for the exact string (common ASIO workaround for INF)
if (avs::game::is_ext(2024090100, MAXINT) && if (avs::game::is_ext(2024090100, INT_MAX) &&
!(SOUND_OUTPUT_DEVICE_IN_EFFECT.has_value() && !(SOUND_OUTPUT_DEVICE_IN_EFFECT.has_value() &&
SOUND_OUTPUT_DEVICE_IN_EFFECT.value() == "wasapi")) { SOUND_OUTPUT_DEVICE_IN_EFFECT.value() == "wasapi")) {
+1 -1
View File
@@ -89,7 +89,7 @@ namespace games::iidx {
protected: protected:
virtual ~IIDXLocalCamera() {}; virtual ~IIDXLocalCamera() {};
ULONG m_nRefCount; LONG m_nRefCount;
CRITICAL_SECTION m_critsec; CRITICAL_SECTION m_critsec;
std::string m_name; std::string m_name;
@@ -278,7 +278,7 @@ static bool is_dx9_on_12_enabled() {
} }
if (GRAPHICS_9_ON_12_STATE == DX9ON12_FORCE_ON) { if (GRAPHICS_9_ON_12_STATE == DX9ON12_FORCE_ON) {
if (avs::game::is_model("LDJ") && avs::game::is_ext(2023091500, MAXINT)) { if (avs::game::is_model("LDJ") && avs::game::is_ext(2023091500, INT_MAX)) {
deferredlogs::defer_error_messages({ deferredlogs::defer_error_messages({
"dx9on12 was force enabled by user (-dx9on12)", "dx9on12 was force enabled by user (-dx9on12)",
" IIDX31+ is known to be incompatible with DX 9on12, leading to blank screen or crashes", " IIDX31+ is known to be incompatible with DX 9on12, leading to blank screen or crashes",
@@ -593,7 +593,7 @@ HRESULT STDMETHODCALLTYPE WrappedIDirect3DDevice9::UpdateTexture(
WRAP_DEBUG; WRAP_DEBUG;
if (CUSTOM_RESET) { if (CUSTOM_RESET) {
#ifdef __GNUC__ #if defined(__GNUC__) && !defined(__clang__)
// Do a pointer compare rather than `QueryInterface` because it is a lot cheaper than incrementing // Do a pointer compare rather than `QueryInterface` because it is a lot cheaper than incrementing
// the reference count // the reference count
+1 -1
View File
@@ -3182,7 +3182,7 @@ namespace overlay::windows {
} else if (filter != nullptr) { } else if (filter != nullptr) {
cat = "Search results"; cat = "Search results";
} }
ImGui::TextColored(ImVec4(1.f, 0.7f, 0, 1), cat.c_str()); ImGui::TextColored(ImVec4(1.f, 0.7f, 0, 1), "%s", cat.c_str());
ImGui::Separator(); ImGui::Separator();
// render table // render table
+1
View File
@@ -2,6 +2,7 @@
#include "overlay/window.h" #include "overlay/window.h"
#include "cfg/button.h" #include "cfg/button.h"
#include "cfg/light.h"
namespace overlay::windows { namespace overlay::windows {
@@ -235,9 +235,9 @@ namespace overlay::windows {
#ifdef _MSC_VER #ifdef _MSC_VER
static_cast<PLDR_DLL_NOTIFICATION_FUNCTION>([] static_cast<PLDR_DLL_NOTIFICATION_FUNCTION>([]
#else #else
[] CALLBACK []
#endif #endif
(ULONG reason, PCLDR_DLL_NOTIFICATION_DATA data, PVOID ctx) { (ULONG reason, PCLDR_DLL_NOTIFICATION_DATA data, PVOID ctx) CALLBACK {
if (reason == LDR_DLL_NOTIFICATION_REASON_LOADED) { if (reason == LDR_DLL_NOTIFICATION_REASON_LOADED) {
auto const dll = strtolower(std::filesystem::path({ auto const dll = strtolower(std::filesystem::path({
data->Loaded.FullDllName->Buffer, data->Loaded.FullDllName->Buffer,
+1 -1
View File
@@ -10,7 +10,7 @@ namespace overlay::windows {
~ScreenResize() override; ~ScreenResize() override;
void build_content() override; void build_content() override;
void update(); void update() override;
private: private:
size_t toggle_screen_resize = ~0u; size_t toggle_screen_resize = ~0u;
+2 -2
View File
@@ -56,8 +56,8 @@ public:
template<class T, class... Args> template<class T, class... Args>
auto add(T&& func, Args&&... args) auto add(T&& func, Args&&... args)
-> std::future<typename std::result_of<T(Args...)>::type> { -> std::future<typename std::invoke_result<T, Args...>::type> {
using ret_t = typename std::result_of<T(Args...)>::type; using ret_t = typename std::invoke_result<T, Args...>::type;
auto task = std::make_shared<std::packaged_task<ret_t()>>( auto task = std::make_shared<std::packaged_task<ret_t()>>(
std::bind(std::forward<T>(func), std::forward<Args>(args)...)); std::bind(std::forward<T>(func), std::forward<Args>(args)...));
std::future<ret_t> fut = task->get_future(); std::future<ret_t> fut = task->get_future();