Squashed commit of the following:
commit af7cadfce4b750f8b1b23476c281bd2dfe027225 Author: CasualPokePlayer <50538166+CasualPokePlayer@users.noreply.github.com> Date: Tue Nov 2 22:43:21 2021 -0700 right, rename these too commit e27197d18ad33af53729b1a57ee4a048189c41c4 Author: CasualPokePlayer <50538166+CasualPokePlayer@users.noreply.github.com> Date: Tue Nov 2 22:40:42 2021 -0700 build commit 1af068f11f553ade70999fb2c640ee98e054aa36 Author: CasualPokePlayer <50538166+CasualPokePlayer@users.noreply.github.com> Date: Tue Nov 2 22:37:28 2021 -0700 new way to do mic input for melonds
This commit is contained in:
parent
274a137de4
commit
600ee6c913
Binary file not shown.
|
@ -47,7 +47,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
|
|||
public Buttons Keys;
|
||||
public byte TouchX;
|
||||
public byte TouchY;
|
||||
public short MicInput;
|
||||
public byte MicVolume;
|
||||
public byte GBALightSensor;
|
||||
}
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
|
|||
"Up", "Down", "Left", "Right", "Start", "Select", "B", "A", "Y", "X", "L", "R", "LidOpen", "LidClose", "Touch", "Power"
|
||||
}
|
||||
}.AddXYPair("Touch {0}", AxisPairOrientation.RightAndUp, 0.RangeTo(255), 128, 0.RangeTo(191), 96)
|
||||
.AddAxis("Mic Input", (-1).RangeTo(2047), 0)
|
||||
.AddAxis("Mic Volume", (0).RangeTo(100), 0)
|
||||
.AddAxis("GBA Light Sensor", 0.RangeTo(10), 0);
|
||||
private LibMelonDS.Buttons GetButtons(IController c)
|
||||
{
|
||||
|
@ -242,7 +242,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
|
|||
Keys = GetButtons(controller),
|
||||
TouchX = (byte)controller.AxisValue("Touch X"),
|
||||
TouchY = (byte)controller.AxisValue("Touch Y"),
|
||||
MicInput = (short)controller.AxisValue("Mic Input"),
|
||||
MicVolume = (byte)controller.AxisValue("Mic Volume"),
|
||||
GBALightSensor = (byte)controller.AxisValue("GBA Light Sensor"),
|
||||
};
|
||||
}
|
||||
|
|
|
@ -56,11 +56,10 @@ namespace BizHawk.Emulation.Cores
|
|||
new ButtonSchema(68, 18, "LidClose") { DisplayName = "Lid Close" },
|
||||
new ButtonSchema(128, 18, "Power"),
|
||||
|
||||
new SingleAxisSchema(10, 63, "Mic Input")
|
||||
new SingleAxisSchema(10, 63, "Mic Volume")
|
||||
{
|
||||
TargetSize = new Size(226, 69),
|
||||
MinValue = -1,
|
||||
MaxValue = 2047,
|
||||
MaxValue = 100,
|
||||
},
|
||||
|
||||
new SingleAxisSchema(10, 137, "GBA Light Sensor")
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "../emulibc/emulibc.h"
|
||||
#include "../emulibc/waterboxcore.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
#include <time.h>
|
||||
|
||||
|
@ -263,7 +264,7 @@ struct MyFrameInfo : public FrameInfo
|
|||
u32 Keys;
|
||||
s8 TouchX;
|
||||
s8 TouchY;
|
||||
s16 MicInput;
|
||||
s8 MicVolume;
|
||||
s8 GBALightSensor;
|
||||
};
|
||||
|
||||
|
@ -276,13 +277,13 @@ static bool ValidRange(s8 sensor)
|
|||
|
||||
static int sampPos = 0;
|
||||
|
||||
static void MicFeedNoise()
|
||||
static void MicFeedNoise(s8 vol)
|
||||
{
|
||||
int sampLen = sizeof mic_blow / sizeof mic_blow[0];
|
||||
|
||||
for (int i = 0; i < 735; i++)
|
||||
{
|
||||
biz_mic_input[i] = mic_blow[sampPos++];
|
||||
biz_mic_input[i] = std::round(mic_blow[sampPos++] * (vol / 100.0));
|
||||
if (sampPos >= sampLen) sampPos = 0;
|
||||
}
|
||||
}
|
||||
|
@ -307,10 +308,7 @@ EXPORT void FrameAdvance(MyFrameInfo* f)
|
|||
else if (f->Keys & 0x4000)
|
||||
NDS::SetLidClosed(true);
|
||||
|
||||
if (f->MicInput < 0)
|
||||
MicFeedNoise();
|
||||
else
|
||||
std::fill_n(biz_mic_input, 735, f->MicInput << 4);
|
||||
MicFeedNoise(f->MicVolume);
|
||||
|
||||
NDS::MicInputFrame(biz_mic_input, 735);
|
||||
|
||||
|
|
Loading…
Reference in New Issue