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 resolution and cheat code settings for the DOOM core

Daiuno4b3925564bf6
diff --cc ManicEmu/ManicEmu.xcodeproj/project.pbxproj
index 1b4a5eeb,488b6b88..9286fbef
--- a/ManicEmu/ManicEmu.xcodeproj/project.pbxproj
+++ b/ManicEmu/ManicEmu.xcodeproj/project.pbxproj
@@@ -843,7 -840,7 +843,8 @@@
57FC198D2DF04E160076D93C /* right_eye_disabler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57FC198C2DF04E160076D93C /* right_eye_disabler.cpp */; };
57FC19982DF051180076D93C /* hack_manager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57FC19962DF051180076D93C /* hack_manager.cpp */; };
57FC19992DF051180076D93C /* hack_list.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57FC19952DF051180076D93C /* hack_list.cpp */; };
+ 57J2ME02F23397000EA24F1 /* J2ME.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57J2ME01F23397000EA24F1 /* J2ME.swift */; };
+ 7E864E4CE64E0E64CCE47550 /* DOOM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2068D6E791D56FF6148997EA /* DOOM.swift */; };
A392D5652E96682C00F920E7 /* DisabledTapSwitch.swift in Sources */ = {isa = PBXBuildFile; fileRef = A392D5632E96682600F920E7 /* DisabledTapSwitch.swift */; };
A392D5B32E9796B900F920E7 /* ServiceIconView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A392D5B22E9796B800F920E7 /* ServiceIconView.swift */; };
A3A043802E9BF57A006442C2 /* UIScrollViewExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3A0437F2E9BF57A006442C2 /* UIScrollViewExtensions.swift */; };
@@@ -4274,7 -4271,6 +4280,8 @@@
57F0D8402DE2CD7500760F57 /* Cores */ = {
isa = PBXGroup;
children = (
+ 57J2ME01F23397000EA24F1 /* J2ME.swift */,
++ 2068D6E791D56FF6148997EA /* DOOM.swift */,
573CEE952F23396C00EA24F1 /* Lynx.swift */,
573CEE902F23396200EA24F1 /* Jaguar.swift */,
573CEE882F2338D500EA24F1 /* A7800.swift */,
diff --cc ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/brand/doom_group_brand.imageset/Contents.json
index 00000000,00000000..85f13fd5
new file mode 100644
--- /dev/null
+++ b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/brand/doom_group_brand.imageset/Contents.json
@@@ -1,0 -1,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 --cc ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/brand/doom_group_brand.imageset/[email protected]
index 00000000,00000000..0707d01c
new file mode 100644
Binary files differ
diff --cc ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/brand/doom_group_brand.imageset/[email protected]
index 00000000,00000000..2f3d72b3
new file mode 100644
Binary files differ
diff --cc ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/doom_cover_h.imageset/Contents.json
index 00000000,00000000..17aac783
new file mode 100644
--- /dev/null
+++ b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/doom_cover_h.imageset/Contents.json
@@@ -1,0 -1,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 --cc ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/doom_cover_h.imageset/[email protected]
index 00000000,00000000..74a78638
new file mode 100644
Binary files differ
diff --cc ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/doom_cover_h.imageset/[email protected]
index 00000000,00000000..9ab47507
new file mode 100644
Binary files differ
diff --cc ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/doom_cover_v.imageset/Contents.json
index 00000000,00000000..5b22d5b4
new file mode 100644
--- /dev/null
+++ b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/doom_cover_v.imageset/Contents.json
@@@ -1,0 -1,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 --cc ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/doom_cover_v.imageset/[email protected]
index 00000000,00000000..8619f296
new file mode 100644
Binary files differ
diff --cc ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/cover/doom_cover_v.imageset/[email protected]
index 00000000,00000000..175ef02b
new file mode 100644
Binary files differ
diff --cc ManicEmu/ManicEmu/Resources/Config-Base.xcconfig
index 394bc456,95c3e0a4..f9d57d76
--- a/ManicEmu/ManicEmu/Resources/Config-Base.xcconfig
+++ b/ManicEmu/ManicEmu/Resources/Config-Base.xcconfig
@@@ -11,5 -11,5 +11,5 @@@
// https://help.apple.com/xcode/#/dev745c5c974
APP_BUNDLE_IDENTIFIER = com.aoshuang.manicemu
- APP_BUILD_VERSION = 0
-APP_BUILD_VERSION = 2
-APP_VERSION = 1.8.3
++APP_BUILD_VERSION = 1
+APP_VERSION = 1.9.0
diff --cc ManicEmu/ManicEmu/Sources/Business/CheatCode/Views/AddCheatCodeView.swift
index ef1e67dd,ef1e67dd..558ffa78
--- a/ManicEmu/ManicEmu/Sources/Business/CheatCode/Views/AddCheatCodeView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/CheatCode/Views/AddCheatCodeView.swift
@@@ -36,21 -36,21 +36,26 @@@ class AddCheatCodeView: BaseView
guard let self = self else { return }
self.collectionView.endEditing(true)
if let editGameCheat = self.editGameCheat,
-- cheatCode == editGameCheat.code,
-- cheatCodeName == editGameCheat.name,
-- cheatCodeType == editGameCheat.type {
++ self.cheatCode == editGameCheat.code,
++ self.cheatCodeName == editGameCheat.name,
++ self.cheatCodeType == editGameCheat.type {
//尝试编辑,但是没有任何改动
-- didTapClose?()
++ self.didTapClose?()
return
}
var isValid = false
if CheatType(cheatCodeType) == .autoDetect {
-- //自动检测模式下需要帮用户做一下检查
-- if let result = Self.checkCheat(cheatCode: cheatCode, supportedCheatFormats: supportedCheatFormats) {
++ if self.game.gameType == .doom, !self.cheatCode.trimmed.isEmpty {
isValid = true
-- cheatCode = result.formatString
-- cheatCodeType = result.cheatFormat.type.rawValue
++ self.cheatCodeType = CheatType.doomCommands.rawValue
++ } else {
++ //自动检测模式下需要帮用户做一下检查
++ if let result = Self.checkCheat(cheatCode: self.cheatCode, supportedCheatFormats: supportedCheatFormats) {
++ isValid = true
++ self.cheatCode = result.formatString
++ self.cheatCodeType = result.cheatFormat.type.rawValue
++ }
}
} else {
//指定了作弊码类型 且已经通过校验
@@@ -209,7 -209,7 +214,7 @@@
private func validateInput() {
var isValid = true
-- if cheatCodeName.isEmpty || cheatCodeType.isEmpty || cheatCode.isEmpty {
++ if cheatCodeName.trimmed.isEmpty || cheatCodeType.trimmed.isEmpty || cheatCode.trimmed.isEmpty {
//验证名称 不能为空
isValid = false
} else {
@@@ -296,8 -296,8 +301,13 @@@
currentCheatFormat: CheatFormat? = nil,
supportedCheatFormats: [CheatFormat] = []) -> (formatString: String, cheatFormat: CheatFormat)? {
if let currentCheatFormat {
++ if currentCheatFormat.type == .doomCommands {
++ if cheatCode.trimmed.isEmpty {
++ return nil
++ }
++ return (cheatCode, currentCheatFormat)
++ }
//指定作弊码类型的检查
-- var isValid = true
let formatString: String
if currentCheatFormat.type == .cwCheat {
formatString = Self.formattedCWCheat(code: cheatCode)
diff --cc ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoDetailReusableView.swift
index 22a9ed09,55caf8da..43423c62
--- a/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoDetailReusableView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoDetailReusableView.swift
@@@ -1215,7 -1199,7 +1215,7 @@@ class GameInfoDetailReusableView: UICol
} else if game.gameType == .n64 {
updateN64FunctionButton()
} else if game.gameType == .vb || game.gameType == .pm || game.isJGenesisCore {
-- updateNoCheatCodeFunctionButton()
++ hideDefaultFunctionButtons([cheatCodeButton])
} else if game.gameType == .ps1 {
updatePS1FunctionButton()
} else if game.gameType == .dc {
@@@ -1228,8 -1212,6 +1228,10 @@@
updateNSFunctionButton()
} else if game.isAtari {
updateAtariFunctionButton()
+ } else if game.isJ2MECore {
+ updateJ2MEFunctionButton()
++ } else if game.gameType == .doom || (game.gameType == .arcade && game.defaultCore == 0) {
++ hideDefaultFunctionButtons([retroButton])
}
addManualsButton()
hasSetupViews = true
@@@ -1355,7 -1337,7 +1357,7 @@@
}
private func updateCitra3DSFunctionButton() {
-- manualButton.removeFromSuperview()
++ hideDefaultFunctionButtons([retroButton])
threeDSAdvancedModeButton.removeFromSuperview()
jitContextMenuButton.removeFromSuperview()
jitButton.removeFromSuperview()
@@@ -1451,6 -1433,6 +1453,7 @@@
}
private func updateAzahar3DSFunctionButton() {
++ hideDefaultFunctionButtons([retroButton])
if let lastView = functionButtonContainerView.subviews.last {
functionButtonContainerView.addSubview(threeDSAdvancedSettingButton)
threeDSAdvancedSettingButton.snp.makeConstraints { make in
@@@ -1642,18 -1624,18 +1645,22 @@@
}
}
-- private func updateNoCheatCodeFunctionButton() {
-- cheatCodeButton.removeFromSuperview()
--
-- retroButton.snp.makeConstraints { make in
-- make.leading.centerY.equalToSuperview()
-- make.size.equalTo(Constants.Size.IconSizeHuge)
++ 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)
++ }
}
--
-- skinButton.snp.makeConstraints { make in
-- make.leading.equalTo(retroButton.snp.trailing).offset(Constants.Size.ContentSpaceMin)
-- make.size.equalTo(Constants.Size.IconSizeHuge)
-- make.trailing.equalToSuperview()
++ 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)
++ }
}
}
@@@ -1800,26 -1782,9 +1807,18 @@@
}
private func updateAtariFunctionButton() {
-- cheatCodeButton.removeFromSuperview()
-
- retroButton.snp.makeConstraints { make in
- make.leading.centerY.equalToSuperview()
- make.size.equalTo(Constants.Size.IconSizeHuge)
- }
-
- skinButton.snp.makeConstraints { make in
- make.leading.equalTo(retroButton.snp.trailing).offset(Constants.Size.ContentSpaceMin)
- make.size.equalTo(Constants.Size.IconSizeHuge)
- make.trailing.equalToSuperview()
++ if let game, game.gameType == .a5200 {
++ hideDefaultFunctionButtons([retroButton, cheatCodeButton])
++ } else {
++ hideDefaultFunctionButtons([cheatCodeButton])
+ }
+ }
+
+ private func updateJ2MEFunctionButton() {
- retroButton.removeFromSuperview()
- cheatCodeButton.removeFromSuperview()
++ hideDefaultFunctionButtons([retroButton, cheatCodeButton])
+ j2mesettingButton.removeFromSuperview()
- retroButton.snp.makeConstraints { make in
+ skinButton.snp.makeConstraints { make in
make.leading.centerY.equalToSuperview()
make.size.equalTo(Constants.Size.IconSizeHuge)
}
diff --cc ManicEmu/ManicEmu/Sources/Business/Games/Views/GameCoverView.swift
index f24945c1,a36daa02..b42c6847
--- a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameCoverView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameCoverView.swift
@@@ -231,10 -233,6 +231,12 @@@ class GameCoverView: UIView
image = style == .style2 ? R.image.jaguar_cover_v() : R.image.jaguar_cover_h()
} else if gameType == .lynx {
image = style == .style2 ? R.image.lynx_cover_v() : R.image.lynx_cover_h()
+ } else if gameType == .xbox360 {
+ 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 {
++ image = style == .style2 ? R.image.doom_cover_v() : R.image.doom_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 --cc ManicEmu/ManicEmu/Sources/Business/Games/Views/GamesCollectionReusableView.swift
index d297ef9e,68b8d232..55e3b661
--- a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GamesCollectionReusableView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GamesCollectionReusableView.swift
@@@ -212,10 -212,6 +212,12 @@@ class GamesCollectionReusableView: UICo
image = R.image.jaguar_group_brand(compatibleWith: traitCollection)
} else if gameType == .lynx {
image = R.image.lynx_group_brand(compatibleWith: traitCollection)
+ } else if gameType == .xbox360 {
+ image = R.image.xbox360_group_brand(compatibleWith: traitCollection)
+ } else if gameType == .j2me {
+ image = R.image.j2me_group_brand(compatibleWith: traitCollection)
++ } else if gameType == .doom {
++ image = R.image.doom_group_brand(compatibleWith: traitCollection)
}
Self.brandImageCaches[key] = image
return image
diff --cc ManicEmu/ManicEmu/Sources/Business/Play/Models/Game.swift
index 624e3103,25f23997..d3d097a2
--- a/ManicEmu/ManicEmu/Sources/Business/Play/Models/Game.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Play/Models/Game.swift
@@@ -496,7 -498,7 +500,7 @@@ class Game: Object, ObjectUpdatable
}
var supportRetroAchievements: Bool {
-- if gameType == ._3ds {
++ if gameType == ._3ds || gameType == .doom || gameType == .a5200 {
return false
}
if gameType == .arcade, defaultCore == 0 {
diff --cc ManicEmu/ManicEmu/Sources/Business/Play/Models/GameSetting.swift
index 9ec7578b,bd1f5877..ea7001ca
--- a/ManicEmu/ManicEmu/Sources/Business/Play/Models/GameSetting.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Play/Models/GameSetting.swift
@@@ -682,32 -655,7 +682,38 @@@ struct GameSetting: SettingCellItem
return gameType == .ps1
}
+ if type == .j2meSettings {
+ return gameType == .j2me
+ }
+
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
diff --cc ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift
index 34e56954,5a1ae9b8..75a7500f
--- a/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift
@@@ -1800,7 -1735,7 +1800,7 @@@ extension PlayViewController
}
case .resolution:
//MARK: handleMenuGameSetting.resolution
-- guard manicGame.gameType == ._3ds || manicGame.gameType == .psp || manicGame.gameType == .n64 || manicGame.gameType == .ps1 || manicGame.gameType == .dc || (manicGame.gameType == .ds && manicGame.defaultCore == 1) else { return true }
++ guard manicGame.gameType == ._3ds || manicGame.gameType == .psp || manicGame.gameType == .n64 || manicGame.gameType == .ps1 || manicGame.gameType == .dc || (manicGame.gameType == .ds && manicGame.defaultCore == 1) || manicGame.gameType == .doom else { return true }
Log.debug("设置分辨率")
if manicGame.resolution != item.resolution {
Game.change { realm in
@@@ -1825,6 -1760,6 +1825,11 @@@
let scale = UInt32(item.resolution == .undefine ? 1 : item.resolution.rawValue)
let option = "\(256*scale)x\(192*scale)"
LibretroCore.sharedInstance().updateRunningCoreConfigs(["desmume_internal_resolution": option], flush: false)
++ } else if manicGame.gameType == .doom {
++ let scale = UInt32(item.resolution == .undefine ? 1 : item.resolution.rawValue)
++ let option = "\(320*scale)x\(200*scale)"
++ LibretroCore.sharedInstance().updateRunningCoreConfigs(["prboom-resolution": option], flush: true)
++ LibretroCore().reload(byKeepState: true)
}
}
let message: String
@@@ -2661,6 -2572,6 +2666,13 @@@
"virtualjaguar_p2_retropad_analog_ru": "hash"
],
reload: false)
++ } else if manicGame.gameType == .doom {
++ let scale = UInt32(manicGame.resolution == .undefine ? 1 : manicGame.resolution.rawValue)
++ let option = "\(320*scale)x\(200*scale)"
++ LibretroCore.sharedInstance().updateConfig(LibretroCore.Cores.PrBoom.name,
++ configs: ["prboom-resolution": option,
++ "prboom-rumble": "enabled"],
++ reload: false)
}
//配置静音模式
@@@ -2830,7 -2740,7 +2844,6 @@@
DSEmulatorBridge.shared.isDeSmuMECore = false
} else {
//DeSmuME
-- let scale = UInt32(manicGame.resolution == .undefine ? 1 : manicGame.resolution.rawValue)
LibretroCore.sharedInstance().updateConfig(LibretroCore.Cores.DeSmuME.name,
configs: ["desmume_pointer_type": "touch",
"desmume_internal_resolution": "256x192",
@@@ -2996,7 -2906,7 +3009,6 @@@
enableLibretroLog = "true"
libretroLogLevel = "0"
#endif
-- let enableMircophone = (manicGame.gameType == .ds && (manicGame.getExtraBool(key: ExtraKey.microphone.rawValue) ?? false)) || manicGame.isAzahar3DS
LibretroCore.sharedInstance().updateLibretroConfigs([
"fastforward_frameskip": "false",
"log_verbosity": enableLibretroLog,
@@@ -3027,6 -2937,6 +3039,8 @@@
LibretroCore.sharedInstance().updateLibretroConfig("savefile_directory", value: Constants.Path.bsnes.libretroPath)
} else if manicGame.gameType == .ds {
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 {
LibretroCore.sharedInstance().updateLibretroConfig("savefile_directory", value: Constants.Path.LibretroSavePath.libretroPath)
}
diff --cc ManicEmu/ManicEmu/Sources/Business/Play/Views/GameSettingView.swift
index 95b60df2,4e2d3cd7..7f733af3
--- a/ManicEmu/ManicEmu/Sources/Business/Play/Views/GameSettingView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Play/Views/GameSettingView.swift
@@@ -635,7 -631,7 +635,14 @@@ extension GameSettingView: UICollection
}
return UIContextMenuConfiguration(actionProvider: { _ in UIMenu(children: actions) })
} else {
-- let actions = GameSetting.Resolution.allCases.filter({ $0 != .undefine }).map { resolution in
++ let actions = GameSetting.Resolution.allCases.filter({
++ if game.gameType == .doom && ($0 == .undefine || $0 == .nine || $0 == .ten) {
++ return false
++ } else if $0 == .undefine {
++ return false
++ }
++ return true
++ }).map { resolution in
UIAction(title: resolution.title,
image: resolution == game.resolution ? UIImage(symbol: .checkmarkCircleFill) : nil) { [weak self] _ in
guard let self = self else { return }
diff --cc ManicEmu/ManicEmu/Sources/Tools/Cores/DOOM.swift
index 00000000,4b59c836..cb423a72
mode 000000,100644..100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Cores/DOOM.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Cores/DOOM.swift
@@@ -1,0 -1,165 +1,171 @@@
+ //
+ // DOOM.swift
+ // ManicEmu
+ //
+ // Created by Stephen on 3/16/2026.
+ //
+
+ import ManicEmuCore
+ import AVFoundation
+
+ extension GameType
+ {
+ static let doom = GameType("public.aoshuang.game.doom")
+ }
+
++extension CheatType
++{
++ static let doomCommands = CheatType("DoomCommands")
++}
++
+ @objc enum DOOMGameInput: 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 flex
+ case menu
+
+ public var type: InputType {
+ return .game(.doom)
+ }
+
+ 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 == "flex" { self = .flex }
+ else { return nil }
+ }
+ }
+
+ struct DOOM: ManicEmuCoreProtocol {
+ public static let core = DOOM()
+
+ public var name: String { "DOOM" }
+ public var identifier: String { "com.aoshuang.DOOMCore" }
+
+ public var gameType: GameType { GameType.doom }
+ public var gameInputType: Input.Type { DOOMGameInput.self }
+ var allInputs: [Input] { DOOMGameInput.allCases }
- public var gameSaveExtension: String { "save" }
++ public var gameSaveExtension: String { "dsg" }
+
+ public let audioFormat = AVAudioFormat(commonFormat: .pcmFormatInt16, sampleRate: 44100, channels: 2, interleaved: true)!
+ public let videoFormat = VideoFormat(format: .bitmap(.rgb565), dimensions: CGSize(width: 320, height: 200))
+
+ public var supportCheatFormats: Set<CheatFormat> {
- return []
++ let doomCommandsFormat = CheatFormat(name: NSLocalizedString("DoomCommands", comment: ""), format: "", type: .doomCommands, allowedCodeCharacters: .letters)
++ return [doomCommandsFormat]
+ }
+
+ public var emulatorConnector: EmulatorBase { DOOMEmulatorBridge.shared }
+
+ private init() {}
+ }
+
+
+ class DOOMEmulatorBridge : NSObject, EmulatorBase {
+ static let shared = DOOMEmulatorBridge()
+
+ 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)?
+
+ 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 let gameInput = DOOMGameInput(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: DOOMGameInput) -> 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 let gameInput = DOOMGameInput(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 --cc ManicEmu/ManicEmu/Sources/Tools/Extensions/LibretroCoreExtensions.swift
index 65c5541f,cbdddfd9..99785701
--- a/ManicEmu/ManicEmu/Sources/Tools/Extensions/LibretroCoreExtensions.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Extensions/LibretroCoreExtensions.swift
@@@ -9,7 -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
- case Nestopia, Snes9x, PicoDrive, Yabause, BeetleSaturn, Mupen64PlushNext, BeetleVB, PokeMini, BeetlePSXHW, bsnes, Gambatte, VBAM, mGBA, Flycast, Gearsystem, ClownMDEmu, bsnesJG, melonDSDS, PPSSPP, MAME, FinalBurnNeo, PrBoom, Citra, Azahar, JGenesis, DeSmuME, Stella, Atari800, ProSystem, VirtualJaguar, Holani
++ 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
var name: String {
switch self {
diff --cc ManicEmu/ManicEmu/Sources/Tools/Others/OnlineCoverManager.swift
index b36b96d1,0d083941..483f94e0
--- a/ManicEmu/ManicEmu/Sources/Tools/Others/OnlineCoverManager.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Others/OnlineCoverManager.swift
@@@ -127,12 -127,6 +127,14 @@@ class OnlineCoverManager
boxArtUrl = host.appendingPathComponent("Atari - Jaguar/Named_Boxarts")
case .lynx:
boxArtUrl = host.appendingPathComponent("Atari - Lynx/Named_Boxarts")
+ case .ns, .xbox360, .j2me:
+ searchCoversFromMoby(coverMatch: coverMatch,
+ persistentedTranslation: persistentedTranslation,
+ isCallBackMain: isCallBackMain,
+ completion: completion)
+ return
++ case .doom:
++ boxArtUrl = host.appendingPathComponent("DOOM/Named_Boxarts")
default:
boxArtUrl = nil
}
diff --cc ManicEmu/ManicEmu/Sources/Tools/Others/System.swift
index 9aee2303,d386a10f..ee869ad9
--- a/ManicEmu/ManicEmu/Sources/Tools/Others/System.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Others/System.swift
@@@ -11,8 -11,7 +11,9 @@@ import ManicEmuCor
enum System: CaseIterable
{
+ case doom
+ case j2me
+ case xbox360
case jaguar
case lynx
case a7800
@@@ -48,7 -47,7 +49,7 @@@
}
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]
- 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, DOOM.core, A2600.core, A5200.core, A7800.core, Lynx.core, Jaguar.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]
}
}
diff --cc ManicSupport/Resources/System.core
index 13ae1eff,65369efe..53bd48c5
--- a/ManicSupport/Resources/System.core
+++ b/ManicSupport/Resources/System.core
@@@ -1,3 -1,3 +1,3 @@@
version https://git-lfs.github.com/spec/v1
- oid sha256:8076af9631d2d260e72ca801e686c7e91336b065847d3166ed7f5c1d27968c89
- size 71841118
-oid sha256:e7ee99fa0c28a3f6c9481c409fa4212ba086bfd07e86f0cd32901329c579332d
-size 60037267
++oid sha256:5af66fa27bf62727da9bbbf855b733b59bdb6541bf3fda38279b134b082fd76a
++size 71890372