Skip to content

Commit

Permalink
Make touch input interpolation configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
CasualPokePlayer committed Dec 30, 2024
1 parent 3a8024b commit 0ec54fe
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
Binary file modified Assets/dll/melonDS.wbx.zst
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public enum Buttons : uint
public byte MicVolume;
public byte GBALightSensor;
public byte ConsiderAltLag;
public byte UseTouchInterpolation;
}

[StructLayout(LayoutKind.Sequential)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@ public DateTime InitialTime
[DefaultValue(true)]
public bool UseRealTime { get; set; }

[DisplayName("Touch Interpolation")]
[Description("If true, touch inputs will be interpolated, creating smoother touch movements. Required to progress in some games. May be undesirable when TASing.")]
[DefaultValue(true)]
public bool UseTouchInterpolation { get; set; }

[DisplayName("DSi Mode")]
[Description("If true, DSi mode will be used. Forced true if a DSiWare rom is detected.")]
[DefaultValue(false)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ protected override LibWaterboxCore.FrameInfo FrameAdvancePrep(IController contro
MicVolume = (byte)(controller.IsPressed("Microphone") ? controller.AxisValue("Mic Volume") : 0),
GBALightSensor = (byte)controller.AxisValue("GBA Light Sensor"),
ConsiderAltLag = (byte)(_settings.ConsiderAltLag ? 1 : 0),
UseTouchInterpolation = (byte)(_activeSyncSettings.UseTouchInterpolation ? 1 : 0),
};
}

Expand Down
19 changes: 15 additions & 4 deletions waterbox/melon/BizInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ struct MyFrameInfo : public FrameInfo
u8 MicVolume;
u8 GBALightSensor;
bool ConsiderAltLag;
bool UseTouchInterpolation;
};

static s16 biz_mic_input[735];
Expand Down Expand Up @@ -71,8 +72,15 @@ ECL_EXPORT void FrameAdvance(MyFrameInfo* f)

if (f->Keys & 0x1000)
{
// move touch coords incrementally to our new touch point
f->NDS->MoveTouch(f->TouchX, f->TouchY);
if (f->UseTouchInterpolation)
{
// move touch coords incrementally to our new touch point
f->NDS->MoveTouch(f->TouchX, f->TouchY);
}
else
{
f->NDS->TouchScreen(f->TouchX, f->TouchY);
}
}
else
{
Expand Down Expand Up @@ -113,8 +121,11 @@ ECL_EXPORT void FrameAdvance(MyFrameInfo* f)

if (f->Keys & 0x1000)
{
// finalize touch after emulation finishes
f->NDS->TouchScreen(f->TouchX, f->TouchY);
if (f->UseTouchInterpolation)
{
// finalize touch after emulation finishes
f->NDS->TouchScreen(f->TouchX, f->TouchY);
}
}

auto& renderer3d = f->NDS->GetRenderer3D();
Expand Down

0 comments on commit 0ec54fe

Please sign in to comment.