diff --git a/Source/Core/CMakeLists.txt b/Source/Core/CMakeLists.txt index f89e15aede..640d653f24 100644 --- a/Source/Core/CMakeLists.txt +++ b/Source/Core/CMakeLists.txt @@ -5,7 +5,6 @@ add_subdirectory(Core) if(wxWidgets_FOUND) add_subdirectory(DebuggerUICommon) add_subdirectory(DebuggerWX) - add_subdirectory(InputUICommon) add_subdirectory(VideoUICommon) endif() diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index 4c66d5a60f..f167a741f2 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -16,6 +16,7 @@ // http://code.google.com/p/dolphin-emu/ #include +#include #include "Common.h" #include "IniFile.h" @@ -371,7 +372,6 @@ unsigned int Initialize() // Initialized g_real_wiimotes_initialized = true; - atexit(WiimoteReal::Shutdown); g_wiimotes_found = FindWiimotes(g_wiimotes, wanted_wiimotes); @@ -379,6 +379,7 @@ unsigned int Initialize() g_wiimotes_found, wanted_wiimotes); #ifndef _WIN32 + atexit(WiimoteReal::Shutdown); g_wiimotes_found = ConnectWiimotes(g_wiimotes); #endif diff --git a/Source/Core/DolphinWX/CMakeLists.txt b/Source/Core/DolphinWX/CMakeLists.txt index 1cefb2411a..84ef8c5abd 100644 --- a/Source/Core/DolphinWX/CMakeLists.txt +++ b/Source/Core/DolphinWX/CMakeLists.txt @@ -43,18 +43,17 @@ if(wxWidgets_FOUND) Src/UDPConfigDiag.cpp Src/WiimoteConfigDiag.cpp Src/MemoryCards/WiiSaveCrypted.cpp + Src/WXInputBase.cpp Src/WxUtils.cpp) set(WXLIBS debwx debugger_ui_util - inputuicommon ${wxWidgets_LIBRARIES} ${GTK2_LIBRARIES}) else(wxWidgets_FOUND) set(SRCS ${SRCS} - Src/MainNoGUI.cpp - Src/cmdline.c) + Src/MainNoGUI.cpp) endif() if(WIN32) diff --git a/Source/Core/DolphinWX/DolphinWX.vcproj b/Source/Core/DolphinWX/DolphinWX.vcproj index 5b4586b574..7c418eeae6 100644 --- a/Source/Core/DolphinWX/DolphinWX.vcproj +++ b/Source/Core/DolphinWX/DolphinWX.vcproj @@ -56,7 +56,7 @@ Optimization="3" InlineFunctionExpansion="0" FavorSizeOrSpeed="1" - AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\DebuggerWX\src;..\DebuggerUICommon\Src;..\InputUICommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\..\..\Externals\SFML\include;..\..\..\Externals\CLRun\include" + AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\DebuggerWX\src;..\DebuggerUICommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\..\..\Externals\SFML\include;..\..\..\Externals\CLRun\include" PreprocessorDefinitions="WIN32;__WXMSW__;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" StringPooling="false" RuntimeLibrary="0" @@ -175,7 +175,7 @@ EnableIntrinsicFunctions="true" FavorSizeOrSpeed="1" OmitFramePointers="false" - AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\DebuggerWX\src;..\DebuggerUICommon\Src;..\InputUICommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\..\..\Externals\SFML\include;..\..\..\Externals\CLRun\include" + AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\DebuggerWX\src;..\DebuggerUICommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\..\..\Externals\SFML\include;..\..\..\Externals\CLRun\include" PreprocessorDefinitions="WIN32;__WXMSW__;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" StringPooling="true" RuntimeLibrary="0" @@ -287,7 +287,7 @@ + + + + diff --git a/Source/Core/DolphinWX/Src/MainNoGUI.cpp b/Source/Core/DolphinWX/Src/MainNoGUI.cpp index add529c777..5b5a0a2503 100644 --- a/Source/Core/DolphinWX/Src/MainNoGUI.cpp +++ b/Source/Core/DolphinWX/Src/MainNoGUI.cpp @@ -257,87 +257,13 @@ void X11_MainLoop() } #endif +int main(int argc, char* argv[]) +{ #ifdef __APPLE__ - -int cocoaArgc; -char **cocoaArgv; -int appleMain(int argc, char *argv[]); - -@interface CocoaThread : NSObject -{ - NSThread *Thread; -} -- (void)cocoaThreadStart; -- (void)cocoaThreadRun: (id) sender; -@end - -@implementation CocoaThread -#define CocoaThreadHaveFinish @"CocoaThreadHaveFinish" -- (void)cocoaThreadStart -{ - [NSThread detachNewThreadSelector: @selector(cocoaThreadRun:) - toTarget: self withObject: nil]; -} - -- (void)cocoaThreadRun: (id) sender -{ - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - Thread = [NSThread currentThread]; - - appleMain(cocoaArgc, cocoaArgv); - - [pool release]; -} -@end - -int main(int argc, char *argv[]) -{ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSEvent *event = [[NSEvent alloc] init]; - CocoaThread *thread = [[CocoaThread alloc] init]; ProcessSerialNumber psn; - - cocoaArgc = argc; - cocoaArgv = argv; - - GetCurrentProcess(&psn); - TransformProcessType(&psn, kProcessTransformToForegroundApplication); - SetFrontProcess(&psn); - - if (NSApp == nil) { - [NSApplication sharedApplication]; - //TODO : Create menu - [NSApp finishLaunching]; - } - - [thread cocoaThreadStart]; - - while (1) - { - event = [NSApp nextEventMatchingMask: NSKeyDownMask - untilDate: [NSDate distantFuture] - inMode: NSDefaultRunLoopMode dequeue: YES]; - - if (([event modifierFlags] & NSCommandKeyMask) == 0) - continue; - - if ([[event characters] UTF8String][0] == 'q') { - Core::Stop(); - break; - } else - [NSApp sendEvent: event]; - } - - [event release]; - [thread release]; - [pool release]; -} - -int appleMain(int argc, char *argv[]) -#else -int main(int argc, char* argv[]) #endif -{ int ch, help = 0; struct option longopts[] = { { "exec", no_argument, NULL, 'e' }, @@ -380,7 +306,38 @@ int main(int argc, char* argv[]) // No use running the loop when booting fails if (BootManager::BootCore(argv[optind])) { -#if defined HAVE_X11 && HAVE_X11 +#ifdef __APPLE__ + GetCurrentProcess(&psn); + TransformProcessType(&psn, kProcessTransformToForegroundApplication); + SetFrontProcess(&psn); + + if (NSApp == nil) { + [NSApplication sharedApplication]; + //TODO : Create menu + [NSApp finishLaunching]; + } + + while (running) + { + event = [NSApp nextEventMatchingMask: NSAnyEventMask + untilDate: [NSDate distantFuture] + inMode: NSDefaultRunLoopMode dequeue: YES]; + + if ([event type] == NSKeyDown && + [event modifierFlags] & NSCommandKeyMask && + [[event characters] UTF8String][0] == 'q') + { + Core::Stop(); + break; + } + + if ([event type] != NSKeyDown) + [NSApp sendEvent: event]; + } + + [event release]; + [pool release]; +#elif defined HAVE_X11 && HAVE_X11 XInitThreads(); X11_MainLoop(); #else