[Scummvm-git-logs] scummvm master -> e793a2d3bfe70ae06a746fa8bb3788ae78d1ac81
dreammaster
dreammaster at scummvm.org
Sun Mar 14 05:36:09 UTC 2021
This automated email contains information about 7 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
9b21eaf19f AGS: Move soundcache.cpp globals to Globals
8f252e4da2 AGS: Move agsplatformdriver.cpp globals to Globals
f0898d953e AGS: Move other GfxFilterInfo statics to Globals
82ac06065d AGS: Cleanups, changing globals to statics
3e3d4e9097 AGS: Move stand-alone methods from ags.cpp to their own file
ddfb81d715 AGS: Enable return to launcher
e793a2d3bf AGS: Remove duplicate detection entry for Shivah
Commit: 9b21eaf19f4f5e128cab6228101e83052f5d5df7
https://github.com/scummvm/scummvm/commit/9b21eaf19f4f5e128cab6228101e83052f5d5df7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-03-13T21:34:55-08:00
Commit Message:
AGS: Move soundcache.cpp globals to Globals
Changed paths:
engines/ags/engine/media/audio/soundcache.cpp
engines/ags/engine/media/audio/soundcache.h
engines/ags/globals.h
diff --git a/engines/ags/engine/media/audio/soundcache.cpp b/engines/ags/engine/media/audio/soundcache.cpp
index 65800f77dd..8523f388a9 100644
--- a/engines/ags/engine/media/audio/soundcache.cpp
+++ b/engines/ags/engine/media/audio/soundcache.cpp
@@ -35,26 +35,23 @@ namespace AGS3 {
using namespace Shared;
-sound_cache_entry_t *sound_cache_entries = nullptr;
-unsigned int sound_cache_counter = 0;
-
void clear_sound_cache() {
AGS::Engine::MutexLock _lock(::AGS::g_vm->_soundCacheMutex);
- if (sound_cache_entries) {
+ if (_G(sound_cache_entries)) {
int i;
for (i = 0; i < _G(psp_audio_cachesize); i++) {
- if (sound_cache_entries[i].data) {
- free(sound_cache_entries[i].data);
- sound_cache_entries[i].data = nullptr;
- free(sound_cache_entries[i].file_name);
- sound_cache_entries[i].file_name = nullptr;
- sound_cache_entries[i].reference = 0;
+ if (_G(sound_cache_entries)[i].data) {
+ free(_G(sound_cache_entries)[i].data);
+ _G(sound_cache_entries)[i].data = nullptr;
+ free(_G(sound_cache_entries)[i].file_name);
+ _G(sound_cache_entries)[i].file_name = nullptr;
+ _G(sound_cache_entries)[i].reference = 0;
}
}
} else {
- sound_cache_entries = (sound_cache_entry_t *)malloc(_G(psp_audio_cachesize) * sizeof(sound_cache_entry_t));
- memset(sound_cache_entries, 0, _G(psp_audio_cachesize) * sizeof(sound_cache_entry_t));
+ _G(sound_cache_entries) = (sound_cache_entry_t *)malloc(_G(psp_audio_cachesize) * sizeof(sound_cache_entry_t));
+ memset(_G(sound_cache_entries), 0, _G(psp_audio_cachesize) * sizeof(sound_cache_entry_t));
}
}
@@ -66,12 +63,12 @@ void sound_cache_free(char *buffer) {
#endif
int i;
for (i = 0; i < _G(psp_audio_cachesize); i++) {
- if (sound_cache_entries[i].data == buffer) {
- if (sound_cache_entries[i].reference > 0)
- sound_cache_entries[i].reference--;
+ if (_G(sound_cache_entries)[i].data == buffer) {
+ if (_G(sound_cache_entries)[i].reference > 0)
+ _G(sound_cache_entries)[i].reference--;
#ifdef SOUND_CACHE_DEBUG
- Debug::Printf("..decreased reference count of slot %d to %d\n", i, sound_cache_entries[i].reference);
+ Debug::Printf("..decreased reference count of slot %d to %d\n", i, _G(sound_cache_entries)[i].reference);
#endif
return;
}
@@ -99,18 +96,18 @@ char *get_cached_sound(const AssetPath &asset_name, size_t &size) {
int i;
for (i = 0; i < _G(psp_audio_cachesize); i++) {
- if (sound_cache_entries[i].data == nullptr)
+ if (_G(sound_cache_entries)[i].data == nullptr)
continue;
- if (strcmp(asset_name.second, sound_cache_entries[i].file_name) == 0) {
+ if (strcmp(asset_name.second, _G(sound_cache_entries)[i].file_name) == 0) {
#ifdef SOUND_CACHE_DEBUG
Debug::Printf("..found in slot %d\n", i);
#endif
- sound_cache_entries[i].reference++;
- sound_cache_entries[i].last_used = sound_cache_counter++;
- size = sound_cache_entries[i].size;
+ _G(sound_cache_entries)[i].reference++;
+ _G(sound_cache_entries)[i].last_used = _G(sound_cache_counter)++;
+ size = _G(sound_cache_entries)[i].size;
- return sound_cache_entries[i].data;
+ return _G(sound_cache_entries)[i].data;
}
}
@@ -124,19 +121,19 @@ char *get_cached_sound(const AssetPath &asset_name, size_t &size) {
// Find free slot
for (i = 0; i < _G(psp_audio_cachesize); i++) {
- if (sound_cache_entries[i].data == nullptr)
+ if (_G(sound_cache_entries)[i].data == nullptr)
break;
}
// No free slot?
if (i == _G(psp_audio_cachesize)) {
- unsigned int oldest = sound_cache_counter;
+ unsigned int oldest = _G(sound_cache_counter);
int index = -1;
for (i = 0; i < _G(psp_audio_cachesize); i++) {
- if (sound_cache_entries[i].reference == 0) {
- if (sound_cache_entries[i].last_used < oldest) {
- oldest = sound_cache_entries[i].last_used;
+ if (_G(sound_cache_entries)[i].reference == 0) {
+ if (_G(sound_cache_entries)[i].last_used < oldest) {
+ oldest = _G(sound_cache_entries)[i].last_used;
index = i;
}
}
@@ -170,21 +167,21 @@ char *get_cached_sound(const AssetPath &asset_name, size_t &size) {
Debug::Printf("..loading cached in slot %d\n", i);
#endif
- if (sound_cache_entries[i].data) {
- free(sound_cache_entries[i].data);
+ if (_G(sound_cache_entries)[i].data) {
+ free(_G(sound_cache_entries)[i].data);
}
- sound_cache_entries[i].size = size;
- sound_cache_entries[i].data = newdata;
+ _G(sound_cache_entries)[i].size = size;
+ _G(sound_cache_entries)[i].data = newdata;
- if (sound_cache_entries[i].file_name)
- free(sound_cache_entries[i].file_name);
- sound_cache_entries[i].file_name = (char *)malloc(strlen(asset_name.second) + 1);
- strcpy(sound_cache_entries[i].file_name, asset_name.second);
- sound_cache_entries[i].reference = 1;
- sound_cache_entries[i].last_used = sound_cache_counter++;
+ if (_G(sound_cache_entries)[i].file_name)
+ free(_G(sound_cache_entries)[i].file_name);
+ _G(sound_cache_entries)[i].file_name = (char *)malloc(strlen(asset_name.second) + 1);
+ strcpy(_G(sound_cache_entries)[i].file_name, asset_name.second);
+ _G(sound_cache_entries)[i].reference = 1;
+ _G(sound_cache_entries)[i].last_used = _G(sound_cache_counter)++;
- return sound_cache_entries[i].data;
+ return _G(sound_cache_entries)[i].data;
}
}
diff --git a/engines/ags/engine/media/audio/soundcache.h b/engines/ags/engine/media/audio/soundcache.h
index 1d2811f55d..89f4caf04a 100644
--- a/engines/ags/engine/media/audio/soundcache.h
+++ b/engines/ags/engine/media/audio/soundcache.h
@@ -34,7 +34,7 @@ namespace AGS3 {
//#define SOUND_CACHE_DEBUG
-typedef struct {
+struct sound_cache_entry_t {
char *file_name;
int number;
int free;
@@ -42,7 +42,7 @@ typedef struct {
unsigned int size;
char *data;
int reference;
-} sound_cache_entry_t;
+};
void clear_sound_cache();
void sound_cache_free(char *buffer);
diff --git a/engines/ags/globals.h b/engines/ags/globals.h
index a227146390..bdc72e19d8 100644
--- a/engines/ags/globals.h
+++ b/engines/ags/globals.h
@@ -149,6 +149,7 @@ struct ScriptPosition;
struct ScriptRegion;
struct ScriptString;
struct ScriptSystem;
+struct sound_cache_entry_t;
struct SOUNDCLIP;
struct SpeechLipSyncLine;
struct SpriteListEntry;
@@ -1122,6 +1123,16 @@ public:
/**@}*/
+ /**
+ * \defgroup soundcache globals
+ * @{
+ */
+
+ sound_cache_entry_t *_sound_cache_entries = nullptr;
+ unsigned int _sound_cache_counter = 0;
+
+ /**@}*/
+
/**
* \defgroup string globals
* @{
Commit: 8f252e4da2fadd56df4db4cc33a2584f673c9eb4
https://github.com/scummvm/scummvm/commit/8f252e4da2fadd56df4db4cc33a2584f673c9eb4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-03-13T21:34:55-08:00
Commit Message:
AGS: Move agsplatformdriver.cpp globals to Globals
Changed paths:
engines/ags/engine/platform/base/agsplatformdriver.cpp
engines/ags/globals.h
diff --git a/engines/ags/engine/platform/base/agsplatformdriver.cpp b/engines/ags/engine/platform/base/agsplatformdriver.cpp
index e7796599cc..61149181ac 100644
--- a/engines/ags/engine/platform/base/agsplatformdriver.cpp
+++ b/engines/ags/engine/platform/base/agsplatformdriver.cpp
@@ -50,11 +50,6 @@ namespace AGS3 {
using namespace AGS::Shared;
using namespace AGS::Engine;
-// We don't have many places where we delay longer than a frame, but where we
-// do, we should give the audio layer a chance to update.
-// 16 milliseconds is rough period for 60fps
-const auto MaximumDelayBetweenPolling = std::chrono::milliseconds(16);
-
AGSPlatformDriver *AGSPlatformDriver::instance = nullptr;
// ******** DEFAULT IMPLEMENTATIONS *******
@@ -261,7 +256,7 @@ void AGSPlatformDriver::Delay(int millis) {
break;
}
- auto duration = std::min<std::chrono::milliseconds>(delayUntil - now, MaximumDelayBetweenPolling);
+ auto duration = std::min<std::chrono::milliseconds>(delayUntil - now, _G(MaximumDelayBetweenPolling));
std::this_thread::sleep_for(duration);
now = AGS_Clock::now(); // update now
diff --git a/engines/ags/globals.h b/engines/ags/globals.h
index bdc72e19d8..e0470b9cfa 100644
--- a/engines/ags/globals.h
+++ b/engines/ags/globals.h
@@ -208,6 +208,18 @@ public:
/**@}*/
+ /**
+ * \defgroup agsplatformdriver globals
+ * @{
+ */
+
+ // We don't have many places where we delay longer than a frame, but where we
+ // do, we should give the audio layer a chance to update.
+ // 16 milliseconds is rough period for 60fps
+ const std::chrono::milliseconds _MaximumDelayBetweenPolling = std::chrono::milliseconds(16);
+
+ /**@}*/
+
/**
* \defgroup agsstaticobject globals
* @{
Commit: f0898d953e0472f539e0d07039257a0a28f1404a
https://github.com/scummvm/scummvm/commit/f0898d953e0472f539e0d07039257a0a28f1404a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-03-13T21:34:55-08:00
Commit Message:
AGS: Move other GfxFilterInfo statics to Globals
Changed paths:
engines/ags/engine/gfx/gfxfilter_aad3d.cpp
engines/ags/engine/gfx/gfxfilter_aad3d.h
engines/ags/engine/gfx/gfxfilter_d3d.cpp
engines/ags/engine/gfx/gfxfilter_d3d.h
engines/ags/globals.cpp
engines/ags/globals.h
diff --git a/engines/ags/engine/gfx/gfxfilter_aad3d.cpp b/engines/ags/engine/gfx/gfxfilter_aad3d.cpp
index fd2161174f..e3d150689f 100644
--- a/engines/ags/engine/gfx/gfxfilter_aad3d.cpp
+++ b/engines/ags/engine/gfx/gfxfilter_aad3d.cpp
@@ -22,7 +22,7 @@
#include "ags/shared/core/platform.h"
#include "ags/engine/gfx/gfxfilter_aad3d.h"
-
+#include "ags/globals.h"
#if AGS_PLATFORM_OS_WINDOWS
//include <d3d9.h>
#endif
@@ -32,10 +32,8 @@ namespace AGS {
namespace Engine {
namespace D3D {
-const GfxFilterInfo AAD3DGfxFilter::FilterInfo = GfxFilterInfo("Linear", "Linear interpolation");
-
const GfxFilterInfo &AAD3DGfxFilter::GetInfo() const {
- return FilterInfo;
+ return _GP(aad3dFilterInfo);
}
void AAD3DGfxFilter::SetSamplerStateForStandardSprite(void *direct3ddevice9) {
diff --git a/engines/ags/engine/gfx/gfxfilter_aad3d.h b/engines/ags/engine/gfx/gfxfilter_aad3d.h
index 5396e749cc..dbf0db17dd 100644
--- a/engines/ags/engine/gfx/gfxfilter_aad3d.h
+++ b/engines/ags/engine/gfx/gfxfilter_aad3d.h
@@ -42,8 +42,6 @@ public:
void SetSamplerStateForStandardSprite(void *direct3ddevice9) override;
bool NeedToColourEdgeLines() override;
-
- static const GfxFilterInfo FilterInfo;
};
} // namespace D3D
diff --git a/engines/ags/engine/gfx/gfxfilter_d3d.cpp b/engines/ags/engine/gfx/gfxfilter_d3d.cpp
index ecba7a45c6..5c75365e14 100644
--- a/engines/ags/engine/gfx/gfxfilter_d3d.cpp
+++ b/engines/ags/engine/gfx/gfxfilter_d3d.cpp
@@ -22,6 +22,7 @@
#include "ags/shared/core/platform.h"
#include "ags/engine/gfx/gfxfilter_d3d.h"
+#include "ags/globals.h"
#if AGS_PLATFORM_OS_WINDOWS
//include <d3d9.h>
#endif
@@ -31,10 +32,8 @@ namespace AGS {
namespace Engine {
namespace D3D {
-const GfxFilterInfo D3DGfxFilter::FilterInfo = GfxFilterInfo("StdScale", "Nearest-neighbour");
-
const GfxFilterInfo &D3DGfxFilter::GetInfo() const {
- return FilterInfo;
+ return _GP(d3dFilterInfo);
}
void D3DGfxFilter::SetSamplerStateForStandardSprite(void *direct3ddevice9) {
diff --git a/engines/ags/engine/gfx/gfxfilter_d3d.h b/engines/ags/engine/gfx/gfxfilter_d3d.h
index c4be89a8ca..3f0cef9ff1 100644
--- a/engines/ags/engine/gfx/gfxfilter_d3d.h
+++ b/engines/ags/engine/gfx/gfxfilter_d3d.h
@@ -42,8 +42,6 @@ public:
virtual void SetSamplerStateForStandardSprite(void *direct3ddevice9);
virtual bool NeedToColourEdgeLines();
-
- static const GfxFilterInfo FilterInfo;
};
} // namespace D3D
diff --git a/engines/ags/globals.cpp b/engines/ags/globals.cpp
index de388e3431..bf9d42ea4e 100644
--- a/engines/ags/globals.cpp
+++ b/engines/ags/globals.cpp
@@ -212,9 +212,15 @@ Globals::Globals() {
_StaticInventoryArray = new StaticArray();
_StaticDialogArray = new StaticArray();
+ // gfxfilter_aad3d.cpp globals
+ _aad3dFilterInfo = new AGS::Engine::GfxFilterInfo("Linear", "Linear interpolation");
+
// gfxfilter_allegro.cpp globals
_allegroFilterInfo = new AGS::Engine::GfxFilterInfo("StdScale", "Nearest-neighbour");
+ // gfxfilter_d3d.cpp globals
+ _d3dFilterInfo = new AGS::Engine::GfxFilterInfo("StdScale", "Nearest-neighbour");
+
// gfxfilter_hqx.cpp globals
_hqxFilterInfo = new AGS::Engine::GfxFilterInfo("Hqx", "Hqx (High Quality)", 2, 3);
@@ -423,9 +429,15 @@ Globals::~Globals() {
delete _StaticInventoryArray;
delete _StaticDialogArray;
+ // gfxfilter_aad3d.cpp globals
+ delete _aad3dFilterInfo;
+
// gfxfilter_allegro.cpp globals
delete _allegroFilterInfo;
+ // gfxfilter_d3d.cpp globals
+ delete _d3dFilterInfo;
+
// gfxfilter_hqx.cpp globals
delete _hqxFilterInfo;
diff --git a/engines/ags/globals.h b/engines/ags/globals.h
index e0470b9cfa..0fea69cdec 100644
--- a/engines/ags/globals.h
+++ b/engines/ags/globals.h
@@ -722,6 +722,15 @@ public:
/**@}*/
+ /**
+ * \defgroup gfxfilter_aad3d globals
+ * @{
+ */
+
+ const AGS::Engine::GfxFilterInfo *_aad3dFilterInfo;
+
+ /**@}*/
+
/**
* \defgroup gfxfilter_allegro globals
* @{
@@ -740,6 +749,15 @@ public:
/**@}*/
+ /**
+ * \defgroup gfxfilter_d3d globals
+ * @{
+ */
+
+ const AGS::Engine::GfxFilterInfo *_d3dFilterInfo;
+
+ /**@}*/
+
/**
* \defgroup global_dialog globals
* @{
Commit: 82ac06065de3fc422c58f268728fb6d637de22ce
https://github.com/scummvm/scummvm/commit/82ac06065de3fc422c58f268728fb6d637de22ce
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-03-13T21:34:55-08:00
Commit Message:
AGS: Cleanups, changing globals to statics
Changed paths:
engines/ags/engine/ac/dynobj/cc_hotspot.cpp
engines/ags/engine/ac/dynobj/managedobjectpool.cpp
engines/ags/engine/debugging/filebasedagsdebugger.cpp
engines/ags/engine/debugging/filebasedagsdebugger.h
engines/ags/engine/device/mousew32.cpp
engines/ags/shared/core/asset.cpp
engines/ags/shared/core/assetmanager.cpp
engines/ags/shared/gui/guilistbox.cpp
engines/ags/shared/gui/guislider.cpp
diff --git a/engines/ags/engine/ac/dynobj/cc_hotspot.cpp b/engines/ags/engine/ac/dynobj/cc_hotspot.cpp
index 3b6730e173..e3581760e8 100644
--- a/engines/ags/engine/ac/dynobj/cc_hotspot.cpp
+++ b/engines/ags/engine/ac/dynobj/cc_hotspot.cpp
@@ -28,8 +28,6 @@
namespace AGS3 {
-
-
// return the type name of the object
const char *CCHotspot::GetType() {
return "Hotspot";
diff --git a/engines/ags/engine/ac/dynobj/managedobjectpool.cpp b/engines/ags/engine/ac/dynobj/managedobjectpool.cpp
index 16a6ce7d71..63d161c904 100644
--- a/engines/ags/engine/ac/dynobj/managedobjectpool.cpp
+++ b/engines/ags/engine/ac/dynobj/managedobjectpool.cpp
@@ -34,10 +34,10 @@ namespace AGS3 {
using namespace AGS::Shared;
-const auto OBJECT_CACHE_MAGIC_NUMBER = 0xa30b;
-const auto SERIALIZE_BUFFER_SIZE = 10240;
-const auto GARBAGE_COLLECTION_INTERVAL = 1024;
-const auto RESERVED_SIZE = 2048;
+static const auto OBJECT_CACHE_MAGIC_NUMBER = 0xa30b;
+static const auto SERIALIZE_BUFFER_SIZE = 10240;
+static const auto GARBAGE_COLLECTION_INTERVAL = 1024;
+static const auto RESERVED_SIZE = 2048;
int ManagedObjectPool::Remove(ManagedObject &o, bool force) {
if (!o.isUsed()) {
diff --git a/engines/ags/engine/debugging/filebasedagsdebugger.cpp b/engines/ags/engine/debugging/filebasedagsdebugger.cpp
index 5300cf622d..9293e0b7f6 100644
--- a/engines/ags/engine/debugging/filebasedagsdebugger.cpp
+++ b/engines/ags/engine/debugging/filebasedagsdebugger.cpp
@@ -35,7 +35,7 @@ namespace AGS3 {
using AGS::Shared::Stream;
using AGS::Shared::TextStreamWriter;
-const char *SENT_MESSAGE_FILE_NAME = "dbgrecv.tmp";
+static const char *SENT_MESSAGE_FILE_NAME = "dbgrecv.tmp";
static bool exists(const char *filename) {
Common::InSaveFile *save = g_system->getSavefileManager()->openForLoading(filename);
diff --git a/engines/ags/engine/debugging/filebasedagsdebugger.h b/engines/ags/engine/debugging/filebasedagsdebugger.h
index eae9a7aa91..c42294d143 100644
--- a/engines/ags/engine/debugging/filebasedagsdebugger.h
+++ b/engines/ags/engine/debugging/filebasedagsdebugger.h
@@ -29,7 +29,6 @@ namespace AGS3 {
struct FileBasedAGSDebugger : IAGSEditorDebugger {
public:
-
bool Initialize() override;
void Shutdown() override;
bool SendMessageToEditor(const char *message) override;
@@ -38,8 +37,6 @@ public:
};
-extern const char *SENT_MESSAGE_FILE_NAME;
-
} // namespace AGS3
#endif
diff --git a/engines/ags/engine/device/mousew32.cpp b/engines/ags/engine/device/mousew32.cpp
index 0144478480..9eb8c63a64 100644
--- a/engines/ags/engine/device/mousew32.cpp
+++ b/engines/ags/engine/device/mousew32.cpp
@@ -70,8 +70,6 @@ enum {
NONE = -1, LEFT = 0, RIGHT = 1, MIDDLE = 2
};
-extern char lib_file_name[13];
-
static const int MB_ARRAY[3] = { 1, 2, 4 };
void mgraphconfine(int x1, int y1, int x2, int y2) {
diff --git a/engines/ags/shared/core/asset.cpp b/engines/ags/shared/core/asset.cpp
index 7cb05ed89d..a1cbae5a26 100644
--- a/engines/ags/shared/core/asset.cpp
+++ b/engines/ags/shared/core/asset.cpp
@@ -31,6 +31,7 @@ AssetInfo::AssetInfo()
, Offset(0)
, Size(0) {
}
+
void AssetLibInfo::Unload() {
BaseFileName = "";
BaseFilePath = "";
diff --git a/engines/ags/shared/core/assetmanager.cpp b/engines/ags/shared/core/assetmanager.cpp
index 337da1c1e0..7b504ed048 100644
--- a/engines/ags/shared/core/assetmanager.cpp
+++ b/engines/ags/shared/core/assetmanager.cpp
@@ -30,14 +30,13 @@ namespace AGS3 {
namespace AGS {
namespace Shared {
+AssetManager *AssetManager::_theAssetManager = nullptr;
+
AssetLocation::AssetLocation()
: Offset(0)
, Size(0) {
}
-
-AssetManager *AssetManager::_theAssetManager = nullptr;
-
/* static */ bool AssetManager::CreateInstance() {
// Issue a warning - recreating asset manager is not a normal behavior
assert(_theAssetManager == NULL);
diff --git a/engines/ags/shared/gui/guilistbox.cpp b/engines/ags/shared/gui/guilistbox.cpp
index 2d653c8663..70ce1c28ca 100644
--- a/engines/ags/shared/gui/guilistbox.cpp
+++ b/engines/ags/shared/gui/guilistbox.cpp
@@ -28,7 +28,6 @@
#include "ags/globals.h"
namespace AGS3 {
-
namespace AGS {
namespace Shared {
diff --git a/engines/ags/shared/gui/guislider.cpp b/engines/ags/shared/gui/guislider.cpp
index b4d9c3cdab..89f56c5d39 100644
--- a/engines/ags/shared/gui/guislider.cpp
+++ b/engines/ags/shared/gui/guislider.cpp
@@ -27,7 +27,6 @@
#include "ags/globals.h"
namespace AGS3 {
-
namespace AGS {
namespace Shared {
Commit: 3e3d4e909734559f49f4e868aa07b5f83ca13b7b
https://github.com/scummvm/scummvm/commit/3e3d4e909734559f49f4e868aa07b5f83ca13b7b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-03-13T21:34:56-08:00
Commit Message:
AGS: Move stand-alone methods from ags.cpp to their own file
Changed paths:
A engines/ags/engine/main/main.cpp
engines/ags/ags.cpp
engines/ags/engine/main/main.h
engines/ags/engine/main/quit.h
engines/ags/module.mk
diff --git a/engines/ags/ags.cpp b/engines/ags/ags.cpp
index 29cbe35097..ff5f313301 100644
--- a/engines/ags/ags.cpp
+++ b/engines/ags/ags.cpp
@@ -51,228 +51,21 @@
#include "ags/engine/main/engine.h"
#include "ags/engine/main/mainheader.h"
#include "ags/engine/main/main.h"
+#include "ags/engine/main/quit.h"
#include "ags/engine/platform/base/agsplatformdriver.h"
#include "ags/engine/script/script.h"
#include "ags/engine/ac/route_finder.h"
#include "ags/shared/core/assetmanager.h"
#include "ags/shared/util/directory.h"
-#include "ags/shared/util/path.h"
#ifdef ENABLE_AGS_TESTS
#include "ags/tests/test_all.h"
#endif
-namespace AGS3 {
-
-using namespace Shared;
-using namespace Engine;
-
-extern HSaveError load_game(int slotNumber, bool &data_overwritten);
-
-// this needs to be updated if the "play" struct changes
-#define SVG_VERSION_BWCOMPAT_MAJOR 3
-#define SVG_VERSION_BWCOMPAT_MINOR 2
-#define SVG_VERSION_BWCOMPAT_RELEASE 0
-#define SVG_VERSION_BWCOMPAT_REVISION 1103
-// CHECKME: we may lower this down, if we find that earlier versions may still
-// load new savedgames
-#define SVG_VERSION_FWCOMPAT_MAJOR 3
-#define SVG_VERSION_FWCOMPAT_MINOR 2
-#define SVG_VERSION_FWCOMPAT_RELEASE 1
-#define SVG_VERSION_FWCOMPAT_REVISION 1111
-
-extern void quit_free();
-
-void main_pre_init() {
- _G(our_eip) = -999;
- Shared::AssetManager::SetSearchPriority(Shared::kAssetPriorityDir);
- _GP(play).takeover_data = 0;
-}
-
-void main_create_platform_driver() {
- _G(platform) = AGSPlatformDriver::GetDriver();
-}
-
-void main_init(int argc, const char *argv[]) {
- _G(EngineVersion) = Version(ACI_VERSION_STR " " SPECIAL_VERSION);
-
- _G(SavedgameLowestBackwardCompatVersion) = Version(SVG_VERSION_BWCOMPAT_MAJOR, SVG_VERSION_BWCOMPAT_MINOR, SVG_VERSION_BWCOMPAT_RELEASE, SVG_VERSION_BWCOMPAT_REVISION);
- _G(SavedgameLowestForwardCompatVersion) = Version(SVG_VERSION_FWCOMPAT_MAJOR, SVG_VERSION_FWCOMPAT_MINOR, SVG_VERSION_FWCOMPAT_RELEASE, SVG_VERSION_FWCOMPAT_REVISION);
-
- Shared::AssetManager::CreateInstance();
- main_pre_init();
- main_create_platform_driver();
-
- _G(global_argv) = argv;
- _G(global_argc) = argc;
-}
-
-String get_engine_string() {
- return String::FromFormat("Adventure Game Studio v%s Interpreter\n"
- "ACI version %s\n", _G(EngineVersion).ShortString.GetCStr(), _G(EngineVersion).LongString.GetCStr());
-}
-
-void main_print_help() {
- // No implementation
-}
-
-static int main_process_cmdline(ConfigTree &cfg, int argc, const char *argv[]) {
- int datafile_argv = 0;
- for (int ee = 1; ee < argc; ++ee) {
- const char *arg = argv[ee];
- //
- // Startup options
- //
- if (scumm_stricmp(arg, "--help") == 0 || scumm_stricmp(arg, "/?") == 0 || scumm_stricmp(arg, "-?") == 0) {
- _G(justDisplayHelp) = true;
- return 0;
- }
- if (scumm_stricmp(arg, "-v") == 0 || scumm_stricmp(arg, "--version") == 0) {
- _G(justDisplayVersion) = true;
- return 0;
- } else if (scumm_stricmp(arg, "-updatereg") == 0)
- _G(debug_flags) |= DBG_REGONLY;
-#if AGS_PLATFORM_DEBUG
- else if ((scumm_stricmp(arg, "--startr") == 0) && (ee < argc - 1)) {
- _G(override_start_room) = atoi(argv[ee + 1]);
- ee++;
- }
-#endif
- else if ((scumm_stricmp(arg, "--testre") == 0) && (ee < argc - 2)) {
- strncpy(_G(return_to_roomedit), argv[ee + 1], 30);
- strncpy(_G(return_to_room), argv[ee + 2], 150);
- ee += 2;
- } else if (scumm_stricmp(arg, "-noexceptionhandler") == 0) _GP(usetup).disable_exception_handling = true;
- else if (scumm_stricmp(arg, "--setup") == 0) {
- _G(justRunSetup) = true;
- } else if (scumm_stricmp(arg, "-registergame") == 0) {
- _G(justRegisterGame) = true;
- } else if (scumm_stricmp(arg, "-unregistergame") == 0) {
- _G(justUnRegisterGame) = true;
- } else if ((scumm_stricmp(arg, "-loadsavedgame") == 0) && (argc > ee + 1)) {
- _G(loadSaveGameOnStartup) = atoi(argv[ee + 1]);
- ee++;
- } else if ((scumm_stricmp(arg, "--enabledebugger") == 0) && (argc > ee + 1)) {
- strcpy(_G(editor_debugger_instance_token), argv[ee + 1]);
- _G(editor_debugging_enabled) = 1;
- _G(force_window) = 1;
- ee++;
- } else if (scumm_stricmp(arg, "--runfromide") == 0 && (argc > ee + 3)) {
- _GP(usetup).install_dir = argv[ee + 1];
- _GP(usetup).install_audio_dir = argv[ee + 2];
- _GP(usetup).install_voice_dir = argv[ee + 3];
- ee += 3;
- } else if (scumm_stricmp(arg, "--takeover") == 0) {
- if (argc < ee + 2)
- break;
- _GP(play).takeover_data = atoi(argv[ee + 1]);
- strncpy(_GP(play).takeover_from, argv[ee + 2], 49);
- _GP(play).takeover_from[49] = 0;
- ee += 2;
- } else if (scumm_strnicmp(arg, "--tell", 6) == 0) {
- if (arg[6] == 0)
- _G(tellInfoKeys).insert(String("all"));
- else if (arg[6] == '-' && arg[7] != 0)
- _G(tellInfoKeys).insert(String(arg + 7));
- }
- //
- // Config overrides
- //
- else if (scumm_stricmp(arg, "-windowed") == 0 || scumm_stricmp(arg, "--windowed") == 0)
- _G(force_window) = 1;
- else if (scumm_stricmp(arg, "-fullscreen") == 0 || scumm_stricmp(arg, "--fullscreen") == 0)
- _G(force_window) = 2;
- else if ((scumm_stricmp(arg, "-gfxdriver") == 0 || scumm_stricmp(arg, "--gfxdriver") == 0) && (argc > ee + 1)) {
- INIwritestring(cfg, "graphics", "driver", argv[++ee]);
- } else if ((scumm_stricmp(arg, "-gfxfilter") == 0 || scumm_stricmp(arg, "--gfxfilter") == 0) && (argc > ee + 1)) {
- // NOTE: we make an assumption here that if user provides scaling factor,
- // this factor means to be applied to windowed mode only.
- INIwritestring(cfg, "graphics", "filter", argv[++ee]);
- if (argc > ee + 1 && argv[ee + 1][0] != '-')
- INIwritestring(cfg, "graphics", "game_scale_win", argv[++ee]);
- else
- INIwritestring(cfg, "graphics", "game_scale_win", "max_round");
- } else if (scumm_stricmp(arg, "--fps") == 0) _G(display_fps) = kFPS_Forced;
- else if (scumm_stricmp(arg, "--test") == 0) _G(debug_flags) |= DBG_DEBUGMODE;
- else if (scumm_stricmp(arg, "-noiface") == 0) _G(debug_flags) |= DBG_NOIFACE;
- else if (scumm_stricmp(arg, "-nosprdisp") == 0) _G(debug_flags) |= DBG_NODRAWSPRITES;
- else if (scumm_stricmp(arg, "-nospr") == 0) _G(debug_flags) |= DBG_NOOBJECTS;
- else if (scumm_stricmp(arg, "-noupdate") == 0) _G(debug_flags) |= DBG_NOUPDATE;
- else if (scumm_stricmp(arg, "-nosound") == 0) _G(debug_flags) |= DBG_NOSFX;
- else if (scumm_stricmp(arg, "-nomusic") == 0) _G(debug_flags) |= DBG_NOMUSIC;
- else if (scumm_stricmp(arg, "-noscript") == 0) _G(debug_flags) |= DBG_NOSCRIPT;
- else if (scumm_stricmp(arg, "-novideo") == 0) _G(debug_flags) |= DBG_NOVIDEO;
- else if (scumm_stricmp(arg, "-dbgscript") == 0) _G(debug_flags) |= DBG_DBGSCRIPT;
- else if (scumm_stricmp(arg, "--log") == 0) INIwriteint(cfg, "misc", "log", 1);
- else if (scumm_stricmp(arg, "--no-log") == 0) INIwriteint(cfg, "misc", "log", 0);
- //
- // Special case: data file location
- //
- else if (arg[0] != '-') datafile_argv = ee;
- }
-
- if (datafile_argv > 0) {
- _G(cmdGameDataPath) = argv[datafile_argv];
- } else {
- // assign standard path for mobile/consoles (defined in their own platform implementation)
- _G(cmdGameDataPath) = _G(psp_game_file_name);
- }
-
- if (!_G(tellInfoKeys).empty())
- _G(justTellInfo) = true;
-
- return 0;
-}
-
-void main_set_gamedir(int argc, const char *argv[]) {
- _G(appDirectory) = Path::GetDirectoryPath("./");
-#ifdef DEPRECATED
- if ((_G(loadSaveGameOnStartup) != nullptr) && (argv[0] != nullptr)) {
- // When launched by double-clicking a save game file, the curdir will
- // be the save game folder unless we correct it
- Directory::SetCurrentDirectory(_G(appDirectory));
- } else {
- // It looks like Allegro library does not like ANSI (ACP) paths.
- // When *not* working in U_UNICODE filepath mode, whenever it gets
- // current directory for its own operations, it "fixes" it by
- // substituting non-ASCII symbols with '^'.
- // Here we explicitly set current directory to ASCII path.
- String cur_dir = Directory::GetCurrentDirectory();
- String path = Path::GetPathInASCII(cur_dir);
- if (!path.IsEmpty())
- Directory::SetCurrentDirectory(Path::MakeAbsolutePath(path));
- else
- Debug::Printf(kDbgMsg_Error, "Unable to determine current directory: GetPathInASCII failed.\nArg: %s", cur_dir.GetCStr());
- }
-#endif
-}
-
-const char *get_allegro_error() {
- return "ERROR"; // allegro_error;
-}
-
-#define ALLEGRO_ERROR_SIZE 256
-char allegro_error[ALLEGRO_ERROR_SIZE];
-
-const char *set_allegro_error(const char *format, ...) {
- va_list argptr;
- va_start(argptr, format);
- Common::String msg = Common::String::format(format, argptr);
- strncpy(allegro_error, msg.c_str(), ALLEGRO_ERROR_SIZE - 1);
- allegro_error[ALLEGRO_ERROR_SIZE - 1] = '\0';
-
- va_end(argptr);
- return allegro_error;
-}
-
-} // namespace AGS3
-
namespace AGS {
AGSEngine *g_vm;
-/*------------------------------------------------------------------*/
-
AGSEngine::AGSEngine(OSystem *syst, const AGSGameDescription *gameDesc) : Engine(syst),
_gameDescription(gameDesc), _randomSource("AGS"), _events(nullptr), _music(nullptr),
_rawScreen(nullptr), _screen(nullptr), _gfxDriver(nullptr),
@@ -356,7 +149,7 @@ Common::Error AGSEngine::run() {
if (!_G(justTellInfo))
_G(platform)->SetGUIMode(true);
AGS3::init_debug(startup_opts, _G(justTellInfo));
- AGS3::Debug::Printf("%s", AGS3::get_engine_string().GetNullableCStr());
+ AGS3::AGS::Shared::Debug::Printf("%s", AGS3::get_engine_string().GetNullableCStr());
AGS3::main_set_gamedir(ARGC, ARGV);
diff --git a/engines/ags/engine/main/main.cpp b/engines/ags/engine/main/main.cpp
new file mode 100644
index 0000000000..c4b36d5d25
--- /dev/null
+++ b/engines/ags/engine/main/main.cpp
@@ -0,0 +1,261 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+/*
+#include "ags/ags.h"
+#include "ags/detection.h"
+#include "ags/events.h"
+#include "ags/game_scanner.h"
+#include "ags/music.h"
+#include "common/scummsys.h"
+#include "common/config-manager.h"
+#include "common/debug-channels.h"
+#include "common/events.h"
+#include "common/file.h"
+#include "engines/util.h"
+*/
+#include "ags/shared/core/platform.h"
+#include "ags/lib/std/set.h"
+#include "ags/shared/ac/common.h"
+#include "ags/engine/ac/game.h"
+#include "ags/globals.h"
+#include "ags/engine/ac/gamesetup.h"
+#include "ags/engine/ac/gamestate.h"
+#include "ags/engine/ac/room.h"
+#include "ags/shared/core/def_version.h"
+#include "ags/engine/debugging/debugger.h"
+#include "ags/engine/debugging/debug_log.h"
+#include "ags/shared/debugging/out.h"
+#include "ags/engine/game/savegame.h"
+#include "ags/engine/main/config.h"
+#include "ags/engine/main/engine.h"
+#include "ags/engine/main/mainheader.h"
+#include "ags/engine/main/main.h"
+#include "ags/engine/platform/base/agsplatformdriver.h"
+#include "ags/engine/script/script.h"
+#include "ags/engine/ac/route_finder.h"
+#include "ags/shared/core/assetmanager.h"
+#include "ags/shared/util/directory.h"
+#include "ags/shared/util/path.h"
+
+namespace AGS3 {
+
+using namespace Shared;
+using namespace Engine;
+
+extern HSaveError load_game(int slotNumber, bool &data_overwritten);
+
+// this needs to be updated if the "play" struct changes
+#define SVG_VERSION_BWCOMPAT_MAJOR 3
+#define SVG_VERSION_BWCOMPAT_MINOR 2
+#define SVG_VERSION_BWCOMPAT_RELEASE 0
+#define SVG_VERSION_BWCOMPAT_REVISION 1103
+// CHECKME: we may lower this down, if we find that earlier versions may still
+// load new savedgames
+#define SVG_VERSION_FWCOMPAT_MAJOR 3
+#define SVG_VERSION_FWCOMPAT_MINOR 2
+#define SVG_VERSION_FWCOMPAT_RELEASE 1
+#define SVG_VERSION_FWCOMPAT_REVISION 1111
+
+void main_pre_init() {
+ _G(our_eip) = -999;
+ Shared::AssetManager::SetSearchPriority(Shared::kAssetPriorityDir);
+ _GP(play).takeover_data = 0;
+}
+
+void main_create_platform_driver() {
+ _G(platform) = AGSPlatformDriver::GetDriver();
+}
+
+void main_init(int argc, const char *argv[]) {
+ _G(EngineVersion) = Version(ACI_VERSION_STR " " SPECIAL_VERSION);
+
+ _G(SavedgameLowestBackwardCompatVersion) = Version(SVG_VERSION_BWCOMPAT_MAJOR, SVG_VERSION_BWCOMPAT_MINOR, SVG_VERSION_BWCOMPAT_RELEASE, SVG_VERSION_BWCOMPAT_REVISION);
+ _G(SavedgameLowestForwardCompatVersion) = Version(SVG_VERSION_FWCOMPAT_MAJOR, SVG_VERSION_FWCOMPAT_MINOR, SVG_VERSION_FWCOMPAT_RELEASE, SVG_VERSION_FWCOMPAT_REVISION);
+
+ Shared::AssetManager::CreateInstance();
+ main_pre_init();
+ main_create_platform_driver();
+
+ _G(global_argv) = argv;
+ _G(global_argc) = argc;
+}
+
+String get_engine_string() {
+ return String::FromFormat("Adventure Game Studio v%s Interpreter\n"
+ "ACI version %s\n", _G(EngineVersion).ShortString.GetCStr(), _G(EngineVersion).LongString.GetCStr());
+}
+
+void main_print_help() {
+ // No implementation
+}
+
+int main_process_cmdline(ConfigTree &cfg, int argc, const char *argv[]) {
+ int datafile_argv = 0;
+ for (int ee = 1; ee < argc; ++ee) {
+ const char *arg = argv[ee];
+ //
+ // Startup options
+ //
+ if (scumm_stricmp(arg, "--help") == 0 || scumm_stricmp(arg, "/?") == 0 || scumm_stricmp(arg, "-?") == 0) {
+ _G(justDisplayHelp) = true;
+ return 0;
+ }
+ if (scumm_stricmp(arg, "-v") == 0 || scumm_stricmp(arg, "--version") == 0) {
+ _G(justDisplayVersion) = true;
+ return 0;
+ } else if (scumm_stricmp(arg, "-updatereg") == 0)
+ _G(debug_flags) |= DBG_REGONLY;
+#if AGS_PLATFORM_DEBUG
+ else if ((scumm_stricmp(arg, "--startr") == 0) && (ee < argc - 1)) {
+ _G(override_start_room) = atoi(argv[ee + 1]);
+ ee++;
+ }
+#endif
+ else if ((scumm_stricmp(arg, "--testre") == 0) && (ee < argc - 2)) {
+ strncpy(_G(return_to_roomedit), argv[ee + 1], 30);
+ strncpy(_G(return_to_room), argv[ee + 2], 150);
+ ee += 2;
+ } else if (scumm_stricmp(arg, "-noexceptionhandler") == 0) _GP(usetup).disable_exception_handling = true;
+ else if (scumm_stricmp(arg, "--setup") == 0) {
+ _G(justRunSetup) = true;
+ } else if (scumm_stricmp(arg, "-registergame") == 0) {
+ _G(justRegisterGame) = true;
+ } else if (scumm_stricmp(arg, "-unregistergame") == 0) {
+ _G(justUnRegisterGame) = true;
+ } else if ((scumm_stricmp(arg, "-loadsavedgame") == 0) && (argc > ee + 1)) {
+ _G(loadSaveGameOnStartup) = atoi(argv[ee + 1]);
+ ee++;
+ } else if ((scumm_stricmp(arg, "--enabledebugger") == 0) && (argc > ee + 1)) {
+ strcpy(_G(editor_debugger_instance_token), argv[ee + 1]);
+ _G(editor_debugging_enabled) = 1;
+ _G(force_window) = 1;
+ ee++;
+ } else if (scumm_stricmp(arg, "--runfromide") == 0 && (argc > ee + 3)) {
+ _GP(usetup).install_dir = argv[ee + 1];
+ _GP(usetup).install_audio_dir = argv[ee + 2];
+ _GP(usetup).install_voice_dir = argv[ee + 3];
+ ee += 3;
+ } else if (scumm_stricmp(arg, "--takeover") == 0) {
+ if (argc < ee + 2)
+ break;
+ _GP(play).takeover_data = atoi(argv[ee + 1]);
+ strncpy(_GP(play).takeover_from, argv[ee + 2], 49);
+ _GP(play).takeover_from[49] = 0;
+ ee += 2;
+ } else if (scumm_strnicmp(arg, "--tell", 6) == 0) {
+ if (arg[6] == 0)
+ _G(tellInfoKeys).insert(String("all"));
+ else if (arg[6] == '-' && arg[7] != 0)
+ _G(tellInfoKeys).insert(String(arg + 7));
+ }
+ //
+ // Config overrides
+ //
+ else if (scumm_stricmp(arg, "-windowed") == 0 || scumm_stricmp(arg, "--windowed") == 0)
+ _G(force_window) = 1;
+ else if (scumm_stricmp(arg, "-fullscreen") == 0 || scumm_stricmp(arg, "--fullscreen") == 0)
+ _G(force_window) = 2;
+ else if ((scumm_stricmp(arg, "-gfxdriver") == 0 || scumm_stricmp(arg, "--gfxdriver") == 0) && (argc > ee + 1)) {
+ INIwritestring(cfg, "graphics", "driver", argv[++ee]);
+ } else if ((scumm_stricmp(arg, "-gfxfilter") == 0 || scumm_stricmp(arg, "--gfxfilter") == 0) && (argc > ee + 1)) {
+ // NOTE: we make an assumption here that if user provides scaling factor,
+ // this factor means to be applied to windowed mode only.
+ INIwritestring(cfg, "graphics", "filter", argv[++ee]);
+ if (argc > ee + 1 && argv[ee + 1][0] != '-')
+ INIwritestring(cfg, "graphics", "game_scale_win", argv[++ee]);
+ else
+ INIwritestring(cfg, "graphics", "game_scale_win", "max_round");
+ } else if (scumm_stricmp(arg, "--fps") == 0) _G(display_fps) = kFPS_Forced;
+ else if (scumm_stricmp(arg, "--test") == 0) _G(debug_flags) |= DBG_DEBUGMODE;
+ else if (scumm_stricmp(arg, "-noiface") == 0) _G(debug_flags) |= DBG_NOIFACE;
+ else if (scumm_stricmp(arg, "-nosprdisp") == 0) _G(debug_flags) |= DBG_NODRAWSPRITES;
+ else if (scumm_stricmp(arg, "-nospr") == 0) _G(debug_flags) |= DBG_NOOBJECTS;
+ else if (scumm_stricmp(arg, "-noupdate") == 0) _G(debug_flags) |= DBG_NOUPDATE;
+ else if (scumm_stricmp(arg, "-nosound") == 0) _G(debug_flags) |= DBG_NOSFX;
+ else if (scumm_stricmp(arg, "-nomusic") == 0) _G(debug_flags) |= DBG_NOMUSIC;
+ else if (scumm_stricmp(arg, "-noscript") == 0) _G(debug_flags) |= DBG_NOSCRIPT;
+ else if (scumm_stricmp(arg, "-novideo") == 0) _G(debug_flags) |= DBG_NOVIDEO;
+ else if (scumm_stricmp(arg, "-dbgscript") == 0) _G(debug_flags) |= DBG_DBGSCRIPT;
+ else if (scumm_stricmp(arg, "--log") == 0) INIwriteint(cfg, "misc", "log", 1);
+ else if (scumm_stricmp(arg, "--no-log") == 0) INIwriteint(cfg, "misc", "log", 0);
+ //
+ // Special case: data file location
+ //
+ else if (arg[0] != '-') datafile_argv = ee;
+ }
+
+ if (datafile_argv > 0) {
+ _G(cmdGameDataPath) = argv[datafile_argv];
+ } else {
+ // assign standard path for mobile/consoles (defined in their own platform implementation)
+ _G(cmdGameDataPath) = _G(psp_game_file_name);
+ }
+
+ if (!_G(tellInfoKeys).empty())
+ _G(justTellInfo) = true;
+
+ return 0;
+}
+
+void main_set_gamedir(int argc, const char *argv[]) {
+ _G(appDirectory) = Path::GetDirectoryPath("./");
+#ifdef DEPRECATED
+ if ((_G(loadSaveGameOnStartup) != nullptr) && (argv[0] != nullptr)) {
+ // When launched by double-clicking a save game file, the curdir will
+ // be the save game folder unless we correct it
+ Directory::SetCurrentDirectory(_G(appDirectory));
+ } else {
+ // It looks like Allegro library does not like ANSI (ACP) paths.
+ // When *not* working in U_UNICODE filepath mode, whenever it gets
+ // current directory for its own operations, it "fixes" it by
+ // substituting non-ASCII symbols with '^'.
+ // Here we explicitly set current directory to ASCII path.
+ String cur_dir = Directory::GetCurrentDirectory();
+ String path = Path::GetPathInASCII(cur_dir);
+ if (!path.IsEmpty())
+ Directory::SetCurrentDirectory(Path::MakeAbsolutePath(path));
+ else
+ Debug::Printf(kDbgMsg_Error, "Unable to determine current directory: GetPathInASCII failed.\nArg: %s", cur_dir.GetCStr());
+ }
+#endif
+}
+
+const char *get_allegro_error() {
+ return "ERROR"; // allegro_error;
+}
+
+#define ALLEGRO_ERROR_SIZE 256
+char allegro_error[ALLEGRO_ERROR_SIZE];
+
+const char *set_allegro_error(const char *format, ...) {
+ va_list argptr;
+ va_start(argptr, format);
+ Common::String msg = Common::String::format(format, argptr);
+ strncpy(allegro_error, msg.c_str(), ALLEGRO_ERROR_SIZE - 1);
+ allegro_error[ALLEGRO_ERROR_SIZE - 1] = '\0';
+
+ va_end(argptr);
+ return allegro_error;
+}
+
+} // namespace AGS3
diff --git a/engines/ags/engine/main/main.h b/engines/ags/engine/main/main.h
index 29e4e44765..0da5e2ca70 100644
--- a/engines/ags/engine/main/main.h
+++ b/engines/ags/engine/main/main.h
@@ -25,15 +25,28 @@
#include "ags/shared/core/platform.h"
#include "ags/shared/util/version.h"
+#include "ags/shared/util/ini_util.h"
+#include "ags/shared/util/string.h"
namespace AGS3 {
+using AGS::Shared::ConfigTree;
+using AGS::Shared::String;
+
//=============================================================================
void main_print_help();
int ags_entry_point(int argc, char *argv[]);
+extern void main_init(int argc, const char *argv[]);
+
+extern int main_process_cmdline(ConfigTree &cfg, int argc, const char *argv[]);
+
+extern String get_engine_string();
+
+extern void main_set_gamedir(int argc, const char *argv[]);
+
} // namespace AGS3
#endif
diff --git a/engines/ags/engine/main/quit.h b/engines/ags/engine/main/quit.h
index 849173f814..5b9112cd4f 100644
--- a/engines/ags/engine/main/quit.h
+++ b/engines/ags/engine/main/quit.h
@@ -48,6 +48,8 @@ enum QuitReason {
kQuit_FatalError = kQuitKind_EngineException
};
+extern void quit_free();
+
} // namespace AGS3
#endif
diff --git a/engines/ags/module.mk b/engines/ags/module.mk
index 979348db6b..b6375cb7cc 100644
--- a/engines/ags/module.mk
+++ b/engines/ags/module.mk
@@ -261,6 +261,7 @@ MODULE_OBJS = \
engine/main/game_run.o \
engine/main/game_start.o \
engine/main/graphics_mode.o \
+ engine/main/main.o \
engine/main/quit.o \
engine/main/update.o \
engine/media/audio/ambientsound.o \
Commit: ddfb81d715649209ee63ae68868aa156b27e9211
https://github.com/scummvm/scummvm/commit/ddfb81d715649209ee63ae68868aa156b27e9211
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-03-13T21:34:56-08:00
Commit Message:
AGS: Enable return to launcher
Changed paths:
engines/ags/ags.h
engines/ags/events.cpp
diff --git a/engines/ags/ags.h b/engines/ags/ags.h
index 28363d3f42..5e78d8c32f 100644
--- a/engines/ags/ags.h
+++ b/engines/ags/ags.h
@@ -119,7 +119,8 @@ public:
bool hasFeature(EngineFeature f) const override {
return
(f == kSupportsLoadingDuringRuntime) ||
- (f == kSupportsSavingDuringRuntime);
+ (f == kSupportsSavingDuringRuntime) ||
+ (f == kSupportsReturnToLauncher);
};
/**
diff --git a/engines/ags/events.cpp b/engines/ags/events.cpp
index d47b594b08..51df1dbcf9 100644
--- a/engines/ags/events.cpp
+++ b/engines/ags/events.cpp
@@ -41,7 +41,7 @@ void EventsManager::pollEvents() {
Common::Event e;
while (g_system->getEventManager()->pollEvent(e)) {
- if (e.type == Common::EVENT_QUIT) {
+ if (e.type == Common::EVENT_QUIT || e.type == Common::EVENT_RETURN_TO_LAUNCHER) {
_G(want_exit) = true;
_G(abort_engine) = true;
_G(check_dynamic_sprites_at_exit) = false;
Commit: e793a2d3bfe70ae06a746fa8bb3788ae78d1ac81
https://github.com/scummvm/scummvm/commit/e793a2d3bfe70ae06a746fa8bb3788ae78d1ac81
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-03-13T21:34:56-08:00
Commit Message:
AGS: Remove duplicate detection entry for Shivah
Changed paths:
engines/ags/detection_tables.h
diff --git a/engines/ags/detection_tables.h b/engines/ags/detection_tables.h
index 8da5e26a7b..e644ea3fab 100644
--- a/engines/ags/detection_tables.h
+++ b/engines/ags/detection_tables.h
@@ -1731,13 +1731,12 @@ const AGSGameDescription GAME_DESCRIPTIONS[] = {
GAME_ENTRY("shardlight", "shardlight.exe", "ee801fba52d252249677a9170bd2db96", 642157876), // Steam
GAME_ENTRY("shardlight", "shardlight.exe", "ee801fba52d252249677a9170bd2db96", 642151325),
GAME_ENTRY("shivah", "shivah.exe", "6cddccb3744ec5c6af7c398fb7b3b11c", 19542815), // Official website
- GAME_ENTRY("shivah", "shivah.exe", "0aaf5445a3544a631d6e7dd4561fc7ae", 32319665),
GAME_ENTRY("shivah", "shivah.exe", "0aaf5445a3544a631d6e7dd4561fc7ae", 32323040), // Steam
GAME_ENTRY("shivah", "ac2game.dat", "0aaf5445a3544a631d6e7dd4561fc7ae", 32323040), // Steam
GAME_ENTRY("shivah", "ac2game.dat", "0aaf5445a3544a631d6e7dd4561fc7ae", 32339699), // Android
GAME_ENTRY("shivah", "ac2game.dat", "ec0019b528dd1e9bcb4264967c4a3a31", 30446404), // Linux Humble Bundle
GAME_ENTRY("shivah", "ac2game.dat", "bdc618b23fc279938f05f8ac058a938b", 32723739), // MacOS
- GAME_ENTRY("shivah", "shivah.exe", "0aaf5445a3544a631d6e7dd4561fc7ae", 32319665), // Windows Humble Bundle
+ GAME_ENTRY("shivah", "shivah.exe", "0aaf5445a3544a631d6e7dd4561fc7ae", 32319665), // Windows GOG, Humble Bundle
GAME_ENTRY("sumatra", "sumatra fate of yandi.exe", "57c868b1a81c0335ab60970292cd79d8", 170088886), // Steam
GAME_ENTRY("superjazzman", "sjm.exe", "0710e2ec71042617f565c01824f0cf3c", 10841689), // Official website
GAME_ENTRY("tales", "tales.exe", "4f6c7ec127e8b0ce077abb357903612f", 112930701),
More information about the Scummvm-git-logs
mailing list