Initial commit

This commit is contained in:
2026-02-02 04:50:13 +01:00
commit 5b11698731
22592 changed files with 7677434 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#define FORBIDDEN_SYMBOL_EXCEPTION_printf
#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
#include "common/scummsys.h"
#if defined(__3DS__)
#include "backends/mutex/3ds/3ds-mutex.h"
#include <3ds.h>
/**
* 3DS mutex manager
*/
class _3DSMutexInternal final : public Common::MutexInternal {
public:
_3DSMutexInternal() { RecursiveLock_Init(&_mutex); }
~_3DSMutexInternal() override {}
bool lock() override { RecursiveLock_Lock(&_mutex); return true; }
bool unlock() override { RecursiveLock_Unlock(&_mutex); return true; }
private:
RecursiveLock _mutex;
};
Common::MutexInternal *create3DSMutexInternal() {
return new _3DSMutexInternal();
}
#endif

View File

@@ -0,0 +1,29 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef BACKENDS_MUTEX_3DS_H
#define BACKENDS_MUTEX_3DS_H
#include "common/mutex.h"
Common::MutexInternal *create3DSMutexInternal();
#endif

View File

@@ -0,0 +1,38 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef BACKENDS_MUTEX_NULL_H
#define BACKENDS_MUTEX_NULL_H
#include "common/mutex.h"
/**
* Null mutex manager
*/
class NullMutexInternal final : public Common::MutexInternal {
public:
NullMutexInternal() {}
virtual ~NullMutexInternal() {}
virtual bool lock() { return true; }
virtual bool unlock() { return true; }
};
#endif

View File

@@ -0,0 +1,80 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
#include "backends/mutex/pthread/pthread-mutex.h"
#include <pthread.h>
/**
* pthreads mutex implementation
*/
class PthreadMutexInternal final : public Common::MutexInternal {
public:
PthreadMutexInternal();
~PthreadMutexInternal() override;
bool lock() override;
bool unlock() override;
private:
pthread_mutex_t _mutex;
};
PthreadMutexInternal::PthreadMutexInternal() {
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
if (pthread_mutex_init(&_mutex, &attr) != 0) {
warning("pthread_mutex_init() failed");
}
}
PthreadMutexInternal::~PthreadMutexInternal() {
if (pthread_mutex_destroy(&_mutex) != 0)
warning("pthread_mutex_destroy() failed");
}
bool PthreadMutexInternal::lock() {
if (pthread_mutex_lock(&_mutex) != 0) {
warning("pthread_mutex_lock() failed");
return false;
} else {
return true;
}
}
bool PthreadMutexInternal::unlock() {
if (pthread_mutex_unlock(&_mutex) != 0) {
warning("pthread_mutex_unlock() failed");
return false;
} else {
return true;
}
}
Common::MutexInternal *createPthreadMutexInternal() {
return new PthreadMutexInternal();
}

View File

@@ -0,0 +1,29 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef BACKENDS_MUTEX_PTHREAD_H
#define BACKENDS_MUTEX_PTHREAD_H
#include "common/mutex.h"
Common::MutexInternal *createPthreadMutexInternal();
#endif

View File

@@ -0,0 +1,66 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "common/scummsys.h"
#if defined(SDL_BACKEND)
#include "backends/mutex/sdl/sdl-mutex.h"
#include "backends/platform/sdl/sdl-sys.h"
/**
* SDL mutex manager
*/
class SdlMutexInternal final : public Common::MutexInternal {
public:
SdlMutexInternal() { _mutex = SDL_CreateMutex(); }
~SdlMutexInternal() override { SDL_DestroyMutex(_mutex); }
bool lock() override {
#if SDL_VERSION_ATLEAST(3, 0, 0)
SDL_LockMutex(_mutex);
return true;
#else
return (SDL_mutexP(_mutex) == 0);
#endif
}
bool unlock() override {
#if SDL_VERSION_ATLEAST(3, 0, 0)
SDL_UnlockMutex(_mutex);
return true;
#else
return (SDL_mutexV(_mutex) == 0);
#endif
}
private:
#if SDL_VERSION_ATLEAST(3, 0, 0)
SDL_Mutex *_mutex;
#else
SDL_mutex *_mutex;
#endif
};
Common::MutexInternal *createSdlMutexInternal() {
return new SdlMutexInternal();
}
#endif

View File

@@ -0,0 +1,29 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef BACKENDS_MUTEX_SDL_H
#define BACKENDS_MUTEX_SDL_H
#include "common/mutex.h"
Common::MutexInternal *createSdlMutexInternal();
#endif

View File

@@ -0,0 +1,89 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "common/scummsys.h"
#if defined(__WII__)
#include "backends/mutex/wii/wii-mutex.h"
#include <ogc/mutex.h>
/**
* Wii mutex implementation
*/
class WiiMutexInternal final : public Common::MutexInternal {
public:
WiiMutexInternal();
~WiiMutexInternal() override;
bool lock() override;
bool unlock() override;
private:
mutex_t _mutex;
};
WiiMutexInternal::WiiMutexInternal() {
s32 res = LWP_MutexInit(&_mutex, true);
if (res) {
printf("ERROR creating mutex\n");
}
}
WiiMutexInternal::~WiiMutexInternal() {
s32 res = LWP_MutexDestroy(_mutex);
if (res)
printf("ERROR destroying mutex (%d)\n", res);
}
bool WiiMutexInternal::lock() {
s32 res = LWP_MutexLock(_mutex);
if (res) {
printf("ERROR locking mutex (%d)\n", res);
return false;
} else {
return true;
}
}
bool WiiMutexInternal::unlock() {
s32 res = LWP_MutexUnlock(_mutex);
if (res) {
printf("ERROR unlocking mutex (%d)\n", res);
return false;
} else {
return true;
}
}
Common::MutexInternal *createWiiMutexInternal() {
return new WiiMutexInternal();
}
#endif

View File

@@ -0,0 +1,29 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef BACKENDS_MUTEX_WII_H
#define BACKENDS_MUTEX_WII_H
#include "common/mutex.h"
Common::MutexInternal *createWiiMutexInternal();
#endif