forked from ObscureMosquito/MapsX
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathshields.x
More file actions
141 lines (109 loc) · 4.92 KB
/
Copy pathshields.x
File metadata and controls
141 lines (109 loc) · 4.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#import <Foundation/Foundation.h>
#import <malloc/malloc.h>
#import <substrate.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import "GEOShieldMappingManager.h"
typedef struct PointsStruct {
unsigned x;
unsigned y;
} PointsStruct;
typedef struct {
int list;
unsigned count;
unsigned size;
} SCD_Struct_VK106;
typedef struct {
CGPoint origin;
CGPoint size;
} SCD_Struct_VK63;
@interface VKPShieldIndex : NSObject
-(id)entries;
@end
@interface VKShieldAtlas : NSObject
@end
static void ReachabilityCallback(SCNetworkReachabilityRef target,
SCNetworkReachabilityFlags flags,
void *info) {
BOOL reachable = (flags & kSCNetworkReachabilityFlagsReachable) &&
!(flags & kSCNetworkReachabilityFlagsConnectionRequired);
if (reachable) {
[GEOShieldMappingManager cacheToFile];
}
}
static SCNetworkReachabilityRef reachabilityRef;
%hook GEOResourceManifestServer
-(void)init {
reachabilityRef = SCNetworkReachabilityCreateWithName(NULL, "www.apple.com");
SCNetworkReachabilityContext context = {0, NULL, NULL, NULL, NULL};
SCNetworkReachabilitySetCallback(reachabilityRef, ReachabilityCallback, &context);
SCNetworkReachabilityScheduleWithRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
%orig;
}
%end
// %hook VKPShieldIndex
// -(NSString*)artworkIdentifierForShieldType:(int)shieldType
// {
// // return %orig(8420);
// id orig = %orig;
// if (!orig) {
// NSLog(@"sdid(%i)", shieldType);
// }
// return orig;
// }
// %end
%hook VKShieldManager
-(id)init {
[GEOShieldMappingManager initForUse];
return %orig;
}
-(id)artworkForShieldType:(int)shieldType textLength:(unsigned)textLen contentScale:(float)contentScale resourceNames:(id)resourceNames style:(id)style mode:(int)mode numberOfLines:(unsigned)numOfLines {
int newShieldID = [[GEOShieldMappingManager sharedManager] translateShieldMap:shieldType];
if (newShieldID == 0) return %orig();
return %orig(newShieldID, textLen, contentScale, resourceNames, style, mode, numOfLines);
}
-(id)artworkForShieldType:(int)shieldType textLength:(unsigned)textLen contentScale:(float)contentScale resourceNames:(id)resourceNames style:(id)style mode:(int)mode {
int newShieldID = [[GEOShieldMappingManager sharedManager] translateShieldMap:shieldType];
if (newShieldID == 0) return %orig();
return %orig(newShieldID, textLen, contentScale, resourceNames, style, mode);
}
/// iOS 7
-(id)artworkForShieldType:(int)shieldType textLength:(unsigned long long)textLen contentScale:(double)contentScale resourceNames:(id)resourceNames style:(id)style size:(long long)size idiom:(long long)idiom numberOfLines:(unsigned long long)numberOfLines {
int newShieldID = [[GEOShieldMappingManager sharedManager] translateShieldMap:shieldType];
if (newShieldID == 0) return %orig();
return %orig(newShieldID, textLen, contentScale, resourceNames, style, size, idiom, numberOfLines);
}
-(id)artworkForShieldType:(int)shieldType textLength:(unsigned long long)textLen contentScale:(double)contentScale size:(long long)size idiom:(long long)idiom mapRect:(SCD_Struct_VK63)mapRect {
int newShieldID = [[GEOShieldMappingManager sharedManager] translateShieldMap:shieldType];
if (newShieldID == 0) return %orig();
return %orig(newShieldID, textLen, contentScale, size, idiom, mapRect);
}
-(id)artworkForShieldType:(int)shieldType textLength:(unsigned long long)textLen contentScale:(double)contentScale size:(long long)size idiom:(long long)idiom {
int newShieldID = [[GEOShieldMappingManager sharedManager] translateShieldMap:shieldType];
if (newShieldID == 0) return %orig();
return %orig(newShieldID, textLen, contentScale, size, idiom);
}
%end
%hook VKIconManager
-(id)iconForFeatureID:(uint64_t)featureId withResourceNames:(id)resourceNames style:(void*)style {
int newIconID = [[GEOShieldMappingManager sharedManager] translateIconMap:featureId];
if (newIconID == 0) {
// NSLog(@"icid(%llu)", featureId);
return %orig();
}
return %orig(newIconID, resourceNames, style);
}
/// iOS 7
-(id)artworkForFeatureID:(uint64_t)featureId withResourceNames:(id)resourceNames style:(void*)style contentScale:(double)contentScale {
int newIconID = [[GEOShieldMappingManager sharedManager] translateIconMap:featureId];
if (newIconID == 0) {
NSLog(@"icid(%llu)", featureId);
return %orig();
}
return %orig(newIconID, resourceNames, style, contentScale);
}
// -(id)artworkForShieldType:(int)shieldType textLength:(unsigned)textLen contentScale:(float)contentScale resourceNames:(id)resourceNames style:(id)style mode:(int)mode {
// int newShieldID = [[GEOShieldMappingManager sharedManager] translateShieldMap:shieldType];
// if (newShieldID == 0) return %orig();
// return %orig(newShieldID, textLen, contentScale, resourceNames, style, mode);
// }
%end