Skip to content

Manic EMU is an all-in-one retro game emulator for iOS. It packs powerful features while keeping a clean, sleek UI and delivering buttery-smooth gameplay.

Swift

Added NDS microphone support and simulated blow

Daiuno7b28cab05039
diff --git a/Cores/Libretro/audio/drivers_microphone/coreaudio_mic.m b/Cores/Libretro/audio/drivers_microphone/coreaudio_mic.m
new file mode 100644
index 00000000..d6fdecf6
--- /dev/null
+++ b/Cores/Libretro/audio/drivers_microphone/coreaudio_mic.m
@@ -0,0 +1,464 @@
+/* RetroArch - A frontend for libretro.
+ * Copyright (C) 2025 - Joseph Mattiello
+ *
+ * RetroArch is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Found-
+ * ation, either version 3 of the License, or (at your option) any later version.
+ */
+
+#import <AudioToolbox/AudioToolbox.h>
+#import <AVFoundation/AVFoundation.h>
+#include "audio/microphone_driver.h"
+#include "queues/fifo_queue.h"
+#include "verbosity.h"
+#include <memory.h>
+#include <stdatomic.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdlib.h>
+
+#include "audio/audio_driver.h"
+#include "../../verbosity.h"
+
+typedef struct coreaudio_microphone
+{
+ AudioUnit audio_unit; /// CoreAudio audio unit
+ AudioStreamBasicDescription format; /// Audio format
+ fifo_buffer_t *sample_buffer; /// Sample buffer
+ bool is_running; /// Whether the microphone is running
+ bool nonblock; /// Non-blocking mode flag
+ int sample_rate; /// Current sample rate
+ bool use_float; /// Whether to use float format
+} coreaudio_microphone_t;
+
+/// Callback for receiving audio samples
+static OSStatus coreaudio_input_callback(
+ void *inRefCon,
+ AudioUnitRenderActionFlags *ioActionFlags,
+ const AudioTimeStamp *inTimeStamp,
+ UInt32 inBusNumber,
+ UInt32 inNumberFrames,
+ AudioBufferList *ioData)
+{
+ coreaudio_microphone_t *microphone = (coreaudio_microphone_t*)inRefCon;
+ AudioBufferList bufferList;
+ OSStatus status;
+ void *tempBuffer = NULL;
+
+ /// Calculate required buffer size
+ size_t bufferSize = inNumberFrames * microphone->format.mBytesPerFrame;
+ if (bufferSize == 0) {
+ RARCH_ERR("[CoreAudio]: Invalid buffer size calculation\n");
+ return kAudio_ParamError;
+ }
+
+ /// Allocate temporary buffer
+ tempBuffer = malloc(bufferSize);
+ if (!tempBuffer) {
+ RARCH_ERR("[CoreAudio]: Failed to allocate temporary buffer\n");
+ return kAudio_MemFullError;
+ }
+
+ /// Set up buffer list
+ bufferList.mNumberBuffers = 1;
+ bufferList.mBuffers[0].mDataByteSize = (UInt32)bufferSize;
+ bufferList.mBuffers[0].mData = tempBuffer;
+
+ /// Render audio data
+ status = AudioUnitRender(microphone->audio_unit,
+ ioActionFlags,
+ inTimeStamp,
+ inBusNumber,
+ inNumberFrames,
+ &bufferList);
+
+ if (status == noErr) {
+ /// Write to FIFO buffer
+ fifo_write(microphone->sample_buffer,
+ bufferList.mBuffers[0].mData,
+ bufferList.mBuffers[0].mDataByteSize);
+ } else {
+ RARCH_ERR("[CoreAudio]: Failed to render audio: %d\n", status);
+ }
+
+ /// Clean up temporary buffer
+ free(tempBuffer);
+ return status;
+}
+
+/// Initialize CoreAudio microphone driver
+static void *coreaudio_microphone_init(void)
+{
+ /// For CoreAudio, we don't need a complex driver context
+ /// Return a non-NULL placeholder to indicate successful initialization
+ return (void*)1; /// Simple placeholder for driver context
+}
+
+/// Free CoreAudio microphone driver
+static void coreaudio_microphone_free(void *driver_context)
+{
+ /// This function frees the driver context, not individual microphones
+ /// Individual microphones are freed by coreaudio_microphone_close_mic
+ (void)driver_context; /// For CoreAudio, we don't need to track driver-specific state
+
+ /// Note: The driver context for CoreAudio is just a placeholder
+ /// The actual microphone contexts are managed separately
+}
+
+/// Read samples from microphone
+static int coreaudio_microphone_read(void *driver_context,
+ void *microphone_context,
+ void *buf,
+ size_t size)
+{
+ coreaudio_microphone_t *microphone = (coreaudio_microphone_t*)microphone_context;
+ (void)driver_context; /// Driver context not used
+ size_t avail, read_amt;
+
+ if (!microphone || !buf) {
+ RARCH_ERR("[CoreAudio]: Invalid parameters in read\n");
+ return -1;
+ }
+
+ avail = FIFO_READ_AVAIL(microphone->sample_buffer);
+ read_amt = MIN(avail, size);
+
+ if (microphone->nonblock && read_amt == 0) {
+ return 0; /// Return immediately in non-blocking mode
+ }
+
+ if (read_amt > 0) {
+ fifo_read(microphone->sample_buffer, buf, read_amt);
+#if DEBUG
+ RARCH_LOG("[CoreAudio]: Read %zu bytes from microphone\n", read_amt);
+#endif
+ }
+
+ return (int)read_amt;
+}
+
+/// Set non-blocking state
+static void coreaudio_microphone_set_nonblock_state(void *driver_context, bool state)
+{
+ /// This method sets non-blocking state for all microphones created by this driver
+ /// For CoreAudio implementation, we don't maintain driver-level state
+ /// Non-blocking behavior is handled per-microphone
+ (void)driver_context;
+ (void)state;
+
+ /// Note: Individual microphone non-blocking state should be set via
+ /// individual microphone context, not driver context
+}
+
+/// Helper method to set audio format
+static void coreaudio_microphone_set_format(coreaudio_microphone_t *microphone, bool use_float)
+{
+ microphone->use_float = use_float; /// Store the format choice
+ microphone->format.mSampleRate = microphone->sample_rate;
+ microphone->format.mFormatID = kAudioFormatLinearPCM;
+ microphone->format.mFormatFlags = use_float ?
+ (kAudioFormatFlagIsFloat | kAudioFormatFlagIsPacked) :
+ (kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked);
+ microphone->format.mFramesPerPacket = 1;
+ microphone->format.mChannelsPerFrame = 1;
+ microphone->format.mBitsPerChannel = use_float ? 32 : 16;
+ microphone->format.mBytesPerFrame = microphone->format.mChannelsPerFrame * microphone->format.mBitsPerChannel / 8;
+ microphone->format.mBytesPerPacket = microphone->format.mBytesPerFrame * microphone->format.mFramesPerPacket;
+
+ RARCH_LOG("[CoreAudio] Format setup: sample_rate=%d, bits=%d, bytes_per_frame=%d\n",
+ (int)microphone->format.mSampleRate,
+ microphone->format.mBitsPerChannel,
+ microphone->format.mBytesPerFrame);
+}
+
+/// Open microphone device
+static void *coreaudio_microphone_open_mic(void *driver_context,
+ const char *device,
+ unsigned rate,
+ unsigned latency,
+ unsigned *new_rate)
+{
+ coreaudio_microphone_t *microphone = (coreaudio_microphone_t*)calloc(1, sizeof(*microphone));
+ if (!microphone) {
+ RARCH_ERR("[CoreAudio]: Failed to allocate microphone context\n");
+ return NULL;
+ }
+
+ (void)driver_context; /// Driver context not used for this implementation
+
+ /// Initialize handle fields
+ microphone->sample_rate = rate;
+ microphone->use_float = false; /// Default to integer format
+
+ /// Validate requested sample rate
+ if (rate != 44100 && rate != 48000) {
+ RARCH_WARN("[CoreAudio]: Requested sample rate %u not supported, defaulting to 48000\n", rate);
+ rate = 48000;
+ }
+
+#if TARGET_OS_IPHONE
+ /// Configure audio session
+ AVAudioSession *audioSession = [AVAudioSession sharedInstance];
+ NSError *error = nil;
+ [audioSession setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionMixWithOthers || AVAudioSessionCategoryOptionAllowBluetoothA2DP || AVAudioSessionCategoryOptionAllowAirPlay || AVAudioSessionCategoryOptionDefaultToSpeaker error:&error];
+ if (error) {
+ RARCH_ERR("[CoreAudio]: Failed to set audio session category: %s\n", [[error localizedDescription] UTF8String]);
+ return NULL;
+ }
+
+ /// Set preferred sample rate
+ [audioSession setPreferredSampleRate:rate error:&error];
+ if (error) {
+ RARCH_ERR("[CoreAudio]: Failed to set preferred sample rate: %s\n", [[error localizedDescription] UTF8String]);
+ return NULL;
+ }
+
+ /// Get actual sample rate
+ Float64 actualRate = [audioSession sampleRate];
+ if (new_rate) {
+ *new_rate = (unsigned)actualRate;
+ }
+ microphone->sample_rate = (int)actualRate;
+
+ RARCH_LOG("[CoreAudio] Using sample rate: %d Hz\n", microphone->sample_rate);
+#else
+
+#endif
+
+ /// Set format using helper method
+ coreaudio_microphone_set_format(microphone, false); /// Default to 16-bit integer
+
+ /// Calculate FIFO buffer size
+ size_t fifoBufferSize = (latency * microphone->sample_rate * microphone->format.mBytesPerFrame) / 1000;
+ if (fifoBufferSize == 0) {
+ RARCH_WARN("[CoreAudio]: Calculated FIFO buffer size is 0 for latency: %u, sample_rate: %d, bytes_per_frame: %d\n",
+ latency, microphone->sample_rate, microphone->format.mBytesPerFrame);
+ fifoBufferSize = 1024; /// Default to a reasonable buffer size
+ }
+
+ RARCH_LOG("[CoreAudio] FIFO buffer size: %zu bytes\n", fifoBufferSize);
+
+ /// Create sample buffer
+ microphone->sample_buffer = fifo_new(fifoBufferSize);
+ if (!microphone->sample_buffer) {
+ RARCH_ERR("[CoreAudio]: Failed to create sample buffer\n");
+ return NULL;
+ }
+
+ /// Initialize audio unit
+ AudioComponentDescription desc = {
+ .componentType = kAudioUnitType_Output,
+#if TARGET_OS_IPHONE
+ .componentSubType = kAudioUnitSubType_RemoteIO,
+#else
+ .componentSubType = kAudioUnitSubType_HALOutput,
+#endif
+ .componentManufacturer = kAudioUnitManufacturer_Apple,
+ .componentFlags = 0,
+ .componentFlagsMask = 0
+ };
+
+ AudioComponent comp = AudioComponentFindNext(NULL, &desc);
+ OSStatus status = AudioComponentInstanceNew(comp, &microphone->audio_unit);
+ if (status != noErr) {
+ RARCH_ERR("[CoreAudio]: Failed to create audio unit\n");
+ goto error;
+ }
+
+ /// Enable input
+ UInt32 flag = 1;
+ status = AudioUnitSetProperty(microphone->audio_unit,
+ kAudioOutputUnitProperty_EnableIO,
+ kAudioUnitScope_Input,
+ 1, // Input bus
+ &flag,
+ sizeof(flag));
+ if (status != noErr) {
+ RARCH_ERR("[CoreAudio]: Failed to enable input\n");
+ goto error;
+ }
+
+ /// Set format using helper method
+ coreaudio_microphone_set_format(microphone, false); /// Default to 16-bit integer
+ status = AudioUnitSetProperty(microphone->audio_unit,
+ kAudioUnitProperty_StreamFormat,
+ kAudioUnitScope_Output,
+ 1, // Input bus
+ &microphone->format,
+ sizeof(microphone->format));
+ if (status != noErr) {
+ RARCH_ERR("[CoreAudio]: Failed to set format: %d\n", status);
+ goto error;
+ }
+
+ /// Set callback
+ AURenderCallbackStruct callback = { coreaudio_input_callback, microphone };
+ status = AudioUnitSetProperty(microphone->audio_unit,
+ kAudioOutputUnitProperty_SetInputCallback,
+ kAudioUnitScope_Global,
+ 1, // Input bus
+ &callback,
+ sizeof(callback));
+ if (status != noErr) {
+ RARCH_ERR("[CoreAudio]: Failed to set callback\n");
+ goto error;
+ }
+
+ /// Initialize audio unit
+ status = AudioUnitInitialize(microphone->audio_unit);
+ if (status != noErr) {
+ RARCH_ERR("[CoreAudio]: Failed to initialize audio unit: %d\n", status);
+ goto error;
+ }
+
+ /// Start audio unit
+ status = AudioOutputUnitStart(microphone->audio_unit);
+ if (status != noErr) {
+ RARCH_ERR("[CoreAudio]: Failed to start audio unit: %d\n", status);
+ goto error;
+ }
+
+ return microphone;
+
+error:
+ if (microphone) {
+ if (microphone->audio_unit) {
+ AudioComponentInstanceDispose(microphone->audio_unit);
+ microphone->audio_unit = nil;
+ }
+ if (microphone->sample_buffer) {
+ fifo_free(microphone->sample_buffer);
+ microphone->sample_buffer = NULL;
+ }
+ free(microphone);
+ }
+ return NULL;
+}
+
+/// Close microphone
+static void coreaudio_microphone_close_mic(void *driver_context, void *microphone_context)
+{
+ coreaudio_microphone_t *microphone = (coreaudio_microphone_t*)microphone_context;
+ if (microphone) {
+ if (microphone->is_running)
+ AudioOutputUnitStop(microphone->audio_unit);
+
+ if(microphone->audio_unit) {
+ AudioComponentInstanceDispose(microphone->audio_unit);
+ microphone->audio_unit = nil;
+ }
+ if (microphone->sample_buffer)
+ fifo_free(microphone->sample_buffer);
+ free(microphone);
+ } else {
+ RARCH_ERR("[CoreAudio]: Failed to close microphone\n");
+ }
+
+ AVAudioSessionCategoryOptions options = AVAudioSessionCategoryOptionMixWithOthers |
+ AVAudioSessionCategoryOptionAllowBluetoothA2DP |
+ AVAudioSessionCategoryOptionAllowAirPlay;
+ settings_t *settings = config_get_ptr();
+ if (settings) {
+ if (settings->bools.audio_respect_silent_mode) {
+ [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient withOptions:options error:nil];
+ } else {
+ [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback withOptions:options error:nil];
+ }
+ } else {
+ [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient withOptions:options error:nil];
+ }
+}
+
+/// Start microphone
+static bool coreaudio_microphone_start_mic(void *driver_context, void *microphone_context)
+{
+ RARCH_LOG("[CoreAudio]: Starting microphone\n");
+ coreaudio_microphone_t *microphone = (coreaudio_microphone_t*)microphone_context;
+ if (!microphone) {
+ RARCH_ERR("[CoreAudio]: Failed to start microphone\n");
+ return false;
+ }
+ RARCH_LOG("[CoreAudio]: Starting audio unit\n");
+
+ OSStatus status = AudioOutputUnitStart(microphone->audio_unit);
+ if (status == noErr) {
+ RARCH_LOG("[CoreAudio]: Audio unit started successfully\n");
+ microphone->is_running = true;
+ return true;
+ } else {
+ RARCH_ERR("[CoreAudio]: Failed to start microphone: %d\n", status);
+ }
+ return false;
+}
+
+/// Stop microphone
+static bool coreaudio_microphone_stop_mic(void *driver_context, void *microphone_context)
+{
+ coreaudio_microphone_t *microphone = (coreaudio_microphone_t*)microphone_context;
+ if (!microphone) {
+ RARCH_ERR("[CoreAudio]: Failed to stop microphone\n");
+ return false;
+ }
+
+ if (microphone->is_running) {
+ OSStatus status = AudioOutputUnitStop(microphone->audio_unit);
+ if (status == noErr) {
+ microphone->is_running = false;
+ return true;
+ } else {
+ RARCH_ERR("[CoreAudio]: Failed to stop microphone: %d\n", status);
+ }
+ }
+ return true; /// Already stopped
+}
+
+/// Check if microphone is alive
+static bool coreaudio_microphone_mic_alive(const void *driver_context, const void *microphone_context)
+{
+ coreaudio_microphone_t *microphone = (coreaudio_microphone_t*)microphone_context;
+ (void)driver_context;
+
+ return microphone && microphone->is_running;
+}
+
+/// Check if microphone uses float samples
+static bool coreaudio_microphone_mic_use_float(const void *driver_context, const void *microphone_context)
+{
+ coreaudio_microphone_t *microphone = (coreaudio_microphone_t*)microphone_context;
+ (void)driver_context;
+
+ return microphone && microphone->use_float;
+}
+
+/// Get device list (not implemented for CoreAudio)
+static struct string_list *coreaudio_microphone_device_list_new(const void *driver_context)
+{
+ (void)driver_context;
+ return NULL;
+}
+
+/// Free device list (not implemented for CoreAudio)
+static void coreaudio_microphone_device_list_free(const void *driver_context, struct string_list *devices)
+{
+ (void)driver_context;
+ (void)devices;
+}
+
+
+/// CoreAudio microphone driver structure
+microphone_driver_t microphone_coreaudio = {
+ coreaudio_microphone_init,
+ coreaudio_microphone_free,
+ coreaudio_microphone_read,
+ coreaudio_microphone_set_nonblock_state,
+ "coreaudio",
+ coreaudio_microphone_device_list_new,
+ coreaudio_microphone_device_list_free,
+ coreaudio_microphone_open_mic,
+ coreaudio_microphone_close_mic,
+ coreaudio_microphone_mic_alive,
+ coreaudio_microphone_start_mic,
+ coreaudio_microphone_stop_mic,
+ coreaudio_microphone_mic_use_float
+};
diff --git a/Cores/Libretro/audio/microphone_driver.c b/Cores/Libretro/audio/microphone_driver.c
index f3f7dc3d..9e275f6f 100644
--- a/Cores/Libretro/audio/microphone_driver.c
+++ b/Cores/Libretro/audio/microphone_driver.c
@@ -60,6 +60,9 @@ microphone_driver_t *microphone_drivers[] = {
#endif
#ifdef HAVE_PIPEWIRE
&microphone_pipewire,
+#endif
+#if defined(HAVE_COREAUDIO) && defined(HAVE_MICROPHONE)
+ &microphone_coreaudio,
#endif
&microphone_null,
NULL,
diff --git a/Cores/Libretro/audio/microphone_driver.h b/Cores/Libretro/audio/microphone_driver.h
index 3997911b..d626b83d 100644
--- a/Cores/Libretro/audio/microphone_driver.h
+++ b/Cores/Libretro/audio/microphone_driver.h
@@ -646,6 +646,11 @@ extern microphone_driver_t microphone_wasapi;
*/
extern microphone_driver_t microphone_pipewire;
+/**
+ * The CoreAudio-backed microphone driver.
+ */
+extern microphone_driver_t microphone_coreaudio;
+
/**
* @return Pointer to the global microphone driver state.
*/
diff --git a/Cores/Libretro/griffin/griffin_objc.m b/Cores/Libretro/griffin/griffin_objc.m
index 5afa82f2..6ff8ac02 100644
--- a/Cores/Libretro/griffin/griffin_objc.m
+++ b/Cores/Libretro/griffin/griffin_objc.m
@@ -62,6 +62,10 @@
#include "../audio/drivers/coreaudio3.m"
#endif
+#if defined(HAVE_COREAUDIO) && defined(HAVE_MICROPHONE)
+#include "../audio/drivers_microphone/coreaudio_mic.m"
+#endif
+
#ifdef HAVE_CORELOCATION
#include "../location/drivers/corelocation.m"
#endif
diff --git a/ManicEmu/Libretro/LibretroConfig.xcconfig b/ManicEmu/Libretro/LibretroConfig.xcconfig
index c25d8a57..c443c668 100644
--- a/ManicEmu/Libretro/LibretroConfig.xcconfig
+++ b/ManicEmu/Libretro/LibretroConfig.xcconfig
@@ -21,6 +21,7 @@ OTHER_CFLAGS = $(inherited) -DHAVE_CHEEVOS
OTHER_CFLAGS = $(inherited) -DHAVE_COCOA_METAL
OTHER_CFLAGS = $(inherited) -DHAVE_CONFIGFILE
OTHER_CFLAGS = $(inherited) -DHAVE_COREAUDIO
+OTHER_CFLAGS = $(inherited) -DHAVE_MICROPHONE
//OTHER_CFLAGS = $(inherited) -DHAVE_CORELOCATION
OTHER_CFLAGS = $(inherited) -DHAVE_DR_FLAC
OTHER_CFLAGS = $(inherited) -DHAVE_DR_MP3
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Symbols/custom.microphone.symbolset/Contents.json b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Symbols/custom.microphone.symbolset/Contents.json
new file mode 100644
index 00000000..a0255598
--- /dev/null
+++ b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Symbols/custom.microphone.symbolset/Contents.json
@@ -0,0 +1,12 @@
+{
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ },
+ "symbols" : [
+ {
+ "filename" : "custom.microphone.svg",
+ "idiom" : "universal"
+ }
+ ]
+}
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Symbols/custom.microphone.symbolset/custom.microphone.svg b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Symbols/custom.microphone.symbolset/custom.microphone.svg
new file mode 100644
index 00000000..01dd2843
--- /dev/null
+++ b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Symbols/custom.microphone.symbolset/custom.microphone.svg
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--Generator: Apple Native CoreSVG 341-->
+<!DOCTYPE svg
+PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 3300 2200">
+ <!--glyph: "", point size: 100.0, font version: "20.0d10e1", template writer version: "138.0.0"-->
+ <style>.monochrome-0 {-sfsymbols-motion-group:0;-sfsymbols-layer-tags:1c77314db3254c4d microphone}
+
+.multicolor-0:systemOrangeColor {-sfsymbols-motion-group:0;-sfsymbols-layer-tags:1c77314db3254c4d microphone}
+
+.hierarchical-0:primary {-sfsymbols-motion-group:0;-sfsymbols-layer-tags:1c77314db3254c4d microphone}
+
+.SFSymbolsPreviewWireframe {fill:none;opacity:1.0;stroke:black;stroke-width:0.5}
+</style>
+ <g id="Notes">
+ <rect height="2200" id="artboard" style="fill:white;opacity:1" width="3300" x="0" y="0"/>
+ <line style="fill:none;stroke:black;opacity:1;stroke-width:0.5;" x1="263" x2="3036" y1="292" y2="292"/>
+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;font-weight:bold;" transform="matrix(1 0 0 1 263 322)">Weight/Scale Variations</text>
+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;text-anchor:middle;" transform="matrix(1 0 0 1 559.711 322)">Ultralight</text>
+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;text-anchor:middle;" transform="matrix(1 0 0 1 856.422 322)">Thin</text>
+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;text-anchor:middle;" transform="matrix(1 0 0 1 1153.13 322)">Light</text>
+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;text-anchor:middle;" transform="matrix(1 0 0 1 1449.84 322)">Regular</text>
+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;text-anchor:middle;" transform="matrix(1 0 0 1 1746.56 322)">Medium</text>
+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;text-anchor:middle;" transform="matrix(1 0 0 1 2043.27 322)">Semibold</text>
+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;text-anchor:middle;" transform="matrix(1 0 0 1 2339.98 322)">Bold</text>
+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;text-anchor:middle;" transform="matrix(1 0 0 1 2636.69 322)">Heavy</text>
+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;text-anchor:middle;" transform="matrix(1 0 0 1 2933.4 322)">Black</text>
+ <line style="fill:none;stroke:black;opacity:1;stroke-width:0.5;" x1="263" x2="3036" y1="1903" y2="1903"/>
+ <g transform="matrix(0.2 0 0 0.2 263 1933)">
+ <path d="m46.2402 4.15039c21.7773 0 39.4531-17.627 39.4531-39.4043s-17.6758-39.4043-39.4531-39.4043c-21.7285 0-39.4043 17.627-39.4043 39.4043s17.6758 39.4043 39.4043 39.4043Zm0-7.42188c-17.6758 0-31.9336-14.3066-31.9336-31.9824s14.2578-31.9824 31.9336-31.9824 31.9824 14.3066 31.9824 31.9824-14.3066 31.9824-31.9824 31.9824Zm-17.9688-31.9824c0 2.14844 1.51367 3.61328 3.75977 3.61328h10.498v10.5957c0 2.19727 1.46484 3.71094 3.61328 3.71094 2.24609 0 3.71094-1.51367 3.71094-3.71094v-10.5957h10.5957c2.19727 0 3.71094-1.46484 3.71094-3.61328 0-2.19727-1.51367-3.71094-3.71094-3.71094h-10.5957v-10.5469c0-2.24609-1.46484-3.75977-3.71094-3.75977-2.14844 0-3.61328 1.51367-3.61328 3.75977v10.5469h-10.498c-2.24609 0-3.75977 1.51367-3.75977 3.71094Z"/>
+ </g>
+ <g transform="matrix(0.2 0 0 0.2 281.506 1933)">
+ <path d="m58.5449 14.5508c27.4902 0 49.8047-22.3145 49.8047-49.8047s-22.3145-49.8047-49.8047-49.8047-49.8047 22.3145-49.8047 49.8047 22.3145 49.8047 49.8047 49.8047Zm0-8.30078c-22.9492 0-41.5039-18.5547-41.5039-41.5039s18.5547-41.5039 41.5039-41.5039 41.5039 18.5547 41.5039 41.5039-18.5547 41.5039-41.5039 41.5039Zm-22.6562-41.5039c0 2.39258 1.66016 4.00391 4.15039 4.00391h14.3555v14.4043c0 2.44141 1.66016 4.15039 4.05273 4.15039 2.44141 0 4.15039-1.66016 4.15039-4.15039v-14.4043h14.4043c2.44141 0 4.15039-1.61133 4.15039-4.00391 0-2.44141-1.70898-4.15039-4.15039-4.15039h-14.4043v-14.3555c0-2.49023-1.70898-4.19922-4.15039-4.19922-2.39258 0-4.05273 1.70898-4.05273 4.19922v14.3555h-14.3555c-2.49023 0-4.15039 1.70898-4.15039 4.15039Z"/>
+ </g>
+ <g transform="matrix(0.2 0 0 0.2 304.924 1933)">
+ <path d="m74.8535 28.3203c35.1074 0 63.623-28.4668 63.623-63.5742s-28.5156-63.623-63.623-63.623-63.5742 28.5156-63.5742 63.623 28.4668 63.5742 63.5742 63.5742Zm0-9.08203c-30.127 0-54.4922-24.3652-54.4922-54.4922s24.3652-54.4922 54.4922-54.4922 54.4922 24.3652 54.4922 54.4922-24.3652 54.4922-54.4922 54.4922Zm-28.8574-54.4922c0 2.58789 1.85547 4.39453 4.58984 4.39453h19.7266v19.7754c0 2.68555 1.85547 4.58984 4.44336 4.58984 2.68555 0 4.54102-1.85547 4.54102-4.58984v-19.7754h19.7754c2.68555 0 4.58984-1.80664 4.58984-4.39453 0-2.73438-1.85547-4.58984-4.58984-4.58984h-19.7754v-19.7266c0-2.73438-1.85547-4.63867-4.54102-4.63867-2.58789 0-4.44336 1.9043-4.44336 4.63867v19.7266h-19.7266c-2.73438 0-4.58984 1.85547-4.58984 4.58984Z"/>
+ </g>
+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;font-weight:bold;" transform="matrix(1 0 0 1 263 1953)">Design Variations</text>
+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;" transform="matrix(1 0 0 1 263 1971)">Symbols are supported in up to nine weights and three scales.</text>
+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;" transform="matrix(1 0 0 1 263 1989)">For optimal layout with text and other symbols, vertically align</text>
+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;" transform="matrix(1 0 0 1 263 2007)">symbols with the adjacent text.</text>
+ <line style="fill:none;stroke:#00AEEF;stroke-width:0.5;opacity:1.0;" x1="776" x2="776" y1="1919" y2="1933"/>
+ <g transform="matrix(0.2 0 0 0.2 776 1933)">
+ <path d="m16.5527 0.78125c2.58789 0 3.85742-0.976562 4.78516-3.71094l6.29883-17.2363h28.8086l6.29883 17.2363c0.927734 2.73438 2.19727 3.71094 4.73633 3.71094 2.58789 0 4.24805-1.5625 4.24805-4.00391 0-0.830078-0.146484-1.61133-0.537109-2.63672l-22.9004-60.9863c-1.12305-2.97852-3.125-4.49219-6.25-4.49219-3.02734 0-5.07812 1.46484-6.15234 4.44336l-22.9004 61.084c-0.390625 1.02539-0.537109 1.80664-0.537109 2.63672 0 2.44141 1.5625 3.95508 4.10156 3.95508Zm13.4766-28.3691 11.8652-32.8613h0.244141l11.8652 32.8613Z"/>
+ </g>
+ <line style="fill:none;stroke:#00AEEF;stroke-width:0.5;opacity:1.0;" x1="792.836" x2="792.836" y1="1919" y2="1933"/>
+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;font-weight:bold;" transform="matrix(1 0 0 1 776 1953)">Margins</text>
+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;" transform="matrix(1 0 0 1 776 1971)">Leading and trailing margins on the left and right side of each symbol</text>
+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;" transform="matrix(1 0 0 1 776 1989)">can be adjusted by modifying the x-location of the margin guidelines.</text>
+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;" transform="matrix(1 0 0 1 776 2007)">Modifications are automatically applied proportionally to all</text>
+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;" transform="matrix(1 0 0 1 776 2025)">scales and weights.</text>
+ <g transform="matrix(0.2 0 0 0.2 1289 1933)">
+ <path d="m14.209 9.32617 8.49609 8.54492c4.29688 4.3457 9.22852 4.05273 13.8672-1.07422l53.4668-58.9355-4.83398-4.88281-53.0762 58.3984c-1.75781 2.00195-3.41797 2.49023-5.76172 0.146484l-5.85938-5.81055c-2.34375-2.29492-1.80664-4.00391 0.195312-5.81055l57.373-54.0039-4.88281-4.83398-57.959 54.4434c-4.93164 4.58984-5.32227 9.47266-1.02539 13.8184Zm32.0801-90.9668c-2.09961 2.05078-2.24609 4.93164-1.07422 6.88477 1.17188 1.80664 3.4668 2.97852 6.68945 2.14844 7.32422-1.70898 14.9414-2.00195 22.0703 2.68555l-2.92969 7.27539c-1.70898 4.15039-0.830078 7.08008 1.85547 9.81445l11.4746 11.5723c2.44141 2.44141 4.49219 2.53906 7.32422 2.05078l5.32227-0.976562 3.32031 3.36914-0.195312 2.7832c-0.195312 2.49023 0.439453 4.39453 2.88086 6.78711l3.80859 3.71094c2.39258 2.39258 5.46875 2.53906 7.8125 0.195312l14.5508-14.5996c2.34375-2.34375 2.24609-5.32227-0.146484-7.71484l-3.85742-3.80859c-2.39258-2.39258-4.24805-3.17383-6.64062-2.97852l-2.88086 0.244141-3.22266-3.17383 1.2207-5.61523c0.634766-2.83203-0.146484-5.0293-3.07617-7.95898l-10.9863-10.9375c-16.6992-16.6016-38.8672-16.2109-53.3203-1.75781Zm7.4707 1.85547c12.1582-8.88672 28.6133-7.37305 39.7461 3.75977l12.1582 12.0605c1.17188 1.17188 1.36719 2.09961 1.02539 3.80859l-1.61133 7.42188 7.51953 7.42188 4.93164-0.292969c1.26953-0.0488281 1.66016 0.0488281 2.63672 1.02539l2.88086 2.88086-12.207 12.207-2.88086-2.88086c-0.976562-0.976562-1.12305-1.36719-1.07422-2.68555l0.341797-4.88281-7.4707-7.42188-7.61719 1.26953c-1.61133 0.341797-2.34375 0.195312-3.56445-0.976562l-10.0098-10.0098c-1.26953-1.17188-1.41602-2.00195-0.634766-3.85742l4.39453-10.4492c-7.8125-7.27539-17.9688-10.4004-28.125-7.42188-0.78125 0.195312-1.07422-0.439453-0.439453-0.976562Z"/>
+ </g>
+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;font-weight:bold;" transform="matrix(1 0 0 1 1289 1953)">Exporting</text>
+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;" transform="matrix(1 0 0 1 1289 1971)">Symbols should be outlined when exporting to ensure the</text>
+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;" transform="matrix(1 0 0 1 1289 1989)">design is preserved when submitting to Xcode.</text>
+ <text id="template-version" style="stroke:none;fill:black;font-family:sans-serif;font-size:13;text-anchor:end;" transform="matrix(1 0 0 1 3036 1933)">Template v.6.0</text>
+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;text-anchor:end;" transform="matrix(1 0 0 1 3036 1951)">Requires Xcode 16 or greater</text>
+ <text id="descriptive-name" style="stroke:none;fill:black;font-family:sans-serif;font-size:13;text-anchor:end;" transform="matrix(1 0 0 1 3036 1969)">Generated from custom.microphone</text>
+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;text-anchor:end;" transform="matrix(1 0 0 1 3036 1987)">Typeset at 100.0 points</text>
+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;" transform="matrix(1 0 0 1 263 726)">Small</text>
+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;" transform="matrix(1 0 0 1 263 1156)">Medium</text>
+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;" transform="matrix(1 0 0 1 263 1586)">Large</text>
+ </g>
+ <g id="Guides">
+ <g id="H-reference" style="fill:#27AAE1;stroke:none;" transform="matrix(1 0 0 1 339 696)">
+ <path d="M0.993654 0L3.63775 0L29.3281-67.1323L30.0303-67.1323L30.0303-70.459L28.1226-70.459ZM11.6885-24.4799L46.9815-24.4799L46.2315-26.7285L12.4385-26.7285ZM55.1196 0L57.7637 0L30.6382-70.459L29.4326-70.459L29.4326-67.1323Z"/>
+ </g>
+ <line id="Baseline-S" style="fill:none;stroke:#27AAE1;opacity:1;stroke-width:0.5;" x1="263" x2="3036" y1="696" y2="696"/>
+ <line id="Capline-S" style="fill:none;stroke:#27AAE1;opacity:1;stroke-width:0.5;" x1="263" x2="3036" y1="625.541" y2="625.541"/>
+ <g id="H-reference" style="fill:#27AAE1;stroke:none;" transform="matrix(1 0 0 1 339 1126)">
+ <path d="M0.993654 0L3.63775 0L29.3281-67.1323L30.0303-67.1323L30.0303-70.459L28.1226-70.459ZM11.6885-24.4799L46.9815-24.4799L46.2315-26.7285L12.4385-26.7285ZM55.1196 0L57.7637 0L30.6382-70.459L29.4326-70.459L29.4326-67.1323Z"/>
+ </g>
+ <line id="Baseline-M" style="fill:none;stroke:#27AAE1;opacity:1;stroke-width:0.5;" x1="263" x2="3036" y1="1126" y2="1126"/>
+ <line id="Capline-M" style="fill:none;stroke:#27AAE1;opacity:1;stroke-width:0.5;" x1="263" x2="3036" y1="1055.54" y2="1055.54"/>
+ <g id="H-reference" style="fill:#27AAE1;stroke:none;" transform="matrix(1 0 0 1 339 1556)">
+ <path d="M0.993654 0L3.63775 0L29.3281-67.1323L30.0303-67.1323L30.0303-70.459L28.1226-70.459ZM11.6885-24.4799L46.9815-24.4799L46.2315-26.7285L12.4385-26.7285ZM55.1196 0L57.7637 0L30.6382-70.459L29.4326-70.459L29.4326-67.1323Z"/>
+ </g>
+ <line id="Baseline-L" style="fill:none;stroke:#27AAE1;opacity:1;stroke-width:0.5;" x1="263" x2="3036" y1="1556" y2="1556"/>
+ <line id="Capline-L" style="fill:none;stroke:#27AAE1;opacity:1;stroke-width:0.5;" x1="263" x2="3036" y1="1485.54" y2="1485.54"/>
+ <line id="right-margin-Black-S" style="fill:none;stroke:#00AEEF;stroke-width:0.5;opacity:1.0;" x1="2981.25" x2="2981.25" y1="600.785" y2="720.121"/>
+ <line id="left-margin-Black-S" style="fill:none;stroke:#00AEEF;stroke-width:0.5;opacity:1.0;" x1="2885.55" x2="2885.55" y1="600.785" y2="720.121"/>
+ <line id="right-margin-Regular-S" style="fill:none;stroke:#00AEEF;stroke-width:0.5;opacity:1.0;" x1="1489.54" x2="1489.54" y1="600.785" y2="720.121"/>
+ <line id="left-margin-Regular-S" style="fill:none;stroke:#00AEEF;stroke-width:0.5;opacity:1.0;" x1="1410.15" x2="1410.15" y1="600.785" y2="720.121"/>
+ <line id="right-margin-Ultralight-S" style="fill:none;stroke:#00AEEF;stroke-width:0.5;opacity:1.0;" x1="595.48" x2="595.48" y1="600.785" y2="720.121"/>
+ <line id="left-margin-Ultralight-S" style="fill:none;stroke:#00AEEF;stroke-width:0.5;opacity:1.0;" x1="523.942" x2="523.942" y1="600.785" y2="720.121"/>
+ </g>
+ <g id="Symbols">
+ <g id="Black-S" transform="matrix(1 0 0 1 2885.55 696)">
+ <path class="monochrome-0 multicolor-0:systemOrangeColor hierarchical-0:primary SFSymbolsPreviewWireframe" d="M10.3516-39.4531C10.3516-20.0195 23.7305-7.8125 41.3086-5.41992L41.3086-2.73438L27.9785-2.73438C24.1211-2.73438 20.7031 0.390625 20.7031 4.24805C20.7031 8.00781 24.1211 11.2305 27.9785 11.2305L67.7246 11.2305C71.582 11.2305 75 8.00781 75 4.24805C75 0.390625 71.582-2.73438 67.7246-2.73438L54.3945-2.73438L54.3945-5.41992C71.9727-7.8125 85.3516-20.0195 85.3516-39.4531L85.3516-46.0938C85.3516-49.9023 82.1289-52.832 78.2227-52.832C74.3164-52.832 70.9961-49.9023 70.9961-46.0938L70.9961-39.8438C70.9961-26.8555 60.6445-18.6523 47.8516-18.6523C35.0586-18.6523 24.707-26.8555 24.707-39.8438L24.707-46.0938C24.707-49.9023 21.3867-52.832 17.4805-52.832C13.5742-52.832 10.3516-49.9023 10.3516-46.0938ZM29.6875-42.6758C29.6875-31.543 37.5-23.8281 47.8516-23.8281C58.2031-23.8281 66.0156-31.543 66.0156-42.6758L66.0156-65.4297C66.0156-76.4648 58.2031-84.2773 47.8516-84.2773C37.5-84.2773 29.6875-76.4648 29.6875-65.4297ZM44.2383-41.9434L44.2383-66.1621C44.2383-68.457 45.2637-71.0938 47.8516-71.0938C50.4395-71.0938 51.4648-68.5059 51.4648-66.1621L51.4648-41.9434C51.4648-39.5996 50.4395-37.0117 47.8516-37.0117C45.2637-37.0117 44.2383-39.5996 44.2383-41.9434Z"/>
+ </g>
+ <g id="Regular-S" transform="matrix(1 0 0 1 1410.15 696)">
+ <path class="monochrome-0 multicolor-0:systemOrangeColor hierarchical-0:primary SFSymbolsPreviewWireframe" d="M11.6699-38.5254C11.6699-23.1934 21.7285-12.5 36.377-11.084L36.377-3.125L22.6074-3.125C20.752-3.125 19.2871-1.66016 19.2871 0.146484C19.2871 2.00195 20.752 3.4668 22.6074 3.4668L56.7871 3.4668C58.5938 3.4668 60.0586 2.00195 60.0586 0.146484C60.0586-1.66016 58.5938-3.125 56.7871-3.125L42.9688-3.125L42.9688-11.084C57.666-12.5 67.7246-23.1934 67.7246-38.5254L67.7246-46.4355C67.7246-48.291 66.2598-49.7559 64.4043-49.7559C62.5977-49.7559 61.1328-48.291 61.1328-46.4355L61.1328-38.8184C61.1328-25.6836 52.6855-17.041 39.6973-17.041C26.709-17.041 18.2617-25.6836 18.2617-38.8184L18.2617-46.4355C18.2617-48.291 16.7969-49.7559 14.9414-49.7559C13.1348-49.7559 11.6699-48.291 11.6699-46.4355ZM25.293-39.8438C25.293-30.6641 31.2012-24.3652 39.6973-24.3652C48.1445-24.3652 54.1016-30.6641 54.1016-39.8438L54.1016-63.5742C54.1016-72.7539 48.1445-79.0527 39.6973-79.0527C31.2012-79.0527 25.293-72.7539 25.293-63.5742ZM31.8848-39.8438L31.8848-63.5742C31.8848-69.1895 35.0098-72.5586 39.6973-72.5586C44.3359-72.5586 47.5098-69.1895 47.5098-63.5742L47.5098-39.8438C47.5098-34.2285 44.3359-30.8594 39.6973-30.8594C35.0098-30.8594 31.8848-34.2285 31.8848-39.8438Z"/>
+ </g>
+ <g id="Ultralight-S" transform="matrix(1 0 0 1 523.942 696)">
+ <path class="monochrome-0 multicolor-0:systemOrangeColor hierarchical-0:primary SFSymbolsPreviewWireframe" d="M11.2612-38.1167C11.2612-24.6919 20.457-14.9521 34.6514-14.4897L34.6514-1.35402L18.6568-1.35402C18.0728-1.35402 17.5615-0.88819 17.5615-0.262204C17.5615 0.321791 18.0728 0.833029 18.6568 0.833029L52.8365 0.833029C53.4624 0.833029 53.9283 0.321791 53.9283-0.262204C53.9283-0.88819 53.4624-1.35402 52.8365-1.35402L36.8384-1.35402L36.8384-14.4897C51.0816-14.9521 60.2774-24.6919 60.2774-38.1167L60.2774-45.1187C60.2774-45.7481 59.7662-46.2139 59.1822-46.2139C58.5562-46.2139 58.0904-45.7481 58.0904-45.1187L58.0904-38.1372C58.0904-25.5928 49.3706-16.6323 35.7466-16.6323C22.168-16.6323 13.4483-25.5928 13.4483-38.1372L13.4483-45.1187C13.4483-45.7481 12.937-46.2139 12.353-46.2139C11.7725-46.2139 11.2612-45.7481 11.2612-45.1187ZM24.0215-39.8438C24.0215-32.5713 28.5674-26.999 35.7466-26.999C42.9678-26.999 47.5171-32.5713 47.5171-39.8438L47.5171-65.3452C47.5171-72.6177 42.9678-78.1899 35.7466-78.1899C28.5674-78.1899 24.0215-72.6177 24.0215-65.3452ZM26.1631-39.8438L26.1631-65.3452C26.1631-71.3691 29.833-76.1006 35.7466-76.1006C41.7022-76.1006 45.3301-71.3691 45.3301-65.3452L45.3301-39.8438C45.3301-33.8198 41.7022-29.0884 35.7466-29.0884C29.833-29.0884 26.1631-33.8198 26.1631-39.8438Z"/>
+ </g>
+ </g>
+</svg>
diff --git a/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings
index f59c23f8..241a8c55 100644
--- a/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings
@@ -721,3 +721,5 @@ Press the controller button to complete mapping...";
"ThreeDSNandImportFailed" = "Incorrect nand.zip imported!";
"HoldFastForward" = "Hold %@ FF";
"HoldMaxFastForward" = "Hold Max FF";
+"Microphone" = "Microphone";
+"MicrophoneTips" = "Enabling the microphone will request access and keep it active during gameplay, which may stop music playback from other apps in the background.";
diff --git a/ManicEmu/ManicEmu/Sources/Business/Common/Models/ExtraKey.swift b/ManicEmu/ManicEmu/Sources/Business/Common/Models/ExtraKey.swift
index 79080f73..08cf719b 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Common/Models/ExtraKey.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Common/Models/ExtraKey.swift
@@ -30,4 +30,5 @@ enum ExtraKey: String {
case pspRenderer
case globalAchievements
case globalHardcore
+ case microphone
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoDetailReusableView.swift b/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoDetailReusableView.swift
index eca0f3db..48183bb1 100644
--- a/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoDetailReusableView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoDetailReusableView.swift
@@ -683,6 +683,42 @@ class GameInfoDetailReusableView: UICollectionReusableView {
return view
}()
+ private lazy var microphoneContextMenuButton: ContextMenuButton = {
+ var actions: [UIMenuElement] = []
+ actions.append((UIAction(title: R.string.localizable.on()) { [weak self] _ in
+ guard let self = self else { return }
+ self.microphoneButton.titleLabel.text = R.string.localizable.microphone() + " " + R.string.localizable.on()
+ if let game {
+ game.updateExtra(key: ExtraKey.microphone.rawValue, value: true)
+ }
+ }))
+ actions.append(UIAction(title: R.string.localizable.off()) { [weak self] _ in
+ guard let self = self else { return }
+ self.microphoneButton.titleLabel.text = R.string.localizable.microphone() + " " + R.string.localizable.off()
+ if let game {
+ game.updateExtra(key: ExtraKey.microphone.rawValue, value: false)
+ }
+ })
+ let view = ContextMenuButton(image: nil, menu: UIMenu(title: R.string.localizable.microphoneTips(), children: actions))
+ return view
+ }()
+
+ private lazy var microphoneButton: SymbolButton = {
+ let title: String
+ if game?.getExtraBool(key: ExtraKey.microphone.rawValue) ?? false {
+ title = R.string.localizable.microphone() + " " + R.string.localizable.on()
+ } else {
+ title = R.string.localizable.microphone() + " " + R.string.localizable.off()
+ }
+ let view = SymbolButton(image: R.image.customMicrophone()?.applySymbolConfig(color: Constants.Color.LabelPrimary), title: title, horizontalContian: true)
+ view.titleLabel.numberOfLines = 0
+ view.addTapGesture { [weak self] gesture in
+ guard let self = self else { return }
+ self.microphoneContextMenuButton.triggerTapGesture()
+ }
+ return view
+ }()
+
private lazy var psxModeContextMenuButton: ContextMenuButton = {
var actions: [UIMenuElement] = []
actions.append(UIAction(title: Constants.Strings.PSXController) { [weak self] _ in
@@ -1232,6 +1268,8 @@ class GameInfoDetailReusableView: UICollectionReusableView {
private func updateDSFunctionButton() {
languageContextMenuButton.removeFromSuperview()
languageButton.removeFromSuperview()
+ microphoneContextMenuButton.removeFromSuperview()
+ microphoneButton.removeFromSuperview()
ndsSystemTypeContextMenuButton.removeFromSuperview()
ndsSystemTypeButton.removeFromSuperview()
gbaSlotContextMenuButton.removeFromSuperview()
@@ -1249,6 +1287,18 @@ class GameInfoDetailReusableView: UICollectionReusableView {
make.edges.equalTo(languageButton)
}
+ //麦克风
+ functionButtonContainerView.addSubview(microphoneContextMenuButton)
+ functionButtonContainerView.addSubview(microphoneButton)
+ microphoneButton.snp.makeConstraints { make in
+ make.leading.equalTo(languageButton.snp.trailing).offset(Constants.Size.ContentSpaceMin)
+ make.centerY.equalToSuperview()
+ make.size.equalTo(Constants.Size.IconSizeHuge)
+ }
+ microphoneContextMenuButton.snp.makeConstraints { make in
+ make.edges.equalTo(microphoneButton)
+ }
+
var enableGBASlot = true
if let game, let mode = game.getExtraString(key: ExtraKey.ndsSystemMode.rawValue), mode == "DSi" {
enableGBASlot = false
@@ -1258,7 +1308,7 @@ class GameInfoDetailReusableView: UICollectionReusableView {
functionButtonContainerView.addSubview(ndsSystemTypeContextMenuButton)
functionButtonContainerView.addSubview(ndsSystemTypeButton)
ndsSystemTypeButton.snp.makeConstraints { make in
- make.leading.equalTo(languageButton.snp.trailing).offset(Constants.Size.ContentSpaceMin)
+ make.leading.equalTo(microphoneButton.snp.trailing).offset(Constants.Size.ContentSpaceMin)
make.centerY.equalToSuperview()
make.size.equalTo(Constants.Size.IconSizeHuge)
if !enableGBASlot {
diff --git a/ManicEmu/ManicEmu/Sources/Business/Play/Models/GameSetting.swift b/ManicEmu/ManicEmu/Sources/Business/Play/Models/GameSetting.swift
index 9c3413d3..0b388ffe 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Play/Models/GameSetting.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Play/Models/GameSetting.swift
@@ -652,7 +652,7 @@ struct GameSetting: SettingCellItem {
}
return true
case .ds:
- if type == .resolution || type == .consoleHome || type == .amiibo || type == .simBlowing || type == .palette || type == .swapDisk {
+ if type == .resolution || type == .consoleHome || type == .amiibo || type == .palette || type == .swapDisk {
return false
}
return true
diff --git a/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift b/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift
index c7f096f5..2f1df790 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift
@@ -1594,10 +1594,20 @@ extension PlayViewController {
case .simBlowing:
//MARK: handleMenuGameSetting.simBlowing
- guard manicGame.gameType == ._3ds else { return false }
- threeDSCore?.setSimBlowing(start: true)
- DispatchQueue.main.asyncAfter(delay: 5) { [weak self] in
- self?.threeDSCore?.setSimBlowing(start: false)
+ if manicGame.gameType == ._3ds {
+ threeDSCore?.setSimBlowing(start: true)
+ DispatchQueue.main.asyncAfter(delay: 5) { [weak self] in
+ self?.threeDSCore?.setSimBlowing(start: false)
+ }
+ } else if manicGame.gameType == .ds {
+ LibretroCore.sharedInstance().updateRunningCoreConfigs(["melonds_mic_input": "blow"], flush: false)
+ DispatchQueue.main.asyncAfter(delay: 5) { [weak self] in
+ var restoreInput = "silence"
+ if self?.manicGame.getExtraBool(key: ExtraKey.microphone.rawValue) ?? false {
+ restoreInput = "microphone"
+ }
+ LibretroCore.sharedInstance().updateRunningCoreConfigs(["melonds_mic_input": restoreInput], flush: false)
+ }
}
case .palette:
@@ -1924,15 +1934,20 @@ extension PlayViewController {
systemType = "ds"
}
- //wfc
+ //麦克风
+ let microphone = manicGame.getExtraBool(key: ExtraKey.microphone.rawValue) ?? false
+
+ //设置配置
LibretroCore.sharedInstance().updateConfig(LibretroCore.Cores.melonDSDS.name,
configs: ["melonds_firmware_language": dsLanguageOption,
"melonds_console_mode": systemType,
+ "melonds_mic_input": microphone ? "microphone" : "silence",
"melonds_mic_input_active": "always",
"melonds_number_of_screen_layouts": "1",
"melonds_screen_layout1": "custom",
"melonds_show_cursor": "disabled"],
reload: false)
+ //wfc
LibretroCore.sharedInstance().setNDSWFCDNS( WFC.currentDNS());
} else if manicGame.gameType == .gba {
@@ -2031,11 +2046,14 @@ extension PlayViewController {
enableLibretroLog = "true"
libretroLogLevel = "0"
#endif
+ let enableMircophone = manicGame.gameType == .ds && (manicGame.getExtraBool(key: ExtraKey.microphone.rawValue) ?? false)
LibretroCore.sharedInstance().updateLibretroConfigs([
"fastforward_frameskip": manicGame.gameType == .ps1 ? "false" : "true",
"log_verbosity": enableLibretroLog,
"libretro_log_level": libretroLogLevel,
- "camera_driver": ((manicGame.gameType == .gb || manicGame.gameType == .gbc) && manicGame.defaultCore == 1) ? "null" : "avfoundation"
+ "camera_driver": ((manicGame.gameType == .gb || manicGame.gameType == .gbc) && manicGame.defaultCore == 1) ? "null" : "avfoundation",
+ "microphone_enable": enableMircophone ? "true" : "false",
+ "microphone_driver": "coreaudio"
])
if manicGame.isN64ParaLLEl {
LibretroCore.sharedInstance().setReloadDelay(1)