Wire up B&W/colo(u)r switch in Stella (resolves #3203)

unmanaged side was done in 3af38050f (#4178)
This commit is contained in:
YoshiRulz 2025-05-30 08:24:06 +10:00
parent 15d920550a
commit b5e13206cf
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
3 changed files with 17 additions and 9 deletions

View File

@ -11,6 +11,8 @@ namespace BizHawk.Emulation.Cores.Atari.Stella
private bool _leftDifficultyToggled;
private bool _rightDifficultyToggled;
private bool _colorVideoToggled = true;
public bool FrameAdvance(IController controller, bool render, bool renderSound)
{
byte port1 = _controllerDeck.ReadPort1(controller);
@ -19,12 +21,13 @@ namespace BizHawk.Emulation.Cores.Atari.Stella
// Handle all the console switches here
if (controller.IsPressed("Toggle Right Difficulty")) _rightDifficultyToggled = !_rightDifficultyToggled;
if (controller.IsPressed("Toggle Left Difficulty")) _leftDifficultyToggled = !_leftDifficultyToggled;
if (controller.IsPressed("Toggle TV Type")) _colorVideoToggled = !_colorVideoToggled;
// select and reset switches default to an unpressed state
// unknown whether TV color switch matters for TASing, so default to Color for now
byte switchPort = 0b00001011;
byte switchPort = 0b0000_0011;
if (_rightDifficultyToggled) switchPort |= 0b10000000;
if (_leftDifficultyToggled) switchPort |= 0b01000000;
if (_colorVideoToggled) switchPort |= 0b0000_1000;
if (controller.IsPressed("Select")) switchPort &= 0b11111101; // 0 = Pressed
if (controller.IsPressed("Reset")) switchPort &= 0b11111110; // 0 = Pressed

View File

@ -16,11 +16,15 @@ namespace BizHawk.Emulation.Cores.Atari.Stella
{
BoolButtons = Port1.Definition.BoolButtons
.Concat(Port2.Definition.BoolButtons)
.Concat(
[
"Reset", "Select", "Power", "Toggle Left Difficulty", "Toggle Right Difficulty"
.Concat([
"Reset",
"Select",
"Power",
"Toggle Left Difficulty",
"Toggle Right Difficulty",
"Toggle TV Type",
])
.ToList()
.ToList(),
};
foreach (var kvp in Port1.Definition.Axes) Definition.Axes.Add(kvp);

View File

@ -201,7 +201,7 @@ namespace BizHawk.Emulation.Cores
{
return new ConsoleSchema
{
Size = new Size(185, 75),
Size = new(185, 90),
Buttons = new[]
{
new ButtonSchema(10, 15, "Select"),
@ -214,8 +214,9 @@ namespace BizHawk.Emulation.Cores
new ButtonSchema(92, 40, "Toggle Right Difficulty")
{
DisplayName = "Right Difficulty"
}
}
},
new ButtonSchema(10, 65, "Toggle TV Type") { DisplayName = "B&W / Color" },
},
};
}
}