有一个问题求解,我想在开启游戏后5秒后插件才生效。所以想在tweak.xm里加上NSTimer,得到一个模板如下。我的问题是,1,模板里的Cheats、start和apply分别指什么;2,/write stuff here里写哪些内容。谢谢
enter link description here
- 就是随便起的类名和函数名;
- 写tweak生效之后的功能代码
如果是随便写入的话,我直接复制图片上的代码,编译时应该不会报错啊,可实际情况是报错了
你懂iOS开发吗?编译报的错很明显了
肯定不懂嘛,只是想照葫芦画瓢,做个游戏辅助后,开启APP就闪退,然后考虑到游戏可能是在开启时候自动检测函数是否被修改,仅仅是开启时候检测。所以考虑能不能开启APP后几秒钟后辅助再发挥作用。这个报错我不是很懂,我理解为类目有问题。所以我问图片中的Cheats指的是哪个类
谢谢大神打击我
tweak
#import “writeData.h”
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#define PLIST_PATH @"/var/mobile/Library/Preferences/com.guoguo.shadowfight.plist"
inline bool GetPrefBool(NSString *key)
{
return [[[NSDictionary dictionaryWithContentsOfFile:PLIST_PATH] valueForKey:key] boolValue];
}
%ctor {
if(GetPrefBool(@“kcoins”))
{
writeData(0x889c38, 0xF0A08AE1);
} else {
writeData(0x889c38, 0xF0608AE1);
}
if(GetPrefBool(@“kGems”))
{
writeData(0x8817f8, 0xF0A08AE1);
} else {
writeData(0x8817f8, 0xF0408AE1);
}
if(GetPrefBool(@“khp”))
{
writeData(0x88231c, 0x389284E5);
} else {
writeData(0x88231c, 0x386284E5);
}
}
@interface applicationDidBecomeActive
- (void)start;
- (void)apply;
@end
@implementation applicationDidBecomeActive
-
(void)start {
[NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(apply) userInfo:nil repeats:NO];
} -
(void)apply {
}
attribute((constructor))
void Init() {
applicationDidBecomeActive *applicationDidBecomeActive = [applicationDidBecomeActive alloc];
[applicationDidBecomeActive start];
}
@end
现在画瓢还早了点,先把葫芦画清楚吧