[Scummvm-cvs-logs] SF.net SVN: scummvm:[51398] scummvm/branches/gsoc2010-plugins

toneman1138 at users.sourceforge.net toneman1138 at users.sourceforge.net
Wed Jul 28 02:08:32 CEST 2010


Revision: 51398
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51398&view=rev
Author:   toneman1138
Date:     2010-07-28 00:08:32 +0000 (Wed, 28 Jul 2010)

Log Message:
-----------
various manual tweaks to get ds port compiling from branch again after earlier merge from trunk

Modified Paths:
--------------
    scummvm/branches/gsoc2010-plugins/backends/platform/ds/arm7/source/main.cpp
    scummvm/branches/gsoc2010-plugins/backends/platform/ds/arm9/makefile
    scummvm/branches/gsoc2010-plugins/backends/platform/ds/arm9/source/dsmain.cpp
    scummvm/branches/gsoc2010-plugins/backends/platform/ds/commoninclude/NDS/scummvm_ipc.h
    scummvm/branches/gsoc2010-plugins/backends/plugins/ds/ds-provider.cpp
    scummvm/branches/gsoc2010-plugins/backends/plugins/elf-loader.cpp
    scummvm/branches/gsoc2010-plugins/sound/decoders/voc.cpp

Modified: scummvm/branches/gsoc2010-plugins/backends/platform/ds/arm7/source/main.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/platform/ds/arm7/source/main.cpp	2010-07-27 23:20:43 UTC (rev 51397)
+++ scummvm/branches/gsoc2010-plugins/backends/platform/ds/arm7/source/main.cpp	2010-07-28 00:08:32 UTC (rev 51398)
@@ -38,7 +38,7 @@
 #include <system.h>
 #include <stdlib.h>
 #include <string.h>
-//#include <registers_alt.h>	// not needed in current libnds
+#include <registers_alt.h>	// Needed for SOUND_CR
 #include <NDS/scummvm_ipc.h>
 //////////////////////////////////////////////////////////////////////
 #ifdef USE_DEBUGGER
@@ -590,7 +590,7 @@
   IPC->reset = false;
 
 
- fifoInit();
+  //fifoInit();
 
   for (int r = 0; r < 8; r++) {
 	IPC->adpcm.arm7Buffer[r] = (u8 *) malloc(512);

Modified: scummvm/branches/gsoc2010-plugins/backends/platform/ds/arm9/makefile
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/platform/ds/arm9/makefile	2010-07-27 23:20:43 UTC (rev 51397)
+++ scummvm/branches/gsoc2010-plugins/backends/platform/ds/arm9/makefile	2010-07-28 00:08:32 UTC (rev 51398)
@@ -114,9 +114,6 @@
 	DEFINES += -DDS_SCUMM_BUILD -DDS_BUILD_A -DUSE_ARM_GFX_ASM -DUSE_ARM_COSTUME_ASM
 	LOGO = logoa.bmp
 	ENABLE_SCUMM = $(ENABLED)
-	#DEFINES += -DENABLE_SCUMM=$(ENABLED)
-	#MODULES += engines/scumm
-
 	USE_ARM_GFX_ASM = 1
 	BUILD=scummvm-A
 endif

Modified: scummvm/branches/gsoc2010-plugins/backends/platform/ds/arm9/source/dsmain.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/platform/ds/arm9/source/dsmain.cpp	2010-07-27 23:20:43 UTC (rev 51397)
+++ scummvm/branches/gsoc2010-plugins/backends/platform/ds/arm9/source/dsmain.cpp	2010-07-28 00:08:32 UTC (rev 51398)
@@ -8,16 +8,19 @@
  * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
+ * $URL$
+ * $Id$
+ *
  */
 
 
@@ -80,8 +83,10 @@
 //#include <ARM9/console.h> //basic print funcionality
 
 #include <stdlib.h>
+#include <string.h>
+
+#include "NDS/scummvm_ipc.h"
 #include "dsmain.h"
-#include "string.h"
 #include "osystem_ds.h"
 #include "icons_raw.h"
 #include "fat/gba_nds_fat.h"
@@ -97,17 +102,23 @@
 #endif
 #include "ramsave.h"
 #include "blitters.h"
-#include "cartreset_nolibfat.h"
+#include "libcartreset/cartreset_nolibfat.h"
 #include "keys.h"
 #ifdef USE_PROFILER
 #include "profiler/cyg-profile.h"
 #endif
-#include "backends/fs/ds/ds-fs.h"
 #include "base/version.h"
 #include "engine.h"
 
+
+#include "backends/plugins/ds/ds-provider.h"
+
+#include "backends/fs/ds/ds-fs.h"
+#include "base/version.h"
+#include "common/util.h"
+
 extern "C" void OurIntrMain(void);
-extern "C" u32 getExceptionAddress( u32 opcodeAddress, u32 thumbState);
+extern "C" u32 getExceptionAddress(u32 opcodeAddress, u32 thumbState);
 
 extern const char __itcm_start[];
 static const char *registerNames[] =
@@ -116,22 +127,20 @@
 
 #ifdef WRAP_MALLOC
 
-extern "C" void* __real_malloc(size_t size);
+extern "C" void *__real_malloc(size_t size);
 
-int total = 0;
+static int s_total_malloc = 0;
 
-void* operator new (size_t size)
-{
+void *operator new (size_t size) {
 	register unsigned int reg asm("lr");
 	volatile unsigned int poo = reg;
 
-	void* res = __real_malloc(size);
-	total += size;
+	void *res = __real_malloc(size);
+	s_total_malloc += size;
 
-	if (!res)
-	{
+	if (!res) {
 //		*((u8 *) NULL) = 0;
-		consolePrintf("Failed alloc (new) %d (%d)\n", size, total);
+		consolePrintf("Failed alloc (new) %d (%d)\n", size, s_total_malloc);
 		return NULL;
 	}
 
@@ -139,7 +148,7 @@
 }
 
 
-extern "C" void* __wrap_malloc(size_t size) {
+extern "C" void *__wrap_malloc(size_t size) {
 /*	u32 addr;
 
 	asm("mov %0, lr"
@@ -151,23 +160,22 @@
 	volatile unsigned int poo = reg;
 
 
-	if (size == 0)
-	{
+	if (size == 0) {
 		static int zeroSize = 0;
 		consolePrintf("0 size malloc (%d)", zeroSize++);
 	}
 
-	void* res = __real_malloc(size);
+	void *res = __real_malloc(size);
 	if (res) {
 		if (size > 50 * 1024) {
 			consolePrintf("Allocated %d (%x)\n", size, poo);
 		}
-		total += size;
+		s_total_malloc += size;
 		return res;
 	} else {
 
 //		*((u8 *) NULL) = 0;
-		consolePrintf("Failed alloc %d (%d)\n", size, total);
+		consolePrintf("Failed alloc %d (%d)\n", size, s_total_malloc);
 		return NULL;
 	}
 }
@@ -193,112 +201,109 @@
 #define SCUMM_GAME_HEIGHT 142
 #define SCUMM_GAME_WIDTH 227
 
-int textureID;
-u16* texture;
+static int frameCount;
+static int currentTimeMillis;
 
-int frameCount;
-int currentTimeMillis;
-
 // Timer Callback
-int callbackInterval;
-int callbackTimer;
-OSystem_DS::TimerProc callback;
+static int callbackInterval;
+static int callbackTimer;
+static OSystem_DS::TimerProc callback;
 
 // Scaled
-bool scaledMode;
-int scX;
-int scY;
+static bool scaledMode;
+static int scX;
+static int scY;
 
-int subScX;
-int subScY;
-int subScTargetX;
-int subScTargetY;
-int subScreenWidth = SCUMM_GAME_WIDTH;
-int subScreenHeight = SCUMM_GAME_HEIGHT;
-int subScreenScale = 256;
+static int subScX;
+static int subScY;
+static int subScTargetX;
+static int subScTargetY;
+static int subScreenWidth = SCUMM_GAME_WIDTH;
+static int subScreenHeight = SCUMM_GAME_HEIGHT;
+static int subScreenScale = 256;
 
 
 
 // Sound
-int bufferSize;
-s16* soundBuffer;
-int bufferFrame;
-int bufferRate;
-int bufferSamples;
-bool soundHiPart;
-int soundFrequency;
+static int bufferSize;
+static s16 *soundBuffer;
+static int bufferFrame;
+static int bufferRate;
+static int bufferSamples;
+static bool soundHiPart;
+static int soundFrequency;
 
 // Events
-int lastEventFrame;
-bool indyFightState;
-bool indyFightRight;
+static int lastEventFrame;
+static bool indyFightState;
+static bool indyFightRight;
 
-OSystem_DS::SoundProc soundCallback;
-void* soundParam;
-int lastCallbackFrame;
-bool bufferFirstHalf;
-bool bufferSecondHalf;
+static OSystem_DS::SoundProc soundCallback;
+static int lastCallbackFrame;
+static bool bufferFirstHalf;
+static bool bufferSecondHalf;
 
 // Saved buffers
-bool highBuffer;
-bool displayModeIs8Bit = false;
+static bool highBuffer;
+static bool displayModeIs8Bit = false;
 
 // Game id
-u8 gameID;
+static u8 gameID;
 
-bool snapToBorder = false;
-bool consoleEnable = false;
-bool gameScreenSwap = false;
+static bool snapToBorder = false;
+static bool consoleEnable = false;
+static bool gameScreenSwap = false;
 bool isCpuScalerEnabled();
 //#define HEAVY_LOGGING
 
-MouseMode mouseMode = MOUSE_LEFT;
+static MouseMode mouseMode = MOUSE_LEFT;
 
-int storedMouseX = 0;
-int storedMouseY = 0;
+static int storedMouseX = 0;
+static int storedMouseY = 0;
 
 // Sprites
-SpriteEntry sprites[128];
-SpriteEntry spritesMain[128];
-int tweak;
+static SpriteEntry sprites[128];
+static SpriteEntry spritesMain[128];
+static int tweak;
 
 // Shake
-int shakePos = 0;
+static int s_shakePos = 0;
 
 // Keyboard
-bool keyboardEnable = false;
-bool leftHandedMode = false;
-bool keyboardIcon = false;
+static bool keyboardEnable = false;
+static bool leftHandedMode = false;
+static bool keyboardIcon = false;
 
 // Touch
-int touchScX, touchScY, touchX, touchY;
-int mouseHotspotX, mouseHotspotY;
-bool cursorEnable = false;
-bool mouseCursorVisible = true;
-bool rightButtonDown = false;
-bool touchPadStyle = false;
-int touchPadSensitivity = 8;
-bool tapScreenClicks = true;
+static int touchScX, touchScY, touchX, touchY;
+static int mouseHotspotX, mouseHotspotY;
+static bool cursorEnable = false;
+static bool mouseCursorVisible = true;
+static bool leftButtonDown = false;
+static bool rightButtonDown = false;
+static bool touchPadStyle = false;
+static int touchPadSensitivity = 8;
+static bool tapScreenClicks = true;
 
-int tapCount = 0;
-int tapTimeout = 0;
-int tapComplete = 0;
+static int tapCount = 0;
+static int tapTimeout = 0;
+static int tapComplete = 0;
 
 // Dragging
-int dragStartX, dragStartY;
-bool dragging = false;
-int dragScX, dragScY;
+static int dragStartX, dragStartY;
+static bool dragging = false;
+static int dragScX, dragScY;
 
 // Interface styles
-char gameName[32];
+static char gameName[32];
 
 // 8-bit surface size
-int gameWidth = 320;
-int gameHeight = 200;
+static int gameWidth = 320;
+static int gameHeight = 200;
 
 // Scale
-bool twoHundredPercentFixedScale = false;
-bool cpuScalerEnable = false;
+static bool twoHundredPercentFixedScale = false;
+static bool cpuScalerEnable = false;
 
 		// 100    256
 		// 150	  192
@@ -309,14 +314,14 @@
 
 
 #ifdef USE_PROFILER
-int hBlankCount = 0;
+static int hBlankCount = 0;
 #endif
 
-u8* scalerBackBuffer = NULL;
+static u8 *scalerBackBuffer = NULL;
 
 #define NUM_SUPPORTED_GAMES 21
 
-gameListType gameList[NUM_SUPPORTED_GAMES] = {
+static const gameListType gameList[NUM_SUPPORTED_GAMES] = {
 	// Unknown game - use normal SCUMM controls
 	{"unknown", 	CONT_SCUMM_ORIGINAL},
 
@@ -345,33 +350,31 @@
 	{"parallaction",	CONT_NIPPON},
 };
 
-gameListType* currentGame = NULL;
+static const gameListType *s_currentGame = NULL;
 
 // Stylus
-#define ABS(x) ((x)>0?(x):-(x))
+static bool penDown = FALSE;
+static bool penHeld = FALSE;
+static bool penReleased = FALSE;
+static bool penDownLastFrame = FALSE;
+static s32 penX = 0, penY = 0;
+static s32 penDownX = 0, penDownY = 0;
+static int keysDownSaved = 0;
+static int keysReleasedSaved = 0;
+static int keysChangedSaved = 0;
 
-bool penDown = FALSE;
-bool penHeld = FALSE;
-bool penReleased = FALSE;
-bool penDownLastFrame = FALSE;
-s32 penX = 0, penY = 0;
-s32 penDownX = 0, penDownY = 0;
-int keysDownSaved = 0;
-int keysReleasedSaved = 0;
-int keysChangedSaved = 0;
+static bool penDownSaved = FALSE;
+static bool penReleasedSaved = FALSE;
+static int penDownFrames = 0;
+static int touchXOffset = 0;
+static int touchYOffset = 0;
 
-bool penDownSaved = FALSE;
-bool penReleasedSaved = FALSE;
-int penDownFrames = 0;
-int touchXOffset = 0;
-int touchYOffset = 0;
+static int triggeredIcon = 0;
+static int triggeredIconTimeout = 0;
 
-int triggeredIcon = 0;
-int triggeredIconTimeout = 0;
+static u16 savedPalEntry255 = RGB15(31, 31, 31);
 
-u16 savedPalEntry255 = RGB15(31, 31, 31);
 
-
 extern "C" int scummvm_main(int argc, char *argv[]);
 Common::EventType getKeyEvent(int key);
 int getKeysChanged();
@@ -382,7 +385,7 @@
 void setIconMain(int num, int x, int y, int imageNum, int flags, bool enable);
 void uploadSpriteGfx();
 
-TransferSound soundControl;
+static TransferSound soundControl;
 
 
 bool isCpuScalerEnabled() {
@@ -430,12 +433,12 @@
 //	return (ConfMan.hasKey("cpu_scaler", "ds") && ConfMan.getBool("cpu_scaler", "ds"));
 
 controlType getControlType() {
-	return currentGame->control;
+	return s_currentGame->control;
 }
 
 
 //plays an 8 bit mono sample at 11025Hz
-void playSound(const void* data, u32 length, bool loop, bool adpcm, int rate) {
+void playSound(const void *data, u32 length, bool loop, bool adpcm, int rate) {
 
 	if (!IPC->soundData) {
 		soundControl.count = 0;
@@ -551,21 +554,8 @@
 	return soundFrequency;
 }
 
-void setControls(char* gameName) {
-
-	for (int r = 0; r < NUM_SUPPORTED_GAMES; r++) {
-		if (!stricmp(gameName, gameList[r].gameId)) {
-			currentGame = &gameList[r];
-			consolePrintf("Current game set to: %s\n", gameName);
-			return;
-		}
-	}
-
-	consolePrintf("Failed to set current game to: %s\n", gameName);
-}
-
 void exitGame() {
-	currentGame = NULL;
+	s_currentGame = NULL;
 }
 
 void initGame() {
@@ -580,17 +570,17 @@
 	setOptions();
 
 	//strcpy(gameName, ConfMan.getActiveDomain().c_str());
-	if (currentGame == NULL) {
+	if (s_currentGame == NULL) {
 
 		strcpy(gameName, ConfMan.get("gameid").c_str());
 	//	consolePrintf("\n\n\n\nCurrent game: '%s' %d\n", gameName, gameName[0]);
 
-		currentGame = &gameList[0];		// Default game
+		s_currentGame = &gameList[0];		// Default game
 
 		for (int r = 0; r < NUM_SUPPORTED_GAMES; r++) {
 			if (!stricmp(gameName, gameList[r].gameId)) {
-				currentGame = &gameList[r];
-	//			consolePrintf("Game list num: %d\n", currentGame);
+				s_currentGame = &gameList[r];
+	//			consolePrintf("Game list num: %d\n", s_currentGame);
 			}
 		}
 	}
@@ -785,7 +775,7 @@
 }
 
 void setShowCursor(bool enable) {
-	if ((currentGame) && (currentGame->control == CONT_SCUMM_SAMNMAX)) {
+	if ((s_currentGame) && (s_currentGame->control == CONT_SCUMM_SAMNMAX)) {
 		if (cursorEnable) {
 			sprites[1].attribute[0] = ATTR0_BMP | 150;
 		} else {
@@ -801,7 +791,7 @@
 	mouseCursorVisible = enable;
 }
 
-void setCursorIcon(const u8* icon, uint w, uint h, byte keycolor, int hotspotX, int hotspotY) {
+void setCursorIcon(const u8 *icon, uint w, uint h, byte keycolor, int hotspotX, int hotspotY) {
 
 	int off;
 
@@ -833,7 +823,7 @@
 		}
 	}
 
-	if (currentGame->control != CONT_SCUMM_SAMNMAX)
+	if (s_currentGame->control != CONT_SCUMM_SAMNMAX)
 		return;
 
 	uint16 border = RGB15(24,24,24) | 0x8000;
@@ -982,7 +972,7 @@
 	consolePrintf("Flip %s...", displayModeIs8Bit ? "8bpp" : "16bpp");
 	#endif
 	if (!displayModeIs8Bit) {
-		u16* back = get16BitBackBuffer();
+		u16 *back = get16BitBackBuffer();
 
 //		highBuffer = !highBuffer;
 //		BG3_CR = BG_BMP16_512x256 |	BG_BMP_RAM(highBuffer? 1: 0);
@@ -1001,8 +991,8 @@
 		TIMER1_CR = TIMER_ENABLE | TIMER_DIV_1024;
 		u16 t0 = TIMER1_DATA;
 		#endif
-		const u8* back = (const u8*)get8BitBackBuffer();
-		u16* base = BG_GFX + 0x10000;
+		const u8 *back = (const u8*)get8BitBackBuffer();
+		u16 *base = BG_GFX + 0x10000;
 		Rescale_320x256xPAL8_To_256x256x1555(
 			base,
 			back,
@@ -1031,17 +1021,18 @@
 }
 
 void setShakePos(int shakePos) {
-	shakePos = shakePos;
+	s_shakePos = shakePos;
 }
 
 
-u16* get16BitBackBuffer() {
+u16 *get16BitBackBuffer() {
 	return BG_GFX + 0x20000;
 }
 
 s32 get8BitBackBufferStride() {
-	// When the CPU scaler is enabled, the back buffer is in system RAM and is 320 pixels wide
-	// When the CPU scaler is disabled, the back buffer is in video memory and therefore must have a 512 pixel stride
+	// When the CPU scaler is enabled, the back buffer is in system RAM and is
+	// 320 pixels wide. When the CPU scaler is disabled, the back buffer is in
+	// video memory and therefore must have a 512 pixel stride.
 
 	if (isCpuScalerEnabled()){
 		return 320;
@@ -1050,11 +1041,11 @@
 	}
 }
 
-u16* getScalerBuffer() {
+u16 *getScalerBuffer() {
 	return (u16 *) scalerBackBuffer;
 }
 
-u16* get8BitBackBuffer() {
+u16 *get8BitBackBuffer() {
 	if (isCpuScalerEnabled())
 		return (u16 *) scalerBackBuffer;
 	else
@@ -1124,7 +1115,7 @@
 
 void memoryReport() {
 	int r = 0;
-	int* p;
+	int *p;
 	do {
 		p = (int *) malloc(r * 8192);
 		free(p);
@@ -1132,7 +1123,7 @@
 	} while ((p) && (r < 512));
 
 	int t = -1;
-	void* block[1024];
+	void *block[1024];
 	do {
 		t++;
 		block[t] = (int *) malloc(4096);
@@ -1147,7 +1138,7 @@
 
 
 void addIndyFightingKeys() {
-	OSystem_DS* system = OSystem_DS::instance();
+	OSystem_DS *system = OSystem_DS::instance();
 	Common::Event event;
 
 	event.type = Common::EVENT_KEYDOWN;
@@ -1247,7 +1238,7 @@
 void setKeyboardEnable(bool en) {
 	if (en == keyboardEnable) return;
 	keyboardEnable = en;
-	u16* backupBank = (u16 *) 0x6040000;
+	u16 *backupBank = (u16 *) 0x6040000;
 
 	if (keyboardEnable) {
 
@@ -1283,7 +1274,7 @@
 		if (displayModeIs8Bit) {
 			// Copy the sub screen VRAM from the top screen - they should always be
 			// the same.
-			u16* buffer = get8BitBackBuffer();
+			u16 *buffer = get8BitBackBuffer();
 			s32 stride = get8BitBackBufferStride();
 
 			for (int y = 0; y < gameHeight; y++) {
@@ -1319,8 +1310,7 @@
 	return displayModeIs8Bit;
 }
 
-void doScreenTapMode(OSystem_DS* system)
-{
+void doScreenTapMode(OSystem_DS *system) {
 	Common::Event event;
 	static bool left = false, right = false;
 
@@ -1386,8 +1376,7 @@
 	system->addEvent(event);
 }
 
-void doButtonSelectMode(OSystem_DS* system)
-{
+void doButtonSelectMode(OSystem_DS *system) {
 	Common::Event event;
 
 
@@ -1398,9 +1387,6 @@
 		//consolePrintf("x=%d   y=%d  \n", getPenX(), getPenY());
 	}
 
-	static bool leftButtonDown = false;
-	static bool rightButtonDown = false;
-
 	if (getPenReleased() && (leftButtonDown || rightButtonDown)) {
 		if (leftButtonDown) {
 			event.type = Common::EVENT_LBUTTONUP;
@@ -1467,7 +1453,6 @@
 			}
 
 			if (rightButtonDown) {
-				Common::Event event;
 				event.mouse = Common::Point(getPenX(), getPenY());
 				event.type = Common::EVENT_RBUTTONUP;
 				system->addEvent(event);
@@ -1476,14 +1461,13 @@
 
 
 			if (getKeysDown() & KEY_RIGHT) {
-				if ((currentGame->control != CONT_SCUMM_SAMNMAX) && (currentGame->control != CONT_FUTURE_WARS) && (currentGame->control != CONT_GOBLINS)) {
+				if ((s_currentGame->control != CONT_SCUMM_SAMNMAX) && (s_currentGame->control != CONT_FUTURE_WARS) && (s_currentGame->control != CONT_GOBLINS)) {
 					mouseMode = MOUSE_RIGHT;
 				} else {
 					// If we're playing sam and max, click and release the right mouse
 					// button to change verb
-					Common::Event event;
 
-					if (currentGame->control == CONT_FUTURE_WARS) {
+					if (s_currentGame->control == CONT_FUTURE_WARS) {
 						event.mouse = Common::Point(320 - 128, 200 - 128);
 						event.type = Common::EVENT_MOUSEMOVE;
 						system->addEvent(event);
@@ -1515,7 +1499,7 @@
 	#ifdef HEAVY_LOGGING
 	consolePrintf("addEventsToQueue\n");
 	#endif
-	OSystem_DS* system = OSystem_DS::instance();
+	OSystem_DS *system = OSystem_DS::instance();
 	Common::Event event;
 
 #ifdef USE_PROFILER
@@ -1558,7 +1542,7 @@
 			if (!indyFightState) {
 
 				if ((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) && (getKeysDown() & KEY_B)) {
-					if (currentGame->control == CONT_AGI) {
+					if (s_currentGame->control == CONT_AGI) {
 						event.kbd.keycode = Common::KEYCODE_RETURN;
 						event.kbd.ascii = 13;
 						event.kbd.flags = 0;
@@ -1596,8 +1580,7 @@
 				bool release = getKeysReleased() & (KEY_LEFT | KEY_RIGHT | KEY_UP | KEY_DOWN);
 				bool shoulders = getKeysHeld() & (KEY_L | KEY_R);
 
-				if ( (down && (!shoulders)) || release)
-				{
+				if ( (down && (!shoulders)) || release) {
 
 					if (getKeysChanged() & KEY_LEFT) {
 						event.kbd.keycode = Common::KEYCODE_LEFT;
@@ -1675,9 +1658,7 @@
 
 		updateStatus();
 
-		Common::Event event;
 
-
 		if ((tapScreenClicks) && (getIsDisplayMode8Bit())) {
 			if ((!keyboardEnable) || (!isInsideKeyboard(penDownX, penDownY))) {
 				doScreenTapMode(system);
@@ -1693,13 +1674,10 @@
 
 		if (!keyboardEnable) {
 
-
 			if (((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) || (indyFightState)) && (displayModeIs8Bit)) {
 				// Controls specific to the control method
 
-
-
-				if (currentGame->control == CONT_SKY) {
+				if (s_currentGame->control == CONT_SKY) {
 					// Extra controls for Beneath a Steel Sky
 					if ((getKeysDown() & KEY_DOWN)) {
 						penY = 0;
@@ -1707,9 +1685,8 @@
 					}
 				}
 
-				if (currentGame->control == CONT_AGI) {
+				if (s_currentGame->control == CONT_AGI) {
 					// Extra controls for Leisure Suit Larry and KQ4
-
 					if ((getKeysHeld() & KEY_UP) && (getKeysHeld() & KEY_START)
 						/*&& (!strcmp(gameName, "LLLLL"))*/) {
 						consolePrintf("Cheat key!\n");
@@ -1722,16 +1699,11 @@
 						event.type = Common::EVENT_KEYUP;
 						system->addEvent(event);
 					}
-
 				}
 
-
-
-				if (currentGame->control == CONT_SIMON) {
+				if (s_currentGame->control == CONT_SIMON) {
 					// Extra controls for Simon the Sorcerer
 					if ((getKeysDown() & KEY_DOWN)) {
-						Common::Event event;
-
 						event.type = Common::EVENT_KEYDOWN;
 						event.kbd.keycode = Common::KEYCODE_F10;		// F10 or # - show hotspots
 						event.kbd.ascii = Common::ASCII_F10;
@@ -1744,13 +1716,9 @@
 					}
 				}
 
-
-
-				if (currentGame->control == CONT_SCUMM_ORIGINAL) {
+				if (s_currentGame->control == CONT_SCUMM_ORIGINAL) {
 					// Extra controls for Scumm v1-5 games
 					if ((getKeysDown() & KEY_DOWN)) {
-						Common::Event event;
-
 						event.type = Common::EVENT_KEYDOWN;
 						event.kbd.keycode = Common::KEYCODE_PERIOD;		// Full stop - skips current dialogue line
 						event.kbd.ascii = '.';
@@ -1806,14 +1774,14 @@
 		if ((getKeysChanged() & KEY_START)) {
 			event.kbd.flags = 0;
 			event.type = getKeyEvent(KEY_START);
-			if (currentGame->control == CONT_FUTURE_WARS) {
+			if (s_currentGame->control == CONT_FUTURE_WARS) {
 				event.kbd.keycode = Common::KEYCODE_F10;
 				event.kbd.ascii = Common::ASCII_F10;
-			} else if (currentGame->control == CONT_GOBLINS) {
+			} else if (s_currentGame->control == CONT_GOBLINS) {
 				event.kbd.keycode = Common::KEYCODE_F1;
 				event.kbd.ascii = Common::ASCII_F1;
 //				consolePrintf("!!!!!F1!!!!!");
-			} else if (currentGame->control == CONT_AGI) {
+			} else if (s_currentGame->control == CONT_AGI) {
 				event.kbd.keycode = Common::KEYCODE_ESCAPE;
 				event.kbd.ascii = 27;
 			} else {
@@ -1830,9 +1798,7 @@
 		}
 
 		consumeKeys();
-
 		consumePenEvents();
-
 	}
 }
 
@@ -1862,23 +1828,19 @@
 	if (displayModeIs8Bit) {
 		if (!tapScreenClicks) {
 			switch (mouseMode) {
-				case MOUSE_LEFT: {
-					offs = 1;
-					break;
-				}
-				case MOUSE_RIGHT: {
-					offs = 2;
-					break;
-				}
- 				case MOUSE_HOVER: {
-					offs = 0;
-					break;
-				}
-				default: {
-					// Nothing!
-					offs = 0;
-					break;
-				}
+			case MOUSE_LEFT:
+				offs = 1;
+				break;
+			case MOUSE_RIGHT:
+				offs = 2;
+				break;
+			case MOUSE_HOVER:
+				offs = 0;
+				break;
+			default:
+				// Nothing!
+				offs = 0;
+				break;
 			}
 
 			setIcon(0, 208, 150, offs, 0, true);
@@ -1962,15 +1924,12 @@
 		SUB_BG3_YDX = 0;
 		SUB_BG3_YDY = y;
 	} else*/ {
-		if (isCpuScalerEnabled() && (x==320))
-		{
+		if (isCpuScalerEnabled() && (x==320)) {
 			BG3_XDX = 256;
 			BG3_XDY = 0;
 			BG3_YDX = 0;
 			BG3_YDY = y;
-		}
-		else
-		{
+		} else {
 			BG3_XDX = x;
 			BG3_XDY = 0;
 			BG3_YDX = 0;
@@ -2057,11 +2016,9 @@
 	soundUpdate();
 
 
-
-
 	if ((!gameScreenSwap) && (!(getKeysHeld() & KEY_L) && !(getKeysHeld() & KEY_R))) {
-		if (currentGame) {
-			if (currentGame->control != CONT_SCUMM_SAMNMAX) {
+		if (s_currentGame) {
+			if (s_currentGame->control != CONT_SCUMM_SAMNMAX) {
 				if (getPenHeld() && (getPenY() < SCUMM_GAME_HEIGHT)) {
 					setTopScreenTarget(getPenX(), getPenY());
 				}
@@ -2144,7 +2101,7 @@
 		SUB_BG3_CX = subScX + 64;
 	}
 
-	SUB_BG3_CY = subScY + (shakePos << 8);*/
+	SUB_BG3_CY = subScY + (s_shakePos << 8);*/
 
 	/*SUB_BG3_XDX = (int) (subScreenWidth / 256.0f * 256);
 	SUB_BG3_XDY = 0;
@@ -2284,7 +2241,7 @@
 			setZoomedScreenScale(subScreenWidth, ((subScreenHeight * (256 << 8)) / 192) >> 8);
 
 
-			setMainScreenScroll(scX << 8, (scY << 8) + (shakePos << 8));
+			setMainScreenScroll(scX << 8, (scY << 8) + (s_shakePos << 8));
 			setMainScreenScale(256, 256);		// 1:1 scale
 
 		} else {
@@ -2300,7 +2257,7 @@
 			setZoomedScreenScroll(subScX, subScY, (subScreenWidth != 256) && (subScreenWidth != 128));
 			setZoomedScreenScale(subScreenWidth, ((subScreenHeight * (256 << 8)) / 192) >> 8);
 
-			setMainScreenScroll(64, (scY << 8) + (shakePos << 8));
+			setMainScreenScroll(64, (scY << 8) + (s_shakePos << 8));
 			setMainScreenScale(320, 256);		// 1:1 scale
 
 		}
@@ -2388,7 +2345,7 @@
 	vramSetBankE(VRAM_E_MAIN_SPRITE);
 
 	// Convert texture from 24bit 888 to 16bit 1555, remembering to set top bit!
-	u8* srcTex = (u8 *) ::icons_raw;
+	const u8 *srcTex = (const u8 *) ::icons_raw;
 	for (int r = 32 * 256 ; r >= 0; r--) {
 		SPRITE_GFX_SUB[r] = 0x8000 | (srcTex[r * 3] >> 3) | ((srcTex[r * 3 + 1] >> 3) << 5) | ((srcTex[r * 3 + 2] >> 3) << 10);
 		SPRITE_GFX[r] = 0x8000 | (srcTex[r * 3] >> 3) | ((srcTex[r * 3 + 1] >> 3) << 5) | ((srcTex[r * 3 + 2] >> 3) << 10);
@@ -2634,9 +2591,6 @@
 
 					}
 				}
-				else
-				{
-				}
 
 			} else {
 				penDown = true;
@@ -2856,20 +2810,18 @@
 	return indyFightState;
 }
 
-gameListType* getCurrentGame() {
-	return currentGame;
-}
-
 ///////////////////
 // Fast Ram
 ///////////////////
 
 #define FAST_RAM_SIZE (24000)
-u8* fastRamPointer;
+#define ITCM_DATA	__attribute__((section(".itcm")))
+
+u8 *fastRamPointer;
 u8 fastRamData[FAST_RAM_SIZE] ITCM_DATA;
 
-void* fastRamAlloc(int size) {
-	void* result = (void *) fastRamPointer;
+void *fastRamAlloc(int size) {
+	void *result = (void *) fastRamPointer;
 	fastRamPointer += size;
 	if(fastRamPointer > fastRamData + FAST_RAM_SIZE) {
 		consolePrintf("FastRam (ITCM) allocation failed!\n");
@@ -2926,7 +2878,7 @@
 
 
 // Ensure the function is processed with C linkage
-extern "C" void debug_print_stub(char* string);
+extern "C" void debug_print_stub(char *string);
 
 void debug_print_stub(char *string) {
 	consolePrintf(string);
@@ -3286,7 +3238,7 @@
 */
 	// Create a file system node to force search for a zip file in GBA rom space
 
-	DSFileSystemNode* node = new DSFileSystemNode();
+	DSFileSystemNode *node = new DSFileSystemNode();
 	if (!node->getZip() || (!node->getZip()->isReady())) {
 		// If not found, init CF/SD driver
 		initGBAMP(mode);
@@ -3344,6 +3296,11 @@
 	const char *argv[] = {"/scummvmds", "--config=scummvmj.ini"};
 #elif defined(DS_BUILD_K)
 	const char *argv[] = {"/scummvmds", "--config=scummvmk.ini"};
+#else
+	// Use the default config file if no build was specified. This currently
+	// only happens with builds made using the regular ScummVM build system (as
+	// opposed to the nds specific build system).
+	const char *argv[] = {"/scummvmds"};
 #endif
 
 #ifdef DYNAMIC_MODULES
@@ -3359,8 +3316,9 @@
 	return 0;
 }
 
-}
+}	// End of namespace DS
 
+
 int main() {
 	DS::main();
 }
@@ -3380,7 +3338,6 @@
 
 
 extern "C" void consolePrintf(const char * format, ...) {
-	char buffer[256];
 	va_list args;
 	va_start(args, format);
 	viprintf(format, args);

Modified: scummvm/branches/gsoc2010-plugins/backends/platform/ds/commoninclude/NDS/scummvm_ipc.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/platform/ds/commoninclude/NDS/scummvm_ipc.h	2010-07-27 23:20:43 UTC (rev 51397)
+++ scummvm/branches/gsoc2010-plugins/backends/platform/ds/commoninclude/NDS/scummvm_ipc.h	2010-07-28 00:08:32 UTC (rev 51398)
@@ -33,8 +33,20 @@
 //////////////////////////////////////////////////////////////////////
 
 
+typedef struct sTransferSoundData {
+//---------------------------------------------------------------------------------
+        const void *data;
+        u32 len;
+        u32 rate;
+        u8 vol;
+        u8 pan;
+        u8 format;
+        u8 PADDING;
+} TransferSoundData, * pTransferSoundData;
 
 
+
+
 //---------------------------------------------------------------------------------
 typedef struct sTransferSound {
 //---------------------------------------------------------------------------------

Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/ds/ds-provider.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/ds/ds-provider.cpp	2010-07-27 23:20:43 UTC (rev 51397)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/ds/ds-provider.cpp	2010-07-28 00:08:32 UTC (rev 51398)
@@ -29,7 +29,7 @@
 #include "backends/plugins/dynamic-plugin.h"
 #include "common/fs.h"
 
-#include "backends/platform/ds/arm9/source/dsloader.h"
+#include "backends/plugins/elf-loader.h"
 
 
 class DSPlugin : public DynamicPlugin {

Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/elf-loader.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/elf-loader.cpp	2010-07-27 23:20:43 UTC (rev 51397)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/elf-loader.cpp	2010-07-28 00:08:32 UTC (rev 51398)
@@ -37,6 +37,10 @@
 #include "common/fs.h"
 #include "elf-loader.h"
 
+#ifdef __DS__
+#include <nds.h>
+#endif
+
 #define __DEBUG_PLUGINS__
 
 #ifdef __DEBUG_PLUGINS__
@@ -48,7 +52,7 @@
 #define seterror(x,...) printf(x, ## __VA_ARGS__)
 
 /**
- * Flushes the data cache.
+ * Flushes the data cache (Platform Specific).
  */
 void flushDataCache() {
 #ifdef __DS__
@@ -304,7 +308,7 @@
 #else
 		// Make sure we don't relocate special valued symbols
 		if (s->st_shndx < SHN_LOPROC) {
-				relocCount++;
+				mainCount++;
 				s->st_value += offset;
 				if (s->st_value < (Elf32_Addr)_segment || s->st_value > (Elf32_Addr)_segment + _segmentSize)
 					seterror("Symbol out of bounds! st_value = %x\n", s->st_value);

Modified: scummvm/branches/gsoc2010-plugins/sound/decoders/voc.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/sound/decoders/voc.cpp	2010-07-27 23:20:43 UTC (rev 51397)
+++ scummvm/branches/gsoc2010-plugins/sound/decoders/voc.cpp	2010-07-28 00:08:32 UTC (rev 51398)
@@ -384,7 +384,7 @@
 
 SeekableAudioStream *makeVOCStream(Common::SeekableReadStream *stream, byte flags, DisposeAfterUse::Flag disposeAfterUse) {
 #ifdef STREAM_AUDIO_FROM_DISK
-	return makeVOCDiskStreamNoLoop(*stream, flags, disposeAfterUse);
+	return makeVOCDiskStreamNoLoop(stream, flags, disposeAfterUse);
 #else
 	int size, rate;
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list