aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2009-01-21 04:03:22 +0000
committerMax Horn2009-01-21 04:03:22 +0000
commit023fcd05a3e6e1b7087f4125789b482220225964 (patch)
tree6be6e73ed01db56e2e3ad1287db89d856333b860
parentedbf8c6720b3295224b7cdee368ee5582dd4c565 (diff)
downloadscummvm-rg350-023fcd05a3e6e1b7087f4125789b482220225964.tar.gz
scummvm-rg350-023fcd05a3e6e1b7087f4125789b482220225964.tar.bz2
scummvm-rg350-023fcd05a3e6e1b7087f4125789b482220225964.zip
cleanup
svn-id: r35976
-rw-r--r--backends/platform/ds/arm9/source/dsoptions.cpp15
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.cpp55
-rw-r--r--backends/platform/ds/arm9/source/touchkeyboard.cpp2
-rw-r--r--backends/platform/ds/arm9/source/touchkeyboard.h2
-rw-r--r--backends/platform/ds/arm9/source/wordcompletion.cpp25
-rw-r--r--backends/platform/ds/arm9/source/wordcompletion.h4
6 files changed, 42 insertions, 61 deletions
diff --git a/backends/platform/ds/arm9/source/dsoptions.cpp b/backends/platform/ds/arm9/source/dsoptions.cpp
index 277e8876c3..d82562022e 100644
--- a/backends/platform/ds/arm9/source/dsoptions.cpp
+++ b/backends/platform/ds/arm9/source/dsoptions.cpp
@@ -284,28 +284,23 @@ void DSOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint
static bool guard = false;
- if ((!guard) && (_radioButtonMode))
- {
+ if ((!guard) && (_radioButtonMode)) {
guard = true;
- if ((cmd & 0xFF000000) == 0x10000000)
- {
+ if ((cmd & 0xFF000000) == 0x10000000) {
_cpuScaler->setState(false);
_hardScaler->setState(false);
_unscaledCheckbox->setState(false);
- if ((sender == _cpuScaler) && (cmd == 0x10000002))
- {
+ if ((sender == _cpuScaler) && (cmd == 0x10000002)) {
_cpuScaler->setState(true);
}
- if ((sender == _hardScaler) && (cmd == 0x10000001))
- {
+ if ((sender == _hardScaler) && (cmd == 0x10000001)) {
_hardScaler->setState(true);
}
- if ((sender == _unscaledCheckbox) && (cmd == 0x10000003))
- {
+ if ((sender == _unscaledCheckbox) && (cmd == 0x10000003)) {
_unscaledCheckbox->setState(true);
}
}
diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp
index dac9e59588..a9718b4c3c 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.cpp
+++ b/backends/platform/ds/arm9/source/osystem_ds.cpp
@@ -85,18 +85,17 @@ void OSystem_DS::initBackend() {
}
bool OSystem_DS::hasFeature(Feature f) {
-// consolePrintf("hasfeature\n");
return (f == kFeatureVirtualKeyboard) || (f == kFeatureCursorHasPalette);
}
void OSystem_DS::setFeatureState(Feature f, bool enable) {
-// consolePrintf("setfeature f=%d e=%d\n", f, enable);
- if (f == kFeatureVirtualKeyboard) DS::setKeyboardIcon(enable);
+ if (f == kFeatureVirtualKeyboard)
+ DS::setKeyboardIcon(enable);
}
bool OSystem_DS::getFeatureState(Feature f) {
-// consolePrintf("getfeat\n");
- if (f == kFeatureVirtualKeyboard) return DS::getKeyboardIcon();
+ if (f == kFeatureVirtualKeyboard)
+ return DS::getKeyboardIcon();
return false;
}
@@ -201,11 +200,9 @@ bool OSystem_DS::grabRawScreen(Graphics::Surface* surf) {
const u16* image = (const u16 *) DS::get8BitBackBuffer();
- for (int y = 0; y < DS::getGameHeight(); y++)
- {
+ for (int y = 0; y < DS::getGameHeight(); y++) {
DC_FlushRange(image + (y << 8), DS::getGameWidth());
- for (int x = 0; x < DS::getGameWidth() >> 1; x++)
- {
+ for (int x = 0; x < DS::getGameWidth() >> 1; x++) {
*(((u16 *) (surf->pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[(y << 8) + x];
}
}
@@ -235,16 +232,16 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int
u16* bg;
s32 stride;
- u16* bgSub = (u16 *) BG_GFX_SUB;
+ u16* bgSub = (u16 *)BG_GFX_SUB;
// The DS video RAM doesn't support 8-bit writes because Nintendo wanted
// to save a few pennies/euro cents on the hardware.
if (_frameBufferExists) {
- bg = (u16 *) _framebuffer.pixels;
+ bg = (u16 *)_framebuffer.pixels;
stride = _framebuffer.pitch;
} else {
- bg = (u16 *) DS::get8BitBackBuffer();
+ bg = (u16 *)DS::get8BitBackBuffer();
stride = DS::get8BitBackBufferStride();
}
@@ -370,6 +367,7 @@ void OSystem_DS::updateScreen() {
// DS::doTimerCallback();
DS::addEventsToQueue();
+ // FIXME: Evil game specific hack.
// Force back buffer usage for Nippon Safes, as it doesn't double buffer it's output
if (DS::getControlType() == DS::CONT_NIPPON) {
OSystem_DS::instance()->lockScreen();
@@ -381,25 +379,25 @@ void OSystem_DS::setShakePos(int shakeOffset) {
DS::setShakePos(shakeOffset);
}
-void OSystem_DS::showOverlay () {
+void OSystem_DS::showOverlay() {
// consolePrintf("showovl\n");
DS::displayMode16Bit();
}
-void OSystem_DS::hideOverlay () {
+void OSystem_DS::hideOverlay() {
DS::displayMode8Bit();
}
-void OSystem_DS::clearOverlay () {
+void OSystem_DS::clearOverlay() {
memset((u16 *) DS::get16BitBackBuffer(), 0, 512 * 256 * 2);
// consolePrintf("clearovl\n");
}
-void OSystem_DS::grabOverlay (OverlayColor *buf, int pitch) {
+void OSystem_DS::grabOverlay(OverlayColor *buf, int pitch) {
// consolePrintf("grabovl\n");
}
-void OSystem_DS::copyRectToOverlay (const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
+void OSystem_DS::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
u16* bg = (u16 *) DS::get16BitBackBuffer();
const u16* src = (const u16 *) buf;
@@ -591,8 +589,7 @@ void OSystem_DS::stopCD() {
DS::CD::stopTrack();
}
-void OSystem_DS::updateCD()
-{
+void OSystem_DS::updateCD() {
}
void OSystem_DS::quit() {
@@ -638,10 +635,12 @@ Graphics::Surface* OSystem_DS::createTempFrameBuffer() {
// Ensure we copy using 16 bit quantities due to limitation of VRAM addressing
- // If the scaler is enabled, we can just return the 8 bit back buffer, since it's in system memory
- // memory anyway. Otherwise, we need to copy the back buffer into the memory normally used by the scaler buffer and
- // then return it.
- // We must make sure that once the frame buffer is created, future calls to copyRectToScreen() copy to this buffer
+ // If the scaler is enabled, we can just return the 8 bit back buffer,
+ // since it's in system memory anyway. Otherwise, we need to copy the back
+ // buffer into the memory normally used by the scaler buffer and then
+ // return it.
+ // We also must ensure that once the frame buffer is created, future calls
+ // to copyRectToScreen() copy to this buffer.
if (DS::isCpuScalerEnabled()) {
@@ -651,7 +650,6 @@ Graphics::Surface* OSystem_DS::createTempFrameBuffer() {
_framebuffer.pitch = DS::getGameWidth();
_framebuffer.bytesPerPixel = 1;
-
} else {
s32 height = DS::getGameHeight();
@@ -720,7 +718,7 @@ void OSystem_DS::clearFocusRectangle() {
void OSystem_DS::addAutoComplete(const char *word) {
- DS::addAutoComplete((char *) word);
+ DS::addAutoComplete(word);
}
void OSystem_DS::clearAutoComplete() {
@@ -730,10 +728,3 @@ void OSystem_DS::clearAutoComplete() {
void OSystem_DS::setCharactersEntered(int count) {
DS::setCharactersEntered(count);
}
-
-OSystem *OSystem_DS_create() {
- return new OSystem_DS();
-}
-
-
-
diff --git a/backends/platform/ds/arm9/source/touchkeyboard.cpp b/backends/platform/ds/arm9/source/touchkeyboard.cpp
index 6ff8a60392..ddf182950d 100644
--- a/backends/platform/ds/arm9/source/touchkeyboard.cpp
+++ b/backends/platform/ds/arm9/source/touchkeyboard.cpp
@@ -299,7 +299,7 @@ void setKeyHighlight(int key, bool highlight) {
}
}
-void addAutoComplete(char* word) {
+void addAutoComplete(const char* word) {
if (autoCompleteCount == NUM_WORDS) return;
strcpy(&autoCompleteWord[autoCompleteCount++][0], word);
drawAutoComplete();
diff --git a/backends/platform/ds/arm9/source/touchkeyboard.h b/backends/platform/ds/arm9/source/touchkeyboard.h
index 2f9da16ace..2894281962 100644
--- a/backends/platform/ds/arm9/source/touchkeyboard.h
+++ b/backends/platform/ds/arm9/source/touchkeyboard.h
@@ -37,7 +37,7 @@ void restoreVRAM(int tileBase, int mapBase, u16* saveSpace);
void addKeyboardEvents();
bool getKeyboardClosed();
-void addAutoComplete(char* word);
+void addAutoComplete(const char* word);
void clearAutoComplete();
void setCharactersEntered(int count);
void releaseAllKeys();
diff --git a/backends/platform/ds/arm9/source/wordcompletion.cpp b/backends/platform/ds/arm9/source/wordcompletion.cpp
index 54d74c68d5..c66286d64d 100644
--- a/backends/platform/ds/arm9/source/wordcompletion.cpp
+++ b/backends/platform/ds/arm9/source/wordcompletion.cpp
@@ -17,16 +17,14 @@ int wordBufferPos = 0;
char* wordBufferPtr[MAX_WORD_COUNT];
int wordBufferPtrPos = 0;
-void addAutoCompleteLine(char* line) {
+void addAutoCompleteLine(const char *line) {
- while (*line != 0)
- {
+ while (*line != 0) {
char word[32];
int length;
// Skip the T9-style numbers
- while (*line != ' ')
- {
+ while (*line != ' ') {
line++;
}
line++;
@@ -64,15 +62,14 @@ int stringCompare(const void* a, const void* b) {
void sortAutoCompleteWordList() {
// Sort the whole word list into alphabetical order
- qsort((void *) wordBufferPtr, wordBufferPtrPos, 4, stringCompare);
+ qsort((void *)wordBufferPtr, wordBufferPtrPos, 4, stringCompare);
}
// Sends the current available words to the virtual keyboard code for display
-bool findWordCompletions(char* input)
-{
+bool findWordCompletions(const char* input) {
int min = 0;
int max = wordBufferPtrPos - 1;
- char* word;
+ char *word;
int position;
char partialWord[32];
@@ -92,8 +89,7 @@ bool findWordCompletions(char* input)
}
strcpy(partialWord, &input[start]);
- if (strlen(partialWord) == 0)
- {
+ if (*partialWord == 0) {
return false;
}
@@ -103,10 +99,8 @@ bool findWordCompletions(char* input)
// Get the word from the dictonary line
word = wordBufferPtr[position];
-
-
// Now check to see if the word is before or after the stub we're after
- int result = scumm_stricmp((const char *) partialWord, (const char *) word);
+ int result = scumm_stricmp(partialWord, word);
if (result == 0) {
// We've found the whole word. Aren't we good.
@@ -144,7 +138,8 @@ bool findWordCompletions(char* input)
if (!match) {
position++;
- if (position == wordBufferPtrPos) return false;
+ if (position == wordBufferPtrPos)
+ return false;
word = wordBufferPtr[position];
// consolePrintf("Final word: %s\n", word);
}
diff --git a/backends/platform/ds/arm9/source/wordcompletion.h b/backends/platform/ds/arm9/source/wordcompletion.h
index 980277d6bb..aa689ae8ec 100644
--- a/backends/platform/ds/arm9/source/wordcompletion.h
+++ b/backends/platform/ds/arm9/source/wordcompletion.h
@@ -1,7 +1,7 @@
namespace DS {
-extern bool findWordCompletions(char* input);
-extern void addAutoCompleteLine(char* line);
+extern bool findWordCompletions(const char *input);
+extern void addAutoCompleteLine(const char *line);
extern void sortAutoCompleteWordList();
}