56 lines
1.6 KiB
Swift
56 lines
1.6 KiB
Swift
//
|
|
// GBC.swift
|
|
// GBCDeltaCore
|
|
//
|
|
// Created by Riley Testut on 4/11/17.
|
|
// Copyright © 2017 Riley Testut. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import AVFoundation
|
|
|
|
import DeltaCore
|
|
|
|
@objc public enum GBCGameInput: Int, Input
|
|
{
|
|
case up = 0x40
|
|
case down = 0x80
|
|
case left = 0x20
|
|
case right = 0x10
|
|
case a = 0x01
|
|
case b = 0x02
|
|
case start = 0x08
|
|
case select = 0x04
|
|
|
|
public var type: InputType {
|
|
return .game(.gbc)
|
|
}
|
|
}
|
|
|
|
public struct GBC: DeltaCoreProtocol
|
|
{
|
|
public static let core = GBC()
|
|
|
|
public var name: String { "GBCDeltaCore" }
|
|
public var identifier: String { "com.rileytestut.GBCDeltaCore" }
|
|
|
|
public var gameType: GameType { GameType.gbc }
|
|
public var gameInputType: Input.Type { GBCGameInput.self }
|
|
public var gameSaveFileExtension: String { "sav" }
|
|
|
|
public let audioFormat = AVAudioFormat(commonFormat: .pcmFormatInt16, sampleRate: 35112 * 60, channels: 2, interleaved: true)!
|
|
public let videoFormat = VideoFormat(format: .bitmap(.bgra8), dimensions: CGSize(width: 160, height: 144))
|
|
|
|
public var supportedCheatFormats: Set<CheatFormat> {
|
|
let gameGenieFormat = CheatFormat(name: NSLocalizedString("Game Genie", comment: ""), format: "XXX-YYY-ZZZ", type: .gameGenie)
|
|
let gameSharkFormat = CheatFormat(name: NSLocalizedString("GameShark", comment: ""), format: "XXXXXXXX", type: .gameShark)
|
|
return [gameGenieFormat, gameSharkFormat]
|
|
}
|
|
|
|
public var emulatorBridge: EmulatorBridging { GBCEmulatorBridge.shared }
|
|
|
|
private init()
|
|
{
|
|
}
|
|
}
|