Permalink
Browse files

Merge commit 'upstream/master'

Conflicts:
	food/classes.c
	food/myjni.c
  • Loading branch information...
2 parents 2b34836 + e72b524 commit bae183a2b3300d4a59294987843ae9d9ed465770 Geoff Norton committed Jul 10, 2010
@@ -9,16 +9,16 @@
#import <UIKit/UIKit.h>
#define IOSFC_BUILDING_IOSFC
#include "IOSurface.h"
-@class Server;
+@class FServer;
@interface FlashViewController : UIViewController {
IOSurfaceRef sfc;
CGImageRef oldContents;
int rpcfd;
- Server *server;
+ FServer *server;
CGDataProviderRef provider;
}
-@property (retain) Server *server;
+@property (retain) FServer *server;
- (void)useSurface:(IOSurfaceRef)sfc;
- (void)displaySyncInRect:(CGRect *)rect;
- (CGSize)movieSize;
@@ -32,7 +32,7 @@ - (void)loadView {
- (void)clicked:(id)sender {
[self.server teardown];
- self.server = [[[Server alloc] initWithDelegate:self] autorelease];
+ self.server = [[[FServer alloc] initWithDelegate:self] autorelease];
rpcfd = ((FlashView *)self.view).rpcfd = self.server.rpc_fd;
CGSize size = [self movieSize];
set_movie_size(rpcfd, size.width, size.height);
@@ -22,10 +22,10 @@
IOSurfaceRef sfc;
int rpcfd;
- Server *server;
+ FServer *server;
}
-@property (retain) Server *server;
+@property (retain) FServer *server;
- (void)useSurface:(IOSurfaceRef)sfc;
- (void)displaySyncInRect:(CGRect *)rect;
@@ -50,7 +50,7 @@ - (void)webPlugInStart {
if(!on) { started = YES; return; }
NSLog(@"webPlugInStart");
[self webPlugInStop];
- self.server = [[[Server alloc] initWithDelegate:self] autorelease];
+ self.server = [[[FServer alloc] initWithDelegate:self] autorelease];
rpcfd = self.server.rpc_fd;
[self setSizeIfNecessary];
}
@@ -96,7 +96,7 @@ - (id)initWithArguments:(NSDictionary *)arguments_ {
if(w && h) {
int w_ = [w intValue];
int h_ = [h intValue];
- self.frame = CGRectMake (self.frame.origin.x, self.frame.origin.y, [w floatValue], [h floatValue]);
+ //self.frame = CGRectMake (self.frame.origin.x, self.frame.origin.y, [w floatValue], [h floatValue]);
if(w_ < 30 || h_ < 30) {
on = YES;
return self;
@@ -114,6 +114,9 @@ - (id)initWithArguments:(NSDictionary *)arguments_ {
[initialButton addTarget:self action:@selector(initialDown) forControlEvents:UIControlEventTouchDown];
[initialButton addTarget:self action:@selector(initialUp) forControlEvents:UIControlEventTouchUpOutside];
[self addSubview:initialButton];
+ self.autoresizesSubviews = YES;
+ initialButton.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+
//self.contentMode = UIViewContentModeRedraw;
//self.backgroundColor = [UIColor grayColor];
}
@@ -123,12 +126,13 @@ - (id)initWithArguments:(NSDictionary *)arguments_ {
- (void)setFrame:(CGRect)frame {
[super setFrame:frame];
// For some reason, the frame is constantly fluctating to +/-1 height.
- oldFrame = frame;
- oldFrameValid = YES;
if(oldFrameValid && fabsf(frame.size.height - oldFrame.size.height) < 1.5
&& fabsf(frame.size.width - oldFrame.size.width) < 1.5) {
+ // NSLog(@"Ignoring frame changae to %fx%f", frame.size.width, frame.size.height);
return;
}
+ oldFrame = frame;
+ oldFrameValid = YES;
NSLog(@"Frame changed (now %fx%f)", frame.size.width, frame.size.height);
[self setSizeIfNecessary];
initialButton.frame = self.bounds;
View
@@ -1,7 +1,7 @@
#pragma once
#import <Foundation/Foundation.h>
-@interface Server : NSObject {
+@interface FServer : NSObject {
id delegate;
CFRunLoopSourceRef serv_source;
int serv_fd;
View
@@ -0,0 +1,9 @@
+include ../../env.mk
+Plugin.dylib: PluginFlashView.o server.o food_rpc2.o
+ $(GCC) -dynamiclib -o $@ $^ -framework CoreFoundation -framework Foundation -framework CoreGraphics -framework UIKit -framework IOSurface
+%.o: ../Classes/%.[cm]
+ $(GCC) -std=gnu99 -c -o $@ $< -I../Classes -I.. -Dstream_t=int
+%.o: ../%.[cm]
+ $(GCC) -std=gnu99 -c -o $@ $< -I../Classes -I.. -Dstream_t=int
+clean:
+ rm -f *.o Plugin.dylib
View
@@ -29,7 +29,7 @@
// C and Obj-C threading don't really play very well together.
static NSMutableDictionary *servers;
-static Server *get_server(int rpc_fd) {
+static FServer *get_server(int rpc_fd) {
return [servers objectForKey:[NSNumber numberWithInt:rpc_fd]];
}
/*@interface WebUndefined
@@ -112,12 +112,12 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection_ {
}
@end
-@implementation Server
+@implementation FServer
static void error(int rpc_fd, int err) {
- Server *self = get_server(rpc_fd);
+ FServer *self = get_server(rpc_fd);
NSString *str;
if(err == 0) {
str = [NSString stringWithFormat:@"Unexpected error"];
@@ -203,36 +203,36 @@ - (void)dealloc {
}
int set_sekrit(int rpc_fd, void *sekrit_, size_t sekrit_len) {
- Server *self = get_server(rpc_fd);
+ FServer *self = get_server(rpc_fd);
NSLog(@"sekrit: %s", sekrit_);
if(!self->sekrit) self->sekrit = sekrit_;
return 0;
}
int abort_msg(int rpc_fd, void *message, size_t message_len) {
- Server *self = get_server(rpc_fd);
+ FServer *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);
+ FServer *self = get_server(rpc_fd);
IOSurfaceRef sfc = IOSurfaceLookup(surface);
if(!sfc) return 1;
[self->delegate performSelector:@selector(useSurface:) withObject:(id)sfc];
return 0;
}
int display_sync(int rpc_fd, int l, int t, int r, int b) {
- Server *self = get_server(rpc_fd);
+ FServer *self = get_server(rpc_fd);
CGRect rect = CGRectMake(l, t, r-l, b-t);
[self->delegate performSelector:@selector(displaySyncInRect:) withObject:(id)&rect];
return 0;
}
int new_post_connection(int rpc_fd, stream_t stream, void *url, size_t url_len, void *target, size_t target_len, bool isfile, void *buf, size_t buf_len, void **url_abs, size_t *url_abs_len) {
- Server *self = get_server(rpc_fd);
+ FServer *self = get_server(rpc_fd);
NSString *str = [[[NSString alloc] initWithBytes:url length:url_len encoding:NSUTF8StringEncoding] autorelease];
NSURL *nsurl = [NSURL URLWithString:str relativeToURL:[self->delegate baseURL]];
@@ -257,7 +257,7 @@ int new_post_connection(int rpc_fd, stream_t stream, void *url, size_t url_len,
}
int new_get_connection(int rpc_fd, stream_t stream, void *url, size_t url_len, void *target, size_t target_len, void **url_abs, size_t *url_abs_len) {
- Server *self = get_server(rpc_fd);
+ FServer *self = get_server(rpc_fd);
NSString *str = [[[NSString alloc] initWithBytes:url length:url_len encoding:NSUTF8StringEncoding] autorelease];
NSURL *nsurl = [NSURL URLWithString:str relativeToURL:[self->delegate baseURL]];
if(target_len > 0) {
@@ -297,7 +297,7 @@ int new_get_connection(int rpc_fd, stream_t stream, void *url, size_t url_len, v
int get_parameters(int rpc_fd, void **params, size_t *params_len, int *params_count) {
NSLog(@"GET_PARAMETERS");
- Server *self = get_server(rpc_fd);
+ FServer *self = get_server(rpc_fd);
NSDictionary *dict = [self->delegate performSelector:@selector(paramsDict)];
*params_count = [dict count];
@@ -335,7 +335,7 @@ - (id)objectForName:(int)name {
}
int get_string_value(int rpc_fd, int obj, bool *valid, void **value, size_t *value_len) {
- Server *self = get_server(rpc_fd);
+ FServer *self = get_server(rpc_fd);
NSString *str = [self objectForName:obj];
NSLog(@"get_string_value %@", str);
if([str isKindOfClass:[NSString class]]) {
@@ -351,7 +351,7 @@ int get_string_value(int rpc_fd, int obj, bool *valid, void **value, size_t *val
}
int get_object_property(int rpc_fd, int obj, void *property, size_t property_len, int *obj2) {
- Server *self = get_server(rpc_fd);
+ FServer *self = get_server(rpc_fd);
if(![self->delegate performSelector:@selector(isOn)]) return 1;
NSString *str = [[NSString alloc] initWithBytes:property length:property_len encoding:NSUTF8StringEncoding];
id base = [self objectForName:obj];
@@ -364,20 +364,20 @@ int get_object_property(int rpc_fd, int obj, void *property, size_t property_len
}
int get_string_object(int rpc_fd, void *string, size_t string_len, int *obj2) {
- Server *self = get_server(rpc_fd);
+ FServer *self = get_server(rpc_fd);
*obj2 = [self nameForObject:[[[NSString alloc] initWithBytes:string length:string_len encoding:NSUTF8StringEncoding] autorelease]];
return 0;
}
int get_int_object(int rpc_fd, int theint, int *obj2) {
- Server *self = get_server(rpc_fd);
+ FServer *self = get_server(rpc_fd);
*obj2 = [self nameForObject:[NSNumber numberWithInt:theint]];
return 0;
}
int invoke_object_property(int rpc_fd, int obj, void *property, size_t property_len, void *args, size_t args_len, int *obj2) {
- Server *self = get_server(rpc_fd);
+ FServer *self = get_server(rpc_fd);
if(![self->delegate performSelector:@selector(isOn)]) return 1;
NSString *str = [[NSString alloc] initWithBytes:property length:property_len encoding:NSUTF8StringEncoding];
free(property);
@@ -405,7 +405,7 @@ int invoke_object_property(int rpc_fd, int obj, void *property, size_t property_
int get_window_object(int rpc_fd, int *obj) {
NSLog(@"Getting window object");
- Server *self = get_server(rpc_fd);
+ FServer *self = get_server(rpc_fd);
if(![self->delegate performSelector:@selector(isOn)]) return 1;
id windowObject = [self->delegate performSelector:@selector(getWindowObject)]; // windowScriptObject
*obj = [self nameForObject:windowObject];
@@ -414,7 +414,7 @@ int get_window_object(int rpc_fd, int *obj) {
}
int evaluate_web_script(int rpc_fd, void *script, size_t script_len, int *obj) {
- Server *self = get_server(rpc_fd);
+ FServer *self = get_server(rpc_fd);
NSString *str = [[NSString alloc] initWithBytes:script length:script_len encoding:NSUTF8StringEncoding];
id resultObject = [self->delegate performSelector:@selector(evaluateWebScript:) withObject:str];
*obj = [self nameForObject:resultObject];
View
11 env.mk
@@ -0,0 +1,11 @@
+ifeq "$(shell arch)" "arm"
+export IPHONE_GCC = 1
+SDK := /var/sdk
+XSTUFF := --sysroot $(SDK) -F$(SDK)/System/Library/Frameworks -F$(SDK)/System/Library/PrivateFrameworks
+GCC := gcc $(XSTUFF)
+GXX := g++ $(XSTUFF)
+else
+SDK := /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhone3.2.sdk/
+GCC := /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 --sysroot $(SDK) -arch armv7
+GXX := /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-4.2 --sysroot $(SDK) -arch armv7
+endif
View
@@ -1,21 +1,14 @@
-export SDK := /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.2.sdk/
+include ../env.mk
all: food food_wrapper
-STUFF = -mthumb -Wreturn-type -Wall -DHAVE_MACOSX_IPC -DOS_PATH_SEPARATOR="'/'" -DHAVE_PTHREADS -DHAVE_POSIX_FILEMAP -DHAVE_LITTLE_ENDIAN -I. -I../rpc -I../utils -I../utils/libcutils -isysroot $(SDK) -arch armv7 -ffixed-r9 -Wno-uninitialized -g3 -O2
-DEBUG = 1
-
-#ifeq "$(DEBUG)" "1"
-#STUFF += -g3
-#else
-#STUFF += -O2
-#endif
+STUFF = -mthumb -Wreturn-type -Wall -DHAVE_MACOSX_IPC -DOS_PATH_SEPARATOR="'/'" -DHAVE_PTHREADS -DHAVE_POSIX_FILEMAP -DHAVE_LITTLE_ENDIAN -I. -I../rpc -I../utils -I../utils/libcutils -ffixed-r9 -Wno-uninitialized -g3 -O2
%.o: %.cpp common.h ../rpc/food_rpc1.h
- g++-4.2 $(STUFF) -c -o $@ $<
+ $(GXX) $(STUFF) -c -o $@ $<
%.o: %.c common.h ../rpc/food_rpc1.h
- gcc-4.2 $(STUFF) -c -o $@ $<
+ $(GCC) $(STUFF) -c -o $@ $<
multistuff.c: multistuff.py
python multistuff.py
@@ -24,19 +17,28 @@ multistuff.settings.h: multistuff.py
python multistuff.py
myjni.o: myjni.c multistuff.settings.h
- gcc-4.2 $(STUFF) -c -o $@ $<
+ $(GCC) $(STUFF) -c -o $@ $<
+
+ifdef IPHONE_GCC
+# current iphone-gcc doesn't support NEON stuff. :(
+neon.o: neon.S
+ cp prebuilt-for-iphone-gcc/neon.o neon.o
+else
+neon.o: neon.S
+ $(GCC) $(STUFF) -c -o $@ $<
+endif
%.o: %.S
- gcc-4.2 $(STUFF) -c -o $@ $<
+ $(GCC) $(STUFF) -c -o $@ $<
-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
+OBJS := food.o np.o anp.o multistuff.o common.o myjni.o classes.o fixups/cfixups.o fixups/cppfixups.o fixups/rthread.o fixups/sfixups.o neon.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
+ $(GXX) $(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
+ $(GCC) $(STUFF) -o food_wrapper food_wrapper.c
clean:
rm -f *.o fixups/*.o food
View
@@ -1,9 +1,9 @@
#define ANDROID 1
#include <stdlib.h>
#define IOSFC_BUILDING_IOSFC
-#include <IOSurface/IOSurfaceAPI.h>
-#include <CoreGraphics/CoreGraphics.h>
#include <CoreFoundation/CoreFoundation.h>
+#include <IOSurface/IOSurface.h>
+#include <CoreGraphics/CoreGraphics.h>
#include <jni.h>
#include "npapi.h"
#include "android_npapi.h"
Oops, something went wrong.

0 comments on commit bae183a

Please sign in to comment.