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

Add support for DOS

Daiuno3317dc93d111
diff --git a/Cores/DeltaCore/DeltaCore/Model/ControllerSkin.swift b/Cores/DeltaCore/DeltaCore/Model/ControllerSkin.swift
index cf241bfb..b5e44ab2 100644
--- a/Cores/DeltaCore/DeltaCore/Model/ControllerSkin.swift
+++ b/Cores/DeltaCore/DeltaCore/Model/ControllerSkin.swift
@@ -7,6 +7,7 @@
//
import UIKit
+import AudioToolbox
#if FRAMEWORK || STATIC_LIBRARY || SWIFT_PACKAGE
import ZIPFoundation
@@ -75,6 +76,8 @@ public struct ControllerSkin: ControllerSkinBase
public var isSwapScreen: Bool = false
public var isPlayCase: Bool = false
+ public var soundID: SystemSoundID? = nil
+
let archive: Archive
public init?(fileURL: URL, initGameType: GameType? = nil, supportGameTypes: [GameType]? = nil)
@@ -142,6 +145,28 @@ public struct ControllerSkin: ControllerSkinBase
return nil
}
+
+ do {
+ if let soundEntry = archive["sound.caf"] {
+ let soundData = try archive.extract(soundEntry)
+ var soundID: SystemSoundID = 0
+ let soundPath = NSTemporaryDirectory().appending("/sound.caf")
+ let soundUrl = URL(fileURLWithPath: soundPath)
+ if FileManager.default.fileExists(atPath: soundPath) {
+ try FileManager.default.removeItem(atPath: soundPath)
+ }
+ try soundData.write(to: soundUrl)
+ if FileManager.default.fileExists(atPath: soundPath) {
+ AudioServicesCreateSystemSoundID(soundUrl as CFURL, &soundID)
+ if soundID != 0 {
+ self.soundID = soundID
+ }
+ }
+ }
+ } catch {
+ print("Delta Core create sound failed: \(error)")
+ }
+
}
// Sometimes, recursion really is the best solution ¯\_(ツ)_/¯
diff --git a/Cores/DeltaCore/DeltaCore/Model/Inputs/StandardGameControllerInput.swift b/Cores/DeltaCore/DeltaCore/Model/Inputs/StandardGameControllerInput.swift
index ab3a1f10..803b0ac4 100644
--- a/Cores/DeltaCore/DeltaCore/Model/Inputs/StandardGameControllerInput.swift
+++ b/Cores/DeltaCore/DeltaCore/Model/Inputs/StandardGameControllerInput.swift
@@ -57,6 +57,8 @@ public enum StandardGameControllerInput: String, Codable
case rightDifficulty //A or B bindable
case screenScaling
case j2meSettings
+ case dosSettings
+ case insertDisc
case up
case down
diff --git a/Cores/DeltaCore/DeltaCore/UI/Controller/ControllerView.swift b/Cores/DeltaCore/DeltaCore/UI/Controller/ControllerView.swift
index 57cc49d2..126c2439 100644
--- a/Cores/DeltaCore/DeltaCore/UI/Controller/ControllerView.swift
+++ b/Cores/DeltaCore/DeltaCore/UI/Controller/ControllerView.swift
@@ -7,6 +7,7 @@
//
import UIKit
+import AudioToolbox
private struct ControllerViewInputMapping: GameControllerInputMappingBase
{
@@ -58,6 +59,11 @@ public class ControllerView: UIView, GameController
didSet {
self.updateSkin()
NotificationCenter.default.post(name: ControllerView.controllerSkinDidChangeNotification, object: self)
+ if let skin = controllerSkin as? ControllerSkin, let soundID = skin.soundID {
+ self.soundID = soundID
+ } else {
+ self.soundID = nil
+ }
}
}
@@ -176,9 +182,26 @@ public class ControllerView: UIView, GameController
private(set) var imageCache = NSCache<NSString, NSCache<NSString, UIImage>>()
- //如果允许的话 会判断按钮是否被点中,没有被点中则允许点击穿透,默认为false 设置为true可能会有性能损失
+ //If enabled, it checks whether the button is pressed. If not, it allows click-through. Default is false; setting it to true may cause performance loss.
public var allowTapThroughIfButtonNotHit = false
+ //Keyboard events allowed? Default is yes.
+ public var allowKeyboardEvents = true
+
+ public var enableSkinSoundEffects: Bool = true
+
+ //Event interception from external sources: if the closure returns true, it means the external party has intercepted; otherwise, it indicates no intention to intercept.
+ public var activateButtonInputInterception: ((SomeInput)->Bool)? = nil
+ public var deactivateButtonInputInterception: ((SomeInput)->Bool)? = nil
+
+ private var soundID: SystemSoundID? {
+ didSet {
+ if let oldValue {
+ AudioServicesDisposeSystemSoundID(oldValue)
+ }
+ }
+ }
+
public override var intrinsicContentSize: CGSize {
return buttonsView.intrinsicContentSize
}
@@ -456,6 +479,7 @@ public class ControllerView: UIView, GameController
internal override func _keyCommand(for event: UIEvent, target: UnsafeMutablePointer<UIResponder>) -> UIKeyCommand?
{
+ guard allowKeyboardEvents else { return nil }
let keyCommand = super._keyCommand(for: event, target: target)
if #available(iOS 15, *)
@@ -825,8 +849,17 @@ public class ControllerView: UIView, GameController
{
for input in inputs
{
- activate(input)
+ if let activateButtonInputInterception {
+ if !activateButtonInputInterception(input) {
+ activate(input)
+ }
+ } else {
+ activate(input)
+ }
buttonsDynamicEffectView.activateButtonEffect(input: input)
+ if let soundID, enableSkinSoundEffects {
+ AudioServicesPlaySystemSound(soundID)
+ }
}
}
@@ -834,7 +867,13 @@ public class ControllerView: UIView, GameController
{
for input in inputs
{
- deactivate(input)
+ if let deactivateButtonInputInterception {
+ if !deactivateButtonInputInterception(input) {
+ deactivate(input)
+ }
+ } else {
+ deactivate(input)
+ }
buttonsDynamicEffectView.deactivateButtonEffect(input: input)
}
}
diff --git a/Cores/Libretro/ui/drivers/LibretroCore.m b/Cores/Libretro/ui/drivers/LibretroCore.m
index 79eb1152..c2bc8f34 100644
--- a/Cores/Libretro/ui/drivers/LibretroCore.m
+++ b/Cores/Libretro/ui/drivers/LibretroCore.m
@@ -169,6 +169,14 @@ NSString * const MAMEGameFileMissingNotification = @"MAMEGameFileMissingNotifica
[[self getRetroArch] loadCoreWithoutContent:corePath];
}
+- (void)loadCoreWithoutRunning:(NSString *_Nonnull)corePath {
+ [[self getRetroArch] loadCoreWithoutRunning:corePath];
+}
+
+- (NSArray<CoreOptionCategory *> *_Nullable)getCoreOptions:(NSString *_Nonnull)corePath {
+ return [[self getRetroArch] getCoreOptions:corePath];
+}
+
- (void)pressButton:(LibretroButton)button playerIndex:(unsigned)playerIndex {
[[self getRetroArch] pressButton:(unsigned)button playerIndex:playerIndex];
}
@@ -205,6 +213,256 @@ NSString * const MAMEGameFileMissingNotification = @"MAMEGameFileMissingNotifica
apple_direct_input_keyboard_event(false, keyboardCode.code, 0, _keyboardMods, RETRO_DEVICE_KEYBOARD);
}
+- (void)handleUIPress:(UIPress *)press withEvent:(UIPressesEvent *)event down:(BOOL)down {
+ NSString *ch;
+ uint32_t character = 0;
+ uint32_t mod = 0;
+ NSUInteger mods = 0;
+ if (@available(iOS 13.4, tvOS 13.4, *))
+ {
+ ch = (NSString*)press.key.characters;
+ mods = event.modifierFlags;
+ }
+
+ if (mods & UIKeyModifierAlphaShift)
+ mod |= RETROKMOD_CAPSLOCK;
+ if (mods & UIKeyModifierShift)
+ mod |= RETROKMOD_SHIFT;
+ if (mods & UIKeyModifierControl)
+ mod |= RETROKMOD_CTRL;
+ if (mods & UIKeyModifierAlternate)
+ mod |= RETROKMOD_ALT;
+ if (mods & UIKeyModifierCommand)
+ mod |= RETROKMOD_META;
+ if (mods & UIKeyModifierNumericPad)
+ mod |= RETROKMOD_NUMLOCK;
+
+ if (ch && ch.length != 0)
+ {
+ unsigned i;
+ character = [ch characterAtIndex:0];
+
+ apple_input_keyboard_event(down,
+ (uint32_t)press.key.keyCode, 0, mod,
+ RETRO_DEVICE_KEYBOARD);
+
+ for (i = 1; i < ch.length; i++)
+ apple_input_keyboard_event(down,
+ 0, [ch characterAtIndex:i], mod,
+ RETRO_DEVICE_KEYBOARD);
+ }
+
+ if (@available(iOS 13.4, tvOS 13.4, *))
+ apple_input_keyboard_event(down,
+ (uint32_t)press.key.keyCode, character, mod,
+ RETRO_DEVICE_KEYBOARD);
+}
+
+- (void)keyboardEvent:(UIEvent *_Nonnull)event {
+ // 严格参考 DeltaCore KeyboardResponder.swift 实现
+ // 通过 KVC 从私有字段直接读取
+ NSNumber *keyCodeNum = [event valueForKey:@"_keyCode"];
+ NSNumber *isKeyDownNum = [event valueForKey:@"_isKeyDown"];
+ NSNumber *modifierFlagsNum = [event valueForKey:@"_modifierFlags"];
+ NSString *unmodifiedInput = [event valueForKey:@"_unmodifiedInput"];
+
+ if (!keyCodeNum || !isKeyDownNum || !modifierFlagsNum) {
+ return;
+ }
+
+ NSInteger hidKeyCode = keyCodeNum.integerValue;
+ BOOL isKeyDown = isKeyDownNum.boolValue;
+ NSInteger rawModifiers = modifierFlagsNum.integerValue;
+
+ // ── 1. 计算 RETROKMOD 位掩码 ─────────────────────────────────────────
+ static const NSInteger kShift = 1 << 17; // UIKeyModifierShift
+ static const NSInteger kCtrl = 1 << 18; // UIKeyModifierControl
+ static const NSInteger kAlt = 1 << 19; // UIKeyModifierAlternate
+ static const NSInteger kMeta = 1 << 20; // UIKeyModifierCommand
+ static const NSInteger kCapsLk = 1 << 16; // UIKeyModifierAlphaShift
+
+ uint32_t newMods = RETROKMOD_NONE;
+ if (rawModifiers & kShift) newMods |= RETROKMOD_SHIFT;
+ if (rawModifiers & kCtrl) newMods |= RETROKMOD_CTRL;
+ if (rawModifiers & kAlt) newMods |= RETROKMOD_ALT;
+ if (rawModifiers & kMeta) newMods |= RETROKMOD_META;
+ if (rawModifiers & kCapsLk) newMods |= RETROKMOD_CAPSLOCK;
+
+ // ── 2. HID Usage → RETROK 映射表(初始化一次)────────────────────────
+ static unsigned hidToRetrok[0x200];
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ memset(hidToRetrok, 0, sizeof(hidToRetrok));
+ // 字母 a-z (HID 0x04–0x1D)
+ hidToRetrok[0x04] = RETROK_a; hidToRetrok[0x05] = RETROK_b;
+ hidToRetrok[0x06] = RETROK_c; hidToRetrok[0x07] = RETROK_d;
+ hidToRetrok[0x08] = RETROK_e; hidToRetrok[0x09] = RETROK_f;
+ hidToRetrok[0x0A] = RETROK_g; hidToRetrok[0x0B] = RETROK_h;
+ hidToRetrok[0x0C] = RETROK_i; hidToRetrok[0x0D] = RETROK_j;
+ hidToRetrok[0x0E] = RETROK_k; hidToRetrok[0x0F] = RETROK_l;
+ hidToRetrok[0x10] = RETROK_m; hidToRetrok[0x11] = RETROK_n;
+ hidToRetrok[0x12] = RETROK_o; hidToRetrok[0x13] = RETROK_p;
+ hidToRetrok[0x14] = RETROK_q; hidToRetrok[0x15] = RETROK_r;
+ hidToRetrok[0x16] = RETROK_s; hidToRetrok[0x17] = RETROK_t;
+ hidToRetrok[0x18] = RETROK_u; hidToRetrok[0x19] = RETROK_v;
+ hidToRetrok[0x1A] = RETROK_w; hidToRetrok[0x1B] = RETROK_x;
+ hidToRetrok[0x1C] = RETROK_y; hidToRetrok[0x1D] = RETROK_z;
+ // 数字 1-9, 0 (HID 0x1E–0x27)
+ hidToRetrok[0x1E] = RETROK_1; hidToRetrok[0x1F] = RETROK_2;
+ hidToRetrok[0x20] = RETROK_3; hidToRetrok[0x21] = RETROK_4;
+ hidToRetrok[0x22] = RETROK_5; hidToRetrok[0x23] = RETROK_6;
+ hidToRetrok[0x24] = RETROK_7; hidToRetrok[0x25] = RETROK_8;
+ hidToRetrok[0x26] = RETROK_9; hidToRetrok[0x27] = RETROK_0;
+ // 控制键
+ hidToRetrok[0x28] = RETROK_RETURN; // Return
+ hidToRetrok[0x29] = RETROK_ESCAPE; // Escape
+ hidToRetrok[0x2A] = RETROK_BACKSPACE; // Backspace
+ hidToRetrok[0x2B] = RETROK_TAB; // Tab
+ hidToRetrok[0x2C] = RETROK_SPACE; // Space
+ // 符号
+ hidToRetrok[0x2D] = RETROK_MINUS; // -
+ hidToRetrok[0x2E] = RETROK_EQUALS; // =
+ hidToRetrok[0x2F] = RETROK_LEFTBRACKET; // [
+ hidToRetrok[0x30] = RETROK_RIGHTBRACKET; // ]
+ hidToRetrok[0x31] = RETROK_BACKSLASH; // backslash
+ hidToRetrok[0x33] = RETROK_SEMICOLON; // ;
+ hidToRetrok[0x34] = RETROK_QUOTE; // '
+ hidToRetrok[0x35] = RETROK_BACKQUOTE; // `
+ hidToRetrok[0x36] = RETROK_COMMA; // ,
+ hidToRetrok[0x37] = RETROK_PERIOD; // .
+ hidToRetrok[0x38] = RETROK_SLASH; // /
+ // CapsLock
+ hidToRetrok[0x39] = RETROK_CAPSLOCK;
+ // F1–F12 (HID 0x3A–0x45)
+ hidToRetrok[0x3A] = RETROK_F1; hidToRetrok[0x3B] = RETROK_F2;
+ hidToRetrok[0x3C] = RETROK_F3; hidToRetrok[0x3D] = RETROK_F4;
+ hidToRetrok[0x3E] = RETROK_F5; hidToRetrok[0x3F] = RETROK_F6;
+ hidToRetrok[0x40] = RETROK_F7; hidToRetrok[0x41] = RETROK_F8;
+ hidToRetrok[0x42] = RETROK_F9; hidToRetrok[0x43] = RETROK_F10;
+ hidToRetrok[0x44] = RETROK_F11; hidToRetrok[0x45] = RETROK_F12;
+ // 导航区
+ hidToRetrok[0x49] = RETROK_INSERT; hidToRetrok[0x4A] = RETROK_HOME;
+ hidToRetrok[0x4B] = RETROK_PAGEUP; hidToRetrok[0x4C] = RETROK_DELETE;
+ hidToRetrok[0x4D] = RETROK_END; hidToRetrok[0x4E] = RETROK_PAGEDOWN;
+ hidToRetrok[0x4F] = RETROK_RIGHT; hidToRetrok[0x50] = RETROK_LEFT;
+ hidToRetrok[0x51] = RETROK_DOWN; hidToRetrok[0x52] = RETROK_UP;
+ // 小键盘
+ hidToRetrok[0x53] = RETROK_NUMLOCK;
+ hidToRetrok[0x54] = RETROK_KP_DIVIDE; hidToRetrok[0x55] = RETROK_KP_MULTIPLY;
+ hidToRetrok[0x56] = RETROK_KP_MINUS; hidToRetrok[0x57] = RETROK_KP_PLUS;
+ hidToRetrok[0x58] = RETROK_KP_ENTER;
+ hidToRetrok[0x59] = RETROK_KP1; hidToRetrok[0x5A] = RETROK_KP2;
+ hidToRetrok[0x5B] = RETROK_KP3; hidToRetrok[0x5C] = RETROK_KP4;
+ hidToRetrok[0x5D] = RETROK_KP5; hidToRetrok[0x5E] = RETROK_KP6;
+ hidToRetrok[0x5F] = RETROK_KP7; hidToRetrok[0x60] = RETROK_KP8;
+ hidToRetrok[0x61] = RETROK_KP9; hidToRetrok[0x62] = RETROK_KP0;
+ hidToRetrok[0x63] = RETROK_KP_PERIOD;
+ // PrintScreen/SysReq, ScrollLock, Pause (HID 0x46–0x48)
+ hidToRetrok[0x46] = RETROK_PRINT;
+ hidToRetrok[0x47] = RETROK_SCROLLOCK;
+ hidToRetrok[0x48] = RETROK_PAUSE;
+ // F13–F15 (HID 0x68–0x6A)
+ hidToRetrok[0x68] = RETROK_F13;
+ hidToRetrok[0x69] = RETROK_F14;
+ hidToRetrok[0x6A] = RETROK_F15;
+ // 小键盘等号 (HID 0x67)
+ hidToRetrok[0x67] = RETROK_KP_EQUALS;
+ // 非 US 键盘第102键反斜杠 (HID 0x64)
+ hidToRetrok[0x64] = RETROK_OEM_102;
+ // Application/Menu 键 → Compose (HID 0x65)
+ hidToRetrok[0x65] = RETROK_COMPOSE;
+ // Power 键 (HID 0x66)
+ hidToRetrok[0x66] = RETROK_POWER;
+ // Help 键 (HID 0x75)
+ hidToRetrok[0x75] = RETROK_HELP;
+ // 键盘音量键(HID 键盘页 0x07:0x7F–0x81)
+ hidToRetrok[0x7F] = RETROK_VOLUME_MUTE;
+ hidToRetrok[0x80] = RETROK_VOLUME_UP;
+ hidToRetrok[0x81] = RETROK_VOLUME_DOWN;
+ // 修饰键(左/右)(HID 0xE0–0xE7)
+ hidToRetrok[0xE0] = RETROK_LCTRL; hidToRetrok[0xE1] = RETROK_LSHIFT;
+ hidToRetrok[0xE2] = RETROK_LALT; hidToRetrok[0xE3] = RETROK_LMETA;
+ hidToRetrok[0xE4] = RETROK_RCTRL; hidToRetrok[0xE5] = RETROK_RSHIFT;
+ hidToRetrok[0xE6] = RETROK_RALT; hidToRetrok[0xE7] = RETROK_RMETA;
+ });
+
+ // ── 3. 统一的 activeKeys 跟踪(参考 KeyboardResponder.activeKeyPresses)──
+ // 字典存储每个 HID keyCode 的 {retrok, isActive},用于:
+ // a) 去重(过滤 key-repeat)
+ // b) keyUp 时使用按下时记录的 retrok(因为 keyUp 时 _unmodifiedInput 可能无效)
+ // c) 修饰键也统一走此路径,不再单独 early return
+
+ // activeKeys: key=HID keyCode, value=@[@(retrok), @(isActive)]
+ static NSMutableDictionary<NSNumber *, NSArray<NSNumber *> *> *activeKeys = nil;
+ static dispatch_once_t keysOnce;
+ dispatch_once(&keysOnce, ^{ activeKeys = [NSMutableDictionary dictionary]; });
+
+ NSNumber *keyNum = @(hidKeyCode);
+ NSArray<NSNumber *> *previousEntry = activeKeys[keyNum];
+ BOOL previousIsActive = previousEntry ? previousEntry[1].boolValue : NO;
+
+ // 参考 KeyboardResponder: guard previousKeyPress?.isActive != isActive
+ // 过滤重复的 down/up 事件(包括 key-repeat 和重复 up)
+ if (previousEntry && previousIsActive == isKeyDown) {
+ return;
+ }
+
+ // ── 4. 确定 RETROK 值 ────────────────────────────────────────────────
+ unsigned retrok = RETROK_UNKNOWN;
+
+ if (!isKeyDown && previousEntry) {
+ // keyUp 时优先使用按下时记录的 retrok(参考 KeyboardResponder: previousKeyPress?.key)
+ // 因为 _unmodifiedInput 在 keyUp 时可能无效或不同
+ retrok = previousEntry[0].unsignedIntValue;
+ } else {
+ // keyDown:根据 unmodifiedInput 和 HID keyCode 确定 retrok
+ if (unmodifiedInput.length == 0) {
+ // 纯修饰键事件(参考 KeyboardResponder 对空 key 的处理)
+ // 通过比较前后 modifier flags 确定是哪个修饰键
+ if (isKeyDown) {
+ // 新按下的修饰键 = 当前 flags 中新增的部分
+ uint32_t activated = newMods & ~((uint32_t)_keyboardMods);
+ retrok = [self retrokForModifierFlags:activated];
+ } else {
+ // 新释放的修饰键 = 之前 flags 中消失的部分
+ uint32_t deactivated = ((uint32_t)_keyboardMods) & ~newMods;
+ retrok = [self retrokForModifierFlags:deactivated];
+ }
+ } else {
+ // 有 unmodifiedInput:使用 HID keyCode 映射
+ if (hidKeyCode > 0 && hidKeyCode < 0x200) {
+ retrok = hidToRetrok[hidKeyCode];
+ }
+ }
+ }
+
+ // 更新修饰键状态(参考 KeyboardResponder 的 defer 语义:无论是否发送事件都要更新)
+ _keyboardMods = newMods;
+
+ if (retrok == RETROK_UNKNOWN) {
+ return;
+ }
+
+ // ── 5. 更新 activeKeys 并发送事件 ────────────────────────────────────
+ if (isKeyDown) {
+ activeKeys[keyNum] = @[@(retrok), @YES];
+ apple_direct_input_keyboard_event(true, retrok, 0, newMods, RETRO_DEVICE_KEYBOARD);
+ } else {
+ apple_direct_input_keyboard_event(false, retrok, 0, newMods, RETRO_DEVICE_KEYBOARD);
+ [activeKeys removeObjectForKey:keyNum];
+ }
+}
+
+// 辅助方法:根据 modifier flags 差异确定对应的 RETROK(参考 KeyboardResponder.key(for:))
+- (unsigned)retrokForModifierFlags:(uint32_t)flags {
+ if (flags & RETROKMOD_SHIFT) return RETROK_LSHIFT;
+ if (flags & RETROKMOD_CTRL) return RETROK_LCTRL;
+ if (flags & RETROKMOD_ALT) return RETROK_LALT;
+ if (flags & RETROKMOD_META) return RETROK_LMETA;
+ if (flags & RETROKMOD_CAPSLOCK) return RETROK_CAPSLOCK;
+ return RETROK_UNKNOWN;
+}
+
- (void)moveStick:(BOOL)isLeft x:(CGFloat)x y:(CGFloat)y playerIndex:(unsigned)playerIndex {
[[self getRetroArch] moveStick:isLeft x:x y:y playerIndex:playerIndex];
}
@@ -221,6 +479,10 @@ NSString * const MAMEGameFileMissingNotification = @"MAMEGameFileMissingNotifica
[[self getRetroArch] updateCoreConfig:coreName configs:configs reload:reload];
}
+- (void)updateCoreConfig:(NSString *_Nonnull)coreName content:(NSString *_Nullable)content reload:(BOOL)reload {
+ [[self getRetroArch] updateCoreConfig:coreName content:content reload:reload];
+}
+
- (void)updateRunningCoreConfigs:(NSDictionary<NSString*, NSString*> *_Nullable)configs flush:(BOOL)flush {
[[self getRetroArch] updateRunningCoreConfigs:configs flush:flush];
}
@@ -301,12 +563,16 @@ NSString * const MAMEGameFileMissingNotification = @"MAMEGameFileMissingNotifica
[[self getRetroArch] setDiskIndex:index delay:delay];
}
-- (NSUInteger)getCurrentDiskIndex {
- return [[self getRetroArch] getCurrentDiskIndex];
+- (void)setDiskIndex2:(unsigned)index {
+ [[self getRetroArch] setDiskIndex2:index];
+}
+
+- (LibretroDisk *_Nullable)getDiskInfo {
+ return [[self getRetroArch] getDiskInfo];
}
-- (NSUInteger)getDiskCount {
- return [[self getRetroArch] getDiskCount];
+- (BOOL)insertDisk:(NSString *_Nonnull)path {
+ return [[self getRetroArch] insertDisk:path];
}
- (void)setPSXAnalog:(BOOL)isAnalog {
@@ -660,6 +926,10 @@ static void libretroLogCallback(enum retro_log_level level, const char *fmt, va_
[[self getRetroArch] releaseTouchEvent];
}
+- (void)sendMultiTouchEvent:(NSArray<NSDictionary *> *)points {
+ [[self getRetroArch] sendMultiTouchEvent:points];
+}
+
- (NSString *_Nullable)getCoreConfigs:(NSString *_Nonnull)coreName {
return [[self getRetroArch] getCoreConfigs:coreName];
}
diff --git a/Cores/Libretro/ui/drivers/cocoa/LibretroCore.h b/Cores/Libretro/ui/drivers/cocoa/LibretroCore.h
index 304cb32b..dd5b4664 100644
--- a/Cores/Libretro/ui/drivers/cocoa/LibretroCore.h
+++ b/Cores/Libretro/ui/drivers/cocoa/LibretroCore.h
@@ -12,6 +12,8 @@
#import "AzaharKeyboardConfig.h"
#import "LibretroShaders.h"
#import "LibretroKeyboardCode.h"
+#import "LibretroCoreOptions.h"
+#import "LibretroDisk.h"
NS_ASSUME_NONNULL_BEGIN
@@ -56,16 +58,21 @@ extern NSString * const RetroAchievementsNotification;
- (void)reloadByKeepState:(BOOL)keepState;
- (BOOL)loadGame:(NSString *_Nonnull)gamePath corePath:(NSString *_Nonnull)corePath completion:(void(^ _Nullable)(NSDictionary *_Nullable))completion;
- (void)loadCoreWithoutContent:(NSString *_Nonnull)corePath;
+- (void)loadCoreWithoutRunning:(NSString *_Nonnull)corePath;
+- (NSArray<CoreOptionCategory *> *_Nullable)getCoreOptions:(NSString *_Nonnull)corePath;
- (void)sendEvent:(UIEvent * _Nonnull)event;
- (void)pressButton:(LibretroButton)button playerIndex:(unsigned)playerIndex;
- (void)releaseButton:(LibretroButton)button playerIndex:(unsigned)playerIndex;
- (void)pressKeyboard:(LibretroKeyboardCode *_Nonnull)keyboardCode;
- (void)releaseKeyboard:(LibretroKeyboardCode *_Nonnull)keyboardCode;
+- (void)handleUIPress:(UIPress *)press withEvent:(UIPressesEvent *)event down:(BOOL)down;
+- (void)keyboardEvent:(UIEvent *_Nonnull)event;
///x,y取值范围 -1~1
- (void)moveStick:(BOOL)isLeft x:(CGFloat)x y:(CGFloat)y playerIndex:(unsigned)playerIndex;
- (void)updatePSPCheat:(NSString *_Nonnull)cheatCode cheatFilePath:(NSString *_Nonnull)cheatFilePath reloadGame:(BOOL)reloadGame;
- (void)updateCoreConfig:(NSString *_Nonnull)coreName key:(NSString *_Nonnull)key value:(NSString *_Nonnull)value reload:(BOOL)reload;
- (void)updateCoreConfig:(NSString *_Nonnull)coreName configs:(NSDictionary<NSString*, NSString*> *_Nullable)configs reload:(BOOL)reload;
+- (void)updateCoreConfig:(NSString *_Nonnull)coreName content:(NSString *_Nullable)content reload:(BOOL)reload;
- (void)updateRunningCoreConfigs:(NSDictionary<NSString*, NSString*> *_Nullable)configs flush:(BOOL)flush;
- (void)updateLibretroConfig:(NSString *_Nonnull)key value:(NSString *_Nonnull)value;
- (void)updateLibretroConfigs:(NSDictionary<NSString*, NSString*> *_Nullable)configs;
@@ -82,8 +89,9 @@ extern NSString * const RetroAchievementsNotification;
- (NSString * _Nullable)libretroConfigValue:(NSString * _Nonnull)key;
- (void)setRespectSilentMode:(BOOL)respect;
- (void)setDiskIndex:(unsigned)index delay:(BOOL)delay;
-- (NSUInteger)getCurrentDiskIndex;
-- (NSUInteger)getDiskCount;
+- (void)setDiskIndex2:(unsigned)index;
+- (LibretroDisk *_Nullable)getDiskInfo;
+- (BOOL)insertDisk:(NSString *_Nonnull)path;
- (void)setPSXAnalog:(BOOL)isAnalog;
- (void)setReloadDelay:(double)delay;
- (void)turnOffHardcode;
@@ -99,6 +107,7 @@ extern NSString * const RetroAchievementsNotification;
- (void)setCoreOptionNeedsUpdate;
- (void)sendTouchEventX:(CGFloat)x y:(CGFloat)y;
- (void)releaseTouchEvent;
+- (void)sendMultiTouchEvent:(NSArray<NSDictionary *> *)points;
- (NSString *_Nullable)getCoreConfigs:(NSString *_Nonnull)coreName;
- (void)updateFBNeoCheatCode:(NSArray<NSString *> *_Nonnull)keys enable:(BOOL)enable;
- (void)setFastforwardFrameSkip:(BOOL)frameSkip;
diff --git a/Cores/Libretro/ui/drivers/cocoa/apple_platform.h b/Cores/Libretro/ui/drivers/cocoa/apple_platform.h
index f01ffb2f..b4cbc373 100644
--- a/Cores/Libretro/ui/drivers/cocoa/apple_platform.h
+++ b/Cores/Libretro/ui/drivers/cocoa/apple_platform.h
@@ -113,6 +113,8 @@ UINavigationControllerDelegate> {
- (void)stop;
- (BOOL)loadGame:(NSString *_Nonnull)gamePath corePath:(NSString *_Nonnull)corePath completion:(void(^ _Nullable)(NSDictionary *_Nullable))completion;
- (void)loadCoreWithoutContent:(NSString *_Nonnull)corePath;
+- (void)loadCoreWithoutRunning:(NSString *_Nonnull)corePath;
+- (NSArray<id> *_Nullable)getCoreOptions:(NSString *_Nonnull)corePath;
- (void)pressButton:(unsigned)button playerIndex:(unsigned)playerIndex;
- (void)releaseButton:(unsigned)button playerIndex:(unsigned)playerIndex;
- (void)moveStick:(BOOL)isLeft x:(CGFloat)x y:(CGFloat)y playerIndex:(unsigned)playerIndex;
@@ -126,6 +128,7 @@ UINavigationControllerDelegate> {
- (void)updatePSPCheat:(NSString *_Nonnull)cheatCode cheatFilePath:(NSString *_Nonnull)cheatFilePath reloadGame:(BOOL)reloadGame;
- (void)updateCoreConfig:(NSString *_Nonnull)coreName key:(NSString *_Nonnull)key value:(NSString *_Nonnull)value reload:(BOOL)reload;
- (void)updateCoreConfig:(NSString *_Nonnull)coreName configs:(NSDictionary<NSString*, NSString*> *_Nullable)configs reload:(BOOL)reload;
+- (void)updateCoreConfig:(NSString *_Nonnull)coreName content:(NSString *_Nullable)content reload:(BOOL)reload;
- (void)updateRunningCoreConfigs:(NSDictionary<NSString*, NSString*> *_Nullable)configs flush:(BOOL)flush;
- (void)updateLibretroConfig:(NSString *_Nonnull)key value:(NSString *_Nonnull)value;
- (void)updateLibretroConfigs:(NSDictionary<NSString*, NSString*> *_Nullable)configs;
@@ -141,8 +144,9 @@ UINavigationControllerDelegate> {
- (NSString * _Nullable)coreConfigValue:(NSString * _Nonnull)coreName key:(NSString * _Nonnull)key;
- (NSString * _Nullable)libretroConfigValue:(NSString * _Nonnull)key;
- (void)setDiskIndex:(unsigned)index delay:(BOOL)delay;
-- (NSUInteger)getCurrentDiskIndex;
-- (NSUInteger)getDiskCount;
+- (void)setDiskIndex2:(unsigned)index;
+- (id _Nullable)getDiskInfo;
+- (BOOL)insertDisk:(NSString *_Nonnull)path;
- (void)setPSXAnalog:(BOOL)isAnalog;
- (void)setReloadDelay:(double)delay;
- (void)turnOffHardcode;
@@ -152,6 +156,7 @@ UINavigationControllerDelegate> {
- (BOOL)getSensorEnable:(int)playerIndex;
- (void)sendTouchEventX:(CGFloat)x y:(CGFloat)y;
- (void)releaseTouchEvent;
+- (void)sendMultiTouchEvent:(NSArray<NSDictionary *> *)points;
- (NSString *_Nullable)getCoreConfigs:(NSString *_Nonnull)coreName;
- (void)updateFBNeoCheatCode:(NSArray<NSString *> *_Nonnull)keys enable:(BOOL)enable;
- (void)setFastforwardFrameSkip:(BOOL)frameSkip;
diff --git a/Cores/Libretro/ui/drivers/ui_cocoatouch.m b/Cores/Libretro/ui/drivers/ui_cocoatouch.m
index 181b0507..947dacb4 100644
--- a/Cores/Libretro/ui/drivers/ui_cocoatouch.m
+++ b/Cores/Libretro/ui/drivers/ui_cocoatouch.m
@@ -1138,6 +1138,138 @@ static BOOL RespectSilentMode = false;
task_push_load_contentless_core_from_menu(corePath.UTF8String);
}
+- (void)loadCoreWithoutRunning:(NSString *_Nonnull)corePath {
+ content_ctx_info_t content_info;
+ content_info.argc = 0;
+ content_info.argv = NULL;
+ content_info.args = NULL;
+ content_info.environ_get = NULL;
+ // 设置核心路径并通过 CMD_EVENT_LOAD_CORE 加载动态库,触发 retro_set_environment
+ // 使核心有机会注册其 core options,但不加载任何游戏内容
+ task_push_load_new_core(corePath.UTF8String, NULL, &content_info, CORE_TYPE_PLAIN, NULL, NULL);
+}
+
+- (NSArray<CoreOptionCategory *> *_Nullable)getCoreOptions:(NSString *_Nonnull)corePath {
+ BOOL needToShutdown = false;
+ if (!LibretroInitial) {
+ needToShutdown = true;
+ [self startWithCustomSaveDir:nil];
+ // loadCoreWithoutRunning 内部用 task_push_load_new_core,
+ // 只触发 CMD_EVENT_LOAD_CORE → libretro_get_system_info(临时加载,带 IGNORE_ENVIRONMENT_CB),
+ // 不会执行 retro_set_environment(runloop_environment_cb) + retro_init(),
+ // 因此 core_options 不会被填充。
+ // 必须用 loadCoreWithoutContent: 走完整的 content_load 流程。
+ [self loadCoreWithoutContent:corePath];
+ }
+
+ NSArray<CoreOptionCategory *> *result = nil;
+
+ runloop_state_t *runloop_st = runloop_state_get_ptr();
+ core_option_manager_t *opt = runloop_st ? runloop_st->core_options : NULL;
+
+ if (opt && opt->size > 0) {
+ NSMutableArray<CoreOptionCategory *> *categories = [NSMutableArray array];
+ // 无分类选项(category_key 为空)暂存
+ NSMutableArray<CoreOption *> *uncategorizedOptions = [NSMutableArray array];
+ // 按 category_key 归类的选项
+ NSMutableDictionary<NSString *, NSMutableArray<CoreOption *> *> *categoryOptionsMap = [NSMutableDictionary dictionary];
+
+ for (size_t i = 0; i < opt->size; i++) {
+ struct core_option *option = &opt->opts[i];
+ if (!option->key)
+ continue;
+
+ CoreOption *coreOption = [[CoreOption alloc] init];
+ coreOption.key = @(option->key);
+ coreOption.index = (NSInteger)option->index;
+ coreOption.visible = core_option_manager_get_visible(opt, i);
+
+ BOOL isCategorized = option->category_key != NULL;
+ const char *desc = core_option_manager_get_desc(opt, i, isCategorized);
+ coreOption.desc = desc ? @(desc) : @"";
+
+ const char *info = core_option_manager_get_info(opt, i, isCategorized);
+ coreOption.info = info ? @(info) : @"";
+
+ const char *val = core_option_manager_get_val(opt, i);
+ coreOption.value = val ? @(val) : @"";
+
+ const char *valLabel = core_option_manager_get_val_label(opt, i);
+ coreOption.label = valLabel ? @(valLabel) : @"";
+
+ // 收集所有可选值及其标签
+ NSMutableArray<Options *> *optItems = [NSMutableArray array];
+ if (option->vals) {
+ for (size_t j = 0; j < option->vals->size; j++) {
+ const char *v = option->vals->elems[j].data;
+ const char *l = (option->val_labels && j < option->val_labels->size)
+ ? option->val_labels->elems[j].data : NULL;
+ Options *opt_item = [[Options alloc] init];
+ opt_item.value = v ? @(v) : @"";
+ opt_item.label = l ? @(l) : (v ? @(v) : @"");
+ [optItems addObject:opt_item];
+ }
+ }
+ coreOption.options = [optItems copy];
+
+ if (option->category_key) {
+ NSString *catKey = @(option->category_key);
+ NSMutableArray<CoreOption *> *catOpts = categoryOptionsMap[catKey];
+ if (!catOpts) {
+ catOpts = [NSMutableArray array];
+ categoryOptionsMap[catKey] = catOpts;
+ }
+ [catOpts addObject:coreOption];
+ } else {
+ [uncategorizedOptions addObject:coreOption];
+ }
+ }
+
+ // 无分类选项作为第一个 category(title/desc 均为空)
+ if (uncategorizedOptions.count > 0) {
+ CoreOptionCategory *cat = [[CoreOptionCategory alloc] init];
+ cat.title = @"";
+ cat.desc = @"";
+ cat.info = @"";
+ cat.index = 0;
+ cat.options = [uncategorizedOptions copy];
+ cat.visible = YES;
+ [categories addObject:cat];
+ }
+
+ // 按 cats 数组顺序构建有名分类
+ for (size_t i = 0; i < opt->cats_size; i++) {
+ struct core_category *cat_def = &opt->cats[i];
+ if (!cat_def->key)
+ break;
+
+ NSString *catKey = @(cat_def->key);
+ NSMutableArray<CoreOption *> *catOpts = categoryOptionsMap[catKey];
+
+ CoreOptionCategory *cat = [[CoreOptionCategory alloc] init];
+ const char *catDesc = core_option_manager_get_category_desc(opt, cat_def->key);
+ cat.title = catDesc ? @(catDesc) : catKey;
+ cat.desc = catKey; // key 作为唯一标识符
+ const char *catInfo = core_option_manager_get_category_info(opt, cat_def->key);
+ cat.info = catInfo ? @(catInfo) : @"";
+ cat.index = (NSInteger)categories.count;
+ cat.options = catOpts ? [catOpts copy] : @[];
+ cat.visible = core_option_manager_get_category_visible(opt, cat_def->key);
+ [categories addObject:cat];
+ }
+
+ if (categories.count > 0)
+ result = [categories copy];
+ }
+
+ if (needToShutdown) {
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+ [self stop];
+ });
+ }
+ return result;
+}
+
extern void manic_input_button_event(unsigned port, unsigned button_id, bool pressed);
extern void manic_input_analog_event(unsigned port, unsigned stick_id, float x_value, float y_value);
- (void)pressButton:(unsigned)button playerIndex:(unsigned)playerIndex {
@@ -1602,50 +1734,7 @@ static NSString *_Nullable needToLoadStatePath = nil;
}
- (void)updateCoreConfig:(NSString *_Nonnull)coreName key:(NSString *_Nonnull)key value:(NSString *_Nonnull)value reload:(BOOL)reload {
- NSString *configPath = [NSString stringWithFormat:@"config/%@/%@.opt", coreName, coreName];
- NSString *configFilePath = [self.workspace stringByAppendingPathComponent:configPath];
- if (![[NSFileManager defaultManager] fileExistsAtPath:configFilePath]) {
- core_options_flush();//生成配置
- }
-
- NSError *error = nil;
- NSString *fileContents = [NSString stringWithContentsOfFile:configFilePath encoding:NSUTF8StringEncoding error:&error];
-
- if (error) {
- NSLog(@"读取文件失败: %@", error.localizedDescription);
- [NSFileManager.defaultManager createDirectoryAtPath:[configFilePath stringByDeletingLastPathComponent] withIntermediateDirectories:YES attributes:nil error:nil];
- fileContents = [NSString stringWithFormat:@"%@ = \"%@\"", key, value];
- // 写回文件
- [fileContents writeToFile:configFilePath atomically:YES encoding:NSUTF8StringEncoding error:&error];
- if (reload) {
- [self reloadByKeepState:YES];
- }
- return;
- }
-
- NSString *oldValue = [self configValueForKey:key inFileContents:fileContents];
- if ([oldValue isEqualToString:value]) {
- return;
- }
-
- // 正则匹配并替换
- NSString *pattern = [NSString stringWithFormat:@"%@\\s*=\\s*\"[^\"]*\"", key] ;
- NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:pattern options:0 error:&error];
-
- if (error) {
- NSLog(@"正则表达式错误: %@", error.localizedDescription);
- return;
- }
- NSString *replacement = [NSString stringWithFormat:@"%@ = \"%@\"", key, value];
- NSString *updatedContents = [regex stringByReplacingMatchesInString:fileContents
- options:0
- range:NSMakeRange(0, fileContents.length)
- withTemplate:replacement];
- // 写回文件
- [updatedContents writeToFile:configFilePath atomically:YES encoding:NSUTF8StringEncoding error:&error];
- if (reload) {
- [self reloadByKeepState:YES];
- }
+ [self updateCoreConfig:coreName configs:@{key: value} reload:reload];
}
- (void)updateCoreConfig:(NSString *_Nonnull)coreName configs:(NSDictionary<NSString*, NSString*> *_Nullable)configs reload:(BOOL)reload {
@@ -1706,6 +1795,21 @@ static NSString *_Nullable needToLoadStatePath = nil;
}
}
+- (void)updateCoreConfig:(NSString *_Nonnull)coreName content:(NSString *_Nullable)content reload:(BOOL)reload {
+ NSString *configPath = [NSString stringWithFormat:@"config/%@/%@.opt", coreName, coreName];
+ NSString *configFilePath = [self.workspace stringByAppendingPathComponent:configPath];
+
+ [NSFileManager.defaultManager removeItemAtPath:configFilePath error:nil];
+ if (content && [content stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]].length > 0) {
+ [content writeToFile:configFilePath atomically:YES encoding:NSUTF8StringEncoding error:nil];
+ } else {
+ //Remove the configuration and let the core generate it automatically—that way, it'll just use the default settings.
+ }
+ if (reload) {
+ [self reloadByKeepState:YES];
+ }
+}
+
- (void)updateRunningCoreConfigs:(NSDictionary<NSString*, NSString*> *_Nullable)configs flush:(BOOL)flush {
// 获取 runloop 状态
runloop_state_t *runloop_st = runloop_state_get_ptr();
@@ -2078,38 +2182,100 @@ bool set_shader_preset(const char * _Nullable preset_path)
}
}
-- (NSUInteger)getCurrentDiskIndex {
+- (void)setDiskIndex2:(unsigned)index {
runloop_state_t *runloop_st = runloop_state_get_ptr();
if (!runloop_st) {
- return 0;
+ return;
}
- rarch_system_info_t *sys_info = &runloop_st->system;
- if (!sys_info) {
- return 0;
+ disk_control_interface_t *disk_control = &runloop_st->system.disk_control;
+ if (!disk_control_enabled(disk_control)) {
+ return;
}
- disk_control_interface_t *disk_control = &sys_info->disk_control;
- if (!disk_control) {
- return 0;
+ // 直接调用底层同步 API,避免使用 CMD_EVENT 事件触发的异步路径
+ // eject → set_index → close,三步均同步完成,无需延迟
+ if (!disk_control_get_eject_state(disk_control)) {
+ disk_control_set_eject_state(disk_control, true, false);
}
- unsigned image_index = disk_control->cb.get_image_index();
- return image_index;
+ disk_control_set_index(disk_control, index, false);
+ disk_control_set_eject_state(disk_control, false, false);
}
-- (NSUInteger)getDiskCount {
+- (LibretroDisk *_Nullable)getDiskInfo {
runloop_state_t *runloop_st = runloop_state_get_ptr();
if (!runloop_st) {
- return 0;
+ return nil;
+ }
+ disk_control_interface_t *disk_control = &runloop_st->system.disk_control;
+ if (!disk_control_enabled(disk_control)) {
+ return nil;
+ }
+
+ unsigned num = disk_control_get_num_images(disk_control);
+ unsigned index = disk_control_get_image_index(disk_control);
+ bool ejected = disk_control_get_eject_state(disk_control);
+
+ // 支持 get_image_path 时读取路径,否则路径留空
+ BOOL hasPath = disk_control_initial_image_enabled(disk_control);
+ // 支持 get_image_label 时读取标签,否则回退使用路径的文件名
+ BOOL hasLabel = disk_control_image_label_enabled(disk_control);
+
+ NSMutableArray<NSString *> *paths = [NSMutableArray arrayWithCapacity:num];
+ NSMutableArray<NSString *> *labels = [NSMutableArray arrayWithCapacity:num];
+
+ for (unsigned i = 0; i < num; i++) {
+ // 路径
+ NSString *pathStr = @"";
+ if (hasPath) {
+ char pathBuf[PATH_MAX_LENGTH];
+ pathBuf[0] = '\0';
+ disk_control->cb.get_image_path(i, pathBuf, sizeof(pathBuf));
+ if (pathBuf[0] != '\0') {
+ pathStr = @(pathBuf);
+ }
+ }
+ [paths addObject:pathStr];
+
+ // 标签:优先使用核心提供的 label,其次取路径的文件名,最后留空
+ NSString *labelStr = @"";
+ if (hasLabel) {
+ char labelBuf[512];
+ labelBuf[0] = '\0';
+ disk_control_get_image_label(disk_control, i, labelBuf, sizeof(labelBuf));
+ if (labelBuf[0] != '\0') {
+ labelStr = @(labelBuf);
+ }
+ }
+ if (labelStr.length == 0 && pathStr.length > 0) {
+ labelStr = [pathStr lastPathComponent];
+ }
+ [labels addObject:labelStr];
}
- rarch_system_info_t *sys_info = &runloop_st->system;
- if (!sys_info) {
- return 0;
+
+ LibretroDisk *info = [[LibretroDisk alloc] init];
+ info.diskCount = num;
+ info.currentDiskIndex = index;
+ info.ejected = ejected;
+ info.diskPaths = [paths copy];
+ info.diskLabels = [labels copy];
+ return info;
+}
+
+- (BOOL)insertDisk:(NSString *_Nonnull)path {
+ runloop_state_t *runloop_st = runloop_state_get_ptr();
+ if (!runloop_st) {
+ return NO;
}
- disk_control_interface_t *disk_control = &sys_info->disk_control;
- if (!disk_control) {
- return 0;
+ disk_control_interface_t *disk_control = &runloop_st->system.disk_control;
+ // disk_control_append_image 内部会验证 add_image_index / replace_image_index 等回调,
+ // 会自动处理弹出→追加→切换到新磁盘→关闭的完整流程
+ bool success = disk_control_append_image(disk_control, path.UTF8String);
+ if (success) {
+ LibretroDisk *disk = [self getDiskInfo];
+ [self setDiskIndex2:(unsigned)disk.diskCount];
+ return YES;
+ } else {
+ return NO;
}
- unsigned num_images = disk_control->cb.get_num_images();
- return num_images;
}
- (void)setPSXAnalog:(BOOL)isAnalog {
@@ -2179,15 +2345,39 @@ static NSString * _Nullable g_customSaveExtension = nil;
- (void)releaseTouchEvent {
#if !TARGET_OS_TV
cocoa_input_data_t *apple = (cocoa_input_data_t*) input_state_get_ptr()->current_data;
-
+
if (!apple) {
return;
}
-
+
apple->touch_count = 0;
#endif
}
+- (void)sendMultiTouchEvent:(NSArray<NSDictionary *> *)points {
+#if !TARGET_OS_TV
+ cocoa_input_data_t *apple = (cocoa_input_data_t*) input_state_get_ptr()->current_data;
+ float scale = cocoa_screen_get_native_scale();
+
+ if (!apple) {
+ return;
+ }
+
+ NSUInteger count = MIN(points.count, (NSUInteger)MAX_TOUCHES);
+ apple->touch_count = (int)count;
+
+ for (NSUInteger i = 0; i < count; i++) {
+ NSDictionary *point = points[i];
+ NSNumber *x = point[@"x"];
+ NSNumber *y = point[@"y"];
+ if (x && y) {
+ apple->touches[i].screen_x = [x floatValue] * scale;
+ apple->touches[i].screen_y = [y floatValue] * scale;
+ }
+ }
+#endif
+}
+
- (NSString *_Nullable)getCoreConfigs:(NSString *_Nonnull)coreName {
NSString *configPath = [NSString stringWithFormat:@"config/%@/%@.opt", coreName, coreName];
NSString *configFilePath = [self.workspace stringByAppendingPathComponent:configPath];
diff --git a/Cores/dosbox.pure.libretro.framework/Info.plist b/Cores/dosbox.pure.libretro.framework/Info.plist
new file mode 100644
index 00000000..271d4071
--- /dev/null
+++ b/Cores/dosbox.pure.libretro.framework/Info.plist
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:bc543310c0d359fb56f7cf305489d4efb08c9cc784ab0cda9f0cff64e3eaf72d
+size 730
diff --git a/Cores/dosbox.pure.libretro.framework/_CodeSignature/CodeResources b/Cores/dosbox.pure.libretro.framework/_CodeSignature/CodeResources
new file mode 100644
index 00000000..ea939467
--- /dev/null
+++ b/Cores/dosbox.pure.libretro.framework/_CodeSignature/CodeResources
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e7bd2ed2a5d90646a3e4db07c3024ce4f2f52a461e58dab27b74fc0d437ceb75
+size 1798
diff --git a/Cores/dosbox.pure.libretro.framework/dosbox.pure.libretro b/Cores/dosbox.pure.libretro.framework/dosbox.pure.libretro
new file mode 100755
index 00000000..e9f3d009
--- /dev/null
+++ b/Cores/dosbox.pure.libretro.framework/dosbox.pure.libretro
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:0f4a41c46135f9febe6d014a7fb3f31d5f3dc9b15134828557e4d8cef8ba3eab
+size 2377200
diff --git a/ManicEmu/Libretro/LibretroCoreOptions.h b/ManicEmu/Libretro/LibretroCoreOptions.h
new file mode 100644
index 00000000..9dd0e826
--- /dev/null
+++ b/ManicEmu/Libretro/LibretroCoreOptions.h
@@ -0,0 +1,42 @@
+//
+// LibretroCoreOptions.h
+// Libretro
+//
+// Created by Daiuno on 2026/3/18.
+// Copyright © 2026 Manic EMU. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface Options : NSObject
+@property (nonatomic, copy) NSString *value;
+@property (nonatomic, copy) NSString *label;
+@end
+
+@interface CoreOption : NSObject
+
+@property (nonatomic, copy) NSString *key;
+@property (nonatomic, assign) NSInteger index;
+@property (nonatomic, copy) NSString *desc;
+@property (nonatomic, copy) NSString *info;
+@property (nonatomic, copy) NSString *value;
+@property (nonatomic, copy) NSString *label;
+@property (nonatomic, copy) NSArray<Options *> *options;
+@property (nonatomic, assign) BOOL visible;
+
+@end
+
+@interface CoreOptionCategory : NSObject
+
+@property (nonatomic, copy) NSString *title;
+@property (nonatomic, copy) NSString *desc;
+@property (nonatomic, copy) NSString *info;
+@property (nonatomic, assign) NSInteger index;
+@property (nonatomic, copy) NSArray<CoreOption *> *options;
+@property (nonatomic, assign) BOOL visible;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/ManicEmu/Libretro/LibretroCoreOptions.m b/ManicEmu/Libretro/LibretroCoreOptions.m
new file mode 100644
index 00000000..7ba2339f
--- /dev/null
+++ b/ManicEmu/Libretro/LibretroCoreOptions.m
@@ -0,0 +1,21 @@
+//
+// LibretroCoreOptions.m
+// Libretro
+//
+// Created by Daiuno on 2026/3/18.
+// Copyright © 2026 Manic EMU. All rights reserved.
+//
+
+#import "LibretroCoreOptions.h"
+
+@implementation Options
+
+@end
+
+@implementation CoreOption
+
+@end
+
+@implementation CoreOptionCategory
+
+@end
diff --git a/ManicEmu/Libretro/LibretroDisk.h b/ManicEmu/Libretro/LibretroDisk.h
new file mode 100644
index 00000000..2967e8b2
--- /dev/null
+++ b/ManicEmu/Libretro/LibretroDisk.h
@@ -0,0 +1,22 @@
+//
+// LibretroDisk.h
+// Libretro
+//
+// Created by Daiuno on 2026/3/19.
+// Copyright © 2026 Manic EMU. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface LibretroDisk : NSObject
+@property (nonatomic, assign) NSInteger currentDiskIndex;
+@property (nonatomic, assign) NSInteger diskCount;
+@property (nonatomic, assign) BOOL ejected;
+@property (nonatomic, copy) NSArray<NSString *> *diskPaths;
+@property (nonatomic, copy) NSArray<NSString *> *diskLabels;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/ManicEmu/Libretro/LibretroDisk.m b/ManicEmu/Libretro/LibretroDisk.m
new file mode 100644
index 00000000..4362c4f2
--- /dev/null
+++ b/ManicEmu/Libretro/LibretroDisk.m
@@ -0,0 +1,13 @@
+//
+// LibretroDisk.m
+// Libretro
+//
+// Created by Daiuno on 2026/3/19.
+// Copyright © 2026 Manic EMU. All rights reserved.
+//
+
+#import "LibretroDisk.h"
+
+@implementation LibretroDisk
+
+@end
diff --git a/ManicEmu/Libretro/LibretroKeyboardCode.h b/ManicEmu/Libretro/LibretroKeyboardCode.h
index 34fa230c..6e654c61 100644
--- a/ManicEmu/Libretro/LibretroKeyboardCode.h
+++ b/ManicEmu/Libretro/LibretroKeyboardCode.h
@@ -85,11 +85,11 @@ NS_ASSUME_NONNULL_BEGIN
"END" RETROK_END
"PAGEDWN" RETROK_PAGEDOWN
"F11" RETROK_F11
- "⬆️" RETROK_UP
+ "UP" RETROK_UP
"F12" RETROK_F12
- "⬅️" RETROK_LEFT
- "⬇️" RETROK_DOWN
- "➡️" RETROK_RIGHT
+ "DOWN" RETROK_LEFT
+ "LEFT" RETROK_DOWN
+ "RIGHT" RETROK_RIGHT
"DEL" RETROK_DELETE
"SPACE" RETROK_SPACE
"ESC" RETROK_ESCAPE
diff --git a/ManicEmu/Libretro/LibretroKeyboardCode.m b/ManicEmu/Libretro/LibretroKeyboardCode.m
index b74697fd..df82e0de 100644
--- a/ManicEmu/Libretro/LibretroKeyboardCode.m
+++ b/ManicEmu/Libretro/LibretroKeyboardCode.m
@@ -31,85 +31,91 @@
else if ([label isEqualToString:@"3"]) { return [self createCodeWithLabel:label code:RETROK_3]; }
else if ([label isEqualToString:@"4"]) { return [self createCodeWithLabel:label code:RETROK_4]; }
else if ([label isEqualToString:@"5"]) { return [self createCodeWithLabel:label code:RETROK_5]; }
- else if ([label isEqualToString:@"Q"]) { return [self createCodeWithLabel:label code:RETROK_q]; }
- else if ([label isEqualToString:@"W"]) { return [self createCodeWithLabel:label code:RETROK_w]; }
- else if ([label isEqualToString:@"E"]) { return [self createCodeWithLabel:label code:RETROK_e]; }
- else if ([label isEqualToString:@"R"]) { return [self createCodeWithLabel:label code:RETROK_r]; }
- else if ([label isEqualToString:@"T"]) { return [self createCodeWithLabel:label code:RETROK_t]; }
- else if ([label isEqualToString:@"A"]) { return [self createCodeWithLabel:label code:RETROK_a]; }
- else if ([label isEqualToString:@"S"]) { return [self createCodeWithLabel:label code:RETROK_s]; }
- else if ([label isEqualToString:@"D"]) { return [self createCodeWithLabel:label code:RETROK_d]; }
- else if ([label isEqualToString:@"F"]) { return [self createCodeWithLabel:label code:RETROK_f]; }
- else if ([label isEqualToString:@"G"]) { return [self createCodeWithLabel:label code:RETROK_g]; }
- else if ([label isEqualToString:@"Z"]) { return [self createCodeWithLabel:label code:RETROK_z]; }
- else if ([label isEqualToString:@"X"]) { return [self createCodeWithLabel:label code:RETROK_x]; }
- else if ([label isEqualToString:@"C"]) { return [self createCodeWithLabel:label code:RETROK_c]; }
- else if ([label isEqualToString:@"V"]) { return [self createCodeWithLabel:label code:RETROK_v]; }
- else if ([label isEqualToString:@"B"]) { return [self createCodeWithLabel:label code:RETROK_b]; }
- else if ([label isEqualToString:@"FN"]) { return [self createCodeWithLabel:label code:9000]; }
- else if ([label isEqualToString:@"LSHIFT"]) { return [self createCodeWithLabel:label code:RETROK_LSHIFT]; }
- else if ([label isEqualToString:@"LCTRL"]) { return [self createCodeWithLabel:label code:RETROK_LCTRL]; }
- else if ([label isEqualToString:@"LALT"]) { return [self createCodeWithLabel:label code:RETROK_LALT]; }
- else if ([label isEqualToString:@"F1"]) { return [self createCodeWithLabel:label code:RETROK_F1]; }
- else if ([label isEqualToString:@"F2"]) { return [self createCodeWithLabel:label code:RETROK_F2]; }
- else if ([label isEqualToString:@"F3"]) { return [self createCodeWithLabel:label code:RETROK_F3]; }
- else if ([label isEqualToString:@"F4"]) { return [self createCodeWithLabel:label code:RETROK_F4]; }
- else if ([label isEqualToString:@"F5"]) { return [self createCodeWithLabel:label code:RETROK_F5]; }
- else if ([label isEqualToString:@"-"]) { return [self createCodeWithLabel:label code:RETROK_MINUS]; }
- else if ([label isEqualToString:@"="]) { return [self createCodeWithLabel:label code:RETROK_EQUALS]; }
- else if ([label isEqualToString:@"/"]) { return [self createCodeWithLabel:label code:RETROK_SLASH]; }
- else if ([label isEqualToString:@"["]) { return [self createCodeWithLabel:label code:RETROK_LEFTBRACKET]; }
- else if ([label isEqualToString:@"]"]) { return [self createCodeWithLabel:label code:RETROK_RIGHTBRACKET]; }
- else if ([label isEqualToString:@";"]) { return [self createCodeWithLabel:label code:RETROK_SEMICOLON]; }
- else if ([label isEqualToString:@"~"]) { return [self createCodeWithLabel:label code:RETROK_TILDE]; }
- else if ([label isEqualToString:@":"]) { return [self createCodeWithLabel:label code:RETROK_COLON]; }
- else if ([label isEqualToString:@"?"]) { return [self createCodeWithLabel:label code:RETROK_QUESTION]; }
- else if ([label isEqualToString:@"!"]) { return [self createCodeWithLabel:label code:RETROK_EXCLAIM]; }
- else if ([label isEqualToString:@"RSHIFT"]) { return [self createCodeWithLabel:label code:RETROK_RSHIFT]; }
- else if ([label isEqualToString:@"RCTRL"]) { return [self createCodeWithLabel:label code:RETROK_RCTRL]; }
- else if ([label isEqualToString:@"RALT"]) { return [self createCodeWithLabel:label code:RETROK_RALT]; }
else if ([label isEqualToString:@"6"]) { return [self createCodeWithLabel:label code:RETROK_6]; }
else if ([label isEqualToString:@"7"]) { return [self createCodeWithLabel:label code:RETROK_7]; }
else if ([label isEqualToString:@"8"]) { return [self createCodeWithLabel:label code:RETROK_8]; }
else if ([label isEqualToString:@"9"]) { return [self createCodeWithLabel:label code:RETROK_9]; }
else if ([label isEqualToString:@"0"]) { return [self createCodeWithLabel:label code:RETROK_0]; }
- else if ([label isEqualToString:@"Y"]) { return [self createCodeWithLabel:label code:RETROK_y]; }
- else if ([label isEqualToString:@"U"]) { return [self createCodeWithLabel:label code:RETROK_u]; }
- else if ([label isEqualToString:@"I"]) { return [self createCodeWithLabel:label code:RETROK_i]; }
- else if ([label isEqualToString:@"O"]) { return [self createCodeWithLabel:label code:RETROK_o]; }
- else if ([label isEqualToString:@"P"]) { return [self createCodeWithLabel:label code:RETROK_p]; }
- else if ([label isEqualToString:@"H"]) { return [self createCodeWithLabel:label code:RETROK_h]; }
- else if ([label isEqualToString:@"J"]) { return [self createCodeWithLabel:label code:RETROK_j]; }
- else if ([label isEqualToString:@"K"]) { return [self createCodeWithLabel:label code:RETROK_k]; }
- else if ([label isEqualToString:@"L"]) { return [self createCodeWithLabel:label code:RETROK_l]; }
- else if ([label isEqualToString:@"'"]) { return [self createCodeWithLabel:label code:RETROK_QUOTE]; }
- else if ([label isEqualToString:@"N"]) { return [self createCodeWithLabel:label code:RETROK_n]; }
- else if ([label isEqualToString:@"M"]) { return [self createCodeWithLabel:label code:RETROK_m]; }
- else if ([label isEqualToString:@","]) { return [self createCodeWithLabel:label code:RETROK_COMMA]; }
- else if ([label isEqualToString:@"."]) { return [self createCodeWithLabel:label code:RETROK_PERIOD]; }
- else if ([label isEqualToString:@"BKSPC"]) { return [self createCodeWithLabel:label code:RETROK_BACKSPACE]; }
- else if ([label isEqualToString:@"TAB"]) { return [self createCodeWithLabel:label code:RETROK_TAB]; }
- else if ([label isEqualToString:@"RETURN"]) { return [self createCodeWithLabel:label code:RETROK_RETURN]; }
- else if ([label isEqualToString:@"F6"]) { return [self createCodeWithLabel:label code:RETROK_F6]; }
- else if ([label isEqualToString:@"F7"]) { return [self createCodeWithLabel:label code:RETROK_F7]; }
- else if ([label isEqualToString:@"F8"]) { return [self createCodeWithLabel:label code:RETROK_F8]; }
- else if ([label isEqualToString:@"F9"]) { return [self createCodeWithLabel:label code:RETROK_F9]; }
- else if ([label isEqualToString:@"F10"]) { return [self createCodeWithLabel:label code:RETROK_F10]; }
- else if ([label isEqualToString:@"PAGEUP"]) { return [self createCodeWithLabel:label code:RETROK_PAGEUP]; }
- else if ([label isEqualToString:@"HOME"]) { return [self createCodeWithLabel:label code:RETROK_HOME]; }
- else if ([label isEqualToString:@"INS"]) { return [self createCodeWithLabel:label code:RETROK_INSERT]; }
- else if ([label isEqualToString:@"END"]) { return [self createCodeWithLabel:label code:RETROK_END]; }
- else if ([label isEqualToString:@"PAGEDWN"]) { return [self createCodeWithLabel:label code:RETROK_PAGEDOWN]; }
- else if ([label isEqualToString:@"F11"]) { return [self createCodeWithLabel:label code:RETROK_F11]; }
- else if ([label isEqualToString:@"⬆️"]) { return [self createCodeWithLabel:label code:RETROK_UP]; }
- else if ([label isEqualToString:@"F12"]) { return [self createCodeWithLabel:label code:RETROK_F12]; }
- else if ([label isEqualToString:@"⬅️"]) { return [self createCodeWithLabel:label code:RETROK_LEFT]; }
- else if ([label isEqualToString:@"⬇️"]) { return [self createCodeWithLabel:label code:RETROK_DOWN]; }
- else if ([label isEqualToString:@"➡️"]) { return [self createCodeWithLabel:label code:RETROK_RIGHT]; }
- else if ([label isEqualToString:@"DEL"]) { return [self createCodeWithLabel:label code:RETROK_DELETE]; }
- else if ([label isEqualToString:@"SPACE"]) { return [self createCodeWithLabel:label code:RETROK_SPACE]; }
- else if ([label isEqualToString:@"ESC"]) { return [self createCodeWithLabel:label code:RETROK_ESCAPE]; }
- else if ([label isEqualToString:@"RETURN"]) { return [self createCodeWithLabel:label code:RETROK_RETURN]; }
+ else if ([label isEqualToString:@"a"]) { return [self createCodeWithLabel:label code:RETROK_a]; }
+ else if ([label isEqualToString:@"b"]) { return [self createCodeWithLabel:label code:RETROK_b]; }
+ else if ([label isEqualToString:@"c"]) { return [self createCodeWithLabel:label code:RETROK_c]; }
+ else if ([label isEqualToString:@"d"]) { return [self createCodeWithLabel:label code:RETROK_d]; }
+ else if ([label isEqualToString:@"e"]) { return [self createCodeWithLabel:label code:RETROK_e]; }
+ else if ([label isEqualToString:@"f"]) { return [self createCodeWithLabel:label code:RETROK_f]; }
+ else if ([label isEqualToString:@"g"]) { return [self createCodeWithLabel:label code:RETROK_g]; }
+ else if ([label isEqualToString:@"h"]) { return [self createCodeWithLabel:label code:RETROK_h]; }
+ else if ([label isEqualToString:@"i"]) { return [self createCodeWithLabel:label code:RETROK_i]; }
+ else if ([label isEqualToString:@"j"]) { return [self createCodeWithLabel:label code:RETROK_j]; }
+ else if ([label isEqualToString:@"k"]) { return [self createCodeWithLabel:label code:RETROK_k]; }
+ else if ([label isEqualToString:@"l"]) { return [self createCodeWithLabel:label code:RETROK_l]; }
+ else if ([label isEqualToString:@"m"]) { return [self createCodeWithLabel:label code:RETROK_m]; }
+ else if ([label isEqualToString:@"n"]) { return [self createCodeWithLabel:label code:RETROK_n]; }
+ else if ([label isEqualToString:@"o"]) { return [self createCodeWithLabel:label code:RETROK_o]; }
+ else if ([label isEqualToString:@"p"]) { return [self createCodeWithLabel:label code:RETROK_p]; }
+ else if ([label isEqualToString:@"q"]) { return [self createCodeWithLabel:label code:RETROK_q]; }
+ else if ([label isEqualToString:@"r"]) { return [self createCodeWithLabel:label code:RETROK_r]; }
+ else if ([label isEqualToString:@"s"]) { return [self createCodeWithLabel:label code:RETROK_s]; }
+ else if ([label isEqualToString:@"t"]) { return [self createCodeWithLabel:label code:RETROK_t]; }
+ else if ([label isEqualToString:@"u"]) { return [self createCodeWithLabel:label code:RETROK_u]; }
+ else if ([label isEqualToString:@"v"]) { return [self createCodeWithLabel:label code:RETROK_v]; }
+ else if ([label isEqualToString:@"w"]) { return [self createCodeWithLabel:label code:RETROK_w]; }
+ else if ([label isEqualToString:@"x"]) { return [self createCodeWithLabel:label code:RETROK_x]; }
+ else if ([label isEqualToString:@"y"]) { return [self createCodeWithLabel:label code:RETROK_y]; }
+ else if ([label isEqualToString:@"z"]) { return [self createCodeWithLabel:label code:RETROK_z]; }
+ else if ([label isEqualToString:@"f1"]) { return [self createCodeWithLabel:label code:RETROK_F1]; }
+ else if ([label isEqualToString:@"f2"]) { return [self createCodeWithLabel:label code:RETROK_F2]; }
+ else if ([label isEqualToString:@"f3"]) { return [self createCodeWithLabel:label code:RETROK_F3]; }
+ else if ([label isEqualToString:@"f4"]) { return [self createCodeWithLabel:label code:RETROK_F4]; }
+ else if ([label isEqualToString:@"f5"]) { return [self createCodeWithLabel:label code:RETROK_F5]; }
+ else if ([label isEqualToString:@"f6"]) { return [self createCodeWithLabel:label code:RETROK_F6]; }
+ else if ([label isEqualToString:@"f7"]) { return [self createCodeWithLabel:label code:RETROK_F7]; }
+ else if ([label isEqualToString:@"f8"]) { return [self createCodeWithLabel:label code:RETROK_F8]; }
+ else if ([label isEqualToString:@"f9"]) { return [self createCodeWithLabel:label code:RETROK_F9]; }
+ else if ([label isEqualToString:@"f10"]) { return [self createCodeWithLabel:label code:RETROK_F10]; }
+ else if ([label isEqualToString:@"f11"]) { return [self createCodeWithLabel:label code:RETROK_F11]; }
+ else if ([label isEqualToString:@"f12"]) { return [self createCodeWithLabel:label code:RETROK_F12]; }
+ else if ([label isEqualToString:@"escape"]) { return [self createCodeWithLabel:label code:RETROK_ESCAPE]; }
+ else if ([label isEqualToString:@"backspace"]) { return [self createCodeWithLabel:label code:RETROK_BACKSPACE]; }
+ else if ([label isEqualToString:@"backquote"]) { return [self createCodeWithLabel:label code:RETROK_BACKQUOTE]; }
+ else if ([label isEqualToString:@"minus"]) { return [self createCodeWithLabel:label code:RETROK_MINUS]; }
+ else if ([label isEqualToString:@"equals"]) { return [self createCodeWithLabel:label code:RETROK_EQUALS]; }
+ else if ([label isEqualToString:@"insert"]) { return [self createCodeWithLabel:label code:RETROK_INSERT]; }
+ else if ([label isEqualToString:@"home"]) { return [self createCodeWithLabel:label code:RETROK_HOME]; }
+ else if ([label isEqualToString:@"end"]) { return [self createCodeWithLabel:label code:RETROK_END]; }
+ else if ([label isEqualToString:@"pageup"]) { return [self createCodeWithLabel:label code:RETROK_PAGEUP]; }
+ else if ([label isEqualToString:@"pagedown"]) { return [self createCodeWithLabel:label code:RETROK_PAGEDOWN]; }
+ else if ([label isEqualToString:@"print"]) { return [self createCodeWithLabel:label code:RETROK_PRINT]; }
+ else if ([label isEqualToString:@"scrolllock"]) { return [self createCodeWithLabel:label code:RETROK_SCROLLOCK]; }
+ else if ([label isEqualToString:@"pause"]) { return [self createCodeWithLabel:label code:RETROK_PAUSE]; }
+ else if ([label isEqualToString:@"delete"]) { return [self createCodeWithLabel:label code:RETROK_DELETE]; }
+ else if ([label isEqualToString:@"tab"]) { return [self createCodeWithLabel:label code:RETROK_TAB]; }
+ else if ([label isEqualToString:@"backslash"]) { return [self createCodeWithLabel:label code:RETROK_BACKSLASH]; }
+ else if ([label isEqualToString:@"rightbracket"]) { return [self createCodeWithLabel:label code:RETROK_RIGHTBRACKET]; }
+ else if ([label isEqualToString:@"leftbracket"]) { return [self createCodeWithLabel:label code:RETROK_LEFTBRACKET]; }
+ else if ([label isEqualToString:@"capslock"]) { return [self createCodeWithLabel:label code:RETROK_CAPSLOCK]; }
+ else if ([label isEqualToString:@"quote"]) { return [self createCodeWithLabel:label code:RETROK_QUOTE]; }
+ else if ([label isEqualToString:@"semicolon"]) { return [self createCodeWithLabel:label code:RETROK_SEMICOLON]; }
+ else if ([label isEqualToString:@"return"]) { return [self createCodeWithLabel:label code:RETROK_RETURN]; }
+ else if ([label isEqualToString:@"shift"]) { return [self createCodeWithLabel:label code:RETROK_LSHIFT]; }
+ else if ([label isEqualToString:@"lshift"]) { return [self createCodeWithLabel:label code:RETROK_LSHIFT]; }
+ else if ([label isEqualToString:@"rshift"]) { return [self createCodeWithLabel:label code:RETROK_RSHIFT]; }
+ else if ([label isEqualToString:@"period"]) { return [self createCodeWithLabel:label code:RETROK_PERIOD]; }
+ else if ([label isEqualToString:@"slash"]) { return [self createCodeWithLabel:label code:RETROK_SLASH]; }
+ else if ([label isEqualToString:@"comma"]) { return [self createCodeWithLabel:label code:RETROK_COMMA]; }
+ else if ([label isEqualToString:@"up"]) { return [self createCodeWithLabel:label code:RETROK_UP]; }
+ else if ([label isEqualToString:@"ctrl"]) { return [self createCodeWithLabel:label code:RETROK_LCTRL]; }
+ else if ([label isEqualToString:@"lctrl"]) { return [self createCodeWithLabel:label code:RETROK_LCTRL]; }
+ else if ([label isEqualToString:@"rctrl"]) { return [self createCodeWithLabel:label code:RETROK_RCTRL]; }
+ else if ([label isEqualToString:@"meta"]) { return [self createCodeWithLabel:label code:RETROK_LMETA]; }
+ else if ([label isEqualToString:@"lmeta"]) { return [self createCodeWithLabel:label code:RETROK_LMETA]; }
+ else if ([label isEqualToString:@"rmeta"]) { return [self createCodeWithLabel:label code:RETROK_RMETA]; }
+ else if ([label isEqualToString:@"alt"]) { return [self createCodeWithLabel:label code:RETROK_LALT]; }
+ else if ([label isEqualToString:@"lalt"]) { return [self createCodeWithLabel:label code:RETROK_LALT]; }
+ else if ([label isEqualToString:@"ralt"]) { return [self createCodeWithLabel:label code:RETROK_RALT]; }
+ else if ([label isEqualToString:@"space"]) { return [self createCodeWithLabel:label code:RETROK_SPACE]; }
+ else if ([label isEqualToString:@"down"]) { return [self createCodeWithLabel:label code:RETROK_DOWN]; }
+ else if ([label isEqualToString:@"left"]) { return [self createCodeWithLabel:label code:RETROK_LEFT]; }
+ else if ([label isEqualToString:@"right"]) { return [self createCodeWithLabel:label code:RETROK_RIGHT]; }
return nil;
}
diff --git a/ManicEmu/ManicEmu.xcodeproj/project.pbxproj b/ManicEmu/ManicEmu.xcodeproj/project.pbxproj
index 9286fbef..35c59547 100644
--- a/ManicEmu/ManicEmu.xcodeproj/project.pbxproj
+++ b/ManicEmu/ManicEmu.xcodeproj/project.pbxproj
@@ -83,6 +83,10 @@
5726FEF22D720B8800041AD5 /* ColorfulX in Frameworks */ = {isa = PBXBuildFile; productRef = 5726FEF12D720B8800041AD5 /* ColorfulX */; };
5726FF462D741F5C00041AD5 /* ColorfulX in Frameworks */ = {isa = PBXBuildFile; productRef = 5726FF452D741F5C00041AD5 /* ColorfulX */; };
5726FF812D74AC9D00041AD5 /* RoundAndBorderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5726FF802D74AC8D00041AD5 /* RoundAndBorderView.swift */; };
+ 572C5C642F6C30CE00776F8C /* LibretroDisk.h in Headers */ = {isa = PBXBuildFile; fileRef = 572C5C622F6C30CE00776F8C /* LibretroDisk.h */; };
+ 572C5C652F6C30CE00776F8C /* LibretroDisk.m in Sources */ = {isa = PBXBuildFile; fileRef = 572C5C632F6C30CE00776F8C /* LibretroDisk.m */; };
+ 572C5CB42F6E983600776F8C /* J2MENetworkBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 572C5CB32F6E983600776F8C /* J2MENetworkBridge.swift */; };
+ 572C5CD52F6EDB9200776F8C /* LetterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 572C5CD32F6EDB8800776F8C /* LetterView.swift */; };
57399AC52E40ACE100AB73DD /* PSXSBIImportViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57399AC42E40ACCF00AB73DD /* PSXSBIImportViewController.swift */; };
57399AC82E40AFBA00AB73DD /* PSXSBICollectionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57399AC72E40AFB100AB73DD /* PSXSBICollectionCell.swift */; };
57399ACF2E40BB4D00AB73DD /* PSXSBIDescCollectionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57399ACE2E40BB4400AB73DD /* PSXSBIDescCollectionCell.swift */; };
@@ -105,6 +109,11 @@
573CEEA52F23405F00EA24F1 /* prosystem.libretro.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 573CEE9B2F23403100EA24F1 /* prosystem.libretro.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
573CEEA82F23407500EA24F1 /* holani.libretro.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 573CEE9A2F23403100EA24F1 /* holani.libretro.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
573CEEAB2F23408400EA24F1 /* virtualjaguar.libretro.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 573CEE9D2F23403100EA24F1 /* virtualjaguar.libretro.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
+ 573DE1882F6AA3B20091CE59 /* LibretroCoreOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 573DE1872F6AA3B20091CE59 /* LibretroCoreOptions.m */; };
+ 573DE1892F6AA3B20091CE59 /* LibretroCoreOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 573DE1862F6AA3B20091CE59 /* LibretroCoreOptions.h */; };
+ 573DE1A72F6AF6C70091CE59 /* ZipHandlerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 573DE1A52F6AF6AA0091CE59 /* ZipHandlerView.swift */; };
+ 573DE1B72F6B97660091CE59 /* CoreConfigsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 573DE1B52F6B97610091CE59 /* CoreConfigsView.swift */; };
+ 573DE1BB2F6BA55E0091CE59 /* CoreConfigsOptionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 573DE1BA2F6BA55B0091CE59 /* CoreConfigsOptionView.swift */; };
5744C6622E34D6E20088081A /* KeyboardKit in Frameworks */ = {isa = PBXBuildFile; productRef = 5744C6612E34D6E20088081A /* KeyboardKit */; };
5744C6CF2E360AF00088081A /* UIControllerKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5744C6CE2E360AD50088081A /* UIControllerKit.swift */; };
5744C6FF2E368BB40088081A /* NoControllCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5744C6FE2E368BA50088081A /* NoControllCollectionView.swift */; };
@@ -621,6 +630,8 @@
5781F4EB2EEFE44F00916D8B /* NumbersExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5781F4E92EEFE44800916D8B /* NumbersExtensions.swift */; };
5781F5462EF1384500916D8B /* EmulatorInteractionKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5781F5442EF1383F00916D8B /* EmulatorInteractionKit.swift */; };
5781F5AE2EF45C8200916D8B /* JGenesisView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5781F5AB2EF45C6900916D8B /* JGenesisView.swift */; };
+ 578452BA2F6A79370020A88F /* DOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 578452B92F6A79340020A88F /* DOS.swift */; };
+ 578452C02F6A7F500020A88F /* dosbox.pure.libretro.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 578452BE2F6A7F380020A88F /* dosbox.pure.libretro.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
578F287E2F37805000D2D998 /* WFCSettingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 578F287C2F37804600D2D998 /* WFCSettingViewController.swift */; };
578F28832F3780BC00D2D998 /* WFCSettingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 578F28812F3780B700D2D998 /* WFCSettingView.swift */; };
578F288E2F37838300D2D998 /* OnlinePlayCollectionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 578F288C2F37837B00D2D998 /* OnlinePlayCollectionCell.swift */; };
@@ -900,6 +911,8 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
+ 578452C02F6A7F500020A88F /* dosbox.pure.libretro.framework in Embed Frameworks */,
+ D90358FF409D7405F5E406CC /* prboom.libretro.framework in Embed Frameworks */,
573CEEAB2F23408400EA24F1 /* virtualjaguar.libretro.framework in Embed Frameworks */,
573CEEA82F23407500EA24F1 /* holani.libretro.framework in Embed Frameworks */,
573CEEA52F23405F00EA24F1 /* prosystem.libretro.framework in Embed Frameworks */,
@@ -932,7 +945,6 @@
57BFBE732DD3361800AABF98 /* ppsspp.libretro.framework in Embed Frameworks */,
57BFBE1E2DD32F7700AABF98 /* Libretro.framework in Embed Frameworks */,
5768FE6C2DAE018E009974D1 /* MoltenVK.xcframework in Embed Frameworks */,
- D90358FF409D7405F5E406CC /* prboom.libretro.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
@@ -1041,6 +1053,10 @@
5726FEDC2D71BEF900041AD5 /* SettingsItemCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsItemCollectionViewCell.swift; sourceTree = "<group>"; };
5726FEE62D71D7F100041AD5 /* SettingsListFooterCollectionReusableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsListFooterCollectionReusableView.swift; sourceTree = "<group>"; };
5726FF802D74AC8D00041AD5 /* RoundAndBorderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoundAndBorderView.swift; sourceTree = "<group>"; };
+ 572C5C622F6C30CE00776F8C /* LibretroDisk.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LibretroDisk.h; sourceTree = "<group>"; };
+ 572C5C632F6C30CE00776F8C /* LibretroDisk.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LibretroDisk.m; sourceTree = "<group>"; };
+ 572C5CB32F6E983600776F8C /* J2MENetworkBridge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = J2MENetworkBridge.swift; sourceTree = "<group>"; };
+ 572C5CD32F6EDB8800776F8C /* LetterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterView.swift; sourceTree = "<group>"; };
57399AC42E40ACCF00AB73DD /* PSXSBIImportViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PSXSBIImportViewController.swift; sourceTree = "<group>"; };
57399AC72E40AFB100AB73DD /* PSXSBICollectionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PSXSBICollectionCell.swift; sourceTree = "<group>"; };
57399ACE2E40BB4400AB73DD /* PSXSBIDescCollectionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PSXSBIDescCollectionCell.swift; sourceTree = "<group>"; };
@@ -1063,6 +1079,11 @@
573CEE9B2F23403100EA24F1 /* prosystem.libretro.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = prosystem.libretro.framework; path = ../Cores/prosystem.libretro.framework; sourceTree = SOURCE_ROOT; };
573CEE9C2F23403100EA24F1 /* stella.libretro.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = stella.libretro.framework; path = ../Cores/stella.libretro.framework; sourceTree = SOURCE_ROOT; };
573CEE9D2F23403100EA24F1 /* virtualjaguar.libretro.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = virtualjaguar.libretro.framework; path = ../Cores/virtualjaguar.libretro.framework; sourceTree = SOURCE_ROOT; };
+ 573DE1862F6AA3B20091CE59 /* LibretroCoreOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LibretroCoreOptions.h; sourceTree = "<group>"; };
+ 573DE1872F6AA3B20091CE59 /* LibretroCoreOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LibretroCoreOptions.m; sourceTree = "<group>"; };
+ 573DE1A52F6AF6AA0091CE59 /* ZipHandlerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZipHandlerView.swift; sourceTree = "<group>"; };
+ 573DE1B52F6B97610091CE59 /* CoreConfigsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreConfigsView.swift; sourceTree = "<group>"; };
+ 573DE1BA2F6BA55B0091CE59 /* CoreConfigsOptionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreConfigsOptionView.swift; sourceTree = "<group>"; };
5744C6CE2E360AD50088081A /* UIControllerKit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIControllerKit.swift; sourceTree = "<group>"; };
5744C6FE2E368BA50088081A /* NoControllCollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoControllCollectionView.swift; sourceTree = "<group>"; };
5744C7172E375BF00088081A /* PM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PM.swift; sourceTree = "<group>"; };
@@ -1746,6 +1767,8 @@
5781F4E92EEFE44800916D8B /* NumbersExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NumbersExtensions.swift; sourceTree = "<group>"; };
5781F5442EF1383F00916D8B /* EmulatorInteractionKit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmulatorInteractionKit.swift; sourceTree = "<group>"; };
5781F5AB2EF45C6900916D8B /* JGenesisView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JGenesisView.swift; sourceTree = "<group>"; };
+ 578452B92F6A79340020A88F /* DOS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DOS.swift; sourceTree = "<group>"; };
+ 578452BE2F6A7F380020A88F /* dosbox.pure.libretro.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = dosbox.pure.libretro.framework; path = ../Cores/dosbox.pure.libretro.framework; sourceTree = SOURCE_ROOT; };
578F287C2F37804600D2D998 /* WFCSettingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WFCSettingViewController.swift; sourceTree = "<group>"; };
578F28812F3780B700D2D998 /* WFCSettingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WFCSettingView.swift; sourceTree = "<group>"; };
578F288C2F37837B00D2D998 /* OnlinePlayCollectionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnlinePlayCollectionCell.swift; sourceTree = "<group>"; };
@@ -3947,6 +3970,8 @@
57913B432D5ED727004D51AA /* VIews */ = {
isa = PBXGroup;
children = (
+ 573DE1BA2F6BA55B0091CE59 /* CoreConfigsOptionView.swift */,
+ 573DE1B52F6B97610091CE59 /* CoreConfigsView.swift */,
57F3BAEA2F6541AB00ABF4B3 /* J2MESettingView.swift */,
57399ACE2E40BB4400AB73DD /* PSXSBIDescCollectionCell.swift */,
57399AC72E40AFB100AB73DD /* PSXSBICollectionCell.swift */,
@@ -4013,6 +4038,10 @@
570CF8332EEA58DE00696C1B /* AzaharKeyboardConfig.m */,
5781F4542EECF7CF00916D8B /* LibretroShaders.h */,
5781F4552EECF7CF00916D8B /* LibretroShaders.m */,
+ 573DE1862F6AA3B20091CE59 /* LibretroCoreOptions.h */,
+ 573DE1872F6AA3B20091CE59 /* LibretroCoreOptions.m */,
+ 572C5C622F6C30CE00776F8C /* LibretroDisk.h */,
+ 572C5C632F6C30CE00776F8C /* LibretroDisk.m */,
575AD5812F24902F00C2B7E4 /* LibretroKeyboardCode.h */,
575AD5822F24902F00C2B7E4 /* LibretroKeyboardCode.m */,
57BFBE642DD3330900AABF98 /* keyboard_event_apple.h */,
@@ -4040,6 +4069,7 @@
57BFBE702DD335FD00AABF98 /* Cores */ = {
isa = PBXGroup;
children = (
+ 578452BE2F6A7F380020A88F /* dosbox.pure.libretro.framework */,
573CEE992F23403100EA24F1 /* atari800.libretro.framework */,
573CEE9A2F23403100EA24F1 /* holani.libretro.framework */,
573CEE9B2F23403100EA24F1 /* prosystem.libretro.framework */,
@@ -4280,6 +4310,7 @@
57F0D8402DE2CD7500760F57 /* Cores */ = {
isa = PBXGroup;
children = (
+ 578452B92F6A79340020A88F /* DOS.swift */,
57J2ME01F23397000EA24F1 /* J2ME.swift */,
2068D6E791D56FF6148997EA /* DOOM.swift */,
573CEE952F23396C00EA24F1 /* Lynx.swift */,
@@ -4389,8 +4420,10 @@
A561F94D257DCB5200E800A8 /* Views */ = {
isa = PBXGroup;
children = (
+ 572C5CD32F6EDB8800776F8C /* LetterView.swift */,
57AEB9DA2F2614BF005CB496 /* NavigationBlurView.swift */,
573CEE0C2F20D05100EA24F1 /* RomPatcherView.swift */,
+ 572C5CB32F6E983600776F8C /* J2MENetworkBridge.swift */,
57DC7FF32F52E92B004B6FFD /* J2MEView.swift */,
5781F5AB2EF45C6900916D8B /* JGenesisView.swift */,
57EED0752ECB8172003971BD /* IconView.swift */,
@@ -4539,6 +4572,7 @@
5771C1A72E6207650062EDE0 /* MobyGamesKit.swift */,
5744C6CE2E360AD50088081A /* UIControllerKit.swift */,
57DCE8552E0FC9B60079E3AA /* CoreSelectionView.swift */,
+ 573DE1A52F6AF6AA0091CE59 /* ZipHandlerView.swift */,
57DCE7DA2E0D385E0079E3AA /* INIFile.swift */,
57655C252DF6BCE3003E4A6E /* PlatformSelectionView.swift */,
575A39CD2DCD00FE00B28FC2 /* OnlineCoverManager.swift */,
@@ -4683,7 +4717,9 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
+ 573DE1892F6AA3B20091CE59 /* LibretroCoreOptions.h in Headers */,
57BFBE5B2DD332A100AABF98 /* LibretroCore.h in Headers */,
+ 572C5C642F6C30CE00776F8C /* LibretroDisk.h in Headers */,
575AD5832F24902F00C2B7E4 /* LibretroKeyboardCode.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -5315,6 +5351,7 @@
57BFBE6B2DD3331A00AABF98 /* griffin_glslang.cpp in Sources */,
5781F4572EECF7CF00916D8B /* LibretroShaders.m in Sources */,
575AD5842F24902F00C2B7E4 /* LibretroKeyboardCode.m in Sources */,
+ 572C5C652F6C30CE00776F8C /* LibretroDisk.m in Sources */,
57BFBE6C2DD3331A00AABF98 /* griffin_cpp.cpp in Sources */,
57BFBE6E2DD3331A00AABF98 /* griffin_objc.m in Sources */,
57BFBE5F2DD332DA00AABF98 /* LibretroCore.m in Sources */,
@@ -5322,6 +5359,7 @@
5720E7A32E541BF500EC0DA5 /* CheevosBridge.m in Sources */,
57BFBE522DD3328500AABF98 /* JITSupport.m in Sources */,
570CF8352EEA58DE00696C1B /* AzaharKeyboardConfig.m in Sources */,
+ 573DE1882F6AA3B20091CE59 /* LibretroCoreOptions.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -5330,6 +5368,7 @@
buildActionMask = 2147483647;
files = (
57E48D932D8D73AD008000A3 /* CheersView.swift in Sources */,
+ 573DE1B72F6B97660091CE59 /* CoreConfigsView.swift in Sources */,
577005B32D3E6F1600762E8F /* ImportServiceListView.swift in Sources */,
57C8A11A2DF2BA3E00593F82 /* SNES.swift in Sources */,
57DCE7D72E0D2EFC0079E3AA /* CitraAdvancedSettingViewController.swift in Sources */,
@@ -5410,6 +5449,7 @@
5754D8882E274AA5001EA5ED /* OnlinePlaySettingViewController.swift in Sources */,
5781F4612EED62E200916D8B /* ShadersListCell.swift in Sources */,
5770069C2D44BDEA00762E8F /* GameCollectionViewCell.swift in Sources */,
+ 572C5CD52F6EDB9200776F8C /* LetterView.swift in Sources */,
577005782D3D60B700762E8F /* GameCheat.swift in Sources */,
574ABEBC2E609FE60045F76E /* GBA.swift in Sources */,
5754D8932E2751CA001EA5ED /* WFC.swift in Sources */,
@@ -5445,6 +5485,7 @@
574789BD2D4F8769006F0D99 /* SectionIndexViewItemIndicator.swift in Sources */,
57CCB3FF2D69B4050036476B /* ContextMenuButton.swift in Sources */,
576F0E052D88006300D2A1BA /* GameSavePurchaseGuideView.swift in Sources */,
+ 572C5CB42F6E983600776F8C /* J2MENetworkBridge.swift in Sources */,
57D7CF592EA78B2B00F41540 /* TriggerProPreviewController.swift in Sources */,
570F591C2DC70843007BFD92 /* Theme.swift in Sources */,
574789BE2D4F8769006F0D99 /* SectionIndexViewItem.swift in Sources */,
@@ -5532,8 +5573,10 @@
57DCE80B2E0D9F300079E3AA /* Subtitle.swift in Sources */,
57DCE80C2E0D9F300079E3AA /* Row.swift in Sources */,
5754D8962E2752C6001EA5ED /* ExtraKey.swift in Sources */,
+ 578452BA2F6A79370020A88F /* DOS.swift in Sources */,
57DCE80D2E0D9F300079E3AA /* Reusable.swift in Sources */,
57DCE80E2E0D9F300079E3AA /* RadioSection.swift in Sources */,
+ 573DE1BB2F6BA55E0091CE59 /* CoreConfigsOptionView.swift in Sources */,
57DCE80F2E0D9F300079E3AA /* TapActionCell.swift in Sources */,
57F0D81A2DE1C2D700760F57 /* GameListStyleCollectionViewCell.swift in Sources */,
573CEE122F20D46D00EA24F1 /* LocalWebServer.swift in Sources */,
@@ -5684,6 +5727,7 @@
577005452D3C91F300762E8F /* AddImportServiceViewController.swift in Sources */,
570F59C02DC91FF5007BFD92 /* ColorPickerView.swift in Sources */,
57B6ECBD2D7953EC002E619C /* CheatCodeListView.swift in Sources */,
+ 573DE1A72F6AF6C70091CE59 /* ZipHandlerView.swift in Sources */,
5781F4892EEE591500916D8B /* ShaderInfoAppendCell.swift in Sources */,
5726FEE72D71D7FA00041AD5 /* SettingsListFooterCollectionReusableView.swift in Sources */,
57F632B72D700A06007270E8 /* LanServiceEditCollectionViewCell.swift in Sources */,
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/brand/doom_group_brand.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/brand/doom_group_brand.imageset/[email protected]
index 0707d01c..e54f7137 100644
Binary files a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/brand/doom_group_brand.imageset/[email protected] and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/brand/doom_group_brand.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/brand/doom_group_brand.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/brand/doom_group_brand.imageset/[email protected]
index 2f3d72b3..899b2a20 100644
Binary files a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/brand/doom_group_brand.imageset/[email protected] and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/brand/doom_group_brand.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/brand/dos_group_brand.imageset/Contents.json b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/brand/dos_group_brand.imageset/Contents.json
new file mode 100644
index 00000000..7d70e25a
--- /dev/null
+++ b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/brand/dos_group_brand.imageset/Contents.json
@@ -0,0 +1,22 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/brand/dos_group_brand.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/brand/dos_group_brand.imageset/[email protected]
new file mode 100644
index 00000000..c5d8d2dd
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/brand/dos_group_brand.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/brand/dos_group_brand.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/brand/dos_group_brand.imageset/[email protected]
new file mode 100644
index 00000000..b223bb0f
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/brand/dos_group_brand.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/doom_cover_h.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/doom_cover_h.imageset/[email protected]
index 74a78638..235a5b46 100644
Binary files a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/doom_cover_h.imageset/[email protected] and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/doom_cover_h.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/doom_cover_h.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/doom_cover_h.imageset/[email protected]
index 9ab47507..fd9e1f25 100644
Binary files a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/doom_cover_h.imageset/[email protected] and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/doom_cover_h.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/doom_cover_v.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/doom_cover_v.imageset/[email protected]
index 8619f296..1fc39546 100644
Binary files a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/doom_cover_v.imageset/[email protected] and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/doom_cover_v.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/doom_cover_v.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/doom_cover_v.imageset/[email protected]
index 175ef02b..da4d10c1 100644
Binary files a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/doom_cover_v.imageset/[email protected] and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/doom_cover_v.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/dos_cover_h.imageset/Contents.json b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/dos_cover_h.imageset/Contents.json
new file mode 100644
index 00000000..44895811
--- /dev/null
+++ b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/dos_cover_h.imageset/Contents.json
@@ -0,0 +1,22 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/dos_cover_h.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/dos_cover_h.imageset/[email protected]
new file mode 100644
index 00000000..47efde3b
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/dos_cover_h.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/dos_cover_h.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/dos_cover_h.imageset/[email protected]
new file mode 100644
index 00000000..6e781b2e
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/dos_cover_h.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/dos_cover_v.imageset/Contents.json b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/dos_cover_v.imageset/Contents.json
new file mode 100644
index 00000000..114b3978
--- /dev/null
+++ b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/dos_cover_v.imageset/Contents.json
@@ -0,0 +1,22 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/dos_cover_v.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/dos_cover_v.imageset/[email protected]
new file mode 100644
index 00000000..1c361e79
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/dos_cover_v.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/dos_cover_v.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/dos_cover_v.imageset/[email protected]
new file mode 100644
index 00000000..1cde93e1
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/dos_cover_v.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/home_menu_dos.imageset/Contents.json b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/home_menu_dos.imageset/Contents.json
new file mode 100644
index 00000000..2639994f
--- /dev/null
+++ b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/home_menu_dos.imageset/Contents.json
@@ -0,0 +1,22 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/home_menu_dos.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/home_menu_dos.imageset/[email protected]
new file mode 100644
index 00000000..40b65190
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/home_menu_dos.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/home_menu_dos.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/home_menu_dos.imageset/[email protected]
new file mode 100644
index 00000000..052e4cc7
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/home_menu_dos.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Symbols/custom.dos.symbolset/Contents.json b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Symbols/custom.dos.symbolset/Contents.json
new file mode 100644
index 00000000..8385011b
--- /dev/null
+++ b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Symbols/custom.dos.symbolset/Contents.json
@@ -0,0 +1,12 @@
+{
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ },
+ "symbols" : [
+ {
+ "filename" : "custom.dos.svg",
+ "idiom" : "universal"
+ }
+ ]
+}
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Symbols/custom.dos.symbolset/custom.dos.svg b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Symbols/custom.dos.symbolset/custom.dos.svg
new file mode 100644
index 00000000..a075314d
--- /dev/null
+++ b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Symbols/custom.dos.symbolset/custom.dos.svg
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg height="600" width="800" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <g id="Notes" font-family="'LucidaGrande', 'Lucida Grande', sans-serif" font-size="13">
+ <rect fill="white" height="600.0" width="800.0" x="0.0" y="0.0" />
+ <g font-size="13">
+ <text x="18.0" y="176.0">Small</text>
+ <text x="18.0" y="376.0">Medium</text>
+ <text x="18.0" y="576.0">Large</text>
+ </g>
+ <g font-size="9">
+ <text x="250.0" y="30.0">Ultralight</text>
+ <text x="450.0" y="30.0">Regular</text>
+ <text x="650.0" y="30.0">Black</text>
+ <text id="template-version" fill="#505050" text-anchor="end" x="785.0" y="575.0">Template v.3.0</text>
+ <a href="https://wangchujiang.com/#/app">
+ <text fill="#505050" text-anchor="end" x="785.0" y="590.0">https://wangchujiang.com/#/app</text>
+ </a>
+ </g>
+ </g>
+ <g id="Guides" stroke="rgb(39, 170, 225)" stroke-width="0.5">
+ <path id="Capline-S" d="M18,76 l800,0" />
+ <path id="H-reference" d="M85,145.755 L87.685,145.755 L113.369,79.287 L114.052,79.287 L114.052,76 L112.148,76 L85,145.755 Z M95.693,121.536 L130.996,121.536 L130.263,119.313 L96.474,119.313 L95.693,121.536 Z M139.15,145.755 L141.787,145.755 L114.638,76 L113.466,76 L113.466,79.287 L139.15,145.755 Z" stroke="none" />
+ <path id="Baseline-S" d="M18,146 l800,0" />
+ <path id="left-margin-Ultralight-S" d="M221,56 l0,110" />
+ <path id="right-margin-Ultralight-S" d="M309,56 l0,110" />
+ <path id="left-margin-Regular-S" d="M421,56 l0,110" />
+ <path id="right-margin-Regular-S" d="M509,56 l0,110" />
+ <path id="left-margin-Black-S" d="M621,56 l0,110" />
+ <path id="right-margin-Black-S" d="M709,56 l0,110" />
+ <path id="Capline-M" d="M18,276 l800,0" />
+ <path id="Baseline-M" d="M18,346 l800,0" />
+ <path id="Capline-L" d="M18,476 l800,0" />
+ <path id="Baseline-L" d="M18,546 l800,0" />
+ </g>
+ <g id="Symbols">
+ <g id="Ultralight-S">
+ <path d="M291.528,86.459 L284.916,86.459 C283.3,79.659 274.056,81.404 274.259,85.274 C274.336,91.066 286.673,88.196 291.279,94.577 C295.475,101.308 290.549,110.332 280.03,110.304 C271.803,110.175 267.102,105.162 267.14,99.453 L273.641,99.453 C275.134,104.128 281.599,105.911 285.108,102.243 C286.378,100.366 286.853,97.818 279.649,96.252 C271.064,94.386 267.334,92.11 267.231,85.554 C267.641,80.449 271.245,76.939 277.225,76 L280.943,76 C286.559,76.613 290.73,80.019 291.528,86.459 M237.168,76 L246.65,76 L251.656,95.568 L255.388,76 L266.12,76 L266.126,110.036 L259.658,110.036 L259.234,91.435 L255.397,110.036 L248.525,110.036 L243.899,91.435 L243.859,110.036 L237.168,110.036 Z M251.37,137.706 C255.951,137.473 256.171,130.701 256.548,125.598 C256.867,121.285 259.949,117.227 266.286,117.409 C267.33,115.27 268.996,113.465 270.935,112.1 C254.847,107.316 245.375,121.788 251.37,137.706 M274.389,130.285 C262.536,128.208 263.319,109.941 280.773,111.525 C287.807,112.428 291.247,116.177 291.708,122.054 L285.165,122.054 C283.943,114.648 271.523,116.94 273.139,121.729 C274.871,126.426 274.729,126.303 274.389,130.285 M262.527,119.142 C268.639,130.382 263.362,145.807 248.225,145.115 L237.168,144.665 L237.168,112.394 L249.168,112.09 C251.149,112.084 253.235,112.524 255.12,113.138 C253.946,113.943 251.663,116.096 250.741,118.857 L243.824,118.857 L243.824,138.818 C243.824,138.818 250.788,138.841 252.142,138.818 C255.911,137.999 257.529,134.035 257.593,128.185 C257.638,124.04 258.82,120.671 262.527,119.142 M274.144,120.754 C274.348,118.997 277.289,118.223 280.297,118.6 C283.893,125.205 283.602,131.913 280.206,138.705 C277.341,139.046 273.868,137.776 274.205,135.747 C277.395,126.062 274.815,125.946 274.144,120.754 M279.865,139.756 C286.913,139.95 287.891,134.71 283.44,132.721 C283.868,130.414 284.008,128.261 283.756,126.314 C295.075,128.525 293.724,138.36 290.74,141.456 C284.108,148.997 265.058,146.561 266.068,134.515 L272.467,134.515 C273.017,138.146 275.262,139.746 279.865,139.756 M258.257,144.446 C259.321,143.604 261.628,141.741 263.11,139.234 C263.948,139.103 264.924,139.102 265.677,139.248 C266.783,141.772 268.908,143.671 271.187,145.134 C267.04,146.473 262.963,146.271 258.257,144.446" />
+ </g>
+ <g id="Regular-S">
+ <path d="M491.528,86.459 L484.916,86.459 C483.3,79.659 474.056,81.404 474.259,85.274 C474.336,91.066 486.673,88.196 491.279,94.577 C495.475,101.308 490.549,110.332 480.03,110.304 C471.803,110.175 467.102,105.162 467.14,99.453 L473.641,99.453 C475.134,104.128 481.599,105.911 485.108,102.243 C486.378,100.366 486.853,97.818 479.649,96.252 C471.064,94.386 467.334,92.11 467.231,85.554 C467.641,80.449 471.245,76.939 477.225,76 L480.943,76 C486.559,76.613 490.73,80.019 491.528,86.459 M437.168,76 L446.65,76 L451.656,95.568 L455.388,76 L466.12,76 L466.126,110.036 L459.658,110.036 L459.234,91.435 L455.397,110.036 L448.525,110.036 L443.899,91.435 L443.859,110.036 L437.168,110.036 Z M451.37,137.706 C455.951,137.473 456.171,130.701 456.548,125.598 C456.867,121.285 459.949,117.227 466.286,117.409 C467.33,115.27 468.996,113.465 470.935,112.1 C454.847,107.316 445.375,121.788 451.37,137.706 M474.389,130.285 C462.536,128.208 463.319,109.941 480.773,111.525 C487.807,112.428 491.247,116.177 491.708,122.054 L485.165,122.054 C483.943,114.648 471.523,116.94 473.139,121.729 C474.871,126.426 474.729,126.303 474.389,130.285 M462.527,119.142 C468.639,130.382 463.362,145.807 448.225,145.115 L437.168,144.665 L437.168,112.394 L449.168,112.09 C451.149,112.084 453.235,112.524 455.121,113.138 C453.946,113.943 451.663,116.096 450.741,118.857 L443.824,118.857 L443.824,138.818 C443.824,138.818 450.788,138.841 452.142,138.818 C455.911,137.999 457.529,134.035 457.593,128.185 C457.638,124.04 458.82,120.671 462.527,119.142 M474.144,120.754 C474.348,118.997 477.289,118.223 480.297,118.6 C483.893,125.205 483.602,131.913 480.206,138.705 C477.341,139.046 473.868,137.776 474.205,135.747 C477.395,126.062 474.815,125.946 474.144,120.754 M479.865,139.756 C486.913,139.95 487.891,134.71 483.44,132.721 C483.868,130.414 484.008,128.261 483.756,126.314 C495.075,128.525 493.724,138.36 490.74,141.456 C484.108,148.997 465.058,146.561 466.068,134.515 L472.467,134.515 C473.017,138.146 475.262,139.746 479.865,139.756 M458.257,144.446 C459.321,143.604 461.628,141.741 463.11,139.234 C463.948,139.103 464.924,139.102 465.677,139.248 C466.783,141.772 468.908,143.671 471.187,145.134 C467.04,146.473 462.963,146.271 458.257,144.446" />
+ </g>
+ <g id="Black-S">
+ <path d="M691.528,86.459 L684.916,86.459 C683.3,79.659 674.056,81.404 674.259,85.274 C674.336,91.066 686.673,88.196 691.279,94.577 C695.475,101.308 690.549,110.332 680.03,110.304 C671.803,110.175 667.102,105.162 667.14,99.453 L673.641,99.453 C675.134,104.128 681.599,105.911 685.108,102.243 C686.378,100.366 686.853,97.818 679.649,96.252 C671.064,94.386 667.334,92.11 667.231,85.554 C667.641,80.449 671.245,76.939 677.225,76 L680.943,76 C686.559,76.613 690.73,80.019 691.528,86.459 M637.168,76 L646.65,76 L651.656,95.568 L655.388,76 L666.12,76 L666.126,110.036 L659.658,110.036 L659.234,91.435 L655.398,110.036 L648.525,110.036 L643.899,91.435 L643.859,110.036 L637.168,110.036 Z M651.37,137.706 C655.951,137.473 656.171,130.701 656.548,125.598 C656.867,121.285 659.949,117.227 666.286,117.409 C667.33,115.27 668.996,113.465 670.935,112.1 C654.847,107.316 645.375,121.788 651.37,137.706 M674.389,130.285 C662.536,128.208 663.319,109.941 680.773,111.525 C687.807,112.428 691.247,116.177 691.708,122.054 L685.165,122.054 C683.943,114.648 671.523,116.94 673.139,121.729 C674.871,126.426 674.729,126.303 674.389,130.285 M662.527,119.142 C668.639,130.382 663.362,145.807 648.225,145.115 L637.168,144.665 L637.168,112.394 L649.168,112.09 C651.149,112.084 653.235,112.524 655.12,113.138 C653.946,113.943 651.663,116.096 650.741,118.857 L643.825,118.857 L643.825,138.818 C643.825,138.818 650.788,138.841 652.142,138.818 C655.911,137.999 657.529,134.035 657.593,128.185 C657.638,124.04 658.82,120.671 662.527,119.142 M674.144,120.754 C674.348,118.997 677.289,118.223 680.297,118.6 C683.893,125.205 683.602,131.913 680.206,138.705 C677.341,139.046 673.868,137.776 674.205,135.747 C677.395,126.062 674.815,125.946 674.144,120.754 M679.865,139.756 C686.913,139.95 687.891,134.71 683.44,132.721 C683.868,130.414 684.008,128.261 683.756,126.314 C695.075,128.525 693.724,138.36 690.74,141.456 C684.108,148.997 665.058,146.561 666.068,134.515 L672.467,134.515 C673.017,138.146 675.263,139.746 679.865,139.756 M658.257,144.446 C659.321,143.604 661.628,141.741 663.11,139.234 C663.948,139.103 664.924,139.102 665.677,139.248 C666.783,141.772 668.908,143.671 671.187,145.134 C667.04,146.473 662.963,146.271 658.257,144.446" />
+ </g>
+ </g>
+</svg>
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Symbols/custom.insert.disc.symbolset/Contents.json b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Symbols/custom.insert.disc.symbolset/Contents.json
new file mode 100644
index 00000000..e7d6f71b
--- /dev/null
+++ b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Symbols/custom.insert.disc.symbolset/Contents.json
@@ -0,0 +1,12 @@
+{
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ },
+ "symbols" : [
+ {
+ "filename" : "custom.insert.disc.svg",
+ "idiom" : "universal"
+ }
+ ]
+}
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Symbols/custom.insert.disc.symbolset/custom.insert.disc.svg b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Symbols/custom.insert.disc.symbolset/custom.insert.disc.svg
new file mode 100644
index 00000000..5c6f883c
--- /dev/null
+++ b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Symbols/custom.insert.disc.symbolset/custom.insert.disc.svg
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg height="600" width="800" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <g id="Notes" font-family="'LucidaGrande', 'Lucida Grande', sans-serif" font-size="13">
+ <rect fill="white" height="600.0" width="800.0" x="0.0" y="0.0" />
+ <g font-size="13">
+ <text x="18.0" y="176.0">Small</text>
+ <text x="18.0" y="376.0">Medium</text>
+ <text x="18.0" y="576.0">Large</text>
+ </g>
+ <g font-size="9">
+ <text x="250.0" y="30.0">Ultralight</text>
+ <text x="450.0" y="30.0">Regular</text>
+ <text x="650.0" y="30.0">Black</text>
+ <text id="template-version" fill="#505050" text-anchor="end" x="785.0" y="575.0">Template v.3.0</text>
+ <a href="https://wangchujiang.com/#/app">
+ <text fill="#505050" text-anchor="end" x="785.0" y="590.0">https://wangchujiang.com/#/app</text>
+ </a>
+ </g>
+ </g>
+ <g id="Guides" stroke="rgb(39, 170, 225)" stroke-width="0.5">
+ <path id="Capline-S" d="M18,76 l800,0" />
+ <path id="H-reference" d="M85,145.755 L87.685,145.755 L113.369,79.287 L114.052,79.287 L114.052,76 L112.148,76 L85,145.755 Z M95.693,121.536 L130.996,121.536 L130.263,119.313 L96.474,119.313 L95.693,121.536 Z M139.15,145.755 L141.787,145.755 L114.638,76 L113.466,76 L113.466,79.287 L139.15,145.755 Z" stroke="none" />
+ <path id="Baseline-S" d="M18,146 l800,0" />
+ <path id="left-margin-Ultralight-S" d="M221,56 l0,110" />
+ <path id="right-margin-Ultralight-S" d="M309,56 l0,110" />
+ <path id="left-margin-Regular-S" d="M421,56 l0,110" />
+ <path id="right-margin-Regular-S" d="M509,56 l0,110" />
+ <path id="left-margin-Black-S" d="M621,56 l0,110" />
+ <path id="right-margin-Black-S" d="M709,56 l0,110" />
+ <path id="Capline-M" d="M18,276 l800,0" />
+ <path id="Baseline-M" d="M18,346 l800,0" />
+ <path id="Capline-L" d="M18,476 l800,0" />
+ <path id="Baseline-L" d="M18,546 l800,0" />
+ </g>
+ <g id="Symbols">
+ <g id="Ultralight-S">
+ <path d="M282.227,128.658 L277.898,128.658 L277.898,119.697 C276.84,120.349 275.732,120.922 274.577,121.41 C271.543,122.694 268.321,123.345 265,123.345 C261.679,123.345 258.457,122.694 255.423,121.41 C254.268,120.922 253.16,120.349 252.102,119.697 L252.102,128.658 L247.773,128.658 C246.855,128.658 246.415,129.786 247.09,130.408 L263.307,145.339 C264.264,146.22 265.736,146.22 266.693,145.339 L282.91,130.408 C283.585,129.786 283.145,128.658 282.227,128.658 Z" />
+ <path d="M252.102,117.472 C255.768,120.001 260.21,121.483 265,121.483 C269.79,121.483 274.232,120.001 277.898,117.473 C283.844,113.37 287.742,106.512 287.742,98.742 C287.742,86.182 277.56,76 265,76 C252.44,76 242.258,86.182 242.258,98.742 C242.258,106.512 246.156,113.37 252.102,117.472 Z M265,119.258 L265,107.066 C266.79,107.066 268.448,106.5 269.806,105.539 L276.622,115.65 C273.318,117.925 269.315,119.258 265,119.258 Z M271.27,98.742 C271.27,100.466 270.574,102.027 269.448,103.161 C268.312,104.304 266.739,105.012 265,105.012 C263.261,105.012 261.688,104.304 260.552,103.161 C259.426,102.027 258.73,100.466 258.73,98.742 C258.73,95.278 261.537,92.471 265,92.471 C268.463,92.471 271.27,95.279 271.27,98.742 Z M257.382,79.686 L262.148,90.919 C260.481,91.527 259.062,92.653 258.088,94.103 L247.864,87.457 C250.155,83.986 253.471,81.252 257.382,79.686 Z" />
+ </g>
+ <g id="Regular-S">
+ <path d="M482.227,128.658 L477.898,128.658 L477.898,119.697 C476.84,120.349 475.732,120.922 474.577,121.41 C471.543,122.694 468.321,123.345 465,123.345 C461.679,123.345 458.457,122.694 455.423,121.41 C454.268,120.922 453.16,120.349 452.102,119.697 L452.102,128.658 L447.773,128.658 C446.855,128.658 446.415,129.786 447.09,130.408 L463.307,145.339 C464.264,146.22 465.736,146.22 466.693,145.339 L482.91,130.408 C483.585,129.786 483.145,128.658 482.227,128.658 Z" />
+ <path d="M452.102,117.472 C455.768,120.001 460.21,121.483 465,121.483 C469.79,121.483 474.232,120.001 477.898,117.473 C483.844,113.37 487.742,106.512 487.742,98.742 C487.742,86.182 477.56,76 465,76 C452.44,76 442.258,86.182 442.258,98.742 C442.258,106.512 446.156,113.37 452.102,117.472 Z M465,119.258 L465,107.066 C466.79,107.066 468.448,106.5 469.806,105.539 L476.622,115.65 C473.318,117.925 469.315,119.258 465,119.258 Z M471.27,98.742 C471.27,100.466 470.574,102.027 469.448,103.161 C468.312,104.304 466.739,105.012 465,105.012 C463.261,105.012 461.688,104.304 460.552,103.161 C459.426,102.027 458.73,100.466 458.73,98.742 C458.73,95.278 461.537,92.471 465,92.471 C468.463,92.471 471.27,95.279 471.27,98.742 Z M457.382,79.686 L462.148,90.919 C460.481,91.527 459.062,92.653 458.088,94.103 L447.864,87.457 C450.155,83.986 453.471,81.252 457.382,79.686 Z" />
+ </g>
+ <g id="Black-S">
+ <path d="M682.227,128.658 L677.898,128.658 L677.898,119.697 C676.84,120.349 675.732,120.922 674.577,121.41 C671.543,122.694 668.321,123.345 665,123.345 C661.679,123.345 658.457,122.694 655.423,121.41 C654.268,120.922 653.16,120.349 652.102,119.697 L652.102,128.658 L647.773,128.658 C646.855,128.658 646.415,129.786 647.09,130.408 L663.307,145.339 C664.264,146.22 665.736,146.22 666.693,145.339 L682.91,130.408 C683.585,129.786 683.145,128.658 682.227,128.658 Z" />
+ <path d="M652.102,117.472 C655.768,120.001 660.21,121.483 665,121.483 C669.79,121.483 674.232,120.001 677.898,117.473 C683.844,113.37 687.742,106.512 687.742,98.742 C687.742,86.182 677.56,76 665,76 C652.44,76 642.258,86.182 642.258,98.742 C642.258,106.512 646.156,113.37 652.102,117.472 Z M665,119.258 L665,107.066 C666.79,107.066 668.448,106.5 669.806,105.539 L676.622,115.65 C673.318,117.925 669.315,119.258 665,119.258 Z M671.27,98.742 C671.27,100.466 670.574,102.027 669.448,103.161 C668.312,104.304 666.739,105.012 665,105.012 C663.261,105.012 661.688,104.304 660.552,103.161 C659.426,102.027 658.73,100.466 658.73,98.742 C658.73,95.278 661.537,92.471 665,92.471 C668.463,92.471 671.27,95.279 671.27,98.742 Z M657.382,79.686 L662.148,90.919 C660.481,91.527 659.062,92.653 658.088,94.103 L647.864,87.457 C650.155,83.986 653.471,81.252 657.382,79.686 Z" />
+ </g>
+ </g>
+</svg>
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/Info.plist b/ManicEmu/ManicEmu/Resources/Info.plist
index eedf3610..b3f84487 100644
--- a/ManicEmu/ManicEmu/Resources/Info.plist
+++ b/ManicEmu/ManicEmu/Resources/Info.plist
@@ -362,6 +362,18 @@
<string>public.aoshuang.game.j2me</string>
</array>
</dict>
+ <dict>
+ <key>CFBundleTypeName</key>
+ <string>DOS Game</string>
+ <key>CFBundleTypeRole</key>
+ <string>Editor</string>
+ <key>LSHandlerRank</key>
+ <string>Owner</string>
+ <key>LSItemContentTypes</key>
+ <array>
+ <string>public.aoshuang.game.dos</string>
+ </array>
+ </dict>
<dict>
<key>CFBundleTypeName</key>
<string>Manic EMU Controller Skin</string>
@@ -1286,6 +1298,40 @@
</array>
</dict>
</dict>
+ <dict>
+ <key>UTTypeConformsTo</key>
+ <array>
+ <string>public.data</string>
+ </array>
+ <key>UTTypeDescription</key>
+ <string>DOS Game</string>
+ <key>UTTypeIconFiles</key>
+ <array>
+ <string>file_icon.png</string>
+ </array>
+ <key>UTTypeIdentifier</key>
+ <string>public.aoshuang.game.dos</string>
+ <key>UTTypeTagSpecification</key>
+ <dict>
+ <key>public.filename-extension</key>
+ <array>
+ <string>zip</string>
+ <string>dosz</string>
+ <string>exe</string>
+ <string>com</string>
+ <string>bat</string>
+ <string>iso</string>
+ <string>cue</string>
+ <string>img</string>
+ <string>ima</string>
+ <string>vhd</string>
+ <string>jrc</string>
+ <string>tc</string>
+ <string>m3u</string>
+ <string>conf</string>
+ </array>
+ </dict>
+ </dict>
<dict>
<key>UTTypeConformsTo</key>
<array>
diff --git a/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings
index fd1e463d..1c82c6d2 100644
--- a/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings
@@ -900,9 +900,17 @@ Press the controller button to complete mapping...";
"Width" = "Width";
"Height" = "Height";
"ScreenSize" = "Screen Size";
-"J2MESettings" = "J2ME Settings";
"J2MESettingsTips" = "Due to differences in JAR standards, Manic EMU may not always detect the correct screen resolution or orientation. For the best display results, you can configure them manually.";
"J2MEScreenChange" = "J2ME screen settings have been saved. To apply the changes immediately, the game must be reset. Any unsaved progress may be lost. Reset now?";
"Later" = "Later";
"ResetImmediately" = "Reset Now";
"LoadingCheerpJ" = "Loading CheerpJ";
+"ZipHandlerTitle" = "ZIP File Handling";
+"ZipHandlerDetail" = "Some platforms (such as DOS and Arcade) can load ROMs directly from .zip files. For other platforms, ROMs inside a .zip must be extracted before importing.\n\nSelected files will be extracted and imported individually, while unselected files will be imported as a single ZIP ROM.";
+"ConfigsResetCore" = "Reset to Core Defaults";
+"ConfigsResetBefore" = "Revert to Previous Settings";
+"InsertDisc" = "Insert Disc";
+"InsertDiscAlert" = "You can insert a disc by selecting another game from the same platform in your library, or by choosing a disc file from Files. Due to iOS file system limitations, disc files selected from Files will be copied to Manic EMU's cache.";
+"InsertDiscFailed" = "Failed to Insert Disc";
+"GenerateHomeMenu" = "Create Home Menu";
+"SkinSoundEffects" = "Skin Sound Effects";
diff --git a/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.strings
index a143a758..ead7e48a 100644
--- a/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.strings
@@ -894,9 +894,17 @@
"Width" = "宽度";
"Height" = "高度";
"ScreenSize" = "屏幕尺寸";
-"J2MESettings" = "J2ME 设置";
"J2MESettingsTips" = "由于 JAR 标准存在差异,Manic EMU 有时无法自动获取正确的分辨率或屏幕方向。为了获得更好的显示效果,您可以手动进行配置。";
"J2MEScreenChange" = "J2ME 屏幕设置已保存。若要立即生效,需要重置游戏,未保存的游戏进度可能会丢失。是否立即重置?";
"Later" = "稍后";
"ResetImmediately" = "立即重置";
"LoadingCheerpJ" = "正在加载 CheerpJ";
+"ZipHandlerTitle" = "ZIP 文件处理";
+"ZipHandlerDetail" = "部分平台(如 DOS、Arcade)支持直接加载 .zip 格式的 ROM。对于其他平台,.zip 内的 ROM 需要解压后才能导入。\n\n已勾选的文件将会被解压并分别导入,未勾选的文件将作为完整的 ZIP ROM 导入。";
+"ConfigsResetCore" = "重置为核心默认值";
+"ConfigsResetBefore" = "恢复为之前配置";
+"InsertDisc" = "插入光盘";
+"InsertDiscAlert" = "您可以在游戏库中选择同一平台的游戏光盘进行插入,或从“文件”App 中选择一个光盘文件。由于 iOS 文件系统的限制,从文件中选择的光盘文件会被复制到 Manic EMU 的缓存中。";
+"InsertDiscFailed" = "插入光盘失败";
+"GenerateHomeMenu" = "创建 Home Menu";
+"SkinSoundEffects" = "皮肤音效";
diff --git a/ManicEmu/ManicEmu/Sources/Base/Application.swift b/ManicEmu/ManicEmu/Sources/Base/Application.swift
index 7e33a4c1..58700606 100644
--- a/ManicEmu/ManicEmu/Sources/Base/Application.swift
+++ b/ManicEmu/ManicEmu/Sources/Base/Application.swift
@@ -21,12 +21,15 @@ class ManicApplication: UIApplication {
override func sendEvent(_ event: UIEvent) {
super.sendEvent(event)
-// LibretroCore.sharedInstance().send(event)
+ if PlayViewController.isGaming, PlayViewController.currentGameType == .dos {
+ LibretroCore.sharedInstance().send(event)
+ }
}
- // 处理键盘事件 - 对应Objective-C中的handleKeyUIEvent方法
+ // 处理键盘事件 - 对应Objective-C中的handleKeyUIEvent方法 主要将键盘事件传递给DeltaCore
override func handleKeyboardKey(for event: UIEvent) {
super.handleKeyboardKey(for: event)
+
if #available(iOS 26.0, *) {
guard let firstResponder = UIResponder.firstResponder as? ControllerView else { return }
// 检查是否是重复的时间戳,避免重复处理
@@ -41,4 +44,22 @@ class ManicApplication: UIApplication {
}
+ override func pressesBegan(_ presses: Set<UIPress>, with event: UIPressesEvent?) {
+ if let event, PlayViewController.isGaming, PlayViewController.currentGameType == .dos {
+ for press in presses {
+ LibretroCore.sharedInstance().handle(press, with: event, down: true)
+ }
+ }
+ super.pressesBegan(presses, with: event)
+ }
+
+ override func pressesEnded(_ presses: Set<UIPress>, with event: UIPressesEvent?) {
+ if let event, PlayViewController.isGaming, PlayViewController.currentGameType == .dos {
+ for press in presses {
+ LibretroCore.sharedInstance().handle(press, with: event, down: false)
+ }
+ }
+ super.pressesEnded(presses, with: event)
+ }
+
}
diff --git a/ManicEmu/ManicEmu/Sources/Base/ApplicationSceneDelegate.swift b/ManicEmu/ManicEmu/Sources/Base/ApplicationSceneDelegate.swift
index ebd97d23..89307f0f 100644
--- a/ManicEmu/ManicEmu/Sources/Base/ApplicationSceneDelegate.swift
+++ b/ManicEmu/ManicEmu/Sources/Base/ApplicationSceneDelegate.swift
@@ -56,6 +56,10 @@ class ApplicationSceneDelegate: UIResponder, UIWindowSceneDelegate {
AchievementsUser.updateUser(username: u, password: p, token: t)
}
})
+
+// DispatchQueue.main.asyncAfter(delay: 3) {
+// LetterView.showFirstAnniversaryLetterIfNeed()
+// }
}
}
let dropInteraction = UIDropInteraction(delegate: self)
diff --git a/ManicEmu/ManicEmu/Sources/Base/Constants.swift b/ManicEmu/ManicEmu/Sources/Base/Constants.swift
index 89d15d26..48d3270c 100644
--- a/ManicEmu/ManicEmu/Sources/Base/Constants.swift
+++ b/ManicEmu/ManicEmu/Sources/Base/Constants.swift
@@ -104,6 +104,7 @@ struct Constants {
case .lynx: return 1.118
case .xbox360: return 0.7062
case .j2me: return 0.75
+ case .dos: return 0.8
default: return 1.0
}
case .style2:
@@ -348,6 +349,8 @@ struct Constants {
static let RomPatcher = Resource.appendingPathComponent("RomPatcher")
static let J2meJS = Resource.appendingPathComponent("j2mejs")
static let Freej2meWeb = Resource.appendingPathComponent("freej2me")
+ static let DOSBoxPure = Document.appendingPathComponent(LibretroCore.Cores.DOSBoxPure.name)
+ static let DOSBoxPureSystem = DOSBoxPure.appendingPathComponent("system")
}
struct DefaultKey {
@@ -369,6 +372,7 @@ struct Constants {
static let HasShowPlayCasePromo = "HasShowPlayCasePromo"
static let HasImportedPlayCaseSkin = "HasImportedPlayCaseSkin"
static let HasShowFreeJ2meAlert = "HasShowFreeJ2meAlert"
+ static let HasShowFirstAnniversaryLetter = "HasShowFirstAnniversaryLetter"
}
struct Font {
@@ -408,7 +412,7 @@ struct Constants {
/// caption
/// - Parameters:
- /// - size: s: 8 m: 10 l: 12
+ /// - size: s: 8 m: 10 l: 11
/// - weight: 默认regular
/// - Returns: UIFont
static func caption(size: Size = .m, weight: UIFont.Weight = .regular) -> UIFont {
@@ -418,7 +422,7 @@ struct Constants {
case .m:
UIFont.systemFont(ofSize: 10, weight: weight)
case .l:
- UIFont.systemFont(ofSize: 12, weight: weight)
+ UIFont.systemFont(ofSize: 11, weight: weight)
}
}
}
@@ -449,6 +453,7 @@ struct Constants {
static let MeloNXScheme = "atariemulator"
static let XeniOSScheme = "xenios"
static let J2MEScreenSizes = ["96x65", "96x96", "104x80", "128x128", "132x176", "128x160", "176x208", "176x220", "208x208", "240x320", "320x240", "240x400", "352x416", "360x640", "640x360", "480x800", "800x480"]
+ static let DOSKeyboardSkinID = "public.aoshuang.game.dos.standard.keyboard"
}
enum Config {
diff --git a/ManicEmu/ManicEmu/Sources/Business/Common/Models/ExtraKey.swift b/ManicEmu/ManicEmu/Sources/Business/Common/Models/ExtraKey.swift
index a4641c44..abfa6fe3 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Common/Models/ExtraKey.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Common/Models/ExtraKey.swift
@@ -52,4 +52,6 @@ enum ExtraKey: String {
case screenScaling
case j2meScreenSize
case j2meScreenRotate
+ case coreConfigs
+ case skinSoundEffects
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Common/Models/HomeMenuImage.swift b/ManicEmu/ManicEmu/Sources/Business/Common/Models/HomeMenuImage.swift
index 9ee331cd..3a41b33d 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Common/Models/HomeMenuImage.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Common/Models/HomeMenuImage.swift
@@ -44,6 +44,8 @@ class HomeMenuImage: UIImage, @unchecked Sendable {
}
} else if gameType == ._3ds {
brand = R.image.home_menu_3ds()?.scaled(toHeight: size.height * brandRatio)
+ } else if gameType == .dos {
+ brand = R.image.home_menu_dos()?.scaled(toHeight: size.height * brandRatio)
}
if let brand {
if Constants.Size.GameCoverStyle == .style1 {
diff --git a/ManicEmu/ManicEmu/Sources/Business/Common/Views/J2MENetworkBridge.swift b/ManicEmu/ManicEmu/Sources/Business/Common/Views/J2MENetworkBridge.swift
new file mode 100644
index 00000000..03b6484b
--- /dev/null
+++ b/ManicEmu/ManicEmu/Sources/Business/Common/Views/J2MENetworkBridge.swift
@@ -0,0 +1,515 @@
+//
+// J2MENetworkBridge.swift
+// ManicEmu
+//
+// Network bridge for J2ME J2meJS core - handles HTTP requests and TCP sockets
+// via evalNative commands from JavaScript.
+//
+
+import Foundation
+import Network
+import WebKit
+
+/// Callback type for HTTP requests and socket events
+typealias J2MENetworkCallback = ([String: Any]) -> Void
+
+/// Pending connection request
+private struct PendingConnection {
+ let data: [String: Any]
+ let callback: J2MENetworkCallback?
+ let timestamp: Date
+}
+
+/// Handles all network operations for J2meJS core
+final class J2MENetworkBridge {
+
+ // MARK: - Socket State
+
+ /// Active socket connections: socketId -> NWConnection
+ private var sockets: [String: NWConnection] = [:]
+
+ /// Host tracking: host -> [socketIds] for per-host connection limiting
+ private var hostSockets: [String: [String]] = [:]
+
+ /// Socket event callbacks: socketId -> callback
+ private var socketCallbacks: [String: J2MENetworkCallback] = [:]
+
+ /// Next socket ID counter
+ private var nextSocketId: Int = 1
+
+ /// Weak reference back to J2MEView for evaluateJavaScript
+ private weak var webView: WKWebView?
+
+ /// Queue for socket operations
+ private let socketQueue = DispatchQueue(label: "com.manicemu.j2me.network.socket")
+
+ /// Pending connection requests (queued to avoid server overload)
+ private var pendingConnections: [PendingConnection] = []
+
+ /// Maximum concurrent connections per host
+ private let maxConnectionsPerHost = 2
+
+ /// Connection timeout for pending requests (seconds)
+ private let pendingConnectionTimeout: TimeInterval = 10.0
+
+ // MARK: - Initialization
+
+ init(webView: WKWebView) {
+ self.webView = webView
+ }
+
+ // MARK: - Public API
+
+ /// Handle evalNative command from JavaScript
+ /// - Parameters:
+ /// - command: The command name ("request", "connectSocket", "onSocket", "invokeSocket")
+ /// - data: Command parameters dictionary
+ /// - callback: Optional callback for async responses (used by socket commands)
+ func handleCommand(_ command: String, data: [String: Any], callback: J2MENetworkCallback?) {
+ switch command {
+ case "request":
+ handleHTTPRequest(data)
+ case "connectSocket":
+ handleConnectSocket(data, callback: callback)
+ case "onSocket":
+ handleOnSocket(data, callback: callback)
+ case "invokeSocket":
+ handleInvokeSocket(data)
+ default:
+ Log.debug("J2MENetworkBridge: unknown command \(command)")
+ }
+ }
+
+ // MARK: - HTTP Request
+
+ private func handleHTTPRequest(_ data: [String: Any]) {
+ guard let urlString = data["url"] as? String,
+ let url = URL(string: urlString) else {
+ Log.debug("J2MENetworkBridge: invalid URL")
+ return
+ }
+
+ let method = data["method"] as? String ?? "GET"
+ let headers = data["headers"] as? [String: String] ?? [:]
+ let responseType = data["responseType"] as? String ?? "utf8"
+
+ var request = URLRequest(url: url)
+ request.httpMethod = method
+ request.allHTTPHeaderFields = headers
+
+ // Handle request body (base64 encoded)
+ if let bodyData = data["data"] as? String,
+ let body = Data(base64Encoded: bodyData) {
+ request.httpBody = body
+ }
+
+ let task = URLSession.shared.dataTask(with: request) { [weak self] responseData, response, error in
+ guard let self = self else { return }
+
+ if let error = error {
+ self.injectCallback("window.__j2meNetworkCallbacks.request",
+ data: ["error": error.localizedDescription])
+ return
+ }
+
+ guard let httpResponse = response as? HTTPURLResponse else {
+ self.injectCallback("window.__j2meNetworkCallbacks.request",
+ data: ["error": "Invalid response"])
+ return
+ }
+
+ var result: [String: Any] = [
+ "statusCode": httpResponse.statusCode,
+ "headers": httpResponse.allHeaderFields.compactMapKeys { String(describing: $0) }
+ ]
+
+ if let data = responseData {
+ if responseType == "base64" {
+ result["data"] = data.base64EncodedString()
+ } else {
+ result["data"] = String(data: data, encoding: .utf8) ?? ""
+ }
+ result["encoding"] = responseType
+ }
+
+ self.injectCallback("window.__j2meNetworkCallbacks.request", data: result)
+ }
+
+ task.resume()
+ }
+
+ // MARK: - Socket Operations
+
+ private func handleConnectSocket(_ data: [String: Any], callback: J2MENetworkCallback?) {
+ guard let host = data["host"] as? String,
+ let port = data["port"] as? Int else {
+ callback?(["error": "Invalid socket parameters"])
+ return
+ }
+
+ // Use socketId from JavaScript if provided, otherwise generate one
+ let timeout = (data["timeout"] as? Double) ?? 3000
+ let socketId: String
+ if let jsSocketId = data["__socketId"] as? String {
+ socketId = jsSocketId
+ } else {
+ socketId = "socket_\(nextSocketId)"
+ nextSocketId += 1
+ }
+
+ Log.debug("J2MENetworkBridge: connectSocket \(host):\(port) id=\(socketId), active sockets: \(sockets.count), pending: \(pendingConnections.count)")
+
+ // Count active connections to this specific host
+ let existingHostSocketIds = hostSockets[host] ?? []
+ let activeToHost = existingHostSocketIds.filter { socketId in
+ sockets[socketId] != nil
+ }.count
+
+ // If we have too many active connections to this host, queue this request
+ if activeToHost >= maxConnectionsPerHost {
+ Log.debug("J2MENetworkBridge: connection limit reached for \(host):\(port) (\(activeToHost) active), queueing request")
+ pendingConnections.append(PendingConnection(data: data, callback: callback, timestamp: Date()))
+
+ // Set up timeout for pending request
+ socketQueue.asyncAfter(deadline: .now() + pendingConnectionTimeout) { [weak self] in
+ self?.processPendingConnections()
+ }
+ return
+ }
+
+ // Proceed with connection
+ createConnection(socketId: socketId, host: host, port: port, timeout: timeout, data: data, callback: callback)
+ }
+
+ private func createConnection(socketId: String, host: String, port: Int, timeout: Double, data: [String: Any], callback: J2MENetworkCallback?) {
+ // Create TCP connection using Network.framework
+ let endpoint = NWEndpoint.hostPort(host: NWEndpoint.Host(host), port: NWEndpoint.Port(integerLiteral: UInt16(port)))
+ let parameters = NWParameters.tcp
+ parameters.allowLocalEndpointReuse = true
+
+ let connection = NWConnection(to: endpoint, using: parameters)
+
+ // Store callback
+ if let callback = callback {
+ socketCallbacks[socketId] = callback
+ }
+
+ // Store connection with host tracking
+ sockets[socketId] = connection
+ if hostSockets[host] == nil {
+ hostSockets[host] = []
+ }
+ hostSockets[host]?.append(socketId)
+
+ // Set up state observer
+ connection.stateUpdateHandler = { [weak self] state in
+ guard let self = self else { return }
+
+ switch state {
+ case .ready:
+ Log.debug("J2MENetworkBridge: socket \(socketId) connected")
+ // Notify connected
+ self.injectSocketEvent(socketId, event: "connect")
+ // Process any pending connections
+ self.processPendingConnections()
+
+ case .failed(let error):
+ Log.debug("J2MENetworkBridge: socket \(socketId) failed: \(error)")
+ self.injectSocketEvent(socketId, event: "close")
+ self.cleanupSocket(socketId)
+ self.processPendingConnections()
+
+ case .cancelled:
+ Log.debug("J2MENetworkBridge: socket \(socketId) cancelled")
+ self.cleanupSocket(socketId)
+ self.processPendingConnections()
+
+ case .waiting(let error):
+ Log.debug("J2MENetworkBridge: socket \(socketId) waiting: \(error)")
+
+ default:
+ break
+ }
+ }
+
+ // Start connection
+ connection.start(queue: socketQueue)
+
+ // Set up data receive handler
+ receiveData(for: socketId)
+
+ // Set up timeout
+ let deadline = DispatchTime.now() + timeout / 1000.0
+ socketQueue.asyncAfter(deadline: deadline) { [weak self] in
+ guard let self = self, let conn = self.sockets[socketId] else { return }
+ if conn.state != .ready {
+ Log.debug("J2MENetworkBridge: socket \(socketId) timeout")
+ self.injectSocketEvent(socketId, event: "close")
+ conn.cancel()
+ self.cleanupSocket(socketId)
+ self.processPendingConnections()
+ }
+ }
+ }
+
+ private func processPendingConnections() {
+ socketQueue.async { [weak self] in
+ guard let self = self else { return }
+
+ // Clean up stale pending requests
+ let now = Date()
+ self.pendingConnections.removeAll { pending in
+ now.timeIntervalSince(pending.timestamp) > self.pendingConnectionTimeout
+ }
+
+ // Process pending connections if we have capacity for their specific host
+ while !self.pendingConnections.isEmpty {
+ // Find the first pending connection that we have capacity for
+ guard let index = self.pendingConnections.firstIndex(where: { pending in
+ guard let host = pending.data["host"] as? String else { return false }
+ let existingHostSocketIds = self.hostSockets[host] ?? []
+ let activeToHost = existingHostSocketIds.filter { socketId in
+ self.sockets[socketId] != nil
+ }.count
+ return activeToHost < self.maxConnectionsPerHost
+ }) else {
+ // No pending connection fits the per-host limit
+ break
+ }
+
+ let pending = self.pendingConnections.remove(at: index)
+ guard let host = pending.data["host"] as? String,
+ let port = pending.data["port"] as? Int else {
+ continue
+ }
+
+ let timeout = (pending.data["timeout"] as? Double) ?? 3000
+ let socketId = "socket_\(self.nextSocketId)"
+ self.nextSocketId += 1
+
+ Log.debug("J2MENetworkBridge: processing pending connection to \(host):\(port)")
+
+ self.createConnection(
+ socketId: socketId,
+ host: host,
+ port: port,
+ timeout: timeout,
+ data: pending.data,
+ callback: pending.callback
+ )
+ }
+ }
+ }
+
+ private func handleOnSocket(_ data: [String: Any], callback: J2MENetworkCallback?) {
+ guard let socketId = data["id"] as? String else {
+ callback?(["error": "Missing socket id"])
+ return
+ }
+
+ // Register the callback for this socket
+ if let callback = callback {
+ socketCallbacks[socketId] = callback
+ }
+
+ // If socket exists and is ready, immediately send connect event
+ if let conn = sockets[socketId], conn.state == .ready {
+ injectSocketEvent(socketId, event: "connect")
+ }
+ }
+
+ private func handleInvokeSocket(_ data: [String: Any]) {
+ guard let socketId = data["id"] as? String,
+ let method = data["method"] as? String else {
+ return
+ }
+
+ Log.debug("J2MENetworkBridge: invokeSocket \(socketId) method=\(method)")
+
+ switch method {
+ case "write":
+ guard let base64Data = data["data"] as? String,
+ let writeData = Data(base64Encoded: base64Data) else {
+ return
+ }
+
+ // 打印发送的数据内容
+ var writeStr = "[Binary: \(writeData.count) bytes]"
+ if let str = String(data: writeData, encoding: .utf8) {
+ writeStr = str
+ }
+ Log.debug("J2MENetworkBridge: socket \(socketId) WRITE \(writeData.count) bytes:\n\(writeStr)")
+
+ if let connection = sockets[socketId] {
+ connection.send(content: writeData, completion: .contentProcessed { error in
+ if let error = error {
+ Log.debug("J2MENetworkBridge: socket \(socketId) write error: \(error)")
+ }
+ })
+ }
+
+ case "destroy":
+ if let connection = sockets[socketId] {
+ connection.cancel()
+ }
+ cleanupSocket(socketId)
+
+ default:
+ Log.debug("J2MENetworkBridge: unknown invokeSocket method: \(method)")
+ }
+ }
+
+ // MARK: - Data Reception
+
+ private func receiveData(for socketId: String) {
+ guard let connection = sockets[socketId] else { return }
+
+ connection.receive(minimumIncompleteLength: 1, maximumLength: 65536) { [weak self] content, _, isComplete, error in
+ guard let self = self else { return }
+
+ if let data = content, !data.isEmpty {
+ let base64 = data.base64EncodedString()
+ // 打印接收到的数据内容
+ var dataStr = "[Binary data: \(data.count) bytes, hex: \(data.prefix(256).map { String(format: "%02X", $0) }.joined(separator: " "))]"
+ if let str = String(data: data, encoding: .utf8) {
+ dataStr = str
+ }
+ Log.debug("J2MENetworkBridge: socket \(socketId) received \(data.count) bytes, content:\n\(dataStr)")
+ self.injectSocketEvent(socketId, event: "data", data: base64)
+ }
+
+ if isComplete {
+ Log.debug("J2MENetworkBridge: socket \(socketId) closed by remote")
+ self.injectSocketEvent(socketId, event: "close")
+ self.cleanupSocket(socketId)
+ } else if let error = error {
+ Log.debug("J2MENetworkBridge: socket \(socketId) receive error: \(error)")
+ self.injectSocketEvent(socketId, event: "close")
+ self.cleanupSocket(socketId)
+ } else {
+ // Continue receiving
+ self.receiveData(for: socketId)
+ }
+ }
+ }
+
+ // MARK: - Cleanup
+
+ private func cleanupSocket(_ socketId: String) {
+ sockets.removeValue(forKey: socketId)
+ socketCallbacks.removeValue(forKey: socketId)
+
+ // Remove from hostSockets tracking
+ for (host, var socketIds) in hostSockets {
+ if socketIds.contains(socketId) {
+ socketIds.removeAll { $0 == socketId }
+ if socketIds.isEmpty {
+ hostSockets.removeValue(forKey: host)
+ } else {
+ hostSockets[host] = socketIds
+ }
+ break
+ }
+ }
+ }
+
+ // MARK: - JavaScript Injection
+
+ /// Inject a callback result into the WebView JavaScript context
+ private func injectCallback(_ callbackName: String, data: [String: Any]) {
+ DispatchQueue.main.async { [weak self] in
+ guard let self = self, let webView = self.webView else { return }
+
+ let jsonData: Data
+ do {
+ jsonData = try JSONSerialization.data(withJSONObject: data)
+ } catch {
+ Log.debug("J2MENetworkBridge: JSON serialization error: \(error)")
+ return
+ }
+
+ guard let jsonString = String(data: jsonData, encoding: .utf8) else {
+ return
+ }
+
+ let script = """
+ (function() {
+ var callback = \(callbackName);
+ if (typeof callback === 'function') {
+ callback(\(jsonString));
+ }
+ })();
+ """
+
+ webView.evaluateJavaScript(script) { _, error in
+ if let error = error {
+ Log.debug("J2MENetworkBridge: evaluateJavaScript error: \(error)")
+ }
+ }
+ }
+ }
+
+ /// Inject a socket event into the WebView JavaScript context
+ private func injectSocketEvent(_ socketId: String, event: String, data: String? = nil) {
+ let callbackKey = "window.__j2meSocketCallbacks[\"\(socketId)\"]"
+
+ var eventData: [String: Any] = ["event": event]
+ if let data = data {
+ eventData["data"] = data
+ }
+
+ let jsonData: Data
+ do {
+ jsonData = try JSONSerialization.data(withJSONObject: eventData)
+ } catch {
+ Log.debug("J2MENetworkBridge: JSON serialization error: \(error)")
+ return
+ }
+
+ guard let jsonString = String(data: jsonData, encoding: .utf8) else {
+ return
+ }
+
+ Log.debug("J2MENetworkBridge: injectSocketEvent socketId=\(socketId) event=\(event) callbackKey=\(callbackKey) jsonString=\(jsonString)")
+
+ let script = """
+ (function() {
+ var callback = \(callbackKey);
+ console.log('[JS] Looking up callback for key: \(callbackKey)');
+ console.log('[JS] callback type:', typeof callback);
+ if (typeof callback === 'function') {
+ console.log('[JS] Calling callback with:', \(jsonString));
+ callback(\(jsonString));
+ console.log('[JS] Callback called successfully');
+ } else {
+ console.log('[JS] Callback not found or not a function');
+ }
+ })();
+ """
+
+ DispatchQueue.main.async { [weak self] in
+ guard let self = self, let webView = self.webView else { return }
+
+ webView.evaluateJavaScript(script) { _, error in
+ if let error = error {
+ Log.debug("J2MENetworkBridge: socket event injection error: \(error)")
+ }
+ }
+ }
+ }
+}
+
+// MARK: - Dictionary Extension
+
+private extension Dictionary {
+ /// Creates a new dictionary with keys transformed to Strings
+ func compactMapKeys<T: Hashable>(_ transform: (Key) throws -> T?) rethrows -> [T: Value] {
+ var result: [T: Value] = [:]
+ for (key, value) in self {
+ if let newKey = try transform(key) {
+ result[newKey] = value
+ }
+ }
+ return result
+ }
+}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Common/Views/J2MEView.swift b/ManicEmu/ManicEmu/Sources/Business/Common/Views/J2MEView.swift
index 00941fb9..cf6ba4b3 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Common/Views/J2MEView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Common/Views/J2MEView.swift
@@ -310,6 +310,9 @@ class J2MEView: BaseView {
private var pressingButtons: [J2MEButton] = []
private var lastKnownBounds: CGRect = .zero
+ /// Network bridge for evalNative HTTP/socket operations (J2meJS only)
+ private var networkBridge: J2MENetworkBridge?
+
// MARK: - Initialization
init(coreType: J2MECoreType) {
@@ -329,8 +332,13 @@ class J2MEView: BaseView {
// Start local server
try? localServer.start(serverType: serverType)
-
+
setupWebView()
+
+ // Initialize network bridge for J2meJS (freej2meWeb has its own network handling)
+ if coreType == .j2meJS {
+ networkBridge = J2MENetworkBridge(webView: webView)
+ }
}
required init?(coder: NSCoder) {
@@ -344,7 +352,7 @@ class J2MEView: BaseView {
// MARK: - WebView Setup
- private lazy var webView: WKWebView = {
+ lazy var webView: WKWebView = {
let configuration = WKWebViewConfiguration()
configuration.allowsInlineMediaPlayback = true
configuration.mediaTypesRequiringUserActionForPlayback = []
@@ -472,7 +480,7 @@ class J2MEView: BaseView {
// Register file to local server
let fileId = localServer.registerFile(filePath: filePath)
- let jarURL = "http://localhost:8080/file/\(fileId)"
+ let jarURL = "http://localhost:\(localServer.port)/file/\(fileId)"
let fileName = filePath.lastPathComponent
// Build the JavaScript to load the JAR
@@ -986,6 +994,19 @@ extension J2MEView: WKScriptMessageHandler {
Log.debug("🚪 MIDlet requested exit")
onExit?()
+ case "evalNative":
+ // Handle network commands from JavaScript evalNative bridge
+ guard let networkBridge = networkBridge,
+ let command = body["command"] as? String,
+ let data = body["data"] as? [String: Any] else {
+ break
+ }
+ let hasCallback = body["hasCallback"] as? Bool ?? false
+ networkBridge.handleCommand(command, data: data, callback: hasCallback ? { result in
+ // Callback is handled by injectCallback in networkBridge
+ // The result is already injected into JavaScript by the bridge
+ } : nil)
+
default:
break
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Common/Views/LetterView.swift b/ManicEmu/ManicEmu/Sources/Business/Common/Views/LetterView.swift
new file mode 100644
index 00000000..4efa6b61
--- /dev/null
+++ b/ManicEmu/ManicEmu/Sources/Business/Common/Views/LetterView.swift
@@ -0,0 +1,116 @@
+//
+// LetterView.swift
+// ManicEmu
+//
+// Created by Daiuno on 2026/3/21.
+// Copyright © 2026 Manic EMU. All rights reserved.
+//
+import ProHUD
+
+struct LetterView {
+ static func showFirstAnniversaryLetterIfNeed() {
+ var calendar = Calendar(identifier: .gregorian)
+ calendar.timeZone = TimeZone(identifier: "Asia/Shanghai")!
+
+ // beginDate
+ var startComponents = DateComponents()
+ startComponents.year = 2026
+ startComponents.month = 4
+ startComponents.day = 3
+ startComponents.hour = 0
+ startComponents.minute = 0
+ startComponents.second = 0
+ let startDate = calendar.date(from: startComponents)!
+
+ // endDate
+ var endComponents = DateComponents()
+ endComponents.year = 2026
+ endComponents.month = 4
+ endComponents.day = 4
+ endComponents.hour = 0
+ let endDate = calendar.date(from: endComponents)!
+
+ let now = Date()
+
+ if now >= startDate &&
+ now < endDate &&
+ !UserDefaults.standard.bool(forKey: Constants.DefaultKey.HasShowFreeJ2meAlert) {
+ DispatchQueue.main.asyncAfter(delay: 0.35) {
+ CheersView.makeNormalCheers(userTopWindow: true)
+ }
+
+ Sheet.lazyPush(identifier: String(describing: LetterView.self)) { sheet in
+ sheet.configGamePlayingStyle(hideCompletion: nil)
+
+ sheet.config.backgroundViewMask { mask in
+ mask.backgroundColor = .black.withAlphaComponent(0.5)
+ }
+
+ let view = UIView()
+ let containerView = RoundAndBorderView(roundCorner: (UIDevice.isPad || UIDevice.isLandscape || PlayViewController.menuInsets != nil) ? .allCorners : [.topLeft, .topRight])
+ containerView.makeBlur()
+ view.addSubview(containerView)
+ containerView.snp.makeConstraints { make in
+ make.edges.equalToSuperview()
+ make.height.equalTo(Constants.Size.WindowHeight/2)
+ }
+ view.addPanGesture { [weak view, weak sheet] gesture in
+ guard let view = view, let sheet = sheet else { return }
+ let point = gesture.translation(in: gesture.view)
+ view.transform = .init(translationX: 0, y: point.y <= 0 ? 0 : point.y)
+ if gesture.state == .recognized {
+ let v = gesture.velocity(in: gesture.view)
+ if (view.y > view.height*2/3 && v.y > 0) || v.y > 1200 {
+ // 达到移除的速度
+ sheet.pop()
+ }
+ UIView.animate(withDuration: 0.8, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 0.5, options: [.allowUserInteraction, .curveEaseOut], animations: {
+ view.transform = .identity
+ })
+ }
+ }
+
+ let topView = UIView()
+ containerView.addSubview(topView)
+ topView.snp.makeConstraints { make in
+ make.leading.top.trailing.equalToSuperview()
+ make.height.equalTo(Constants.Size.ItemHeightMid)
+ }
+
+ let closeButton = SymbolButton(image: UIImage(symbol: .xmark, font: Constants.Font.body(weight: .bold)))
+ closeButton.addTapGesture { [weak sheet] gesture in
+ sheet?.pop()
+ }
+ closeButton.enableRoundCorner = true
+ topView.addSubview(closeButton)
+ closeButton.snp.makeConstraints { make in
+ make.centerY.equalToSuperview()
+ make.size.equalTo(Constants.Size.IconSizeMid)
+ make.trailing.equalToSuperview().offset(-Constants.Size.ContentSpaceMax)
+ }
+
+ let envolopeImageView = UIImageView(image: R.image.appicon())
+ envolopeImageView.isUserInteractionEnabled = true
+ envolopeImageView.addTapGesture { [weak containerView, weak sheet, weak view] gesture in
+ guard let containerView, let sheet else { return }
+ containerView.snp.updateConstraints { make in
+ make.height.equalTo(sheet.config.cardMaxHeight!)
+ }
+ UIView.springAnimate {
+ view?.layoutIfNeeded()
+ }
+ }
+ envolopeImageView.enableInteractive = true
+ containerView.addSubview(envolopeImageView)
+ envolopeImageView.snp.makeConstraints { make in
+ make.size.equalTo(100)
+ make.center.equalToSuperview()
+ }
+
+ sheet.set(customView: view).snp.makeConstraints { make in
+ make.edges.equalToSuperview()
+ }
+ }
+ }
+ }
+}
diff --git a/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/CoreConfigsOptionView.swift b/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/CoreConfigsOptionView.swift
new file mode 100644
index 00000000..ff9e6ad7
--- /dev/null
+++ b/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/CoreConfigsOptionView.swift
@@ -0,0 +1,249 @@
+//
+// CoreConfigsOptionView.swift
+// ManicEmu
+//
+// Created by Daiuno on 2026/3/19.
+// Copyright © 2026 Manic EMU. All rights reserved.
+//
+import UIKit
+import ProHUD
+
+class CoreConfigsOptionView: BaseView {
+ static func show(coreOption: CoreOption,
+ defaultOption: Options,
+ optionChange: ((_ value: String)->Void)? = nil ) {
+ Sheet { sheet in
+ sheet.contentMaskView.alpha = 0
+ sheet.config.windowEdgeInset = 0
+ sheet.config.backgroundViewMask { mask in
+ mask.backgroundColor = .black.withAlphaComponent(0.2)
+ }
+
+ let view = UIView()
+ let grabber = UIImageView(image: R.image.grabber_icon())
+ grabber.isUserInteractionEnabled = true
+ grabber.contentMode = .center
+ view.addPanGesture { [weak view, weak sheet] gesture in
+ guard let view = view, let sheet = sheet else { return }
+ let point = gesture.translation(in: gesture.view)
+ view.transform = .init(translationX: 0, y: point.y <= 0 ? 0 : point.y)
+ if gesture.state == .recognized {
+ let v = gesture.velocity(in: gesture.view)
+ if (view.y > view.height*2/3 && v.y > 0) || v.y > 1200 {
+ sheet.pop()
+ }
+ UIView.animate(withDuration: 0.8, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 0.5, options: [.allowUserInteraction, .curveEaseOut], animations: {
+ view.transform = .identity
+ })
+ }
+ }
+ view.addSubview(grabber)
+ grabber.snp.makeConstraints { make in
+ make.leading.top.trailing.equalToSuperview()
+ make.height.equalTo(Constants.Size.ContentSpaceTiny*3)
+ }
+
+ let containerView = RoundAndBorderView(roundCorner: (UIDevice.isPad || UIDevice.isLandscape) ? .allCorners : [.topLeft, .topRight])
+ containerView.backgroundColor = Constants.Color.Background
+ containerView.makeBlur()
+ view.addSubview(containerView)
+ containerView.snp.makeConstraints { make in
+ make.top.equalTo(grabber.snp.bottom)
+ make.leading.bottom.trailing.equalToSuperview()
+ }
+
+ let titleLabel = UILabel()
+ titleLabel.textAlignment = .center
+ titleLabel.text = coreOption.desc
+ titleLabel.font = Constants.Font.title(size: .s, weight: .semibold)
+ titleLabel.textColor = Constants.Color.LabelPrimary
+ containerView.addSubview(titleLabel)
+ titleLabel.snp.makeConstraints { make in
+ make.centerX.equalToSuperview()
+ make.top.equalToSuperview().offset(30)
+ }
+
+ let detailLabel = UILabel()
+ detailLabel.numberOfLines = 0
+ detailLabel.text = coreOption.info
+ detailLabel.font = Constants.Font.body(size: .m)
+ detailLabel.textColor = Constants.Color.LabelPrimary
+ containerView.addSubview(detailLabel)
+ detailLabel.snp.makeConstraints { make in
+ make.leading.trailing.equalToSuperview().inset(Constants.Size.ContentSpaceHuge)
+ make.top.equalTo(titleLabel.snp.bottom).offset(Constants.Size.ContentSpaceMin)
+ }
+
+ let optionView = CoreConfigsOptionView(coreOption: coreOption, defaultOption: defaultOption)
+ optionView.didOptionChange = { value in
+ optionChange?(value)
+ }
+ containerView.addSubview(optionView)
+ optionView.snp.makeConstraints { make in
+ make.leading.trailing.equalToSuperview()
+ make.top.equalTo(detailLabel.snp.bottom).offset(Constants.Size.ContentSpaceMin)
+ let count = CGFloat(coreOption.options.count)
+ let estimatedHeight = count * Constants.Size.ItemHeightMax + ((count + 1) * Constants.Size.ContentSpaceMax)
+ let maxHeight = Constants.Size.WindowHeight*3/4
+ make.height.equalTo(min(estimatedHeight, maxHeight))
+ make.bottom.equalToSuperview().offset(-Constants.Size.ContentInsetBottom)
+ }
+
+ sheet.set(customView: view).snp.makeConstraints { make in
+ make.edges.equalToSuperview()
+ }
+ }
+ }
+
+ private lazy var collectionView: UICollectionView = {
+ let view = UICollectionView(frame: .zero, collectionViewLayout: createLayout())
+ view.backgroundColor = .clear
+ view.contentInsetAdjustmentBehavior = .never
+ view.register(cellWithClass: CoreConfigsOptionCell.self)
+ view.showsVerticalScrollIndicator = false
+ view.dataSource = self
+ view.delegate = self
+ return view
+ }()
+
+ private var coreOption: CoreOption
+ private var defaultOption: Options
+
+ var didOptionChange: ((_ value: String)->Void)? = nil
+
+ deinit {
+ Log.debug("\(String(describing: Self.self)) deinit")
+ }
+
+ init(coreOption: CoreOption, defaultOption: Options) {
+ self.coreOption = coreOption
+ self.defaultOption = defaultOption
+ super.init(frame: .zero)
+ Log.debug("\(String(describing: Self.self)) init")
+
+ addSubview(collectionView)
+ collectionView.snp.makeConstraints { make in
+ make.edges.equalToSuperview()
+ }
+
+ DispatchQueue.main.asyncAfter(delay: 0.35) { [weak self] in
+ if let selectedIndex = coreOption.options.firstIndex(where: { $0.value == defaultOption.value }) {
+ self?.collectionView.selectItem(at: IndexPath(row: selectedIndex, section: 0), animated: true, scrollPosition: .centeredVertically)
+ }
+ }
+ }
+
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+
+ private func createLayout() -> UICollectionViewLayout {
+ let layout = UICollectionViewCompositionalLayout { sectionIndex, env in
+ //item布局
+ let item = NSCollectionLayoutItem(layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1),
+ heightDimension: .estimated(Constants.Size.ItemHeightMax)))
+
+ //group布局
+ let group = NSCollectionLayoutGroup.horizontal(layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .estimated(Constants.Size.ItemHeightMax)), subitems: [item])
+ group.contentInsets = NSDirectionalEdgeInsets(top: 0,
+ leading: Constants.Size.ContentSpaceMid * 2,
+ bottom: 0,
+ trailing: Constants.Size.ContentSpaceMid * 2)
+
+ //section布局
+ let section = NSCollectionLayoutSection(group: group)
+ section.interGroupSpacing = Constants.Size.ContentSpaceMax
+ section.contentInsets = NSDirectionalEdgeInsets(top: Constants.Size.ContentSpaceMax, leading: 0, bottom: Constants.Size.ContentSpaceMax, trailing: 0)
+
+ section.decorationItems = [NSCollectionLayoutDecorationItem.background(elementKind: String(describing: PlatformSelectionView.PlatformSelectionCollectionReusableView.self))]
+
+
+ return section
+ }
+
+ layout.register(PlatformSelectionView.PlatformSelectionCollectionReusableView.self, forDecorationViewOfKind: String(describing: PlatformSelectionView.PlatformSelectionCollectionReusableView.self))
+ return layout
+ }
+}
+
+extension CoreConfigsOptionView: UICollectionViewDataSource {
+
+ func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
+ return coreOption.options.count
+ }
+
+ func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
+ let cell = collectionView.dequeueReusableCell(withClass: CoreConfigsOptionCell.self, for: indexPath)
+ cell.setData(title: coreOption.options[indexPath.row].label)
+ return cell
+ }
+}
+
+extension CoreConfigsOptionView: UICollectionViewDelegate {
+ func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
+ didOptionChange?(coreOption.options[indexPath.row].value)
+ }
+}
+
+class CoreConfigsOptionCell: UICollectionViewCell {
+ private var titleLabel: UILabel = {
+ let label = UILabel()
+ label.font = Constants.Font.body(size: .l)
+ label.textColor = Constants.Color.LabelPrimary
+ label.numberOfLines = 0
+ return label
+ }()
+
+ private let selectedIcon = SymbolButton(image: .init(symbol: .checkmarkCircleFill,
+ size: Constants.Size.IconSizeTiny.height,
+ colors: [Constants.Color.LabelPrimary, Constants.Color.Main]))
+
+ private let normalIcon = SymbolButton(image: .init(symbol: .circle,
+ size: Constants.Size.IconSizeTiny.height,
+ colors: [Constants.Color.LabelPrimary]))
+
+ override init(frame: CGRect) {
+ super.init(frame: frame)
+
+ layerCornerRadius = Constants.Size.CornerRadiusMid
+
+ backgroundColor = Constants.Color.Background
+
+ addSubview(titleLabel)
+ titleLabel.snp.makeConstraints { make in
+ make.top.bottom.equalToSuperview().inset(Constants.Size.ContentSpaceMid)
+ make.leading.equalToSuperview().offset(Constants.Size.ContentSpaceMid)
+ }
+
+ normalIcon.backgroundColor = .clear
+ addSubview(normalIcon)
+ normalIcon.snp.makeConstraints { make in
+ make.leading.equalTo(titleLabel.snp.trailing).offset(Constants.Size.ContentSpaceMin)
+ make.size.equalTo(Constants.Size.IconSizeMin)
+ make.centerY.equalToSuperview()
+ make.trailing.equalToSuperview().inset(Constants.Size.ContentSpaceMid)
+ }
+
+ selectedIcon.backgroundColor = .clear
+ selectedIcon.isHidden = true
+ addSubview(selectedIcon)
+ selectedIcon.snp.makeConstraints { make in
+ make.edges.equalTo(normalIcon)
+ }
+ }
+
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+
+ func setData(title: String) {
+ titleLabel.text = title
+ }
+
+ override var isSelected: Bool {
+ willSet {
+ normalIcon.isHidden = newValue
+ selectedIcon.isHidden = !newValue
+ }
+ }
+}
diff --git a/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/CoreConfigsView.swift b/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/CoreConfigsView.swift
new file mode 100644
index 00000000..4e84c296
--- /dev/null
+++ b/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/CoreConfigsView.swift
@@ -0,0 +1,412 @@
+//
+// CoreConfigsView.swift
+// ManicEmu
+//
+// Created by Daiuno on 2026/3/19.
+// Copyright © 2026 Manic EMU. All rights reserved.
+//
+
+import UIKit
+import ManicEmuCore
+import ProHUD
+
+class CoreConfigsView: BaseView {
+
+ private var navigationBlurView: NavigationBlurView = {
+ let view = NavigationBlurView()
+ view.makeBlur()
+ return view
+ }()
+
+ private lazy var collectionView: UICollectionView = {
+ let view = UICollectionView(frame: .zero, collectionViewLayout: createLayout())
+ view.backgroundColor = .clear
+ view.contentInsetAdjustmentBehavior = .never
+ view.register(cellWithClass: CoreConfigsCell.self)
+ view.register(supplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withClass: BackgroundColorHaderReusableView.self)
+ view.register(supplementaryViewOfKind: UICollectionView.elementKindSectionFooter, withClass: BackgroundColorDetailFooterReusableView.self)
+ view.showsVerticalScrollIndicator = false
+ view.dataSource = self
+ view.delegate = self
+ view.contentInset = UIEdgeInsets(top: Constants.Size.ItemHeightMid, left: 0, bottom: UIDevice.isPad ? (Constants.Size.ContentInsetBottom + Constants.Size.HomeTabBarSize.height + Constants.Size.ContentSpaceMax) : Constants.Size.ContentInsetBottom, right: 0)
+ return view
+ }()
+
+ private lazy var closeButton: SymbolButton = {
+ let view = SymbolButton(image: UIImage(symbol: .xmark, font: Constants.Font.body(weight: .bold)), enableGlass: true)
+ view.enableRoundCorner = true
+ view.addTapGesture { [weak self] gesture in
+ guard let self = self else { return }
+ if self.originalUserConfigs != self.userConfigs {
+ if let jsonString = self.userConfigs?.jsonString() {
+ self.game.updateExtra(key: ExtraKey.coreConfigs.rawValue, value: jsonString)
+ } else {
+ self.game.updateExtra(key: ExtraKey.coreConfigs.rawValue, value: nil)
+ }
+ }
+ self.didTapClose?()
+ }
+ return view
+ }()
+
+ private lazy var moreContextMenuButton: ContextMenuButton = {
+ var actions: [UIMenuElement] = []
+ actions.append((UIAction(title: R.string.localizable.configsResetCore()) { [weak self] _ in
+ guard let self = self else { return }
+ //reset to core default
+ self.reset(toCoreDefault: true)
+ }))
+ actions.append((UIAction(title: R.string.localizable.configsResetBefore()) { [weak self] _ in
+ guard let self = self else { return }
+ //reset to user config
+ self.reset(toCoreDefault: false)
+ }))
+ let view = ContextMenuButton(image: nil, menu: UIMenu(children: actions))
+ return view
+ }()
+
+ private lazy var moreButton: SymbolButton = {
+ let view = SymbolButton(symbol: .ellipsis, enableGlass: true)
+ view.enableRoundCorner = true
+ view.addTapGesture { [weak self] gesture in
+ self?.moreContextMenuButton.triggerTapGesture()
+ }
+ return view
+ }()
+
+ ///点击关闭按钮回调
+ var didTapClose: (()->Void)? = nil
+ var didConfigChange: (([String: String])->Void)? = nil
+
+ deinit {
+ Log.debug("\(String(describing: Self.self)) deinit")
+ }
+
+ var game: Game
+ private var coreOptionCategories: [CoreOptionCategory] = []
+ private var originalUserConfigs: [String: String]?
+ private var userConfigs: [String: String]?
+
+
+ init(game: Game) {
+ self.game = game
+ super.init(frame: .zero)
+ Log.debug("\(String(describing: Self.self)) init")
+ backgroundColor = Constants.Color.Background
+
+ addSubview(collectionView)
+ collectionView.snp.makeConstraints { make in
+ make.edges.equalToSuperview()
+ }
+
+ addSubview(navigationBlurView)
+ navigationBlurView.snp.makeConstraints { make in
+ make.top.equalToSuperview()
+ make.leading.trailing.equalTo(self.safeAreaLayoutGuide)
+ make.height.equalTo(Constants.Size.ItemHeightMid)
+ }
+
+ let icon = UIImageView(image: game.gameType.coreConfigIcon?.applySymbolConfig(size: 30))
+ icon.contentMode = .scaleAspectFit
+ navigationBlurView.addSubview(icon)
+ icon.snp.makeConstraints { make in
+ make.leading.equalToSuperview().offset(Constants.Size.ContentSpaceMax)
+ make.size.equalTo(Constants.Size.IconSizeMin)
+ make.centerY.equalToSuperview()
+ }
+ let headerTitleLabel = UILabel()
+ headerTitleLabel.text = game.gameType.coreConfigTitle
+ headerTitleLabel.textColor = Constants.Color.LabelPrimary
+ headerTitleLabel.font = Constants.Font.title(size: .s)
+ navigationBlurView.addSubview(headerTitleLabel)
+ headerTitleLabel.snp.makeConstraints { make in
+ make.leading.equalTo(icon.snp.trailing).offset(Constants.Size.ContentSpaceUltraTiny)
+ make.centerY.equalTo(icon)
+ }
+
+ navigationBlurView.addSubview(closeButton)
+ closeButton.snp.makeConstraints { make in
+ make.trailing.equalToSuperview().offset(-Constants.Size.ContentSpaceMax)
+ make.centerY.equalToSuperview()
+ make.size.equalTo(Constants.Size.ItemHeightUltraTiny)
+ }
+
+ navigationBlurView.addSubview(moreContextMenuButton)
+ moreContextMenuButton.snp.makeConstraints { make in
+ make.trailing.equalTo(closeButton.snp.leading).offset(-Constants.Size.ContentSpaceMid)
+ make.centerY.equalToSuperview()
+ make.size.equalTo(Constants.Size.ItemHeightUltraTiny)
+ }
+
+ navigationBlurView.addSubview(moreButton)
+ moreButton.snp.makeConstraints { make in
+ make.edges.equalTo(moreContextMenuButton)
+ }
+
+ UIView.makeLoading()
+ DispatchQueue.main.asyncAfter(delay: 0.35, execute: { [weak self] in
+ guard let self else { return }
+ if let json = game.getStoreCoreConfigs() {
+ originalUserConfigs = json
+ userConfigs = json
+ }
+ if let corePath = game.libretroCorePath,
+ let coreCategories = LibretroCore.sharedInstance().getOptions(corePath) {
+ coreOptionCategories = coreCategories
+ }
+ self.collectionView.reloadData()
+ UIView.hideLoading()
+ })
+ }
+
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+
+ private func createLayout() -> UICollectionViewLayout {
+ let layout = UICollectionViewCompositionalLayout { sectionIndex, env in
+ //item布局
+ let item = NSCollectionLayoutItem(layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1),
+ heightDimension: .estimated(Constants.Size.ItemHeightMax)))
+
+ //group布局
+ let group = NSCollectionLayoutGroup.horizontal(layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .estimated(Constants.Size.ItemHeightMax)), subitems: [item])
+ group.contentInsets = NSDirectionalEdgeInsets(top: 0,
+ leading: Constants.Size.ContentSpaceMid,
+ bottom: 0,
+ trailing: Constants.Size.ContentSpaceMid)
+
+ //section布局
+ let section = NSCollectionLayoutSection(group: group)
+ section.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 0, bottom: Constants.Size.ContentSpaceMin, trailing: 0)
+
+ //header布局
+ let headerItem = NSCollectionLayoutBoundarySupplementaryItem(layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1),
+ heightDimension: .absolute(44)),
+ elementKind: UICollectionView.elementKindSectionHeader,
+ alignment: .top)
+ headerItem.pinToVisibleBounds = true
+ section.boundarySupplementaryItems = [headerItem]
+
+ //footer
+ let footerItem = NSCollectionLayoutBoundarySupplementaryItem(layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1),
+ heightDimension: .estimated(44)),
+ elementKind: UICollectionView.elementKindSectionFooter,
+ alignment: .bottom)
+ section.boundarySupplementaryItems.append(footerItem)
+
+ //decoration
+ section.decorationItems = [NSCollectionLayoutDecorationItem.background(elementKind: String(describing: CoreConfigsCollectionReusableView.self))]
+
+ return section
+ }
+
+ layout.register(CoreConfigsCollectionReusableView.self, forDecorationViewOfKind: String(describing: CoreConfigsCollectionReusableView.self))
+ return layout
+ }
+
+ class CoreConfigsCollectionReusableView: UICollectionReusableView {
+ var backgroundView: UIView = {
+ let view = UIView()
+ view.layerCornerRadius = Constants.Size.CornerRadiusMax
+ view.backgroundColor = Constants.Color.BackgroundPrimary
+ return view
+ }()
+
+ override init(frame: CGRect) {
+ super.init(frame: frame)
+
+ addSubview(backgroundView)
+ backgroundView.snp.makeConstraints { make in
+ make.top.equalToSuperview().offset(Constants.Size.ItemHeightMin)
+ make.bottom.equalToSuperview().offset(-32)
+ make.leading.trailing.equalToSuperview().inset(Constants.Size.ContentSpaceMid)
+ }
+ }
+
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+ }
+
+ private func modifyConfig(key: String, value: String?) {
+ var tempConfig = userConfigs ?? [:]
+ tempConfig[key] = value
+ if tempConfig.count == 0 {
+ userConfigs = nil
+ } else {
+ userConfigs = tempConfig
+ }
+ collectionView.reloadData()
+ }
+
+ private func getOptionValue(coreOption: CoreOption) -> String {
+ return getOption(coreOption: coreOption).value
+ }
+
+ private func getOptionLabel(coreOption: CoreOption) -> String {
+ return getOption(coreOption: coreOption).label
+ }
+
+ private func getOption(coreOption: CoreOption) -> Options {
+ if let userConfigs,
+ let userValue = userConfigs[coreOption.key],
+ let option = coreOption.options.first(where: { $0.value == userValue }) {
+ return option
+ }
+ if let defaultOption = coreOption.options.first(where: { $0.value == coreOption.value }) {
+ return defaultOption
+ }
+ let option = Options()
+ option.value = coreOption.value
+ option.label = ""
+ return option
+ }
+
+ private func reset(toCoreDefault: Bool) {
+ if toCoreDefault {
+ userConfigs = nil
+ } else {
+ userConfigs = originalUserConfigs
+ }
+ collectionView.reloadData()
+ }
+}
+
+extension CoreConfigsView: UICollectionViewDataSource {
+ func numberOfSections(in collectionView: UICollectionView) -> Int {
+ return coreOptionCategories.count
+ }
+
+ func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
+ return coreOptionCategories[section].options.count
+ }
+
+ func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
+ let cell = collectionView.dequeueReusableCell(withClass: CoreConfigsCell.self, for: indexPath)
+ let coreOption = coreOptionCategories[indexPath.section].options[indexPath.row]
+ cell.setData(title: coreOption.desc, detail: getOptionLabel(coreOption: coreOption))
+ return cell
+ }
+
+ func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
+ if kind == UICollectionView.elementKindSectionHeader {
+ let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withClass: BackgroundColorHaderReusableView.self, for: indexPath)
+ header.titleLabel.text = coreOptionCategories[indexPath.section].title
+ return header
+ } else {
+ let footer = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withClass: BackgroundColorDetailFooterReusableView.self, for: indexPath)
+ footer.titleLabel.text = coreOptionCategories[indexPath.section].info + "\n"
+ return footer
+ }
+ }
+}
+
+extension CoreConfigsView: UICollectionViewDelegate {
+ func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
+ let coreOption = coreOptionCategories[indexPath.section].options[indexPath.row]
+ CoreConfigsOptionView.show(coreOption: coreOption, defaultOption: getOption(coreOption: coreOption), optionChange: { [weak self] value in
+ guard let self else { return }
+ self.modifyConfig(key: coreOption.key, value: value)
+ self.didConfigChange?([coreOption.key: value])
+ })
+ }
+}
+
+extension CoreConfigsView {
+ static var isShow: Bool {
+ Sheet.find(identifier: String(describing: CoreConfigsView.self)).count > 0 ? true : false
+ }
+
+ static func show(game: Game, hideCompletion: (()->Void)? = nil, configChange: (([String: String])->Void)? = nil) {
+ Sheet.lazyPush(identifier: String(describing: CoreConfigsView.self)) { sheet in
+ sheet.configGamePlayingStyle(hideCompletion: hideCompletion)
+
+ let view = UIView()
+ let containerView = RoundAndBorderView(roundCorner: (UIDevice.isPad || UIDevice.isLandscape || PlayViewController.menuInsets != nil) ? .allCorners : [.topLeft, .topRight])
+ containerView.backgroundColor = Constants.Color.Background
+ view.addSubview(containerView)
+ containerView.snp.makeConstraints { make in
+ make.edges.equalToSuperview()
+ if let maxHeight = sheet.config.cardMaxHeight {
+ make.height.equalTo(maxHeight)
+ }
+ }
+ view.addPanGesture { [weak view, weak sheet] gesture in
+ guard let view = view, let sheet = sheet else { return }
+ let point = gesture.translation(in: gesture.view)
+ view.transform = .init(translationX: 0, y: point.y <= 0 ? 0 : point.y)
+ if gesture.state == .recognized {
+ let v = gesture.velocity(in: gesture.view)
+ if (view.y > view.height*2/3 && v.y > 0) || v.y > 1200 {
+ // 达到移除的速度
+ sheet.pop()
+ }
+ UIView.animate(withDuration: 0.8, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 0.5, options: [.allowUserInteraction, .curveEaseOut], animations: {
+ view.transform = .identity
+ })
+ }
+ }
+
+ let coreConfigsView = CoreConfigsView(game: game)
+ coreConfigsView.didTapClose = { [weak sheet] in
+ sheet?.pop()
+ }
+ coreConfigsView.didConfigChange = { configChange?($0) }
+ containerView.addSubview(coreConfigsView)
+ coreConfigsView.snp.makeConstraints { make in
+ make.edges.equalToSuperview()
+ }
+
+ sheet.set(customView: view).snp.makeConstraints { make in
+ make.edges.equalToSuperview()
+ }
+ }
+ }
+}
+
+class CoreConfigsCell: UICollectionViewCell {
+ private var titleLabel: UILabel = {
+ let view = UILabel()
+ view.numberOfLines = 0
+ return view
+ }()
+
+ private var chevronIconView: UIImageView = {
+ let view = UIImageView(image: UIImage(symbol: .chevronRight, font: Constants.Font.caption(size: .l, weight: .bold), color: Constants.Color.BackgroundSecondary))
+ view.contentMode = .center
+ return view
+ }()
+
+ override init(frame: CGRect) {
+ super.init(frame: frame)
+ enableInteractive = true
+ delayInteractiveTouchEnd = true
+
+ addSubview(titleLabel)
+ titleLabel.snp.makeConstraints { make in
+ make.leading.top.bottom.equalToSuperview().inset(Constants.Size.ContentSpaceMid)
+ make.trailing.equalToSuperview().inset(38)
+ }
+
+ addSubview(chevronIconView)
+ chevronIconView.snp.makeConstraints { make in
+ make.centerY.equalToSuperview()
+ make.trailing.equalToSuperview().inset(Constants.Size.ContentSpaceMid)
+ }
+ }
+
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+
+ func setData(title: String, detail: String) {
+ let matt = NSMutableAttributedString(string: title, attributes: [.font: Constants.Font.body(size: .l), .foregroundColor: Constants.Color.LabelPrimary])
+ matt.append(NSAttributedString(string: "\n\(detail)", attributes: [.font: Constants.Font.caption(size: .l), .foregroundColor: Constants.Color.LabelSecondary]))
+ let style = NSMutableParagraphStyle()
+ style.lineSpacing = Constants.Size.ContentSpaceUltraTiny/2
+ style.alignment = .left
+ titleLabel.attributedText = matt.applying(attributes: [.paragraphStyle: style])
+ }
+}
+
diff --git a/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoDetailReusableView.swift b/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoDetailReusableView.swift
index 43423c62..f638e74d 100644
--- a/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoDetailReusableView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoDetailReusableView.swift
@@ -11,6 +11,7 @@ import UIKit
import BetterSegmentedControl
import RealmSwift
import UniformTypeIdentifiers
+import ManicEmuCore
class GameInfoDetailReusableView: UICollectionReusableView {
let backgroundBlurView: UIView = {
@@ -1128,9 +1129,9 @@ class GameInfoDetailReusableView: UICollectionReusableView {
return view
}()
- private lazy var j2mesettingButton: SymbolButton = {
- let title = R.string.localizable.j2MESettings()
- let view = SymbolButton(image: R.image.customJava()!.applySymbolConfig(size: 30), title: title, horizontalContian: true)
+ private lazy var j2meSettingButton: SymbolButton = {
+ let title = GameType.j2me.coreConfigTitle
+ let view = SymbolButton(image: GameType.j2me.coreConfigIcon?.applySymbolConfig(size: 30), title: title, horizontalContian: true)
view.titleLabel.numberOfLines = 0
view.addTapGesture { [weak self] gesture in
guard let self = self else { return }
@@ -1144,6 +1145,22 @@ class GameInfoDetailReusableView: UICollectionReusableView {
return view
}()
+ private lazy var dosSettingButton: SymbolButton = {
+ let title = GameType.dos.coreConfigTitle
+ let view = SymbolButton(image: GameType.dos.coreConfigIcon?.applySymbolConfig(size: 24), title: title, horizontalContian: true)
+ view.titleLabel.numberOfLines = 0
+ view.addTapGesture { [weak self] gesture in
+ guard let self = self else { return }
+ if let game = self.game {
+ CoreConfigsView.show(game: game)
+ }
+ }
+ view.isAccessibilityElement = true
+ view.accessibilityLabel = title
+ view.accessibilityTraits = .button
+ return view
+ }()
+
var didSegmentChange: ((_ index: Int)->Void)?
lazy var segmentView: BetterSegmentedControl = {
let titles = [R.string.localizable.readySegmentManualSave(), R.string.localizable.readySegmentAutoSave()]
@@ -1225,13 +1242,19 @@ class GameInfoDetailReusableView: UICollectionReusableView {
} else if game.gameType == .snes {
updateSNESFunctionButton()
} else if game.gameType == .ns || game.gameType == .xbox360 {
- updateNSFunctionButton()
+ hideDefaultFunctionButtons([retroButton, skinButton, cheatCodeButton])
} else if game.isAtari {
- updateAtariFunctionButton()
+ if game.gameType == .a5200 {
+ hideDefaultFunctionButtons([retroButton, cheatCodeButton])
+ } else {
+ hideDefaultFunctionButtons([cheatCodeButton])
+ }
} else if game.isJ2MECore {
updateJ2MEFunctionButton()
} else if game.gameType == .doom || (game.gameType == .arcade && game.defaultCore == 0) {
hideDefaultFunctionButtons([retroButton])
+ } else if game.gameType == .dos {
+ updateDOSFunctionButton()
}
addManualsButton()
hasSetupViews = true
@@ -1370,6 +1393,7 @@ class GameInfoDetailReusableView: UICollectionReusableView {
rightEyeRenderMenuButton.removeFromSuperview()
rightEyeRenderButton.removeFromSuperview()
threeDSAdvancedSettingButton.removeFromSuperview()
+ manualButton.removeFromSuperview()
if let lastView = functionButtonContainerView.subviews.last {
functionButtonContainerView.addSubview(threeDSAdvancedModeButton)
threeDSAdvancedModeButton.snp.makeConstraints { make in
@@ -1645,25 +1669,6 @@ class GameInfoDetailReusableView: UICollectionReusableView {
}
}
- private func hideDefaultFunctionButtons(_ buttons: [UIView]) {
- guard buttons.count > 0 else { return }
- var removeButtons = [UIView]()
- functionButtonContainerView.subviews.forEach { button in
- if buttons.contains(where: { $0 == button }) {
- removeButtons.append(button)
- }
- }
- if removeButtons.count > 0 {
- removeButtons.forEach { $0.removeFromSuperview() }
- }
- if let firstView = functionButtonContainerView.subviews.first {
- firstView.snp.makeConstraints { make in
- make.leading.centerY.equalToSuperview()
- make.size.equalTo(Constants.Size.IconSizeHuge)
- }
- }
- }
-
private func updatePS1FunctionButton() {
manualButton.removeFromSuperview()
psxImportSbiButton.removeFromSuperview()
@@ -1802,31 +1807,28 @@ class GameInfoDetailReusableView: UICollectionReusableView {
}
}
- private func updateNSFunctionButton() {
- functionButtonContainerView.subviews.forEach({ $0.removeFromSuperview() })
- }
-
- private func updateAtariFunctionButton() {
- if let game, game.gameType == .a5200 {
- hideDefaultFunctionButtons([retroButton, cheatCodeButton])
- } else {
- hideDefaultFunctionButtons([cheatCodeButton])
- }
- }
-
private func updateJ2MEFunctionButton() {
hideDefaultFunctionButtons([retroButton, cheatCodeButton])
- j2mesettingButton.removeFromSuperview()
+ j2meSettingButton.removeFromSuperview()
- skinButton.snp.makeConstraints { make in
- make.leading.centerY.equalToSuperview()
- make.size.equalTo(Constants.Size.IconSizeHuge)
+ if let lastView = functionButtonContainerView.subviews.last {
+ functionButtonContainerView.addSubview(j2meSettingButton)
+ j2meSettingButton.snp.makeConstraints { make in
+ make.leading.equalTo(lastView.snp.trailing).offset(Constants.Size.ContentSpaceMin)
+ make.centerY.equalToSuperview()
+ make.size.equalTo(Constants.Size.IconSizeHuge)
+ make.trailing.equalToSuperview()
+ }
}
+ }
+
+ private func updateDOSFunctionButton() {
+ hideDefaultFunctionButtons([retroButton, cheatCodeButton])
+ dosSettingButton.removeFromSuperview()
if let lastView = functionButtonContainerView.subviews.last {
- //VRAM
- functionButtonContainerView.addSubview(j2mesettingButton)
- j2mesettingButton.snp.makeConstraints { make in
+ functionButtonContainerView.addSubview(dosSettingButton)
+ dosSettingButton.snp.makeConstraints { make in
make.leading.equalTo(lastView.snp.trailing).offset(Constants.Size.ContentSpaceMin)
make.centerY.equalToSuperview()
make.size.equalTo(Constants.Size.IconSizeHuge)
@@ -1835,6 +1837,33 @@ class GameInfoDetailReusableView: UICollectionReusableView {
}
}
+ private func hideDefaultFunctionButtons(_ buttons: [UIView]) {
+ guard buttons.count > 0 else { return }
+ var removeButtons = [UIView]()
+ functionButtonContainerView.subviews.forEach { button in
+ if buttons.contains(where: { $0 == button }) {
+ removeButtons.append(button)
+ }
+ }
+ if removeButtons.count > 0 {
+ removeButtons.forEach { $0.removeFromSuperview() }
+ }
+
+ let visableSubViews = functionButtonContainerView.subviews.filter({ !$0.isKind(of: ContextMenuButton.self) })
+ for (index, subView) in visableSubViews.enumerated() {
+
+ subView.snp.remakeConstraints { make in
+ if index == 0 {
+ make.leading.equalToSuperview()
+ } else {
+ make.leading.equalTo(visableSubViews[index-1].snp.trailing).offset(Constants.Size.ContentSpaceMin)
+ }
+ make.centerY.equalToSuperview()
+ make.size.equalTo(Constants.Size.IconSizeHuge)
+ }
+ }
+ }
+
private func addManualsButton() {
//添加游戏手册按钮
manualButton.removeFromSuperview()
diff --git a/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/J2MESettingView.swift b/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/J2MESettingView.swift
index 27c90392..31413055 100644
--- a/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/J2MESettingView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/J2MESettingView.swift
@@ -416,7 +416,7 @@ class J2MESettingView: BaseView {
make.height.equalTo(Constants.Size.ItemHeightMid)
}
- let icon = UIImageView(image: R.image.customJava()!.applySymbolConfig(size: 30))
+ let icon = UIImageView(image: game.gameType.coreConfigIcon?.applySymbolConfig(size: 30))
icon.contentMode = .scaleAspectFit
navigationBlurView.addSubview(icon)
icon.snp.makeConstraints { make in
@@ -425,7 +425,7 @@ class J2MESettingView: BaseView {
make.centerY.equalToSuperview()
}
let headerTitleLabel = UILabel()
- headerTitleLabel.text = R.string.localizable.j2MESettings()
+ headerTitleLabel.text = game.gameType.coreConfigTitle
headerTitleLabel.textColor = Constants.Color.LabelPrimary
headerTitleLabel.font = Constants.Font.title(size: .s)
navigationBlurView.addSubview(headerTitleLabel)
diff --git a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameCoverView.swift b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameCoverView.swift
index b42c6847..81169e77 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameCoverView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameCoverView.swift
@@ -235,8 +235,10 @@ class GameCoverView: UIView {
image = style == .style2 ? R.image.xbox360_cover_v() : R.image.xbox360_cover_h()
} else if gameType == .j2me {
image = style == .style2 ? R.image.j2me_cover_v() : R.image.j2me_cover_h()
- } else if gameType == .doom {
+ } else if gameType == .doom {
image = style == .style2 ? R.image.doom_cover_v() : R.image.doom_cover_h()
+ } else if gameType == .dos {
+ image = style == .style2 ? R.image.dos_cover_v() : R.image.dos_cover_h()
}
if UIDevice.isPhone, !UIDevice.isLandscape, scalePlatform, Constants.Size.GamesPerRow != 2, let unwrapImage = image {
image = unwrapImage.scaled(toWidth: unwrapImage.size.width * (1/(Constants.Size.GamesPerRow-1)))
diff --git a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameListView.swift b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameListView.swift
index 929e23f9..11dd91f2 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameListView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameListView.swift
@@ -710,6 +710,8 @@ class GameListView: BaseView {
if game.gameType == .j2me {
game.deleteJ2meSaves()
+ } else if game.gameType == .dos {
+ game.deleteDosFiles()
} else {
if game.isSaveExtsts {
if game.gameType == .psp, let code = game.gameCodeForPSP {
@@ -1218,6 +1220,21 @@ extension GameListView: UICollectionViewDelegate {
firstGroup.append(action)
}
}
+
+ if game.gameType == .dos, !game.isDOSHomeMenuGame {
+ let realm = Database.realm
+ if let _ = realm.object(ofType: Game.self, forPrimaryKey: Game.DOSHomeMenuPrimaryKey) {} else {
+ //add gen home menu action
+ firstGroup.append(UIAction(title: R.string.localizable.generateHomeMenu(), image: .symbolImage(.house)) { _ in
+ let game = Game()
+ game.id = Game.DOSHomeMenuPrimaryKey
+ game.name = Game.DOSHomeMenuPrimaryKey
+ try? realm.write {
+ realm.add(game)
+ }
+ })
+ }
+ }
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GamesCollectionReusableView.swift b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GamesCollectionReusableView.swift
index 55e3b661..0dce6606 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GamesCollectionReusableView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GamesCollectionReusableView.swift
@@ -218,6 +218,8 @@ class GamesCollectionReusableView: UICollectionReusableView {
image = R.image.j2me_group_brand(compatibleWith: traitCollection)
} else if gameType == .doom {
image = R.image.doom_group_brand(compatibleWith: traitCollection)
+ } else if gameType == .dos {
+ image = R.image.dos_group_brand(compatibleWith: traitCollection)
}
Self.brandImageCaches[key] = image
return image
diff --git a/ManicEmu/ManicEmu/Sources/Business/Import/Views/GameSaveMatchGameView.swift b/ManicEmu/ManicEmu/Sources/Business/Import/Views/GameSaveMatchGameView.swift
index de74b0a6..ada04161 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Import/Views/GameSaveMatchGameView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Import/Views/GameSaveMatchGameView.swift
@@ -72,7 +72,6 @@ class GameSaveMatchGameView: BaseView {
let detailLabel = UILabel()
detailLabel.numberOfLines = 0
- detailLabel.textAlignment = .center
detailLabel.text = detail
detailLabel.font = Constants.Font.body(size: .m)
detailLabel.textColor = Constants.Color.LabelPrimary
@@ -192,7 +191,6 @@ class GameSaveMatchGameView: BaseView {
let detailLabel = UILabel()
detailLabel.numberOfLines = 0
- detailLabel.textAlignment = .center
detailLabel.text = detail
detailLabel.font = Constants.Font.body(size: .m)
detailLabel.textColor = Constants.Color.LabelPrimary
diff --git a/ManicEmu/ManicEmu/Sources/Business/Play/Models/Game.swift b/ManicEmu/ManicEmu/Sources/Business/Play/Models/Game.swift
index d3d097a2..f6c43dfe 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Play/Models/Game.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Play/Models/Game.swift
@@ -89,12 +89,12 @@ class Game: Object, ObjectUpdatable {
@Persisted var pallete: GameSetting.Palette = .None
///是否强制全屏 不进行同步
var forceFullSkin: Bool = false
- ///当前光盘的index 多碟游戏才有效
- var currentDiskIndex: UInt = 0
- ///当前游戏总共有多少张光盘 多碟游戏才有效
- var totalDiskCount: UInt = 0
+
static let DsHomeMenuPrimaryKey = "Home Menu"
static let DsiHomeMenuPrimaryKey = "Home Menu (DSi)"
+
+ static let DOSHomeMenuPrimaryKey = "Home Menu (DOSBox)"
+
///安全模式
var safeMode = false
@@ -198,6 +198,17 @@ class Game: Object, ObjectUpdatable {
return URL(fileURLWithPath: Constants.Path.Holani.appendingPathComponent("\(name).srm"))
} else if gameType == .j2me {
return URL(fileURLWithPath: Constants.Path.Data.appendingPathComponent("\(name).\(defaultCore == 0 ? LibretroCore.Cores.J2meJS.name : LibretroCore.Cores.freej2me.name).\(gameType.manicEmuCore?.gameSaveExtension ?? "")"))
+ } else if gameType == .dos {
+ if let enumerator = FileManager.default.enumerator(at: URL(fileURLWithPath: Constants.Path.DOSBoxPure), includingPropertiesForKeys: [.isDirectoryKey]) {
+ for case let fileURL as URL in enumerator {
+ let isDirectory = (try? fileURL.resourceValues(forKeys: [.isDirectoryKey]))?.isDirectory ?? false
+ guard !isDirectory else { continue }
+ if fileURL.lastPathComponent == "\(name).\(gameType.manicEmuCore?.gameSaveExtension ?? "")" {
+ return fileURL
+ }
+ }
+ }
+ return URL(fileURLWithPath: Constants.Path.DOSBoxPure.appendingPathComponent("\(name).\(gameType.manicEmuCore?.gameSaveExtension ?? "")"))
}
let localUrl = URL(fileURLWithPath: Constants.Path.Data.appendingPathComponent("\(name).\(gameType.manicEmuCore?.gameSaveExtension ?? "")"))
@@ -401,6 +412,8 @@ class Game: Object, ObjectUpdatable {
return Bundle.main.path(forResource: "virtualjaguar.libretro", ofType: "framework", inDirectory: "Frameworks")
} else if gameType == .lynx {
return Bundle.main.path(forResource: "holani.libretro", ofType: "framework", inDirectory: "Frameworks")
+ } else if gameType == .dos {
+ return Bundle.main.path(forResource: "dosbox.pure.libretro", ofType: "framework", inDirectory: "Frameworks")
}
return nil
}
@@ -500,7 +513,7 @@ class Game: Object, ObjectUpdatable {
}
var supportRetroAchievements: Bool {
- if gameType == ._3ds || gameType == .doom || gameType == .a5200 {
+ if gameType == ._3ds || gameType == .doom || gameType == .a5200 || gameType == .dos {
return false
}
if gameType == .arcade, defaultCore == 0 {
@@ -518,6 +531,8 @@ class Game: Object, ObjectUpdatable {
var supportSwapDisc: Bool {
if fileExtension.lowercased() == "m3u" || fileExtension.lowercased() == "pbp" {
return true
+ } else if gameType == .dos, let diskCount = diskInfo?.diskCount, diskCount > 0 {
+ return true
}
return false
}
@@ -752,6 +767,55 @@ class Game: Object, ObjectUpdatable {
try? FileManager.safeRemoveItem(at: freej2meUrl)
SyncManager.delete(localFilePath: freej2meUrl.path)
}
+
+ func getStoreCoreConfigs() -> [String: String]? {
+ guard isLibretroType else { return nil }
+ if let coreConfigsString = getExtraString(key: ExtraKey.coreConfigs.rawValue),
+ let jsonData = coreConfigsString.data(using: .utf8),
+ let json = try? JSONSerialization.jsonObject(with: jsonData) as? [String: String] {
+ return json
+ }
+ return nil
+ }
+
+ func getStoreCoreConfigsString() -> String? {
+ if let coreConfigs = getStoreCoreConfigs() {
+ var result = ""
+ for (key, value) in coreConfigs {
+ result += "\(key) = \"\(value)\"\n"
+ }
+ return result
+ }
+ return nil
+ }
+
+ var diskInfo: LibretroDisk? { LibretroCore.sharedInstance().getDiskInfo() }
+
+ func deleteDosFiles() {
+ var fileUrls = [URL]()
+ if let enumerator = FileManager.default.enumerator(at: URL(fileURLWithPath: Constants.Path.DOSBoxPure), includingPropertiesForKeys: [.isDirectoryKey]) {
+ for case let fileURL as URL in enumerator {
+ let isDirectory = (try? fileURL.resourceValues(forKeys: [.isDirectoryKey]))?.isDirectory ?? false
+ guard !isDirectory else { continue }
+ if fileURL.lastPathComponent.contains(name) {
+ fileUrls.append(fileURL)
+ }
+ }
+ }
+
+ fileUrls.forEach({
+ try? FileManager.safeRemoveItem(at: $0)
+ SyncManager.delete(localFilePath: $0.path)
+ })
+ }
+
+ var isDOSHomeMenuGame: Bool {
+ guard gameType == .dos else { return false }
+ if id == Game.DOSHomeMenuPrimaryKey {
+ return true
+ }
+ return false
+ }
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Play/Models/GameSetting.swift b/ManicEmu/ManicEmu/Sources/Business/Play/Models/GameSetting.swift
index ea7001ca..e47418a6 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Play/Models/GameSetting.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Play/Models/GameSetting.swift
@@ -502,7 +502,7 @@ struct GameSetting: SettingCellItem {
enum ItemType: Int, CaseIterable {
//位置很重要 新增内容一定要接到最后面
- case saveState, quickLoadState, volume, fastForward, stateList, cheatCode, skins, filter, screenShot, haptic, airplay, controllerSetting, orientation, functionSort, reload, quit, swapScreen, resolution, consoleHome, amiibo, toggleFullscreen, simBlowing, palette, swapDisk, retro, airPlayScaling, airPlayLayout, toggleAnalog, gameplayManuals, triggerPro, screenScaling, j2meSettings
+ case saveState, quickLoadState, volume, fastForward, stateList, cheatCode, skins, filter, screenShot, haptic, airplay, controllerSetting, orientation, functionSort, reload, quit, swapScreen, resolution, consoleHome, amiibo, toggleFullscreen, simBlowing, palette, swapDisk, retro, airPlayScaling, airPlayLayout, toggleAnalog, gameplayManuals, triggerPro, screenScaling, j2meSettings, dosSettings, insertDisc
}
var type: ItemType
@@ -593,6 +593,10 @@ struct GameSetting: SettingCellItem {
UIImage(symbol: .arrowUpRightAndArrowDownLeftRectangle)
case .j2meSettings:
R.image.customJava()!.applySymbolConfig(size: 30)
+ case .dosSettings:
+ R.image.customDos()!.applySymbolConfig(size: 24)
+ case .insertDisc:
+ R.image.customInsertDisc()!.applySymbolConfig(size: 24)
}
}
@@ -665,7 +669,11 @@ struct GameSetting: SettingCellItem {
case .screenScaling:
R.string.localizable.screenScaling()
case .j2meSettings:
- R.string.localizable.j2MESettings()
+ GameType.j2me.coreConfigTitle
+ case .dosSettings:
+ GameType.dos.coreConfigTitle
+ case .insertDisc:
+ R.string.localizable.insertDisc()
}
}
@@ -674,131 +682,103 @@ struct GameSetting: SettingCellItem {
return mappingOnlyType.enable(for: gameType, defaultCore: defaultCore)
}
- if type == .airPlayLayout {
- return gameType == .ds || (gameType == ._3ds && defaultCore == 1)
- }
-
- if type == .toggleAnalog {
- return gameType == .ps1
- }
-
- if type == .j2meSettings {
- return gameType == .j2me
- }
-
+ var disableTypes = [GameSetting.ItemType]()
switch gameType {
- case .j2me:
- if type == .saveState ||
- type == .quickLoadState ||
- (type == .fastForward && defaultCore == 1) ||
- type == .stateList ||
- type == .cheatCode ||
- type == .filter ||
- type == .swapScreen ||
- type == .resolution ||
- type == .consoleHome ||
- type == .amiibo ||
- type == .simBlowing ||
- type == .palette ||
- type == .swapDisk ||
- type == .retro ||
- type == .airPlayLayout ||
- type == .toggleAnalog {
- return false
- }
- return true
-
- case .doom:
- if type == .swapScreen || type == .consoleHome || type == .amiibo || type == .simBlowing || type == .palette || type == .retro {
- return false
- }
- return true
-
- case .a2600, .a5200, .a7800, .lynx, .jaguar:
- if gameType == .a5200, type == .retro {
- return false
- }
-
- if gameType == .jaguar && (type == .saveState || type == .quickLoadState || type == .stateList) {
- return false
- }
-
- if type == .cheatCode || type == .swapScreen || type == .resolution || type == .consoleHome || type == .amiibo || type == .simBlowing || type == .palette || type == .swapDisk || type == .airPlayLayout || type == .toggleAnalog {
- return false
- }
- return true
+ case .nes:
+ disableTypes += [.swapScreen, .resolution, .consoleHome, .amiibo, .simBlowing, .airPlayLayout, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
+ case .fds:
+ disableTypes += [.swapScreen, .resolution, .consoleHome, .amiibo, .simBlowing, .swapDisk, .airPlayLayout, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
+ case .snes:
+ disableTypes += [.swapScreen, .resolution, .consoleHome, .amiibo, .simBlowing, .palette, .swapDisk, .simBlowing, .airPlayLayout, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
case ._3ds:
if defaultCore == 0 {
- if type == .fastForward || type == .filter || type == .palette || type == .swapDisk || type == .retro || type == .airPlayScaling || type == .screenScaling {
- return false
- }
+ disableTypes += [.fastForward, .filter, .palette, .swapDisk, .retro, .airPlayScaling, .screenScaling, .airPlayLayout, .toggleAnalog, .j2meSettings, .screenScaling, .dosSettings, .insertDisc]
} else {
- if type == .palette || type == .swapDisk || type == .retro || type == .consoleHome {
- return false
- }
- }
- return true
+ disableTypes += [.palette, .swapDisk, .retro, .consoleHome, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
+ }
+ case .gbc:
+ disableTypes += [.swapScreen, .resolution, .consoleHome, .amiibo, .simBlowing, .palette, .swapDisk, .simBlowing, .airPlayLayout, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
+ case .gb:
+ disableTypes += [.swapScreen, .resolution, .consoleHome, .amiibo, .simBlowing, .swapDisk, .simBlowing, .airPlayLayout, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
+ case .gba:
+ disableTypes += [.swapScreen, .resolution, .consoleHome, .amiibo, .simBlowing, .palette, .swapDisk, .simBlowing, .airPlayLayout, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
case .ds:
- if (type == .resolution && defaultCore == 0) || type == .consoleHome || type == .amiibo || type == .palette || type == .swapDisk {
- return false
- }
- return true
- case .gba, .gbc, .gb, .nes, .fds, .snes, .md, .mcd, ._32x, .gg, .sg1000, .ms, .ss, .vb, .pm, .arcade:
- if (gameType == .gb || gameType == .vb || gameType == .pm || gameType == .nes || gameType == .fds) && type == .palette {
- return true
- }
-
- if gameType == ._32x || gameType == .mcd {
- //JGenesis核心
- let notEnableForJGenesis = (type == .cheatCode || type == .filter || type == .retro || type == .swapDisk || type == .screenScaling)
- if defaultCore == 1 && notEnableForJGenesis {
- return false
- }
- }
-
- if ((gameType == .mcd && defaultCore == 2) || (gameType == .md && defaultCore == 0)) && type == .cheatCode {
- //ClownMDEmu核心
- return false
- }
-
- if (gameType == .mcd || gameType == .ss || gameType == .fds) && type == .swapDisk {
- return true
- }
-
- if (gameType == .vb || gameType == .pm) && type == .cheatCode {
- return false
- }
-
- if (gameType == .nes || gameType == .fds) && type == .simBlowing {
- return true
- }
-
- if gameType == .arcade, type == .retro, defaultCore == 0 {
- return false
+ if defaultCore == 0 {
+ disableTypes += [.resolution, .consoleHome, .amiibo, .palette, .amiibo, .swapDisk, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
+ } else {
+ disableTypes += [.consoleHome, .amiibo, .palette, .amiibo, .swapDisk, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
}
-
- if type == .swapScreen || type == .resolution || type == .consoleHome || type == .amiibo || type == .simBlowing || type == .palette || type == .swapDisk {
- return false
+ case .psp:
+ disableTypes += [.swapScreen, .consoleHome, .amiibo, .simBlowing, .palette, .swapDisk, .airPlayLayout, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
+ case .md:
+ if defaultCore == 0 {
+ disableTypes += [.swapScreen, .resolution, .consoleHome, .amiibo, .simBlowing, .palette, .swapDisk, .simBlowing, .cheatCode, .airPlayLayout, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
+ } else {
+ disableTypes += [.swapScreen, .resolution, .consoleHome, .amiibo, .simBlowing, .palette, .swapDisk, .simBlowing, .airPlayLayout, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
}
- return true
- case .psp, .n64:
- if type == .swapScreen || type == .consoleHome || type == .amiibo || type == .simBlowing || type == .palette || type == .swapDisk {
- return false
+ case .mcd:
+ if defaultCore == 0 {
+ disableTypes += [.swapScreen, .resolution, .consoleHome, .amiibo, .simBlowing, .palette, .swapDisk, .airPlayLayout, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
+ } else {
+ disableTypes += [.swapScreen, .resolution, .consoleHome, .amiibo, .simBlowing, .palette, .cheatCode, .filter, .retro, .screenScaling, .airPlayLayout, .toggleAnalog, .j2meSettings, .dosSettings]
}
- return true
+ case ._32x:
+ if defaultCore == 0 {
+ disableTypes += [.swapScreen, .resolution, .consoleHome, .amiibo, .simBlowing, .palette, .swapDisk, .airPlayLayout, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
+ } else {
+ disableTypes += [.swapScreen, .resolution, .consoleHome, .amiibo, .simBlowing, .palette, .swapDisk, .cheatCode, .filter, .retro, .swapDisk, .screenScaling, .airPlayLayout, .toggleAnalog, .j2meSettings, .screenScaling, .dosSettings, .insertDisc]
+ }
+ case .sg1000:
+ disableTypes += [.swapScreen, .resolution, .consoleHome, .amiibo, .simBlowing, .palette, .swapDisk, .airPlayLayout, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
+ case .gg:
+ disableTypes += [.swapScreen, .resolution, .consoleHome, .amiibo, .simBlowing, .palette, .swapDisk, .airPlayLayout, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
+ case .ms:
+ disableTypes += [.swapScreen, .resolution, .consoleHome, .amiibo, .simBlowing, .palette, .swapDisk, .airPlayLayout, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
+ case .ss:
+ disableTypes += [.swapScreen, .resolution, .consoleHome, .amiibo, .simBlowing, .palette, .airPlayLayout, .toggleAnalog, .j2meSettings, .dosSettings]
+ case .n64:
+ disableTypes += [.swapScreen, .consoleHome, .amiibo, .simBlowing, .palette, .swapDisk, .airPlayLayout, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
+ case .vb:
+ disableTypes += [.swapScreen, .consoleHome, .amiibo, .simBlowing, .swapDisk, .cheatCode, .resolution, .airPlayLayout, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
+ case .pm:
+ disableTypes += [.swapScreen, .consoleHome, .amiibo, .simBlowing, .swapDisk, .cheatCode, .resolution, .airPlayLayout, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
case .ps1:
- if type == .swapScreen || type == .consoleHome || type == .amiibo || type == .simBlowing || type == .palette {
- return false
- }
- return true
+ disableTypes += [.swapScreen, .consoleHome, .amiibo, .simBlowing, .palette, .airPlayLayout, .j2meSettings, .dosSettings]
case .dc:
- if type == .swapScreen || type == .consoleHome || type == .amiibo || type == .simBlowing || type == .palette || type == .cheatCode {
- return false
+ disableTypes += [.swapScreen, .consoleHome, .amiibo, .simBlowing, .palette, .cheatCode, .airPlayLayout, .toggleAnalog, .j2meSettings, .dosSettings]
+ case .doom:
+ disableTypes += [.swapScreen, .consoleHome, .amiibo, .simBlowing, .palette, .retro, .swapDisk, .airPlayLayout, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
+ case .arcade:
+ if defaultCore == 0 {
+ disableTypes += [.swapScreen, .consoleHome, .amiibo, .simBlowing, .palette, .swapDisk, .retro, .resolution, .airPlayLayout, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
+ } else {
+ disableTypes += [.swapScreen, .consoleHome, .amiibo, .simBlowing, .palette, .swapDisk, .resolution, .airPlayLayout, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
+ }
+ case .a2600:
+ disableTypes += [.cheatCode, .swapScreen, .resolution, .consoleHome, .amiibo, .simBlowing, .palette, .swapDisk, .airPlayLayout, .toggleAnalog, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
+ case .a5200:
+ disableTypes += [.cheatCode, .swapScreen, .resolution, .consoleHome, .amiibo, .simBlowing, .palette, .swapDisk, .airPlayLayout, .toggleAnalog, .retro, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
+ case .a7800:
+ disableTypes += [.cheatCode, .swapScreen, .resolution, .consoleHome, .amiibo, .simBlowing, .palette, .swapDisk, .airPlayLayout, .toggleAnalog, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
+ case .jaguar:
+ disableTypes += [.cheatCode, .swapScreen, .resolution, .consoleHome, .amiibo, .simBlowing, .palette, .swapDisk, .airPlayLayout, .toggleAnalog, .saveState, .quickLoadState, .stateList, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
+ case .lynx:
+ disableTypes += [.cheatCode, .swapScreen, .resolution, .consoleHome, .amiibo, .simBlowing, .palette, .swapDisk, .airPlayLayout, .toggleAnalog, .toggleAnalog, .j2meSettings, .dosSettings, .insertDisc]
+ case .j2me:
+ if defaultCore == 0 {
+ disableTypes += [.saveState, .quickLoadState, .stateList, .cheatCode, .filter, .swapScreen, .resolution, .consoleHome, .amiibo, .simBlowing, .palette, .swapDisk, .retro, .airPlayLayout, .toggleAnalog, .toggleAnalog, .dosSettings, .insertDisc]
+ } else {
+ disableTypes += [.saveState, .quickLoadState, .stateList, .cheatCode, .filter, .swapScreen, .resolution, .consoleHome, .amiibo, .simBlowing, .palette, .swapDisk, .retro, .airPlayLayout, .toggleAnalog, .fastForward, .toggleAnalog, .dosSettings, .insertDisc]
}
- return true
- default:
+ case .dos:
+ disableTypes += [.cheatCode, .swapScreen, .resolution, .consoleHome, .amiibo, .simBlowing, .palette, .retro, .airPlayLayout, .toggleAnalog, .j2meSettings, .toggleAnalog, .j2meSettings]
+
+ default: return false
+ }
+ if disableTypes.contains([type]) {
return false
}
+ return true
}
var enableLongPress: Bool {
@@ -880,6 +860,10 @@ struct GameSetting: SettingCellItem {
return "screenScaling"
case .j2meSettings:
return "j2meSettings"
+ case .dosSettings:
+ return "dosSettings"
+ case .insertDisc:
+ return "insertDisc"
}
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift b/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift
index 75a7500f..5f26b686 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift
@@ -233,7 +233,7 @@ class PlayViewController: GameViewController {
return
}
- if game.isRomExtsts || game.isNDSHomeMenuGame {
+ if game.isRomExtsts || game.isNDSHomeMenuGame || game.isDOSHomeMenuGame {
UIView.hideLoadingToast(forceHide: true)
func showPlayView() {
if game.isBIOSMissing() {
@@ -735,6 +735,14 @@ class PlayViewController: GameViewController {
make.top.equalTo(gameView.snp.bottom).offset(-9)
} else if manicGame.gameType == .j2me {
make.top.equalTo(gameView.snp.bottom).offset(2)
+ } else if manicGame.gameType == .dos {
+ if UIDevice.isPad {
+ make.top.equalTo(gameView.snp.bottom).offset(UIDevice.isLandscape ? 30 : 40)
+ } else if UIDevice.isSmallScreenPhone {
+ make.top.equalTo(gameView.snp.bottom).offset(17)
+ } else {
+ make.top.equalTo(gameView.snp.bottom).offset(22)
+ }
} else {
make.top.equalTo(gameView.snp.bottom)
}
@@ -743,7 +751,7 @@ class PlayViewController: GameViewController {
} else {
make.leading.trailing.equalTo(gameView)
}
- if manicGame.gameType == .j2me {
+ if manicGame.gameType == .j2me || manicGame.gameType == .dos {
make.height.equalTo(30)
} else {
make.height.equalTo(Constants.Size.ItemHeightMid)
@@ -1173,10 +1181,6 @@ extension PlayViewController {
}
} else {
pauseEmulation()
- if manicGame.supportSwapDisc {
- manicGame.totalDiskCount = LibretroCore.sharedInstance().getDiskCount()
- manicGame.currentDiskIndex = LibretroCore.sharedInstance().getCurrentDiskIndex()
- }
GameSettingView.show(game: manicGame,
didSelectItem: { [weak self] item, sheet in
//点击菜单选项
@@ -1334,10 +1338,12 @@ extension PlayViewController {
if manicGame.gameType == .fds {
handleMenuGameSetting(GameSetting(type: .swapDisk, currentDiskIndex: 0), nil)
} else {
- let currentIndex = LibretroCore.sharedInstance().getCurrentDiskIndex()
- let totalCount = LibretroCore.sharedInstance().getDiskCount()
- let nextIndex = currentIndex + 1 < totalCount ? currentIndex + 1 : 0
- handleMenuGameSetting(GameSetting(type: .swapDisk, currentDiskIndex: nextIndex), nil)
+ if let diskInfo = manicGame.diskInfo {
+ let currentIndex = diskInfo.currentDiskIndex
+ let totalCount = diskInfo.diskCount
+ let nextIndex = currentIndex + 1 < totalCount ? currentIndex + 1 : 0
+ handleMenuGameSetting(GameSetting(type: .swapDisk, currentDiskIndex: UInt(nextIndex)), nil)
+ }
}
} else if input.stringValue == "toggleAnalog" {
handleMenuGameSetting(GameSetting(type: .toggleAnalog), nil)
@@ -1367,6 +1373,38 @@ extension PlayViewController {
handleMenuGameSetting(GameSetting(type: .screenScaling, screenScaling: manicGame.screenScaling.next), nil)
} else if input.stringValue == "j2meSettings" {
handleMenuGameSetting(GameSetting(type: .j2meSettings), nil)
+ } else if input.stringValue == "dosSettings" {
+ handleMenuGameSetting(GameSetting(type: .dosSettings), nil)
+ } else if input.stringValue == "insertDisc" {
+ handleMenuGameSetting(GameSetting(type: .insertDisc), nil)
+ } else if input.stringValue == "useKeyboardSkin" {
+ guard manicGame.gameType == .dos else {
+ UIView.makeToast(message: R.string.localizable.notSupportGameSetting(manicGame.gameType.localizedShortName))
+ return
+ }
+ let realm = Database.realm
+ if let skin = realm.objects(Skin.self).where({
+ $0.gameType == .dos &&
+ $0.skinType == .buildIn &&
+ $0.identifier == Constants.Strings.DOSKeyboardSkinID
+ }).first {
+ try? realm.write {
+ manicGame.portraitSkin = skin
+ manicGame.landscapeSkin = skin
+ }
+ }
+ } else if input.stringValue == "useJoypadSkin" {
+ guard manicGame.gameType == .dos else {
+ UIView.makeToast(message: R.string.localizable.notSupportGameSetting(manicGame.gameType.localizedShortName))
+ return
+ }
+ let realm = Database.realm
+ if let skin = realm.objects(Skin.self).where({ $0.gameType == .dos && $0.skinType == .default }).first {
+ try? realm.write {
+ manicGame.portraitSkin = skin
+ manicGame.landscapeSkin = skin
+ }
+ }
}
}
@@ -1782,6 +1820,8 @@ extension PlayViewController {
self.dismiss(animated: true)
}
} else if manicGame.isLibretroType {
+ LibretroCore.sharedInstance().updateLibretroConfig("savefile_directory", value: Constants.Path.LibretroSavePath.libretroPath)
+ LibretroCore.sharedInstance().updateLibretroConfig("system_directory", value: Constants.Path.System.libretroPath)
LibretroCore.sharedInstance().stop()
gameMetalView = nil;
DispatchQueue.main.asyncAfter(delay: 0.5) {
@@ -2010,7 +2050,7 @@ extension PlayViewController {
return true
}
- guard manicGame.gameType == .mcd || manicGame.gameType == .ss || manicGame.gameType == .ps1 || manicGame.gameType == .dc else { return false }
+ guard manicGame.gameType == .mcd || manicGame.gameType == .ss || manicGame.gameType == .ps1 || manicGame.gameType == .dc || manicGame.gameType == .dos else { return false }
if manicGame.supportSwapDisc {
LibretroCore.sharedInstance().setDiskIndex(UInt32(item.currentDiskIndex), delay: manicGame.gameType == .ps1 ? true : false)
UIView.makeToast(message: R.string.localizable.discInsert(Int(item.currentDiskIndex + 1)))
@@ -2141,6 +2181,68 @@ extension PlayViewController {
//MARK: handleMenuGameSetting.j2meSettings
J2MESettingView.show(game: manicGame)
return false
+ case .dosSettings:
+ //MARK: handleMenuGameSetting.dosSettings
+ CoreConfigsView.show(game: manicGame, configChange: {
+ Log.debug("change DOS config:\($0)")
+ LibretroCore.sharedInstance().updateRunningCoreConfigs($0, flush: false)
+ })
+ return false
+ case .insertDisc:
+ //MARK: handleMenuGameSetting.insertDisc
+ UIView.makeAlert(title: R.string.localizable.insertDisc(),
+ detail: R.string.localizable.insertDiscAlert(),
+ cancelTitle: R.string.localizable.transferPakFromLibrary(),
+ confirmTitle: R.string.localizable.transferPakFromFiles(), cancelAction: { [weak self] in
+ guard let self else { return }
+ let realm = Database.realm
+ let objects = realm.objects(Game.self).where({ $0.gameType == self.manicGame.gameType && !$0.isDeleted })
+ var games = [Game]()
+ games.append(contentsOf: objects)
+ if games.count > 0 {
+ GameSaveMatchGameView.show(showGames: games,
+ title: R.string.localizable.insertDisc(),
+ detail: "",
+ cancelTitle: R.string.localizable.cancelTitle(), completion: { game in
+ if let path = game?.romUrl.path {
+ if LibretroCore.sharedInstance().insertDisk(path) {
+ UIView.makeToast(message: R.string.localizable.discInsert(self.manicGame.diskInfo?.currentDiskIndex ?? 0))
+ } else {
+ UIView.makeToast(message: R.string.localizable.insertDiscFailed())
+ }
+ } else {
+ UIView.makeToast(message: R.string.localizable.transferPakNoGames())
+ }
+ })
+ } else {
+ UIView.makeToast(message: R.string.localizable.transferPakNoGames())
+ }
+ }, confirmAction: { [weak self] in
+ guard let self else { return }
+ let types = UTType.getGameTypes(gameType: self.manicGame.gameType)
+ DispatchQueue.main.asyncAfter(delay: 1) {
+ FilesImporter.shared.presentImportController(supportedTypes: types,
+ allowsMultipleSelection: false,
+ manualHandle: { urls in
+ if let url = urls.first {
+ let toCachePath = Constants.Path.Cache.appendingPathComponent(url.lastPathComponent)
+ if !FileManager.default.fileExists(atPath: toCachePath) {
+ UIView.makeLoading()
+ try? FileManager.safeCopyItem(at: url, to: URL(fileURLWithPath: toCachePath))
+ DispatchQueue.main.async {
+ UIView.hideLoading()
+ }
+ }
+ if LibretroCore.sharedInstance().insertDisk(toCachePath) {
+ UIView.makeToast(message: R.string.localizable.discInsert(self.manicGame.diskInfo?.currentDiskIndex ?? 0))
+ } else {
+ UIView.makeToast(message: R.string.localizable.insertDiscFailed())
+ }
+ }
+ })
+ }
+ })
+ return false
}
//默认关闭菜单
return true
@@ -2673,6 +2775,8 @@ extension PlayViewController {
configs: ["prboom-resolution": option,
"prboom-rumble": "enabled"],
reload: false)
+ } else if manicGame.gameType == .dos {
+ LibretroCore.sharedInstance().updateConfig(LibretroCore.Cores.DOSBoxPure.name, content: manicGame.getStoreCoreConfigsString(), reload: false)
}
//配置静音模式
@@ -2710,7 +2814,8 @@ extension PlayViewController {
"camera_driver": "avfoundation",
"microphone_enable": enableMircophone ? "true" : "false",
"microphone_driver": "coreaudio",
- "audio_latency": "200"
+ "audio_latency": "200",
+ "input_auto_game_focus": "1"
])
if manicGame.isN64ParaLLEl {
LibretroCore.sharedInstance().setReloadDelay(1)
@@ -2739,7 +2844,7 @@ extension PlayViewController {
LibretroCore.sharedInstance().updateLibretroConfig("cheevos_enable", value: "false")
}
- //适配PKSM修改存档位置
+ //修改存档位置
if manicGame.gameType == .gb {
LibretroCore.sharedInstance().updateLibretroConfig("savefile_directory", value: Constants.Path.GBSavePath.libretroPath)
} else if manicGame.gameType == .gbc {
@@ -2752,6 +2857,8 @@ extension PlayViewController {
LibretroCore.sharedInstance().updateLibretroConfig("savefile_directory", value: Constants.Path.DSSavePath.libretroPath)
} else if manicGame.gameType == .doom {
LibretroCore.sharedInstance().updateLibretroConfig("savefile_directory", value: Constants.Path.PrBoom.libretroPath)
+ } else if manicGame.gameType == .dos {
+ LibretroCore.sharedInstance().updateLibretroConfig("savefile_directory", value: Constants.Path.DOSBoxPure.libretroPath)
} else {
LibretroCore.sharedInstance().updateLibretroConfig("savefile_directory", value: Constants.Path.LibretroSavePath.libretroPath)
}
@@ -2762,6 +2869,8 @@ extension PlayViewController {
//配置System的位置
if manicGame.gameType == .dc {
LibretroCore.sharedInstance().updateLibretroConfig("system_directory", value: Constants.Path.Flycast)
+ } else if manicGame.gameType == .dos {
+ LibretroCore.sharedInstance().updateLibretroConfig("system_directory", value: Constants.Path.DOSBoxPureSystem.libretroPath)
} else {
LibretroCore.sharedInstance().updateLibretroConfig("system_directory", value: Constants.Path.System.libretroPath)
}
@@ -2981,6 +3090,13 @@ extension PlayViewController {
"virtualjaguar_p2_retropad_analog_ru": "hash"
],
reload: false)
+ } else if manicGame.gameType == .doom {
+ LibretroCore.sharedInstance().updateConfig(LibretroCore.Cores.PrBoom.name,
+ configs: ["prboom-resolution": "320x200",
+ "prboom-rumble": "enabled"],
+ reload: false)
+ } else if manicGame.gameType == .dos {
+ LibretroCore.sharedInstance().updateConfig(LibretroCore.Cores.DOSBoxPure.name, content: nil, reload: false)
}
//配置静音模式
@@ -3028,7 +3144,7 @@ extension PlayViewController {
//RetroAchievements配置
LibretroCore.sharedInstance().updateLibretroConfig("cheevos_enable", value: "false")
- //适配PKSM修改存档位置
+ //修改存档位置
if manicGame.gameType == .gb {
LibretroCore.sharedInstance().updateLibretroConfig("savefile_directory", value: Constants.Path.GBSavePath.libretroPath)
} else if manicGame.gameType == .gbc {
@@ -3041,6 +3157,8 @@ extension PlayViewController {
LibretroCore.sharedInstance().updateLibretroConfig("savefile_directory", value: Constants.Path.DSSavePath.libretroPath)
} else if manicGame.gameType == .doom {
LibretroCore.sharedInstance().updateLibretroConfig("savefile_directory", value: Constants.Path.PrBoom.libretroPath)
+ } else if manicGame.gameType == .dos {
+ LibretroCore.sharedInstance().updateLibretroConfig("savefile_directory", value: Constants.Path.DOSBoxPure.libretroPath)
} else {
LibretroCore.sharedInstance().updateLibretroConfig("savefile_directory", value: Constants.Path.LibretroSavePath.libretroPath)
}
@@ -3051,6 +3169,8 @@ extension PlayViewController {
//配置System的位置
if manicGame.gameType == .dc {
LibretroCore.sharedInstance().updateLibretroConfig("system_directory", value: Constants.Path.Flycast)
+ } else if manicGame.gameType == .dos {
+ LibretroCore.sharedInstance().updateLibretroConfig("system_directory", value: Constants.Path.DOSBoxPureSystem.libretroPath)
} else {
LibretroCore.sharedInstance().updateLibretroConfig("system_directory", value: Constants.Path.System.libretroPath)
}
@@ -3139,6 +3259,9 @@ extension PlayViewController {
#else
setPreferredSkin()
#endif
+ //Set Skin Sound Effects
+ controllerView.enableSkinSoundEffects = Settings.defalut.getExtraBool(key: ExtraKey.skinSoundEffects.rawValue) ?? true
+
//更新背景
updateBackground()
@@ -3150,7 +3273,7 @@ extension PlayViewController {
updateFilter()
//尝试添加屏幕按钮
updateFunctionButton()
- if manicGame.gameType == .ds || manicGame.gameType == ._3ds {
+ if manicGame.gameType == .ds || manicGame.gameType == ._3ds || (manicGame.gameType == .dos && UIDevice.isPad) {
updateFunctionButtonContainer()
}
//更新3DS画面视图
@@ -3299,7 +3422,11 @@ extension PlayViewController {
gameSetting.volumeOn = manicGame.volume
gameSetting.hapticType = manicGame.haptic
let button = UIImageView(image: gameSetting.image.withRenderingMode(.alwaysTemplate).applySymbolConfig(color: Constants.Color.LabelTertiary))
- button.tintColor = Constants.Color.LabelTertiary
+ if manicGame.gameType == .dos {
+ button.tintColor = Constants.Color.LabelTertiary.forceStyle(.dark)
+ } else {
+ button.tintColor = Constants.Color.LabelTertiary
+ }
button.contentMode = .center
button.isUserInteractionEnabled = true
button.enableInteractive = true
@@ -3375,10 +3502,12 @@ extension PlayViewController {
if self.manicGame.gameType == .fds {
newGameSetting.currentDiskIndex = 0
} else {
- let currentIndex = LibretroCore.sharedInstance().getCurrentDiskIndex()
- let totalCount = LibretroCore.sharedInstance().getDiskCount()
- let nextIndex = currentIndex + 1 < totalCount ? currentIndex + 1 : 0
- newGameSetting.currentDiskIndex = nextIndex
+ if let diskInfo = manicGame.diskInfo {
+ let currentIndex = diskInfo.currentDiskIndex
+ let totalCount = diskInfo.diskCount
+ let nextIndex = currentIndex + 1 < totalCount ? currentIndex + 1 : 0
+ newGameSetting.currentDiskIndex = UInt(nextIndex)
+ }
}
case .airPlayScaling:
newGameSetting.airPlayScaling = Settings.defalut.airPlayScaling.next
@@ -3427,6 +3556,10 @@ extension PlayViewController {
}
}
}
+ } else if manicGame.gameType == .dos, UIDevice.isPad {
+ functionButtonContainer.snp.updateConstraints { make in
+ make.top.equalTo(gameView.snp.bottom).offset(UIDevice.isLandscape ? 30 : 40)
+ }
}
}
@@ -3468,6 +3601,33 @@ extension PlayViewController {
private func updateLibretroViews() {
guard manicGame.isLibretroType else { return }
+
+ if manicGame.gameType == .dos {
+ controllerView.allowTapThroughIfButtonNotHit = true
+ controllerView.allowKeyboardEvents = false
+ if let skin = controllerView.controllerSkin,
+ skin.identifier == Constants.Strings.DOSKeyboardSkinID {
+ controllerView.activateButtonInputInterception = { input in
+ if input.stringValue == "menu" || input.stringValue == "useJoypadSkin" {
+ return false
+ }
+ Log.debug("[LibretroKeyboardCode] input: >>>\(input.stringValue)<<<<")
+ LibretroCore.sharedInstance().pressKeyboard(LibretroKeyboardCode.createCode(withLabel: input.stringValue))
+ return true
+ }
+ controllerView.deactivateButtonInputInterception = { input in
+ if input.stringValue == "menu" || input.stringValue == "useJoypadSkin" {
+ return false
+ }
+ LibretroCore.sharedInstance().releaseKeyboard(LibretroKeyboardCode.createCode(withLabel: input.stringValue))
+ return true
+ }
+ } else {
+ controllerView.activateButtonInputInterception = nil
+ controllerView.deactivateButtonInputInterception = nil
+ }
+ }
+
if let gameMetalView {
if gameMetalView.superview == view {
gameMetalView.snp.remakeConstraints { make in
@@ -3546,7 +3706,7 @@ extension PlayViewController {
}
self.updateDualScreenViews()
LibretroCore.sharedInstance().setCustomSaveExtension(customSaveExtension)
- if self.manicGame.isNDSHomeMenuGame || self.manicGame.isDSiHomeMenuGame {
+ if self.manicGame.isNDSHomeMenuGame || self.manicGame.isDSiHomeMenuGame || self.manicGame.isDOSHomeMenuGame {
LibretroCore.sharedInstance().loadWithoutContent(corePath)
} else {
LibretroCore.sharedInstance().loadGame(manicGame.romUrl.path, corePath: corePath, completion: compltion)
@@ -4463,7 +4623,7 @@ extension PlayViewController: GameViewControllerDelegate {
if SheetProvider.find(identifier: Constants.Strings.PlayPurchaseAlertIdentifier).count > 0 {
return false
}
- return (GameSettingView.isShow || GameInfoView.isShow || CheatCodeListView.isShow || SkinSettingsView.isShow || ShadersListView.isShow || ControllersSettingView.isShow || GameSettingView.isEditingShow || WebViewController.isShow || FlexSkinSettingViewController.isShow || RetroAchievementsListViewController.isShow || CheevosPopupView.isShow || GameplayManualsView.isShow || FBNeoCheatCodeListView.isShow || J2MESettingView.isShow) ? false : true
+ return (GameSettingView.isShow || GameInfoView.isShow || CheatCodeListView.isShow || SkinSettingsView.isShow || ShadersListView.isShow || ControllersSettingView.isShow || GameSettingView.isEditingShow || WebViewController.isShow || FlexSkinSettingViewController.isShow || RetroAchievementsListViewController.isShow || CheevosPopupView.isShow || GameplayManualsView.isShow || FBNeoCheatCodeListView.isShow || J2MESettingView.isShow || CoreConfigsView.isShow) ? false : true
}
}
@@ -4517,4 +4677,11 @@ extension PlayViewController {
}
return nil
}
+
+ static var currentGameType: GameType? {
+ if let currentPlayViewController {
+ return currentPlayViewController.manicGame.gameType
+ }
+ return nil
+ }
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Play/Views/GameSettingView.swift b/ManicEmu/ManicEmu/Sources/Business/Play/Views/GameSettingView.swift
index 7f733af3..4bc39625 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Play/Views/GameSettingView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Play/Views/GameSettingView.swift
@@ -212,7 +212,7 @@ class GameSettingView: BaseView {
let orientation = game.orientation
let isFullScreen = game.forceFullSkin
let palette = game.pallete
- let currentDiskIndex = game.currentDiskIndex
+ let currentDiskIndex = game.diskInfo?.currentDiskIndex ?? 0
let airPlayScaling = Settings.defalut.airPlayScaling
let airPlayLayout = Settings.defalut.airPlayLayout
let nesPalettes: Game.NESPalette
@@ -241,7 +241,7 @@ class GameSettingView: BaseView {
orientation: orientation,
isFullScreen: isFullScreen,
palette: palette,
- currentDiskIndex: currentDiskIndex,
+ currentDiskIndex: UInt(currentDiskIndex),
airPlayScaling: airPlayScaling,
airPlayLayout: airPlayLayout,
nesPalette: nesPalettes,
@@ -539,13 +539,13 @@ extension GameSettingView: UICollectionViewDelegate {
case .swapDisk:
if game.gameType == .fds {
item.currentDiskIndex = 0
- game.currentDiskIndex = 0
updateCellAndCallBack(item: item, indexPath: indexPath)
return
} else if game.supportSwapDisc {
- item.currentDiskIndex = item.currentDiskIndex + 1 < game.totalDiskCount ? item.currentDiskIndex + 1 : 0
- game.currentDiskIndex = item.currentDiskIndex
- updateCellAndCallBack(item: item, indexPath: indexPath)
+ if let diskInfo = game.diskInfo {
+ item.currentDiskIndex = item.currentDiskIndex + 1 < diskInfo.diskCount ? item.currentDiskIndex + 1 : 0
+ updateCellAndCallBack(item: item, indexPath: indexPath)
+ }
return
}
case .airPlayScaling:
@@ -754,14 +754,23 @@ extension GameSettingView: UICollectionViewDelegate {
return UIContextMenuConfiguration(actionProvider: { _ in UIMenu(children: actions) })
} else if game.supportSwapDisc {
var actions = [UIAction]()
- for index in 0..<game.totalDiskCount {
- actions.append(UIAction(title: "Disc \(index + 1)",
- image: index == game.currentDiskIndex ? UIImage(symbol: .checkmarkCircleFill) : nil,
- handler: { [weak self] _ in
- guard let self = self else { return }
- item.currentDiskIndex = index
- self.updateCellAndCallBack(item: item, indexPath: indexPath)
- }))
+ if let diskInfo = game.diskInfo {
+ for index in 0..<diskInfo.diskCount {
+ var diskLabel = "Disc \(index + 1)"
+ if diskInfo.diskLabels.count == diskInfo.diskCount {
+ let label = diskInfo.diskLabels[index]
+ if !label.isEmpty {
+ diskLabel += "(\(label))"
+ }
+ }
+ actions.append(UIAction(title: diskLabel,
+ image: index == diskInfo.currentDiskIndex ? UIImage(symbol: .checkmarkCircleFill) : nil,
+ handler: { [weak self] _ in
+ guard let self = self else { return }
+ item.currentDiskIndex = UInt(index)
+ self.updateCellAndCallBack(item: item, indexPath: indexPath)
+ }))
+ }
}
return UIContextMenuConfiguration(actionProvider: { _ in UIMenu(children: actions) })
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Settings/Models/SettingItem.swift b/ManicEmu/ManicEmu/Sources/Business/Settings/Models/SettingItem.swift
index 2fcccbe0..8d8be7f8 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Settings/Models/SettingItem.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Settings/Models/SettingItem.swift
@@ -10,7 +10,7 @@
struct SettingItem {
enum ItemType: String {
- case theme, quickGame, airPlay, iCloud, fullScreenWhenConnectController, FAQ, feedback, shareApp, qq, telegram, discord, clearCache, language, userAgreement, privacyPolicy, autoSaveState, bios, respectSilentMode, onlinePlay, about, retro, rumble, appearance, triggerPro, skin, jit, shaders, featuredItems
+ case theme, quickGame, airPlay, iCloud, fullScreenWhenConnectController, FAQ, feedback, shareApp, qq, telegram, discord, clearCache, language, userAgreement, privacyPolicy, autoSaveState, bios, respectSilentMode, onlinePlay, about, retro, rumble, appearance, triggerPro, skin, jit, shaders, featuredItems, skinSound
}
var type: ItemType
@@ -27,7 +27,7 @@ struct SettingItem {
return Constants.Color.Green
case .airPlay, .FAQ, .about, .rumble, .jit:
return Constants.Color.Indigo
- case .iCloud, .userAgreement, .appearance:
+ case .iCloud, .userAgreement, .appearance, .skinSound:
return Constants.Color.Blue
case .fullScreenWhenConnectController, .shareApp, .triggerPro:
return Constants.Color.Orange
@@ -106,6 +106,8 @@ struct SettingItem {
R.image.customAppBackgroundDotted()!.applySymbolConfig(font: Constants.Font.body(size: .m, weight: .medium), color: Constants.Color.LabelPrimary.forceStyle(.dark))
case .featuredItems:
UIImage(symbol: .shippingboxFill, font: Constants.Font.body(size: .s, weight: .medium), color: Constants.Color.LabelPrimary.forceStyle(.dark))
+ case .skinSound:
+ UIImage(symbol: .waveform, font: Constants.Font.body(size: .s, weight: .medium), color: Constants.Color.LabelPrimary.forceStyle(.dark))
}
}
@@ -167,6 +169,8 @@ struct SettingItem {
R.string.localizable.shaders()
case .featuredItems:
R.string.localizable.featuredItems()
+ case .skinSound:
+ R.string.localizable.skinSoundEffects()
}
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/SettingsItemCollectionViewCell.swift b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/SettingsItemCollectionViewCell.swift
index d81d0607..29e0963c 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/SettingsItemCollectionViewCell.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/SettingsItemCollectionViewCell.swift
@@ -186,7 +186,7 @@ class SettingsItemCollectionViewCell: UICollectionViewCell {
titleLabel.attributedText = matt
switch item.type {
- case .quickGame, .airPlay, .fullScreenWhenConnectController, .autoSaveState, .respectSilentMode, .rumble:
+ case .quickGame, .airPlay, .fullScreenWhenConnectController, .autoSaveState, .respectSilentMode, .rumble, .skinSound:
switchButton.isHidden = false
chevronIconView.isHidden = true
enableInteractive = false
diff --git a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/SettingsListView.swift b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/SettingsListView.swift
index 3213784d..d221aa7a 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/SettingsListView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/SettingsListView.swift
@@ -113,6 +113,7 @@ class SettingsListView: BaseView {
SettingItem(type: .respectSilentMode, isOn: Settings.defalut.respectSilentMode),
SettingItem(type: .onlinePlay),
SettingItem(type: .rumble, isOn: Settings.defalut.getExtraBool(key: ExtraKey.rumble.rawValue) ?? false),
+ SettingItem(type: .skinSound, isOn: Settings.defalut.getExtraBool(key: ExtraKey.skinSoundEffects.rawValue) ?? true),
SettingItem(type: .retro),
SettingItem(type: .triggerPro),
SettingItem(type: .jit),
@@ -126,6 +127,7 @@ class SettingsListView: BaseView {
SettingItem(type: .respectSilentMode, isOn: Settings.defalut.respectSilentMode),
SettingItem(type: .onlinePlay),
SettingItem(type: .rumble, isOn: Settings.defalut.getExtraBool(key: ExtraKey.rumble.rawValue) ?? false),
+ SettingItem(type: .skinSound, isOn: Settings.defalut.getExtraBool(key: ExtraKey.skinSoundEffects.rawValue) ?? true),
SettingItem(type: .retro),
SettingItem(type: .triggerPro),
SettingItem(type: .jit),
@@ -427,7 +429,12 @@ extension SettingsListView: UICollectionViewDataSource {
Settings.appearance = Settings.Appearance(rawValue: index) ?? .dark
cell?.setData(item: item)
}
- } else {
+ } else if item.type == .skinSound {
+ cell.switchButton.onChange { value in
+ //设置皮肤音效
+ Settings.defalut.updateExtra(key: ExtraKey.skinSoundEffects.rawValue, value: value)
+ }
+ } else {
cell.switchButton.onChange { value in }
}
return cell
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Cores/DOS.swift b/ManicEmu/ManicEmu/Sources/Tools/Cores/DOS.swift
new file mode 100644
index 00000000..bc8c17f0
--- /dev/null
+++ b/ManicEmu/ManicEmu/Sources/Tools/Cores/DOS.swift
@@ -0,0 +1,212 @@
+//
+// DOS.swift
+// ManicEmu
+//
+// Created by Daiuno on 2026/3/18.
+// Copyright © 2026 Manic EMU. All rights reserved.
+//
+
+import ManicEmuCore
+import AVFoundation
+
+extension GameType {
+ static let dos = GameType("public.aoshuang.game.dos")
+}
+
+@objc enum DOSGameInput: Int, Input, CaseIterable {
+ case a
+ case b
+ case x
+ case y
+ case start
+ case select
+ case up
+ case down
+ case left
+ case right
+ case l1
+ case r1
+ case l2
+ case r2
+ case l3
+ case r3
+ case leftThumbstickUp
+ case leftThumbstickDown
+ case leftThumbstickLeft
+ case leftThumbstickRight
+ case rightThumbstickUp
+ case rightThumbstickDown
+ case rightThumbstickLeft
+ case rightThumbstickRight
+
+ case flex
+ case menu
+ case useJoypadSkin
+ case useKeyboardSkin
+
+ public var type: InputType {
+ return .game(.dos)
+ }
+
+ init?(stringValue: String) {
+ if stringValue == "a" { self = .a}
+ else if stringValue == "b" { self = .b}
+ else if stringValue == "x" { self = .x}
+ else if stringValue == "y" { self = .y}
+ else if stringValue == "start" { self = .start}
+ else if stringValue == "select" { self = .select}
+ else if stringValue == "up" { self = .up}
+ else if stringValue == "down" { self = .down}
+ else if stringValue == "left" { self = .left}
+ else if stringValue == "right" { self = .right}
+ else if stringValue == "l1" { self = .l1}
+ else if stringValue == "r1" { self = .r1}
+ else if stringValue == "l2" { self = .l2}
+ else if stringValue == "r2" { self = .r2}
+ else if stringValue == "l3" { self = .l3}
+ else if stringValue == "r3" { self = .r3}
+ else if stringValue == "leftThumbstickUp" { self = .leftThumbstickUp}
+ else if stringValue == "leftThumbstickDown" { self = .leftThumbstickDown}
+ else if stringValue == "leftThumbstickLeft" { self = .leftThumbstickLeft}
+ else if stringValue == "leftThumbstickRight" { self = .leftThumbstickRight}
+ else if stringValue == "rightThumbstickUp" { self = .rightThumbstickUp}
+ else if stringValue == "rightThumbstickDown" { self = .rightThumbstickDown}
+ else if stringValue == "rightThumbstickLeft" { self = .rightThumbstickLeft}
+ else if stringValue == "rightThumbstickRight" { self = .rightThumbstickRight}
+ else if stringValue == "useJoypadSkin" { self = .useJoypadSkin }
+ else if stringValue == "useKeyboardSkin" { self = .useKeyboardSkin }
+ else { return nil }
+ }
+}
+
+struct DOS: ManicEmuCoreProtocol {
+ public static let core = DOS()
+
+ public var name: String { "DOS" }
+ public var identifier: String { "com.aoshuang.DOSCore" }
+
+ public var gameType: GameType { GameType.dos }
+ public var gameInputType: Input.Type { DOSGameInput.self }
+ var allInputs: [Input] { DOSGameInput.allCases }
+ public var gameSaveExtension: String { "pure.zip" }
+
+ public let audioFormat = AVAudioFormat(commonFormat: .pcmFormatInt16, sampleRate: 44100, channels: 1, interleaved: true)!
+ public let videoFormat = VideoFormat(format: .bitmap(.rgb565), dimensions: CGSize(width: 640, height: 480))
+
+ public var supportCheatFormats: Set<CheatFormat> {
+ return []
+ }
+
+ public var emulatorConnector: EmulatorBase { DOSEmulatorBridge.shared }
+
+ private init() {}
+}
+
+
+class DOSEmulatorBridge : NSObject, EmulatorBase {
+ static let shared = DOSEmulatorBridge()
+
+ var gameURL: URL?
+
+ private(set) var frameDuration: TimeInterval = (1.0 / 60.0)
+
+ var audioRenderer: (any ManicEmuCore.AudioRenderProtocol)?
+
+ var videoRenderer: (any ManicEmuCore.VideoRenderProtocol)?
+
+ var saveUpdateHandler: (() -> Void)?
+
+ private var leftThumbstickPosition: CGPoint = .zero
+ private var rightThumbstickPosition: CGPoint = .zero
+
+ func start(withGameURL gameURL: URL) {}
+
+ func stop() {}
+
+ func pause() {}
+
+ func resume() {}
+
+ func runFrame(processVideo: Bool) {}
+
+ func activateInput(_ input: Int, value: Double, playerIndex: Int) {
+ guard playerIndex >= 0 else { return }
+ if input == DOSGameInput.leftThumbstickUp || input == DOSGameInput.leftThumbstickDown {
+ leftThumbstickPosition.y = input == DOSGameInput.leftThumbstickUp ? value : -value
+ LibretroCore.sharedInstance().moveStick(true, x: leftThumbstickPosition.x, y: leftThumbstickPosition.y, playerIndex: UInt32(playerIndex))
+ } else if input == DOSGameInput.leftThumbstickLeft || input == DOSGameInput.leftThumbstickRight {
+ leftThumbstickPosition.x = input == DOSGameInput.leftThumbstickRight ? value : -value
+ LibretroCore.sharedInstance().moveStick(true, x: leftThumbstickPosition.x, y: leftThumbstickPosition.y, playerIndex: UInt32(playerIndex))
+ } else if input == DOSGameInput.rightThumbstickUp || input == DOSGameInput.rightThumbstickDown {
+ rightThumbstickPosition.y = input == DOSGameInput.rightThumbstickUp ? value : -value
+ LibretroCore.sharedInstance().moveStick(false, x: rightThumbstickPosition.x, y: rightThumbstickPosition.y, playerIndex: UInt32(playerIndex))
+ } else if input == DOSGameInput.rightThumbstickLeft || input == DOSGameInput.rightThumbstickRight {
+ rightThumbstickPosition.x = input == DOSGameInput.rightThumbstickRight ? value : -value
+ LibretroCore.sharedInstance().moveStick(false, x: rightThumbstickPosition.x, y: rightThumbstickPosition.y, playerIndex: UInt32(playerIndex))
+ } else if let gameInput = DOSGameInput(rawValue: input),
+ let libretroButton = gameInputToCoreInput(gameInput: gameInput) {
+#if DEBUG
+ Log.debug("\(String(describing: Self.self))点击了:\(gameInput)")
+#endif
+ LibretroCore.sharedInstance().press(libretroButton, playerIndex: UInt32(playerIndex))
+ }
+ }
+
+ func gameInputToCoreInput(gameInput: DOSGameInput) -> LibretroButton? {
+ if gameInput == .a { return .A }
+ else if gameInput == .b { return .B }
+ else if gameInput == .x { return .X }
+ else if gameInput == .y { return .Y }
+ else if gameInput == .start { return .start }
+ else if gameInput == .select { return .select }
+ else if gameInput == .up { return .up }
+ else if gameInput == .down { return .down }
+ else if gameInput == .left { return .left }
+ else if gameInput == .right { return .right }
+ else if gameInput == .l1 { return .L1 }
+ else if gameInput == .r1 { return .R1 }
+ else if gameInput == .l2 { return .L2 }
+ else if gameInput == .r2 { return .R2 }
+ else if gameInput == .l3 { return .L3 }
+ else if gameInput == .r3 { return .R3 }
+ return nil
+ }
+
+ func deactivateInput(_ input: Int, playerIndex: Int) {
+ if input == DOSGameInput.leftThumbstickUp || input == DOSGameInput.leftThumbstickDown {
+ leftThumbstickPosition.y = 0
+ LibretroCore.sharedInstance().moveStick(true, x: leftThumbstickPosition.x, y: leftThumbstickPosition.y, playerIndex: UInt32(playerIndex))
+ } else if input == DOSGameInput.leftThumbstickLeft || input == DOSGameInput.leftThumbstickRight {
+ leftThumbstickPosition.x = 0
+ LibretroCore.sharedInstance().moveStick(true, x: leftThumbstickPosition.x, y: leftThumbstickPosition.y, playerIndex: UInt32(playerIndex))
+ } else if input == DOSGameInput.rightThumbstickUp || input == DOSGameInput.rightThumbstickDown {
+ rightThumbstickPosition.y = 0
+ LibretroCore.sharedInstance().moveStick(false, x: rightThumbstickPosition.x, y: rightThumbstickPosition.y, playerIndex: UInt32(playerIndex))
+ } else if input == DOSGameInput.rightThumbstickLeft || input == DOSGameInput.rightThumbstickRight {
+ rightThumbstickPosition.x = 0
+ LibretroCore.sharedInstance().moveStick(false, x: rightThumbstickPosition.x, y: rightThumbstickPosition.y, playerIndex: UInt32(playerIndex))
+ } else if let gameInput = DOSGameInput(rawValue: input),
+ let libretroButton = gameInputToCoreInput(gameInput: gameInput) {
+ LibretroCore.sharedInstance().release(libretroButton, playerIndex: UInt32(playerIndex))
+ }
+ }
+
+ func resetInputs() {}
+
+ func saveSaveState(to url: URL) {}
+
+ func loadSaveState(from url: URL) {}
+
+ func saveGameSave(to url: URL) {}
+
+ func loadGameSave(from url: URL) {}
+
+ func addCheatCode(_ cheatCode: String, type: String) -> Bool {
+ return false
+ }
+
+ func resetCheats() {}
+
+ func updateCheats() {}
+
+}
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Cores/NDS.swift b/ManicEmu/ManicEmu/Sources/Tools/Cores/NDS.swift
index 623d626a..cefa8d13 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Cores/NDS.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Cores/NDS.swift
@@ -162,7 +162,7 @@ class DSEmulatorBridge : NSObject, EmulatorBase {
touchPointY = nil
}
} else if let gameInput = DSGameInput(rawValue: input),
- let libretroButton = gameInputToCoreInput(gameInput: gameInput) {
+ let libretroButton = gameInputToCoreInput(gameInput: gameInput) {
#if DEBUG
Log.debug("\(String(describing: Self.self))点击了:\(gameInput)")
#endif
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Extensions/GameTypeExtensions.swift b/ManicEmu/ManicEmu/Sources/Tools/Extensions/GameTypeExtensions.swift
index 2b22bbbf..1322456f 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Extensions/GameTypeExtensions.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Extensions/GameTypeExtensions.swift
@@ -12,7 +12,7 @@ import RealmSwift
///通过文件名后缀生成GameType
extension GameType {
- static var multiPlatformFileExtensions = ["chd", "iso", "bin", "cue", "m3u", "pbp", "ccd"]
+ static var multiPlatformFileExtensions = ["chd", "iso", "bin", "cue", "m3u", "pbp", "ccd", "zip"]
static func gameTypes(multiPlatformFileExtension: String) -> [GameType] {
let ext = multiPlatformFileExtension.lowercased()
@@ -21,17 +21,19 @@ extension GameType {
case "chd":
return [.ps1, .psp, .mcd, .ss, .dc]
case "iso":
- return [.psp, .mcd, .ss]
+ return [.psp, .mcd, .ss, .dos]
case "bin":
return [.md, .gg, .ms, ._32x, .dc, .a2600, .a5200, .a7800, .jaguar]
case "cue":
- return [.ps1, .mcd, .ss, .dc]
+ return [.ps1, .mcd, .ss, .dc, .dos]
case "m3u":
- return [ ps1, .mcd, .ss, .dc]
+ return [ ps1, .mcd, .ss, .dc, .dos]
case "pbp":
return [.ps1, .psp]
case "ccd":
return [.ps1, .ss]
+ case "zip":
+ return [.arcade, .dos]
default:
return []
}
@@ -100,6 +102,8 @@ extension GameType {
self = .lynx
} else if ["jar"].contains(ext) {
self = .j2me
+ } else if ["zip", "dosz", "exe", "com", "bat", "iso", "cue", "img", "ima", "vhd", "jrc", "tc", "m3u", "conf"].contains(ext) {
+ self = .dos
} else {
self = .notSupport
}
@@ -176,9 +180,11 @@ extension GameType {
self = .lynx
} else if shortName.uppercased() == "XBOX360" {
self = .xbox360
- } else if shortName.uppercased() == "J2ME" {
+ } else if shortName.uppercased() == "J2ME" {
self = .j2me
- } else {
+ } else if shortName.uppercased() == "DOS" {
+ self = .dos
+ } else {
return nil
}
}
@@ -217,6 +223,7 @@ extension GameType {
case .lynx: return "Atari Lynx"
case .j2me: return "Java ME"
case .xbox360: return "Xbox 360"
+ case .dos: return "MS-DOS"
default: return ""
}
}
@@ -255,6 +262,7 @@ extension GameType {
case .lynx: return NSLocalizedString("LYNX", comment: "")
case .j2me: return NSLocalizedString("J2ME", comment: "")
case .xbox360: return NSLocalizedString("XBOX360", comment: "")
+ case .dos: return NSLocalizedString("DOS", comment: "")
case .unknown: return R.string.localizable.unknownPlatform()
default: return ""
}
@@ -294,6 +302,7 @@ extension GameType {
case .jaguar: return 1993
case .j2me: return 1999
case .xbox360: return 2005
+ case .dos: return 1981
default: return 0
}
}
@@ -330,6 +339,7 @@ extension GameType {
case .jaguar: return Jaguar.core
case .lynx: return Lynx.core
case .j2me: return J2ME.core
+ case .dos: return DOS.core
default: return nil
}
}
@@ -340,7 +350,7 @@ extension GameType {
} else if self == .fds {
return .nes
} else if self == .doom {
- return .arcade
+ return .dos
}
return self
}
@@ -381,6 +391,8 @@ extension GameType {
return [.ms, .gg, .sg1000]
} else if self == .nes || self == .fds {
return [.nes, .fds]
+ } else if self == .dos || self == .doom {
+ return [.dos, .doom]
}
return [self]
}
@@ -426,7 +438,7 @@ extension GameType {
return .atari
case .j2me:
return .sun
- case .xbox360:
+ case .xbox360, .dos:
return .microsoft
default:
return .nintendo
@@ -435,11 +447,26 @@ extension GameType {
var supportAnalogInput: Bool {
switch self {
- case .psp, ._3ds, .arcade, .dc, .ps1, .n64:
+ case .psp, ._3ds, .arcade, .dc, .ps1, .n64, .dos:
return true
default: return false
}
}
+
+ var coreConfigIcon: UIImage? {
+ switch self {
+ case .dos:
+ return R.image.customDos()
+ case .j2me:
+ return R.image.customJava()
+ default:
+ return nil
+ }
+ }
+
+ var coreConfigTitle: String {
+ localizedShortName + R.string.localizable.tabbarTitleSettings()
+ }
}
///让GameType支持realm的存储
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Extensions/LibretroCoreExtensions.swift b/ManicEmu/ManicEmu/Sources/Tools/Extensions/LibretroCoreExtensions.swift
index 99785701..557a9430 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Extensions/LibretroCoreExtensions.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Extensions/LibretroCoreExtensions.swift
@@ -9,7 +9,7 @@
extension LibretroCore {
enum Cores {
- case Nestopia, Snes9x, PicoDrive, Yabause, BeetleSaturn, Mupen64PlushNext, BeetleVB, PokeMini, BeetlePSXHW, bsnes, Gambatte, VBAM, mGBA, Flycast, Gearsystem, ClownMDEmu, bsnesJG, melonDSDS, PPSSPP, MAME, FinalBurnNeo, Citra, Azahar, JGenesis, DeSmuME, Stella, Atari800, ProSystem, VirtualJaguar, Holani, J2meJS, freej2me, PrBoom
+ case Nestopia, Snes9x, PicoDrive, Yabause, BeetleSaturn, Mupen64PlushNext, BeetleVB, PokeMini, BeetlePSXHW, bsnes, Gambatte, VBAM, mGBA, Flycast, Gearsystem, ClownMDEmu, bsnesJG, melonDSDS, PPSSPP, MAME, FinalBurnNeo, Citra, Azahar, JGenesis, DeSmuME, Stella, Atari800, ProSystem, VirtualJaguar, Holani, J2meJS, freej2me, PrBoom, DOSBoxPure
var name: String {
switch self {
@@ -79,6 +79,8 @@ extension LibretroCore {
"J2meJS"
case .freej2me:
"freej2me"
+ case .DOSBoxPure:
+ "DOSBox-pure"
}
}
}
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIImageViewExtensions.swift b/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIImageViewExtensions.swift
index 1d24bc9a..c4fcd4fe 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIImageViewExtensions.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIImageViewExtensions.swift
@@ -10,7 +10,7 @@ import Kingfisher
extension UIImageView {
func setGameCover(game: Game, size: CGSize? = nil, completion: ((UIImage)->Void)? = nil) {
- if game.isNDSHomeMenuGame || game.is3DSHomeMenuGame {
+ if game.isNDSHomeMenuGame || game.is3DSHomeMenuGame || game.isDOSHomeMenuGame {
//Home Menu的图标进行特殊处理
self.kf.cancelDownloadTask()
self.contentMode = .scaleAspectFill
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Extensions/UTTypeExtensions.swift b/ManicEmu/ManicEmu/Sources/Tools/Extensions/UTTypeExtensions.swift
index 4fef5e93..5c455d2f 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Extensions/UTTypeExtensions.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Extensions/UTTypeExtensions.swift
@@ -8,6 +8,7 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import UniformTypeIdentifiers
+import ManicEmuCore
extension UTType {
static var gamesaveTypes: [UTType] { allSystemTypes.gamesaveTypes }
@@ -30,6 +31,13 @@ extension UTType {
return []
}
+ static func getGameTypes(gameType: GameType) -> [UTType] {
+ if let uttype = UTType(gameType.rawValue) {
+ return getAllTypes([uttype])
+ }
+ return []
+ }
+
static var allInfoPlistTypes: [UTType] {
let (gameTypes, gamesaveTypes, skinTypes, zipTypes) = infoPlistTypes
return gameTypes + gamesaveTypes + skinTypes + zipTypes
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Others/CheersView.swift b/ManicEmu/ManicEmu/Sources/Tools/Others/CheersView.swift
index 487ff7c6..81e56a83 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Others/CheersView.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Others/CheersView.swift
@@ -60,8 +60,14 @@ struct CheersView: View {
}
}
- static func makeNormalCheers() {
- if let window = ApplicationSceneDelegate.applicationWindow {
+ static func makeNormalCheers(userTopWindow: Bool = false) {
+ let window = userTopWindow ? (ApplicationSceneDelegate.applicationScene?.windows.last(where: {
+ $0.isHidden == false &&
+ $0.rootViewController != nil &&
+ (String(describing: type(of: $0)) == "SheetWindow" || String(describing: type(of: $0)) == "AlertWindow" || $0.windowLevel == .normal)
+ })) : ApplicationSceneDelegate.applicationWindow
+
+ if let window {
let vc = UIHostingController(rootView: CheersView().edgesIgnoringSafeArea(.all))
if let cheersView = vc.view {
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Others/CoreSelectionView.swift b/ManicEmu/ManicEmu/Sources/Tools/Others/CoreSelectionView.swift
index 8ebda6bf..9e5524cc 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Others/CoreSelectionView.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Others/CoreSelectionView.swift
@@ -77,7 +77,6 @@ class CoreSelectionView: BaseView {
let detailLabel = UILabel()
detailLabel.numberOfLines = 0
- detailLabel.textAlignment = .center
detailLabel.text = R.string.localizable.switchEmulationCoreDetail(gameName)
detailLabel.font = Constants.Font.body(size: .m)
detailLabel.textColor = Constants.Color.LabelPrimary
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Others/FilesImporter.swift b/ManicEmu/ManicEmu/Sources/Tools/Others/FilesImporter.swift
index b5d4850a..27ee6b22 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Others/FilesImporter.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Others/FilesImporter.swift
@@ -69,8 +69,7 @@ extension FilesImporter {
//处理zip包
handleZip(urls: urls, silentMode: silentMode) { unzipUrls in
- var urls = urls.filter({ !FileType.zip.extensions.contains($0.pathExtension) }) + unzipUrls
-
+ var urls = urls.filter({ !FileType.zip.extensions.contains($0.pathExtension.lowercased()) }) + unzipUrls
//先处理cue和m3u
let (multiFileResultUrls, multiFileResultError, multiFileResultItems) = handleMultiFiles(urls: urls)
let (m3uResultUrls, m3uResultError, m3uResultM3uItems, m3uResultMultiFileItems) = handleM3uFiles(urls: multiFileResultUrls, multiFileItems: multiFileResultItems)
@@ -722,115 +721,160 @@ extension FilesImporter {
static func handleZip(urls: [URL], silentMode: Bool, completion: @escaping ([URL])->Void) {
DispatchQueue.global().async {
var results = [URL]()
+ var needToHandleUrls = [URL]()
+
+
for url in urls {
- if FileType.zip.extensions.contains(url.pathExtension) {
- var innerResults = [URL]()
- if url.pathExtension.lowercased() == "zip" {
-
- //街机ROM则不解压
- if MAMEKit.isSupportTitle(fileName: url.lastPathComponent.deletingPathExtension) {
- results.append(url)
- continue
- }
-
- //先检查zip里面有没有支持的文件类型
- if SSZipArchive.isFilePasswordProtected(atPath: url.path) {
- //加密文件先不处理
- if !silentMode {
- UIView.makeToast(message: R.string.localizable.notSupportPasswordZip(url.lastPathComponent))
+ if (url.pathExtension.lowercased() == "zip" || url.pathExtension.lowercased() == "7z") && MAMEKit.isSupportTitle(fileName: url.lastPathComponent.deletingPathExtension) {
+ results.append(url)
+ continue
+ }
+
+
+ if url.pathExtension.lowercased() == "7z" {
+ var sevenZipSnnerResults = [URL]()
+ do {
+ Log.debug("开始解压7z")
+ let archivePath = try Path(url.path)
+ let archivePathInStream = try InStream(path: archivePath)
+ let decoder = try Decoder(stream: archivePathInStream, fileType: .sevenZ)
+ let _ = try decoder.open()
+ let numberOfArchiveItems = try decoder.count()
+ for itemIndex in 0..<numberOfArchiveItems {
+ let item = try decoder.item(at: itemIndex)
+ if item.isDir {
+ continue
}
- continue
- } else {
- //未加密
- if let archive = try? Archive(url: url, accessMode: .read, pathEncoding: nil) {
- for entry in archive {
- if entry.type == .file, let _ = FileType(fileExtension: entry.path.pathExtension) {
- if entry.path.lastPathComponent.hasPrefix(".") {
- //跳过隐藏文件夹
- continue
- }
- do {
- let dstPath = Constants.Path.ZipWorkSpace.appendingPathComponent(entry.decodedPath)
- let destUrl = URL(fileURLWithPath: dstPath)
- if FileManager.default.fileExists(atPath: dstPath) {
- try FileManager.safeRemoveItem(at: destUrl)
- }
- _ = try archive.extract(entry, to: destUrl)
- innerResults.append(destUrl)
- } catch {
- if !silentMode {
- UIView.makeToast(message: R.string.localizable.unzipFailed(entry.path.lastPathComponent))
- }
- }
- }
- }
- results.append(contentsOf: innerResults)
+ let path = try item.path().description
+ if path.lastPathComponent.hasPrefix(".") {
+ //跳过隐藏文件夹
+ continue
+ }
+ let itemArray = try ItemArray(capacity: 1)
+ if let _ = FileType(fileExtension: path.pathExtension) {
+ try itemArray.add(item: item)
} else {
- if !silentMode {
- UIView.makeToast(message: R.string.localizable.unzipFailed(url.lastPathComponent))
- }
continue
}
- }
- } else if url.pathExtension.lowercased() == "7z" {
-
- //街机ROM则不解压
- if MAMEKit.isSupportTitle(fileName: url.lastPathComponent.deletingPathExtension) {
- results.append(url)
- continue
- }
-
- do {
- Log.debug("开始解压7z")
- let archivePath = try Path(url.path)
- let archivePathInStream = try InStream(path: archivePath)
- let decoder = try Decoder(stream: archivePathInStream, fileType: .sevenZ)
- let _ = try decoder.open()
- let numberOfArchiveItems = try decoder.count()
- for itemIndex in 0..<numberOfArchiveItems {
- let item = try decoder.item(at: itemIndex)
- if item.isDir {
- continue
- }
- let path = try item.path().description
- if path.lastPathComponent.hasPrefix(".") {
- //跳过隐藏文件夹
- continue
- }
- let itemArray = try ItemArray(capacity: 1)
- if let _ = FileType(fileExtension: path.pathExtension) {
- try itemArray.add(item: item)
- } else {
- continue
- }
- let dstPath = Constants.Path.ZipWorkSpace.appendingPathComponent(path)
- Log.debug("构建路径:\(dstPath)")
- let destUrl = URL(fileURLWithPath: dstPath)
- if FileManager.default.fileExists(atPath: dstPath) {
- try FileManager.safeRemoveItem(at: destUrl)
- }
- if !FileManager.default.fileExists(atPath: dstPath.deletingLastPathComponent) {
- try FileManager.default.createDirectory(at: URL(fileURLWithPath: dstPath.deletingLastPathComponent), withIntermediateDirectories: true)
- }
- let _ = try decoder.extract(items: itemArray, to: Path(Constants.Path.ZipWorkSpace))
- Log.debug("解压成功!")
- innerResults.append(destUrl)
+ let dstPath = Constants.Path.ZipWorkSpace.appendingPathComponent(path)
+ Log.debug("构建路径:\(dstPath)")
+ let destUrl = URL(fileURLWithPath: dstPath)
+ if FileManager.default.fileExists(atPath: dstPath) {
+ try FileManager.safeRemoveItem(at: destUrl)
}
- results.append(contentsOf: innerResults)
- } catch {
- Log.debug("解压7z失败:\(error)")
+ if !FileManager.default.fileExists(atPath: dstPath.deletingLastPathComponent) {
+ try FileManager.default.createDirectory(at: URL(fileURLWithPath: dstPath.deletingLastPathComponent), withIntermediateDirectories: true)
+ }
+ let _ = try decoder.extract(items: itemArray, to: Path(Constants.Path.ZipWorkSpace))
+ Log.debug("解压成功!")
+ sevenZipSnnerResults.append(destUrl)
+ }
+ results.append(contentsOf: sevenZipSnnerResults)
+ } catch {
+ Log.debug("解压7z失败:\(error)")
+ DispatchQueue.main.async {
UIView.makeToast(message: R.string.localizable.sevenZipDecompressError())
}
}
- if innerResults.isEmpty {
- if !silentMode {
+ if sevenZipSnnerResults.isEmpty, !silentMode {
+ DispatchQueue.main.async {
UIView.makeToast(message: R.string.localizable.noSupportInZip(url.lastPathComponent))
}
}
+ } else if url.pathExtension.lowercased() == "zip" {
+ needToHandleUrls.append(url)
}
}
- DispatchQueue.main.async {
- completion(results)
+
+ if needToHandleUrls.count > 0 {
+ DispatchQueue.main.async {
+ UIView.hideLoading()
+ ZipHandlerView.show(urls: needToHandleUrls) { unzipUrls, noActionUrls in
+ results.append(contentsOf: noActionUrls)
+ if unzipUrls.count > 0 {
+ if !silentMode {
+ UIView.makeLoading()
+ }
+
+ DispatchQueue.global().async {
+ for url in unzipUrls {
+ if FileType.zip.extensions.contains(url.pathExtension) {
+ var zipInnerResults = [URL]()
+ if url.pathExtension.lowercased() == "zip" {
+
+ //街机ROM则不解压
+ if MAMEKit.isSupportTitle(fileName: url.lastPathComponent.deletingPathExtension) {
+ results.append(url)
+ continue
+ }
+
+ //先检查zip里面有没有支持的文件类型
+ if SSZipArchive.isFilePasswordProtected(atPath: url.path) {
+ //加密文件先不处理
+ if !silentMode {
+ UIView.makeToast(message: R.string.localizable.notSupportPasswordZip(url.lastPathComponent))
+ }
+ continue
+ } else {
+ //未加密
+ if let archive = try? Archive(url: url, accessMode: .read, pathEncoding: nil) {
+ for entry in archive {
+ if entry.type == .file, let _ = FileType(fileExtension: entry.path.pathExtension) {
+ if entry.path.lastPathComponent.hasPrefix(".") {
+ //跳过隐藏文件夹
+ continue
+ }
+ do {
+ let dstPath = Constants.Path.ZipWorkSpace.appendingPathComponent(entry.decodedPath)
+ let destUrl = URL(fileURLWithPath: dstPath)
+ if FileManager.default.fileExists(atPath: dstPath) {
+ try FileManager.safeRemoveItem(at: destUrl)
+ }
+ _ = try archive.extract(entry, to: destUrl)
+ zipInnerResults.append(destUrl)
+ } catch {
+ if !silentMode {
+ DispatchQueue.main.async {
+ UIView.makeToast(message: R.string.localizable.unzipFailed(entry.path.lastPathComponent))
+ }
+ }
+ }
+ }
+ }
+ results.append(contentsOf: zipInnerResults)
+ } else {
+ if !silentMode {
+ DispatchQueue.main.async {
+ UIView.makeToast(message: R.string.localizable.unzipFailed(url.lastPathComponent))
+ }
+ }
+ continue
+ }
+ }
+ }
+ if zipInnerResults.isEmpty, !silentMode {
+ DispatchQueue.main.async {
+ UIView.makeToast(message: R.string.localizable.noSupportInZip(url.lastPathComponent))
+ }
+ }
+ }
+ }
+ DispatchQueue.main.async {
+ completion(results)
+ return
+ }
+ }
+ } else {
+ completion(results)
+ return
+ }
+ }
+ }
+ } else {
+ DispatchQueue.main.async {
+ completion(results)
+ return
+ }
}
}
}
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Others/LocalWebServer.swift b/ManicEmu/ManicEmu/Sources/Tools/Others/LocalWebServer.swift
index fcbdaa16..d76d3510 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Others/LocalWebServer.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Others/LocalWebServer.swift
@@ -13,7 +13,7 @@ class LocalWebServer {
}
private var server: GCDWebServer?
- private let port: UInt = 8080
+ var port: UInt = 8080
private var files: [String: String] = [:] // fileId -> filePath
func start(serverType: ServerType) throws {
@@ -87,6 +87,7 @@ class LocalWebServer {
cacheAge: 0,
allowRangeRequests: true)
case .J2meJS:
+ port = 8081
resourcePath = Constants.Path.J2meJS
// Add generic directory handler
@@ -116,6 +117,7 @@ class LocalWebServer {
}
case .freej2meWeb:
+ port = 8082
resourcePath = Constants.Path.Freej2meWeb
// Add generic directory handler
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Others/OnlineCoverManager.swift b/ManicEmu/ManicEmu/Sources/Tools/Others/OnlineCoverManager.swift
index 483f94e0..315e8dfb 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Others/OnlineCoverManager.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Others/OnlineCoverManager.swift
@@ -135,6 +135,8 @@ class OnlineCoverManager {
return
case .doom:
boxArtUrl = host.appendingPathComponent("DOOM/Named_Boxarts")
+ case .dos:
+ boxArtUrl = host.appendingPathComponent("DOS/Named_Boxarts")
default:
boxArtUrl = nil
}
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Others/PlatformSelectionView.swift b/ManicEmu/ManicEmu/Sources/Tools/Others/PlatformSelectionView.swift
index 9045462a..e60f011a 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Others/PlatformSelectionView.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Others/PlatformSelectionView.swift
@@ -76,7 +76,6 @@ class PlatformSelectionView: BaseView {
let detailLabel = UILabel()
detailLabel.numberOfLines = 0
- detailLabel.textAlignment = .center
detailLabel.text = R.string.localizable.platformSelectionDetail(gameName)
detailLabel.font = Constants.Font.body(size: .m)
detailLabel.textColor = Constants.Color.LabelPrimary
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Others/System.swift b/ManicEmu/ManicEmu/Sources/Tools/Others/System.swift
index ee869ad9..46c3d224 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Others/System.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Others/System.swift
@@ -11,6 +11,7 @@ import ManicEmuCore
enum System: CaseIterable
{
+ case dos
case doom
case j2me
case xbox360
@@ -49,7 +50,7 @@ enum System: CaseIterable
}
static var allCores: [ManicEmuCoreProtocol] {
- return [NES.core, SNES.core, ThreeDS.core, GBC.core, GBA.core, PSP.core, MD.core, MCD.core, S2X.core, SG1000.core, GG.core, MS.core, SS.core, N64.core, GB.core, VB.core, PM.core, PS1.core, DC.core, DS.core, FDS.core, Arcade.core, A2600.core, A5200.core, A7800.core, Lynx.core, Jaguar.core, J2ME.core, DOOM.core]
+ return [NES.core, SNES.core, ThreeDS.core, GBC.core, GBA.core, PSP.core, MD.core, MCD.core, S2X.core, SG1000.core, GG.core, MS.core, SS.core, N64.core, GB.core, VB.core, PM.core, PS1.core, DC.core, DS.core, FDS.core, Arcade.core, A2600.core, A5200.core, A7800.core, Lynx.core, Jaguar.core, J2ME.core, DOOM.core, DOS.core]
}
}
@@ -89,6 +90,7 @@ extension System {
case .lynx: return .lynx
case .j2me: return .j2me
case .xbox360: return .xbox360
+ case .dos: return .dos
}
}
}
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Others/ZipHandlerView.swift b/ManicEmu/ManicEmu/Sources/Tools/Others/ZipHandlerView.swift
new file mode 100644
index 00000000..f2ce8993
--- /dev/null
+++ b/ManicEmu/ManicEmu/Sources/Tools/Others/ZipHandlerView.swift
@@ -0,0 +1,256 @@
+//
+// ZipHandlerView.swift
+// ManicEmu
+//
+// Created by Daiuno on 2026/3/18.
+// Copyright © 2026 Manic EMU. All rights reserved.
+//
+
+import UIKit
+import ProHUD
+import ManicEmuCore
+
+class ZipHandlerView: BaseView {
+ static func show(urls: [URL],
+ completion: ((_ unzipUrls: [URL], _ noActionUrls: [URL])->Void)? = nil ) {
+ Sheet { sheet in
+ sheet.contentMaskView.alpha = 0
+ sheet.config.windowEdgeInset = 0
+ sheet.config.backgroundViewMask { mask in
+ mask.backgroundColor = .black.withAlphaComponent(0.2)
+ }
+
+ let view = UIView()
+ let grabber = UIImageView(image: R.image.grabber_icon())
+ grabber.contentMode = .center
+ view.addSubview(grabber)
+ grabber.snp.makeConstraints { make in
+ make.leading.top.trailing.equalToSuperview()
+ make.height.equalTo(Constants.Size.ContentSpaceTiny*3)
+ }
+
+ let containerView = RoundAndBorderView(roundCorner: (UIDevice.isPad || UIDevice.isLandscape) ? .allCorners : [.topLeft, .topRight])
+ containerView.backgroundColor = Constants.Color.Background
+ containerView.makeBlur()
+ view.addSubview(containerView)
+ containerView.snp.makeConstraints { make in
+ make.top.equalTo(grabber.snp.bottom)
+ make.leading.bottom.trailing.equalToSuperview()
+ }
+
+ let titleLabel = UILabel()
+ titleLabel.textAlignment = .center
+ titleLabel.text = R.string.localizable.zipHandlerTitle()
+ titleLabel.font = Constants.Font.title(size: .s, weight: .semibold)
+ titleLabel.textColor = Constants.Color.LabelPrimary
+ containerView.addSubview(titleLabel)
+ titleLabel.snp.makeConstraints { make in
+ make.centerX.equalToSuperview()
+ make.top.equalToSuperview().offset(30)
+ }
+
+ let detailLabel = UILabel()
+ detailLabel.numberOfLines = 0
+ detailLabel.text = R.string.localizable.zipHandlerDetail()
+ detailLabel.font = Constants.Font.body(size: .m)
+ detailLabel.textColor = Constants.Color.LabelPrimary
+ containerView.addSubview(detailLabel)
+ detailLabel.snp.makeConstraints { make in
+ make.leading.trailing.equalToSuperview().inset(Constants.Size.ContentSpaceHuge)
+ make.top.equalTo(titleLabel.snp.bottom).offset(Constants.Size.ContentSpaceMin)
+ }
+
+ let coreSelectionView = ZipHandlerView(urls: urls)
+ containerView.addSubview(coreSelectionView)
+ coreSelectionView.snp.makeConstraints { make in
+ make.leading.trailing.equalToSuperview()
+ make.top.equalTo(detailLabel.snp.bottom).offset(Constants.Size.ContentSpaceMin)
+ let count = Double(urls.count)
+ let estimatedHeight = count * Constants.Size.ItemHeightMid + ((count + 1) * Constants.Size.ContentSpaceMax)
+ let maxHeight = Constants.Size.WindowHeight/2
+ make.height.equalTo(min(estimatedHeight, maxHeight))
+ }
+
+ let confirmLabel = UILabel()
+ confirmLabel.isUserInteractionEnabled = true
+ confirmLabel.enableInteractive = true
+ confirmLabel.text = R.string.localizable.confirmTitle()
+ confirmLabel.textAlignment = .center
+ confirmLabel.font = Constants.Font.title(size: .s, weight: .regular)
+ confirmLabel.textColor = Constants.Color.LabelSecondary
+ containerView.addSubview(confirmLabel)
+ confirmLabel.snp.makeConstraints { make in
+ make.height.equalTo(Constants.Size.ItemHeightMid)
+ make.leading.trailing.equalToSuperview()
+ make.top.equalTo(coreSelectionView.snp.bottom)
+ make.bottom.equalToSuperview().offset(-Constants.Size.ContentInsetBottom)
+ }
+ confirmLabel.addTapGesture { [weak sheet] gesture in
+ let result = coreSelectionView.getResult()
+ sheet?.pop {
+ completion?(result.unzipUrls, result.noActionUrls)
+ }
+ }
+
+ sheet.set(customView: view).snp.makeConstraints { make in
+ make.edges.equalToSuperview()
+ }
+ }
+ }
+
+ private lazy var collectionView: UICollectionView = {
+ let view = UICollectionView(frame: .zero, collectionViewLayout: createLayout())
+ view.backgroundColor = .clear
+ view.contentInsetAdjustmentBehavior = .never
+ view.register(cellWithClass: ZipHandlerCollectionViewCell.self)
+ view.showsVerticalScrollIndicator = false
+ view.dataSource = self
+ view.allowsMultipleSelection = true
+ return view
+ }()
+
+ private var urls: [URL]
+
+ deinit {
+ Log.debug("\(String(describing: Self.self)) deinit")
+ }
+
+ init(urls: [URL]) {
+ self.urls = urls
+ super.init(frame: .zero)
+ Log.debug("\(String(describing: Self.self)) init")
+
+ addSubview(collectionView)
+ collectionView.snp.makeConstraints { make in
+ make.edges.equalToSuperview()
+ }
+ }
+
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+
+ private func createLayout() -> UICollectionViewLayout {
+ let layout = UICollectionViewCompositionalLayout { sectionIndex, env in
+ //item布局
+ let item = NSCollectionLayoutItem(layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1),
+ heightDimension: .fractionalHeight(1)))
+
+ let itemHeight: CGFloat = Constants.Size.ItemHeightMid
+
+ //group布局
+ let group = NSCollectionLayoutGroup.horizontal(layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(itemHeight)), subitems: [item])
+ group.contentInsets = NSDirectionalEdgeInsets(top: 0,
+ leading: Constants.Size.ContentSpaceMid * 2,
+ bottom: 0,
+ trailing: Constants.Size.ContentSpaceMid * 2)
+
+ //section布局
+ let section = NSCollectionLayoutSection(group: group)
+ section.interGroupSpacing = Constants.Size.ContentSpaceMax
+ section.contentInsets = NSDirectionalEdgeInsets(top: Constants.Size.ContentSpaceMax, leading: 0, bottom: Constants.Size.ContentSpaceMax, trailing: 0)
+
+ section.decorationItems = [NSCollectionLayoutDecorationItem.background(elementKind: String(describing: PlatformSelectionView.PlatformSelectionCollectionReusableView.self))]
+
+
+ return section
+ }
+
+ layout.register(PlatformSelectionView.PlatformSelectionCollectionReusableView.self, forDecorationViewOfKind: String(describing: PlatformSelectionView.PlatformSelectionCollectionReusableView.self))
+ return layout
+ }
+
+ func getResult() -> (unzipUrls: [URL], noActionUrls: [URL]) {
+ if let indexPaths = collectionView.indexPathsForSelectedItems {
+ var unzipUrls = [URL]()
+ var noActionUrls = [URL]()
+ for (row, url) in urls.enumerated() {
+ if indexPaths.contains(where: { $0.row == row }) {
+ unzipUrls.append(url)
+ } else {
+ noActionUrls.append(url)
+ }
+ }
+ return (unzipUrls, noActionUrls)
+ }
+ return ([], urls)
+ }
+}
+
+extension ZipHandlerView: UICollectionViewDataSource {
+
+ func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
+ return urls.count
+ }
+
+ func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
+ let url = urls[indexPath.row]
+ let cell = collectionView.dequeueReusableCell(withClass: ZipHandlerCollectionViewCell.self, for: indexPath)
+ cell.setData(fileName: url.lastPathComponent)
+ return cell
+ }
+}
+
+class ZipHandlerCollectionViewCell: UICollectionViewCell {
+ private var titleLabel: UILabel = {
+ let label = UILabel()
+ label.font = Constants.Font.body(size: .l)
+ label.textColor = Constants.Color.LabelPrimary
+ label.lineBreakMode = .byTruncatingMiddle
+ return label
+ }()
+
+ private let selectedIcon = SymbolButton(image: .init(symbol: .checkmarkCircleFill,
+ size: Constants.Size.IconSizeTiny.height,
+ colors: [Constants.Color.LabelPrimary, Constants.Color.Main]))
+
+ private let normalIcon = SymbolButton(image: .init(symbol: .circle,
+ size: Constants.Size.IconSizeTiny.height,
+ colors: [Constants.Color.LabelPrimary]))
+
+ override init(frame: CGRect) {
+ super.init(frame: frame)
+
+ layerCornerRadius = Constants.Size.CornerRadiusMid
+
+ backgroundColor = Constants.Color.Background
+
+ addSubview(titleLabel)
+ titleLabel.snp.makeConstraints { make in
+ make.centerY.equalToSuperview()
+ make.leading.equalToSuperview().offset(Constants.Size.ContentSpaceMid)
+ }
+
+ normalIcon.backgroundColor = .clear
+ addSubview(normalIcon)
+ normalIcon.snp.makeConstraints { make in
+ make.size.equalTo(Constants.Size.IconSizeMin)
+ make.centerY.equalToSuperview()
+ make.trailing.equalToSuperview().inset(Constants.Size.ContentSpaceMid)
+ }
+
+ selectedIcon.backgroundColor = .clear
+ selectedIcon.isHidden = true
+ addSubview(selectedIcon)
+ selectedIcon.snp.makeConstraints { make in
+ make.size.equalTo(Constants.Size.IconSizeMin)
+ make.centerY.equalToSuperview()
+ make.trailing.equalToSuperview().inset(Constants.Size.ContentSpaceMid)
+ }
+ }
+
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+
+ func setData(fileName: String, hideIcon: Bool = false) {
+ titleLabel.text = fileName
+ }
+
+ override var isSelected: Bool {
+ willSet {
+ normalIcon.isHidden = newValue
+ selectedIcon.isHidden = !newValue
+ }
+ }
+}
diff --git a/ManicSupport/Resources/System.core b/ManicSupport/Resources/System.core
index 53bd48c5..ffcc8bbb 100644
--- a/ManicSupport/Resources/System.core
+++ b/ManicSupport/Resources/System.core
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:5af66fa27bf62727da9bbbf855b733b59bdb6541bf3fda38279b134b082fd76a
-size 71890372
+oid sha256:5fae48f95295c585b5bae0e0d7c02807fe97d2b9dacb57e8185610fafd751627
+size 79780726