Skip to content
This repository has been archived by the owner on Nov 12, 2021. It is now read-only.

Commit

Permalink
Changed the structs to a more readable type
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavo-IM committed Jul 7, 2019
1 parent f99e7d7 commit e400566
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 12 deletions.
16 changes: 11 additions & 5 deletions AGPMInjector.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
CF8D21E221D722FC00C0A72D /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF8D21E121D722FC00C0A72D /* ViewController.swift */; };
CF8D21E421D722FE00C0A72D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CF8D21E321D722FE00C0A72D /* Assets.xcassets */; };
CF8D21E721D722FE00C0A72D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CF8D21E521D722FE00C0A72D /* Main.storyboard */; };
CF8D21F021D7232400C0A72D /* AGPM.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF8D21EF21D7232400C0A72D /* AGPM.swift */; };
CF8D21F021D7232400C0A72D /* getPlist.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF8D21EF21D7232400C0A72D /* getPlist.swift */; };
CFB08C8221E1BDFE008C5465 /* Readme.md in Resources */ = {isa = PBXBuildFile; fileRef = CFB08C8121E1BDFE008C5465 /* Readme.md */; };
CFB288FB22D2A77600D229E9 /* setPlist.swift in Sources */ = {isa = PBXBuildFile; fileRef = CFB288FA22D2A77600D229E9 /* setPlist.swift */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand All @@ -40,8 +41,9 @@
CF8D21E621D722FE00C0A72D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
CF8D21E821D722FE00C0A72D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
CF8D21E921D722FE00C0A72D /* AGPMInjector.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = AGPMInjector.entitlements; sourceTree = "<group>"; };
CF8D21EF21D7232400C0A72D /* AGPM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AGPM.swift; sourceTree = "<group>"; };
CF8D21EF21D7232400C0A72D /* getPlist.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = getPlist.swift; sourceTree = "<group>"; };
CFB08C8121E1BDFE008C5465 /* Readme.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = Readme.md; sourceTree = "<group>"; };
CFB288FA22D2A77600D229E9 /* setPlist.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = setPlist.swift; sourceTree = "<group>"; };
CFEE247C21EBFBCD005DD627 /* iGPU_FAQs.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = iGPU_FAQs.md; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -88,7 +90,8 @@
CF8D21DE21D722FC00C0A72D /* AGPMInjector */ = {
isa = PBXGroup;
children = (
CF8D21EF21D7232400C0A72D /* AGPM.swift */,
CF8D21EF21D7232400C0A72D /* getPlist.swift */,
CFB288FA22D2A77600D229E9 /* setPlist.swift */,
CF8D21DF21D722FC00C0A72D /* AppDelegate.swift */,
CF8D21E121D722FC00C0A72D /* ViewController.swift */,
CF8D21E321D722FE00C0A72D /* Assets.xcassets */,
Expand Down Expand Up @@ -127,7 +130,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1010;
LastUpgradeCheck = 1010;
LastUpgradeCheck = 1100;
ORGANIZATIONNAME = Pavo;
TargetAttributes = {
CF8D21DB21D722FC00C0A72D = {
Expand Down Expand Up @@ -177,7 +180,8 @@
buildActionMask = 2147483647;
files = (
CF8D21E221D722FC00C0A72D /* ViewController.swift in Sources */,
CF8D21F021D7232400C0A72D /* AGPM.swift in Sources */,
CFB288FB22D2A77600D229E9 /* setPlist.swift in Sources */,
CF8D21F021D7232400C0A72D /* getPlist.swift in Sources */,
CF8D21E021D722FC00C0A72D /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -320,6 +324,7 @@
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = 5DG8PLV54H;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)";
INFOPLIST_FILE = AGPMInjector/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
Expand All @@ -340,6 +345,7 @@
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = 5DG8PLV54H;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)";
INFOPLIST_FILE = AGPMInjector/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
LastUpgradeVersion = "1100"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -27,8 +27,6 @@
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
Expand All @@ -38,8 +36,8 @@
ReferencedContainer = "container:AGPMInjector.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
Expand All @@ -61,8 +59,6 @@
ReferencedContainer = "container:AGPMInjector.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
124 changes: 124 additions & 0 deletions AGPMInjector/setPlist.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
//
// setPlist.swift
// AGPMInjector
//
// Created by Henry Brock on 7/7/19.
// Copyright © 2019 Pavo. All rights reserved.
//

import Foundation


struct setPlist: Encodable {
let buildMachineOSBuild, cfBundleDevelopmentRegion, cfBundleGetInfoString, cfBundleIdentifier: String
let cfBundleInfoDictionaryVersion, cfBundleName, cfBundlePackageType, cfBundleShortVersionString: String
let cfBundleSignature, cfBundleVersion, nsHumanReadableCopyright: String
let setIOKitPersonalities: setIOKitPersonalities
let osBundleRequired: String
enum CodingKeys: String, CodingKey {
case buildMachineOSBuild = "BuildMachineOSBuild"
case cfBundleDevelopmentRegion = "CFBundleDevelopmentRegion"
case cfBundleGetInfoString = "CFBundleGetInfoString"
case cfBundleIdentifier = "CFBundleIdentifier"
case cfBundleInfoDictionaryVersion = "CFBundleInfoDictionaryVersion"
case cfBundleName = "CFBundleName"
case cfBundlePackageType = "CFBundlePackageType"
case cfBundleShortVersionString = "CFBundleShortVersionString"
case cfBundleSignature = "CFBundleSignature"
case cfBundleVersion = "CFBundleVersion"
case nsHumanReadableCopyright = "NSHumanReadableCopyright"
case setIOKitPersonalities = "IOKitPersonalities"
case osBundleRequired = "OSBundleRequired"
}
}

struct setIOKitPersonalities: Encodable {
let setAGPM: setAGPM

enum CodingKeys: String, CodingKey {
case setAGPM = "AGPM"
}
}

struct setAGPM: Encodable {
let cfBundleIdentifier, ioClass, ioNameMatch, ioProviderClass: String
let setMachines: setMachines
enum CodingKeys: String, CodingKey {
case cfBundleIdentifier = "CFBundleIdentifier"
case ioClass = "IOClass"
case ioNameMatch = "IONameMatch"
case ioProviderClass = "IOProviderClass"
case setMachines = "Machines"
}
}

struct setMachines: Encodable {
let machine: setMachine
func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: setMachine.MachineType.self)
try container.encode(machine, forKey: machine.type)
}
}

struct setMachine: Encodable {
let type: MachineType
let gfx: gfx

enum CodingKeys: String, CodingKey {
case gfx = "GFX0"
}

enum MachineType: String, CodingKey, Codable {
case iMacPro11 = "iMacPro1,1"
case macPro51 = "MacPro5,1"
case macPro41 = "MacPro4,1"
case macPro61 = "MacPro6,1"
case iMac101 = "iMac10,1"
case iMac111 = "iMac11,1"
case iMac112 = "iMac11,2"
case iMac113 = "iMac11,3"
case iMac121 = "iMac12,1"
case iMac122 = "iMac12,2"
case iMac131 = "iMac13,1"
case iMac132 = "iMac13,2"
case iMac133 = "iMac13,3"
case iMac141 = "iMac14,1"
case iMac142 = "iMac14,2"
case iMac143 = "iMac14,3"
case iMac144 = "iMac14,4"
case iMac151 = "iMac15,1"
case iMac152 = "iMac15,2"
case iMac161 = "iMac16,1"
case iMac162 = "iMac16,2"
case iMac171 = "iMac17,1"
case iMac181 = "iMac18,1"
case iMac182 = "iMac18,2"
case iMac183 = "iMac18,3"
case iMac191 = "iMac19,1"
case iMac192 = "iMac19,2"
}
}

struct gfx: Encodable {
let agdcEnabled: Int
let setHeuristic: setHeuristic
let controlID: Int
let maxPowerState: Int
let minPowerState: Int

enum CodingKeys: String, CodingKey {
case agdcEnabled = "AGDCEnabled"
case setHeuristic = "Heuristic"
case controlID = "control-id"
case maxPowerState = "max-power-state"
case minPowerState = "min-power-state"
}
}

struct setHeuristic: Encodable {
let setID: Int

enum CodingKeys: String, CodingKey {
case setID = "ID"
}
}

0 comments on commit e400566

Please sign in to comment.