From 16d9e0f14a840e05c2d8bb38c55ab5696f29a0fa Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 18 Nov 2010 13:13:48 +0000 Subject: DS: Fix compilation despite use of 'forbidden' symbols svn-id: r54317 --- backends/platform/ds/arm9/source/cdaudio.cpp | 3 +++ backends/platform/ds/arm9/source/dsmain.cpp | 3 +++ backends/platform/ds/arm9/source/gbampsave.cpp | 24 ++++++++++++++---------- backends/platform/ds/arm9/source/gbampsave.h | 3 +-- 4 files changed, 21 insertions(+), 12 deletions(-) (limited to 'backends/platform/ds') diff --git a/backends/platform/ds/arm9/source/cdaudio.cpp b/backends/platform/ds/arm9/source/cdaudio.cpp index 5860dea4f2..c07a204e7a 100644 --- a/backends/platform/ds/arm9/source/cdaudio.cpp +++ b/backends/platform/ds/arm9/source/cdaudio.cpp @@ -23,6 +23,9 @@ * */ +// Disable symbol overrides for FILE as that is used in FLAC headers +#define FORBIDDEN_SYMBOL_EXCEPTION_FILE + #include "cdaudio.h" #include "backends/fs/ds/ds-fs.h" #include "common/config-manager.h" diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp index a9dc05b89c..8820fc8b35 100644 --- a/backends/platform/ds/arm9/source/dsmain.cpp +++ b/backends/platform/ds/arm9/source/dsmain.cpp @@ -71,6 +71,9 @@ // - Try discworld? +// Disable symbol overrides for FILE +#define FORBIDDEN_SYMBOL_EXCEPTION_FILE + #include diff --git a/backends/platform/ds/arm9/source/gbampsave.cpp b/backends/platform/ds/arm9/source/gbampsave.cpp index d0fb8fff3b..dde711e1f3 100644 --- a/backends/platform/ds/arm9/source/gbampsave.cpp +++ b/backends/platform/ds/arm9/source/gbampsave.cpp @@ -23,6 +23,9 @@ * */ +// Disable symbol overrides for FILE +#define FORBIDDEN_SYMBOL_EXCEPTION_FILE + #include "gbampsave.h" #include "fat/gba_nds_fat.h" #include "backends/fs/ds/ds-fs.h" @@ -43,47 +46,48 @@ GBAMPSaveFile::GBAMPSaveFile(char *name, bool saveOrLoad) { GBAMPSaveFile::~GBAMPSaveFile() { flushSaveBuffer(); - if (handle) DS::std_fclose(handle); + if (handle) + DS::std_fclose((FILE *)handle); // consolePrintf("Closed file\n"); } uint32 GBAMPSaveFile::read(void *buf, uint32 length) { saveSize += length; // consolePrintf("Read %d %d ", length, saveSize); - return DS::std_fread(buf, 1, length, handle); + return DS::std_fread(buf, 1, length, (FILE *)handle); } bool GBAMPSaveFile::eos() const { - return DS::std_feof(handle); + return DS::std_feof((FILE *)handle); } bool GBAMPSaveFile::skip(uint32 bytes) { - return DS::std_fseek(handle, bytes, SEEK_CUR) == 0; + return DS::std_fseek((FILE *)handle, bytes, SEEK_CUR) == 0; } void GBAMPSaveFile::flushSaveBuffer() { if (bufferPos != 0) { // consolePrintf("Flushing %d bytes from %x\n", bufferPos, buffer); flushed += bufferPos; - DS::std_fwrite(buffer, 1, bufferPos, handle); + DS::std_fwrite(buffer, 1, bufferPos, (FILE *)handle); bufferPos = 0; } } int32 GBAMPSaveFile::pos() const { - return DS::std_ftell(handle); + return DS::std_ftell((FILE *)handle); } int32 GBAMPSaveFile::size() const { int position = pos(); - DS::std_fseek(handle, 0, SEEK_END); - int length = DS::std_ftell(handle); - DS::std_fseek(handle, position, SEEK_SET); + DS::std_fseek((FILE *)handle, 0, SEEK_END); + int length = DS::std_ftell((FILE *)handle); + DS::std_fseek((FILE *)handle, position, SEEK_SET); return length; } bool GBAMPSaveFile::seek(int32 newPos, int whence) { - return DS::std_fseek(handle, newPos, whence) == 0; + return DS::std_fseek((FILE *)handle, newPos, whence) == 0; } diff --git a/backends/platform/ds/arm9/source/gbampsave.h b/backends/platform/ds/arm9/source/gbampsave.h index ad929236cd..9eb551dea6 100644 --- a/backends/platform/ds/arm9/source/gbampsave.h +++ b/backends/platform/ds/arm9/source/gbampsave.h @@ -28,12 +28,11 @@ #include "common/system.h" #include "common/savefile.h" -#include "backends/fs/ds/ds-fs.h" #define SAVE_BUFFER_SIZE 100000 class GBAMPSaveFile : public Common::InSaveFile, public Common::OutSaveFile { - DS::fileHandle *handle; + void *handle; char buffer[SAVE_BUFFER_SIZE]; int bufferPos; int saveSize; -- cgit v1.2.3