mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-09 15:49:25 +01:00
Move NSAutoreleasePool handling into the proper entry/exit points
for the real wiimote thread as for the other threads. Turns out we use OS X bluetooth API's that were introduced in 10.5.4. Remove vestiges of previously removed wiiuse_set_bluetooth_stack(). XXX We should probably have a Common equivalent of htonl and friends. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6531 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
5910ef259c
commit
4934cd29b3
@ -117,7 +117,7 @@ rev = utils.GenerateRevFile(env['flavor'], '.', None)
|
||||
|
||||
# OS X specifics
|
||||
if sys.platform == 'darwin':
|
||||
ccld = ['-arch', 'x86_64', '-arch', 'i386', '-mmacosx-version-min=10.5']
|
||||
ccld = ['-arch', 'x86_64', '-arch', 'i386', '-mmacosx-version-min=10.5.4']
|
||||
ccld += ['--sysroot=/Developer/SDKs/MacOSX10.5.sdk']
|
||||
system = '/System/Library/Frameworks'
|
||||
env['CCFLAGS'] += ccld
|
||||
|
@ -36,6 +36,10 @@
|
||||
#pragma comment(lib, "Bthprops.lib")
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#import <Foundation/NSAutoreleasePool.h>
|
||||
#endif
|
||||
|
||||
unsigned int g_wiimote_sources[MAX_WIIMOTES];
|
||||
|
||||
namespace WiimoteReal
|
||||
@ -468,6 +472,10 @@ void StopWiimoteThreads()
|
||||
|
||||
THREAD_RETURN WiimoteThreadFunc(void* arg)
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
#endif
|
||||
|
||||
Wiimote* const wiimote = (Wiimote*)arg;
|
||||
|
||||
{
|
||||
@ -492,6 +500,9 @@ THREAD_RETURN WiimoteThreadFunc(void* arg)
|
||||
Common::SleepCurrentThread(1);
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
[pool release];
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -84,8 +84,8 @@ elif sys.platform == 'darwin' and env['HAVE_WX']:
|
||||
CFBundlePackageType = 'APPL',
|
||||
CFBundleShortVersionString =
|
||||
utils.GenerateRevFile('', Dir('#None').abspath, None),
|
||||
CFBundleVersion = '2.0',
|
||||
LSMinimumSystemVersion = '10.5.0',
|
||||
CFBundleVersion = '3.0',
|
||||
LSMinimumSystemVersion = '10.5.4',
|
||||
LSRequiresCarbon = True,
|
||||
)))
|
||||
else:
|
||||
|
@ -34,10 +34,7 @@
|
||||
#import <CoreServices/CoreServices.h>
|
||||
extern "C" OSErr UpdateSystemActivity(UInt8 activity);
|
||||
#define BLUETOOTH_VERSION_USE_CURRENT
|
||||
#import <IOBluetooth/objc/IOBluetoothDevice.h>
|
||||
#import <IOBluetooth/objc/IOBluetoothDeviceInquiry.h>
|
||||
#import <IOBluetooth/objc/IOBluetoothHostController.h>
|
||||
#import <IOBluetooth/objc/IOBluetoothL2CAPChannel.h>
|
||||
#import <IOBluetooth/IOBluetooth.h>
|
||||
|
||||
#include "Common.h"
|
||||
#include "wiiuse_internal.h"
|
||||
@ -116,7 +113,7 @@ volatile int reader, writer, outstanding, watermark;
|
||||
|
||||
CFRunLoopStop(CFRunLoopGetCurrent());
|
||||
|
||||
UpdateSystemActivity(1);
|
||||
(void)UpdateSystemActivity(1);
|
||||
}
|
||||
|
||||
- (void) l2capChannelClosed: (IOBluetoothL2CAPChannel *) l2capChannel
|
||||
@ -151,7 +148,6 @@ volatile int reader, writer, outstanding, watermark;
|
||||
*/
|
||||
int wiiuse_find(struct wiimote_t **wm, int max_wiimotes, int timeout)
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
IOBluetoothHostController *bth;
|
||||
IOBluetoothDeviceInquiry *bti;
|
||||
SearchBT *sbt;
|
||||
@ -199,7 +195,6 @@ int wiiuse_find(struct wiimote_t **wm, int max_wiimotes, int timeout)
|
||||
[bth release];
|
||||
[bti release];
|
||||
[sbt release];
|
||||
[pool release];
|
||||
|
||||
return found_devices;
|
||||
}
|
||||
@ -247,7 +242,6 @@ int wiiuse_connect(struct wiimote_t **wm, int wiimotes)
|
||||
*/
|
||||
static int wiiuse_connect_single(struct wiimote_t *wm, char *address)
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
ConnectBT *cbt = [[ConnectBT alloc] init];
|
||||
|
||||
if (wm == NULL || WIIMOTE_IS_CONNECTED(wm))
|
||||
@ -268,7 +262,6 @@ static int wiiuse_connect_single(struct wiimote_t *wm, char *address)
|
||||
wiiuse_set_report_type(wm);
|
||||
|
||||
[cbt release];
|
||||
[pool release];
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -284,8 +277,6 @@ static int wiiuse_connect_single(struct wiimote_t *wm, char *address)
|
||||
*/
|
||||
void wiiuse_disconnect(struct wiimote_t *wm)
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
if (wm == NULL)
|
||||
return;
|
||||
|
||||
@ -297,7 +288,6 @@ void wiiuse_disconnect(struct wiimote_t *wm)
|
||||
[cchan closeChannel];
|
||||
[ichan closeChannel];
|
||||
[btd closeConnection];
|
||||
[pool release];
|
||||
}
|
||||
|
||||
int wiiuse_io_read(struct wiimote_t *wm)
|
||||
|
@ -300,7 +300,11 @@ int wiiuse_write_data(struct wiimote_t* wm, unsigned int addr, byte* data, byte
|
||||
#endif
|
||||
|
||||
/* the offset is in big endian */
|
||||
*(int*)(buf) = Common::swap32(addr); /* XXX only if little-endian */
|
||||
#ifdef __BIG_ENDIAN__
|
||||
*(int*)(buf) = addr;
|
||||
#else
|
||||
*(int*)(buf) = Common::swap32(addr);
|
||||
#endif
|
||||
|
||||
/* length */
|
||||
*(byte*)(buf + 4) = len;
|
||||
@ -366,26 +370,6 @@ int wiiuse_send(struct wiimote_t* wm, byte report_type, byte* msg, int len) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Set the bluetooth stack type to use.
|
||||
*
|
||||
* @param wm Array of wiimote_t structures.
|
||||
* @param wiimotes Number of objects in the wm array.
|
||||
* @param type The type of bluetooth stack to use.
|
||||
*/
|
||||
void wiiuse_set_bluetooth_stack(struct wiimote_t** wm, int wiimotes, enum win_bt_stack_t type) {
|
||||
#ifdef _WIN32
|
||||
int i;
|
||||
|
||||
if (!wm) return;
|
||||
|
||||
for (i = 0; i < wiimotes; ++i)
|
||||
wm[i]->stack = type;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the normal and expansion handshake timeouts.
|
||||
*
|
||||
|
@ -42,9 +42,7 @@
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#elif defined(__APPLE__)
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <IOBluetooth/IOBluetoothUserLib.h>
|
||||
#include <string.h>
|
||||
#import <IOBluetooth/IOBluetooth.h>
|
||||
#elif defined(__linux__)
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
@ -154,16 +152,17 @@ typedef struct wiimote_t {
|
||||
WCONST int unid; /**< user specified id */
|
||||
|
||||
#if defined(__APPLE__)
|
||||
WCONST IOBluetoothDeviceRef *device;
|
||||
WCONST char bdaddr_str[18];
|
||||
WCONST IOBluetoothDevice *btd;
|
||||
WCONST IOBluetoothL2CAPChannel *ichan;
|
||||
WCONST IOBluetoothL2CAPChannel *cchan;
|
||||
#elif defined(__linux__) && HAVE_BLUEZ
|
||||
WCONST bdaddr_t bdaddr; /**< bt address (linux) */
|
||||
WCONST char bdaddr_str[18]; /**< readable bt address */
|
||||
WCONST int out_sock; /**< output socket */
|
||||
WCONST int in_sock; /**< input socket */
|
||||
#elif defined(_WIN32)
|
||||
WCONST char devicepath[255]; /**< unique wiimote reference */
|
||||
//WCONST ULONGLONG btaddr; /**< bt address (windows) */
|
||||
WCONST char devicepath[255]; /**< unique wiimote reference */
|
||||
//WCONST ULONGLONG btaddr; /**< bt address (windows) */
|
||||
WCONST HANDLE dev_handle; /**< HID handle */
|
||||
WCONST OVERLAPPED hid_overlap; /**< overlap handle */
|
||||
WCONST enum win_bt_stack_t stack; /**< type of bluetooth stack to use */
|
||||
|
Loading…
x
Reference in New Issue
Block a user