summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorSoren Jorvang <soren.jorvang@gmail.com>2011-01-15 11:05:22 +0000
committerSoren Jorvang <soren.jorvang@gmail.com>2011-01-15 11:05:22 +0000
commit85db30554efef4a2783d1d6193cedfd385ef57d0 (patch)
treee43c1d432ebd0bf4302536b08499fd128f6dc2ed /Source/Core
parente429d75489b959e13fd7d15f0c9a30122e56a9fd (diff)
Don't bother with a separate NSApplication thread.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6853 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/CMakeLists.txt1
-rw-r--r--Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp3
-rw-r--r--Source/Core/DolphinWX/CMakeLists.txt5
-rw-r--r--Source/Core/DolphinWX/DolphinWX.vcproj20
-rw-r--r--Source/Core/DolphinWX/Src/MainNoGUI.cpp111
5 files changed, 52 insertions, 88 deletions
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 <queue>
+#include <stdlib.h>
#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 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- 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;_DEBUG;__WXMSW__;__WXDEBUG__;_WINDOWS;NOPCH;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -398,7 +398,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- 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;_DEBUG;__WXMSW__;__WXDEBUG__;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -511,7 +511,7 @@
Optimization="2"
InlineFunctionExpansion="1"
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="DEBUGFAST;WIN32;__WXMSW__;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
StringPooling="true"
RuntimeLibrary="0"
@@ -627,7 +627,7 @@
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
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="DEBUGFAST;WIN32;__WXMSW__;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS"
StringPooling="true"
RuntimeLibrary="0"
@@ -1232,6 +1232,14 @@
>
</File>
<File
+ RelativePath=".\Src\WXInputBase.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Src\WXInputBase.h"
+ >
+ </File>
+ <File
RelativePath=".\Src\WxUtils.cpp"
>
</File>
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
-#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[])
+int main(int argc, char* argv[])
{
+#ifdef __APPLE__
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