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", "R": "E, J1 B6, X1 RightShoulder",
"Select": "Space, J1 B9, X1 Back", "Select": "Space, J1 B9, X1 Back",
"Start": "Enter, J1 B10, X1 Start", "Start": "Enter, J1 B10, X1 Start",
"Touch": "WMouse L" "Touch": "WMouse L",
"Microphone": "M"
}, },
"Atari 2600 Basic Controller": { "Atari 2600 Basic Controller": {
"Reset": "D, J1 B9, X1 Back", "Reset": "D, J1 B9, X1 Back",

View File

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

View File

@ -15,10 +15,10 @@ namespace BizHawk.Client.Common
{ {
BoolButtons = 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 }.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) .AddAxis("GBA Light Sensor", 0.RangeTo(10), 0)
.MakeImmutable(); .MakeImmutable();
@ -97,6 +97,7 @@ namespace BizHawk.Client.Common
controller["LidOpen"] = false; controller["LidOpen"] = false;
controller["LidClose"] = false; controller["LidClose"] = false;
controller["Microphone"] = false;
controller["Power"] = false; controller["Power"] = false;
string[] sections = line.Split(new[] {'|'}, StringSplitOptions.RemoveEmptyEntries); string[] sections = line.Split(new[] {'|'}, StringSplitOptions.RemoveEmptyEntries);
@ -104,7 +105,7 @@ namespace BizHawk.Client.Common
{ {
ProcessCmd(sections[0], controller); ProcessCmd(sections[0], controller);
} }
if (sections.Length > 1) if (sections.Length > 1)
{ {
var mnemonics = sections[1].Take(_buttons.Length).ToList(); var mnemonics = sections[1].Take(_buttons.Length).ToList();
@ -131,7 +132,7 @@ namespace BizHawk.Client.Common
{ {
("Touch X", touchX), ("Touch X", touchX),
("Touch Y", touchY), ("Touch Y", touchY),
("Mic Volume", 0), ("Mic Volume", 100),
("GBA Light Sensor", 0), ("GBA Light Sensor", 0),
}); });
} }

View File

@ -416,10 +416,10 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
{ {
BoolButtons = 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) }.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) .AddAxis("GBA Light Sensor", 0.RangeTo(10), 0)
.MakeImmutable(); .MakeImmutable();
@ -480,7 +480,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
Keys = GetButtons(controller), Keys = GetButtons(controller),
TouchX = (byte)controller.AxisValue("Touch X"), TouchX = (byte)controller.AxisValue("Touch X"),
TouchY = (byte)controller.AxisValue("Touch Y"), 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"), GBALightSensor = (byte)controller.AxisValue("GBA Light Sensor"),
ConsiderAltLag = (byte)(_settings.ConsiderAltLag ? 1 : 0), 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(8, 18, "LidOpen") { DisplayName = "Lid Open" },
new ButtonSchema(68, 18, "LidClose") { DisplayName = "Lid Close" }, 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") new SingleAxisSchema(10, 63, "Mic Volume")
{ {