diff options
author | Neil Millstone | 2007-08-18 11:10:41 +0000 |
---|---|---|
committer | Neil Millstone | 2007-08-18 11:10:41 +0000 |
commit | 4ccec7c25ade6cb3c98c96ea7850d897b592fe16 (patch) | |
tree | 3b70353142f6d0b1733a6130c5f82c7ae9338f10 /backends/platform/ds/arm9/source | |
parent | 0566bef99131925e5ca5a7d71bfadf4299b73c6e (diff) | |
download | scummvm-rg350-4ccec7c25ade6cb3c98c96ea7850d897b592fe16.tar.gz scummvm-rg350-4ccec7c25ade6cb3c98c96ea7850d897b592fe16.tar.bz2 scummvm-rg350-4ccec7c25ade6cb3c98c96ea7850d897b592fe16.zip |
Making DS port build again
svn-id: r28654
Diffstat (limited to 'backends/platform/ds/arm9/source')
-rw-r--r-- | backends/platform/ds/arm9/source/blitters.cpp | 8 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/dsmain.cpp | 99 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/dsoptions.cpp | 2 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/osystem_ds.cpp | 47 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/osystem_ds.h | 7 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/touchkeyboard.cpp | 10 |
6 files changed, 90 insertions, 83 deletions
diff --git a/backends/platform/ds/arm9/source/blitters.cpp b/backends/platform/ds/arm9/source/blitters.cpp index ec33a5aab4..9af3c5d611 100644 --- a/backends/platform/ds/arm9/source/blitters.cpp +++ b/backends/platform/ds/arm9/source/blitters.cpp @@ -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 diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp index aafa54e347..43008a1770 100644 --- a/backends/platform/ds/arm9/source/dsmain.cpp +++ b/backends/platform/ds/arm9/source/dsmain.cpp @@ -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 - - -//#define USE_LIBCARTRESET -//#define USE_BUILT_IN_DRIVER_SELECTION + +// - Alternative controls? + + + +#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); } diff --git a/backends/platform/ds/arm9/source/dsoptions.cpp b/backends/platform/ds/arm9/source/dsoptions.cpp index b29b1d9fa7..041b1ba0c6 100644 --- a/backends/platform/ds/arm9/source/dsoptions.cpp +++ b/backends/platform/ds/arm9/source/dsoptions.cpp @@ -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); diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index 32eafe1af7..39413d0723 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -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(); } + + diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h index d943a362ca..512617170b 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.h +++ b/backends/platform/ds/arm9/source/osystem_ds.h @@ -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); diff --git a/backends/platform/ds/arm9/source/touchkeyboard.cpp b/backends/platform/ds/arm9/source/touchkeyboard.cpp index 26f03ca9d1..26807bfa6a 100644 --- a/backends/platform/ds/arm9/source/touchkeyboard.cpp +++ b/backends/platform/ds/arm9/source/touchkeyboard.cpp @@ -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; } |