diff --git a/data/plugins/MaxPayne3.FusionFix.ini b/data/plugins/MaxPayne3.FusionFix.ini index 8ca7377..408f088 100644 --- a/data/plugins/MaxPayne3.FusionFix.ini +++ b/data/plugins/MaxPayne3.FusionFix.ini @@ -13,3 +13,4 @@ GamepadIcons = 0 ; 4 - Playstation 5 ; 5 - Nintendo Switch ; 6 - Steam Deck +; 7 - Steam Controller \ No newline at end of file diff --git a/source/buttons.ixx b/source/buttons.ixx index bddb765..b69d6bc 100644 --- a/source/buttons.ixx +++ b/source/buttons.ixx @@ -6,6 +6,7 @@ module; export module buttons; import common; +import comvars; import settings; class Buttons @@ -19,6 +20,7 @@ private: "PS5_", "SWITCH_", "SD_", + "SC_", }; static inline std::vector buttons = { @@ -123,6 +125,8 @@ public: { FusionFix::onInitEvent() += []() { + assert(gLastControllerTextureIndex == (btnPrefix.size() - 1)); + auto pattern = hook::pattern("B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? B9"); gameButtonPtrs = *pattern.get_first(1); @@ -145,7 +149,7 @@ public: { controllerDstTexPtr = (void**)(regs.esi + 0x104); auto v = FusionFixSettings.GetInt("PREF_BUTTONS"); - if (v > 6) v = 0; else if (v < 0) v = 6; + if (v > gLastControllerTextureIndex) v = 0; else if (v < 0) v = gLastControllerTextureIndex; if (controllerTexPtrs[v]) *controllerDstTexPtr = controllerTexPtrs[v]; } @@ -165,7 +169,7 @@ public: if (oldVal == 3 && curVal == 4) { auto v = FusionFixSettings.GetInt("PREF_BUTTONS") + 1; - if (v > 6) v = 0; else if (v < 0) v = 6; + if (v > gLastControllerTextureIndex) v = 0; else if (v < 0) v = gLastControllerTextureIndex; CIniReader iniWriter(""); iniWriter.WriteInteger("MAIN", "GamepadIcons", v); @@ -175,7 +179,7 @@ public: else if (oldVal == 4 && curVal == 3) { auto v = FusionFixSettings.GetInt("PREF_BUTTONS") - 1; - if (v > 6) v = 0; else if (v < 0) v = 6; + if (v > gLastControllerTextureIndex) v = 0; else if (v < 0) v = gLastControllerTextureIndex; CIniReader iniWriter(""); iniWriter.WriteInteger("MAIN", "GamepadIcons", v); diff --git a/source/comvars.ixx b/source/comvars.ixx index 62fca3a..3d3a5db 100644 --- a/source/comvars.ixx +++ b/source/comvars.ixx @@ -10,6 +10,7 @@ export HWND gWnd; export RECT gRect; export void* (__fastcall* getNativeAddress)(uintptr_t*, uint32_t, uint32_t); export uintptr_t* nativeHandlerPtrAddress; +export constexpr auto gLastControllerTextureIndex = 7; class Common { diff --git a/source/settings.ixx b/source/settings.ixx index a904c05..cfc674a 100644 --- a/source/settings.ixx +++ b/source/settings.ixx @@ -24,7 +24,7 @@ public: mFusionPrefs["PREF_OUTLINESIZE"] = std::clamp(iniReader.ReadFloat("MAIN", "OutlinesSizeMultiplier", 1.0f), 0.0f, 10.0f); mFusionPrefs["PREF_BORDERLESS"] = std::clamp(iniReader.ReadInteger("MAIN", "BorderlessWindowed", 1), 0, 1); mFusionPrefs["PREF_LEDILLUMINATION"] = std::clamp(iniReader.ReadInteger("MAIN", "LightSyncRGB", 1), 0, 1); - mFusionPrefs["PREF_BUTTONS"] = std::clamp(iniReader.ReadInteger("MAIN", "GamepadIcons", 0), 0, 6); + mFusionPrefs["PREF_BUTTONS"] = std::clamp(iniReader.ReadInteger("MAIN", "GamepadIcons", 0), 0, gLastControllerTextureIndex); static std::once_flag flag; std::call_once(flag, [&]() diff --git a/textures/platform/textures/buttons_pc.wtd/sc_a_butt.dds b/textures/platform/textures/buttons_pc.wtd/sc_a_butt.dds new file mode 100644 index 0000000..7084970 Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_a_butt.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_b_butt.dds b/textures/platform/textures/buttons_pc.wtd/sc_b_butt.dds new file mode 100644 index 0000000..cb9a138 Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_b_butt.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_back_butt.dds b/textures/platform/textures/buttons_pc.wtd/sc_back_butt.dds new file mode 100644 index 0000000..7dad715 Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_back_butt.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_down_arrow.dds b/textures/platform/textures/buttons_pc.wtd/sc_down_arrow.dds new file mode 100644 index 0000000..64405f2 Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_down_arrow.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_dpad_all.dds b/textures/platform/textures/buttons_pc.wtd/sc_dpad_all.dds new file mode 100644 index 0000000..fb3e8cc Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_dpad_all.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_dpad_down.dds b/textures/platform/textures/buttons_pc.wtd/sc_dpad_down.dds new file mode 100644 index 0000000..9bca684 Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_dpad_down.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_dpad_left.dds b/textures/platform/textures/buttons_pc.wtd/sc_dpad_left.dds new file mode 100644 index 0000000..2b1b443 Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_dpad_left.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_dpad_leftright.dds b/textures/platform/textures/buttons_pc.wtd/sc_dpad_leftright.dds new file mode 100644 index 0000000..21203a5 Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_dpad_leftright.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_dpad_none.dds b/textures/platform/textures/buttons_pc.wtd/sc_dpad_none.dds new file mode 100644 index 0000000..eede436 Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_dpad_none.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_dpad_right.dds b/textures/platform/textures/buttons_pc.wtd/sc_dpad_right.dds new file mode 100644 index 0000000..4c653ba Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_dpad_right.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_dpad_up.dds b/textures/platform/textures/buttons_pc.wtd/sc_dpad_up.dds new file mode 100644 index 0000000..faf7ab6 Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_dpad_up.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_dpad_updown.dds b/textures/platform/textures/buttons_pc.wtd/sc_dpad_updown.dds new file mode 100644 index 0000000..419f90c Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_dpad_updown.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_lb_butt.dds b/textures/platform/textures/buttons_pc.wtd/sc_lb_butt.dds new file mode 100644 index 0000000..9e7bc8a Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_lb_butt.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_left_arrow.dds b/textures/platform/textures/buttons_pc.wtd/sc_left_arrow.dds new file mode 100644 index 0000000..3fcf161 Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_left_arrow.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_lstick_all.dds b/textures/platform/textures/buttons_pc.wtd/sc_lstick_all.dds new file mode 100644 index 0000000..3d8977b Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_lstick_all.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_lstick_down.dds b/textures/platform/textures/buttons_pc.wtd/sc_lstick_down.dds new file mode 100644 index 0000000..d04616b Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_lstick_down.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_lstick_left.dds b/textures/platform/textures/buttons_pc.wtd/sc_lstick_left.dds new file mode 100644 index 0000000..07514dd Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_lstick_left.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_lstick_leftright.dds b/textures/platform/textures/buttons_pc.wtd/sc_lstick_leftright.dds new file mode 100644 index 0000000..1260872 Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_lstick_leftright.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_lstick_none.dds b/textures/platform/textures/buttons_pc.wtd/sc_lstick_none.dds new file mode 100644 index 0000000..b94aa99 Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_lstick_none.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_lstick_right.dds b/textures/platform/textures/buttons_pc.wtd/sc_lstick_right.dds new file mode 100644 index 0000000..13769ef Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_lstick_right.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_lstick_up.dds b/textures/platform/textures/buttons_pc.wtd/sc_lstick_up.dds new file mode 100644 index 0000000..dc58b3c Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_lstick_up.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_lstick_updown.dds b/textures/platform/textures/buttons_pc.wtd/sc_lstick_updown.dds new file mode 100644 index 0000000..ceda7ef Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_lstick_updown.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_lt_butt.dds b/textures/platform/textures/buttons_pc.wtd/sc_lt_butt.dds new file mode 100644 index 0000000..fec7ed9 Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_lt_butt.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_rb_butt.dds b/textures/platform/textures/buttons_pc.wtd/sc_rb_butt.dds new file mode 100644 index 0000000..497e3f9 Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_rb_butt.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_right_arrow.dds b/textures/platform/textures/buttons_pc.wtd/sc_right_arrow.dds new file mode 100644 index 0000000..37d5775 Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_right_arrow.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_rstick_all.dds b/textures/platform/textures/buttons_pc.wtd/sc_rstick_all.dds new file mode 100644 index 0000000..16a4bf0 Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_rstick_all.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_rstick_down.dds b/textures/platform/textures/buttons_pc.wtd/sc_rstick_down.dds new file mode 100644 index 0000000..cf3adda Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_rstick_down.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_rstick_left.dds b/textures/platform/textures/buttons_pc.wtd/sc_rstick_left.dds new file mode 100644 index 0000000..c00312d Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_rstick_left.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_rstick_leftright.dds b/textures/platform/textures/buttons_pc.wtd/sc_rstick_leftright.dds new file mode 100644 index 0000000..f3a3298 Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_rstick_leftright.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_rstick_none.dds b/textures/platform/textures/buttons_pc.wtd/sc_rstick_none.dds new file mode 100644 index 0000000..7c7a5be Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_rstick_none.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_rstick_right.dds b/textures/platform/textures/buttons_pc.wtd/sc_rstick_right.dds new file mode 100644 index 0000000..63417dd Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_rstick_right.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_rstick_up.dds b/textures/platform/textures/buttons_pc.wtd/sc_rstick_up.dds new file mode 100644 index 0000000..5d307d5 Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_rstick_up.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_rstick_updown.dds b/textures/platform/textures/buttons_pc.wtd/sc_rstick_updown.dds new file mode 100644 index 0000000..e72c633 Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_rstick_updown.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_rt_butt.dds b/textures/platform/textures/buttons_pc.wtd/sc_rt_butt.dds new file mode 100644 index 0000000..40c7099 Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_rt_butt.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_start_butt.dds b/textures/platform/textures/buttons_pc.wtd/sc_start_butt.dds new file mode 100644 index 0000000..0a738e1 Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_start_butt.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_up_arrow.dds b/textures/platform/textures/buttons_pc.wtd/sc_up_arrow.dds new file mode 100644 index 0000000..7af21c4 Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_up_arrow.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_x_butt.dds b/textures/platform/textures/buttons_pc.wtd/sc_x_butt.dds new file mode 100644 index 0000000..9f43c23 Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_x_butt.dds differ diff --git a/textures/platform/textures/buttons_pc.wtd/sc_y_butt.dds b/textures/platform/textures/buttons_pc.wtd/sc_y_butt.dds new file mode 100644 index 0000000..cb892be Binary files /dev/null and b/textures/platform/textures/buttons_pc.wtd/sc_y_butt.dds differ