diff --git a/desmume/src/cocoa/cocoa_util.h b/desmume/src/cocoa/cocoa_util.h index 30c3a71a2..7aa26912f 100644 --- a/desmume/src/cocoa/cocoa_util.h +++ b/desmume/src/cocoa/cocoa_util.h @@ -29,6 +29,7 @@ } + (void) messageSendOneWay:(NSPort *)sendPort msgID:(NSInteger)msgID; ++ (void) messageSendOneWayWithMessageComponents:(NSPort *)sendPort msgID:(NSInteger)msgID array:(NSArray *)msgDataArray; + (void) messageSendOneWayWithData:(NSPort *)sendPort msgID:(NSInteger)msgID data:(NSData *)msgData; + (void) messageSendOneWayWithInteger:(NSPort *)sendPort msgID:(NSInteger)msgID integerValue:(NSInteger)integerValue; + (void) messageSendOneWayWithFloat:(NSPort *)sendPort msgID:(NSInteger)msgID floatValue:(float)floatValue; diff --git a/desmume/src/cocoa/cocoa_util.mm b/desmume/src/cocoa/cocoa_util.mm index 7e37dc79d..44a28c029 100644 --- a/desmume/src/cocoa/cocoa_util.mm +++ b/desmume/src/cocoa/cocoa_util.mm @@ -37,18 +37,23 @@ static NSDate *distantFutureDate = [[NSDate distantFuture] retain]; [message release]; } -+ (void) messageSendOneWayWithData:(NSPort *)sendPort msgID:(NSInteger)msgID data:(NSData *)msgData ++ (void) messageSendOneWayWithMessageComponents:(NSPort *)sendPort msgID:(NSInteger)msgID array:(NSArray *)msgDataArray { - NSArray *messageComponents = [[NSArray alloc] initWithObjects:msgData, nil]; - NSPortMessage *message = [[NSPortMessage alloc] initWithSendPort:sendPort receivePort:nil components:messageComponents]; + NSPortMessage *message = [[NSPortMessage alloc] initWithSendPort:sendPort receivePort:nil components:msgDataArray]; [message setMsgid:msgID]; NSDate *sendDate = [[NSDate alloc] init]; [message sendBeforeDate:distantFutureDate]; [sendDate release]; - [messageComponents release]; [message release]; } ++ (void) messageSendOneWayWithData:(NSPort *)sendPort msgID:(NSInteger)msgID data:(NSData *)msgData +{ + NSArray *messageComponents = [[NSArray alloc] initWithObjects:msgData, nil]; + [CocoaDSUtil messageSendOneWayWithMessageComponents:sendPort msgID:msgID array:messageComponents]; + [messageComponents release]; +} + + (void) messageSendOneWayWithInteger:(NSPort *)sendPort msgID:(NSInteger)msgID integerValue:(NSInteger)integerValue { NSData *messageData = [[NSData alloc] initWithBytes:&integerValue length:sizeof(NSInteger)];