[Scummvm-cvs-logs] SF.net SVN: scummvm:[43491] scummvm/branches/branch-1-0-0/backends
agent-q at users.sourceforge.net
agent-q at users.sourceforge.net
Mon Aug 17 21:26:15 CEST 2009
Revision: 43491
http://scummvm.svn.sourceforge.net/scummvm/?rev=43491&view=rev
Author: agent-q
Date: 2009-08-17 19:26:15 +0000 (Mon, 17 Aug 2009)
Log Message:
-----------
DS port changes:
- Disable dosbox OPL synth
- Add wrap functionality for memory allocs for debugging (disabled)
- Add gamma correction feature
- Fix debug console by implementing my own printf
- Fix vram corruption when keyboard enabled
- Implement configReadStream stuff
Modified Paths:
--------------
scummvm/branches/branch-1-0-0/backends/fs/ds/ds-fs.cpp
scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/makefile
scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/dsmain.cpp
scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/dsmain.h
scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/dsoptions.cpp
scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/dsoptions.h
scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/osystem_ds.cpp
scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/osystem_ds.h
scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/portdefs.h
Modified: scummvm/branches/branch-1-0-0/backends/fs/ds/ds-fs.cpp
===================================================================
--- scummvm/branches/branch-1-0-0/backends/fs/ds/ds-fs.cpp 2009-08-17 19:18:37 UTC (rev 43490)
+++ scummvm/branches/branch-1-0-0/backends/fs/ds/ds-fs.cpp 2009-08-17 19:26:15 UTC (rev 43491)
@@ -770,7 +770,7 @@
}
void std_fprintf(FILE* handle, const char* fmt, ...) {
- consolePrintf(fmt);
+ consolePrintf("%s", fmt);
}
Modified: scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/makefile
===================================================================
--- scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/makefile 2009-08-17 19:18:37 UTC (rev 43490)
+++ scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/makefile 2009-08-17 19:26:15 UTC (rev 43491)
@@ -90,6 +90,7 @@
ARM = 1
USE_ARM_SOUND_ASM = 1
USE_ARM_COSTUME_ASM = 1
+#WRAP_MALLOC = 1
ifdef DS_BUILD_A
DEFINES = -DDS_SCUMM_BUILD -DDS_BUILD_A -DUSE_ARM_GFX_ASM -DUSE_ARM_COSTUME_ASM
@@ -200,7 +201,7 @@
ASFLAGS = -mcpu=arm9tdmi -mthumb-interwork
-DEFINES += -D__DS__ -DNDS -DARM9 -DNONSTANDARD_PORT -DDISABLE_FANCY_THEMES -DVECTOR_RENDERER_FORMAT=1555 -DDISABLE_DEFAULT_SAVEFILEMANAGER -DARM
+DEFINES += -D__DS__ -DNDS -DARM9 -DNONSTANDARD_PORT -DDISABLE_FANCY_THEMES -DVECTOR_RENDERER_FORMAT=1555 -DDISABLE_DOSBOX_OPL -DDISABLE_DEFAULT_SAVEFILEMANAGER -DARM
ifdef USE_MAD
DEFINES += -DUSE_MAD
endif
@@ -212,6 +213,11 @@
LDFLAGS = -specs=ds_arm9.specs -mthumb-interwork -mno-fpu -Wl,-Map,map.txt -Wl,--gc-sections
+ifdef WRAP_MALLOC
+ LDFLAGS += -Wl,--wrap,malloc
+ DEFINES += -DWRAP_MALLOC
+endif
+
INCLUDES= -I$(portdir)/$(BUILD) -I$(srcdir) -I$(srcdir)/engines \
-I$(portdir)/data -I$(portdir)/../commoninclude \
-I$(portdir)/source -I$(portdir)/source/mad -I$(portdir)/source/libcartreset \
@@ -287,11 +293,12 @@
#$(portdir)/source/libcartreset/cartreset.o
# Files in this list will be optimisied for speed, otherwise they will be optimised for space
-OPTLIST := actor.cpp ds_main.cpp osystem_ds.cpp blitters.cpp fmopl.cpp rate.cpp isomap.cpp image.cpp gfx.cpp sprite.cpp actor_path.cpp actor_walk.cpp
+OPTLIST := actor.cpp ds_main.cpp osystem_ds.cpp blitters.cpp mame.cpp rate.cpp isomap.cpp image.cpp gfx.cpp sprite.cpp actor_path.cpp actor_walk.cpp
#OPTLIST :=
# Compiler options for files which should be optimised for speed
OPT_SPEED := -O3
+#OPT_SPEED := -Os -mthumb
# Compiler options for files which should be optimised for space
OPT_SIZE := -Os -mthumb
Modified: scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/dsmain.cpp
===================================================================
--- scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/dsmain.cpp 2009-08-17 19:18:37 UTC (rev 43490)
+++ scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/dsmain.cpp 2009-08-17 19:26:15 UTC (rev 43491)
@@ -61,7 +61,15 @@
// - Make save/restore game screen use scaler buffer
+// 1.0.0!
+// - Fix text on tabs on config screen
+// - Remove ini file debug msg
+// - Memory size for ite
+// - Try discworld?
+
+
+
//#define USE_LIBCARTRESET
#include <nds.h>
@@ -97,28 +105,71 @@
#include "backends/fs/ds/ds-fs.h"
#include "engine.h"
+
+
extern "C" void OurIntrMain(void);
extern "C" u32 getExceptionAddress( u32 opcodeAddress, u32 thumbState);
extern const char __itcm_start[];
static const char *registerNames[] =
{ "r0","r1","r2","r3","r4","r5","r6","r7",
- "r8 ","r9 ","r10","r11","r12","sp ","lr ","pc " };
+ "r8 ","r9 ","r10","r11","r12","sp ","lr ","pc" };
-/*
+#ifdef WRAP_MALLOC
+
extern "C" void* __real_malloc(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);
+
+ if (!res)
+ {
+// *((u8 *) NULL) = 0;
+ consolePrintf("Failed alloc (new) %d (%x)\n", size, poo);
+ return NULL;
+ }
+
+ return res;
+}
+
+
extern "C" void* __wrap_malloc(size_t size) {
+/* u32 addr;
+
+ asm("mov %0, lr"
+ : "=r" (addr)
+ :
+ : );*/
+
+ register unsigned int reg asm("lr");
+ volatile unsigned int poo = reg;
+
+
+ if (size == 0)
+ {
+ static int zeroSize = 0;
+ consolePrintf("0 size malloc (%d)", zeroSize++);
+ }
+
void* res = __real_malloc(size);
if (res) {
+ if (size > 100 * 1024) {
+ consolePrintf("Allocated %d (%d)\n", size, poo);
+ }
return res;
} else {
- consolePrintf("Failed alloc %d\n", size);
+
+// *((u8 *) NULL) = 0;
+ consolePrintf("Failed alloc %d (%x)\n", size, poo);
return NULL;
}
}
-*/
+#endif
namespace DS {
@@ -355,6 +406,10 @@
touchPadSensitivity = sensitivity;
}
+void setGamma(int gamma) {
+ OSystem_DS::instance()->setGammaValue(gamma);
+}
+
void setTopScreenZoom(int percentage) {
// 100 256
// 150 192
@@ -502,7 +557,6 @@
// static bool firstTime = true;
-
setOptions();
//strcpy(gameName, ConfMan.getActiveDomain().c_str());
@@ -625,20 +679,24 @@
- if (consoleEnable) {
- consoleInit(NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 2, 0, true);
- // Move the cursor to the bottom of the screen using ANSI escape code
- consolePrintf("\033[23;0f");
- }
+ consoleInit(NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 2, 0, true);
+ // Set this again because consoleinit resets it
+ videoSetMode(MODE_5_2D | (consoleEnable? DISPLAY_BG0_ACTIVE: 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP);
+ // Move the cursor to the bottom of the screen using ANSI escape code
+ consolePrintf("\033[23;0f");
+
+
for (int r = 0; r < 32 * 32; r++) {
((u16 *) SCREEN_BASE_BLOCK(2))[r] = buffer[r];
// dmaCopyHalfWords(3, (u16 *) SCREEN_BASE_BLOCK(0), buffer, 32 * 32 * 2);
}
// ConsoleInit destroys the hardware palette :-(
- OSystem_DS::instance()->restoreHardwarePalette();
+ if (OSystem_DS::instance()) {
+ OSystem_DS::instance()->restoreHardwarePalette();
+ }
// BG_PALETTE_SUB[255] = RGB15(31,31,31);//by default font will be rendered with color 255
@@ -2886,7 +2944,6 @@
void dsExceptionHandler() {
consolePrintf("Blue screen of death");
setExceptionHandler(NULL);
- while(1);
u32 currentMode = getCPSR() & 0x1f;
u32 thumbState = ((*(u32*)0x027FFD90) & 0x20);
@@ -3025,7 +3082,7 @@
consolePrintf("-------------------------------\n");
consolePrintf("ScummVM DS\n");
consolePrintf("Ported by Neil Millstone\n");
- consolePrintf("Version 0.13.1 beta1 ");
+ consolePrintf("Version 1.0.0 beta1 ");
#if defined(DS_BUILD_A)
consolePrintf("build A\n");
consolePrintf("Lucasarts SCUMM games (SCUMM)\n");
@@ -3219,3 +3276,13 @@
return DS::hBlankCount;
}
#endif
+
+
+extern "C" void consolePrintf(char * format, ...)
+{
+ char buffer[256];
+ va_list args;
+ va_start (args, format);
+ viprintf(format, args);
+ va_end (args);
+}
Modified: scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/dsmain.h
===================================================================
--- scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/dsmain.h 2009-08-17 19:18:37 UTC (rev 43490)
+++ scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/dsmain.h 2009-08-17 19:26:15 UTC (rev 43491)
@@ -85,6 +85,7 @@
void setTopScreenTarget(int x, int y);
void set200PercentFixedScale(bool on);
void setTopScreenZoom(int percentage);
+void setGamma(int gamma);
// Timers
void setTimerCallback(OSystem_DS::TimerProc proc, int interval); // Setup a callback function at a regular interval
Modified: scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/dsoptions.cpp
===================================================================
--- scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/dsoptions.cpp 2009-08-17 19:18:37 UTC (rev 43490)
+++ scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/dsoptions.cpp 2009-08-17 19:26:15 UTC (rev 43491)
@@ -94,18 +94,26 @@
_tab->addTab("Graphics");
- new GUI::StaticTextWidget(_tab, 5, 70, 180, 15, "Initial top screen scale:", Graphics::kTextAlignLeft);
+ new GUI::StaticTextWidget(_tab, 5, 67, 180, 15, "Initial top screen scale:", Graphics::kTextAlignLeft);
- _100PercentCheckbox = new GUI::CheckboxWidget(_tab, 5, 85, 230, 20, "100%", 0x30000001, 'T');
- _150PercentCheckbox = new GUI::CheckboxWidget(_tab, 5, 100, 230, 20, "150%", 0x30000002, 'T');
- _200PercentCheckbox = new GUI::CheckboxWidget(_tab, 5, 115, 230, 20, "200%", 0x30000003, 'T');
+ _100PercentCheckbox = new GUI::CheckboxWidget(_tab, 5, 82, 80, 20, "100%", 0x30000001, 'T');
+ _150PercentCheckbox = new GUI::CheckboxWidget(_tab, 5, 97, 80, 20, "150%", 0x30000002, 'T');
+ _200PercentCheckbox = new GUI::CheckboxWidget(_tab, 5, 112, 80, 20, "200%", 0x30000003, 'T');
new GUI::StaticTextWidget(_tab, 5, 5, 180, 15, "Main screen scaling:", Graphics::kTextAlignLeft);
_hardScaler = new GUI::CheckboxWidget(_tab, 5, 20, 270, 20, "Hardware scale (fast, but low quality)", 0x10000001, 'T');
_cpuScaler = new GUI::CheckboxWidget(_tab, 5, 35, 270, 20, "Software scale (good quality, but slower)", 0x10000002, 'S');
_unscaledCheckbox = new GUI::CheckboxWidget(_tab, 5, 50, 270, 20, "Unscaled (you must scroll left and right)", 0x10000003, 'S');
+
+ new GUI::StaticTextWidget(_tab, 5, 125, 110, 15, "Brightness:", Graphics::kTextAlignLeft);
+ _gammaCorrection = new GUI::SliderWidget(_tab, 130, 120, 130, 12, 1);
+ _gammaCorrection->setMinValue(0);
+ _gammaCorrection->setMaxValue(8);
+ _gammaCorrection->setValue(0);
+
+
_tab->addTab("General");
_highQualityAudioCheckbox = new GUI::CheckboxWidget(_tab, 5, 5, 250, 20, "High quality audio (slower) (reboot)", 0, 'T');
@@ -170,6 +178,12 @@
_150PercentCheckbox->setState(true);
}
+ if (ConfMan.hasKey("gamma", "ds")) {
+ _gammaCorrection->setValue(ConfMan.getInt("gamma", "ds"));
+ } else {
+ _gammaCorrection->setValue(0);
+ }
+
_highQualityAudioCheckbox->setState(confGetBool("22khzaudio", false));
_disablePowerOff->setState(confGetBool("disablepoweroff", false));
@@ -219,6 +233,7 @@
ConfMan.setBool("touchpad", _touchPadStyle->getState(), "ds");
ConfMan.setBool("screentaps", _screenTaps->getState(), "ds");
ConfMan.setInt("sensitivity", _sensitivity->getValue(), "ds");
+ ConfMan.setInt("gamma", _gammaCorrection->getValue(), "ds");
u32 zoomLevel = 150;
@@ -395,6 +410,9 @@
DS::setTapScreenClicksEnable(confGetBool("screentaps", false));
+ DS::setGamma(confGetInt("gamma", 0));
+
+
if (ConfMan.hasKey("touchpad", "ds")) {
bool enable = ConfMan.getBool("touchpad", "ds");
Modified: scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/dsoptions.h
===================================================================
--- scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/dsoptions.h 2009-08-17 19:18:37 UTC (rev 43490)
+++ scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/dsoptions.h 2009-08-17 19:26:15 UTC (rev 43491)
@@ -53,6 +53,7 @@
GUI::SliderWidget* _touchX;
GUI::SliderWidget* _touchY;
GUI::SliderWidget* _sensitivity;
+ GUI::SliderWidget* _gammaCorrection;
GUI::CheckboxWidget* _leftHandedCheckbox;
GUI::CheckboxWidget* _unscaledCheckbox;
GUI::CheckboxWidget* _100PercentCheckbox;
Modified: scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/osystem_ds.cpp
===================================================================
--- scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/osystem_ds.cpp 2009-08-17 19:18:37 UTC (rev 43490)
+++ scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/osystem_ds.cpp 2009-08-17 19:26:15 UTC (rev 43491)
@@ -40,12 +40,29 @@
#include <time.h>
+#if defined(DS_BUILD_A)
+#define DEFAULT_CONFIG_FILE "scummvm.ini"
+#elif defined(DS_BUILD_B)
+#define DEFAULT_CONFIG_FILE "scummvmb.ini"
+#elif defined(DS_BUILD_C)
+#define DEFAULT_CONFIG_FILE "scummvmc.ini"
+#elif defined(DS_BUILD_D)
+#define DEFAULT_CONFIG_FILE "scummvmd.ini"
+#elif defined(DS_BUILD_E)
+#define DEFAULT_CONFIG_FILE "scummvme.ini"
+#elif defined(DS_BUILD_F)
+#define DEFAULT_CONFIG_FILE "scummvmf.ini"
+#elif defined(DS_BUILD_G)
+#define DEFAULT_CONFIG_FILE "scummvmg.ini"
+#elif defined(DS_BUILD_H)
+#define DEFAULT_CONFIG_FILE "scummvmh.ini"
+#endif
OSystem_DS* OSystem_DS::_instance = NULL;
OSystem_DS::OSystem_DS()
: eventNum(0), lastPenFrame(0), queuePos(0), _mixer(NULL), _timer(NULL), _frameBufferExists(false),
- _disableCursorPalette(true), _graphicsEnable(true)
+ _disableCursorPalette(true), _graphicsEnable(true), _gammaValue(0)
{
// eventNum = 0;
// lastPenFrame = 0;
@@ -160,10 +177,13 @@
{
u16 paletteValue = red | (green << 5) | (blue << 10);
+
if (DS::getIsDisplayMode8Bit()) {
- BG_PALETTE[r] = paletteValue;
+ int col = applyGamma(paletteValue);
+ BG_PALETTE[r] = col;
+
if (!DS::getKeyboardEnable()) {
- BG_PALETTE_SUB[r] = paletteValue;
+ BG_PALETTE_SUB[r] = col;
}
}
@@ -180,10 +200,10 @@
// Set the hardware palette up based on the stored palette
for (int r = 0; r < 255; r++) {
- BG_PALETTE[r] = _palette[r];
-
+ int col = applyGamma(_palette[r]);
+ BG_PALETTE[r] = col;
if (!DS::getKeyboardEnable()) {
- BG_PALETTE_SUB[r] = _palette[r];
+ BG_PALETTE_SUB[r] = col;
}
}
}
@@ -207,6 +227,7 @@
}
_disableCursorPalette = false;
+ refreshCursor();
}
bool OSystem_DS::grabRawScreen(Graphics::Surface* surf) {
@@ -271,67 +292,117 @@
if (DS::getKeyboardEnable()) {
// When they keyboard is on screen, we don't update the subscreen because
- // the keyboard image uses the same VRAM addresses. In order to do this,
- // I'm going to update the main screen twice. This avoids putting a compare
- // in the loop and slowing down the common case.
- bgSub = bg;
- }
+ // the keyboard image uses the same VRAM addresses.
- for (int dy = y; dy < y + h; dy++) {
- u8* dest = ((u8 *) (bg)) + (dy * stride) + x;
- u8* destSub = ((u8 *) (bgSub)) + (dy * 512) + x;
- u8* src = (u8 *) buf + (pitch * by);
+ for (int dy = y; dy < y + h; dy++) {
+ u8* dest = ((u8 *) (bg)) + (dy * stride) + x;
+ u8* src = (u8 *) buf + (pitch * by);
+
+ u32 dx;
+
+ u32 pixelsLeft = w;
+
+ if (MISALIGNED16(dest)) {
+ // Read modify write
+
+ dest--;
+ u16 mix = *((u16 *) dest);
+
+ mix = (mix & 0x00FF) | (*src++ << 8);
+
+ *dest = mix;
+
+ dest += 2;
+ pixelsLeft--;
+ }
+
+ // We can now assume dest is aligned
+ u16* dest16 = (u16 *) dest;
+
+ for (dx = 0; dx < pixelsLeft; dx+=2) {
+ u16 mix;
+
+ mix = *src + (*(src + 1) << 8);
+ *dest16++ = mix;
+ src += 2;
+ }
+
+ pixelsLeft -= dx;
+
+ // At the end we may have one pixel left over
+
+ if (pixelsLeft != 0) {
+ u16 mix = *dest16;
+
+ mix = (mix & 0x00FF) | ((*src++) << 8);
+
+ *dest16 = mix;
+ }
- u32 dx;
-
- u32 pixelsLeft = w;
-
- if (MISALIGNED16(dest)) {
- // Read modify write
-
- dest--;
- u16 mix = *((u16 *) dest);
-
- mix = (mix & 0x00FF) | (*src++ << 8);
-
- *dest = mix;
- *destSub = mix;
-
- dest += 2;
- destSub += 2;
- pixelsLeft--;
+ by++;
}
- // We can now assume dest is aligned
- u16* dest16 = (u16 *) dest;
- u16* destSub16 = (u16 *) destSub;
+ } else {
+ // When they keyboard is not on screen, update both vram copies
- for (dx = 0; dx < pixelsLeft; dx+=2) {
- u16 mix;
+ for (int dy = y; dy < y + h; dy++) {
+ u8* dest = ((u8 *) (bg)) + (dy * stride) + x;
+ u8* destSub = ((u8 *) (bgSub)) + (dy * 512) + x;
+ u8* src = (u8 *) buf + (pitch * by);
+
+ u32 dx;
+
+ u32 pixelsLeft = w;
+
+ if (MISALIGNED16(dest)) {
+ // Read modify write
+
+ dest--;
+ u16 mix = *((u16 *) dest);
+
+ mix = (mix & 0x00FF) | (*src++ << 8);
+
+ *dest = mix;
+ *destSub = mix;
+
+ dest += 2;
+ destSub += 2;
+ pixelsLeft--;
+ }
+
+ // We can now assume dest is aligned
+ u16* dest16 = (u16 *) dest;
+ u16* destSub16 = (u16 *) destSub;
+
+ for (dx = 0; dx < pixelsLeft; dx+=2) {
+ u16 mix;
+
+ mix = *src + (*(src + 1) << 8);
+ *dest16++ = mix;
+ *destSub16++ = mix;
+ src += 2;
+ }
+
+ pixelsLeft -= dx;
+
+ // At the end we may have one pixel left over
+
+ if (pixelsLeft != 0) {
+ u16 mix = *dest16;
+
+ mix = (mix & 0x00FF) | ((*src++) << 8);
+
+ *dest16 = mix;
+ *destSub16 = mix;
+ }
- mix = *src + (*(src + 1) << 8);
- *dest16++ = mix;
- *destSub16++ = mix;
- src += 2;
- }
+ by++;
- pixelsLeft -= dx;
-
- // At the end we may have one pixel left over
-
- if (pixelsLeft != 0) {
- u16 mix = *dest16;
-
- mix = (mix & 0x00FF) | ((*src++) << 8);
-
- *dest16 = mix;
- *destSub16 = mix;
}
+ }
- by++;
+
- }
-
// consolePrintf("Slow method used!\n");
@@ -763,3 +834,45 @@
void OSystem_DS::setCharactersEntered(int count) {
DS::setCharactersEntered(count);
}
+
+Common::SeekableReadStream* OSystem_DS::createConfigReadStream() {
+ Common::FSNode file(DEFAULT_CONFIG_FILE);
+ consolePrintf("R %s", DEFAULT_CONFIG_FILE);
+ return file.createReadStream();
+}
+
+Common::WriteStream* OSystem_DS::createConfigWriteStream() {
+ Common::FSNode file(DEFAULT_CONFIG_FILE);
+ consolePrintf("W %s", DEFAULT_CONFIG_FILE);
+ return file.createWriteStream();
+}
+
+u16 OSystem_DS::applyGamma(u16 colour) {
+ // Attempt to do gamma correction (or something like it) to palette entries
+ // to improve the contrast of the image on the original DS screen.
+
+ // Split the colour into it's component channels
+ int r = colour & 0x001F;
+ int g = (colour & 0x03E0) >> 5;
+ int b = (colour & 0x7C00) >> 10;
+
+ // Caluclate the scaling factor for this colour based on it's brightness
+ int scale = ((23 - ((r + g + b) >> 2)) * _gammaValue) >> 3;
+
+ // Scale the three components by the scaling factor, with clamping
+ r = r + ((r * scale) >> 4);
+ if (r > 31) r = 31;
+
+ g = g + ((g * scale) >> 4);
+ if (g > 31) g = 31;
+
+ b = b + ((b * scale) >> 4);
+ if (b > 31) b = 31;
+
+ // Stick them back together into a 555 colour value
+ return 0x8000 | r | (g << 5) | (b << 10);
+}
+
+
+
+
Modified: scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/osystem_ds.h
===================================================================
--- scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/osystem_ds.h 2009-08-17 19:18:37 UTC (rev 43490)
+++ scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/osystem_ds.h 2009-08-17 19:26:15 UTC (rev 43491)
@@ -71,6 +71,8 @@
Graphics::Surface* createTempFrameBuffer();
bool _disableCursorPalette;
+ int _gammaValue;
+
public:
typedef void (*SoundProc)(byte *buf, int len);
typedef int (*TimerProc)(int interval);
@@ -171,6 +173,12 @@
FilesystemFactory *getFilesystemFactory();
void refreshCursor();
+
+ Common::WriteStream* createConfigWriteStream();
+ Common::SeekableReadStream* createConfigReadStream();
+
+ u16 applyGamma(u16 colour);
+ void setGammaValue(int gamma) { _gammaValue = gamma; }
};
static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
Modified: scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/portdefs.h
===================================================================
--- scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/portdefs.h 2009-08-17 19:18:37 UTC (rev 43490)
+++ scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/portdefs.h 2009-08-17 19:26:15 UTC (rev 43491)
@@ -55,20 +55,23 @@
#define DISABLE_TEXT_CONSOLE
#define DISABLE_COMMAND_LINE
+#define STREAM_AUDIO_FROM_DISK
+
+//#undef assert
+//#define assert(expr) consolePrintf("Asserted!")
+#define NO_DEBUG_MSGS
+
+
+// This is defined in dsmain.cpp
#ifdef __cplusplus
extern "C" {
#endif
-int consolePrintf(const char* s, ...);
+void consolePrintf(char * format, ...);
#ifdef __cplusplus
}
#endif
-//#undef assert
-//#define assert(expr) consolePrintf("Asserted!")
-#define NO_DEBUG_MSGS
-#define consolePrintf iprintf
-
#ifdef assert
#undef assert
#endif
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