Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions OpenCore Configurator.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
810042441ECA33DF009FE633 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 810042431ECA33DF009FE633 /* AppDelegate.swift */; };
810042461ECA33DF009FE633 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 810042451ECA33DF009FE633 /* ViewController.swift */; };
8100424B1ECA33DF009FE633 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 810042491ECA33DF009FE633 /* Main.storyboard */; settings = {ASSET_TAGS = (0, ); }; };
901FF74B228C322B0068449B /* Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 901FF74A228C322B0068449B /* Configuration.swift */; };
901FF74D228C35870068449B /* ACPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 901FF74C228C35870068449B /* ACPI.swift */; };
901FF74F228C360F0068449B /* DeviceProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 901FF74E228C360F0068449B /* DeviceProperties.swift */; };
901FF751228C36190068449B /* Kernel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 901FF750228C36190068449B /* Kernel.swift */; };
901FF753228C36280068449B /* Miscellaneous.swift in Sources */ = {isa = PBXBuildFile; fileRef = 901FF752228C36280068449B /* Miscellaneous.swift */; };
901FF755228C363D0068449B /* NVRAM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 901FF754228C363D0068449B /* NVRAM.swift */; };
901FF757228C36440068449B /* PlatformInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 901FF756228C36440068449B /* PlatformInfo.swift */; };
901FF759228C364B0068449B /* UEFI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 901FF758228C364B0068449B /* UEFI.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -32,6 +40,14 @@
810042471ECA33DF009FE633 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
8100424A1ECA33DF009FE633 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
8100424C1ECA33DF009FE633 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
901FF74A228C322B0068449B /* Configuration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Configuration.swift; sourceTree = "<group>"; };
901FF74C228C35870068449B /* ACPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ACPI.swift; sourceTree = "<group>"; };
901FF74E228C360F0068449B /* DeviceProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceProperties.swift; sourceTree = "<group>"; };
901FF750228C36190068449B /* Kernel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Kernel.swift; sourceTree = "<group>"; };
901FF752228C36280068449B /* Miscellaneous.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Miscellaneous.swift; sourceTree = "<group>"; };
901FF754228C363D0068449B /* NVRAM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NVRAM.swift; sourceTree = "<group>"; };
901FF756228C36440068449B /* PlatformInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlatformInfo.swift; sourceTree = "<group>"; };
901FF758228C364B0068449B /* UEFI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UEFI.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -69,6 +85,7 @@
810042451ECA33DF009FE633 /* ViewController.swift */,
810042471ECA33DF009FE633 /* Assets.xcassets */,
810042491ECA33DF009FE633 /* Main.storyboard */,
901FF749228C32190068449B /* Model */,
8100424C1ECA33DF009FE633 /* Info.plist */,
7F4C29DD2269FD2900720E68 /* Extensions.swift */,
7F4C29E1226A130A00720E68 /* AcpiPopoverController.swift */,
Expand All @@ -79,6 +96,21 @@
path = "OpenCore Configurator";
sourceTree = "<group>";
};
901FF749228C32190068449B /* Model */ = {
isa = PBXGroup;
children = (
901FF74A228C322B0068449B /* Configuration.swift */,
901FF74C228C35870068449B /* ACPI.swift */,
901FF74E228C360F0068449B /* DeviceProperties.swift */,
901FF750228C36190068449B /* Kernel.swift */,
901FF752228C36280068449B /* Miscellaneous.swift */,
901FF754228C363D0068449B /* NVRAM.swift */,
901FF756228C36440068449B /* PlatformInfo.swift */,
901FF758228C364B0068449B /* UEFI.swift */,
);
path = Model;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -154,13 +186,21 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
901FF757228C36440068449B /* PlatformInfo.swift in Sources */,
901FF74F228C360F0068449B /* DeviceProperties.swift in Sources */,
7FF918A9227226A60081891E /* openHandlerFunctions.swift in Sources */,
901FF753228C36280068449B /* Miscellaneous.swift in Sources */,
810042461ECA33DF009FE633 /* ViewController.swift in Sources */,
901FF755228C363D0068449B /* NVRAM.swift in Sources */,
7F3AAC182279BB55006644AD /* saveHandlerFunctions.swift in Sources */,
7F961CCC2270974E007F0BBE /* KernelPopoverController.swift in Sources */,
7F4C29DE2269FD2900720E68 /* Extensions.swift in Sources */,
7F4C29E2226A130A00720E68 /* AcpiPopoverController.swift in Sources */,
901FF74D228C35870068449B /* ACPI.swift in Sources */,
901FF74B228C322B0068449B /* Configuration.swift in Sources */,
810042441ECA33DF009FE633 /* AppDelegate.swift in Sources */,
901FF759228C364B0068449B /* UEFI.swift in Sources */,
901FF751228C36190068449B /* Kernel.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
93 changes: 93 additions & 0 deletions OpenCore Configurator/Model/ACPI.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
// Copyright © 2019 notiflux. All rights reserved.

import Foundation

struct ACPI: Codable {
var additions: [Addition]?
var blocks: [Block]?
var patches: [Patch]?
var quirks: Quirks?

private enum CodingKeys: String, CodingKey {
case additions = "Add"
case blocks = "Block"
case patches = "Patch"
case quirks = "Quirk"
}

struct Addition: Codable {
var comment: String?
var isEnabled: Bool = false
var path: String

private enum CodingKeys: String, CodingKey {
case comment = "Comment"
case isEnabled = "Enabled"
case path = "Path"
}
}

struct Block: Codable {
var blockAll: Bool? = false
var comment: String?
var isEnabled: Bool? = false
var oemTableIdentifier: Data? = Data(repeating: 0, count: 8)
var tableLength: Int? = 0
var tableSignature: Data? = Data(repeating: 0, count: 4)

private enum CodingKeys: String, CodingKey {
case blockAll = "All"
case comment = "Comment"
case isEnabled = "Enabled"
case oemTableIdentifier = "OemTableId"
case tableLength = "TableLength"
case tableSignature = "TableSignature"
}
}

struct Patch: Codable {
var comment: String?
var count: Int? = 0
var isEnabled: Bool? = false
var find: Data?
var limit: Int? = 0
var mask: Data?
var oemTableIdentifier: Data? = Data(repeating: 0, count: 8)
var replace: Data?
var replaceMask: Data?
var skip: Int? = 0
var tableLength: Int? = 0
var tableSignature: Data? = Data(repeating: 0, count: 4)

private enum CodingKeys: String, CodingKey {
case comment = "Comment"
case count = "Count"
case isEnabled = "Enabled"
case find = "Find"
case limit = "Limit"
case mask = "Mask"
case oemTableIdentifier = "OemTableId"
case replace = "Replace"
case replaceMask = "ReplaceMask"
case skip = "Skip"
case tableLength = "TableLength"
case tableSignature = "TableSignature"
}
}

struct Quirks: Codable {
var fadtEnableReset: Bool? = false
var ignoreForWindows: Bool? = false
var normalizeHeaders: Bool? = false
var rebaseRegions: Bool? = false
var resetLogoStatus: Bool? = false

private enum CodingKeys: String, CodingKey {
case fadtEnableReset = "FadtEnableReset"
case ignoreForWindows = "IgnoreForWindows"
case normalizeHeaders = "NormalizeHeaders"
case rebaseRegions = "RebaseRegions"
case resetLogoStatus = "ResetLogoStatus"
}
}
}
61 changes: 61 additions & 0 deletions OpenCore Configurator/Model/Configuration.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Copyright © 2019 notiflux. All rights reserved.

import Foundation

struct Configuration: Codable {
var acpi: ACPI?
var deviceProperties: DeviceProperties?
var kernel: Kernel?
var miscellaneous: Miscellaneous?
var nvram: NVRAM?
var platformInfo: PlatformInfo?
var uefi: UEFI?

private enum CodingKeys: String, CodingKey {
case acpi = "ACPI"
case deviceProperties = "DeviceProperties"
case kernel = "Kernel"
case miscellaneous = "Misc"
case nvram = "NVRAM"
case platformInfo = "PlatformInfo"
case uefi = "UEFI"
}

enum Value: Codable {
case string(String)
case int(Int)
case data(Data)
case empty

init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()
do {
self = try .int(container.decode(Int.self))
} catch DecodingError.typeMismatch {
do {
self = try .string(container.decode(String.self))
} catch DecodingError.typeMismatch {
do {
self = try .data(container.decode(Data.self))
} catch DecodingError.typeMismatch {
throw DecodingError.typeMismatch(Value.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "Encoded payload not of an expected type"))
}
}
}
}

func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
switch self {
case let .int(int):
try container.encode(int)
case let .string(string):
try container.encode(string)
case let .data(data):
try container.encode(data)
case .empty:
try container.encodeNil()
}
}
}
}
13 changes: 13 additions & 0 deletions OpenCore Configurator/Model/DeviceProperties.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright © 2019 notiflux. All rights reserved.

import Foundation

struct DeviceProperties: Codable {
var additions: [String: [String: Configuration.Value]]?
var blocks: [String]?

private enum CodingKeys: String, CodingKey {
case additions = "Add"
case blocks = "Block"
}
}
95 changes: 95 additions & 0 deletions OpenCore Configurator/Model/Kernel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
// Copyright © 2019 notiflux. All rights reserved.

import Foundation

struct Kernel: Codable {
var additions: [Addition]?
var blocks: [Block]?
var patches: [Patch]?
var quirks: Quirks?

private enum CodingKeys: String, CodingKey {
case additions = "Add"
case blocks = "Block"
case patches = "Patch"
case quirks = "Quirk"
}

struct Addition: Codable {
var bundlePath: String?
var comment: String?
var isEnabled: Bool = false
var executablePath: String?
var matchKernel: String?
var plistPath: String?

private enum CodingKeys: String, CodingKey {
case bundlePath = "BundlePath"
case comment = "Comment"
case isEnabled = "Enabled"
case executablePath = "ExecutablePath"
case matchKernel = "MatchKernel"
case plistPath = "PlistPath"
}
}

struct Block: Codable {
var comment: String?
var isEnabled: Bool
var identifier: String?
var matchKernel: String?

private enum CodingKeys: String, CodingKey {
case comment = "Comment"
case isEnabled = "Enabled"
case identifier = "Identifier"
case matchKernel = "MatchKernel"
}
}

struct Patch: Codable {
var base: String?
var comment: String?
var count: Int?
var isEnabled: Bool
var find: Data?
var identifier: Data?
var limit: Int?
var mask: Data?
var matchKernel: String?
var replace: Data?
var replaceMask: Data?
var skip: Int?

private enum CodingKeys: String, CodingKey {
case base = "Base"
case comment = "Comment"
case count = "Count"
case isEnabled = "Enabled"
case find = "Find"
case identifier = "Identifier"
case limit = "Limit"
case mask = "Mask"
case matchKernel = "MatchKernel"
case replace = "Replace"
case replaceMask = "ReplaceMask"
case skip = "Skip"
}
}

struct Quirks: Codable {
var appleCpuPmCfgLock: Bool = false
var appleXcpmCfgLock: Bool = false
var externalDiskIcons: Bool = false
var thirdPartyTrim: Bool = false
var xhciPortLimit: Bool = false

private enum CodingKeys: String, CodingKey {
case appleCpuPmCfgLock = "AppleCpuPmCfgLock"
case appleXcpmCfgLock = "AppleXcpmCfgLock"
case externalDiskIcons = "ExternalDiskIcons"
case thirdPartyTrim = "ThirdPartyTrim"
case xhciPortLimit = "XhciPortLimit"
}
}
}
Loading