Skip to content

Add analog keybinds for Ares64#4611

Merged
YoshiRulz merged 4 commits intoTASEmulators:masterfrom
rjgabel:master
Jan 24, 2026
Merged

Add analog keybinds for Ares64#4611
YoshiRulz merged 4 commits intoTASEmulators:masterfrom
rjgabel:master

Conversation

@rjgabel
Copy link
Copy Markdown
Contributor

@rjgabel rjgabel commented Jan 23, 2026

dev build for branch | USERNAME:BRANCHNAME

Fixes #3871.

Check if completed:

@YoshiRulz
Copy link
Copy Markdown
Member

Compare the implementation for Mupen:

private const sbyte _maxAnalogX = 127;
private const sbyte _minAnalogX = -128;
private const sbyte _maxAnalogY = 127;
private const sbyte _minAnalogY = -128;
/// <summary>
/// Translates controller input from EmuHawk into
/// N64 controller data
/// </summary>
/// <param name="i">Id of controller to update and shove</param>
public int GetControllerInput(int i)
{
_emuCore.InputCallbacks.Call();
ThisFrameInputPolled = true;
// Analog stick right = +X
// Analog stick up = +Y
string p = "P" + (i + 1);
sbyte x;
if (Controller.IsPressed(p + " A Left"))
{
x = _minAnalogX;
}
else if (Controller.IsPressed(p + " A Right"))
{
x = _maxAnalogX;
}
else
{
x = (sbyte)Controller.AxisValue(p + " X Axis");
}
sbyte y;
if (Controller.IsPressed(p + " A Up"))
{
y = _maxAnalogY;
}
else if (Controller.IsPressed(p + " A Down"))
{
y = _minAnalogY;
}
else
{
y = (sbyte)Controller.AxisValue(p + " Y Axis");
}
int value = ReadController(i + 1);
value |= (x & 0xFF) << 16;
value |= (y & 0xFF) << 24;
return value;
}

I think it would be better as a static helper method which was shared by both cores.

@CasualPokePlayer
Copy link
Copy Markdown
Member

Not including this was an explicit choice. This thing is a hack and shouldn't be done within the core, it should be done within the frontend for all analog controls, without the core knowing.

@rjgabel
Copy link
Copy Markdown
Contributor Author

rjgabel commented Jan 23, 2026

Not including this was an explicit choice. This thing is a hack and shouldn't be done within the core, it should be done within the frontend for all analog controls, without the core knowing.

I definitely agree that, longer term, this should probably be done by allowing button/key inputs for analog axes, but from what I can tell that seems like it would be a fairly large rewrite that doesn't seem like it's happening soon. And considering we already have the hack present in the Mupen core, I think it makes sense to include it as a stopgap in Ares64 as well.

@rjgabel
Copy link
Copy Markdown
Contributor Author

rjgabel commented Jan 23, 2026

Compare the implementation for Mupen:

private const sbyte _maxAnalogX = 127;
private const sbyte _minAnalogX = -128;
private const sbyte _maxAnalogY = 127;
private const sbyte _minAnalogY = -128;
/// <summary>
/// Translates controller input from EmuHawk into
/// N64 controller data
/// </summary>
/// <param name="i">Id of controller to update and shove</param>
public int GetControllerInput(int i)
{
_emuCore.InputCallbacks.Call();
ThisFrameInputPolled = true;
// Analog stick right = +X
// Analog stick up = +Y
string p = "P" + (i + 1);
sbyte x;
if (Controller.IsPressed(p + " A Left"))
{
x = _minAnalogX;
}
else if (Controller.IsPressed(p + " A Right"))
{
x = _maxAnalogX;
}
else
{
x = (sbyte)Controller.AxisValue(p + " X Axis");
}
sbyte y;
if (Controller.IsPressed(p + " A Up"))
{
y = _maxAnalogY;
}
else if (Controller.IsPressed(p + " A Down"))
{
y = _minAnalogY;
}
else
{
y = (sbyte)Controller.AxisValue(p + " Y Axis");
}
int value = ReadController(i + 1);
value |= (x & 0xFF) << 16;
value |= (y & 0xFF) << 24;
return value;
}

I think it would be better as a static helper method which was shared by both cores.

I've refactored the code into a static helper method in the N64Input class. As a note, I'm working on Linux so I can't test Mupen64, but I've tried to make as few changes as I can to Mupen64-specific code so hopefully it should all work correctly.

Copy link
Copy Markdown
Member

@YoshiRulz YoshiRulz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LGTM.

Comment thread src/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64Input.cs
Comment thread src/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64Input.cs Outdated
@YoshiRulz YoshiRulz merged commit be57529 into TASEmulators:master Jan 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ares64 does not have the analog stick controls unlike Mupen64Plus

3 participants