Skip to content

Commit

Permalink
Merge branch 'develop' into fix-warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeMatt committed Apr 9, 2024
2 parents 7ecf08e + bfddb74 commit 150d20b
Show file tree
Hide file tree
Showing 35 changed files with 117 additions and 117 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public extension PVEmulatorConfiguration {
}

class func updateSystems(fromPlists plists: [URL]) {
typealias SystemPlistEntries = [SytemPlistEntry]
typealias SystemPlistEntries = [SystemPlistEntry]
let database = RomDatabase.sharedInstance
let decoder = PropertyListDecoder()

Expand Down Expand Up @@ -150,7 +150,7 @@ public extension PVEmulatorConfiguration {
}
}

class func setPropertiesTo(pvSystem: PVSystem, fromSystemPlistEntry system: SytemPlistEntry) {
class func setPropertiesTo(pvSystem: PVSystem, fromSystemPlistEntry system: SystemPlistEntry) {
pvSystem.openvgDatabaseID = Int(system.PVDatabaseID) ?? -1
pvSystem.requiresBIOS = system.PVRequiresBIOS ?? false
pvSystem.manufacturer = system.PVManufacturer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -703,12 +703,12 @@ public extension PVEmulatorConfiguration {
@objc
class func m3uFile(forGame game: PVGame) -> URL? {
let gamePath = path(forGame: game)
return m3uFile(forURL: gamePath, indentifier: game.system.identifier)
return m3uFile(forURL: gamePath, identifier: game.system.identifier)
}

@objc
class func m3uFile(forURL gamePath: URL, indentifier: String) -> URL? {
let gameDirectory = romDirectory(forSystemIdentifier: indentifier)
class func m3uFile(forURL gamePath: URL, identifier: String) -> URL? {
let gameDirectory = romDirectory(forSystemIdentifier: identifier)
let filenameWithoutExtension = stripDiscNames(fromFilename: gamePath.deletingPathExtension().lastPathComponent)

do {
Expand Down
6 changes: 3 additions & 3 deletions PVLibrary/PVLibrary/Domain/BIOS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public typealias BIOSExpectationsInfoProvider = ExpectedMD5Provider & ExpectedFilenameProvider & ExpectedSizeProvider & ExpectedExistantInfoProvider
public typealias BIOSExpectationsInfoProvider = ExpectedMD5Provider & ExpectedFilenameProvider & ExpectedSizeProvider & ExpectedExistentInfoProvider

public protocol BIOSInfoProvider: BIOSExpectationsInfoProvider {
var descriptionText: String { get }
Expand Down Expand Up @@ -97,7 +97,7 @@ public struct BIOSStatus: Codable {
}

public enum State: Codable {
public enum CodingError: Error { case uknownRawValue(Int) }
public enum CodingError: Error { case unknownRawValue(Int) }

case missing
case mismatch([Mismatch])
Expand All @@ -124,7 +124,7 @@ public struct BIOSStatus: Codable {
self = .match
return
default:
throw CodingError.uknownRawValue(rawValue)
throw CodingError.unknownRawValue(rawValue)
}
} else {
fatalError("No known decode")
Expand Down
4 changes: 2 additions & 2 deletions PVLibrary/PVLibrary/Domain/PlistDataModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ public extension ControlLayoutEntry {
let dictionary = try JSONSerialization.jsonObject(with: data, options: .allowFragments) as? [String: Any]
return dictionary!
} catch {
fatalError("Bad serialzied data")
fatalError("Bad serialized data")
}
}
}

public struct SytemPlistEntry: Codable, Equatable, Hashable {
public struct SystemPlistEntry: Codable, Equatable, Hashable {
public private(set) var PVSystemIdentifier: String
public private(set) var PVDatabaseID: String
public private(set) var PVRequiresBIOS: Bool?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,6 @@ public protocol ExpectedSizeProvider {
var expectedSize: Int { get }
}

public protocol ExpectedExistantInfoProvider {
public protocol ExpectedExistentInfoProvider {
var optional: Bool { get }
}
2 changes: 1 addition & 1 deletion PVLibrary/PVLibrary/Domain/System.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public enum SystemGeneration: UInt, Codable {
case sixth
case seventh
case eighth
case nineth
case ninth
case tenth
}

Expand Down
34 changes: 17 additions & 17 deletions PVLibrary/PVLibrary/Importer/Services/GameImporter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ public extension GameImporter {

if games.count > 1 {
// TODO: Prompt use for which one? or change all, or all where custom artwork isn't set but only if tehre's at least one that isn't? =jm
WLOG("There were mutliple matches for \(gamePartialPath)! #\(games.count). Going with first for now until we make better code to prompt user.")
WLOG("There were multiple matches for \(gamePartialPath)! #\(games.count). Going with first for now until we make better code to prompt user.")
}

let game = games.first!
Expand Down Expand Up @@ -667,7 +667,7 @@ public extension GameImporter {
#if canImport(UIKit)
// Create new Data from scaled image
guard let coverArtScaledData = coverArtScaledImage.jpegData(compressionQuality: 0.85) else {
ELOG("Failed to create data respresentation of scaled image")
ELOG("Failed to create data representation of scaled image")
return nil
}
#else
Expand Down Expand Up @@ -779,7 +779,7 @@ public extension GameImporter {
try FileManager.default.removeItem(at: path)
ILOG("Deleted empty import folder \(path.path)")
} else {
ILOG("Found non-empty folder in improts dir. Will iterate subcontents for import")
ILOG("Found non-empty folder in imports dir. Will iterate subcontents for import")
subContents.forEach { subFile in
self.workQueue.addOperation {
self._handlePath(path: subFile, userChosenSystem: nil)
Expand Down Expand Up @@ -876,7 +876,7 @@ public extension GameImporter {
let similarName = RomDatabase.sharedInstance.altName(path, systemIdentifier: system.identifier)
if let existingGame = maybeGame ?? // found a match above?
RomDatabase.sharedInstance.getGamesCache()[partialPath] ??
RomDatabase.sharedInstance.getGamesCache()[similiarName],
RomDatabase.sharedInstance.getGamesCache()[similarName],
system.identifier == existingGame.systemIdentifier
{
//database.all(PVGame.self, filter: NSPredicate(format: "romPath CONTAINS[c] %@", argumentArray: [partialPath])).first ?? // Exact filename match
Expand Down Expand Up @@ -1384,7 +1384,7 @@ extension GameImporter {
*/
public func moveCDROM(toAppropriateSubfolder candidateFile: ImportCandidateFile) -> [URL]? {
guard let systemsForExtension = systemIDsForRom(at: candidateFile.filePath) else {
WLOG("No sytem found for import candidate file \(candidateFile.filePath.lastPathComponent)")
WLOG("No system found for import candidate file \(candidateFile.filePath.lastPathComponent)")
return nil
}

Expand Down Expand Up @@ -1433,7 +1433,7 @@ extension GameImporter {

var relatedFiles: [URL]?
// moved the .cue, now move .bins .imgs etc to the destination dir (conflicts or system dir, decided above)
if var paths = moveFiles(similiarToFile: candidateFile.filePath, toDirectory: newDirectory, cuesheet: newCDFilePath) {
if var paths = moveFiles(similarToFile: candidateFile.filePath, toDirectory: newDirectory, cuesheet: newCDFilePath) {
paths.append(newCDFilePath)
relatedFiles = paths
}
Expand All @@ -1447,7 +1447,7 @@ extension GameImporter {
return relatedFiles
}

public func biosEntryMatcing(candidateFile: ImportCandidateFile) -> PVBIOS? {
public func biosEntryMatching(candidateFile: ImportCandidateFile) -> PVBIOS? {
// Check if BIOS by filename - should possibly just only check MD5?
if let bios = PVEmulatorConfiguration.biosEntry(forFilename: candidateFile.filePath.lastPathComponent) {
return bios
Expand Down Expand Up @@ -1477,8 +1477,8 @@ extension GameImporter {
}

// Check first if known BIOS
if let biosEntry = biosEntryMatcing(candidateFile: candidateFile) {
ILOG("Candiate file matches as a known BIOS")
if let biosEntry = biosEntryMatching(candidateFile: candidateFile) {
ILOG("Candidate file matches as a known BIOS")
// We have a BIOS file match
let destinationPath = biosEntry.expectedPath
let biosDirectory = biosEntry.system.biosDirectory
Expand Down Expand Up @@ -1521,15 +1521,15 @@ extension GameImporter {
// Check if .m3u
if extensionLowercased == "m3u" {
let cueFilenameWithoutExtension = filePath.deletingPathExtension().lastPathComponent
let similiarFile = PVEmulatorConfiguration.stripDiscNames(fromFilename: cueFilenameWithoutExtension)
let similarFile = PVEmulatorConfiguration.stripDiscNames(fromFilename: cueFilenameWithoutExtension)

var foundGameMaybe = RomDatabase.sharedInstance.all(PVGame.self, filter: NSPredicate(format: "romPath CONTAINS[c] %@", argumentArray: [similiarFile])).first
var foundGameMaybe = RomDatabase.sharedInstance.all(PVGame.self, filter: NSPredicate(format: "romPath CONTAINS[c] %@", argumentArray: [similarFile])).first

// If don't find by the m3u partial file name matching a filename, try to see if the first line of the m3u matches any games filenames partially
if foundGameMaybe == nil, let m3uContents = try? String(contentsOf: filePath, encoding: .utf8) {
if var firstLine = m3uContents.components(separatedBy: .newlines).first {
firstLine = PVEmulatorConfiguration.stripDiscNames(fromFilename: firstLine)
if let game = RomDatabase.sharedInstance.all(PVGame.self, filter: NSPredicate(format: "romPath CONTAINS[c] %@", argumentArray: [similiarFile])).first {
if let game = RomDatabase.sharedInstance.all(PVGame.self, filter: NSPredicate(format: "romPath CONTAINS[c] %@", argumentArray: [similarFile])).first {
foundGameMaybe = game
}
}
Expand Down Expand Up @@ -1631,7 +1631,7 @@ extension GameImporter {
if let s = systemID, let f = systemToPathMap[s] {
subfolderPathMaybe = f
} else {
ELOG("Didn't expecte any nils here")
ELOG("Didn't expect any nils here")
return nil
}
} else {
Expand All @@ -1651,7 +1651,7 @@ extension GameImporter {
if let s = systemID, let f = systemToPathMap[s] {
subfolderPathMaybe = f
} else {
ELOG("Didn't expecte any nils here")
ELOG("Didn't expect any nils here")
return nil
}
}
Expand Down Expand Up @@ -1729,8 +1729,8 @@ extension GameImporter {
return newPath
}

public func moveFiles(similiarToFile inputFile: URL, toDirectory: URL, cuesheet cueSheetPath: URL) -> [URL]? {
ILOG("Move files files similiar to \(inputFile.lastPathComponent) to directory \(toDirectory.lastPathComponent) from cue sheet \(cueSheetPath.lastPathComponent)")
public func moveFiles(similarToFile inputFile: URL, toDirectory: URL, cuesheet cueSheetPath: URL) -> [URL]? {
ILOG("Move files files similar to \(inputFile.lastPathComponent) to directory \(toDirectory.lastPathComponent) from cue sheet \(cueSheetPath.lastPathComponent)")
let relatedFileName: String = PVEmulatorConfiguration.stripDiscNames(fromFilename: inputFile.deletingPathExtension().lastPathComponent)

let contents: [URL]
Expand Down Expand Up @@ -1770,7 +1770,7 @@ extension GameImporter {
}

if filenameWithoutExtension.contains(relatedFileName) {
DLOG("<\(file.lastPathComponent)> was found to be similiar to <\(cueSheetPath.lastPathComponent)>")
DLOG("<\(file.lastPathComponent)> was found to be similar to <\(cueSheetPath.lastPathComponent)>")
// Before moving the file, make sure the cue sheet's reference uses the same case.
if !cueSheetPath.path.isEmpty {
do {
Expand Down
10 changes: 5 additions & 5 deletions PVLibrary/PVLibrary/Importer/iCloudSync.swift
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ extension SyncFileToiCloud where Self: LocalFileInfoProvider {
}

do {
ILOG("Trying to set Ubiquitious from local (\(url.path)) to ICloud (\(destinationURL.path))")
ILOG("Trying to set ubiquitous from local (\(url.path)) to iCloud (\(destinationURL.path))")
try fm.setUbiquitous(true, itemAt: url, destinationURL: destinationURL)
completionHandler(.success)
} catch {
Expand Down Expand Up @@ -267,7 +267,7 @@ public final class iCloudSync {
}

public static func importNewSaves() {
if !RomDatabase.databaseInitilized {
if !RomDatabase.databaseInitialized {
// Keep trying // TODO: Add a notification for this
// instead of dumb loop
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) {
Expand All @@ -289,8 +289,8 @@ public final class iCloudSync {
try? fm.contentsOfDirectory(at: $0, includingPropertiesForKeys: nil, options: .skipsHiddenFiles)
}.joined()
let jsonFiles = saveFiles.filter { $0.pathExtension == "json" }
let jsonDecorder = JSONDecoder()
jsonDecorder.dataDecodingStrategy = .deferredToData
let jsonDecoder = JSONDecoder()
jsonDecoder.dataDecodingStrategy = .deferredToData

let legacySubDirs: [URL]?
do {
Expand Down Expand Up @@ -342,7 +342,7 @@ public final class iCloudSync {
}

DLOG("Data read \(String(data: data, encoding: .utf8) ?? "Nil")")
let save = try jsonDecorder.decode(SaveState.self, from: data)
let save = try jsonDecoder.decode(SaveState.self, from: data)
DLOG("Read JSON data at (\(json.absoluteString)")

let existing = realm.object(ofType: PVSaveState.self, forPrimaryKey: save.id)
Expand Down
12 changes: 6 additions & 6 deletions PVLibrary/PVLibrary/RealmPlatform/RomDatabase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public extension Thread {

public typealias RomDB = RomDatabase
public final class RomDatabase {
public private(set) static var databaseInitilized = false
public private(set) static var databaseInitialized = false
static var gamesCache: [String: PVGame]?
static var systemCache: [String: PVSystem]?
static var coreCache: [String: PVCore]?
Expand All @@ -212,7 +212,7 @@ public final class RomDatabase {
static var artFileNameToMD5Cache:[String:String]?

public class func initDefaultDatabase() throws {
if !databaseInitilized {
if !databaseInitialized {
RealmConfiguration.setDefaultRealmConfig()
try _sharedInstance = RomDatabase()

Expand All @@ -226,7 +226,7 @@ public final class RomDatabase {
createInitialLocalLibrary()
}

databaseInitilized = true
databaseInitialized = true
}
}

Expand Down Expand Up @@ -680,9 +680,9 @@ public extension RomDatabase {
RomDatabase.gamesCache=addGameCache(game, cache: RomDatabase.gamesCache ?? [:])
}
func altName(_ romPath:URL, systemIdentifier:String) -> String {
var similiarName = romPath.deletingPathExtension().lastPathComponent
similiarName = PVEmulatorConfiguration.stripDiscNames(fromFilename: similiarName)
return (systemIdentifier as NSString).appendingPathComponent(similiarName)
var similarName = romPath.deletingPathExtension().lastPathComponent
similarName = PVEmulatorConfiguration.stripDiscNames(fromFilename: similarName)
return (systemIdentifier as NSString).appendingPathComponent(similarName)
}
func getGamesCache() -> [String:PVGame] {
if RomDatabase.gamesCache == nil {
Expand Down
2 changes: 1 addition & 1 deletion PVSupport/Sources/PVLibRetro/PVLibRetroCore.m
Original file line number Diff line number Diff line change
Expand Up @@ -1325,7 +1325,7 @@ extern bool video_pixel_frame_scale(const void *data,
void video_driver_frame(const void *data, unsigned width,
unsigned height, size_t pitch)
{
NAssert(@"Shouldn't be here, or need to impliment");
NAssert(@"Shouldn't be here, or need to implement");
// static char video_driver_msg[256];
// unsigned output_width = 0;
// unsigned output_height = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public final class HapticsManager {
try engine.playPattern(from: url)

} catch { // Engine startup errors
ELOG("An error occured playing \(filename): \(error).")
ELOG("An error occurred playing \(filename): \(error).")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation
@_exported import GameController
import simd

private let thumbstickSensitivty: Float = 0.2
private let thumbstickSensitivity: Float = 0.2

@objc
public enum PVControllerAxisDirection : UInt, CustomDebugStringConvertible {
Expand Down Expand Up @@ -44,7 +44,7 @@ public enum PVControllerAxisDirection : UInt, CustomDebugStringConvertible {
let xValue = fabsf(thumbstick.xAxis.value)
let yValue = fabsf(thumbstick.yAxis.value)

if xValue <= thumbstickSensitivty && yValue <= thumbstickSensitivty {
if xValue <= thumbstickSensitivity && yValue <= thumbstickSensitivity {
self = .None
return
}
Expand Down
Loading

0 comments on commit 150d20b

Please sign in to comment.