aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2010-07-05 16:11:34 +0000
committerMax Horn2010-07-05 16:11:34 +0000
commit782e43591a6eb5995036bebf2dcc2c871e4aed95 (patch)
tree1582e0758e9d8364cfd29d8ab85c5a8f907825e4
parent3d44870c8a64999e5464fc3b09c08f9378c4a2d3 (diff)
downloadscummvm-rg350-782e43591a6eb5995036bebf2dcc2c871e4aed95.tar.gz
scummvm-rg350-782e43591a6eb5995036bebf2dcc2c871e4aed95.tar.bz2
scummvm-rg350-782e43591a6eb5995036bebf2dcc2c871e4aed95.zip
DS: Cleanup NDS portdefs.h a bit
* Don't #include "nds/ndstypes.h" everywhere * Don't #define ITCM_DATA globally, it is only need in one place * Fix STREAM_AUDIO_FROM_DISK definition (copy&paste error) * Fix custom assert() implementation by using the do/while(0) trick for macros. Previously, there could be subtle errors caused by statements like if (COND) assert(...) else ... svn-id: r50690
-rw-r--r--backends/platform/ds/arm9/source/dsmain.cpp2
-rw-r--r--backends/platform/ds/arm9/source/portdefs.h35
-rw-r--r--backends/platform/ds/arm9/source/ramsave.h2
-rw-r--r--backends/platform/ds/arm9/source/zipreader.cpp1
-rw-r--r--backends/platform/ds/arm9/source/zipreader.h4
5 files changed, 16 insertions, 28 deletions
diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp
index 698960bb9f..163ae9518d 100644
--- a/backends/platform/ds/arm9/source/dsmain.cpp
+++ b/backends/platform/ds/arm9/source/dsmain.cpp
@@ -2834,6 +2834,8 @@ bool getIndyFightState() {
///////////////////
#define FAST_RAM_SIZE (24000)
+#define ITCM_DATA __attribute__((section(".itcm")))
+
u8 *fastRamPointer;
u8 fastRamData[FAST_RAM_SIZE] ITCM_DATA;
diff --git a/backends/platform/ds/arm9/source/portdefs.h b/backends/platform/ds/arm9/source/portdefs.h
index 3b3925abba..bdb42993d1 100644
--- a/backends/platform/ds/arm9/source/portdefs.h
+++ b/backends/platform/ds/arm9/source/portdefs.h
@@ -26,24 +26,8 @@
#ifndef _PORTDEFS_H_
#define _PORTDEFS_H_
-
-
-/*
-typedef unsigned char u8;
-typedef signed char s8;
-
-typedef unsigned short u16;
-typedef signed short s16;
-
-typedef unsigned int u32;
-typedef signed int s32;
-*/
-
-#include "nds/ndstypes.h"
-
-
-// Somebody removed these from scummsys.h, but they're still required, so I'm adding them here
-// in the hope that they'll stay.
+// Somebody removed these from scummsys.h, but they're still required, so I'm
+// adding them here in the hope that they'll stay.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -53,8 +37,6 @@ typedef signed int s32;
#define double float
-#define CT_NO_TRANSPARENCY
-
#ifndef DISABLE_TEXT_CONSOLE
#define DISABLE_TEXT_CONSOLE
#endif
@@ -63,15 +45,12 @@ typedef signed int s32;
#define DISABLE_COMMAND_LINE
#endif
-#ifndef DISABLE_COMMAND_LINE
+#ifndef STREAM_AUDIO_FROM_DISK
#define STREAM_AUDIO_FROM_DISK
#endif
-//#undef assert
-//#define assert(expr) consolePrintf("Asserted!")
#define NO_DEBUG_MSGS
-
// This is defined in dsmain.cpp
#ifdef __cplusplus
extern "C" {
@@ -86,15 +65,17 @@ void consolePrintf(const char *format, ...);
#undef assert
#endif
-#define assert(s) if (!(s)) consolePrintf("Assertion failed: '##s##' at file %s, line %d\n", __FILE__, __LINE__)
+#define assert(s) \
+ do { \
+ if (!(s)) \
+ consolePrintf("Assertion failed: '##s##' at file %s, line %d\n", __FILE__, __LINE__); \
+ } while (0)
//#include "ds-fs.h"
//#define debug(fmt, ...) consolePrintf(fmt, ##__VA_ARGS__)
//#define debug(fmt, ...) debug(0, fmt, ##__VA_ARGS__)
-#define ITCM_DATA __attribute__((section(".itcm")))
-
// FIXME: Since I can't change the engine at the moment (post lockdown) this define can go here.
// This define changes the mouse-relative motion which doesn't make sense on a touch screen to
// a more conventional form of input where the menus can be clicked on.
diff --git a/backends/platform/ds/arm9/source/ramsave.h b/backends/platform/ds/arm9/source/ramsave.h
index 066f7c332c..f2cfe0fc0b 100644
--- a/backends/platform/ds/arm9/source/ramsave.h
+++ b/backends/platform/ds/arm9/source/ramsave.h
@@ -26,9 +26,11 @@
#ifndef _RAMSAVE_H_
#define _RAMSAVE_H_
+#include <nds/ndstypes.h>
#include "common/system.h"
#include "common/savefile.h"
+
// SaveFileManager class
#define DS_MAX_SAVE_SIZE 150000
diff --git a/backends/platform/ds/arm9/source/zipreader.cpp b/backends/platform/ds/arm9/source/zipreader.cpp
index 24458781af..0906123436 100644
--- a/backends/platform/ds/arm9/source/zipreader.cpp
+++ b/backends/platform/ds/arm9/source/zipreader.cpp
@@ -24,6 +24,7 @@
*/
+#include "common/scummsys.h"
#include "zipreader.h"
ZipFile::ZipFile() {
diff --git a/backends/platform/ds/arm9/source/zipreader.h b/backends/platform/ds/arm9/source/zipreader.h
index bfba920401..5429954088 100644
--- a/backends/platform/ds/arm9/source/zipreader.h
+++ b/backends/platform/ds/arm9/source/zipreader.h
@@ -25,7 +25,9 @@
#ifndef _ZIPREADER_H_
#define _ZIPREADER_H_
-#include "portdefs.h"
+
+#include <nds/ndstypes.h>
+
#define ZF_SEARCH_START 0x08000000
#define ZF_SEARCH_END 0x09000000
#define ZF_SEARCH_STRIDE 16