Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

things

  • Loading branch information...
commit 399d16a1e64211fc37a2c4d81ca57bddafe1249e 1 parent 0cb24ad
@comex authored
View
0  control → DEBIAN/control
File renamed without changes
View
3  DEBIAN/postinst
@@ -0,0 +1,3 @@
+#!/bin/sh
+launchctl load /System/Library/LaunchDaemons/food.plist
+killall MobileSafari || true
View
3  DEBIAN/prerm
@@ -0,0 +1,3 @@
+#!/bin/sh
+launchctl unload /System/Library/LaunchDaemons/food.plist
+killall MobileSafari || true
View
3  Player2/Classes/PluginFlashView.m
@@ -123,7 +123,8 @@ - (void)displaySyncInRect:(CGRect *)rect {
CFRelease(data);
self.layer.contents = (id) image;
CFRelease(image);*/
- self.layer.opacity = self.layer.opacity == 1.000 ? 0.9999 : 1.000;
+ //self.layer.opacity = self.layer.opacity == 1.000 ? 0.9999 : 1.000;
+ [self.layer performSelector:@selector(setContentsChanged)];
/*if(rect->size.width) {
[self.layer setNeedsDisplayInRect:*rect];
} else {
View
15 Player2/server.m
@@ -95,7 +95,7 @@ - (void)connection:(NSURLConnection *)connection_ didFailWithError:(NSError *)er
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
- NSLog(@"connectionDidReceiveData");
+ //NSLog(@"connectionDidReceiveData");
connection_got_data(rpc_fd, stream, (void *) [data bytes], [data length]);
}
@@ -113,8 +113,10 @@ @implementation Server
static void error(int rpc_fd, int err) {
Server *self = get_server(rpc_fd);
NSString *str;
- if(err < 0) {
- str = [NSString stringWithFormat:@"Socket error: %s", strerror(-err)];
+ if(err == 0) {
+ str = [NSString stringWithFormat:@"Unexpected error"];
+ } else if(err < 0) {
+ str = [NSString stringWithFormat:@"Socket error: %s", strerror(-err)];
} else {
str = [NSString stringWithFormat:@"Internal error: %d", err];
}
@@ -201,6 +203,13 @@ int set_sekrit(int rpc_fd, void *sekrit_, size_t sekrit_len) {
return 0;
}
+int abort_msg(int rpc_fd, void *message, size_t message_len) {
+ Server *self = get_server(rpc_fd);
+ NSString *str = [[[NSString alloc] initWithBytes:message length:message_len encoding:NSUTF8StringEncoding] autorelease];
+ [self dieWithError:str];
+ return 0;
+}
+
int use_surface(int rpc_fd, int surface) {
Server *self = get_server(rpc_fd);
IOSurfaceRef sfc = IOSurfaceLookup(surface);
View
15 fakeinstall
@@ -0,0 +1,15 @@
+#!/bin/sh
+# run as root please
+set -e
+rm -rf iroot
+mkdir -p 'iroot/System/Library/Internet Plug-Ins'
+cp -a Frash.webplugin 'iroot/System/Library/Internet Plug-Ins/Frash.webplugin'
+cp -a Player2/build/Release-iphoneos/Plugin.dylib 'iroot/System/Library/Internet Plug-Ins/Frash.webplugin/'
+mkdir -p iroot/System/Library/LaunchDaemons
+cp food/food.plist iroot/System/Library/LaunchDaemons/
+mkdir -p iroot/var/mobile/frash
+cp -a food/food{,.sb,_wrapper} utils/lib{c,}utils.dylib icu/*.dylib libgcc/libgccstuff.dylib oem.cfg iroot/var/mobile/frash/
+chown -R 501 iroot/var/mobile
+cp -r DEBIAN iroot/DEBIAN
+chown -R 0 iroot/DEBIAN
+dpkg-deb -b iroot frash.deb
View
1  food/Makefile
@@ -33,6 +33,7 @@ myjni.o: myjni.c multistuff.settings.h
OBJS := food.o np.o anp.o neon.o multistuff.o common.o myjni.o classes.o fixups/cfixups.o fixups/cppfixups.o fixups/rthread.o fixups/sfixups.o
food: ../rpc/food_rpc1.h $(OBJS)
g++-4.2 $(STUFF) -o food $(OBJS) ../rpc/food_rpc1.o -F$(SDK)/System/Library/Frameworks -F$(SDK)/System/Library/PrivateFrameworks -framework CoreGraphics -framework IOSurface -framework CoreFoundation -framework CoreText -framework AudioToolbox -framework GraphicsServices -image_base 0x08000000
+ ldid -S food
food_wrapper: food_wrapper.c
gcc-4.2 $(STUFF) -o food_wrapper food_wrapper.c
View
3  food/TODO
@@ -1,5 +1,6 @@
+- pld
+- keyboard!
- invocation arguments
- make it think it's fullscreen or otherwise fix mouse
-- keyboard
- video?
- overzoom
View
6 food/anp.cpp
@@ -1144,9 +1144,13 @@ bool surface_impl_lock(JNIEnv* env, jobject surface, ANPBitmap* bitmap, ANPRectI
temp = calloc(1, IOSurfaceGetAllocSize(sfc));
//memset(temp, 0xff, IOSurfaceGetAllocSize(sfc));
temp_sz = IOSurfaceGetAllocSize(sfc);
- dirtyRect = NULL; // it is probably invalid
}
//log("dirtyRect=%p", dirtyRect);
+ // sanity, not security check, fwiw
+ if(dirtyRect && (dirtyRect->left >= (int)IOSurfaceGetWidth(sfc) || dirtyRect->top >= (int)IOSurfaceGetHeight(sfc) || dirtyRect->right >= (int)IOSurfaceGetWidth(sfc) || dirtyRect->bottom >= (int)IOSurfaceGetHeight(sfc))) {
+ dirtyRect = false;
+ }
+
if(dirtyRect) {
//log("%d,%d,%d,%d", dirtyRect->left, dirtyRect->top, dirtyRect->right, dirtyRect->bottom);
cur_dirty_valid = true;
View
27 food/common.c
@@ -201,24 +201,39 @@ void sandbox_me() {
free(sandbox);
}
+__attribute__((noreturn))
+static void do_abort(char *message) {
+ err("%s", message);
+ abort_msg(food, message, strlen(message)); // may or may not succeed
+ exit(1);
+}
void _assert_(bool test, const char *label, const char *file, int line, const char *func) {
if(!test) {
- err("Assertion failed: (%s), function %s, file %s, line %d.", label, func, file, line);
- exit(1);
+ char *x;
+ asprintf(&x, "Assertion failed: (%s), function %s, file %s, line %d.", label, func, file, line);
+ do_abort(x);
}
}
void _assertZero_(int test, const char *label, const char *file, int line, const char *func) {
if(test != 0) {
- err("Assertion failed: !(%s) [it was %d / 0x%x], function %s, file %s, line %d.", label, test, test, func, file, line);
- exit(1);
+ char *x;
+ asprintf(&x, "Assertion failed: !(%s) [it was %d / 0x%x], function %s, file %s, line %d.", label, test, test, func, file, line);
+ do_abort(x);
}
}
void _abort_(const char *file, int line) {
- err("_abort() %s:%d", file, line);
- exit(1);
+ char *x;
+ asprintf(&x, "_abort() %s:%d", file, line);
+ do_abort(x);
+}
+
+void _abortWithError_(const char *file, int line, const char *error) {
+ char *x;
+ asprintf(&x, "%s %s:%d", error, file, line);
+ do_abort(x);
}
#if TIMING
View
3  food/common.h
@@ -83,6 +83,9 @@ void sandbox_me();
__attribute__((noreturn))
void _abort_(const char *file, int line);
#define _abort() _abort_(__FILE__, __LINE__)
+__attribute__((noreturn))
+void _abortWithError_(const char *file, int line, const char *error);
+#define _abortWithError(error) _abortWithError_(__FILE__, __LINE__, error)
void _assert_(bool test, const char *label, const char *file, int line, const char *func);
void _assertZero_(int test, const char *label, const char *file, int line, const char *func);
View
BIN  food/food
Binary file not shown
View
3  food/food.sb
@@ -11,12 +11,15 @@
(allow ipc-posix-shm)
+(allow system-socket)
+
(allow file-read*
(regex #"/usr/lib(/|$)")
(regex #"/usr/share(/|$)")
(regex #"/System/Library/(Frameworks|Fonts)")
(regex #"/Library/Managed Preferences/mobile(/|$)")
(regex #"/private/var/Managed Preferences/mobile(/|$)")
+ (regex #"/private/var/mobile$")
(regex #"/private/var/mobile/Library/Preferences/\.GlobalPreferences\.plist")
(regex #"/var$")
(regex #"/var/stash.*icu[^/]*\.dat$")
View
3  food/np.c
@@ -378,6 +378,9 @@ int connection_got_data(int rpcfd, NPStream *stream, void *data, size_t data_len
static void even_later(CFRunLoopTimerRef, void *);
int connection_all_done(int rpcfd, NPStream *stream, bool successful) {
log("connection_all_done [%p]: successful=%d", stream, successful);
+ if(!successful) {
+ _abortWithError("The connection failed.");
+ }
NPReason reason = successful ? NPRES_DONE : NPRES_NETWORK_ERR;
int ret = pluginfuncs.destroystream(&nppt, stream, reason);
_assertZero(ret);
View
2  rpc/food.proto
@@ -1,6 +1,8 @@
# This must be first in the file
> async set_sekrit(buf sekrit);
+> sync abort_msg(buf message);
+
> async use_surface(int name);
> async display_sync(int l, int t, int r, int b);
> sync get_parameters(out buf params, out int params_count);
Please sign in to comment.
Something went wrong with that request. Please try again.