Add microphone button for melonDS

This changes the behavior so the user just has to press the microphone button to blow the mic, where the volume of the blowing can be controlled with the mic volume axis (but now the neutral value of mic volume is 100 rather than 0)
This commit is contained in:
CasualPokePlayer 2024-08-30 17:35:18 -07:00
parent 1ce8b855c7
commit aeda8f1659
5 changed files with 80 additions and 76 deletions

View File

@ -145,7 +145,8 @@
"R": "E, J1 B6, X1 RightShoulder",
"Select": "Space, J1 B9, X1 Back",
"Start": "Enter, J1 B10, X1 Start",
"Touch": "WMouse L"
"Touch": "WMouse L",
"Microphone": "M"
},
"Atari 2600 Basic Controller": {
"Reset": "D, J1 B9, X1 Back",

View File

@ -510,6 +510,7 @@ namespace BizHawk.Client.Common
{
["LidOpen"] = 'o',
["LidClose"] = 'c',
["Microphone"] = 'M',
["Touch"] = 'T'
},
[VSystemID.Raw.O2] = new()
@ -718,73 +719,73 @@ namespace BizHawk.Client.Common
["F12"] = '2',
},
[VSystemID.Raw.Amiga] = new()
{
["L"] = 'L',
["R"] = 'R',
["NP 0"] = '0',
["NP 1"] = '1',
["NP 2"] = '2',
["NP 3"] = '3',
["NP 4"] = '4',
["NP 5"] = '5',
["NP 6"] = '6',
["NP 7"] = '7',
["NP 8"] = '8',
["NP 9"] = '9',
["NP Add"] = '+',
["NP Delete"] = 'd',
["NP Div"] = '/',
["NP Enter"] = 'e',
["NP Left Paren"] = '(',
["NP Mul"] = '*',
["NP Right Paren"] = ')',
["NP Sub"] = '-',
["Backquote"] = '`',
["Backslash"] = '\\',
["Backspace"] = 'b',
["Caps Lock"] = 'c',
["Comma"] = ',',
["Ctrl"] = 'c',
["Delete"] = 'd',
["Down"] = 'D',
["Equal"] = '=',
["Escape"] = 'e',
["Help"] = 'h',
["Left"] = 'L',
["Left Alt"] = 'a',
["Left Amiga"] = 'A',
["Left Bracket"] = '[',
["Left Shift"] = 's',
["Less"] = '<',
["Minus"] = '-',
["Number Sign"] = '#',
["Period"] = '.',
["Quote"] = '\"',
["Return"] = 'r',
["Right"] = 'R',
["Right Alt"] = 'a',
["Right Amiga"] = 'A',
["Right Bracket"] = ']',
["Right Shift"] = 's',
["Semicolon"] = ';',
["Slash"] = '/',
["Space"] = '_',
["Tab"] = 't',
["Up"] = 'U',
["Joystick Button 1"] = '1',
["Joystick Button 2"] = '2',
["Joystick Button 3"] = '3',
["Joystick Up"] = 'U',
["Joystick Down"] = 'D',
["Joystick Left"] = 'L',
["Joystick Right"] = 'R',
["Mouse Left Button"] = 'l',
["Mouse Middle Button"] = 'm',
["Mouse Right Button"] = 'r',
["Eject"] = '^',
["Insert"] = 'v',
["Next Drive"] = '}',
["Next Slot"] = '>',
{
["L"] = 'L',
["R"] = 'R',
["NP 0"] = '0',
["NP 1"] = '1',
["NP 2"] = '2',
["NP 3"] = '3',
["NP 4"] = '4',
["NP 5"] = '5',
["NP 6"] = '6',
["NP 7"] = '7',
["NP 8"] = '8',
["NP 9"] = '9',
["NP Add"] = '+',
["NP Delete"] = 'd',
["NP Div"] = '/',
["NP Enter"] = 'e',
["NP Left Paren"] = '(',
["NP Mul"] = '*',
["NP Right Paren"] = ')',
["NP Sub"] = '-',
["Backquote"] = '`',
["Backslash"] = '\\',
["Backspace"] = 'b',
["Caps Lock"] = 'c',
["Comma"] = ',',
["Ctrl"] = 'c',
["Delete"] = 'd',
["Down"] = 'D',
["Equal"] = '=',
["Escape"] = 'e',
["Help"] = 'h',
["Left"] = 'L',
["Left Alt"] = 'a',
["Left Amiga"] = 'A',
["Left Bracket"] = '[',
["Left Shift"] = 's',
["Less"] = '<',
["Minus"] = '-',
["Number Sign"] = '#',
["Period"] = '.',
["Quote"] = '\"',
["Return"] = 'r',
["Right"] = 'R',
["Right Alt"] = 'a',
["Right Amiga"] = 'A',
["Right Bracket"] = ']',
["Right Shift"] = 's',
["Semicolon"] = ';',
["Slash"] = '/',
["Space"] = '_',
["Tab"] = 't',
["Up"] = 'U',
["Joystick Button 1"] = '1',
["Joystick Button 2"] = '2',
["Joystick Button 3"] = '3',
["Joystick Up"] = 'U',
["Joystick Down"] = 'D',
["Joystick Left"] = 'L',
["Joystick Right"] = 'R',
["Mouse Left Button"] = 'l',
["Mouse Middle Button"] = 'm',
["Mouse Right Button"] = 'r',
["Eject"] = '^',
["Insert"] = 'v',
["Next Drive"] = '}',
["Next Slot"] = '>',
}
};

View File

@ -15,10 +15,10 @@ namespace BizHawk.Client.Common
{
BoolButtons =
{
"Up", "Down", "Left", "Right", "Start", "Select", "B", "A", "Y", "X", "L", "R", "LidOpen", "LidClose", "Touch", "Power"
"Up", "Down", "Left", "Right", "Start", "Select", "B", "A", "Y", "X", "L", "R", "LidOpen", "LidClose", "Touch", "Microphone", "Power"
}
}.AddXYPair("Touch {0}", AxisPairOrientation.RightAndUp, 0.RangeTo(255), 128, 0.RangeTo(191), 96) //TODO verify direction against hardware
.AddAxis("Mic Volume", 0.RangeTo(100), 0)
.AddAxis("Mic Volume", 0.RangeTo(100), 100)
.AddAxis("GBA Light Sensor", 0.RangeTo(10), 0)
.MakeImmutable();
@ -97,6 +97,7 @@ namespace BizHawk.Client.Common
controller["LidOpen"] = false;
controller["LidClose"] = false;
controller["Microphone"] = false;
controller["Power"] = false;
string[] sections = line.Split(new[] {'|'}, StringSplitOptions.RemoveEmptyEntries);
@ -104,7 +105,7 @@ namespace BizHawk.Client.Common
{
ProcessCmd(sections[0], controller);
}
if (sections.Length > 1)
{
var mnemonics = sections[1].Take(_buttons.Length).ToList();
@ -131,7 +132,7 @@ namespace BizHawk.Client.Common
{
("Touch X", touchX),
("Touch Y", touchY),
("Mic Volume", 0),
("Mic Volume", 100),
("GBA Light Sensor", 0),
});
}

View File

@ -416,10 +416,10 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
{
BoolButtons =
{
"Up", "Down", "Left", "Right", "Start", "Select", "B", "A", "Y", "X", "L", "R", "LidOpen", "LidClose", "Touch", "Power"
"Up", "Down", "Left", "Right", "Start", "Select", "B", "A", "Y", "X", "L", "R", "LidOpen", "LidClose", "Touch", "Microphone", "Power"
}
}.AddXYPair("Touch {0}", AxisPairOrientation.RightAndUp, 0.RangeTo(255), 128, 0.RangeTo(191), 96)
.AddAxis("Mic Volume", (0).RangeTo(100), 0)
.AddAxis("Mic Volume", 0.RangeTo(100), 100)
.AddAxis("GBA Light Sensor", 0.RangeTo(10), 0)
.MakeImmutable();
@ -480,7 +480,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
Keys = GetButtons(controller),
TouchX = (byte)controller.AxisValue("Touch X"),
TouchY = (byte)controller.AxisValue("Touch Y"),
MicVolume = (byte)controller.AxisValue("Mic Volume"),
MicVolume = (byte)(controller.IsPressed("Microphone") ? controller.AxisValue("Mic Volume") : 0),
GBALightSensor = (byte)controller.AxisValue("GBA Light Sensor"),
ConsiderAltLag = (byte)(_settings.ConsiderAltLag ? 1 : 0),
};

View File

@ -52,7 +52,8 @@ namespace BizHawk.Emulation.Cores
{
new ButtonSchema(8, 18, "LidOpen") { DisplayName = "Lid Open" },
new ButtonSchema(68, 18, "LidClose") { DisplayName = "Lid Close" },
new ButtonSchema(128, 18, "Power"),
new ButtonSchema(128, 18, "Microphone") { DisplayName = "Mic" },
new ButtonSchema(163, 18, "Power"),
new SingleAxisSchema(10, 63, "Mic Volume")
{