Permalink
Browse files

[atv2] - if users diddle XBMC into the toprow with plist manipulation…

… - prevent crash - but show our nice topshelf logo instead
  • Loading branch information...
1 parent 9487305 commit 76470c98128b76746a22ed579c04234d92ab219f @Memphiz Memphiz committed Feb 26, 2013
Showing with 25 additions and 0 deletions.
  1. +25 −0 xbmc/osx/atv2/XBMCAppliance.mm
View
25 xbmc/osx/atv2/XBMCAppliance.mm
@@ -72,6 +72,7 @@
@class XBMCAppliance;
@class BRTopShelfView;
@class XBMCApplianceInfo;
+@class BRMainMenuImageControl;
// SECTIONCOMMENT
// orig method handlers we wanna call in hooked methods
@@ -147,6 +148,7 @@ @interface XBMCTopShelfController : NSObject
}
- (void) selectCategoryWithIdentifier:(id)identifier;
- (id) topShelfView;
+- (id) mainMenuShelfView;
// added in 4.1+
- (void) refresh;
@end
@@ -176,6 +178,29 @@ - (BRTopShelfView *)topShelfView
return topShelf;
}
+// this method is called with the new ios ui (ios 5.1 and higher)
+// its similar to the topshelf view on the opd ios gui
+// but its more mighty (thats we we need to dig one level deeper here)
+// to get our loogo visible
+- (id) mainMenuShelfView;
+{
+ Class BRTopShelfViewCls = objc_getClass("BRTopShelfView");
+ Class BRImageCls = objc_getClass("BRImage");
+
+ id topShelf = [[BRTopShelfViewCls alloc] init];
+
+ // first hook into the mainMenuImageControl
+ // which is a wrapper for an image control
+ BRMainMenuImageControl *mainMenuImageControl = (BRMainMenuImageControl *)MSHookIvar<id>(topShelf, "_productImage");
+ // now get the image instance
+ BRImageControl *imageControl = (BRImageControl *)MSHookIvar<id>(mainMenuImageControl, "_content");// hook the image so we can diddle with it
+
+ // load our logo into it
+ BRImage *gpImage = [BRImageCls imageWithPath:[[NSBundle bundleForClass:[XBMCATV2Detector class]] pathForResource:@"XBMC" ofType:@"png"]];
+ [imageControl setImage:gpImage];
+ return topShelf;
+}
+
- (void) refresh
{
}

0 comments on commit 76470c9

Please sign in to comment.