Skip to content

Commit

Permalink
This commit is way too big
Browse files Browse the repository at this point in the history
- Work on M1 support
- Switch to injection method made by @jslegendre
- Support warning users about ABI on M1 machines
- Altered SIP info
- Updated some old copyright
- Updated pods
  • Loading branch information
w0lfschild committed Feb 4, 2021
1 parent 8fb8c8f commit 44f1c98
Show file tree
Hide file tree
Showing 541 changed files with 21,861 additions and 14,999 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,19 @@
### 1.2.0

- M1 (Apple Silicon) support **
- Updates System tab
- Removed option to toggle plugins to user folder
- Core plugins are now stored in /Library/Application Support/MacEnhance/CorePlugins
- Core plugins are not shown in the manage tab
- Button colors change with system color
- Display changelog when opening app after updates
- Altered SIP information shown to user
- Automate booting to recovery mode
- Automate disabling abi on arm machines
- Bug fixes

** Every individual plugin will require an update to support arm64/arm64e

### 1.1.0

- Initial support for Big Sur
Expand Down
283 changes: 184 additions & 99 deletions MacForge/MacForge.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1200"
LastUpgradeVersion = "1240"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -14,24 +14,24 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8D01CCC60486CAD60068D4B7"
BuildableName = "mach_inject_bundle_stub.bundle"
BlueprintName = "mach_inject_bundle_stub"
ReferencedContainer = "container:mach_inject_bundle_stub.xcodeproj">
BlueprintIdentifier = "FB13A8D525CA613E004790BE"
BuildableName = "PluginLoader.bundle"
BlueprintName = "PluginLoader"
ReferencedContainer = "container:MacForge.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Development"
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Development"
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
Expand All @@ -40,37 +40,28 @@
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8D01CCC60486CAD60068D4B7"
BuildableName = "mach_inject_bundle_stub.bundle"
BlueprintName = "mach_inject_bundle_stub"
ReferencedContainer = "container:mach_inject_bundle_stub.xcodeproj">
</BuildableReference>
</MacroExpansion>
</LaunchAction>
<ProfileAction
buildConfiguration = "Deployment"
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8D01CCC60486CAD60068D4B7"
BuildableName = "mach_inject_bundle_stub.bundle"
BlueprintName = "mach_inject_bundle_stub"
ReferencedContainer = "container:mach_inject_bundle_stub.xcodeproj">
BlueprintIdentifier = "FB13A8D525CA613E004790BE"
BuildableName = "PluginLoader.bundle"
BlueprintName = "PluginLoader"
ReferencedContainer = "container:MacForge.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Development">
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Deployment"
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Expand Up @@ -12,24 +12,29 @@
<key>MacForgeDockTile.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>4</integer>
<integer>2</integer>
</dict>
<key>MacForgeHelper.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
</dict>
<key>PluginLoader.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>53</integer>
</dict>
<key>PreferenceLoader.xcscheme_^#shared#^_</key>
<dict>
<key>isShown</key>
<true/>
<key>orderHint</key>
<integer>5</integer>
<integer>3</integer>
</dict>
<key>com.w0lf.MacForge.Injector.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>7</integer>
<integer>4</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
Expand Down
Binary file not shown.
48 changes: 29 additions & 19 deletions MacForge/MacForge/AppDelegate.h
Expand Up @@ -37,7 +37,7 @@
#import "SGDirWatchdog.h"
#import "NSBundle+LoginItem.h"

#import "MF_extra.h"
#import "MECore.h"
#import "MF_pluginPreferencesView.h"
#import "MF_accountManager.h"
#import "MF_BlacklistManager.h"
Expand Down Expand Up @@ -90,22 +90,22 @@
@property IBOutlet NSView *sourcesBundle;

// Extra
@property IBOutlet MF_extra *sidebarController;
@property IBOutlet MECore *sidebarController;

// Top sidebar items
@property IBOutlet NSSearchField *searchPlugins;
@property IBOutlet MF_sidebarButton *sidebarFeatured;
@property IBOutlet MF_sidebarButton *sidebarDiscover;
@property IBOutlet MF_sidebarButton *sidebarUpdates;
@property IBOutlet NSButton *viewUpdateCounter;
@property IBOutlet MF_sidebarButton *sidebarSystem;
@property IBOutlet MF_sidebarButton *sidebarManage;
@property IBOutlet MF_sidebarButton *sidebarPluginPrefs;
@property IBOutlet NSSearchField *searchPlugins;
@property IBOutlet MECoreSBButton *sidebarFeatured;
@property IBOutlet MECoreSBButton *sidebarDiscover;
@property IBOutlet MECoreSBButton *sidebarUpdates;
@property IBOutlet NSButton *viewUpdateCounter;
@property IBOutlet MECoreSBButton *sidebarSystem;
@property IBOutlet MECoreSBButton *sidebarManage;
@property IBOutlet MECoreSBButton *sidebarPluginPrefs;

// Bottom sidebar items
@property IBOutlet MF_sidebarButton *sidebarWarning;
@property IBOutlet MF_sidebarButton *sidebarDiscord;
@property IBOutlet MF_sidebarButton *sidebarAccount;
@property IBOutlet MECoreSBButton *sidebarWarning;
@property IBOutlet MECoreSBButton *sidebarDiscord;
@property IBOutlet MECoreSBButton *sidebarAccount;

// About view
@property IBOutlet NSTextField *appName;
Expand Down Expand Up @@ -135,12 +135,22 @@
@property IBOutlet NSSecureTextField *password;

// System Information view
@property IBOutlet NSButton *MacForgePrivHelper;
@property IBOutlet NSButton *SIP_filesystem;
@property IBOutlet NSButton *SIP_TaskPID;
@property IBOutlet NSTextField *SIP_status;
@property IBOutlet NSTextField *AMFI_status;
@property IBOutlet NSTextField *LV_status;
//@property IBOutlet NSButton *MacForgePrivHelper;
//@property IBOutlet NSButton *SIP_filesystem;
//@property IBOutlet NSButton *SIP_TaskPID;
//@property IBOutlet NSTextField *SIP_status;
//@property IBOutlet NSTextField *AMFI_status;
//@property IBOutlet NSTextField *LV_status;

@property IBOutlet NSImageView *SIP_filesystem;
@property IBOutlet NSImageView *SIP_taskPID;
@property IBOutlet NSImageView *SIP_status;
@property IBOutlet NSImageView *SIP_amfi;
@property IBOutlet NSImageView *SIP_abi;
@property IBOutlet NSImageView *SIP_lv;
@property IBOutlet NSImageView *SIP_privHelper;
@property IBOutlet NSImageView *SIP_helper;

@property IBOutlet NSView *infoDocView;
@property IBOutlet NSScrollView *infoScroll;
@property IBOutlet blacklistTable *blackListTable;
Expand Down
99 changes: 35 additions & 64 deletions MacForge/MacForge/AppDelegate.m
Expand Up @@ -11,7 +11,6 @@
AppDelegate *myDelegate;
NSDate *appStart;
NSMutableDictionary *myPreferences;
NSWindow *sipWarningWindow;

@implementation AppDelegate

Expand Down Expand Up @@ -96,7 +95,7 @@ - (NSString*) runCommand: (NSString*)command {
- (instancetype)init {
myDelegate = self;
appStart = [NSDate date];
osx_ver = MF_extra.sharedInstance.macOS;
osx_ver = MECore.sharedInstance.macOS;
return self;
}

Expand Down Expand Up @@ -183,7 +182,7 @@ - (void)showLink:(MF_Plugin*)p {
MF_repoData.sharedInstance.currentPlugin = p;
NSView *v = myDelegate.sourcesBundle;
dispatch_async(dispatch_get_main_queue(), ^(void){
[MF_extra.sharedInstance setViewSubViewWithScrollableView:self.tabMain :v];
[MECore.sharedInstance setViewSubViewWithScrollableView:self.tabMain :v];
});
} else {
showBundleOnOpen = false;
Expand Down Expand Up @@ -306,7 +305,7 @@ - (void)applicationWillFinishLaunching:(NSNotification *)aNotification {
// Sidebar

// Init the sidebar controller
_sidebarController = MF_extra.sharedInstance;
_sidebarController = MECore.sharedInstance;
_sidebarController.mainView = _tabMain;
_sidebarController.mainWindow = _window;
_sidebarController.prefWindow = _windowPreferences;
Expand All @@ -328,7 +327,7 @@ - (void)applicationWillFinishLaunching:(NSNotification *)aNotification {
[_sidebarDiscord.buttonClickArea setImageScaling:NSImageScaleAxesIndependently];
[_sidebarDiscord.buttonClickArea setAutoresizingMask:NSViewMaxYMargin];

if (![SIPKit SIP_HasRequiredFlags] || ![SIPKit LIBRARYVALIDATION_enabled]) [_sidebarWarning.buttonClickArea setEnabled:false];
if (![SIPKit SIP_HasRequiredFlags] || ![SIPKit LIBRARYVALIDATION_isEnabled]) [_sidebarWarning.buttonClickArea setEnabled:false];
if ([NSUserDefaults.standardUserDefaults boolForKey:@"prefHideDiscord"]) [_sidebarDiscord.buttonClickArea setEnabled:false];

[_sidebarWarning.buttonClickArea setTarget:_sidebarController];
Expand Down Expand Up @@ -392,43 +391,11 @@ - (IBAction)resetSidebar:(id)sender {
[_sidebarController setupSidebar];
}

- (void)byeSIP {
exit(0);
}

- (void)restartSIP {
system("osascript -e 'tell application \"Finder\" to restart'");
}

- (void)closeSIP {
[_window endSheet:sipWarningWindow];
}

- (void)checkSIP {
if (![SIPKit SIP_HasRequiredFlags]) {
NSString *frameworkBundleID = @"com.macenhance.SIPKit";
NSBundle *frameworkBundle = [NSBundle bundleWithIdentifier:frameworkBundleID];

SK_SipView *p = [[SK_SipView alloc] initWithNibName:@"SK_SipView" bundle:frameworkBundle];
NSView *view = p.view;
[p.confirmQuit setTarget:self];
[p.confirmQuit setAction:@selector(byeSIP)];
[p.confirmReboot setTarget:self];
[p.confirmReboot setAction:@selector(restartSIP)];
[p.confirm setTarget:self];
[p.confirm setAction:@selector(closeSIP)];

sipWarningWindow = [[NSWindow alloc] initWithContentRect:[view frame] styleMask:NSWindowStyleMaskTitled backing:NSBackingStoreBuffered defer:YES];
[sipWarningWindow setContentView:view];
[_window beginSheet:sipWarningWindow completionHandler:^(NSModalResponse returnCode) { }];
}
}

- (void)setupWindow {
[_window setTitle:@""];
[_window setMovableByWindowBackground:YES];

[self executionTime:@"checkSIP"];
[SIPKit showMasterWaringinWindow:_window];

[_window setTitlebarAppearsTransparent:true];
[_window setTitleVisibility:NSWindowTitleHidden];
Expand All @@ -437,16 +404,11 @@ - (void)setupWindow {
[self simbl_blacklist];

// Add blurred background if NSVisualEffectView exists
Class vibrantClass=NSClassFromString(@"NSVisualEffectView");
if (vibrantClass) {
NSVisualEffectView *vibrant=[[vibrantClass alloc] initWithFrame:[[_window contentView] bounds]];
[vibrant setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[vibrant setBlendingMode:NSVisualEffectBlendingModeBehindWindow];
[vibrant setState:NSVisualEffectStateActive];
[[_window contentView] addSubview:vibrant positioned:NSWindowBelow relativeTo:nil];
} else {
[_window setBackgroundColor:[NSColor whiteColor]];
}
NSVisualEffectView *vibrant = [[NSVisualEffectView alloc] initWithFrame:[[_window contentView] bounds]];
[vibrant setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[vibrant setBlendingMode:NSVisualEffectBlendingModeBehindWindow];
[vibrant setState:NSVisualEffectStateActive];
[[_window contentView] addSubview:vibrant positioned:NSWindowBelow relativeTo:nil];

[_window.contentView setWantsLayer:YES];

Expand Down Expand Up @@ -585,27 +547,36 @@ - (IBAction)toggleHideMenubar:(id)sender {
[[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"com.macenhance.MacForgeHelperNotify" object:message];
}

- (NSImage*)onOff:(BOOL)state {
if (state) return [NSImage imageNamed:NSImageNameStatusAvailable];
return [NSImage imageNamed:NSImageNameStatusUnavailable];
}

- (void)setupSystemView {
Boolean sipEnabled = [SIPKit SIP_enabled];
Boolean sipHasFlags = [SIPKit SIP_HasRequiredFlags];
Boolean amfiEnabled = [SIPKit AMFI_enabled];
Boolean LVEnabled = [SIPKit LIBRARYVALIDATION_enabled];
// SIP off = green
_SIP_status.image = [self onOff:![SIPKit SIP_enabled]];

[_SIP_TaskPID setState:![SIPKit SIP_TASK_FOR_PID]];
[_SIP_filesystem setState:![SIPKit SIP_Filesystem]];
[_MacForgePrivHelper setState:[FileManager fileExistsAtPath:@"/Library/PrivilegedHelperTools/com.macenhance.MacForge.Injector"]];
// AMFI on = green
_SIP_amfi.image = [self onOff:[SIPKit AMFI_isEnabled]];

if (!sipEnabled) [_SIP_status setStringValue:@"Disabled"];
if (!amfiEnabled) [_AMFI_status setStringValue:@"Disabled"];
if (!LVEnabled) [_LV_status setStringValue:@"Disabled"];
if (sipEnabled && sipHasFlags) [_SIP_status setStringValue:@"Enabled (Custom)"];
// Library Validation off = green
_SIP_lv.image = [self onOff:![SIPKit LIBRARYVALIDATION_isEnabled]];

[_infoScroll setDocumentView:_infoDocView];
[_infoScroll.contentView scrollToPoint:CGPointMake(0, 0)];
// abi off = green
// or x86 = green
_SIP_abi.image = [self onOff:![SIPKit ABI_isEnabled]];

dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void){
[SIPKit AMFI_NUKE];
});
// off = green
_SIP_filesystem.image = [self onOff:![SIPKit SIP_Filesystem]];

// off = green
_SIP_taskPID.image = [self onOff:![SIPKit SIP_TASK_FOR_PID]];

// file exists = green
_SIP_privHelper.image = [self onOff:[FileManager fileExistsAtPath:@"/Library/PrivilegedHelperTools/com.macenhance.MacForge.Injector"]];

// process running = green
_SIP_helper.image = [self onOff:[NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.macenhance.MacForgeHelper"]];
}

- (void)simbl_blacklist {
Expand Down

0 comments on commit 44f1c98

Please sign in to comment.