Skip to content

Commit

Permalink
switch to cef
Browse files Browse the repository at this point in the history
  • Loading branch information
marzent committed Nov 29, 2021
1 parent c981092 commit 855dbef
Show file tree
Hide file tree
Showing 330 changed files with 2,194 additions and 394,472 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -24,4 +24,4 @@ Icon
Network Trash Folder
Temporary Items
.apdisk

cef_binary_*
28 changes: 28 additions & 0 deletions BunnyHUD Helper/Info.plist
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.0</string>
<key>CFBundleVersion</key>
<string>2</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2021 Marc-Aurel Zent</string>
</dict>
</plist>
72 changes: 72 additions & 0 deletions BunnyHUD Helper/main.c
@@ -0,0 +1,72 @@
/*
See LICENSE folder for licensing information.
*/

#if USE_SWIFT_HELPER
#include <dlfcn.h>
#else
#include "include/capi/cef_app_capi.h"
#endif

#include "include/wrapper/cef_library_loader.h"
#include "include/cef_sandbox_mac.h"
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>

// Entry point function for sub-processes.
int main(int argc, char* argv[]) {
// Initialize the macOS sandbox for this helper process.
void* sandboxContext = cef_sandbox_initialize(argc, argv);
if (!sandboxContext) {
return 1;
}

// Load the CEF framework library at runtime instead of linking directly
// as required by the macOS sandbox implementation.
const char* format = "%s/../../../Chromium Embedded Framework.framework/Chromium Embedded Framework";
char* dirName = dirname(argv[0]);
size_t bufSize = snprintf(NULL, 0, format, dirName) + 1;
char* fwPath = (char*)malloc(bufSize);
snprintf(fwPath, bufSize, format, dirName);

int success = cef_load_library(fwPath);
free(fwPath);

if (!success) {
cef_sandbox_destroy(sandboxContext);
return 2;
}

#if USE_SWIFT_HELPER
void* lib = dlopen("SwiftHelper.framework/SwiftHelper", RTLD_LAZY);
if (!lib) {
cef_unload_library();
cef_sandbox_destroy(sandboxContext);
return 3;
}

int (*helperMain)(void) = dlsym(lib, "HelperMain");
dlclose(lib);

if (!helperMain) {
cef_unload_library();
cef_sandbox_destroy(sandboxContext);
return 4;
}

int retval = helperMain();
#else
// Provide CEF with command-line arguments.
cef_main_args_t mainArgs = {.argc = argc, .argv = argv};

// Execute the sub-process.
int retval = cef_execute_process(&mainArgs, NULL, NULL);
#endif

cef_unload_library();
cef_sandbox_destroy(sandboxContext);

return retval;
}

1,511 changes: 1,280 additions & 231 deletions BunnyHUD.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1310"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -14,9 +14,9 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "50841AEE270DFA36005B7D3F"
BuildableName = "BunnyHUD.app"
BlueprintName = "BunnyHUD"
BlueprintIdentifier = "E8A9A6D31FB839D400F41676"
BuildableName = "BunnyHUD Helper.app"
BlueprintName = "BunnyHUD Helper (C)"
ReferencedContainer = "container:BunnyHUD.xcodeproj">
</BuildableReference>
</BuildActionEntry>
Expand All @@ -31,9 +31,9 @@
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand All @@ -44,9 +44,9 @@
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "50841AEE270DFA36005B7D3F"
BuildableName = "BunnyHUD.app"
BlueprintName = "BunnyHUD"
BlueprintIdentifier = "E8A9A6D31FB839D400F41676"
BuildableName = "BunnyHUD Helper.app"
BlueprintName = "BunnyHUD Helper (C)"
ReferencedContainer = "container:BunnyHUD.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
Expand All @@ -61,9 +61,9 @@
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "50841AEE270DFA36005B7D3F"
BuildableName = "BunnyHUD.app"
BlueprintName = "BunnyHUD"
BlueprintIdentifier = "E8A9A6D31FB839D400F41676"
BuildableName = "BunnyHUD Helper.app"
BlueprintName = "BunnyHUD Helper (C)"
ReferencedContainer = "container:BunnyHUD.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
Expand Down
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1310"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E82313922458D12500F03641"
BuildableName = "BunnyHUD Helper (GPU).app"
BlueprintName = "BunnyHUD Helper (GPU)"
ReferencedContainer = "container:BunnyHUD.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E82313922458D12500F03641"
BuildableName = "BunnyHUD Helper (GPU).app"
BlueprintName = "BunnyHUD Helper (GPU)"
ReferencedContainer = "container:BunnyHUD.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E82313922458D12500F03641"
BuildableName = "BunnyHUD Helper (GPU).app"
BlueprintName = "BunnyHUD Helper (GPU)"
ReferencedContainer = "container:BunnyHUD.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1310"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E82313AA2458D14500F03641"
BuildableName = "BunnyHUD Helper (Plugin).app"
BlueprintName = "BunnyHUD Helper (Plugin)"
ReferencedContainer = "container:BunnyHUD.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E82313AA2458D14500F03641"
BuildableName = "BunnyHUD Helper (Plugin).app"
BlueprintName = "BunnyHUD Helper (Plugin)"
ReferencedContainer = "container:BunnyHUD.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E82313AA2458D14500F03641"
BuildableName = "BunnyHUD Helper (Plugin).app"
BlueprintName = "BunnyHUD Helper (Plugin)"
ReferencedContainer = "container:BunnyHUD.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

0 comments on commit 855dbef

Please sign in to comment.