[Scummvm-git-logs] scummvm master -> c30c22dac838ca66b459d467a184d2fc3b8c57ca
bluegr
bluegr at gmail.com
Mon Feb 8 01:07:38 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
c30c22dac8 TEST: Simplify the use of the Null backend
Commit: c30c22dac838ca66b459d467a184d2fc3b8c57ca
https://github.com/scummvm/scummvm/commit/c30c22dac838ca66b459d467a184d2fc3b8c57ca
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-02-08T03:07:34+02:00
Commit Message:
TEST: Simplify the use of the Null backend
Changed paths:
R test/stubs.cpp
backends/platform/null/null.cpp
test/module.mk
test/null_osystem.cpp
diff --git a/backends/platform/null/null.cpp b/backends/platform/null/null.cpp
index bdf2af1b69..2112e8e932 100644
--- a/backends/platform/null/null.cpp
+++ b/backends/platform/null/null.cpp
@@ -45,19 +45,21 @@ typedef void (*sighandler_t)(int);
#define FORBIDDEN_SYMBOL_EXCEPTION_exit
#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
+#include "common/scummsys.h"
+
+#if defined(USE_NULL_DRIVER)
#include "backends/modular-backend.h"
#include "base/main.h"
-#if defined(USE_NULL_DRIVER)
+#ifndef NULL_DRIVER_USE_FOR_TEST
#include "backends/saves/default/default-saves.h"
#include "backends/timer/default/default-timer.h"
#include "backends/events/default/default-events.h"
#include "backends/mixer/null/null-mixer.h"
#include "backends/mutex/null/null-mutex.h"
#include "backends/graphics/null/null-graphics.h"
-#include "audio/mixer_intern.h"
-#include "common/scummsys.h"
#include "gui/debugger.h"
+#endif
/*
* Include header files needed for the getFilesystemFactory() method.
@@ -137,7 +139,9 @@ void OSystem_NULL::initBackend() {
#elif defined(WIN32)
_startTime = GetTickCount();
#endif
-#if defined(POSIX) && !defined(NULL_DRIVER_USE_FOR_TEST)
+
+#ifndef NULL_DRIVER_USE_FOR_TEST
+#ifdef POSIX
last_handler = signal(SIGINT, intHandler);
#endif
@@ -149,15 +153,17 @@ void OSystem_NULL::initBackend() {
_mixerManager = new NullMixerManager();
// Setup and start mixer
_mixerManager->init();
+#endif
BaseBackend::initBackend();
}
bool OSystem_NULL::pollEvent(Common::Event &event) {
+#ifndef NULL_DRIVER_USE_FOR_TEST
((DefaultTimerManager *)getTimerManager())->checkTimers();
((NullMixerManager *)_mixerManager)->update(1);
-#if defined(POSIX) && !defined(NULL_DRIVER_USE_FOR_TEST)
+#ifdef POSIX
if (intReceived) {
intReceived = false;
@@ -173,6 +179,7 @@ bool OSystem_NULL::pollEvent(Common::Event &event) {
event.type = Common::EVENT_QUIT;
return true;
}
+#endif
#endif
return false;
@@ -248,10 +255,6 @@ int main(int argc, char *argv[]) {
g_system->destroy();
return res;
}
-#else
-void Common::install_null_g_system() {
- g_system = OSystem_NULL_create();
-}
#endif
#else /* USE_NULL_DRIVER */
diff --git a/test/module.mk b/test/module.mk
index 192e336dbc..e0fa9d3e61 100644
--- a/test/module.mk
+++ b/test/module.mk
@@ -15,19 +15,16 @@ TEST_LIBS += test/null_osystem.o \
backends/fs/posix/posix-iostream.o \
backends/fs/abstract-fs.o \
backends/fs/stdiostream.o \
- backends/modular-backend.o \
- test/stubs.o
+ backends/modular-backend.o
endif
ifdef WIN32
TEST_LIBS += test/null_osystem.o \
- backends/fs/posix/posix-fs-factory.o \
- backends/fs/posix/posix-fs.o \
- backends/fs/posix/posix-iostream.o \
+ backends/fs/windows/windows-fs-factory.o \
+ backends/fs/windows/windows-fs.o \
backends/fs/abstract-fs.o \
backends/fs/stdiostream.o \
- backends/modular-backend.o \
- test/stubs.o
+ backends/modular-backend.o
endif
TEST_LIBS += audio/libaudio.a math/libmath.a common/libcommon.a
@@ -50,7 +47,6 @@ TEST_CXXFLAGS := $(filter-out -Wglobal-constructors,$(CXXFLAGS))
ifdef WIN32
TEST_LDFLAGS := $(filter-out -mwindows,$(TEST_LDFLAGS))
-TEST_LIBS += backends/fs/windows/windows-fs-factory.o backends/fs/windows/windows-fs.o
endif
ifdef N64
diff --git a/test/null_osystem.cpp b/test/null_osystem.cpp
index 478c25a028..ae53ec96b4 100644
--- a/test/null_osystem.cpp
+++ b/test/null_osystem.cpp
@@ -2,3 +2,21 @@
#define NULL_DRIVER_USE_FOR_TEST 1
#include "null_osystem.h"
#include "../backends/platform/null/null.cpp"
+
+void Common::install_null_g_system() {
+ g_system = OSystem_NULL_create();
+}
+
+void BaseBackend::displayMessageOnOSD(const Common::U32String &msg) {
+}
+
+void BaseBackend::initBackend() {
+ OSystem::initBackend();
+}
+
+void BaseBackend::fillScreen(uint32 col) {
+}
+
+void EventsBaseBackend::initBackend() {
+ BaseBackend::initBackend();
+}
diff --git a/test/stubs.cpp b/test/stubs.cpp
deleted file mode 100644
index 103a6f052e..0000000000
--- a/test/stubs.cpp
+++ /dev/null
@@ -1,181 +0,0 @@
-#include "backends/events/default/default-events.h"
-#include "backends/timer/default/default-timer.h"
-#include "backends/saves/default/default-saves.h"
-#include "common/savefile.h"
-#include "gui/message.h"
-#include "backends/base-backend.h"
-#include "backends/mixer/null/null-mixer.h"
-#include "engines/engine.h"
-
-Engine *g_engine = 0;
-
-GUI::Debugger *Engine::getOrCreateDebugger() {
- assert(0);
-}
-
-NullMixerManager::NullMixerManager() : MixerManager() {
- _outputRate = 22050;
- _callsCounter = 0;
- _samples = 8192;
- while (_samples * 16 > _outputRate * 2)
- _samples >>= 1;
- _samplesBuf = new uint8[_samples * 4];
-}
-
-NullMixerManager::~NullMixerManager() {
- delete []_samplesBuf;
-}
-
-void NullMixerManager::update(uint8 callbackPeriod) {
- if (_audioSuspended) {
- return;
- }
-
- assert(0);
-}
-
-void NullMixerManager::init() {
- assert(0);
-}
-
-void NullMixerManager::suspendAudio() {
- _audioSuspended = true;
-}
-
-int NullMixerManager::resumeAudio() {
- if (!_audioSuspended) {
- return -2;
- }
- _audioSuspended = false;
- return 0;
-}
-
-DefaultEventManager::DefaultEventManager(Common::EventSource *boss) :
- _buttonState(0),
- _modifierState(0),
- _shouldQuit(false),
- _shouldReturnToLauncher(false),
- _confirmExitDialogActive(false) {
-}
-
-DefaultEventManager::~DefaultEventManager() {
-}
-
-void DefaultEventManager::init() {
-}
-
-bool DefaultEventManager::pollEvent(Common::Event &event) {
- assert(0);
-}
-
-void DefaultEventManager::pushEvent(const Common::Event &event) {
- assert(0);
-}
-
-void DefaultEventManager::purgeMouseEvents() {
- assert(0);
-}
-
-Common::Keymap *DefaultEventManager::getGlobalKeymap() {
- assert(0);
-}
-
-DefaultTimerManager::DefaultTimerManager() :
- _timerCallbackNext(0),
- _head(0) {
-}
-
-DefaultTimerManager::~DefaultTimerManager() {
-}
-
-void DefaultTimerManager::handler() {
- assert(0);
-}
-
-void DefaultTimerManager::checkTimers(uint32 interval) {
- assert(0);
-}
-
-bool DefaultTimerManager::installTimerProc(TimerProc callback, int32 interval, void *refCon, const Common::String &id) {
- assert(0);
-}
-
-void DefaultTimerManager::removeTimerProc(TimerProc callback) {
- assert(0);
-}
-
-DefaultSaveFileManager::DefaultSaveFileManager() {
-}
-
-DefaultSaveFileManager::DefaultSaveFileManager(const Common::String &defaultSavepath) {
-}
-
-
-void DefaultSaveFileManager::checkPath(const Common::FSNode &dir) {
- assert(0);
-}
-
-void DefaultSaveFileManager::updateSavefilesList(Common::StringArray &lockedFiles) {
- assert(0);
-}
-
-Common::StringArray DefaultSaveFileManager::listSavefiles(const Common::String &pattern) {
- assert(0);
-}
-
-Common::InSaveFile *DefaultSaveFileManager::openRawFile(const Common::String &filename) {
- assert(0);
-}
-
-Common::InSaveFile *DefaultSaveFileManager::openForLoading(const Common::String &filename) {
- assert(0);
-}
-
-Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const Common::String &filename, bool compress) {
- assert(0);
-}
-
-bool DefaultSaveFileManager::removeSavefile(const Common::String &filename) {
- assert(0);
-}
-
-Common::String DefaultSaveFileManager::getSavePath() const {
- assert(0);
-}
-
-void DefaultSaveFileManager::assureCached(const Common::String &savePathName) {
- assert(0);
-}
-
-Common::String DefaultSaveFileManager::concatWithSavesPath(Common::String name) {
- assert(0);
-}
-
-bool Common::SaveFileManager::copySavefile(const Common::String &oldFilename, const Common::String &newFilename, bool compress) {
- assert(0);
-}
-
-bool Common::SaveFileManager::renameSavefile(const Common::String &oldFilename, const Common::String &newFilename, bool compress) {
- assert(0);
-}
-
-Common::String Common::SaveFileManager::popErrorDesc() {
- Common::String err = _errorDesc;
- clearError();
-
- return err;
-}
-
-void BaseBackend::displayMessageOnOSD(const Common::U32String &msg) {
-}
-
-void BaseBackend::initBackend() {
- OSystem::initBackend();
-}
-
-void BaseBackend::fillScreen(uint32 col) {
-}
-
-void EventsBaseBackend::initBackend() {
- BaseBackend::initBackend();
-}
More information about the Scummvm-git-logs
mailing list