theos / orion Goto Github PK
View Code? Open in Web Editor NEWElegant tweak development in pure Swift
Home Page: https://orion.theos.dev
License: MIT License
Elegant tweak development in pure Swift
Home Page: https://orion.theos.dev
License: MIT License
Orion.framework is compiled with Xcode 11.
Xcode 11 swift apps break on arm64e iOS 14.
Orion tweaks crash in orion_init
on arm64e iOS 14:
Call stack:
--
2 | 0 ColoredSwipe.dylib 0x0000000101132e00 0x10112c000 + 28160 // orion_init()
3 | 1 ColoredSwipe.dylib 0x0000000101132ddc 0x10112c000 + 28124 // orion_init()
4 | 2 ColoredSwipe.dylib 0x0000000101132da0 0x10112c000 + 28064 // orion_init
5 | 3 ColoredSwipe.dylib 0x0000000101132828 0x10112c000 + 26664 // init
The newest verison of orion does not support IOS 16.
In the IDE, next to the first line with "import Orion" on it, this shows:
Failed to build module 'Orion' from its module interface; the compiler that produced it, 'Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)', may have used features that aren't supported by this compiler, 'Apple Swift version 5.4 (swiftlang-1205.0.24.6 clang-1205.0.19.54)'
Upon building with make clean all messages=yes
, I get this: Orion does not support this version of Swift yet. Please check https://github.com/theos/Orion for progress updates. #error("""
(Thanks for reporting an issue! Please make sure you click the link above to view the issue guidelines, then fill out the blanks below.)
Tweak fails to compile
Tweak compiles successfully
https://ghostbin.co/paste/52w4
The same code compiles on macOS
Operating System:
Linux
Distro: Ubuntu 20.04
Kernel: 5.8.0-44-generic
Toolchain Version:
Swift 5.3.3 from https://swift.org/download/
CRKatri toolchain 5.3.2 from https://github.com/CRKatri/llvm-project/releases/tag/swift-5.3.2-RELEASE
SDK Version:
iOS 14.0
I get a linker error on the linking phase of the preference bundle.
The tweak compiling and linking, considering I didn't even write any code, just used the given code.
> Making all for tweak customcarrier…
> Making all in preferencesforcarrier…
> Making all for bundle PreferencesForCarrier…
==> Copying resource directories into the bundle wrapper…
==> Compiling Sources/PreferencesForCarrier/RootListController.swift (arm64)…
==> Linking bundle PreferencesForCarrier (arm64)…
ld: warning: Could not find or use auto-linked framework 'Preferences'
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_PSListController", referenced from:
type metadata for PreferencesForCarrier.RootListController in RootListController.swift.f4f34afd.o
"_OBJC_METACLASS_$_PSListController", referenced from:
_OBJC_METACLASS_$__TtC21PreferencesForCarrier18RootListController in RootListController.swift.f4f34afd.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[4]: *** [/Users/user/Developer/iOS/customcarrier/.theos/obj/debug/arm64/PreferencesForCarrier.bundle/PreferencesForCarrier] Error 1
make[3]: *** [/Users/user/Developer/iOS/customcarrier/.theos/obj/debug/arm64/PreferencesForCarrier.bundle/PreferencesForCarrier] Error 2
make[2]: *** [internal-bundle-all_] Error 2
make[1]: *** [PreferencesForCarrier.all.bundle.variables] Error 2
make: *** [internal-all] Error 2
Operating System: macOS Monterey 12.5.1
Toolchain Version: Xcode 13.4.1
SDK Version: I think the SDK Theos uses is iPhoneOS14.5.sdk
Build failed
Build the tweak
Making all for tweak swifttweakorion…
==> Building Swift support tools…
error: unable to invoke subcommand: /usr/bin/swift-build (No such file or directory)
Failed to build swift-support: command failed: SPM_THEOS_BUILD=1 swift build -c release --package-path /opt/theos/vendor/swift-support --build-path /opt/theos/vendor/swift-support/.theos_build
make[2]: *** [/opt/theos/makefiles/instance/rules.mk:197: internal-swifttweakorion-swift-support] Error 2
make[1]: *** [/opt/theos/makefiles/instance/rules.mk:62: before-swifttweakorion-all] Error 2
make: *** [/opt/theos/makefiles/master/rules.mk:163: swifttweakorion.all.tweak.variables] Error 2
Is it even possible to build a tweak on iOS?
Operating System: …
iOS 14.0.1
Toolchain Version: …
swift-toolchain 4.0.3-1
libswift4 4.2.1-2
SDK Version: …
While regular SPM projects that use Orion should work on any Apple platform, Theos in particular only supports iOS at the moment. It would be useful to support other platforms like macOS and the iOS simulator.
This will probably require building multiple copies of the framework and selecting the right one depending on the platform. Something similar will have to be figured out for the tweak_swift template's Package.swift as well – maybe a binaryTarget, or some modulemap trickery.
Question: is there a prebuilt Orion Preprocessor, I am using the latest commit on gh actions and the build time increased by 7 mins to build Orion Preprocessor, this didn’t happen on the Orion branch of Theos
When I create and deb and try install it via sideloady, I get an error saying : failed to prepare to inject dylibs, no data found in deb
I have tried hooking NSNotificationCenter
through
import Orion
class NSNotificationCenterHook: ClassHook<NSObject> {
static let targetName = "NSNotificationCenter"
func addObserver(_ observer: Any, selector aSelector: Selector, name aName: NSNotification.Name?, object anObject: Any?) {
NSLog("NSNOTIFHOOKTESTLOG")
orig.addObserver(observer, selector: aSelector, name: aName, object: anObject)
}
}
yet the hook always fails (no logs appear).
However, the code does not cause any crash.
One guess as to why this fails is because of the renaming of NSNotificationCenter
to NotificationCenter
. This is merely a guess.
Failure to install wrong iOS version
It fails to install
With Palera1n allowing iOS 17 to have JB it'd be awesome if this tweak were ported. A lot of things depend on it.
Why should the system version be greater than 12.2 and will not support lower versions?
Doesn’t create a rootless deb, just a normal deb
I am expecting it to create a rootless deb
Build fails with error: 'swift-support': Invalid manifest
No errors.
`make do
==> Notice: Build may be slow as Theos isn’t using all available CPU cores on this computer. Consider upgrading GNU Make: https://theos.dev/docs/parallel-building
==> Warning: Building for iOS 12.2, but the current toolchain can’t produce arm64e binaries for iOS earlier than 14.0. More information: https://theos.dev/docs/arm64e-deployment
Making all for tweak VLCTweak…
==> Building Swift support tools…
warning: '--build-path' option is deprecated; use '--scratch-path' instead
error: 'swift-support': Invalid manifest
:474:9: note: in file included from :474:
#import "hfs/hfs_format.h"
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/hfs/hfs_format.h:794:2: error: unknown type name 'uuid_string_t'; did you mean 'io_string_t'?
uuid_string_t ext_jnl_uuid;
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/device/device_types.h:89:33: note: 'io_string_t' declared here
typedef char io_string_t[512];
^
:474:9: note: in file included from :474:
#import "hfs/hfs_format.h"
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/hfs/hfs_format.h:796:20: error: use of undeclared identifier 'uuid_string_t'
char reserved[JIB_RESERVED_SIZE];
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/hfs/hfs_format.h:787:61: note: expanded from macro 'JIB_RESERVED_SIZE'
#define JIB_RESERVED_SIZE ((32*sizeof(u_int32_t)) - sizeof(uuid_string_t) - 48)
^
:482:9: note: in file included from :482:
#import "netinet6/ipcomp.h"
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/netinet6/ipcomp.h:40:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/netinet6/ipcomp.h:40:
#include <netinet6/ipsec.h>
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/netinet6/ipsec.h:141:2: error: unknown type name 'uuid_string_t'; did you mean 'io_string_t'?
uuid_string_t wake_uuid;
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/device/device_types.h:89:33: note: 'io_string_t' declared here
typedef char io_string_t[512];
^
:482:9: note: in file included from :482:
#import "netinet6/ipcomp.h"
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/netinet6/ipcomp.h:40:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/netinet6/ipcomp.h:40:
#include <netinet6/ipsec.h>
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/netinet6/ipsec.h:148:2: error: unknown type name 'uuid_string_t'; did you mean 'io_string_t'?
uuid_string_t wake_uuid;
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/device/device_types.h:89:33: note: 'io_string_t' declared here
typedef char io_string_t[512];
^
:0: error: could not build Objective-C module 'Darwin'
/Users/blackout/theos/vendor/swift-support/Package.swift:3:8: error: failed to build module 'PackageDescription' for importation due to the errors above; the textual interface may be broken by project issues or a compiler bug
import PackageDescription
^
Failed to build swift-support: command failed: SPM_THEOS_BUILD=1 swift build -c release --package-path /Users/blackout/theos/vendor/swift-support --build-path /Users/blackout/theos/vendor/swift-support/.theos_build
make[2]: *** [internal-VLCTweak-swift-support] Error 2
make[1]: *** [before-VLCTweak-all] Error 2
make: *** [VLCTweak.all.tweak.variables] Error 2`
Operating System: macOS 12.6.1
Toolchain Version: IDK
SDK Version: iPhoneOS16.2
class TAEDarkColorPaletteHook: ClassHook {
func backgroundColor() -> UIColor {
return ThemeStorage.shared.config.getActiveTheme().backgroundColor.uiColor
}
}
class MyHook: ClassHook<SomeClass> {
func function(arg: Any) {}
}
and
class MyHook: ClassHook<SomeClass> {
func function(arg: Any?) {}
}
both compile as expected.
However, if I do
class MyHook: ClassHook<SomeClass> {
func function(arg: Any!) {}
}
I receive the following errors:
error: using '!' is not allowed here; perhaps '?' was intended?
private static let orion_sel1 = #selector(function(arg:) as (Self) -> (Any!) -> Void)
error: using '!' is not allowed here; perhaps '?' was intended?
private static var orion_orig1: @convention(c) (Target, Selector, Any!) -> Void = { target, _cmd, arg1 in
error: using '!' is not allowed here; perhaps '?' was intended?
callSuper((@convention(c) (UnsafeRawPointer, Selector, Any!) -> Void).self) { $0($1, Self.orion_sel1, arg1) }
I do not believe this behavior is intended.
(Thanks for reporting an issue! Please make sure you click the link above to view the issue guidelines, then fill out the blanks below.)
Add this to your Tweak's Objective-C inside a method.
#if DEBUG
NSLog(@"This value should appear in the console")
#endif
Call the method in code.
Compile and install tweak with make do
The code between the#if DEBUG
is never executed.
The code to be executed since make do
builds as debug by default
None
DEBUG=1
to the makefile doesn't work.make DEBUG=1 do
doesn't work.#define DEBUG 1
does work for manual initialization but #define DEBUG 0
is not allowed.Operating System:
MacOS Big Sur
Orion 0.9.1
SDK Version:
iOS 14.4
Would be useful, especially for function hooking (unsure if ObjC hooking has any efficiency bonus, though, but C hooking certainly does). I tried to have a go at this, but it's rather complex from Swift to be able to actually use the batched functions.
The best way to do it would be to get all the needed symbols in one go with LHFindSymbols
, then hook everything in one go with LHHookFunctions
.
Hi, I am just wondering if there is a way to setup an Xcode project which contains a pure Swift Framework as a dependancy along with an Orion Tweak that can be compiled. Is there a way to do this? Thanks
Just a question, I use monkeydev for Xcode, will I be able to use orion?? if so how? as my entire project is made on Xcode (monkey dev)
@interface
, Dynamic
, etc.)handleError
, Theos troubleshooting, etc.)Document QoL features:
@available
handlingDocument directives:
disable
new
returns_retained
supr_tramp
im building against ios 14 and im injection my deb & orion 14 deb
class AppDelegate_Hook: ClassHook< UIApplicationDelegate> { func applicationDidBecomeActive(_ application: UIApplication) -> Target { let target = orig.applicationDidBecomeActive(application: application) return target } }
I get an exception when running the app
VM Region Info: 0 is not in any region. Bytes before following region: 4344643584
The hook to work
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Codes: 0x0000000000000001, 0x0000000000000000
VM Region Info: 0 is not in any region. Bytes before following region: 4340596736
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
--->
__TEXT 102b84000-106d14000 [ 65.6M] r-x/r-x SM=COW ...game.app/game
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [68713]
Triggered by Thread: 0
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 ??? 0x0 ???
1 Orion 0x10ecc31cc 0x10eca8000 + 111052
2 Orion 0x10ecc3094 0x10eca8000 + 110740
3 Orion 0x10ecaf1e8 0x10eca8000 + 29160
4 Orion 0x10ecb6aec 0x10eca8000 + 60140
5 lddmw2.dylib 0x10e90c5b8 0x10e904000 + 34232
6 dyld 0x1a7b937c4 invocation function for block in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 156
7 dyld 0x1a7bd8214 invocation function for block in dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 340
8 dyld 0x1a7bcb524 invocation function for block in dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const + 524
9 dyld 0x1a7b782d8 dyld3::MachOFile::forEachLoadCommand(Diagnostics&, void (load_command const*, bool&) block_pointer) const + 296
10 dyld 0x1a7bca548 dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const + 192
11 dyld 0x1a7bd7bf4 dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 516
12 dyld 0x1a7b9369c dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 176
13 dyld 0x1a7b93950 dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const + 216
14 dyld 0x1a7b9392c dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const + 180
15 dyld 0x1a7b93ae8 dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const + 328
16 dyld 0x1a7bb64b8 dyld4::APIs::runAllInitializersForMain() + 480
17 dyld 0x1a7b7cdd8 dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 3500
18 dyld 0x1a7b7bdc4 start + 2404
Operating System: Monterey
Toolchain Version: Newest
SDK Version: TARGET := iphone:clang:latest:14.0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.