From ddc969ff04ff7c305e91887b381f9776ad4e44fd Mon Sep 17 00:00:00 2001 From: HaseoSora Date: Mon, 6 Apr 2026 12:22:00 +0000 Subject: [PATCH] haseosora-springBoost-Integration (#102) Reviewed-on: https://gitea.tendokyu.moe/TeamTofuShop/segatools/pulls/102 Reviewed-by: Dniel97 Co-authored-by: HaseoSora Co-committed-by: HaseoSora --- dist/idac/segatools.ini | 1 + games/idacio/di-dev.c | 14 +++++++++++--- games/idzio/di-dev.c | 7 ++++++- games/swdcio/di-dev.c | 7 ++++++- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/dist/idac/segatools.ini b/dist/idac/segatools.ini index ca3e211..0b8c083 100644 --- a/dist/idac/segatools.ini +++ b/dist/idac/segatools.ini @@ -286,3 +286,4 @@ baseDamperFraction = 20 ; Recommended: 10 (1.0%) to 100 (10.0%). ; Default: 20 = 2.0% deadband = 20 + diff --git a/games/idacio/di-dev.c b/games/idacio/di-dev.c index 1bc714a..c3b7bcc 100644 --- a/games/idacio/di-dev.c +++ b/games/idacio/di-dev.c @@ -32,6 +32,9 @@ static uint8_t idac_di_rumble_duration; static uint8_t idac_di_base_damper; static uint8_t idac_di_deadband; +/* Fixed spring boost multiplier (1.5x) */ +static const float idac_di_spring_boost = 1.5f; + HRESULT idac_di_dev_init(const struct idac_di_config* cfg, IDirectInputDevice8W* dev, HWND wnd) { assert(cfg != NULL); @@ -240,13 +243,18 @@ void idac_di_ffb_damper(uint8_t force) { DIEFFECT fx; DICONDITION cond; + /* SPRING (centering) */ memset(&cond, 0, sizeof(cond)); - cond.lPositiveCoefficient = (LONG)(((uint32_t)force * ffb_strength) / idac_di_ffb_scale); - cond.lNegativeCoefficient = cond.lPositiveCoefficient; + LONG base_coeff = (LONG)(((uint32_t)force * ffb_strength) / idac_di_ffb_scale); + + LONG boosted_coeff = (LONG)((float)base_coeff * idac_di_spring_boost); + + cond.lPositiveCoefficient = boosted_coeff; + cond.lNegativeCoefficient = boosted_coeff; cond.dwPositiveSaturation = DI_FFNOMINALMAX; cond.dwNegativeSaturation = DI_FFNOMINALMAX; - + /* If user enters 25, result is 0.025 * DI_FFNOMINALMAX */ cond.lDeadBand = (DI_FFNOMINALMAX * (LONG)idac_di_deadband) / 1000; diff --git a/games/idzio/di-dev.c b/games/idzio/di-dev.c index 25d2b79..c0a5cff 100644 --- a/games/idzio/di-dev.c +++ b/games/idzio/di-dev.c @@ -31,6 +31,9 @@ static uint8_t idz_di_rumble_duration; static uint8_t idz_di_base_damper; static uint8_t idz_di_deadband; +/* Fixed spring boost multiplier (1.5x) */ +static const float idz_di_spring_boost = 1.5f; + HRESULT idz_di_dev_init(const struct idz_di_config* cfg, IDirectInputDevice8W* dev, HWND wnd) { assert(cfg != NULL); @@ -63,6 +66,7 @@ HRESULT idz_di_dev_init(const struct idz_di_config* cfg, ? 200 : cfg->ffb_deadband; + return S_OK; } @@ -251,7 +255,8 @@ void idz_di_ffb_damper(uint8_t force) { /* SPRING (centering) */ memset(&cond, 0, sizeof(cond)); - cond.lPositiveCoefficient = (LONG)(((uint32_t)force * ffb_strength) / idz_di_ffb_scale); + LONG base_coeff = (LONG)(((uint32_t)force * ffb_strength) / idz_di_ffb_scale); + LONG boosted_coeff = (LONG)((float)base_coeff * idz_di_spring_boost); cond.lNegativeCoefficient = cond.lPositiveCoefficient; cond.dwPositiveSaturation = DI_FFNOMINALMAX; cond.dwNegativeSaturation = DI_FFNOMINALMAX; diff --git a/games/swdcio/di-dev.c b/games/swdcio/di-dev.c index e913927..9c5a6c8 100644 --- a/games/swdcio/di-dev.c +++ b/games/swdcio/di-dev.c @@ -32,6 +32,9 @@ static uint8_t swdc_di_rumble_duration; static uint8_t swdc_di_base_damper; static uint8_t swdc_di_deadband; +/* Fixed spring boost multiplier (1.5x) */ +static const float swdc_di_spring_boost = 1.5f; + HRESULT swdc_di_dev_init(const struct swdc_di_config* cfg, IDirectInputDevice8W* dev, HWND wnd) { assert(cfg != NULL); @@ -64,6 +67,7 @@ HRESULT swdc_di_dev_init(const struct swdc_di_config* cfg, ? 200 : cfg->ffb_deadband; + return S_OK; } @@ -242,7 +246,8 @@ void swdc_di_ffb_damper(uint8_t force) { /* SPRING (centering) */ memset(&cond, 0, sizeof(cond)); - cond.lPositiveCoefficient = (LONG)(((uint32_t)force * ffb_strength) / swdc_di_ffb_scale); + LONG base_coeff = (LONG)(((uint32_t)force * ffb_strength) / swdc_di_ffb_scale); + LONG boosted_coeff = (LONG)((float)base_coeff * swdc_di_spring_boost); cond.lNegativeCoefficient = cond.lPositiveCoefficient; cond.dwPositiveSaturation = DI_FFNOMINALMAX; cond.dwNegativeSaturation = DI_FFNOMINALMAX;