Comments (2)
%init;
or %init();
with no group name implies initialising _ungrouped
. Groups can’t override each other — actually you can have a hook for the same method in multiple groups and they will be applied in the order you init them. Nothing is overridden on Logos’ level; it’s just allowing you to control exactly where in the program Logos places the calls to Substrate to create the hooks.
Running Logos directly or checking for the processed Logos output under .theos/obj/arm64/Tweak.x.m
might help you to understand what exactly Logos is doing and if it might be an issue on our side. See my example below.
Logos input
%hook Thing
- (id)description { returm @"Thing"; }
- (NSInteger)florps { return 5; }
%end
%group MyGroup
%hook Thing
- (id)description { return [%orig stringByAppendingString:@" (of doom)"]; }
- (id)anotherThing { return nil; }
%end
%end
BOOL something = YES;
%ctor {
%init;
if (something) {
%init(MyGroup);
}
}
Logos output
(Simplified for readability)#include <substrate.h>
@class Thing;
static id (*_logos_orig$_ungrouped$Thing$description)(_LOGOS_SELF_TYPE_NORMAL Thing* _LOGOS_SELF_CONST, SEL);
static id _logos_method$_ungrouped$Thing$description(_LOGOS_SELF_TYPE_NORMAL Thing* _LOGOS_SELF_CONST, SEL);
static NSInteger (*_logos_orig$_ungrouped$Thing$florps)(_LOGOS_SELF_TYPE_NORMAL Thing* _LOGOS_SELF_CONST, SEL);
static NSInteger _logos_method$_ungrouped$Thing$florps(_LOGOS_SELF_TYPE_NORMAL Thing* _LOGOS_SELF_CONST, SEL);
static id _logos_method$_ungrouped$Thing$description(_LOGOS_SELF_TYPE_NORMAL Thing* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd) { returm @"Thing"; }
static NSInteger _logos_method$_ungrouped$Thing$florps(_LOGOS_SELF_TYPE_NORMAL Thing* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd) { return 5; }
static id (*_logos_orig$MyGroup$Thing$description)(_LOGOS_SELF_TYPE_NORMAL Thing* _LOGOS_SELF_CONST, SEL);
static id _logos_method$MyGroup$Thing$description(_LOGOS_SELF_TYPE_NORMAL Thing* _LOGOS_SELF_CONST, SEL);
static id (*_logos_orig$MyGroup$Thing$anotherThing)(_LOGOS_SELF_TYPE_NORMAL Thing* _LOGOS_SELF_CONST, SEL);
static id _logos_method$MyGroup$Thing$anotherThing(_LOGOS_SELF_TYPE_NORMAL Thing* _LOGOS_SELF_CONST, SEL);
static id _logos_method$MyGroup$Thing$description(_LOGOS_SELF_TYPE_NORMAL Thing* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd) { return [_logos_orig$MyGroup$Thing$description(self, _cmd) stringByAppendingString:@" (of doom)"]; }
static id _logos_method$MyGroup$Thing$anotherThing(_LOGOS_SELF_TYPE_NORMAL Thing* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd) { return nil; }
BOOL something = YES;
static __attribute__((constructor)) void _logosLocalCtor_36cf86a9(int __unused argc, char __unused **argv, char __unused **envp) {
{
Class _logos_class$_ungrouped$Thing = objc_getClass("Thing");
MSHookMessageEx(_logos_class$_ungrouped$Thing, @selector(description), (IMP)&_logos_method$_ungrouped$Thing$description, (IMP*)&_logos_orig$_ungrouped$Thing$description);
MSHookMessageEx(_logos_class$_ungrouped$Thing, @selector(florps), (IMP)&_logos_method$_ungrouped$Thing$florps, (IMP*)&_logos_orig$_ungrouped$Thing$florps);
}
if (something) {
{
Class _logos_class$MyGroup$Thing = objc_getClass("Thing");
MSHookMessageEx(_logos_class$MyGroup$Thing, @selector(description), (IMP)&_logos_method$MyGroup$Thing$description, (IMP*)&_logos_orig$MyGroup$Thing$description);
MSHookMessageEx(_logos_class$MyGroup$Thing, @selector(anotherThing), (IMP)&_logos_method$MyGroup$Thing$anotherThing, (IMP*)&_logos_orig$MyGroup$Thing$anotherThing);
}
}
}
from logos.
Hi @kirb, thanks for answering! It turned out that one of my MSHookMessageEx crashed, so it seems the init is overwritten. Deleting the crash code will work like you said.
btw, in my path .theos/obj/debug/arm64
, I didn't see a Tweak.x.m like yours, just Tweak.xm.f4523a75.Td
and Tweak.xm.f4523a75.o
. Did I miss anything? Thank you.
I think this thread can be closed then
from logos.
Related Issues (20)
- Nullability specifiers not supported in %subclass methods
- Cannot find module ' ./logo.svg' or its corresponding type declarations. HOT 2
- Logos failes to hook NSBundle.bundleIdentifier on iOS 16 HOT 2
- Mixing `}` with `'` results in a false positive missing closure [Beeper] HOT 1
- Request: dot in class name support for %c HOT 4
- `super` in %subclass is dodgy HOT 1
- Nullability specifiers not supported in %property HOT 3
- Add [super ...] calls
- Logos compilation error if multiline comment has //
- Regression in %hookf HOT 4
- Issue when using %property to add NSMutableArray with specified item type HOT 2
- %property crashes when no parameters set HOT 8
- Line comments are incorrectly handled within block comments HOT 2
- Logos produces bad output without newline after imports HOT 1
- %config(generator=Internal) does not work but using `internal` does HOT 1
- [logos] preprocess could not handle comment outed braces correctly. HOT 2
- [Bug]: space/newline in %init causes issues HOT 1
- iOSOpenDev compiles with logos.pl in Xcode 14.1 RC2 with numerous deprecation warnings HOT 2
- Logos fails to parse code with curly braces inside of character literals
- Logos ignores end of block comment if line contains a `//` before block comment terminator HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from logos.