mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-24 15:01:16 +01:00
Config stuff
This commit is contained in:
parent
959e331c7e
commit
f43f3a0bfd
@ -569,6 +569,9 @@ const Info<bool> MAIN_EMULATE_INFINITY_BASE{
|
|||||||
const Info<bool> MAIN_EMULATE_WII_SPEAK{{System::Main, "EmulatedUSBDevices", "EmulateWiiSpeak"},
|
const Info<bool> MAIN_EMULATE_WII_SPEAK{{System::Main, "EmulatedUSBDevices", "EmulateWiiSpeak"},
|
||||||
false};
|
false};
|
||||||
|
|
||||||
|
const Info<std::string> MAIN_WII_SPEAK_MICROPHONE{{System::Main, "General", "WiiSpeakMicrophone"},
|
||||||
|
""};
|
||||||
|
|
||||||
// The reason we need this function is because some memory card code
|
// The reason we need this function is because some memory card code
|
||||||
// expects to get a non-NTSC-K region even if we're emulating an NTSC-K Wii.
|
// expects to get a non-NTSC-K region even if we're emulating an NTSC-K Wii.
|
||||||
DiscIO::Region ToGameCubeRegion(DiscIO::Region region)
|
DiscIO::Region ToGameCubeRegion(DiscIO::Region region)
|
||||||
|
@ -352,6 +352,7 @@ void SetUSBDeviceWhitelist(const std::set<std::pair<u16, u16>>& devices);
|
|||||||
extern const Info<bool> MAIN_EMULATE_SKYLANDER_PORTAL;
|
extern const Info<bool> MAIN_EMULATE_SKYLANDER_PORTAL;
|
||||||
extern const Info<bool> MAIN_EMULATE_INFINITY_BASE;
|
extern const Info<bool> MAIN_EMULATE_INFINITY_BASE;
|
||||||
extern const Info<bool> MAIN_EMULATE_WII_SPEAK;
|
extern const Info<bool> MAIN_EMULATE_WII_SPEAK;
|
||||||
|
extern const Info<std::string> MAIN_WII_SPEAK_MICROPHONE;
|
||||||
|
|
||||||
// GameCube path utility functions
|
// GameCube path utility functions
|
||||||
|
|
||||||
|
@ -24,8 +24,19 @@ WiiSpeak::WiiSpeak(IOS::HLE::EmulationKernel& ios, const std::string& device_nam
|
|||||||
m_endpoint_descriptor.emplace_back(EndpointDescriptor{0x7, 0x5, 0x3, 0x1, 0x0040, 1});
|
m_endpoint_descriptor.emplace_back(EndpointDescriptor{0x7, 0x5, 0x3, 0x1, 0x0040, 1});
|
||||||
|
|
||||||
m_microphone = Microphone();
|
m_microphone = Microphone();
|
||||||
m_microphone.OpenMicrophone();
|
if (m_microphone.OpenMicrophone() != 0)
|
||||||
m_microphone.StartCapture();
|
{
|
||||||
|
ERROR_LOG_FMT(IOS_USB, "Error opening the microphone.");
|
||||||
|
b_is_mic_connected = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_microphone.StartCapture() != 0)
|
||||||
|
{
|
||||||
|
ERROR_LOG_FMT(IOS_USB, "Error starting captures.");
|
||||||
|
b_is_mic_connected = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_microphone_thread = std::thread([this] {
|
m_microphone_thread = std::thread([this] {
|
||||||
u64 timeout{};
|
u64 timeout{};
|
||||||
@ -135,6 +146,9 @@ int WiiSpeak::SubmitTransfer(std::unique_ptr<CtrlMessage> cmd)
|
|||||||
m_vid, m_pid, m_active_interface, cmd->request_type, cmd->request, cmd->value,
|
m_vid, m_pid, m_active_interface, cmd->request_type, cmd->request, cmd->value,
|
||||||
cmd->index, cmd->length);
|
cmd->index, cmd->length);
|
||||||
|
|
||||||
|
if (!b_is_mic_connected)
|
||||||
|
return IPC_ENOENT;
|
||||||
|
|
||||||
switch (cmd->request_type << 8 | cmd->request)
|
switch (cmd->request_type << 8 | cmd->request)
|
||||||
{
|
{
|
||||||
case USBHDR(DIR_DEVICE2HOST, TYPE_STANDARD, REC_INTERFACE, REQUEST_GET_INTERFACE):
|
case USBHDR(DIR_DEVICE2HOST, TYPE_STANDARD, REC_INTERFACE, REQUEST_GET_INTERFACE):
|
||||||
@ -195,6 +209,9 @@ int WiiSpeak::SubmitTransfer(std::unique_ptr<IntrMessage> cmd)
|
|||||||
|
|
||||||
int WiiSpeak::SubmitTransfer(std::unique_ptr<IsoMessage> cmd)
|
int WiiSpeak::SubmitTransfer(std::unique_ptr<IsoMessage> cmd)
|
||||||
{
|
{
|
||||||
|
if (!b_is_mic_connected)
|
||||||
|
return IPC_ENOENT;
|
||||||
|
|
||||||
auto& system = m_ios.GetSystem();
|
auto& system = m_ios.GetSystem();
|
||||||
auto& memory = system.GetMemory();
|
auto& memory = system.GetMemory();
|
||||||
|
|
||||||
|
@ -83,6 +83,7 @@ private:
|
|||||||
u8 m_active_interface = 0;
|
u8 m_active_interface = 0;
|
||||||
bool m_device_attached = false;
|
bool m_device_attached = false;
|
||||||
bool init = false;
|
bool init = false;
|
||||||
|
bool b_is_mic_connected = true;
|
||||||
Microphone m_microphone;
|
Microphone m_microphone;
|
||||||
DeviceDescriptor m_device_descriptor{};
|
DeviceDescriptor m_device_descriptor{};
|
||||||
std::vector<ConfigDescriptor> m_config_descriptor;
|
std::vector<ConfigDescriptor> m_config_descriptor;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user