diff options
Diffstat (limited to 'backends/platform/dc')
-rw-r--r-- | backends/platform/dc/README | 6 | ||||
-rw-r--r-- | backends/platform/dc/dc-fs.cpp | 1 | ||||
-rw-r--r-- | backends/platform/dc/dcloader.cpp | 7 | ||||
-rw-r--r-- | backends/platform/dc/dcloader.h | 2 | ||||
-rw-r--r-- | backends/platform/dc/dreamcast.mk | 9 | ||||
-rw-r--r-- | backends/platform/dc/plugin.syms | 1 | ||||
-rw-r--r-- | backends/platform/dc/plugin.x | 1 | ||||
-rw-r--r-- | backends/platform/dc/vmsave.cpp | 51 |
8 files changed, 60 insertions, 18 deletions
diff --git a/backends/platform/dc/README b/backends/platform/dc/README index e26df500e8..3524f57bac 100644 --- a/backends/platform/dc/README +++ b/backends/platform/dc/README @@ -4,13 +4,13 @@ Compiling ScummVM for SEGA Dreamcast If you want to compile ScummVM for your Dreamcast, you'll need the following: -* gcc-3.4.2 configured as a cross-compiler for `sh-elf' +* gcc-4.6.3 configured as a cross-compiler for `sh-elf' * binutils-2.18 configured likewise -* newlib for sh-elf : <URL:http://mc.pp.se/dc/files/newlib-1.12.0.tar.gz> +* newlib for sh-elf : <URL:http://mc.pp.se/dc/files/newlib-1.19.0.tar.gz> -* libronin-0.5 : <URL:http://peter.bortas.org/scumm/libronin-0.5.tar.gz> +* libronin-0.6 : <URL:http://peter.bortas.org/scumm/libronin-0.6.tar.gz> * libmad : <URL:http://mc.pp.se/dc/files/libmad-0.15.1b.tar.gz> diff --git a/backends/platform/dc/dc-fs.cpp b/backends/platform/dc/dc-fs.cpp index 77fe4143dd..4bd7e5a777 100644 --- a/backends/platform/dc/dc-fs.cpp +++ b/backends/platform/dc/dc-fs.cpp @@ -57,6 +57,7 @@ public: virtual Common::SeekableReadStream *createReadStream(); virtual Common::WriteStream *createWriteStream() { return 0; } + virtual bool create(bool isDirectory) { return false; } static AbstractFSNode *makeFileNodePath(const Common::String &path); }; diff --git a/backends/platform/dc/dcloader.cpp b/backends/platform/dc/dcloader.cpp index bc5e3a733b..2627773b13 100644 --- a/backends/platform/dc/dcloader.cpp +++ b/backends/platform/dc/dcloader.cpp @@ -26,6 +26,8 @@ #include "dcloader.h" +#include <cxxabi.h> + #ifdef DL_DEBUG #define DBG(x) reportf x #else @@ -345,6 +347,7 @@ bool DLObject::open(const char *path) ctors_end = symbol("__plugin_ctors_end"); dtors_start = symbol("__plugin_dtors"); dtors_end = symbol("__plugin_dtors_end"); + dso_handle = symbol("__dso_handle"); if (ctors_start == NULL || ctors_end == NULL || dtors_start == NULL || dtors_end == NULL) { @@ -364,6 +367,10 @@ bool DLObject::open(const char *path) bool DLObject::close() { + if (dso_handle != NULL) { + __cxxabiv1::__cxa_finalize(dso_handle); + dso_handle = NULL; + } if (dtors_start != NULL && dtors_end != NULL) for (void (**f)(void) = (void (**)(void))dtors_start; f != dtors_end; f++) (**f)(); diff --git a/backends/platform/dc/dcloader.h b/backends/platform/dc/dcloader.h index 074ae7aa29..daa2802ec4 100644 --- a/backends/platform/dc/dcloader.h +++ b/backends/platform/dc/dcloader.h @@ -34,7 +34,7 @@ class DLObject { void *segment, *symtab; char *strtab; int symbol_cnt; - void *dtors_start, *dtors_end; + void *dtors_start, *dtors_end, *dso_handle; void seterror(const char *fmt, ...); void unload(); diff --git a/backends/platform/dc/dreamcast.mk b/backends/platform/dc/dreamcast.mk index 9d8a53e25a..98b5bae087 100644 --- a/backends/platform/dc/dreamcast.mk +++ b/backends/platform/dc/dreamcast.mk @@ -6,6 +6,8 @@ ASFLAGS := $(CXXFLAGS) dist : SCUMMVM.BIN IP.BIN plugin_dist +clean : dcclean + plugin_dist : plugins @[ -z "$(PLUGINS)" ] || for p in $(or $(PLUGINS),none); do \ t="`basename \"$$p\" | LC_CTYPE=C tr '[:lower:]' '[:upper:]'`"; \ @@ -37,3 +39,10 @@ ip.txt : $(srcdir)/backends/platform/dc/ip.txt.in dcdist : dist mkdir -p dcdist/scummvm cp scummvm.elf SCUMMVM.BIN IP.BIN *.PLG dcdist/scummvm/ + +dcclean : + $(RM) backends/platform/dc/plugin_head.o + $(RM) scummvm.bin SCUMMVM.BIN ip.txt IP.BIN *.PLG + $(RM_REC) dcdist + +.PHONY: dcclean diff --git a/backends/platform/dc/plugin.syms b/backends/platform/dc/plugin.syms index 2cab08c9c7..9340ca20b8 100644 --- a/backends/platform/dc/plugin.syms +++ b/backends/platform/dc/plugin.syms @@ -6,3 +6,4 @@ ___plugin_ctors ___plugin_ctors_end ___plugin_dtors ___plugin_dtors_end +___dso_handle diff --git a/backends/platform/dc/plugin.x b/backends/platform/dc/plugin.x index 2c8469a335..039fca81cf 100644 --- a/backends/platform/dc/plugin.x +++ b/backends/platform/dc/plugin.x @@ -9,6 +9,7 @@ SECTIONS . = 0; .text : { + ___dso_handle = .; *(.text .stub .text.* .gnu.linkonce.t.*) *(.gnu.warning) } :plugin =0 diff --git a/backends/platform/dc/vmsave.cpp b/backends/platform/dc/vmsave.cpp index 75fc1ed0df..df02813b67 100644 --- a/backends/platform/dc/vmsave.cpp +++ b/backends/platform/dc/vmsave.cpp @@ -266,18 +266,19 @@ public: { return ::readSaveGame(buffer, _size, filename); } }; -class OutVMSave : public Common::OutSaveFile { +class OutVMSave : public Common::WriteStream { private: char *buffer; - int pos, size, committed; + int _pos, size, committed; char filename[16]; bool iofailed; public: uint32 write(const void *buf, uint32 cnt); + virtual int32 pos() const { return _pos; } OutVMSave(const char *_filename) - : pos(0), committed(-1), iofailed(false) + : _pos(0), committed(-1), iofailed(false) { strncpy(filename, _filename, 16); buffer = new char[size = MAX_SAVE_SIZE]; @@ -291,12 +292,34 @@ public: }; class VMSaveManager : public Common::SaveFileManager { +private: + static int nameCompare(const unsigned char *entry, const char *match) { + return !scumm_strnicmp(reinterpret_cast<const char *>(entry), match, 12); + } + public: + virtual void updateSavefilesList(Common::StringArray &lockedFiles) { + // TODO: implement this (locks files, preventing them from being listed, saved or loaded) + } - virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true) { - OutVMSave *s = new OutVMSave(filename.c_str()); - return compress ? Common::wrapCompressedWriteStream(s) : s; - } + VMSaveManager() { + vmsfs_name_compare_function = nameCompare; + } + + virtual Common::InSaveFile *openRawFile(const Common::String &filename) { + InVMSave *s = new InVMSave(); + if (s->readSaveGame(filename.c_str())) { + return s; + } else { + delete s; + return NULL; + } + } + + virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true) { + OutVMSave *s = new OutVMSave(filename.c_str()); + return new Common::OutSaveFile(compress ? Common::wrapCompressedWriteStream(s) : s); + } virtual Common::InSaveFile *openForLoading(const Common::String &filename) { InVMSave *s = new InVMSave(); @@ -320,14 +343,14 @@ void OutVMSave::finalize() extern const char *gGameName; extern Icon icon; - if (committed >= pos) + if (committed >= _pos) return; char *data = buffer; - int len = pos; + int len = _pos; vmsaveResult r = writeSaveGame(gGameName, data, len, filename, icon); - committed = pos; + committed = _pos; if (r != VMSAVE_OK) iofailed = true; displaySaveResult(r); @@ -386,13 +409,13 @@ bool InVMSave::seek(int32 offs, int whence) uint32 OutVMSave::write(const void *buf, uint32 cnt) { int nbyt = cnt; - if (pos + nbyt > size) { - cnt = (size - pos); + if (_pos + nbyt > size) { + cnt = (size - _pos); nbyt = cnt; } if (nbyt) - memcpy(buffer + pos, buf, nbyt); - pos += nbyt; + memcpy(buffer + _pos, buf, nbyt); + _pos += nbyt; return cnt; } |