aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt15
-rw-r--r--src/chips/common/mutex.hpp33
2 files changed, 42 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e6877bc..d93901e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,6 +26,21 @@ if(DJGPP OR MSDOS)
add_definitions(-DADLMIDI_HW_OPL)
endif()
+if(${CMAKE_SYSTEM_NAME} STREQUAL "Nintendo3DS")
+ set(ADLMIDI_3DS 1)
+ add_definitions(-DDOSBOX_NO_MUTEX)
+endif()
+
+if(${CMAKE_SYSTEM_NAME} STREQUAL "NintendoDS")
+ set(ADLMIDI_DS 1)
+ add_definitions(-DDOSBOX_NO_MUTEX)
+endif()
+
+if(${CMAKE_SYSTEM_NAME} STREQUAL "NintendoWii")
+ set(ADLMIDI_WII 1)
+ add_definitions(-DDOSBOX_NO_MUTEX)
+endif()
+
#===========================================================================================
# Strip garbage
if(APPLE)
diff --git a/src/chips/common/mutex.hpp b/src/chips/common/mutex.hpp
index 8fc1dc8..89d49b0 100644
--- a/src/chips/common/mutex.hpp
+++ b/src/chips/common/mutex.hpp
@@ -21,12 +21,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#if !defined(_WIN32)
-#include <pthread.h>
+#ifndef DOSBOX_NO_MUTEX
+# if !defined(_WIN32)
+# include <pthread.h>
typedef pthread_mutex_t MutexNativeObject;
-#else
-#include <windows.h>
+# else
+# include <windows.h>
typedef CRITICAL_SECTION MutexNativeObject;
+# endif
#endif
class Mutex
@@ -37,7 +39,9 @@ public:
void lock();
void unlock();
private:
+#if !defined(DOSBOX_NO_MUTEX)
MutexNativeObject m;
+#endif
Mutex(const Mutex &);
Mutex &operator=(const Mutex &);
};
@@ -53,7 +57,22 @@ private:
MutexHolder &operator=(const MutexHolder &);
};
-#if !defined(_WIN32)
+#if defined(DOSBOX_NO_MUTEX) // No mutex, just a dummy
+
+inline Mutex::Mutex()
+{}
+
+inline Mutex::~Mutex()
+{}
+
+inline void Mutex::lock()
+{}
+
+inline void Mutex::unlock()
+{}
+
+#elif !defined(_WIN32) // pthread
+
inline Mutex::Mutex()
{
pthread_mutex_init(&m, NULL);
@@ -73,7 +92,9 @@ inline void Mutex::unlock()
{
pthread_mutex_unlock(&m);
}
-#else
+
+#else // Win32
+
inline Mutex::Mutex()
{
InitializeCriticalSection(&m);