Making DS port build again

svn-id: r28654
This commit is contained in:
Neil Millstone 2007-08-18 11:10:41 +00:00
parent 0566bef991
commit 4ccec7c25a
7 changed files with 95 additions and 85 deletions

View File

@ -5,10 +5,12 @@ libndsdir = /home/neil/devkitpro/libnds
# Select the build you want by uncommenting one of the following lines:
#DS_BUILD_A = 1
DS_BUILD_A = 1
#DS_BUILD_B = 1
#DS_BUILD_C = 1
DS_BUILD_D = 1
#DS_BUILD_D = 1
#DS_BUILD_E = 1
#DS_BUILD_F = 1
#DS_BUILD_E = 1
#DS_BUILD_F = 1
@ -38,6 +40,7 @@ VPATH = $(srcdir)
# Command to build libmad is:
# ./configure --host=arm-elf --enable-speed --enable-sso -enable-fpm=arm CFLAGS='-specs=ds_arm9.specs -mthumb-interwork'
USE_ARM_SOUND_ASM = 1
ARM = 1
ifdef DS_BUILD_A
@ -249,7 +252,7 @@ PRE_OBJS_FLAGS = -Wl,--whole-archive
POST_OBJS_FLAGS = -Wl,--no-whole-archive
endif
PORT_OBJS := $(portdir)/source/blitters.o $(portdir)/source/cdaudio.o $(portdir)/source/dsmain.o \
PORT_OBJS := $(portdir)/source/blitters_arm.o $(portdir)/source/cdaudio.o $(portdir)/source/dsmain.o \
$(portdir)/../../../fs/ds/ds-fs.o $(portdir)/source/gbampsave.o $(portdir)/source/scummhelp.o\
$(portdir)/source/osystem_ds.o $(portdir)/source/portdefs.o $(portdir)/source/ramsave.o\
$(portdir)/source/scummconsole.o $(portdir)/source/touchkeyboard.o $(portdir)/source/zipreader.o\
@ -423,8 +426,8 @@ endif
#---------------------------------------------------------------------------------
%.nds: %.bin
@echo ndstool -c $@ -9 scummvm.bin $(ARM7BIN) -b ../../$(LOGO) "$(shell basename $@);ScummVM 0.10.0;DS Port"
ndstool -c $@ -9 scummvm.bin $(ARM7BIN) -b ../../$(LOGO) "$(shell basename $@);ScummVM 0.10.0;DS Port"
@echo ndstool -c $@ -9 scummvm.bin $(ARM7BIN) -b ../../$(LOGO) "$(shell basename $@);ScummVM 0.11.0;DS Port"
ndstool -c $@ -9 scummvm.bin $(ARM7BIN) -b ../../$(LOGO) "$(shell basename $@);ScummVM 0.11.0;DS Port"
dsbuild $@ -l ../ndsloader.bin
padbin 16 $(basename $@).ds.gba

View File

@ -1,6 +1,8 @@
/* ScummVM - Scumm Interpreter
* Copyright (C) 2005-2006 Neil Millstone
* Copyright (C) 2006 The ScummVM project
/* 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

View File

@ -21,17 +21,6 @@
*/
// - Turn off when quit - Done
// - Simon and Kyrandia - Done
// - 200% scale option - Done
// - Change zoom range - Done
// - Speed increase! - Done
// - Fixed bugs in Sky - Done
// - Change name of ini file and intro screen for build c - Done
// - Check for existance of zip file in batch file - Done
// - Add new support - Done
// - Fix help screen
// - Remove scummconsole.c
// - Delete files
// - Fatlib conversion?
@ -39,38 +28,15 @@
// - libcartreset
// - Alternative controls - tap for left click, double for right
// - Inherit the Earth?
// - New Supercard, M3 drivers?
// - Stereo audio?
// - Delete saves?
// - Software scaler?
// - 100% scale
// - Arrow keys cause key events when keyboard enabled - Done
// - Mouse cursor display - Done
// - Disable scaler on options menu - Done
// - Fix scale icons on top screen - Done
// - Fseek optimisation? - No need
// - Fix agi hack to be cleaner - done
// - Fix not typing looong words - Done
// - Show keyboard by default in AGI games
// - Fix mouse moving when cursor on keyboard screen - Done
// - Fix 'fit' thingy always appearing - Done
// - check cine backbuffer code - Done
// - Add long filename support - Done
// - New icons
// - Add key config for gob engine: Start:F1, Shift-numbers: F keys - Done
// - Fix [ds] appearing in game menu
// - Find out what's going wrong when you turn the console off
// - enable console when asserting
// - AGI: Adding keyboard hack
// - CINE: Framebuffer modification should check if it works without, fix for overwrite crash
// - KYRA: GetFileSize modification
// - Alternative controls?
//#define USE_LIBCARTRESET
//#define USE_BUILT_IN_DRIVER_SELECTION
#define USE_LIBCARTRESET
#include <nds.h>
@ -102,7 +68,7 @@
#include "cartreset_nolibfat.h"
#include "keys.h"
#include "profiler/cyg-profile.h"
//test
#include "blitters.h"
namespace DS {
@ -245,7 +211,7 @@ gameListType gameList[NUM_SUPPORTED_GAMES] = {
{"sky", CONT_SKY},
{"simon1", CONT_SIMON},
{"simon2", CONT_SIMON},
{"gob", CONT_GOBLINS},
{"gob1", CONT_SCUMM_ORIGINAL},
{"queen", CONT_SCUMM_ORIGINAL},
{"cine", CONT_FUTURE_WARS},
{"agi", CONT_AGI}
@ -441,7 +407,7 @@ void initGame() {
//strcpy(gameName, ConfMan.getActiveDomain().c_str());
strcpy(gameName, ConfMan.get("gameid").c_str());
//consolePrintf("\n\n\n\nCurrent game: '%s' %d\n", gameName, gameName[0]);
consolePrintf("\n\n\n\nCurrent game: '%s' %d\n", gameName, gameName[0]);
currentGame = &gameList[0]; // Default game
@ -962,25 +928,25 @@ void addIndyFightingKeys() {
if ((getKeysChanged() & KEY_UP)) {
event.type = getKeyEvent(KEY_UP);
event.kbd.keycode = '8';
event.kbd.keycode = Common::KEYCODE_8;
event.kbd.ascii = '8';
system->addEvent(event);
}
if ((getKeysChanged() & KEY_LEFT)) {
event.type = getKeyEvent(KEY_LEFT);
event.kbd.keycode = '4';
event.kbd.keycode = Common::KEYCODE_4;
event.kbd.ascii = '4';
system->addEvent(event);
}
if ((getKeysChanged() & KEY_RIGHT)) {
event.type = getKeyEvent(KEY_RIGHT);
event.kbd.keycode = '6';
event.kbd.keycode = Common::KEYCODE_6;
event.kbd.ascii = '6';
system->addEvent(event);
}
if ((getKeysChanged() & KEY_DOWN)) {
event.type = getKeyEvent(KEY_DOWN);
event.kbd.keycode = '2';
event.kbd.keycode = Common::KEYCODE_2;
event.kbd.ascii = '2';
system->addEvent(event);
}
@ -989,19 +955,19 @@ void addIndyFightingKeys() {
if ((getKeysChanged() & KEY_X)) {
event.type = getKeyEvent(KEY_X);
event.kbd.keycode = '9';
event.kbd.keycode = Common::KEYCODE_9;
event.kbd.ascii = '9';
system->addEvent(event);
}
if ((getKeysChanged() & KEY_A)) {
event.type = getKeyEvent(KEY_A);
event.kbd.keycode = '6';
event.kbd.keycode = Common::KEYCODE_6;
event.kbd.ascii = '6';
system->addEvent(event);
}
if ((getKeysChanged() & KEY_B)) {
event.type = getKeyEvent(KEY_B);
event.kbd.keycode = '3';
event.kbd.keycode = Common::KEYCODE_3;
event.kbd.ascii = '3';
system->addEvent(event);
}
@ -1010,19 +976,19 @@ void addIndyFightingKeys() {
if ((getKeysChanged() & KEY_X)) {
event.type = getKeyEvent(KEY_X);
event.kbd.keycode = '7';
event.kbd.keycode = Common::KEYCODE_7;
event.kbd.ascii = '7';
system->addEvent(event);
}
if ((getKeysChanged() & KEY_A)) {
event.type = getKeyEvent(KEY_A);
event.kbd.keycode = '4';
event.kbd.keycode = Common::KEYCODE_4;
event.kbd.ascii = '4';
system->addEvent(event);
}
if ((getKeysChanged() & KEY_B)) {
event.type = getKeyEvent(KEY_B);
event.kbd.keycode = '1';
event.kbd.keycode = Common::KEYCODE_1;
event.kbd.ascii = '1';
system->addEvent(event);
}
@ -1032,7 +998,7 @@ void addIndyFightingKeys() {
if ((getKeysChanged() & KEY_Y)) {
event.type = getKeyEvent(KEY_Y);
event.kbd.keycode = '5';
event.kbd.keycode = Common::KEYCODE_5;
event.kbd.ascii = '5';
system->addEvent(event);
}
@ -1143,7 +1109,7 @@ void addEventsToQueue() {
if (!indyFightState) {
if ((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) && (getKeysChanged() & KEY_B)) {
event.kbd.keycode = 27;
event.kbd.keycode = Common::KEYCODE_ESCAPE;
event.kbd.ascii = 27;
event.kbd.flags = 0;
@ -1168,26 +1134,26 @@ void addEventsToQueue() {
event.kbd.flags = 0;
if (getKeysChanged() & KEY_LEFT) {
event.kbd.keycode = SDLK_LEFT;
event.kbd.ascii = SDLK_LEFT;
event.kbd.keycode = Common::KEYCODE_LEFT;
event.kbd.ascii = 0;
event.type = getKeyEvent(KEY_LEFT);
}
if (getKeysChanged() & KEY_RIGHT) {
event.kbd.keycode = SDLK_RIGHT;
event.kbd.ascii = SDLK_RIGHT;
event.kbd.keycode = Common::KEYCODE_RIGHT;
event.kbd.ascii = 0;
event.type = getKeyEvent(KEY_RIGHT);
}
if (getKeysChanged() & KEY_UP) {
event.kbd.keycode = SDLK_UP;
event.kbd.ascii = SDLK_UP;
event.kbd.keycode = Common::KEYCODE_UP;
event.kbd.ascii = 0;
event.type = getKeyEvent(KEY_UP);
}
if (getKeysChanged() & KEY_DOWN) {
event.kbd.keycode = SDLK_DOWN;
event.kbd.ascii = SDLK_DOWN;
event.kbd.keycode = Common::KEYCODE_DOWN;
event.kbd.ascii = 0;
event.type = getKeyEvent(KEY_DOWN);
}
@ -1323,8 +1289,8 @@ void addEventsToQueue() {
Common::Event event;
event.type = getKeyEvent(KEY_DOWN);
event.kbd.keycode = '#'; // F10 or # - show hotspots
event.kbd.ascii = '#';
event.kbd.keycode = Common::KEYCODE_F10; // F10 or # - show hotspots
event.kbd.ascii = Common::ASCII_F10;
event.kbd.flags = 0;
system->addEvent(event);
// consolePrintf("F10\n");
@ -1337,7 +1303,7 @@ void addEventsToQueue() {
Common::Event event;
event.type = getKeyEvent(KEY_DOWN);
event.kbd.keycode = '.'; // Full stop - skips current dialogue line
event.kbd.keycode = Common::KEYCODE_PERIOD; // Full stop - skips current dialogue line
event.kbd.ascii = '.';
event.kbd.flags = 0;
system->addEvent(event);
@ -1397,6 +1363,7 @@ void addEventsToQueue() {
// consolePrintf("!!!!!F5!!!!!");
}
event.kbd.flags = 0;
consolePrintf("!!!!!F5!!!!!");
system->addEvent(event);
}

View File

@ -197,7 +197,7 @@ void togglePause() {
OSystem_DS* system = OSystem_DS::instance();
event.type = Common::EVENT_KEYDOWN;
event.kbd.keycode = 'p';
event.kbd.keycode = Common::KEYCODE_p;
event.kbd.ascii = 'p';
event.kbd.flags = 0;
system->addEvent(event);

View File

@ -152,6 +152,24 @@ void OSystem_DS::setPalette(const byte *colors, uint start, uint num) {
}
}
bool OSystem_DS::grabRawScreen(Graphics::Surface* surf) {
surf->create(DS::getGameWidth(), DS::getGameHeight(), 1);
// Ensure we copy using 16 bit quantities due to limitation of VRAM addressing
u16* image = (u16 *) DS::get8BitBackBuffer();
for (int y = 0; y < DS::getGameHeight(); y++)
{
DC_FlushRange(image + (y << 8), DS::getGameWidth());
for (int x = 0; x < DS::getGameWidth() >> 1; x++)
{
*(((u16 *) (surf->pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[y << 8 + x];
}
}
return true;
}
void OSystem_DS::grabPalette(unsigned char *colors, uint start, uint num) {
// consolePrintf("Grabpalette");
@ -325,7 +343,7 @@ bool OSystem_DS::pollEvent(Common::Event &event)
// So we make it something harmless which won't cause any adverse effects.
event.type = Common::EVENT_KEYUP;
event.kbd.ascii = 0;
event.kbd.keycode = 0;
event.kbd.keycode = Common::KEYCODE_INVALID;
event.kbd.flags = 0;
// consolePrintf("type: %d\n", event.type);
return false;
@ -478,25 +496,36 @@ Common::SaveFileManager* OSystem_DS::getSavefileManager()
}
}
bool OSystem_DS::grabRawScreen(Graphics::Surface* surf) {
surf->create(DS::getGameWidth(), DS::getGameHeight(), 1);
Graphics::Surface *OSystem_DS::lockScreen() {
/* // For now, we create a full temporary screen surface, to which we copy the
// the screen content. Later unlockScreen will copy everything back.
// Not very nice nor efficient, but at least works, and is not worse
// than in the bad old times where we used grabRawScreen + copyRectToScreen.
_framebuffer.create(DS::getGameWidth(), DS::getGameHeight(), 1);
// Ensure we copy using 16 bit quantities due to limitation of VRAM addressing
size_t imageStrideInBytes = DS::isCpuScalerEnabled()? DS::getGameWidth() : 512;
size_t imageStrideInWords = imageStrideInBytes / 2;
u16* image = (u16 *) DS::get8BitBackBuffer();
for (int y = 0; y < DS::getGameHeight(); y++)
{
DC_FlushRange(image + (y * imageStrideInWords), DS::getGameWidth());
DC_FlushRange(image + (y << 8), DS::getGameWidth());
for (int x = 0; x < DS::getGameWidth() >> 1; x++)
{
*(((u16 *) (surf->pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[y * imageStrideInWords + x];
*(((u16 *) (_framebuffer.pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[y << 8 + x];
}
}
return true;
return &_framebuffer;*/
}
void OSystem_DS::unlockScreen() {
/* // Copy temp framebuffer back to screen
copyRectToScreen((byte *)_framebuffer.pixels, _framebuffer.pitch, 0, 0, _framebuffer.w, _framebuffer.h);
// Free memory
_framebuffer.free(); */
}
void OSystem_DS::setFocusRectangle(const Common::Rect& rect) {
@ -524,3 +553,5 @@ OSystem *OSystem_DS_create() {
return new OSystem_DS();
}

View File

@ -31,6 +31,7 @@
#include "backends/saves/default/default-saves.h"
#include "backends/timer/default/default-timer.h"
#include "sound/mixer.h"
#include "graphics/surface.h"
class DSAudioMixer : public Audio::Mixer {
};
@ -53,9 +54,12 @@ public:
GBAMPSaveFileManager mpSaveManager;
DSAudioMixer* _mixer;
DSTimerManager* _timer;
Graphics::Surface _framebuffer;
static OSystem_DS* _instance;
typedef void (*SoundProc)(void *param, byte *buf, int len);
typedef int (*TimerProc)(int interval);
@ -137,6 +141,9 @@ public:
virtual void initBackend();
virtual Graphics::Surface *lockScreen();
virtual void unlockScreen();
virtual Audio::Mixer* getMixer() { return _mixer; }
virtual Common::TimerManager* getTimerManager() { return _timer; }
static int timerHandler(int t);

View File

@ -338,7 +338,7 @@ void updateTypeEvents()
Common::Event event;
OSystem_DS* system = OSystem_DS::instance();
event.kbd.keycode = autoCompleteBuffer[0];
event.kbd.keycode = (Common::KeyCode) autoCompleteBuffer[0];
event.kbd.ascii = autoCompleteBuffer[0];
event.type = Common::EVENT_KEYDOWN;
event.kbd.flags = 0;
@ -402,9 +402,9 @@ void addKeyboardEvents() {
if (!DS::shiftState) {
event.kbd.ascii = keys[r].character;
event.kbd.keycode = 0;
event.kbd.keycode = Common::KEYCODE_INVALID;
} else {
event.kbd.keycode = SDLK_F1 - (keys[r].character - '1');
event.kbd.keycode = (Common::KeyCode) (Common::KEYCODE_F1 - (keys[r].character - '1'));
event.kbd.ascii = 0;
}
@ -416,10 +416,10 @@ void addKeyboardEvents() {
event.kbd.ascii = keys[r].character;
}
event.kbd.keycode = event.kbd.ascii;
event.kbd.keycode = (Common::KeyCode) event.kbd.ascii;
} else {
event.kbd.ascii = keys[r].character;
event.kbd.keycode = keys[r].character;
event.kbd.keycode = (Common::KeyCode) keys[r].character;
}