+MSInstanceMessage2(UIImageTableArtwork *, UIImageTableArtwork, initWithName,inBundle, NSString *, name, NSBundle *, bundle) {
+ if ((self = MSOldCall(name, bundle)) != nil) {
+ $objc_setAssociatedObject(self, @selector(wb$bundle), bundle, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+ } return self;
+}
+
+MSInstanceMessage2(UIImage *, UIImageTableArtwork, imageNamed,device, NSString *, name, int, device) {
+ NSBundle *bundle($objc_getAssociatedObject(self, @selector(wb$bundle)));
+ if (Debug_)
+ NSLog(@"WB:Debug:[UIImageTableArtwork[%@] imageNamed:\"%@\" device:%i]", bundle, name, device);
+ if (bundle == nil)
+ return MSOldCall(name, device);
+ UIImage *image = [UIImages_ objectForKey:name];
+ if (image != nil)
+ return reinterpret_cast<id>(image) == [NSNull null] ? MSOldCall(name, device) : image;
+ if (NSString *path = $pathForFile$inBundle$(name, bundle, true, true))
+ image = $getImage$(path);
+ [UIImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:name];
+ if (image != nil)
+ return image;
+
+ image = MSOldCall(name, device);
+
+ if (UIDebug_) {
+ NSString *path([@"/tmp/UIImages/" stringByAppendingString:name]);
+ if (![Manager_ fileExistsAtPath:path])
+ [UIImagePNGRepresentation(image) writeToFile:path atomically:YES];
+ }
+
+ return image;
+}
+