aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/PalmOS/Src/base_gfx.cpp2
-rw-r--r--backends/platform/PalmOS/Src/be_base.cpp16
-rw-r--r--backends/platform/PalmOS/Src/be_base.h9
-rw-r--r--backends/platform/PalmOS/Src/be_os5.h2
-rw-r--r--backends/platform/PalmOS/Src/be_zodiac.h2
-rw-r--r--backends/platform/PalmOS/Src/init_mathlib.cpp2
-rw-r--r--backends/platform/PalmOS/Src/init_sony.h2
-rw-r--r--backends/platform/PalmOS/Src/os5_gfx.cpp4
-rw-r--r--backends/platform/PalmOS/Src/os5_overlay.cpp10
-rw-r--r--backends/platform/PalmOS/Src/rumble.cpp2
-rw-r--r--backends/platform/PalmOS/Src/rumble.h2
-rw-r--r--backends/platform/PalmOS/Src/zodiac_gfx.cpp4
-rw-r--r--backends/platform/PalmOS/Src/zodiac_overlay.cpp10
-rw-r--r--backends/platform/dc/Makefile5
-rw-r--r--backends/platform/dc/dc-fs.cpp2
-rw-r--r--backends/platform/dc/dc.h14
-rw-r--r--backends/platform/dc/vmsave.cpp2
-rw-r--r--backends/platform/ds/arm9/makefile6
-rw-r--r--backends/platform/ds/arm9/source/blitters.cpp108
-rw-r--r--backends/platform/ds/arm9/source/blitters.h14
-rw-r--r--backends/platform/ds/arm9/source/blitters.s339
-rw-r--r--backends/platform/ds/arm9/source/cdaudio.cpp166
-rw-r--r--backends/platform/ds/arm9/source/cdaudio.h2
-rw-r--r--backends/platform/ds/arm9/source/console2.h4
-rw-r--r--backends/platform/ds/arm9/source/dsmain.cpp618
-rw-r--r--backends/platform/ds/arm9/source/dsmain.h4
-rw-r--r--backends/platform/ds/arm9/source/dsoptions.cpp98
-rw-r--r--backends/platform/ds/arm9/source/dsoptions.h11
-rw-r--r--backends/platform/ds/arm9/source/fat/disc_io.c54
-rw-r--r--backends/platform/ds/arm9/source/fat/disc_io.h6
-rw-r--r--backends/platform/ds/arm9/source/fat/gba_nds_fat.c512
-rw-r--r--backends/platform/ds/arm9/source/fat/gba_nds_fat.h28
-rw-r--r--backends/platform/ds/arm9/source/fat/io_dldi.h4
-rw-r--r--backends/platform/ds/arm9/source/fat/io_fcsr.h4
-rw-r--r--backends/platform/ds/arm9/source/fat/io_m3_common.h6
-rw-r--r--backends/platform/ds/arm9/source/fat/io_m3cf.h4
-rw-r--r--backends/platform/ds/arm9/source/fat/io_mmcf.h2
-rw-r--r--backends/platform/ds/arm9/source/fat/io_mpcf.h4
-rw-r--r--backends/platform/ds/arm9/source/fat/io_njsd.h4
-rw-r--r--backends/platform/ds/arm9/source/fat/io_nmmc.h4
-rw-r--r--backends/platform/ds/arm9/source/fat/io_sccf.h4
-rw-r--r--backends/platform/ds/arm9/source/fat/io_scsd.h8
-rw-r--r--backends/platform/ds/arm9/source/fat/io_sd_common.h10
-rw-r--r--backends/platform/ds/arm9/source/gbampsave.cpp44
-rw-r--r--backends/platform/ds/arm9/source/gbampsave.h18
-rw-r--r--backends/platform/ds/arm9/source/keys.cpp18
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.cpp98
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.h47
-rw-r--r--backends/platform/ds/arm9/source/portdefs.h6
-rw-r--r--backends/platform/ds/arm9/source/ramsave.cpp82
-rw-r--r--backends/platform/ds/arm9/source/ramsave.h44
-rw-r--r--backends/platform/ds/arm9/source/scummconsole.c11
-rw-r--r--backends/platform/ds/arm9/source/scummconsole.h4
-rw-r--r--backends/platform/ds/arm9/source/scummhelp.cpp2
-rw-r--r--backends/platform/ds/arm9/source/scummhelp.h4
-rw-r--r--backends/platform/ds/arm9/source/touchkeyboard.cpp116
-rw-r--r--backends/platform/ds/arm9/source/touchkeyboard.h2
-rw-r--r--backends/platform/ds/arm9/source/wordcompletion.cpp21
-rw-r--r--backends/platform/ds/arm9/source/zipreader.cpp62
-rw-r--r--backends/platform/ds/arm9/source/zipreader.h16
-rw-r--r--backends/platform/gp2x/gp2x-common.h10
-rw-r--r--backends/platform/gp2x/graphics.cpp8
-rw-r--r--backends/platform/iphone/osys_iphone.cpp62
-rw-r--r--backends/platform/iphone/osys_iphone.h10
-rw-r--r--backends/platform/null/null.cpp10
-rw-r--r--backends/platform/ps2/Gs2dScreen.cpp10
-rw-r--r--backends/platform/ps2/fileio.cpp2
-rw-r--r--backends/platform/ps2/iop/rpckbd/include/ps2kbd.h2
-rw-r--r--backends/platform/ps2/iop/rpckbd/src/irx_imports.h2
-rw-r--r--backends/platform/ps2/iop/rpckbd/src/us_keymap.h50
-rw-r--r--backends/platform/ps2/irxboot.cpp4
-rw-r--r--backends/platform/ps2/savefilemgr.cpp6
-rw-r--r--backends/platform/ps2/savefilemgr.h2
-rw-r--r--backends/platform/ps2/systemps2.cpp35
-rw-r--r--backends/platform/ps2/systemps2.h5
-rw-r--r--backends/platform/psp/osys_psp.cpp109
-rw-r--r--backends/platform/psp/osys_psp.h7
-rw-r--r--backends/platform/psp/osys_psp_gu.cpp10
-rw-r--r--backends/platform/psp/psp_main.cpp3
-rw-r--r--backends/platform/psp/trace.cpp5
-rw-r--r--backends/platform/sdl/events.cpp11
-rw-r--r--backends/platform/sdl/graphics.cpp578
-rw-r--r--backends/platform/sdl/sdl.cpp47
-rw-r--r--backends/platform/sdl/sdl.h68
-rw-r--r--backends/platform/symbian/AdaptAllMMPs.pl11
-rw-r--r--backends/platform/symbian/BuildPackageUpload_LocalSettings.pl15
-rw-r--r--backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in130
-rw-r--r--backends/platform/symbian/S60v3/scummvm_A0000658_loc.rss22
-rw-r--r--backends/platform/symbian/S60v3/scummvm_A0000658_reg.rss18
-rw-r--r--backends/platform/symbian/UIQ3/ScummVM_A0000658.rss49
-rw-r--r--backends/platform/symbian/UIQ3/ScummVM_A0000658_UIQ3.mmp.in132
-rw-r--r--backends/platform/symbian/UIQ3/scummvm_A0000658_loc.rss59
-rw-r--r--backends/platform/symbian/UIQ3/scummvm_A0000658_reg.rss18
-rw-r--r--backends/platform/symbian/mmp/scummvm_base.mmp.in1
-rw-r--r--backends/platform/symbian/mmp/scummvm_groovie.mmp.in57
-rw-r--r--backends/platform/symbian/mmp/scummvm_tucker.mmp.in57
-rw-r--r--backends/platform/symbian/res/scummvm_A0000658.rss62
-rw-r--r--backends/platform/symbian/src/SymbianActions.cpp2
-rw-r--r--backends/platform/symbian/src/SymbianOS.cpp10
-rw-r--r--backends/platform/symbian/src/portdefs.h3
-rw-r--r--backends/platform/symbian/src/vsnprintf.h38
-rw-r--r--backends/platform/wii/Makefile24
-rw-r--r--backends/platform/wii/gdb.txt4
-rw-r--r--backends/platform/wii/gecko_console.cpp91
-rw-r--r--backends/platform/wii/gecko_console.h14
-rw-r--r--backends/platform/wii/gx_supp.cpp9
-rw-r--r--backends/platform/wii/gx_supp.h2
-rw-r--r--backends/platform/wii/main.cpp37
-rw-r--r--backends/platform/wii/osystem.cpp4
-rw-r--r--backends/platform/wii/osystem.h7
-rw-r--r--backends/platform/wii/osystem_gfx.cpp31
-rw-r--r--backends/platform/wince/CEActionsPocket.cpp4
-rw-r--r--backends/platform/wince/CELauncherDialog.cpp11
-rw-r--r--backends/platform/wince/Makefile2
-rw-r--r--backends/platform/wince/missing/missing.cpp14
-rw-r--r--backends/platform/wince/wince-sdl.cpp278
-rw-r--r--backends/platform/wince/wince-sdl.h25
117 files changed, 2562 insertions, 2444 deletions
diff --git a/backends/platform/PalmOS/Src/base_gfx.cpp b/backends/platform/PalmOS/Src/base_gfx.cpp
index c96a258d52..cb40bb55e5 100644
--- a/backends/platform/PalmOS/Src/base_gfx.cpp
+++ b/backends/platform/PalmOS/Src/base_gfx.cpp
@@ -152,7 +152,7 @@ void OSystem_PalmBase::updateScreen() {
void OSystem_PalmBase::clearScreen() {
WinSetDrawWindow(WinGetDisplayWindow());
- WinSetBackColor(RGBToColor(0,0,0));
+ WinSetBackColor(Graphics::RGBToColor<ColorMasks<565> >(0,0,0));
WinEraseWindow();
}
diff --git a/backends/platform/PalmOS/Src/be_base.cpp b/backends/platform/PalmOS/Src/be_base.cpp
index 32e68bde9f..9e1fdf39d1 100644
--- a/backends/platform/PalmOS/Src/be_base.cpp
+++ b/backends/platform/PalmOS/Src/be_base.cpp
@@ -171,10 +171,22 @@ Common::SaveFileManager *OSystem_PalmBase::getSavefileManager() {
return _saveMgr;
}
-Audio::Mixer * OSystem_PalmBase::getMixer() {
+Audio::Mixer *OSystem_PalmBase::getMixer() {
return _mixerMgr;
}
-Common::TimerManager * OSystem_PalmBase::getTimerManager() {
+Common::TimerManager *OSystem_PalmBase::getTimerManager() {
return _timerMgr;
}
+
+#define PALMOS_CONFIG_FILE "/PALM/Programs/ScummVM/scummvm.ini"
+
+Common::SeekableReadStream *OSystem_PalmBase::openConfigFileForReading() {
+ Common::FSNode file(PALMOS_CONFIG_FILE);
+ return file.openForReading();
+}
+
+Common::WriteStream *OSystem_PalmBase::openConfigFileForWriting() {
+ Common::FSNode file(PALMOS_CONFIG_FILE);
+ return file.openForWriting();
+}
diff --git a/backends/platform/PalmOS/Src/be_base.h b/backends/platform/PalmOS/Src/be_base.h
index 582aae5d7a..009c5a9997 100644
--- a/backends/platform/PalmOS/Src/be_base.h
+++ b/backends/platform/PalmOS/Src/be_base.h
@@ -199,9 +199,6 @@ public:
virtual int16 getOverlayHeight();
virtual int16 getOverlayWidth();
- virtual OverlayColor ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b);
- virtual void colorToARGB(OverlayColor color, uint8 &a, uint8 &r, uint8 &g, uint8 &b);
-
virtual void setCursorPalette(const byte *colors, uint start, uint num);
virtual void disableCursorPalette(bool disable);
@@ -233,8 +230,7 @@ public:
void setPalette(const byte *colors, uint start, uint num);
void grabPalette(byte *colors, uint start, uint num);
- virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b) = 0;
- virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) = 0;
+ virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<565>(); }
bool pollEvent(Common::Event &event);
@@ -257,6 +253,9 @@ public:
Common::SaveFileManager *getSavefileManager();
Common::TimerManager *getTimerManager();
+
+ virtual Common::SeekableReadStream *openConfigFileForReading();
+ virtual Common::WriteStream *openConfigFileForWriting();
};
#endif
diff --git a/backends/platform/PalmOS/Src/be_os5.h b/backends/platform/PalmOS/Src/be_os5.h
index 99d1dd9dc1..c56688b98f 100644
--- a/backends/platform/PalmOS/Src/be_os5.h
+++ b/backends/platform/PalmOS/Src/be_os5.h
@@ -181,8 +181,6 @@ public:
virtual void clearOverlay();
virtual void grabOverlay(OverlayColor *buf, int pitch);
virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
- virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b);
- virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b);
void setWindowCaption(const char *caption);
diff --git a/backends/platform/PalmOS/Src/be_zodiac.h b/backends/platform/PalmOS/Src/be_zodiac.h
index 58e2ca88ac..28fcf29ddd 100644
--- a/backends/platform/PalmOS/Src/be_zodiac.h
+++ b/backends/platform/PalmOS/Src/be_zodiac.h
@@ -71,8 +71,6 @@ public:
void clearOverlay();
void grabOverlay(OverlayColor *buf, int pitch);
void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
- OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b);
- void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b);
};
#endif
diff --git a/backends/platform/PalmOS/Src/init_mathlib.cpp b/backends/platform/PalmOS/Src/init_mathlib.cpp
index 88cf8a21f2..1ea39c3e0a 100644
--- a/backends/platform/PalmOS/Src/init_mathlib.cpp
+++ b/backends/platform/PalmOS/Src/init_mathlib.cpp
@@ -26,4 +26,4 @@ void MathlibRelease() {
if (!useCount)
SysLibRemove(MathLibRef);
}
-} \ No newline at end of file
+}
diff --git a/backends/platform/PalmOS/Src/init_sony.h b/backends/platform/PalmOS/Src/init_sony.h
index 0316a012d7..86224283f6 100644
--- a/backends/platform/PalmOS/Src/init_sony.h
+++ b/backends/platform/PalmOS/Src/init_sony.h
@@ -37,4 +37,4 @@ void SonyHRRelease(UInt16 HRrefNum);
UInt8 SonyScreenSize(UInt16 HRrefNum, Coord *stdw, Coord *stdh, Coord *fullw, Coord *fullh);
-#endif \ No newline at end of file
+#endif
diff --git a/backends/platform/PalmOS/Src/os5_gfx.cpp b/backends/platform/PalmOS/Src/os5_gfx.cpp
index 2d26419dff..c02e1f7db4 100644
--- a/backends/platform/PalmOS/Src/os5_gfx.cpp
+++ b/backends/platform/PalmOS/Src/os5_gfx.cpp
@@ -77,8 +77,8 @@ void OSystem_PalmOS5::load_gfx_mode() {
__68K(PINSetInputTriggerState(pinInputTriggerDisabled));
}
- gVars->indicator.on = RGBToColor(0,255,0);
- gVars->indicator.off = RGBToColor(0,0,0);
+ gVars->indicator.on = Graphics::RGBToColor<ColorMasks<565> >(0,255,0);
+ gVars->indicator.off = Graphics::RGBToColor<ColorMasks<565> >(0,0,0);
_overlayH = alloc_screen(_screenWidth, _screenHeight);
_overlayP = (OverlayColor *)(BmpGetBits(WinGetBitmap(_overlayH)));
diff --git a/backends/platform/PalmOS/Src/os5_overlay.cpp b/backends/platform/PalmOS/Src/os5_overlay.cpp
index 5555c7ef08..2ffc082547 100644
--- a/backends/platform/PalmOS/Src/os5_overlay.cpp
+++ b/backends/platform/PalmOS/Src/os5_overlay.cpp
@@ -74,13 +74,3 @@ void OSystem_PalmOS5::copyRectToOverlay(const OverlayColor *buf, int pitch, int
buf += pitch;
} while (--h);
}
-
-OverlayColor OSystem_PalmOS5::RGBToColor(uint8 r, uint8 g, uint8 b) {
- return gfxMakeDisplayRGB(r, g, b);
-}
-
-void OSystem_PalmOS5::colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) {
- r = ((color >> 8) & 0xF8);
- g = ((color >> 3) & 0xFC);
- b = ((color << 3) & 0xF8);
-}
diff --git a/backends/platform/PalmOS/Src/rumble.cpp b/backends/platform/PalmOS/Src/rumble.cpp
index 6546aa9e90..513152f49c 100644
--- a/backends/platform/PalmOS/Src/rumble.cpp
+++ b/backends/platform/PalmOS/Src/rumble.cpp
@@ -137,4 +137,4 @@ void RumbleRelease() {
HwrVibrateAttributes(1, kHwrVibrateActive, &active);
#endif
}
-} \ No newline at end of file
+}
diff --git a/backends/platform/PalmOS/Src/rumble.h b/backends/platform/PalmOS/Src/rumble.h
index b95fa5f666..680c0eb164 100644
--- a/backends/platform/PalmOS/Src/rumble.h
+++ b/backends/platform/PalmOS/Src/rumble.h
@@ -31,4 +31,4 @@ void RumbleRun (Boolean active);
Boolean RumbleInit ();
void RumbleRelease ();
-#endif \ No newline at end of file
+#endif
diff --git a/backends/platform/PalmOS/Src/zodiac_gfx.cpp b/backends/platform/PalmOS/Src/zodiac_gfx.cpp
index e7f7adb773..866ee086f7 100644
--- a/backends/platform/PalmOS/Src/zodiac_gfx.cpp
+++ b/backends/platform/PalmOS/Src/zodiac_gfx.cpp
@@ -71,8 +71,8 @@ void OSystem_PalmZodiac::load_gfx_mode() {
SysSetOrientationTriggerState(sysOrientationTriggerDisabled);
PINSetInputTriggerState(pinInputTriggerDisabled);
- gVars->indicator.on = RGBToColor(0,255,0);
- gVars->indicator.off = RGBToColor(0,0,0);
+ gVars->indicator.on = Graphics::RGBToColor<ColorMasks<565> >(0,255,0);
+ gVars->indicator.off = Graphics::RGBToColor<ColorMasks<565> >(0,0,0);
_screenH = WinGetDisplayWindow();
_screenP = (byte *)BmpGetBits(WinGetBitmap(_screenH));
diff --git a/backends/platform/PalmOS/Src/zodiac_overlay.cpp b/backends/platform/PalmOS/Src/zodiac_overlay.cpp
index 34390853fc..f8322e8fa5 100644
--- a/backends/platform/PalmOS/Src/zodiac_overlay.cpp
+++ b/backends/platform/PalmOS/Src/zodiac_overlay.cpp
@@ -65,13 +65,3 @@ void OSystem_PalmZodiac::copyRectToOverlay(const OverlayColor *buf, int pitch, i
};
e = TwGfxDrawBitmap(_overlayP, &pos, &bmp);
}
-
-OverlayColor OSystem_PalmZodiac::RGBToColor(uint8 r, uint8 g, uint8 b) {
- return TwGfxMakeDisplayRGB(r, g, b);
-}
-
-void OSystem_PalmZodiac::colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) {
- r = ((color >> 8) & 0xF8);
- g = ((color >> 3) & 0xFC);
- b = ((color << 3) & 0xF8);
-}
diff --git a/backends/platform/dc/Makefile b/backends/platform/dc/Makefile
index db5861903b..127091dc2a 100644
--- a/backends/platform/dc/Makefile
+++ b/backends/platform/dc/Makefile
@@ -11,7 +11,7 @@ VPATH = $(srcdir)
CC = sh-elf-gcc -ml -m4-single-only
CXX = sh-elf-g++ -ml -m4-single-only
CXXFLAGS= -O3 -Wno-multichar -funroll-loops -fschedule-insns2 -fomit-frame-pointer -fdelete-null-pointer-checks -fno-exceptions
-DEFINES = -D__DC__ -DNONSTANDARD_PORT -DUSE_MAD -DUSE_ZLIB -DDISABLE_DEFAULT_SAVEFILEMANAGER
+DEFINES = -D__DC__ -DNONSTANDARD_PORT -DUSE_MAD -DUSE_ZLIB -DDISABLE_DEFAULT_SAVEFILEMANAGER -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE
LDFLAGS = -Wl,-Ttext,0x8c010000 -nostartfiles $(ronindir)/lib/crt0.o
INCLUDES= -I./ -I$(srcdir) -I$(ronindir)/include/ -I$(srcdir)/engines
LIBS = -L$(ronindir)/lib -lmad -lronin -lz -lm
@@ -47,7 +47,9 @@ ENABLE_CINE = $(ENABLED)
ENABLE_CRUISE = $(ENABLED)
ENABLE_DRASCULA = $(ENABLED)
ENABLE_GOB = $(ENABLED)
+ENABLE_GROOVIE = $(ENABLED)
ENABLE_IGOR = $(ENABLED)
+ENABLE_IHNM = $(ENABLED)
ENABLE_KYRA = $(ENABLED)
ENABLE_LURE = $(ENABLED)
ENABLE_M4 = $(ENABLED)
@@ -59,6 +61,7 @@ ENABLE_SKY = $(ENABLED)
ENABLE_SWORD1 = $(ENABLED)
ENABLE_SWORD2 = $(ENABLED)
ENABLE_TOUCHE = $(ENABLED)
+ENABLE_TUCKER = $(ENABLED)
OBJS := dcmain.o time.o display.o audio.o input.o selector.o icon.o \
label.o vmsave.o softkbd.o dcloader.o cache.o dc-fs.o
diff --git a/backends/platform/dc/dc-fs.cpp b/backends/platform/dc/dc-fs.cpp
index d77e1c86df..810eed836c 100644
--- a/backends/platform/dc/dc-fs.cpp
+++ b/backends/platform/dc/dc-fs.cpp
@@ -90,7 +90,7 @@ AbstractFSNode *RoninCDFileNode::makeFileNodePath(const Common::String &path) {
return new RoninCDFileNode(path);
} else if ((fd = open(path.c_str(), O_DIR|O_RDONLY)) >= 0) {
close(fd);
- return new RoninCDDirectoryNode(path);
+ return new RoninCDDirectoryNode(path);
} else {
return NULL;
}
diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h
index 54cd2e982b..f8e16a4d4f 100644
--- a/backends/platform/dc/dc.h
+++ b/backends/platform/dc/dc.h
@@ -155,19 +155,7 @@ class OSystem_Dreamcast : public OSystem, public FilesystemFactory {
void clearOverlay();
void grabOverlay(int16 *buf, int pitch);
void copyRectToOverlay(const int16 *buf, int pitch, int x, int y, int w, int h);
- OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b) { return ARGBToColor(255, r, g, b); }
- void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) {
- uint8 tmp; colorToARGB(color, tmp, r, g, b);
- }
- OverlayColor ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b) {
- return ((a&0xf0)<<8)|((r&0xf0)<<4)|(g&0xf0)|(b>>4);
- }
- void colorToARGB(OverlayColor color, uint8 &a, uint8 &r, uint8 &g, uint8 &b) {
- a = ((color>>8)&0xf0)|((color>>12)&0x0f);
- r = ((color>>4)&0xf0)|((color>>8)&0x0f);
- g = (color&0xf0)|((color>>4)&0x0f);
- b = ((color<<4)&0xf0)|(color&0x0f);
- }
+ virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<4444>(); }
// Mutex handling
MutexRef createMutex();
diff --git a/backends/platform/dc/vmsave.cpp b/backends/platform/dc/vmsave.cpp
index d17e1f6213..05b459f40f 100644
--- a/backends/platform/dc/vmsave.cpp
+++ b/backends/platform/dc/vmsave.cpp
@@ -28,7 +28,7 @@
#include "dc.h"
#include "icon.h"
#include <common/savefile.h>
-#include <gui/newgui.h>
+#include <gui/GuiManager.h>
#include <gui/message.h>
#include <backends/saves/compressed/compressed-saves.h>
diff --git a/backends/platform/ds/arm9/makefile b/backends/platform/ds/arm9/makefile
index e74bcf28da..8f191d1f7e 100644
--- a/backends/platform/ds/arm9/makefile
+++ b/backends/platform/ds/arm9/makefile
@@ -191,11 +191,12 @@ CXXFLAGS= $(CFLAGS) -Wno-non-virtual-dtor -Wno-unknown-pragmas -Wno-reorder \
ASFLAGS = -mcpu=arm9tdmi -mthumb-interwork
-DEFINES += -D__DS__ -DNDS -DARM9 -DNONSTANDARD_PORT -DDISABLE_FANCY_THEMES -DDISABLE_DEFAULT_SAVEFILEMANAGER -DARM
+DEFINES += -D__DS__ -DNDS -DARM9 -DNONSTANDARD_PORT -DDISABLE_FANCY_THEMES -DVECTOR_RENDERER_FORMAT=1555 -DDISABLE_DEFAULT_SAVEFILEMANAGER -DARM
ifdef USE_MAD
DEFINES += -DUSE_MAD
endif
+DEFINES += -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE -DREDUCE_MEMORY_USAGE
LDFLAGS = -specs=ds_arm9.specs -mthumb-interwork -Wl,--wrap,time -mno-fpu -Wl,-Map,map.txt -Wl,--gc-sections
@@ -248,7 +249,6 @@ endif
DATA_OBJS := $(portdir)/data/icons.o $(portdir)/data/keyboard.o $(portdir)/data/keyboard_pal.o $(portdir)/data/default_font.o $(portdir)/data/8x8font_tga.o
-
COMPRESSOR_OBJS :=
#$(portdir)/source/compressor/lz.o
@@ -274,7 +274,7 @@ LIBCARTRESET_OBJS :=
#$(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 mixer.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 fmopl.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
diff --git a/backends/platform/ds/arm9/source/blitters.cpp b/backends/platform/ds/arm9/source/blitters.cpp
index 582e15eb13..07c6b3fee1 100644
--- a/backends/platform/ds/arm9/source/blitters.cpp
+++ b/backends/platform/ds/arm9/source/blitters.cpp
@@ -27,25 +27,25 @@
namespace DS {
-void asmDrawStripToScreen(int height, int width, byte const* text, byte const* src, byte* dst,
+void asmDrawStripToScreen(int height, int width, byte const* text, byte const* src, byte* dst,
int vsPitch, int vmScreenWidth, int textSurfacePitch) {
if (height <= 0) height = 1;
if (width < 4) return;
-
-
+
+
width &= ~4;
// src = (const byte *) (((int) (src)) & (~4));
// dst = (byte *) (((int) (dst)) & (~4));
// text = (const byte *) (((int) (text)) & (~4));
-
+
asm ( "mov r5, %0\n" // Height
- "yLoop:\n"
+ "yLoop:\n"
"mov r3, #0\n" // X pos
-
+
"xLoop:\n"
-
+
"ldr r4, [%2, r3]\n" // Load text layer word
"cmp r4, %5\n"
"bne singleByteCompare\n"
@@ -54,7 +54,7 @@ void asmDrawStripToScreen(int height, int width, byte const* text, byte const* s
"add r3, r3, #4\n"
"cmp r3, %1\n" // x == width?
"blt xLoop\n"
-
+
"add %2, %2, %8\n" // src += vs->pitch
"add %3, %3, %6\n" // dst += _vm->_screenWidth
"add %4, %4, %7\n" // text += _textSurface.pitch
@@ -62,8 +62,8 @@ void asmDrawStripToScreen(int height, int width, byte const* text, byte const* s
"cmp r5, #0\n" // y == 0?
"bne yLoop\n"
"b end\n"
-
-
+
+
"singleByteCompare:\n"
"ldrb r4, [%2, r3]\n" // Load text byte
"cmps r4, %5, lsr #24\n" // Compare with mask
@@ -78,7 +78,7 @@ void asmDrawStripToScreen(int height, int width, byte const* text, byte const* s
"ldreqb r4, [%3, r3]\n" // Otherwise Load src byte
"streqb r4, [%4, r3]\n" // Store it
"add r3, r3, #1\n"
-
+
"ldrb r4, [%2, r3]\n" // Load text byte
"cmps r4, %5, lsr #24\n" // Compare with mask
"strneb r4, [%4, r3]\n" // Store if not equal
@@ -91,7 +91,7 @@ void asmDrawStripToScreen(int height, int width, byte const* text, byte const* s
"strneb r4, [%4, r3]\n" // Store if not equal
"ldreqb r4, [%3, r3]\n" // Otherwise Load src byte
"streqb r4, [%4, r3]\n" // Store it
- "add r3, r3, #1\n"
+ "add r3, r3, #1\n"
"cmps r3, %1\n" // x == width?
"blt xLoop\n" // Repeat
@@ -101,10 +101,10 @@ void asmDrawStripToScreen(int height, int width, byte const* text, byte const* s
"sub r5, r5, #1\n" // y -= 1
"cmp r5, #0\n" // y == 0?
"bne yLoop\n"
-
+
"end:\n"
: /* no output registers */
- : "r" (height), "r" (width), "r" (text), "r" (src), "r" (dst), "r" (CHARSET_MASK_TRANSPARENCY | (CHARSET_MASK_TRANSPARENCY << 8) | (CHARSET_MASK_TRANSPARENCY << 16) | (CHARSET_MASK_TRANSPARENCY << 24)),
+ : "r" (height), "r" (width), "r" (text), "r" (src), "r" (dst), "r" (CHARSET_MASK_TRANSPARENCY | (CHARSET_MASK_TRANSPARENCY << 8) | (CHARSET_MASK_TRANSPARENCY << 16) | (CHARSET_MASK_TRANSPARENCY << 24)),
"r" (vsPitch), "r" (vmScreenWidth), "r" (textSurfacePitch)
: "r5", "r3", "r4", "%2", "%3", "%4", "memory");
}
@@ -115,7 +115,7 @@ void asmCopy8Col(byte* dst, int dstPitch, const byte* src, int height) {
asm("ands r0, %3, #1\n"
"addne %3, %3, #1\n"
"bne roll2\n"
-
+
"yLoop2:\n"
"ldr r0, [%2, #0]\n"
"str r0, [%0, #0]\n"
@@ -131,7 +131,7 @@ void asmCopy8Col(byte* dst, int dstPitch, const byte* src, int height) {
"add %0, %0, %1\n"
"add %2, %2, %1\n"
"subs %3, %3, #2\n"
- "bne yLoop2\n"
+ "bne yLoop2\n"
: /* no output registers */
: "r" (dst), "r" (dstPitch), "r" (src), "r" (height)
@@ -150,7 +150,7 @@ void ComputeDivBy5TableIFN()
for (int i=0; i<160; ++i)
{
DIV_BY_5[i] = (2*i+5)/10;
- }
+ }
}
#ifdef PERFECT_5_TO_4_RESCALING
@@ -163,13 +163,13 @@ static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3
u32 bs3 = s3 & 0x1F;
u32 bs4 = s4 & 0x1F;
-#if 0
+#if 0
u32 gs0 = (s0 >> 5) & 0x1F;
u32 gs1 = (s1 >> 5) & 0x1F;
u32 gs2 = (s2 >> 5) & 0x1F;
u32 gs3 = (s3 >> 5) & 0x1F;
u32 gs4 = (s4 >> 5) & 0x1F;
-
+
u32 rs0 = (s0 >> 10) & 0x1F;
u32 rs1 = (s1 >> 10) & 0x1F;
u32 rs2 = (s2 >> 10) & 0x1F;
@@ -191,22 +191,22 @@ static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3
asm("and %0, %2, %1, lsr #10" : "=r"(rs3) : "r"(s3), "r"(mask) : );
asm("and %0, %2, %1, lsr #10" : "=r"(rs4) : "r"(s4), "r"(mask) : );
#endif
-
+
u32 rd0 = 4*rs0 + rs1;
u32 rd1 = 2*rs1 + rs1 + 2*rs2;
u32 rd2 = 2*rs2 + 2*rs3 + rs3;
u32 rd3 = rs3 + 4*rs4;
-
+
u32 gd0 = 4*gs0 + gs1;
u32 gd1 = 2*gs1 + gs1 + 2*gs2;
u32 gd2 = 2*gs2 + 2*gs3 + gs3;
u32 gd3 = gs3 + 4*gs4;
-
+
u32 bd0 = 4*bs0 + bs1;
u32 bd1 = 2*bs1 + bs1 + 2*bs2;
u32 bd2 = 2*bs2 + 2*bs3 + bs3;
u32 bd3 = bs3 + 4*bs4;
-
+
#if 0
// Offsetting for correct rounding
rd0 = rd0*2+5; rd1 = rd1*2+5; rd2 = rd2*2+5; rd3 = rd3*2+5;
@@ -217,14 +217,14 @@ static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3
gd0 = (gd0 * 51) >> 9; gd1 = (gd1 * 51) >> 9; gd2 = (gd2 * 51) >> 9; gd3 = (gd3 * 51) >> 9;
bd0 = (bd0 * 51) >> 9; bd1 = (bd1 * 51) >> 9; bd2 = (bd2 * 51) >> 9; bd3 = (bd3 * 51) >> 9;
#else
- rd0 = DIV_BY_5[rd0]; rd1 = DIV_BY_5[rd1]; rd2 = DIV_BY_5[rd2]; rd3 = DIV_BY_5[rd3];
- gd0 = DIV_BY_5[gd0]; gd1 = DIV_BY_5[gd1]; gd2 = DIV_BY_5[gd2]; gd3 = DIV_BY_5[gd3];
- bd0 = DIV_BY_5[bd0]; bd1 = DIV_BY_5[bd1]; bd2 = DIV_BY_5[bd2]; bd3 = DIV_BY_5[bd3];
+ rd0 = DIV_BY_5[rd0]; rd1 = DIV_BY_5[rd1]; rd2 = DIV_BY_5[rd2]; rd3 = DIV_BY_5[rd3];
+ gd0 = DIV_BY_5[gd0]; gd1 = DIV_BY_5[gd1]; gd2 = DIV_BY_5[gd2]; gd3 = DIV_BY_5[gd3];
+ bd0 = DIV_BY_5[bd0]; bd1 = DIV_BY_5[bd1]; bd2 = DIV_BY_5[bd2]; bd3 = DIV_BY_5[bd3];
#endif
-
+
u32 d10 = 0x80008000 | (rd1 << 26) | (gd1 << 21) | (bd1 << 16) | (rd0 << 10) | (gd0 << 5) | bd0;
u32 d32 = 0x80008000 | (rd3 << 26) | (gd3 << 21) | (bd3 << 16) | (rd2 << 10) | (gd2 << 5) | bd2;
-
+
((u32*)dest)[0] = d10;
((u32*)dest)[1] = d32;
}
@@ -233,7 +233,7 @@ static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3
u16* dest)
{
static const u32 MASK = 0x03E07C1F;
-
+
u32 argbargbs0 = u32(s0) | (u32(s0) << 16);
u32 argbargbs1 = u32(s1) | (u32(s1) << 16);
u32 argbargbs2 = u32(s2) | (u32(s2) << 16);
@@ -245,32 +245,32 @@ static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3
u32 grbs2 = argbargbs2 & MASK;
u32 grbs3 = argbargbs3 & MASK;
u32 grbs4 = argbargbs4 & MASK;
-
+
u32 grbd0 = (3*grbs0 + grbs1) >> 2;
u32 grbd1 = ( grbs1 + grbs2) >> 1;
u32 grbd2 = ( grbs2 + grbs3) >> 1;
u32 grbd3 = ( grbs3 + 3*grbs4) >> 2;
-
+
grbd0 &= MASK;
grbd1 &= MASK;
grbd2 &= MASK;
grbd3 &= MASK;
-
+
u32 d0 = grbd0 | (grbd0 >> 16);
u32 d1 = grbd1 | (grbd1 >> 16);
u32 d2 = grbd2 | (grbd2 >> 16);
u32 d3 = grbd3 | (grbd3 >> 16);
-
- d0 &= 0xFFFF;
- d1 &= 0xFFFF;
- d2 &= 0xFFFF;
- d3 &= 0xFFFF;
-
- d0 |= 0x8000;
- d1 |= 0x8000;
- d2 |= 0x8000;
- d3 |= 0x8000;
-
+
+ d0 &= 0xFFFF;
+ d1 &= 0xFFFF;
+ d2 &= 0xFFFF;
+ d3 &= 0xFFFF;
+
+ d0 |= 0x8000;
+ d1 |= 0x8000;
+ d2 |= 0x8000;
+ d3 |= 0x8000;
+
dest[0] = d0;
dest[1] = d1;
dest[2] = d2;
@@ -287,13 +287,13 @@ static inline void RescaleBlock_5x8888_To_4x1555( u32 s0, u32 s1, u32 s2, u32 s3
u32 bd0 = (d0 << 24) >> 24;
u32 bd1 = (d1 << 24) >> 24;
u32 gd0 = (d0 << 16) >> 24;
- u32 gd1 = (d1 << 16) >> 24;
+ u32 gd1 = (d1 << 16) >> 24;
u32 rd0 = (d0 >> 16);
u32 rd1 = (d1 >> 16);
-
+
rd0 = DIV_BY_5[rd0]; rd1 = DIV_BY_5[rd1];
gd0 = DIV_BY_5[gd0]; gd1 = DIV_BY_5[gd1];
- bd0 = DIV_BY_5[bd0]; bd1 = DIV_BY_5[bd1];
+ bd0 = DIV_BY_5[bd0]; bd1 = DIV_BY_5[bd1];
u32 d10 = 0x80008000 | (rd1 << 26) | (gd1 << 21) | (bd1 << 16) | (rd0 << 10) | (gd0 << 5) | bd0;
((u32*)dest)[0] = d10;
@@ -307,11 +307,11 @@ static inline void RescaleBlock_5x8888_To_4x1555( u32 s0, u32 s1, u32 s2, u32 s3
u32 rd2 = (d2 >> 16);
u32 rd3 = (d3 >> 16);
- rd2 = DIV_BY_5[rd2]; rd3 = DIV_BY_5[rd3];
- gd2 = DIV_BY_5[gd2]; gd3 = DIV_BY_5[gd3];
- bd2 = DIV_BY_5[bd2]; bd3 = DIV_BY_5[bd3];
+ rd2 = DIV_BY_5[rd2]; rd3 = DIV_BY_5[rd3];
+ gd2 = DIV_BY_5[gd2]; gd3 = DIV_BY_5[gd3];
+ bd2 = DIV_BY_5[bd2]; bd3 = DIV_BY_5[bd3];
u32 d32 = 0x80008000 | (rd3 << 26) | (gd3 << 21) | (bd3 << 16) | (rd2 << 10) | (gd2 << 5) | bd2;
-
+
((u32*)dest)[1] = d32;
}
@@ -320,7 +320,7 @@ static inline void RescaleBlock_5x8888_To_4x1555( u32 s0, u32 s1, u32 s2, u32 s3
static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16* dest, const u8* src, const u32* palette)
{
ComputeDivBy5TableIFN();
-
+
for (size_t i=0; i<64; ++i)
{
u32 s0 = palette[src[5*i+0]];
@@ -353,7 +353,7 @@ static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16* dest, const
static inline void Rescale_320x1555Scanline_To_256x1555Scanline(u16* dest, const u16* src)
{
ComputeDivBy5TableIFN();
-
+
for (size_t i=0; i<64; ++i)
{
u16 s0 = src[5*i+0];
@@ -384,7 +384,7 @@ void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, int destStri
for (size_t i=0; i<200; ++i)
{
- Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam);
+ Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam);
}
}
#else
@@ -396,7 +396,7 @@ void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, int destStri
for (size_t i=0; i<200; ++i)
{
- Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam);
+ Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam);
}
}
#endif
diff --git a/backends/platform/ds/arm9/source/blitters.h b/backends/platform/ds/arm9/source/blitters.h
index 463aa2ac02..5f541d1bd6 100644
--- a/backends/platform/ds/arm9/source/blitters.h
+++ b/backends/platform/ds/arm9/source/blitters.h
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
+
#ifndef _BLITTERS_H_
#define _BLITTERS_H_
@@ -29,23 +29,23 @@
namespace DS {
-void asmDrawStripToScreen(int height, int width, byte const* text, byte const* src, byte* dst,
+void asmDrawStripToScreen(int height, int width, byte const* text, byte const* src, byte* dst,
int vsPitch, int vmScreenWidth, int textSurfacePitch);
void asmCopy8Col(byte* dst, int dstPitch, const byte* src, int height);
void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, int destStride, int srcStride, const u16* palette);
void Rescale_320x256x1555_To_256x256x1555(u16* dest, const u16* src, int destStride, int srcStride);
}
-
+
#else
extern "C" {
-void asmDrawStripToScreen(int height, int width, byte const* text, byte const* src, byte* dst,
+void ITCM_CODE asmDrawStripToScreen(int height, int width, byte const* text, byte const* src, byte* dst,
int vsPitch, int vmScreenWidth, int textSurfacePitch);
-void asmCopy8Col(byte* dst, int dstPitch, const byte* src, int height);
-void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, int destStride, int srcStride, const u16* palette, u32 numLines);
-void Rescale_320x256x1555_To_256x256x1555(u16* dest, const u16* src, int destStride, int srcStride);
+void ITCM_CODE asmCopy8Col(byte* dst, int dstPitch, const byte* src, int height);
+void ITCM_CODE Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, int destStride, int srcStride, const u16* palette, u32 numLines);
+void ITCM_CODE Rescale_320x256x1555_To_256x256x1555(u16* dest, const u16* src, int destStride, int srcStride);
}
diff --git a/backends/platform/ds/arm9/source/blitters.s b/backends/platform/ds/arm9/source/blitters.s
deleted file mode 100644
index 2f14c5a140..0000000000
--- a/backends/platform/ds/arm9/source/blitters.s
+++ /dev/null
@@ -1,339 +0,0 @@
-@ ScummVM Scumm Interpreter
-@ Copyright (C) 2007 The ScummVM project
-@
-@ This program is free software@ you can redistribute it and/or
-@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-@
-@ $URL: $
-@ $Id: $
-@
-@ @author Robin Watts (robin@wss.co.uk)
-
- .text
-
- .global asmDrawStripToScreen
- .global asmCopy8Col
- .global Rescale_320x256xPAL8_To_256x256x1555
- .global Rescale_320x256x1555_To_256x256x1555
-
- @ ARM implementation of asmDrawStripToScreen.
- @
- @ C prototype would be:
- @
- @ extern "C" void asmDrawStripToScreen(int height,
- @ int width,
- @ byte const *text,
- @ byte const *src,
- @ byte *dst,
- @ int vsPitch,
- @ int vsScreenWidth,
- @ int textSurfacePitch);
- @
- @ In addition, we assume that text, src and dst are all word (4 byte)
- @ aligned. This is the same assumption that the old 'inline' version
- @ made.
-asmDrawStripToScreen:
- @ r0 = height
- @ r1 = width
- @ r2 = text
- @ r3 = src
- MOV r12,r13
- STMFD r13!,{r4-r7,r9-r11,R14}
- LDMIA r12,{r4,r5,r6,r7}
- @ r4 = dst
- @ r5 = vsPitch
- @ r6 = vmScreenWidth
- @ r7 = textSurfacePitch
-
- CMP r0,#0 @ If height<=0
- MOVLE r0,#1 @ height=1
- CMP r1,#4 @ If width<4
- BLT end @ return
-
- @ Width &= ~4 ? What's that about then? Width &= ~3 I could have
- @ understood...
- BIC r1,r1,#4
-
- SUB r5,r5,r1 @ vsPitch -= width
- SUB r6,r6,r1 @ vmScreenWidth -= width
- SUB r7,r7,r1 @ textSurfacePitch -= width
- MOV r10,#253
- ORR r10,r10,r10,LSL #8
- ORR r10,r10,r10,LSL #16 @ r10 = mask
-yLoop:
- MOV r14,r1 @ r14 = width
-xLoop:
- LDR r12,[r2],#4 @ r12 = [text]
- LDR r11,[r3],#4 @ r11 = [src]
- CMP r12,r10
- BNE singleByteCompare
- SUBS r14,r14,#4
- STR r11,[r4], #4 @ r4 = [dst]
- BGT xLoop
-
- ADD r2,r2,r7 @ text += textSurfacePitch
- ADD r3,r3,r5 @ src += vsPitch
- ADD r4,r4,r6 @ dst += vmScreenWidth
- SUBS r0,r0,#1
- BGT yLoop
- LDMFD r13!,{r4-r7,r9-r11,PC}
-
-singleByteCompare:
- MOV r9,r12,LSR #24 @ r9 = 1st byte of [text]
- CMP r9,r10,LSR #24 @ if (r9 == mask)
- MOVEQ r9,r11,LSR #24 @ r9 = 1st byte of [src]
- ORR r12,r9,r12,LSL #8 @ r12 = combine r9 and r12
-
- MOV r9,r12,LSR #24 @ r9 = 1st byte of [text]
- CMP r9,r10,LSR #24 @ if (r9 == mask)
- MOVEQ r9,r11,LSR #24 @ r9 = 1st byte of [src]
- ORR r12,r9,r12,LSL #8 @ r12 = combine r9 and r12
-
- MOV r9,r12,LSR #24 @ r9 = 1st byte of [text]
- CMP r9,r10,LSR #24 @ if (r9 == mask)
- MOVEQ r9,r11,LSR #24 @ r9 = 1st byte of [src]
- ORR r12,r9,r12,LSL #8 @ r12 = combine r9 and r12
-
- MOV r9,r12,LSR #24 @ r9 = 1st byte of [text]
- CMP r9,r10,LSR #24 @ if (r9 == mask)
- MOVEQ r9,r11,LSR #24 @ r9 = 1st byte of [src]
- ORR r12,r9,r12,LSL #8 @ r12 = combine r9 and r12
-
- STR r12,[r4],#4
- SUBS r14,r14,#4
- BGT xLoop
-
- ADD r2,r2,r7 @ text += textSurfacePitch
- ADD r3,r3,r5 @ src += vsPitch
- ADD r4,r4,r6 @ dst += vmScreenWidth
- SUBS r0,r0,#1
- BGT yLoop
-end:
- LDMFD r13!,{r4-r7,r9-r11,PC}
-
-
- @ ARM implementation of asmCopy8Col
- @
- @ C prototype would be:
- @
- @ extern "C" void asmCopy8Col(byte *dst,
- @ int dstPitch,
- @ const byte *src,
- @ int height);
- @
- @ In addition, we assume that src and dst are both word (4 byte)
- @ aligned. This is the same assumption that the old 'inline' version
- @ made.
-asmCopy8Col:
- @ r0 = dst
- @ r1 = dstPitch
- @ r2 = src
- @ r3 = height
- STMFD r13!,{r14}
- SUB r1,r1,#4
-
- TST r3,#1
- ADDNE r3,r3,#1
- BNE roll2
-yLoop2:
- LDR r12,[r2],#4
- LDR r14,[r2],r1
- STR r12,[r0],#4
- STR r14,[r0],r1
-roll2:
- LDR r12,[r2],#4
- LDR r14,[r2],r1
- SUBS r3,r3,#2
- STR r12,[r0],#4
- STR r14,[r0],r1
- BNE yLoop2
-
- LDMFD r13!,{PC}
-
-
- @ ARM implementation of Rescale_320x256x1555_To_256x256x1555
- @
- @ C prototype would be:
- @
- @ extern "C" void Rescale_320x256x1555_To_256x256x1555(
- @ u16 *dst,
- @ const u16 *src,
- @ int dstStride,
- @ int srcStride);
-Rescale_320x256x1555_To_256x256x1555:
- @ r0 = dst
- @ r1 = src
- @ r2 = dstStride
- @ r3 = srcStride
- STMFD r13!,{r4-r5,r8-r11,r14}
-
- SUB r2,r2,#64*5 @ srcStride -= line length
- SUB r3,r3,#64*4 @ dstStride -= line length
-
- MOV r8, #0x0000001F
- ORR r8, r8,#0x00007C00
- ORR r8, r8,#0x03E00000 @ r8 = mask
- MOV r5, #200 @ r5 = y
-yLoop3:
- MOV r4, #64 @ r4 = x
-xLoop3:
- LDRH r9, [r0],#2 @ r9 = src0
- LDRH r10,[r0],#2 @ r10= src1
- LDRH r11,[r0],#2 @ r11= src2
- LDRH r12,[r0],#2 @ r12= src3
- LDRH r14,[r0],#2 @ r14= src4
-
- ORR r9, r9, r9, LSL #16 @ r9 = src0 | src0
- ORR r10,r10,r10,LSL #16 @ r10= src1 | src1
- ORR r11,r11,r11,LSL #16 @ r11= src2 | src2
- ORR r12,r12,r12,LSL #16 @ r12= src3 | src3
- ORR r14,r14,r14,LSL #16 @ r13= src4 | src4
-
- AND r9, r9, r8 @ r9 = 0 | G0 | 0 | B0 | 0 | R0
- AND r10,r10,r8 @ r10= 0 | G1 | 0 | B1 | 0 | R1
- AND r11,r11,r8 @ r11= 0 | G2 | 0 | B2 | 0 | R2
- AND r12,r12,r8 @ r12= 0 | G3 | 0 | B3 | 0 | R3
- AND r14,r14,r8 @ r14= 0 | G4 | 0 | B4 | 0 | R4
-
- ADD r9, r9, r9, LSL #1 @ r9 = 3*src0
- ADD r9, r9, r10 @ r9 = dst0<<2
- ADD r10,r10,r11 @ r10= dst1
- ADD r11,r11,r12 @ r11= dst2
- ADD r12,r12,r14 @ r12= src3 + src4
- ADD r12,r12,r14,LSL #1 @ r12= src3 + src4*3 = dst3<<2
-
- AND r9, r8, r9, LSR #2 @ r9 = dst0 (split)
- AND r10,r8, r10,LSR #1 @ r10= dst1 (split)
- AND r11,r8, r11,LSR #1 @ r11= dst2 (split)
- AND r12,r8, r12,LSR #2 @ r12= dst3 (split)
-
- ORR r9, r9, r9, LSR #16 @ r9 = dst0
- ORR r10,r10,r10,LSR #16 @ r10= dst1
- ORR r11,r11,r11,LSR #16 @ r11= dst2
- ORR r12,r12,r12,LSR #16 @ r12= dst3
-
- ORR r9, r9, #0x8000
- ORR r10,r10,#0x8000
- ORR r11,r11,#0x8000
- ORR r12,r12,#0x8000
-
- STRH r9, [r1],#2
- STRH r10,[r1],#2
- STRH r11,[r1],#2
- STRH r12,[r1],#2
-
- SUBS r4,r4,#1
- BGT xLoop3
-
- ADD r0,r0,r2,LSL #1
- ADD r1,r2,r3,LSL #1
- SUBS r5,r5,#1
- BGT yLoop3
-
- LDMFD r13!,{r4-r5,r8-r11,PC}
-
- @ ARM implementation of Rescale_320x256xPAL8_To_256x256x1555
- @
- @ C prototype would be:
- @
- @ extern "C" void Rescale_320x256xPAL8_To_256x256x1555(
- @ u16 *dst,
- @ const u8 *src,
- @ int dstStride,
- @ int srcStride,
- @ const u16 *pal);
- @
- @ This is a slight reordering of the params from the existing C one.
- @ Sorry, but it makes the code easier.
-Rescale_320x256xPAL8_To_256x256x1555:
- @ r0 = dst
- @ r1 = src
- @ r2 = dstStride
- @ r3 = srcStride
- STMFD r13!,{r4-r5,r8-r11,r14}
- MOV r8, #0x0000001F
- ORR r8, r8,#0x00007C00
- ORR r8, r8,#0x03E00000 @ r8 = mask
- LDR r9, [r13,#7*4] @ r9 = palette
-
- SUB r13,r13,#256*4 @ r13 = 1K of space on the stack.
- MOV r5, r13 @ r5 points to this space
- MOV r14,#256
-palLoop:
- LDRH r10,[r9],#2 @ r10 = palette entry
- SUBS r14,r14,#1
- ORR r10,r10,r10,LSL #16
- AND r10,r10,r8 @ r10 = separated palette entry
- STR r10,[r5], #4
- BGT palLoop
-
- SUB r2,r2,#64*5 @ srcStride -= line length
- SUB r3,r3,#64*4 @ dstStride -= line length
-
- MOV r5,#200 @ r5 = y
-yLoop4:
- MOV r4,#64 @ r4 = x
-xLoop4:
- LDRB r9, [r0],#1 @ r9 = src0
- LDRB r10,[r0],#1 @ r10= src1
- LDRB r11,[r0],#1 @ r11= src2
- LDRB r12,[r0],#1 @ r12= src3
- LDRB r14,[r0],#1 @ r14= src4
-
- LDR r9, [r13,r9, LSL #2] @ r9 = pal[src0]
- LDR r10,[r13,r10,LSL #2] @ r10= pal[src1]
- LDR r11,[r13,r11,LSL #2] @ r11= pal[src2]
- LDR r12,[r13,r12,LSL #2] @ r12= pal[src3]
- LDR r14,[r13,r14,LSL #2] @ r13= pal[src4]
-
- ADD r9, r9, r9, LSL #1 @ r9 = 3*src0
- ADD r9, r9, r10 @ r9 = dst0<<2
- ADD r10,r10,r11 @ r10= dst1
- ADD r11,r11,r12 @ r11= dst2
- ADD r12,r12,r14 @ r12= src3 + src4
- ADD r12,r12,r14,LSL #1 @ r12= src3 + src4*3 = dst3<<2
-
- AND r9, r8, r9, LSR #2 @ r9 = dst0 (split)
- AND r10,r8, r10,LSR #1 @ r10= dst1 (split)
- AND r11,r8, r11,LSR #1 @ r11= dst2 (split)
- AND r12,r8, r12,LSR #2 @ r12= dst3 (split)
-
- ORR r9, r9, r9, LSR #16 @ r9 = dst0
- ORR r10,r10,r10,LSR #16 @ r10= dst1
- ORR r11,r11,r11,LSR #16 @ r11= dst2
- ORR r12,r12,r12,LSR #16 @ r12= dst3
-
- ORR r9, r9, #0x8000
- ORR r10,r10,#0x8000
- ORR r11,r11,#0x8000
- ORR r12,r12,#0x8000
-
- STRH r9, [r1],#2
- STRH r10,[r1],#2
- STRH r11,[r1],#2
- STRH r12,[r1],#2
-
- SUBS r4,r4,#1
- BGT xLoop4
-
- ADD r0,r0,r2
- ADD r1,r2,r3,LSL #1
- SUBS r5,r5,#1
- BGT yLoop4
-
- ADD r13,r13,#256*4
-
- LDMFD r13!,{r4-r5,r8-r11,PC}
-
-
diff --git a/backends/platform/ds/arm9/source/cdaudio.cpp b/backends/platform/ds/arm9/source/cdaudio.cpp
index 56ac4e8c09..4f66401b53 100644
--- a/backends/platform/ds/arm9/source/cdaudio.cpp
+++ b/backends/platform/ds/arm9/source/cdaudio.cpp
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
+
#include "cdaudio.h"
#include "backends/fs/ds/ds-fs.h"
#include "common/config-manager.h"
@@ -53,9 +53,9 @@ struct WaveHeader {
u16 fmtExtraData; // Number of extra fmt bytes
u16 fmtExtra; // Samples per block (only for IMA-ADPCM files)
} __attribute__ ((packed));
-
+
struct chunkHeader {
- char name[4];
+ char name[4];
u32 size;
} __attribute__ ((packed));
@@ -112,7 +112,7 @@ void decompressBlock();
void allocBuffers() {
-
+
}
void setActive(bool active) {
@@ -125,17 +125,17 @@ bool getActive() {
void playTrack(int track, int numLoops, int startFrame, int duration) {
Common::String path = ConfMan.get("path");
-
+
if (isPlayingFlag) {
stopTrack();
}
-
+
if (trackStartsAt2) {
track++;
}
-
-
-
+
+
+
char str[100];
if (path[strlen(path.c_str()) - 1] == '/') {
@@ -145,50 +145,50 @@ void playTrack(int track, int numLoops, int startFrame, int duration) {
sprintf(str, "/track%d.wav", track);
path = path + str;
}
-
-
+
+
//1820160
-
+
file = DS::std_fopen(path.c_str(), "rb");
-
+
if (!file) {
consolePrintf("Failed to open %s!\n", path.c_str());
return;
}
-
-
+
+
DS::std_fread((const void *) &waveHeader, sizeof(waveHeader), 1, file);
-
+
consolePrintf("Playing track %d\n", track);
consolePrintf("Format: %d\n", waveHeader.fmtFormatTag);
consolePrintf("Rate : %d\n", waveHeader.fmtSamPerSec);
consolePrintf("Bits : %d\n", waveHeader.fmtBitsPerSam);
consolePrintf("BlkSz : %d\n", waveHeader.fmtExtra);
-
+
if ((waveHeader.fmtFormatTag != 17) && (waveHeader.fmtFormatTag != 20)) {
consolePrintf("Wave file is in the wrong format! You must use IMA-ADPCM 4-bit mono.\n");
DS::std_fclose(file);
return;
}
-
+
for (int r = 0; r < 8; r++) {
IPC->adpcm.buffer[r] = (u8 * volatile) (decoderFormat *) malloc(waveHeader.fmtBlockAlign);
IPC->adpcm.filled[r] = false;
IPC->adpcm.arm7Dirty[r] = false;
}
-
+
// Skip chunks until we reach the data chunk
chunkHeader chunk;
DS::std_fread((const void *) &chunk, sizeof(chunkHeader), 1, file);
-
+
while (!((chunk.name[0] == 'd') && (chunk.name[1] == 'a') && (chunk.name[2] == 't') && (chunk.name[3] == 'a'))) {
DS::std_fseek(file, chunk.size, SEEK_CUR);
DS::std_fread((const void *) &chunk, sizeof(chunkHeader), 1, file);
}
-
+
dataChunkStart = DS::std_ftell(file);
-
-
+
+
static bool started = false;
sampleNum = 0;
blockCount = 0;
@@ -206,35 +206,35 @@ void playTrack(int track, int numLoops, int startFrame, int duration) {
memset(audioBuffer, 0, BUFFER_SIZE * 2);
memset(decompressionBuffer, 0, waveHeader.fmtExtra * 2);
DS::playSound(audioBuffer, BUFFER_SIZE * 2, false, false, waveHeader.fmtSamPerSec);
-
- }
+
+ }
fillPos = (IPC->streamPlayingSection + 1) & 3;
isPlayingFlag = true;
-
-
+
+
// Startframe is a 75Hz timer. Dunno why, since nothing else
// seems to run at that rate.
int tenths = (startFrame * 10) / 75;
-
+
// Seek to the nearest block start to the start time
int samples = (tenths * waveHeader.fmtSamPerSec) / 10;
int block = samples / waveHeader.fmtExtra;
-
-
+
+
if (duration == 0) {
blocksLeft = 0;
} else {
blocksLeft = ((((duration * 100) / 75) * (waveHeader.fmtSamPerSec)) / (waveHeader.fmtExtra) / 100) + 10;
}
// consolePrintf("Playing %d blocks (%d)\n\n", blocksLeft, duration);
-
+
// No need to seek if we're starting from the beginning
if (block != 0) {
DS::std_fseek(file, dataChunkStart + block * waveHeader.fmtBlockAlign, SEEK_SET);
// consolePrintf("Startframe: %d msec: %d (%d,%d)\n", startFrame, tenthssec, samples, block);
}
-
-
+
+
//decompressBlock();
playNextBlock();
DS::CD::numLoops = numLoops;
@@ -252,21 +252,21 @@ extern "C" void ARM_adcpm(int *block, int len, int stepTableIndex,
void decompressBlock() {
int block[2048];
bool loop = false;
-
+
blockCount++;
-
+
if (blockCount < 10) return;
-
-
+
+
do {
DS::std_fread((const void *) &blockHeader, sizeof(blockHeader), 1, file);
-
+
DS::std_fread(&block[0], waveHeader.fmtBlockAlign - sizeof(blockHeader), 1, file);
if (DS::std_feof(file) ) {
// Reached end of file, so loop
-
-
+
+
if ((numLoops == -1) || (numLoops > 1)) {
// Seek file to first packet
if (numLoops != -1) {
@@ -283,14 +283,14 @@ void decompressBlock() {
stopTrack();
return;
}
-
+
} else {
loop = false;
}
-
+
} while (loop);
-
-
+
+
if (blocksLeft > 0) {
blocksLeft--;
// consolePrintf("%d ", blocksLeft);
@@ -305,37 +305,37 @@ void decompressBlock() {
blockHeader.stepTableIndex,
blockHeader.firstSample,
decompressionBuffer);
-#else
+#else
// First sample is in header
decompressionBuffer[0] = blockHeader.firstSample;
-
+
// Set up initial table indeces
int stepTableIndex = blockHeader.stepTableIndex;
int prevSample = blockHeader.firstSample;
-
+
// consolePrintf("Decompressing block step=%d fs=%d\n", stepTableIndex, prevSample);
for (int r = 0; r < waveHeader.fmtExtra - 1; r++) {
-
+
int word = block[r >> 3];
int offset = 0;
-
+
switch (7 - (r & 0x0007)) {
case 0: {
offset = (word & 0xF0000000) >> 28;
break;
}
-
+
case 1: {
offset = (word & 0x0F000000) >> 24;
break;
}
-
+
case 2: {
offset = (word & 0x00F00000) >> 20;
break;
}
-
+
case 3: {
offset = (word & 0x000F0000) >> 16;
break;
@@ -361,41 +361,41 @@ void decompressBlock() {
break;
}
}
-
+
int diff = 0;
-
+
if (offset & 4) {
diff = diff + stepTab[stepTableIndex];
}
-
+
if (offset & 2) {
diff = diff + (stepTab[stepTableIndex] >> 1);
}
-
+
if (offset & 1) {
diff = diff + (stepTab[stepTableIndex] >> 2);
}
-
+
diff = diff + (stepTab[stepTableIndex] >> 3);
-
+
if (offset & 8) {
- diff = -diff;
+ diff = -diff;
}
-
+
int newSample = prevSample + diff;
-
+
if (newSample > 32767) newSample = 32767;
if (newSample < -32768) newSample = -32768;
-
+
decompressionBuffer[r + 1] = newSample;
-
+
prevSample = newSample;
-
+
stepTableIndex += indexTab[offset];
-
+
if (stepTableIndex > 88) stepTableIndex = 88;
if (stepTableIndex < 0) stepTableIndex = 0;
-
+
}
#endif
@@ -404,21 +404,21 @@ void decompressBlock() {
void playNextBlock() {
if (!isPlayingFlag) return;
int lastBlockId = -1;
-
+
while (IPC->adpcm.semaphore); // Wait for buffer to become free if needed
IPC->adpcm.semaphore = true; // Lock the buffer structure to prevent clashing with the ARM7
// DC_FlushAll();
-
+
//-8644, 25088
for (int block = fillPos + 1; block < fillPos + 4; block++) {
int blockId = block & 3;
-
+
if (IPC->streamFillNeeded[blockId]) {
-
+
IPC->streamFillNeeded[blockId] = false;
// DC_FlushAll();
-
+
/* if (!(REG_KEYINPUT & KEY_R)) {
//consolePrintf("Align: %d First: %d Step:%d Res:%d\n", waveHeader.fmtBlockAlign, blockHeader.firstSample, blockHeader.stepTableIndex, blockHeader.reserved);
consolePrintf("Filling buffer %d\n", blockId);
@@ -432,19 +432,19 @@ void playNextBlock() {
}
}
}
-
+
lastBlockId = blockId;
IPC->streamFillNeeded[blockId] = false;
// DC_FlushAll();
}
-
-
-
+
+
+
}
-
-
-
+
+
+
if (lastBlockId != -1) {
fillPos = lastBlockId;
/* if (!(REG_KEYINPUT & KEY_R)) {
@@ -459,18 +459,18 @@ void stopTrack() {
if (!isPlayingFlag) return;
DS::std_fclose(file);
-
+
isPlayingFlag = false;
-
+
for (int r = 0; r < BUFFER_SIZE; r++) {
audioBuffer[r] = 0;
}
-
+
for (int r= 0; r < waveHeader.fmtExtra; r++) {
decompressionBuffer[r] = 0;
}
// DS::stopSound(1);
-
+
// free(audioBuffer);
// free(decompressionBuffer);
@@ -507,7 +507,7 @@ bool trackExists(int num) {
bool checkCD() {
// Need to check whethe CD audio files are present - do this by trying to open Track1.wav.
consolePrintf("Attempted to open cd drive\n");
-
+
if (trackExists(1)) {
trackStartsAt2 = false;
return true;
diff --git a/backends/platform/ds/arm9/source/cdaudio.h b/backends/platform/ds/arm9/source/cdaudio.h
index d1897d3e5d..aac303dd5e 100644
--- a/backends/platform/ds/arm9/source/cdaudio.h
+++ b/backends/platform/ds/arm9/source/cdaudio.h
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
+
#ifndef _CDAUDIO_H_
#define _CDAUDIO_H_
diff --git a/backends/platform/ds/arm9/source/console2.h b/backends/platform/ds/arm9/source/console2.h
index 6b9a677cc7..86434dcb93 100644
--- a/backends/platform/ds/arm9/source/console2.h
+++ b/backends/platform/ds/arm9/source/console2.h
@@ -25,7 +25,7 @@
//
// Changelog:
// 0.1: First version
-// 0.2: Fixed sprite mapping bug. 1D mapping should work now.
+// 0.2: Fixed sprite mapping bug. 1D mapping should work now.
// Changed some register defines for consistency.
//
//////////////////////////////////////////////////////////////////////
@@ -87,7 +87,7 @@ void consoleClear(void);
//
// Changelog:
// 0.1: First version
-// 0.2: Fixed sprite mapping bug. 1D mapping should work now.
+// 0.2: Fixed sprite mapping bug. 1D mapping should work now.
// Changed some register defines for consistency.
//
//////////////////////////////////////////////////////////////////////
diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp
index 872a196e9b..492b7384ec 100644
--- a/backends/platform/ds/arm9/source/dsmain.cpp
+++ b/backends/platform/ds/arm9/source/dsmain.cpp
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
+
// - Remove scummconsole.c
// - Delete files
@@ -244,8 +244,8 @@ bool cpuScalerEnable = false;
// 150 192
// 200 128
- // (256 << 8) / scale
-
+ // (256 << 8) / scale
+
#ifdef USE_PROFILER
@@ -259,7 +259,7 @@ u8* scalerBackBuffer = NULL;
gameListType gameList[NUM_SUPPORTED_GAMES] = {
// Unknown game - use normal SCUMM controls
{"unknown", CONT_SCUMM_ORIGINAL},
-
+
// SCUMM games
{"maniac", CONT_SCUMM_ORIGINAL},
{"zak", CONT_SCUMM_ORIGINAL},
@@ -270,7 +270,7 @@ gameListType gameList[NUM_SUPPORTED_GAMES] = {
{"monkey2", CONT_SCUMM_ORIGINAL},
{"tentacle", CONT_SCUMM_ORIGINAL},
{"samnmax", CONT_SCUMM_SAMNMAX},
-
+
// Non-SCUMM games
{"sky", CONT_SKY},
{"simon1", CONT_SIMON},
@@ -356,8 +356,8 @@ void setTopScreenZoom(int percentage) {
// 150 192
// 200 128
- // (256 << 8) / scale
-
+ // (256 << 8) / scale
+
s32 scale = (percentage << 8) / 100;
subScreenScale = (256 * 256) / scale;
@@ -374,11 +374,11 @@ controlType getControlType() {
//plays an 8 bit mono sample at 11025Hz
void playSound(const void* data, u32 length, bool loop, bool adpcm, int rate)
{
-
+
if (!IPC->soundData) {
soundControl.count = 0;
}
-
+
soundControl.data[soundControl.count].data = data;
soundControl.data[soundControl.count].len = length | (loop? 0x80000000: 0x00000000);
soundControl.data[soundControl.count].rate = rate; // 367 samples per frame
@@ -428,14 +428,14 @@ void initSprites() {
sprites[i].attribute[2] = 0;
sprites[i].filler = 0;
}
-
+
for (int i = 0; i < 128; i++) {
spritesMain[i].attribute[0] = ATTR0_DISABLED;
spritesMain[i].attribute[1] = 0;
spritesMain[i].attribute[2] = 0;
spritesMain[i].filler = 0;
}
-
+
updateOAM();
}
@@ -446,7 +446,7 @@ void saveGameBackBuffer() {
// So, I lock the video memory here, as if I'm going to modify it. This
// forces OSystem_DS to create a system memory copy if one doesn't exist.
// This will be automatially resotred by OSystem_DS::updateScreen().
-
+
OSystem_DS::instance()->lockScreen();
OSystem_DS::instance()->unlockScreen();
}
@@ -460,22 +460,22 @@ void startSound(int freq, int buffer) {
bufferFirstHalf = false;
bufferSecondHalf = true;
-
+
int bytes = (2 * (bufferSamples)) + 100;
-
+
soundBuffer = (s16 *) malloc(bytes * 2);
if (!soundBuffer)
consolePrintf("Sound buffer alloc failed\n");
soundHiPart = true;
-
+
for (int r = 0; r < bytes; r++) {
soundBuffer[r] = 0;
}
soundFrequency = freq;
-
+
swiWaitForVBlank();
swiWaitForVBlank();
@@ -507,14 +507,14 @@ void initGame() {
// consolePrintf("\n\n\n\nCurrent game: '%s' %d\n", gameName, gameName[0]);
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);
}
}
-
+
/* if (firstTime) {
firstTime = false;
@@ -557,7 +557,7 @@ void displayMode8Bit() {
consolePrintf("displayMode8Bit...");
#endif
u16 buffer[32 * 32];
-
+
setKeyboardEnable(false);
if (!displayModeIs8Bit) {
@@ -568,7 +568,7 @@ void displayMode8Bit() {
consoleInitDefault((u16*)SCREEN_BASE_BLOCK(2), (u16*)CHAR_BASE_BLOCK(0), 16);
consolePrintSet(0, 23);
-
+
if (!displayModeIs8Bit) {
for (int r = 0; r < 32 * 32; r++) {
((u16 *) SCREEN_BASE_BLOCK(2))[r] = buffer[r];
@@ -577,20 +577,20 @@ void displayMode8Bit() {
}
displayModeIs8Bit = true;
-
+
if (isCpuScalerEnabled())
{
- videoSetMode(MODE_5_2D | (consoleEnable? DISPLAY_BG0_ACTIVE: 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP);
+ videoSetMode(MODE_5_2D | (consoleEnable? DISPLAY_BG0_ACTIVE: 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP);
videoSetModeSub(MODE_3_2D /*| DISPLAY_BG0_ACTIVE*/ | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); //sub bg 0 will be used to print text
-
+
vramSetBankA(VRAM_A_MAIN_BG_0x06000000);
vramSetBankB(VRAM_B_MAIN_BG_0x06020000);
-
+
vramSetBankC(VRAM_C_SUB_BG_0x06200000);
vramSetBankD(VRAM_D_SUB_SPRITE);
-
+
vramSetBankH(VRAM_H_LCD);
-
+
BG3_CR = BG_BMP16_256x256 | BG_BMP_BASE(8);
BG3_XDX = 256;
@@ -601,27 +601,27 @@ void displayMode8Bit() {
}
else
{
- videoSetMode(MODE_5_2D | (consoleEnable? DISPLAY_BG0_ACTIVE: 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP);
+ videoSetMode(MODE_5_2D | (consoleEnable? DISPLAY_BG0_ACTIVE: 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP);
videoSetModeSub(MODE_3_2D /*| DISPLAY_BG0_ACTIVE*/ | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); //sub bg 0 will be used to print text
-
+
vramSetBankA(VRAM_A_MAIN_BG_0x06000000);
vramSetBankB(VRAM_B_MAIN_BG_0x06020000);
-
+
vramSetBankC(VRAM_C_SUB_BG_0x06200000);
vramSetBankD(VRAM_D_SUB_SPRITE);
-
+
vramSetBankH(VRAM_H_LCD);
-
+
BG3_CR = BG_BMP8_512x256 | BG_BMP_BASE(8);
-
+
BG3_XDX = (int) (((float) (gameWidth) / 256.0f) * 256);
BG3_XDY = 0;
BG3_YDX = 0;
BG3_YDY = (int) ((200.0f / 192.0f) * 256);
- }
-
+ }
+
SUB_BG3_CR = BG_BMP8_512x256;
-
+
SUB_BG3_XDX = (int) (subScreenWidth / 256.0f * 256);
SUB_BG3_XDY = 0;
SUB_BG3_YDX = 0;
@@ -633,15 +633,15 @@ void displayMode8Bit() {
BG0_CR = BG_MAP_BASE(2) | BG_TILE_BASE(0);
BG0_Y0 = 0;
-
- // Restore palette entry used by text in the front-end
+
+ // Restore palette entry used by text in the front-end
// PALETTE_SUB[255] = savedPalEntry255;
-
-
+
+
initGame();
-
+
#ifdef HEAVY_LOGGING
consolePrintf("done\n");
#endif
@@ -653,9 +653,9 @@ void displayMode8Bit() {
}
uploadSpriteGfx();
-
+
keyboardEnable = false;
-
+
}
void setGameID(int id) {
@@ -668,22 +668,22 @@ void dummyHandler() {
void checkSleepMode() {
if (IPC->performArm9SleepMode) {
-
+
consolePrintf("ARM9 Entering sleep mode\n");
-
+
int intSave = REG_IE;
irqSet(IRQ_VBLANK, dummyHandler);
// int irqHandlerSave = (int) IRQ_HANDLER;
REG_IE = IRQ_VBLANK;
//IRQ_HANDLER = dummyHandler;
-
+
int powerSave = POWER_CR;
POWER_CR &= ~POWER_ALL;
-
+
while (IPC->performArm9SleepMode) {
swiWaitForVBlank();
}
-
+
POWER_CR = powerSave;
// IRQ_HANDLER = (void (*)()) irqHandlerSave;
irqSet(IRQ_VBLANK, VBlankHandler);
@@ -722,18 +722,18 @@ void setCursorIcon(const u8* icon, uint w, uint h, byte keycolor, int hotspotX,
{
int off = 128*64;
-
-
+
+
memset(SPRITE_GFX + off, 0, 32 * 32 * 2);
memset(SPRITE_GFX_SUB + off, 0, 32 * 32 * 2);
-
+
for (uint y=0; y<h; y++) {
for (uint x=0; x<w; x++) {
int color = icon[y*w+x];
//consolePrintf("%d:%d ", color, OSystem_DS::instance()->getDSPaletteEntry(color));
-
+
if (color == keycolor) {
SPRITE_GFX[off+(y)*32+x] = 0x0000; // black background
SPRITE_GFX_SUB[off+(y)*32+x] = 0x0000; // black background
@@ -743,23 +743,23 @@ void setCursorIcon(const u8* icon, uint w, uint h, byte keycolor, int hotspotX,
}
}
}
-
+
}
if (currentGame->control != CONT_SCUMM_SAMNMAX)
return;
uint16 border = RGB15(24,24,24) | 0x8000;
-
-
+
+
int off = 176*64;
memset(SPRITE_GFX_SUB+off, 0, 64*64*2);
memset(SPRITE_GFX+off, 0, 64*64*2);
-
+
int pos = 190 - (w+2);
-
-
+
+
// make border
for (uint i=0; i<w+2; i++) {
SPRITE_GFX[off+i] = border;
@@ -775,7 +775,7 @@ void setCursorIcon(const u8* icon, uint w, uint h, byte keycolor, int hotspotX,
SPRITE_GFX_SUB[off+(i*64)] = border;
SPRITE_GFX_SUB[off+(i*64)+(w+1)] = border;
}
-
+
int offset = (32 - h) >> 1;
for (uint y=0; y<h; y++) {
@@ -791,8 +791,8 @@ void setCursorIcon(const u8* icon, uint w, uint h, byte keycolor, int hotspotX,
}
}
}
-
-
+
+
if ((cursorEnable)) {
sprites[1].attribute[0] = ATTR0_BMP | 150;
sprites[1].attribute[1] = ATTR1_SIZE_64 | pos;
@@ -827,7 +827,7 @@ void displayMode16Bit() {
}
- videoSetMode(MODE_5_2D | /*DISPLAY_BG0_ACTIVE |*/ DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP);
+ videoSetMode(MODE_5_2D | /*DISPLAY_BG0_ACTIVE |*/ DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP);
videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE |/* DISPLAY_BG1_ACTIVE |*/ DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); //sub bg 0 will be used to print text
vramSetBankA(VRAM_A_MAIN_BG);
@@ -838,10 +838,10 @@ void displayMode16Bit() {
BG3_CR = BG_BMP16_512x256;
highBuffer = false;
-
+
memset(BG_GFX, 0, 512 * 256 * 2);
-
+
savedPalEntry255 = PALETTE_SUB[255];
PALETTE_SUB[255] = RGB15(31,31,31);//by default font will be rendered with color 255
@@ -860,11 +860,11 @@ void displayMode16Bit() {
consolePrintSet(0, 23);
consolePrintf("\n");
-
+
// Show keyboard
SUB_BG1_CR = BG_TILE_BASE(1) | BG_MAP_BASE(12);
//drawKeyboard(1, 12);
-
+
POWER_CR &= ~POWER_SWAP_LCDS;
displayModeIs8Bit = false;
@@ -887,10 +887,10 @@ void displayMode16BitFlipBuffer() {
#endif
if (!displayModeIs8Bit) {
u16* back = get16BitBackBuffer();
-
+
// highBuffer = !highBuffer;
// BG3_CR = BG_BMP16_512x256 | BG_BMP_RAM(highBuffer? 1: 0);
-
+
if (isCpuScalerEnabled())
{
Rescale_320x256x1555_To_256x256x1555(BG_GFX, back, 512, 512);
@@ -912,14 +912,14 @@ void displayMode16BitFlipBuffer() {
#endif
const u8* back = (const u8*)get8BitBackBuffer();
u16* base = BG_GFX + 0x10000;
- Rescale_320x256xPAL8_To_256x256x1555(
+ Rescale_320x256xPAL8_To_256x256x1555(
base,
back,
256,
get8BitBackBufferStride(),
- BG_PALETTE,
+ BG_PALETTE,
getGameHeight() );
-
+
#ifdef SCALER_PROFILE
// 10 pixels : 1ms
u16 t1 = TIMER1_DATA;
@@ -982,10 +982,10 @@ void doSoundCallback() {
if (OSystem_DS::instance())
if (OSystem_DS::instance()->getMixerImpl()) {
lastCallbackFrame = frameCount;
-
+
for (int r = IPC->playingSection; r < IPC->playingSection + 4; r++) {
int chunk = r & 3;
-
+
if (IPC->fillNeeded[chunk]) {
IPC->fillNeeded[chunk] = false;
DC_FlushAll();
@@ -993,9 +993,9 @@ void doSoundCallback() {
IPC->fillNeeded[chunk] = false;
DC_FlushAll();
}
-
+
}
-
+
}
#ifdef HEAVY_LOGGING
consolePrintf("done\n");
@@ -1007,7 +1007,7 @@ void doTimerCallback() {
if (callbackTimer <= 0) {
callbackTimer += callbackInterval;
callback(callbackInterval);
- }
+ }
}
}
@@ -1016,15 +1016,15 @@ void soundUpdate() {
// playSound(soundBuffer, (bufferSamples * 2), true);
}
// consolePrintf("%x\n", IPC->test);
-
-
+
+
if (bufferFrame == 0) {
// bufferFirstHalf = true;
- }
+ }
if (bufferFrame == bufferSize >> 1) {
//bufferSecondHalf = true;
- }
-
+ }
+
bufferFrame++;
if (bufferFrame == bufferSize) {
bufferFrame = 0;
@@ -1037,20 +1037,20 @@ void memoryReport() {
do {
p = (int *) malloc(r * 8192);
free(p);
- r++;
+ r++;
} while ((p) && (r < 512));
-
+
int t = -1;
void* block[1024];
do {
t++;
block[t] = (int *) malloc(4096);
- } while ((t < 1024) && (block[t]));
-
+ } while ((t < 1024) && (block[t]));
+
for (int q = 0; q < t; q++) {
free(block[q]);
}
-
+
consolePrintf("Free: %dK, Largest: %dK\n", t * 4, r * 8);
}
@@ -1061,7 +1061,7 @@ void addIndyFightingKeys() {
event.type = Common::EVENT_KEYDOWN;
event.kbd.flags = 0;
-
+
// consolePrintf("Fight keys\n");
if ((getKeysDown() & KEY_L)) {
@@ -1091,16 +1091,16 @@ void addIndyFightingKeys() {
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 = Common::KEYCODE_2;
event.kbd.ascii = '2';
system->addEvent(event);
}
-
+
if (indyFightRight) {
-
+
if ((getKeysChanged() & KEY_X)) {
event.type = getKeyEvent(KEY_X);
event.kbd.keycode = Common::KEYCODE_9;
@@ -1118,7 +1118,7 @@ void addIndyFightingKeys() {
event.kbd.keycode = Common::KEYCODE_3;
event.kbd.ascii = '3';
system->addEvent(event);
- }
+ }
} else {
@@ -1139,18 +1139,18 @@ void addIndyFightingKeys() {
event.kbd.keycode = Common::KEYCODE_1;
event.kbd.ascii = '1';
system->addEvent(event);
- }
-
+ }
+
}
-
-
+
+
if ((getKeysChanged() & KEY_Y)) {
event.type = getKeyEvent(KEY_Y);
event.kbd.keycode = Common::KEYCODE_5;
event.kbd.ascii = '5';
system->addEvent(event);
}
-}
+}
void setKeyboardEnable(bool en) {
@@ -1162,8 +1162,8 @@ void setKeyboardEnable(bool en) {
DS::drawKeyboard(1, 15, backupBank);
-
-
+
+
SUB_BG1_CR = BG_TILE_BASE(1) | BG_MAP_BASE(15);
if (displayModeIs8Bit) {
@@ -1185,10 +1185,10 @@ void setKeyboardEnable(bool en) {
for (int r = 0; r < 256; r++) {
BG_PALETTE_SUB[r] = BG_PALETTE[r];
}
-
-
+
+
//restoreVRAM(1, 12, backupBank);
-
+
if (displayModeIs8Bit) {
// Copy the sub screen VRAM from the top screen - they should always be
// the same.
@@ -1200,17 +1200,17 @@ void setKeyboardEnable(bool en) {
BG_GFX_SUB[y * 256 + x] = buffer[(y * (stride / 2)) + x];
}
}
-/*
+/*
for (int r = 0; r < (512 * 256) >> 1; r++)
BG_GFX_SUB[r] = buffer[r];
- */
+ */
SUB_DISPLAY_CR &= ~DISPLAY_BG1_ACTIVE; // Turn off keyboard layer
SUB_DISPLAY_CR |= DISPLAY_BG3_ACTIVE; // Turn on game layer
} else {
SUB_DISPLAY_CR &= ~DISPLAY_BG1_ACTIVE; // Turn off keyboard layer
SUB_DISPLAY_CR |= DISPLAY_BG0_ACTIVE; // Turn on console layer
}
-
+
// Restore the screens so they're the right way round
if (gameScreenSwap) {
POWER_CR |= POWER_SWAP_LCDS;
@@ -1321,7 +1321,7 @@ void doButtonSelectMode(OSystem_DS* system)
if ((mouseMode != MOUSE_HOVER) || (!displayModeIs8Bit)) {
- if (getPenDown() && (!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R))) {
+ if (getPenDown() && (!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R))) {
if ((mouseMode == MOUSE_LEFT) || (!displayModeIs8Bit)) {
event.type = Common::EVENT_LBUTTONDOWN;
leftButtonDown = true;
@@ -1333,7 +1333,7 @@ void doButtonSelectMode(OSystem_DS* system)
event.mouse = Common::Point(getPenX(), getPenY());
system->addEvent(event);
}
-
+
} else {
// In hover mode, D-pad left and right click the mouse when the pen is on the screen
@@ -1369,7 +1369,7 @@ void doButtonSelectMode(OSystem_DS* system)
if (getKeysDown() & KEY_LEFT) {
mouseMode = MOUSE_LEFT;
}
-
+
if (rightButtonDown)
{
Common::Event event;
@@ -1378,8 +1378,8 @@ void doButtonSelectMode(OSystem_DS* system)
system->addEvent(event);
rightButtonDown = false;
}
-
-
+
+
if (getKeysDown() & KEY_RIGHT) {
if ((currentGame->control != CONT_SCUMM_SAMNMAX) && (currentGame->control != CONT_FUTURE_WARS) && (currentGame->control != CONT_GOBLINS)) {
mouseMode = MOUSE_RIGHT;
@@ -1387,7 +1387,7 @@ void doButtonSelectMode(OSystem_DS* system)
// 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) {
event.mouse = Common::Point(320 - 128, 200 - 128);
event.type = Common::EVENT_MOUSEMOVE;
@@ -1395,20 +1395,20 @@ void doButtonSelectMode(OSystem_DS* system)
} else {
event.mouse = Common::Point(getPenX(), getPenY());
}
-
+
rightButtonDown = true;
-
-
+
+
event.type = Common::EVENT_RBUTTONDOWN;
system->addEvent(event);
-
+
//event.type = Common::EVENT_RBUTTONUP;
//system->addEvent(event);
}
}
-
-
-
+
+
+
if (getKeysDown() & KEY_UP) {
mouseMode = MOUSE_HOVER;
}
@@ -1423,7 +1423,7 @@ void addEventsToQueue() {
OSystem_DS* system = OSystem_DS::instance();
Common::Event event;
-
+
#ifdef USE_PROFILER
if (keysDown() & KEY_R) {
cygprofile_begin();
@@ -1435,7 +1435,7 @@ void addEventsToQueue() {
}
#endif
-
+
if (system->isEventQueueEmpty()) {
/*
@@ -1444,7 +1444,7 @@ void addEventsToQueue() {
consolePrintf("Tweak: %d\n", tweak);
IPC->tweakChanged = true;
}
-
+
if (getKeysDown() & KEY_R) {
tweak++;
@@ -1460,14 +1460,14 @@ void addEventsToQueue() {
if (!indyFightState) {
- if ((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) && (getKeysDown() & KEY_B)) {
+ if ((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) && (getKeysDown() & KEY_B)) {
if (currentGame->control == CONT_AGI) {
event.kbd.keycode = Common::KEYCODE_RETURN;
event.kbd.ascii = 13;
event.kbd.flags = 0;
} else {
- event.kbd.keycode = Common::KEYCODE_ESCAPE;
- event.kbd.ascii = 27;
+ event.kbd.keycode = Common::KEYCODE_ESCAPE;
+ event.kbd.ascii = 27;
event.kbd.flags = 0;
}
@@ -1477,11 +1477,11 @@ void addEventsToQueue() {
event.type = Common::EVENT_KEYUP;
system->addEvent(event);
}
-
+
}
-
-
-
+
+
+
if ((!getIndyFightState()) && (getKeysDown() & KEY_Y)) {
consoleEnable = !consoleEnable;
if (displayModeIs8Bit) {
@@ -1490,7 +1490,7 @@ void addEventsToQueue() {
displayMode16Bit();
}
}
-
+
if ((getKeyboardEnable())) {
event.kbd.flags = 0;
@@ -1498,30 +1498,30 @@ void addEventsToQueue() {
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;
event.kbd.ascii = 0;
event.type = getKeyEvent(KEY_LEFT);
system->addEvent(event);
}
-
+
if (getKeysChanged() & KEY_RIGHT) {
event.kbd.keycode = Common::KEYCODE_RIGHT;
event.kbd.ascii = 0;
event.type = getKeyEvent(KEY_RIGHT);
system->addEvent(event);
}
-
+
if (getKeysChanged() & KEY_UP) {
event.kbd.keycode = Common::KEYCODE_UP;
event.kbd.ascii = 0;
event.type = getKeyEvent(KEY_UP);
system->addEvent(event);
}
-
+
if (getKeysChanged() & KEY_DOWN) {
event.kbd.keycode = Common::KEYCODE_DOWN;
event.kbd.ascii = 0;
@@ -1529,9 +1529,9 @@ void addEventsToQueue() {
system->addEvent(event);
}
}
-
+
}
-
+
if (!((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) && (!getIndyFightState()) && (!getKeyboardEnable())) {
if ((getKeysDown() & KEY_A) && (!indyFightState)) {
@@ -1544,10 +1544,10 @@ void addEventsToQueue() {
}
}
-
-
-
-
+
+
+
+
}
if ((getKeysDown() & KEY_SELECT)) {
@@ -1556,18 +1556,18 @@ void addEventsToQueue() {
showOptionsDialog();
}
-
+
}
-
+
if (!getIndyFightState() && !((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) && (getKeysDown() & KEY_X)) {
setKeyboardEnable(!keyboardEnable);
}
-
- updateStatus();
-
+
+ updateStatus();
+
Common::Event event;
-
+
if (!keyboardEnable) {
if ((tapScreenClicks) && (getIsDisplayMode8Bit()))
@@ -1578,11 +1578,11 @@ void addEventsToQueue() {
{
doButtonSelectMode(system);
}
-
+
if (((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) || (indyFightState)) && (displayModeIs8Bit)) {
// Controls specific to the control method
-
-
+
+
if (currentGame->control == CONT_SKY) {
// Extra controls for Beneath a Steel Sky
if ((getKeysDown() & KEY_DOWN)) {
@@ -1595,7 +1595,7 @@ void addEventsToQueue() {
// 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;
@@ -1608,13 +1608,13 @@ void addEventsToQueue() {
}
}
-
-
+
+
if (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 = '.';
@@ -1624,19 +1624,19 @@ void addEventsToQueue() {
event.type = Common::EVENT_KEYUP;
system->addEvent(event);
}
-
+
if (indyFightState) {
addIndyFightingKeys();
}
-
+
}
-
+
}
}
-
+
if (!displayModeIs8Bit) {
// Front end controls
-
+
if (leftHandedSwap(getKeysChanged()) & KEY_UP) {
event.type = getKeyEvent(leftHandedSwap(KEY_UP));
event.kbd.keycode = Common::KEYCODE_UP;
@@ -1663,10 +1663,10 @@ void addEventsToQueue() {
event.type = Common::EVENT_KEYUP;
system->addEvent(event);
}
-
+
}
-
+
if ((getKeysChanged() & KEY_START)) {
event.type = getKeyEvent(KEY_START);
if (currentGame->control == CONT_FUTURE_WARS) {
@@ -1688,34 +1688,34 @@ void addEventsToQueue() {
system->addEvent(event);
}
-
+
if (keyboardEnable) {
DS::addKeyboardEvents();
}
-
+
consumeKeys();
-
+
consumePenEvents();
}
}
-
+
void triggerIcon(int imageNum) {
triggeredIcon = imageNum;
- triggeredIconTimeout = 120;
+ triggeredIconTimeout = 120;
}
-
+
void setIcon(int num, int x, int y, int imageNum, int flags, bool enable) {
- sprites[num].attribute[0] = ATTR0_BMP | (enable? (y & 0xFF): 192) | (!enable? ATTR0_DISABLED: 0);
+ sprites[num].attribute[0] = ATTR0_BMP | (enable? (y & 0xFF): 192) | (!enable? ATTR0_DISABLED: 0);
sprites[num].attribute[1] = ATTR1_SIZE_32 | (x & 0x1FF) | flags;
sprites[num].attribute[2] = ATTR2_ALPHA(1)| (imageNum * 16);
}
void setIconMain(int num, int x, int y, int imageNum, int flags, bool enable) {
- spritesMain[num].attribute[0] = ATTR0_BMP | (y & 0xFF) | (!enable? ATTR0_DISABLED: 0);
+ spritesMain[num].attribute[0] = ATTR0_BMP | (y & 0xFF) | (!enable? ATTR0_DISABLED: 0);
spritesMain[num].attribute[1] = ATTR1_SIZE_32 | (x & 0x1FF) | flags;
spritesMain[num].attribute[2] = ATTR2_ALPHA(1)| (imageNum * 16);
}
@@ -1744,17 +1744,17 @@ void updateStatus() {
break;
}
}
-
+
setIcon(0, 208, 150, offs, 0, true);
}
-
+
if (indyFightState) {
setIcon(1, (190 - 32), 150, 3, (indyFightRight? 0: ATTR1_FLIP_X), true);
// consolePrintf("%d\n", indyFightRight);
} else {
// setIcon(1, 0, 0, 0, 0, false);
}
-
+
if (triggeredIconTimeout > 0) {
triggeredIconTimeout--;
setIcon(4, 16, 150, triggeredIcon, 0, true);
@@ -1793,7 +1793,7 @@ void soundBufferEmptyHandler() {
} else {
// bufferFirstHalf = true;
}
-
+
soundHiPart = !soundHiPart;
}
@@ -1804,7 +1804,7 @@ void setMainScreenScroll(int x, int y) {
} else */{
BG3_CX = x + (((frameCount & 1) == 0)? 64: 0);
BG3_CY = y;
-
+
if ((!gameScreenSwap) || (touchPadStyle)) {
touchX = x >> 8;
touchY = y >> 8;
@@ -1827,14 +1827,14 @@ void setMainScreenScale(int x, int y) {
BG3_YDY = y;
}
else
- {
+ {
BG3_XDX = x;
BG3_XDY = 0;
BG3_YDX = 0;
BG3_YDY = y;
}
-
- if ((!gameScreenSwap) || (touchPadStyle)) {
+
+ if ((!gameScreenSwap) || (touchPadStyle)) {
touchScX = x;
touchScY = y;
}
@@ -1845,7 +1845,7 @@ void setZoomedScreenScroll(int x, int y, bool shake) {
/* if (gameScreenSwap) {
BG3_CX = x + ((shake && ((frameCount & 1) == 0))? 64: 0);
BG3_CY = y;
-
+
touchX = x >> 8;
touchY = y >> 8;
} else */{
@@ -1908,7 +1908,7 @@ void VBlankHandler(void) {
soundUpdate();
-
+
if ((!gameScreenSwap) && (!(getKeysHeld() & KEY_L) && !(getKeysHeld() & KEY_R))) {
if (currentGame) {
@@ -1923,14 +1923,14 @@ void VBlankHandler(void) {
}
}
}
-
+
penUpdate();
keysUpdate();
frameCount++;
-
+
if ((cursorEnable) && (mouseCursorVisible)) {
if (!keyboardEnable) {
storedMouseX = penX;
@@ -1953,31 +1953,31 @@ void VBlankHandler(void) {
if (callback) {
callbackTimer -= FRAME_TIME;
}
-
+
if ((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) {
-
+
if ((!dragging) && (getPenHeld()) && (penDownFrames > 5)) {
dragging = true;
dragStartX = penX;
dragStartY = penY;
-
+
if (gameScreenSwap) {
dragScX = subScTargetX;
dragScY = subScTargetY;
} else {
dragScX = scX;
- dragScY = scY;
- }
-
-
+ dragScY = scY;
+ }
+
+
}
-
+
if ((dragging) && (!getPenHeld())) {
dragging = false;
}
-
+
if (dragging) {
-
+
if (gameScreenSwap) {
subScTargetX = dragScX + ((dragStartX - penX) << 8);
subScTargetY = dragScY + ((dragStartY - penY) << 8);
@@ -1985,18 +1985,18 @@ void VBlankHandler(void) {
scX = dragScX + ((dragStartX - penX));
scY = dragScY + ((dragStartY - penY));
}
-
+
// consolePrintf("X:%d Y:%d\n", dragStartX - penX, dragStartY - penY);
}
- }
-
-
+ }
+
+
/* if ((frameCount & 1) == 0) {
SUB_BG3_CX = subScX;
} else {
SUB_BG3_CX = subScX + 64;
}
-
+
SUB_BG3_CY = subScY + (shakePos << 8);*/
/*SUB_BG3_XDX = (int) (subScreenWidth / 256.0f * 256);
@@ -2005,26 +2005,26 @@ void VBlankHandler(void) {
SUB_BG3_YDY = (int) (subScreenHeight / 192.0f * 256);*/
static int ratio = (320 << 8) / SCUMM_GAME_WIDTH;
-
+
bool zooming = false;
-
+
if ((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) {
if ((getKeysHeld() & KEY_A) && (subScreenScale < ratio)) {
subScreenScale += 1;
zooming = true;
}
-
+
if ((getKeysHeld() & KEY_B) && (subScreenScale > 128)) {
subScreenScale -=1;
zooming = true;
}
}
-
+
int xCenter = subScTargetX + ((subScreenWidth >> 1) << 8);
int yCenter = subScTargetY + ((subScreenHeight >> 1) << 8);
-
+
if (twoHundredPercentFixedScale) {
subScreenWidth = 256 >> 1;
subScreenHeight = 192 >> 1;
@@ -2033,9 +2033,9 @@ void VBlankHandler(void) {
// subScreenHeight = SCUMM_GAME_HEIGHT * subScreenScale >> 8;
- subScreenWidth = (256 * subScreenScale) >> 8;
+ subScreenWidth = (256 * subScreenScale) >> 8;
subScreenHeight = (192 * subScreenScale) >> 8;
-
+
if ( ((subScreenWidth) > 256 - 8) && ((subScreenWidth) < 256 + 8) ) {
subScreenWidth = 256;
subScreenHeight = 192;
@@ -2064,13 +2064,13 @@ void VBlankHandler(void) {
//triggerIcon(-1);
}
}
-
+
subScTargetX = xCenter - ((subScreenWidth >> 1) << 8);
subScTargetY = yCenter - ((subScreenHeight >> 1) << 8);
-
-
+
+
if (subScTargetX < 0) subScTargetX = 0;
if (subScTargetX > (gameWidth - subScreenWidth) << 8) subScTargetX = (gameWidth - subScreenWidth) << 8;
@@ -2082,30 +2082,30 @@ void VBlankHandler(void) {
subScX += (subScTargetX - subScX) >> 2;
subScY += (subScTargetY - subScY) >> 2;
-
+
if (displayModeIs8Bit) {
-
+
if ((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) {
-
+
int offsX = 0, offsY = 0;
if (getKeysHeld() & KEY_LEFT) {
offsX -= 1;
}
-
+
if (getKeysHeld() & KEY_RIGHT) {
offsX += 1;
}
-
+
if (getKeysHeld() & KEY_UP) {
offsY -= 1;
}
-
+
if (getKeysHeld() & KEY_DOWN) {
offsY += 1;
}
-
+
if (((gameScreenSwap) && (getKeysHeld() & KEY_L)) || ((!gameScreenSwap) && (getKeysHeld() & KEY_R))) {
subScTargetX += offsX << 8;
subScTargetY += offsY << 8;
@@ -2116,32 +2116,32 @@ void VBlankHandler(void) {
}
if (!scaledMode) {
-
+
if (scX + 256 > gameWidth - 1) {
scX = gameWidth - 1 - 256;
}
-
+
if (scX < 0) {
scX = 0;
}
-
+
if (scY + 192 > gameHeight - 1) {
scY = gameHeight - 1 - 192;
}
-
+
if (scY < 0) {
scY = 0;
}
-
+
setZoomedScreenScroll(subScX, subScY, (subScreenWidth != 256) && (subScreenWidth != 128));
setZoomedScreenScale(subScreenWidth, ((subScreenHeight * (256 << 8)) / 192) >> 8);
-
-
+
+
setMainScreenScroll(scX << 8, (scY << 8) + (shakePos << 8));
setMainScreenScale(256, 256); // 1:1 scale
-
+
} else {
-
+
if (scY > gameHeight - 192 - 1) {
scY = gameHeight - 192 - 1;
}
@@ -2149,13 +2149,13 @@ void VBlankHandler(void) {
if (scY < 0) {
scY = 0;
}
-
+
setZoomedScreenScroll(subScX, subScY, (subScreenWidth != 256) && (subScreenWidth != 128));
setZoomedScreenScale(subScreenWidth, ((subScreenHeight * (256 << 8)) / 192) >> 8);
-
+
setMainScreenScroll(64, (scY << 8) + (shakePos << 8));
setMainScreenScale(320, 256); // 1:1 scale
-
+
}
} else {
setZoomedScreenScroll(0, 0, true);
@@ -2164,12 +2164,12 @@ void VBlankHandler(void) {
setMainScreenScroll(0, 0);
setMainScreenScale(320, 256); // 1:1 scale
}
-
+
// Enable on screen keyboard when pen taps icon
if ((keyboardIcon) && (penX < 32) && (penY > 160) && (penHeld)) {
setKeyboardEnable(true);
}
-
+
if (keyboardEnable) {
if (DS::getKeyboardClosed()) {
setKeyboardEnable(false);
@@ -2219,7 +2219,7 @@ void setTopScreenTarget(int x, int y) {
if (subScTargetY < 0) subScTargetY = 0;
if (subScTargetY > gameHeight - subScreenHeight) subScTargetY = gameHeight - subScreenHeight;
-
+
subScTargetX <<=8;
subScTargetY <<=8;
}
@@ -2233,16 +2233,16 @@ void hBlankHandler() {
#endif
void uploadSpriteGfx() {
- vramSetBankD(VRAM_D_SUB_SPRITE);
- vramSetBankE(VRAM_E_MAIN_SPRITE);
+ vramSetBankD(VRAM_D_SUB_SPRITE);
+ vramSetBankE(VRAM_E_MAIN_SPRITE);
// Convert texture from 24bit 888 to 16bit 1555, remembering to set top bit!
- u8* srcTex = (u8 *) icons_raw;
+ u8* srcTex = (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);
}
-
+
}
void initHardware() {
@@ -2253,12 +2253,12 @@ void initHardware() {
penInit();
powerON(POWER_ALL);
-/* vramSetBankA(VRAM_A_MAIN_BG);
- vramSetBankB(VRAM_B_MAIN_BG);
+/* vramSetBankA(VRAM_A_MAIN_BG);
+ vramSetBankB(VRAM_B_MAIN_BG);
vramSetBankC(VRAM_C_SUB_BG); */
- vramSetBankD(VRAM_D_SUB_SPRITE);
- vramSetBankE(VRAM_E_MAIN_SPRITE);
-
+ vramSetBankD(VRAM_D_SUB_SPRITE);
+ vramSetBankE(VRAM_E_MAIN_SPRITE);
+
currentTimeMillis = 0;
@@ -2286,8 +2286,8 @@ void initHardware() {
// Allocate save buffer for game screen
// savedBuffer = new u8[320 * 200];
displayMode16Bit();
-
- memset(BG_GFX, 0, 512 * 256 * 2);
+
+ memset(BG_GFX, 0, 512 * 256 * 2);
scaledMode = true;
scX = 0;
scY = 0;
@@ -2295,33 +2295,33 @@ void initHardware() {
subScY = 0;
subScTargetX = 0;
subScTargetY = 0;
-
+
//lcdSwap();
POWER_CR &= ~POWER_SWAP_LCDS;
-
+
frameCount = 0;
callback = NULL;
-
-// vramSetBankH(VRAM_H_SUB_BG);
-
+
+// vramSetBankH(VRAM_H_SUB_BG);
+
// // Do text stuff
//BG0_CR = BG_MAP_BASE(0) | BG_TILE_BASE(1);
// BG0_Y0 = 48;
-
+
PALETTE[255] = RGB15(31,31,31);//by default font will be rendered with color 255
-
+
//consoleInit() is a lot more flexible but this gets you up and running quick
// consoleInitDefault((u16*)SCREEN_BASE_BLOCK(0), (u16*)CHAR_BASE_BLOCK(1), 16);
//consolePrintSet(0, 6);
-
+
//irqs are nice
irqInit();
// irqInitHandler();
irqSet(IRQ_VBLANK, VBlankHandler);
irqSet(IRQ_TIMER0, timerTickHandler);
irqSet(IRQ_TIMER2, soundBufferEmptyHandler);
-
+
irqEnable(IRQ_VBLANK);
irqEnable(IRQ_TIMER0);
irqEnable(IRQ_TIMER2);
@@ -2330,15 +2330,15 @@ void initHardware() {
irqSet(IRQ_HBLANK, hBlankHandler);
irqEnable(IRQ_HBLANK);
#endif
-
-
+
+
// Set up a millisecond timer
#ifdef HEAVY_LOGGING
consolePrintf("Setting up timer...");
#endif
TIMER0_CR = 0;
TIMER0_DATA = (u32) TIMER_FREQ(1000);
- TIMER0_CR = TIMER_ENABLE | TIMER_DIV_1 | TIMER_IRQ_REQ;
+ TIMER0_CR = TIMER_ENABLE | TIMER_DIV_1 | TIMER_IRQ_REQ;
REG_IME = 1;
#ifdef HEAVY_LOGGING
consolePrintf("done\n");
@@ -2347,7 +2347,7 @@ void initHardware() {
PALETTE[255] = RGB15(0,0,31);
initSprites();
-
+
// videoSetModeSub(MODE_3_2D | DISPLAY_BG0_ACTIVE | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); //sub bg 0 will be used to print text
// If the software scaler's back buffer has not been allocated, do it now
@@ -2405,7 +2405,7 @@ void penUpdate() {
if ((tapTimeout >= 0)) {
tapTimeout++;
-
+
if (((tapTimeout > 15) || (tapCount == 2)) && (tapCount > 0)) {
tapComplete = tapCount;
tapCount = 0;
@@ -2413,7 +2413,7 @@ void penUpdate() {
}
}
-
+
if ((penHeld) && (!penDownThisFrame)) {
if ((touchPadStyle) || (moved) || (tapCount == 1)) {
@@ -2427,15 +2427,15 @@ void penUpdate() {
}
}
-
+
if ((touchPadStyle) && (getIsDisplayMode8Bit())) {
-
- if ((penDownFrames > 0)) {
-
-
+
+ if ((penDownFrames > 0)) {
+
+
if ((penHeld)) {
-
+
if (penDownThisFrame)
{
if (penDownFrames >= 2) {
@@ -2446,13 +2446,13 @@ void penUpdate() {
if ((ABS(diffX) < 35) && (ABS(diffY) < 35))
{
-
+
if (speed >= 8)
{
diffX *= ((speed >> 3) * touchPadSensitivity) >> 3;
diffY *= ((speed >> 3) * touchPadSensitivity) >> 3;
}
-
+
penX += diffX;
penY += diffY;
if (penX > 255) penX = 255;
@@ -2460,30 +2460,30 @@ void penUpdate() {
if (penY > 191) penY = 191;
if (penY < 0) penY = 0;
}
-
+
// consolePrintf("x: %d y: %d\n", IPC->touchYpx - penDownY, IPC->touchYpx - penDownY);
penDownX = IPC->touchXpx;
penDownY = IPC->touchYpx;
-
+
}
}
else
{
}
-
-
+
+
} else {
penDown = true;
penHeld = true;
penDownSaved = true;
-
+
// First frame, so save pen positions
if (penDownThisFrame) {
penDownX = IPC->touchXpx;
penDownY = IPC->touchYpx;
}
}
-
+
} else {
if (penHeld) {
penReleased = true;
@@ -2491,13 +2491,13 @@ void penUpdate() {
} else {
penReleased = false;
}
-
+
penDown = false;
penHeld = false;
}
} else {
if ((penDownFrames > 1)) { // Is this right? Dunno, but it works for me.
-
+
if ((penHeld)) {
penHeld = true;
penDown = false;
@@ -2512,9 +2512,9 @@ void penUpdate() {
penY = IPC->touchYpx + touchYOffset;
moved = true;
}
-
-
+
+
} else {
if (penHeld) {
penReleased = true;
@@ -2522,12 +2522,12 @@ void penUpdate() {
} else {
penReleased = false;
}
-
+
penDown = false;
penHeld = false;
}
-
-
+
+
}
@@ -2545,20 +2545,20 @@ int leftHandedSwap(int keys) {
// Start and select are unchanged
if (leftHandedMode) {
int result = keys & (~(KEY_R | KEY_L | KEY_Y | KEY_A | KEY_B | KEY_X | KEY_LEFT | KEY_RIGHT | KEY_UP | KEY_DOWN));
-
+
if (keys & KEY_L) result |= KEY_R;
if (keys & KEY_R) result |= KEY_L;
-
+
if (keys & KEY_LEFT) result |= KEY_Y;
if (keys & KEY_RIGHT) result |= KEY_A;
if (keys & KEY_DOWN) result |= KEY_B;
if (keys & KEY_UP) result |= KEY_X;
-
+
if (keys & KEY_Y) result |= KEY_LEFT;
if (keys & KEY_A) result |= KEY_RIGHT;
if (keys & KEY_B) result |= KEY_DOWN;
if (keys & KEY_X) result |= KEY_UP;
-
+
return result;
} else {
return keys;
@@ -2647,10 +2647,10 @@ int getPenY() {
GLvector getPenPos() {
GLvector v;
-
+
v.x = (penX * inttof32(1)) / SCREEN_WIDTH;
v.y = (penY * inttof32(1)) / SCREEN_HEIGHT;
-
+
return v;
}
@@ -2659,18 +2659,18 @@ GLvector getPenPos() {
void formatSramOption() {
consolePrintf("The following files are present in save RAM:\n");
DSSaveFileManager::instance()->listFiles();
-
+
consolePrintf("\nAre you sure you want to\n");
consolePrintf("DELETE all files?\n");
consolePrintf("A = Yes, X = No\n");
-
+
while (true) {
if (keysHeld() & KEY_A) {
DSSaveFileManager::instance()->formatSram();
consolePrintf("SRAM cleared!\n");
return;
}
-
+
if (keysHeld() & KEY_X) {
consolePrintf("Whew, that was close!\n");
return;
@@ -2708,7 +2708,7 @@ void* fastRamAlloc(int size) {
if(fastRamPointer > fastRamData + FAST_RAM_SIZE) {
consolePrintf("FastRam (ITCM) allocation failed!\n");
return NULL;
- }
+ }
return result;
}
@@ -2723,7 +2723,7 @@ void fastRamReset() {
bool GBAMPAvail = false;
-bool initGBAMP(int mode) {
+bool initGBAMP(int mode) {
if (FAT_InitFiles()) {
if (mode == 2) {
disc_IsInserted();
@@ -2748,14 +2748,14 @@ void initDebugger() {
set_verbosity(VERBOSE_INFO | VERBOSE_ERROR);
wireless_init(0);
wireless_connect();
-
+
// This is where the address of the computer running the Java
// stub goes.
debugger_connect_tcp(192, 168, 0, 1);
- debugger_init();
-
+ debugger_init();
+
// Update function - should really call every frame
- user_debugger_update();
+ user_debugger_update();
}
@@ -2788,7 +2788,7 @@ cardTranslate cardReaderTable[] = {
void reboot() {
int deviceType = -1;
-
+
if (disc_getDeviceId() == DEVICE_DLDI) {
char id[6];
@@ -2855,7 +2855,7 @@ void dsExceptionHandler() {
consolePrintf("Blue screen of death");
setExceptionHandler(NULL);
-
+
u32 currentMode = getCPSR() & 0x1f;
u32 thumbState = ((*(u32*)0x027FFD90) & 0x20);
@@ -2871,7 +2871,7 @@ void dsExceptionHandler() {
exceptionAddress = getExceptionAddress( codeAddress, thumbState);
else
exceptionAddress = codeAddress;
-
+
} else {
if (thumbState)
offset = 2;
@@ -2919,13 +2919,13 @@ int main(void) {
initDebugger();
}
#endif
-
+
// Let arm9 read cartridge
*((u16 *) (0x04000204)) &= ~0x0080;
-
+
lastCallbackFrame = 0;
tweak = 0;
-
+
indyFightState = false;
indyFightRight = true;
@@ -2938,25 +2938,25 @@ int main(void) {
// bufferSize = 10;
-
+
/*bufferRate = 44100;
bufferFrame = 0;
bufferSamples = 8192;
bufferFirstHalf = false;
bufferSecondHalf = true;
-
+
int bytes = (2 * (bufferSamples)) + 100;
-
+
soundBuffer = (s16 *) malloc(bytes * 2);
soundHiPart = true;
-
+
for (int r = 0; r < bytes; r++) {
soundBuffer[r] = 0;
}
-
+
swiWaitForVBlank();
swiWaitForVBlank();
@@ -2965,29 +2965,29 @@ int main(void) {
swiWaitForVBlank();
swiWaitForVBlank();
*/
-
+
lastEventFrame = 0;
mouseMode = MOUSE_LEFT;
-
+
/*
TIMER1_CR = 0;
TIMER1_DATA = TIMER_FREQ(bufferRate);
TIMER1_CR = TIMER_ENABLE | TIMER_DIV_1;
-
+
TIMER2_CR = 0;
TIMER2_DATA = 0xFFFF - (bufferSamples / 2);
TIMER2_CR = TIMER_ENABLE | TIMER_IRQ_REQ | TIMER_CASCADE;
*/
// 2945 - 2947
-
-
+
+
// for (int r = 2946; r < 3000; r++) {
// soundBuffer[r] = 30000;
// }
-
+
//2372
consolePrintf("-------------------------------\n");
@@ -3040,7 +3040,7 @@ int main(void) {
consolePrintf("\n");
#endif
-
+
#ifdef USE_BUILT_IN_DRIVER_SELECTION
// Do M3 detection selectioon
int extraData = DSSaveFileManager::getExtraData();
@@ -3079,7 +3079,7 @@ int main(void) {
disc_setEnable(mode);
DSSaveFileManager::setExtraData(mode);
#else
-
+
int mode = 0;
#endif
@@ -3125,11 +3125,11 @@ int main(void) {
}
delete node;
-
+
updateStatus();
-
-
+
+
// OSystem_DS::instance();
g_system = new OSystem_DS();
diff --git a/backends/platform/ds/arm9/source/dsmain.h b/backends/platform/ds/arm9/source/dsmain.h
index ab74554917..7efd4a9365 100644
--- a/backends/platform/ds/arm9/source/dsmain.h
+++ b/backends/platform/ds/arm9/source/dsmain.h
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
+
#ifndef _DSMAIN_H
#define _DSMAIN_H
@@ -93,7 +93,7 @@ int getMillis(); // Return the current runtime in milliseconds
void doTimerCallback(); // Call callback function if required
// Sound
-void doSoundCallback();
+void doSoundCallback();
void startSound(int freq, int buffer); // Start sound hardware
// Call function if sound buffers need more data
void playSound(const void* data, u32 length, bool loop, bool adpcm = false, int rate = 22050); // Start a sound
diff --git a/backends/platform/ds/arm9/source/dsoptions.cpp b/backends/platform/ds/arm9/source/dsoptions.cpp
index 2dbc4b842b..277e8876c3 100644
--- a/backends/platform/ds/arm9/source/dsoptions.cpp
+++ b/backends/platform/ds/arm9/source/dsoptions.cpp
@@ -19,11 +19,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
+
#include "dsoptions.h"
#include "dsmain.h"
#include "gui/dialog.h"
-#include "gui/newgui.h"
+#include "gui/GuiManager.h"
#include "gui/ListWidget.h"
#include "gui/TabWidget.h"
#include "osystem_ds.h"
@@ -33,18 +33,11 @@
#define ALLOW_CPU_SCALER
-#ifdef DS_SCUMM_BUILD
-namespace Scumm {
- extern Common::StringList generateSavegameList(Scumm::ScummEngine *scumm, bool saveMode);
- extern Scumm::ScummEngine *g_scumm;
-}
-#endif
-
namespace DS {
DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) {
- addButton(this, 10, 170, "Close", GUI::kCloseCmd, 'C');
+ new GUI::ButtonWidget(this, 10, 170, 72, 16, "Close", GUI::kCloseCmd, 'C');
_tab = new GUI::TabWidget(this, 5, 5, 300, 230 - 20 - 40 - 10);
_tab->addTab("Controls");
@@ -54,29 +47,29 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) {
_showCursorCheckbox = new GUI::CheckboxWidget(_tab, 150, 5, 130, 20, "Show mouse cursor", 0, 'T');
_snapToBorderCheckbox = new GUI::CheckboxWidget(_tab, 150, 20, 130, 20, "Snap to edges", 0, 'T');
- new GUI::StaticTextWidget(_tab, 20, 35, 100, 15, "Touch X Offset", GUI::kTextAlignLeft);
+ new GUI::StaticTextWidget(_tab, 20, 35, 100, 15, "Touch X Offset", Graphics::kTextAlignLeft);
_touchX = new GUI::SliderWidget(_tab, 130, 35, 130, 12, 1);
_touchX->setMinValue(-8);
_touchX->setMaxValue(+8);
_touchX->setValue(0);
_touchX->setFlags(GUI::WIDGET_CLEARBG);
- new GUI::StaticTextWidget(_tab, 20, 50, 100, 15, "Touch Y Offset", GUI::kTextAlignLeft);
+ new GUI::StaticTextWidget(_tab, 20, 50, 100, 15, "Touch Y Offset", Graphics::kTextAlignLeft);
_touchY = new GUI::SliderWidget(_tab, 130, 50, 130, 12, 2);
_touchY->setMinValue(-8);
_touchY->setMaxValue(+8);
_touchY->setValue(0);
_touchY->setFlags(GUI::WIDGET_CLEARBG);
- new GUI::StaticTextWidget(_tab, 130 + 65 - 10, 65, 20, 15, "0", GUI::kTextAlignCenter);
- new GUI::StaticTextWidget(_tab, 130 + 130 - 10, 65, 20, 15, "8", GUI::kTextAlignCenter);
- new GUI::StaticTextWidget(_tab, 130 - 20, 65, 20, 15, "-8", GUI::kTextAlignCenter);
+ new GUI::StaticTextWidget(_tab, 130 + 65 - 10, 65, 20, 15, "0", Graphics::kTextAlignCenter);
+ new GUI::StaticTextWidget(_tab, 130 + 130 - 10, 65, 20, 15, "8", Graphics::kTextAlignCenter);
+ new GUI::StaticTextWidget(_tab, 130 - 20, 65, 20, 15, "-8", Graphics::kTextAlignCenter);
_touchPadStyle = new GUI::CheckboxWidget(_tab, 5, 80, 270, 20, "Use laptop trackpad-style cursor control", 0x20000001, 'T');
_screenTaps = new GUI::CheckboxWidget(_tab, 5, 95, 285, 20, "Tap for left click, double tap right click", 0x20000002, 'T');
- _sensitivityLabel = new GUI::StaticTextWidget(_tab, 20, 110, 110, 15, "Sensitivity", GUI::kTextAlignLeft);
+ _sensitivityLabel = new GUI::StaticTextWidget(_tab, 20, 110, 110, 15, "Sensitivity", Graphics::kTextAlignLeft);
_sensitivity = new GUI::SliderWidget(_tab, 130, 110, 130, 12, 1);
_sensitivity->setMinValue(4);
_sensitivity->setMaxValue(16);
@@ -85,13 +78,13 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) {
_tab->addTab("Graphics");
- new GUI::StaticTextWidget(_tab, 5, 70, 180, 15, "Initial top screen scale:", GUI::kTextAlignLeft);
+ new GUI::StaticTextWidget(_tab, 5, 70, 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');
- new GUI::StaticTextWidget(_tab, 5, 5, 180, 15, "Main screen scaling:", GUI::kTextAlignLeft);
+ 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');
@@ -105,28 +98,24 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) {
_tab->setActiveTab(0);
_radioButtonMode = false;
-
+
#ifdef DS_SCUMM_BUILD
if (!DS::isGBAMPAvailable()) {
// addButton(this, 100, 140, "Delete Save", 'dels', 'D');
}
#endif
-// new GUI::StaticTextWidget(this, 90, 10, 130, 15, "ScummVM DS Options", GUI::kTextAlignCenter);
+// new GUI::StaticTextWidget(this, 90, 10, 130, 15, "ScummVM DS Options", Graphics::kTextAlignCenter);
//#ifdef ALLOW_CPU_SCALER
// _cpuScaler = new GUI::CheckboxWidget(this, 160, 115, 90, 20, "CPU scaler", 0, 'T');
//#endif
-
-#ifdef DS_SCUMM_BUILD
- _delDialog = new Scumm::SaveLoadChooser("Delete game:", "Delete", false, Scumm::g_scumm);
-#endif
if (ConfMan.hasKey("snaptoborder", "ds")) {
_snapToBorderCheckbox->setState(ConfMan.getBool("snaptoborder", "ds"));
@@ -156,13 +145,13 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) {
_unscaledCheckbox->setState(false);
}
-
+
if (ConfMan.hasKey("topscreenzoom", "ds")) {
- _100PercentCheckbox->setState(false);
- _150PercentCheckbox->setState(false);
- _200PercentCheckbox->setState(false);
-
+ _100PercentCheckbox->setState(false);
+ _150PercentCheckbox->setState(false);
+ _200PercentCheckbox->setState(false);
+
switch (ConfMan.getInt("topscreenzoom", "ds"))
{
case 100: {
@@ -248,7 +237,7 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) {
if (!_cpuScaler->getState() && !_unscaledCheckbox->getState()) {
_hardScaler->setState(true);
}
-
+
_radioButtonMode = true;
}
@@ -304,17 +293,17 @@ void DSOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint
_cpuScaler->setState(false);
_hardScaler->setState(false);
_unscaledCheckbox->setState(false);
-
+
if ((sender == _cpuScaler) && (cmd == 0x10000002))
{
_cpuScaler->setState(true);
}
-
+
if ((sender == _hardScaler) && (cmd == 0x10000001))
{
_hardScaler->setState(true);
}
-
+
if ((sender == _unscaledCheckbox) && (cmd == 0x10000003))
{
_unscaledCheckbox->setState(true);
@@ -393,35 +382,6 @@ void DSOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint
updateConfigManager();
close();
}
-
-#ifdef DS_SCUMM_BUILD
-/* if (cmd == 'dels') {
- _delDialog->setList(Scumm::generateSavegameList(Scumm::g_scumm, false));
- _delDialog->handleCommand(NULL, GUI::kListSelectionChangedCmd, 0);
-
- Common::Event event;
- event.type = Common::EVENT_KEYDOWN;
- event.kbd.ascii = 0;
- event.kbd.keycode = Common::KEYCODE_DOWN;
- OSystem_DS::instance()->addEvent(event);
-
- event.type = Common::EVENT_KEYUP;
- OSystem_DS::instance()->addEvent(event);
-
- int idx = _delDialog->runModal();
-
- if (idx >= 0) {
- char name[256];
- Scumm::g_scumm->makeSavegameName(name, idx, false);
- if (!DS::isGBAMPAvailable()) {
- ((DSSaveFileManager *) (OSystem_DS::instance()->getSavefileManager()))->deleteFile(name);
- }
- }
-
- }*/
-#endif
-
-
}
void togglePause() {
@@ -432,11 +392,11 @@ void togglePause() {
OSystem_DS* system = OSystem_DS::instance();
event.type = Common::EVENT_KEYDOWN;
- event.kbd.keycode = Common::KEYCODE_p;
+ event.kbd.keycode = Common::KEYCODE_p;
event.kbd.ascii = 'p';
event.kbd.flags = 0;
system->addEvent(event);
-
+
event.type = Common::EVENT_KEYUP;
system->addEvent(event);
}
@@ -447,12 +407,12 @@ void showOptionsDialog() {
togglePause();
DS::displayMode16Bit();
-
+
DSOptionsDialog* d = new DSOptionsDialog();
d->runModal();
delete d;
-
+
DS::displayMode8Bit();
togglePause();
@@ -527,7 +487,7 @@ void setOptions() {
} else {
DS::setCpuScalerEnable(false);
}
-#endif
+#endif
if (ConfMan.hasKey("screentaps", "ds")) {
DS::setTapScreenClicksEnable(ConfMan.getBool("screentaps", "ds"));
@@ -537,7 +497,7 @@ void setOptions() {
if (ConfMan.hasKey("touchpad", "ds")) {
bool enable = ConfMan.getBool("touchpad", "ds");
-
+
DS::setTrackPadStyleEnable(enable);
if ((enable) and (firstLoad)) {
@@ -549,7 +509,7 @@ void setOptions() {
if (enable) {
DS::setTapScreenClicksEnable(true);
}
-
+
} else {
DS::setTrackPadStyleEnable(false);
}
diff --git a/backends/platform/ds/arm9/source/dsoptions.h b/backends/platform/ds/arm9/source/dsoptions.h
index e3ab2f55e0..229b27ebbb 100644
--- a/backends/platform/ds/arm9/source/dsoptions.h
+++ b/backends/platform/ds/arm9/source/dsoptions.h
@@ -19,13 +19,14 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
+
#ifndef _DSOPTIONS_H_
#define _DSOPTIONS_H_
#include "common/scummsys.h"
#include "common/str.h"
+#include "common/config-manager.h"
#include "gui/object.h"
#include "gui/widget.h"
@@ -40,7 +41,7 @@ class DSOptionsDialog : public GUI::Dialog {
public:
DSOptionsDialog();
~DSOptionsDialog();
-
+
protected:
virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
void togglePause();
@@ -66,14 +67,10 @@ protected:
GUI::CheckboxWidget* _hardScaler;
GUI::CheckboxWidget* _cpuScaler;
-
+
GUI::CheckboxWidget* _touchPadStyle;
GUI::CheckboxWidget* _screenTaps;
-#ifdef DS_SCUMM_BUILD
- Scumm::SaveLoadChooser* _delDialog;
-#endif
-
bool _radioButtonMode;
};
diff --git a/backends/platform/ds/arm9/source/fat/disc_io.c b/backends/platform/ds/arm9/source/fat/disc_io.c
index 6d48674d62..9a65812f89 100644
--- a/backends/platform/ds/arm9/source/fat/disc_io.c
+++ b/backends/platform/ds/arm9/source/fat/disc_io.c
@@ -5,7 +5,7 @@
uniformed io-interface to work with Chishm's FAT library
Written by MightyMax
-
+
Modified by Chishm:
2005-11-06
* Added WAIT_CR modifications for NDS
@@ -28,13 +28,13 @@
* Added EFA2 support
*/
-#include "disc_io.h"
-#include "scummconsole.h"
-
#ifdef NDS
#include <nds.h>
#endif
+#include "disc_io.h"
+#include "scummconsole.h"
+
// Include known io-interfaces:
#ifdef SUPPORT_MPCF
@@ -87,7 +87,7 @@ LPIO_INTERFACE active_interface = 0;
Disc Cache functions
2006-02-03:
- Added by www.neoflash.com
+ Added by www.neoflash.com
*/
int discDetect = 0;
@@ -99,7 +99,7 @@ int dldiFound = FALSE;
#include <string.h>
#define CACHE_FREE 0xFFFFFFFF
-
+
static u8 cacheBuffer[ DISC_CACHE_COUNT * 512 ];
static struct {
@@ -112,20 +112,20 @@ FATDevice currentDevice;
static u32 disc_CacheFind(u32 sector) {
u32 i;
-
+
for( i = 0; i < DISC_CACHE_COUNT; i++ ) {
if( cache[ i ].sector == sector )
return i;
}
-
+
return CACHE_FREE;
}
static u32 disc_CacheFindFree(void) {
-
+
u32 i = 0, j;
u32 count = -1;
-
+
for( j = 0; j < DISC_CACHE_COUNT; j++ ) {
if( cache[ j ].sector == CACHE_FREE ) {
@@ -142,7 +142,7 @@ static u32 disc_CacheFindFree(void) {
if( cache[ i ].sector != CACHE_FREE && cache[i].dirty != 0 ) {
active_interface->fn_WriteSectors( cache[ i ].sector, 1, &cacheBuffer[ i * 512 ] );
- /* todo: handle write error here
+ // todo: handle write error here
cache[ i ].sector = CACHE_FREE;
cache[ i ].dirty = 0;
@@ -368,7 +368,7 @@ bool disc_setDsSlotInterface (void)
active_interface = DLDI_GetInterface();
- if (stricmp(&_dldi_driver_name, "Default (No interface)")) {
+ if (stricmp((char *)(&_dldi_driver_name), "Default (No interface)")) {
char name[48];
memcpy(name, &_dldi_driver_name, 48);
name[47] = '\0';
@@ -431,7 +431,7 @@ bool disc_setDsSlotInterface (void)
#endif
-bool disc_Init(void)
+bool disc_Init(void)
{
#ifdef DISC_CACHE
disc_CacheInit();
@@ -455,15 +455,15 @@ bool disc_Init(void)
// could not find a working IO Interface
active_interface = 0 ;
return false ;
-}
+}
-bool disc_IsInserted(void)
+bool disc_IsInserted(void)
{
if (active_interface) return active_interface->fn_IsInserted() ;
return false ;
-}
+}
-bool disc_ReadSectors(u32 sector, u8 numSecs, void* buffer)
+bool disc_ReadSectors(u32 sector, u8 numSecs, void* buffer)
{
#ifdef DISC_CACHE
u8 *p=(u8*)buffer;
@@ -480,9 +480,9 @@ bool disc_ReadSectors(u32 sector, u8 numSecs, void* buffer)
if (active_interface) return active_interface->fn_ReadSectors(sector,numSecs,buffer) ;
return false ;
#endif
-}
+}
-bool disc_WriteSectors(u32 sector, u8 numSecs, void* buffer)
+bool disc_WriteSectors(u32 sector, u8 numSecs, void* buffer)
{
/*#ifdef DISC_CACHE
u8 *p=(u8*)buffer;
@@ -513,32 +513,32 @@ bool disc_WriteSectors(u32 sector, u8 numSecs, void* buffer)
int r;
for (r = 0; r < numSecs; r++) {
- memcpy(sectorBuffer, &buffer[r * 512], 512);
+ memcpy(sectorBuffer, &((char *)buffer)[r * 512], 512);
if (!active_interface->fn_WriteSectors(sector + r, 1, sectorBuffer))
{
return false;
}
}
-
+
return true;
}
#else
if (active_interface) return active_interface->fn_WriteSectors(sector,numSecs,buffer) ;
- return false ;
#endif
//#endif
-}
+ return false ;
+}
-bool disc_ClearStatus(void)
+bool disc_ClearStatus(void)
{
if (active_interface) return active_interface->fn_ClearStatus() ;
return false ;
-}
+}
-bool disc_Shutdown(void)
+bool disc_Shutdown(void)
{
#ifdef DISC_CACHE
disc_CacheFlush();
@@ -546,7 +546,7 @@ bool disc_Shutdown(void)
if (active_interface) active_interface->fn_Shutdown() ;
active_interface = 0 ;
return true ;
-}
+}
u32 disc_HostType (void)
{
diff --git a/backends/platform/ds/arm9/source/fat/disc_io.h b/backends/platform/ds/arm9/source/fat/disc_io.h
index 2d3da1fc6f..d9a3c67353 100644
--- a/backends/platform/ds/arm9/source/fat/disc_io.h
+++ b/backends/platform/ds/arm9/source/fat/disc_io.h
@@ -7,7 +7,7 @@
// Use DMA to read the card, remove this line to use normal reads/writes
// #define _CF_USE_DMA
-// Allow buffers not aligned to 16 bits when reading files.
+// Allow buffers not aligned to 16 bits when reading files.
// Note that this will slow down access speed, so only use if you have to.
// It is also incompatible with DMA
#define _CF_ALLOW_UNALIGNED
@@ -43,7 +43,7 @@
// This allows the code to build on an earlier version of libnds, before the register was renamed
#ifndef REG_EXMEMCNT
-#define REG_EXMEMCNT REG_EXEMEMCNT
+#define REG_EXMEMCNT REG_EXEMEMCNT
#endif
#ifndef REG_EXEMEMCNT
@@ -70,7 +70,7 @@
#endif
// Disable NDS specific hardware and features if running on a GBA
-#ifndef NDS
+#ifndef NDS
#undef SUPPORT_NMMC
#undef DISC_CACHE
#endif
diff --git a/backends/platform/ds/arm9/source/fat/gba_nds_fat.c b/backends/platform/ds/arm9/source/fat/gba_nds_fat.c
index b5fdd665df..b70d9e7b99 100644
--- a/backends/platform/ds/arm9/source/fat/gba_nds_fat.c
+++ b/backends/platform/ds/arm9/source/fat/gba_nds_fat.c
@@ -42,7 +42,7 @@
//---------------------------------------------------------------
// Appropriate placement of CF functions and data
#ifdef NDS
- #define _VARS_IN_RAM
+ #define _VARS_IN_RAM
#else
#define _VARS_IN_RAM __attribute__ ((section (".sbss")))
#endif
@@ -74,7 +74,7 @@
#ifdef __GNUC__
#define __PACKED __attribute__ ((__packed__))
#else
- #define __PACKED
+ #define __PACKED
#pragma pack(1)
#endif
@@ -98,7 +98,7 @@ typedef struct
u32 numSectors;
union // Different types of extended BIOS Parameter Block for FAT16 and FAT32
{
- struct
+ struct
{
// Ext BIOS Parameter Block for FAT16
u8 driveNumber;
@@ -110,7 +110,7 @@ typedef struct
// Bootcode
u8 bootCode[448];
} __PACKED fat16;
- struct
+ struct
{
// FAT32 extended block
u32 sectorsPerFAT32;
@@ -158,7 +158,7 @@ typedef struct
typedef struct
{
u8 ordinal; // Position within LFN
- u16 char0;
+ u16 char0;
u16 char1;
u16 char2;
u16 char3;
@@ -177,7 +177,7 @@ typedef struct
u16 char12;
} __PACKED DIR_ENT_LFN;
-const char lfn_offset_table[13]={0x01,0x03,0x05,0x07,0x09,0x0E,0x10,0x12,0x14,0x16,0x18,0x1C,0x1E};
+const char lfn_offset_table[13]={0x01,0x03,0x05,0x07,0x09,0x0E,0x10,0x12,0x14,0x16,0x18,0x1C,0x1E};
// End of packed structs
#ifdef __PACKED
@@ -190,7 +190,7 @@ const char lfn_offset_table[13]={0x01,0x03,0x05,0x07,0x09,0x0E,0x10,0x12,0x14,0x
//-----------------------------------------------------------------
// Global Variables
-// _VARS_IN_RAM variables are stored in the largest section of WRAM
+// _VARS_IN_RAM variables are stored in the largest section of WRAM
// available: IWRAM on NDS ARM7, EWRAM on NDS ARM9 and GBA
// Files
@@ -305,7 +305,7 @@ u16 getRTCtoFileTime (void)
u16 getRTCtoFileDate (void)
{
#ifdef NDS
- return (
+ return (
( ((IPC->rtc_year + 20) & 0x7F) <<9) |
( (IPC->rtc_month & 0xF) << 5) |
(IPC->rtc_day & 0x1F) );
@@ -330,13 +330,13 @@ u32 FAT_NextCluster(u32 cluster)
u32 nextCluster = CLUSTER_FREE;
u32 sector;
int offset;
-
- switch (filesysType)
+
+ switch (filesysType)
{
case FS_UNKNOWN:
nextCluster = CLUSTER_FREE;
break;
-
+
case FS_FAT12:
sector = filesysFAT + (((cluster * 3) / 2) / BYTE_PER_READ);
offset = ((cluster * 3) / 2) % BYTE_PER_READ;
@@ -351,32 +351,32 @@ u32 FAT_NextCluster(u32 cluster)
nextCluster = ((u8*)fatBuffer)[offset];
offset++;
-
+
if (offset >= BYTE_PER_READ) {
offset = 0;
fatBufferCurSector++;
disc_ReadSector(fatBufferCurSector, fatBuffer);
}
-
+
nextCluster |= (((u8*)fatBuffer)[offset]) << 8;
-
+
if (cluster & 0x01) {
nextCluster = nextCluster >> 4;
} else {
nextCluster &= 0x0FFF;
}
-
+
if (nextCluster >= 0x0FF7)
{
nextCluster = CLUSTER_EOF;
}
break;
-
+
case FS_FAT16:
sector = filesysFAT + ((cluster << 1) / BYTE_PER_READ);
offset = cluster % (BYTE_PER_READ >> 1);
-
+
// If FAT buffer contains wrong sector
if (sector != fatBufferCurSector)
{
@@ -387,17 +387,17 @@ u32 FAT_NextCluster(u32 cluster)
// read the nextCluster value
nextCluster = ((u16*)fatBuffer)[offset];
-
+
if (nextCluster >= 0xFFF7)
{
nextCluster = CLUSTER_EOF;
}
break;
-
+
case FS_FAT32:
sector = filesysFAT + ((cluster << 2) / BYTE_PER_READ);
offset = cluster % (BYTE_PER_READ >> 2);
-
+
// If FAT buffer contains wrong sector
if (sector != fatBufferCurSector)
{
@@ -408,18 +408,18 @@ u32 FAT_NextCluster(u32 cluster)
// read the nextCluster value
nextCluster = (((u32*)fatBuffer)[offset]) & 0x0FFFFFFF;
-
+
if (nextCluster >= 0x0FFFFFF7)
{
nextCluster = CLUSTER_EOF;
}
break;
-
+
default:
nextCluster = CLUSTER_FREE;
break;
}
-
+
return nextCluster;
}
@@ -437,13 +437,13 @@ bool FAT_WriteFatEntry (u32 cluster, u32 value)
{
return false;
}
-
- switch (filesysType)
+
+ switch (filesysType)
{
case FS_UNKNOWN:
return false;
break;
-
+
case FS_FAT12:
sector = filesysFAT + (((cluster * 3) / 2) / BYTE_PER_READ);
offset = ((cluster * 3) / 2) % BYTE_PER_READ;
@@ -465,32 +465,32 @@ bool FAT_WriteFatEntry (u32 cluster, u32 value)
offset = 0;
// write the buffer back to disc
disc_WriteSector(fatBufferCurSector, fatBuffer);
- // read the next sector
+ // read the next sector
fatBufferCurSector++;
disc_ReadSector(fatBufferCurSector, fatBuffer);
}
-
+
((u8*)fatBuffer)[offset] = (value & 0x0FF0) >> 4;
} else {
-
+
((u8*)fatBuffer)[offset] = value & 0xFF;
-
+
offset++;
if (offset >= BYTE_PER_READ) {
offset = 0;
// write the buffer back to disc
disc_WriteSector(fatBufferCurSector, fatBuffer);
- // read the next sector
+ // read the next sector
fatBufferCurSector++;
disc_ReadSector(fatBufferCurSector, fatBuffer);
}
-
+
((u8*)fatBuffer)[offset] = (((u8*)fatBuffer)[offset] & 0xF0) | ((value >> 8) & 0x0F);
}
break;
-
+
case FS_FAT16:
sector = filesysFAT + ((cluster << 1) / BYTE_PER_READ);
offset = cluster % (BYTE_PER_READ >> 1);
@@ -507,11 +507,11 @@ bool FAT_WriteFatEntry (u32 cluster, u32 value)
((u16*)fatBuffer)[offset] = (value & 0xFFFF);
break;
-
+
case FS_FAT32:
sector = filesysFAT + ((cluster << 2) / BYTE_PER_READ);
offset = cluster % (BYTE_PER_READ >> 2);
-
+
// If FAT buffer contains wrong sector
if (sector != fatBufferCurSector)
{
@@ -524,15 +524,15 @@ bool FAT_WriteFatEntry (u32 cluster, u32 value)
(((u32*)fatBuffer)[offset]) = value;
break;
-
+
default:
return false;
break;
}
-
+
// write the buffer back to disc
disc_WriteSector(fatBufferCurSector, fatBuffer);
-
+
return true;
}
#endif
@@ -540,8 +540,8 @@ bool FAT_WriteFatEntry (u32 cluster, u32 value)
#ifdef CAN_WRITE_TO_DISC
/*-----------------------------------------------------------------
FAT_ReadWriteFatEntryBuffered
-Internal function - writes FAT information about a cluster to a
- buffer that should then be flushed to disc using
+Internal function - writes FAT information about a cluster to a
+ buffer that should then be flushed to disc using
FAT_WriteFatEntryFlushBuffer()
Call FAT_WriteFatEntry first so as not to ruin the disc.
Also returns the entry being replaced
@@ -555,13 +555,13 @@ u32 FAT_ReadWriteFatEntryBuffered (u32 cluster, u32 value)
if ((cluster < 0x0002) || (cluster > fatLastCluster))
return CLUSTER_FREE;
-
- switch (filesysType)
+
+ switch (filesysType)
{
case FS_UNKNOWN:
oldValue = CLUSTER_FREE;
break;
-
+
case FS_FAT12:
sector = filesysFAT + (((cluster * 3) / 2) / BYTE_PER_READ);
offset = ((cluster * 3) / 2) % BYTE_PER_READ;
@@ -587,40 +587,40 @@ u32 FAT_ReadWriteFatEntryBuffered (u32 cluster, u32 value)
offset = 0;
// write the buffer back to disc
disc_WriteSector(fatBufferCurSector, fatBuffer);
- // read the next sector
+ // read the next sector
fatBufferCurSector++;
disc_ReadSector(fatBufferCurSector, fatBuffer);
}
-
+
oldValue |= ((((u8*)fatBuffer)[offset]) << 4) & 0x0FF0;
((u8*)fatBuffer)[offset] = (value & 0x0FF0) >> 4;
} else {
-
+
oldValue = ((u8*)fatBuffer)[offset] & 0xFF;
((u8*)fatBuffer)[offset] = value & 0xFF;
-
+
offset++;
if (offset >= BYTE_PER_READ) {
offset = 0;
// write the buffer back to disc
disc_WriteSector(fatBufferCurSector, fatBuffer);
- // read the next sector
+ // read the next sector
fatBufferCurSector++;
disc_ReadSector(fatBufferCurSector, fatBuffer);
}
-
+
oldValue |= (((u8*)fatBuffer)[offset] & 0x0F) << 8;
((u8*)fatBuffer)[offset] = (((u8*)fatBuffer)[offset] & 0xF0) | ((value >> 8) & 0x0F);
}
- if (oldValue >= 0x0FF7)
+ if (oldValue >= 0x0FF7)
{
oldValue = CLUSTER_EOF;
}
break;
-
+
case FS_FAT16:
sector = filesysFAT + ((cluster << 1) / BYTE_PER_READ);
offset = cluster % (BYTE_PER_READ >> 1);
@@ -634,23 +634,23 @@ u32 FAT_ReadWriteFatEntryBuffered (u32 cluster, u32 value)
// Load correct sector to buffer
fatBufferCurSector = sector;
disc_ReadSector(fatBufferCurSector, fatBuffer);
- }
+ }
// write the value to the FAT buffer
oldValue = ((u16*)fatBuffer)[offset];
((u16*)fatBuffer)[offset] = value;
- if (oldValue >= 0xFFF7)
+ if (oldValue >= 0xFFF7)
{
oldValue = CLUSTER_EOF;
}
break;
-
+
case FS_FAT32:
sector = filesysFAT + ((cluster << 2) / BYTE_PER_READ);
offset = cluster % (BYTE_PER_READ >> 2);
-
+
// If FAT buffer contains wrong sector
if (sector != fatBufferCurSector)
{
@@ -666,18 +666,18 @@ u32 FAT_ReadWriteFatEntryBuffered (u32 cluster, u32 value)
oldValue = ((u32*)fatBuffer)[offset];
((u32*)fatBuffer)[offset] = value;
- if (oldValue >= 0x0FFFFFF7)
+ if (oldValue >= 0x0FFFFFF7)
{
oldValue = CLUSTER_EOF;
}
break;
-
+
default:
oldValue = CLUSTER_FREE;
break;
}
-
+
return oldValue;
}
#endif
@@ -727,7 +727,7 @@ u32 FAT_FirstFreeCluster(void)
/*-----------------------------------------------------------------
FAT_LinkFreeCluster
Internal function - gets the first available free cluster, sets it
-to end of file, links the input cluster to it then returns the
+to end of file, links the input cluster to it then returns the
cluster number
-----------------------------------------------------------------*/
u32 FAT_LinkFreeCluster(u32 cluster)
@@ -746,7 +746,7 @@ u32 FAT_LinkFreeCluster(u32 cluster)
{
return curLink; // Return the current link - don't allocate a new one
}
-
+
// Get a free cluster
firstFree = FAT_FirstFreeCluster();
@@ -777,7 +777,7 @@ Internal function - frees any cluster used by a file
bool FAT_ClearLinks (u32 cluster)
{
u32 nextCluster;
-
+
if ((cluster < 0x0002) || (cluster > fatLastCluster))
return false;
@@ -793,7 +793,7 @@ bool FAT_ClearLinks (u32 cluster)
while ((cluster != CLUSTER_EOF) && (cluster != CLUSTER_FREE))
{
cluster = FAT_ReadWriteFatEntryBuffered (cluster, CLUSTER_FREE);
- }
+ }
// Flush fat write buffer
FAT_WriteFatEntryFlushBuffer ();
@@ -814,7 +814,7 @@ bool FAT_InitFiles (void)
int i;
int bootSector;
BOOT_SEC* bootSec;
-
+
if (!disc_Init())
{
return (false);
@@ -830,7 +830,7 @@ bool FAT_InitFiles (void)
return false;
}*/
-
+
// Check if there is a FAT string, which indicates this is a boot sector
if ((globalBuffer[0x36] == 'F') && (globalBuffer[0x37] == 'A') && (globalBuffer[0x38] == 'T'))
@@ -848,9 +848,9 @@ bool FAT_InitFiles (void)
// First check for an active partition
for (i=0x1BE; (i < 0x1FE) && (globalBuffer[i] != 0x80); i+= 0x10);
// If it didn't find an active partition, search for any valid partition
- if (i == 0x1FE)
+ if (i == 0x1FE)
for (i=0x1BE; (i < 0x1FE) && (globalBuffer[i+0x04] == 0x00); i+= 0x10);
-
+
// Go to first valid partition
if ( i != 0x1FE) // Make sure it found a partition
{
@@ -865,7 +865,7 @@ bool FAT_InitFiles (void)
if (!disc_ReadSector (bootSector, bootSec)) {
return false;
}
-
+
// Store required information about the file system
if (bootSec->sectorsPerFAT != 0)
{
@@ -875,7 +875,7 @@ bool FAT_InitFiles (void)
{
filesysSecPerFAT = bootSec->extBlock.fat32.sectorsPerFAT32;
}
-
+
if (bootSec->numSectorsSmall != 0)
{
filesysNumSec = bootSec->numSectorsSmall;
@@ -987,7 +987,7 @@ Return the file info structure of the next valid file entry
u32 dirCluster: IN cluster of subdirectory table
int entry: IN the desired file entry
int origin IN: relative position of the entry
-DIR_ENT return OUT: desired dirEntry. First char will be FILE_FREE if
+DIR_ENT return OUT: desired dirEntry. First char will be FILE_FREE if
the entry does not exist.
-----------------------------------------------------------------*/
DIR_ENT FAT_GetDirEntry ( u32 dirCluster, int entry, int origin)
@@ -1011,8 +1011,8 @@ DIR_ENT FAT_GetDirEntry ( u32 dirCluster, int entry, int origin)
{
return (dir);
}
-
- switch (origin)
+
+ switch (origin)
{
case SEEK_SET:
wrkDirCluster = dirCluster;
@@ -1022,7 +1022,7 @@ DIR_ENT FAT_GetDirEntry ( u32 dirCluster, int entry, int origin)
case SEEK_CUR: // Don't change anything
break;
case SEEK_END: // Find entry signifying end of directory
- // Subtraction will never reach 0, so it keeps going
+ // Subtraction will never reach 0, so it keeps going
// until reaches end of directory
wrkDirCluster = dirCluster;
wrkDirSector = 0;
@@ -1055,7 +1055,7 @@ DIR_ENT FAT_GetDirEntry ( u32 dirCluster, int entry, int origin)
{
notFound = true;
}
- firstSector = FAT_ClustToSect(wrkDirCluster);
+ firstSector = FAT_ClustToSect(wrkDirCluster);
}
else if ((wrkDirCluster == FAT16_ROOT_DIR_CLUSTER) && (wrkDirSector == (filesysData - filesysRootDir)))
{
@@ -1082,7 +1082,7 @@ DIR_ENT FAT_GetDirEntry ( u32 dirCluster, int entry, int origin)
lfnName[0] = '\0';
}
}
- if (entry == 0)
+ if (entry == 0)
{
if (!lfnExists)
{
@@ -1128,7 +1128,7 @@ DIR_ENT FAT_GetDirEntry ( u32 dirCluster, int entry, int origin)
}
}
} while (!found && !notFound);
-
+
// If no file is found, return FILE_FREE
if (notFound)
{
@@ -1141,7 +1141,7 @@ DIR_ENT FAT_GetDirEntry ( u32 dirCluster, int entry, int origin)
/*-----------------------------------------------------------------
FAT_GetLongFilename
-Get the long name of the last file or directory retrived with
+Get the long name of the last file or directory retrived with
GetDirEntry. Also works for FindFirstFile and FindNextFile.
If a long name doesn't exist, it returns the short name
instead.
@@ -1156,14 +1156,14 @@ bool FAT_GetLongFilename (char* filename)
strncpy (filename, lfnName, MAX_FILENAME_LENGTH - 1);
filename[MAX_FILENAME_LENGTH - 1] = '\0';
-
+
return true;
}
/*-----------------------------------------------------------------
FAT_GetFilename
-Get the alias (short name) of the file or directory stored in
+Get the alias (short name) of the file or directory stored in
dirEntry
DIR_ENT dirEntry: IN a valid directory table entry
char* alias OUT: will be filled with the alias (short filename),
@@ -1192,7 +1192,7 @@ bool FAT_GetFilename (DIR_ENT dirEntry, char* alias)
}
}
else
- {
+ {
// Copy the filename from the dirEntry to the string
for (i = 0; (i < 8) && (dirEntry.name[i] != ' '); i++)
{
@@ -1230,7 +1230,7 @@ bool FAT_GetAlias (char* alias)
}
// Read in the last accessed directory entry
disc_ReadSector ((wrkDirCluster == FAT16_ROOT_DIR_CLUSTER ? filesysRootDir : FAT_ClustToSect(wrkDirCluster)) + wrkDirSector, globalBuffer);
-
+
return FAT_GetFilename (((DIR_ENT*)globalBuffer)[wrkDirOffset], alias);
}
@@ -1244,7 +1244,7 @@ u32 FAT_GetFileSize (void)
{
// Read in the last accessed directory entry
disc_ReadSector ((wrkDirCluster == FAT16_ROOT_DIR_CLUSTER ? filesysRootDir : FAT_ClustToSect(wrkDirCluster)) + wrkDirSector, globalBuffer);
-
+
return ((DIR_ENT*)globalBuffer)[wrkDirOffset].fileSize;
}
@@ -1257,7 +1257,7 @@ u32 FAT_GetFileCluster (void)
{
// Read in the last accessed directory entry
disc_ReadSector ((wrkDirCluster == FAT16_ROOT_DIR_CLUSTER ? filesysRootDir : FAT_ClustToSect(wrkDirCluster)) + wrkDirSector, globalBuffer);
-
+
return (((DIR_ENT*)globalBuffer)[wrkDirOffset].startCluster) | (((DIR_ENT*)globalBuffer)[wrkDirOffset].startClusterHigh << 16);
}
@@ -1270,7 +1270,7 @@ u8 FAT_GetFileAttributes (void)
{
// Read in the last accessed directory entry
disc_ReadSector ((wrkDirCluster == FAT16_ROOT_DIR_CLUSTER ? filesysRootDir : FAT_ClustToSect(wrkDirCluster)) + wrkDirSector, globalBuffer);
-
+
return ((DIR_ENT*)globalBuffer)[wrkDirOffset].attrib;
}
@@ -1294,7 +1294,7 @@ u8 FAT_SetFileAttributes (const char* filename, u8 attributes, u8 mask)
disc_ReadSector ((wrkDirCluster == FAT16_ROOT_DIR_CLUSTER ? filesysRootDir : FAT_ClustToSect(wrkDirCluster)) + wrkDirSector, globalBuffer);
((DIR_ENT*)globalBuffer)[wrkDirOffset].attrib = (((DIR_ENT*)globalBuffer)[wrkDirOffset].attrib & ~(mask & 0x27)) | (attributes & 0x27); // 0x27 is he settable attributes
-
+
disc_WriteSector ((wrkDirCluster == FAT16_ROOT_DIR_CLUSTER ? filesysRootDir : FAT_ClustToSect(wrkDirCluster)) + wrkDirSector, globalBuffer);
return ((DIR_ENT*)globalBuffer)[wrkDirOffset].attrib;
@@ -1305,7 +1305,7 @@ u8 FAT_SetFileAttributes (const char* filename, u8 attributes, u8 mask)
time_t FAT_FileTimeToCTime (u16 fileTime, u16 fileDate)
{
struct tm timeInfo;
-
+
timeInfo.tm_year = (fileDate >> 9) + 80; // years since midnight January 1970
timeInfo.tm_mon = ((fileDate >> 5) & 0xf) - 1; // Months since january
timeInfo.tm_mday = fileDate & 0x1f; // Day of the month
@@ -1326,7 +1326,7 @@ time_t FAT_GetFileCreationTime (void)
{
// Read in the last accessed directory entry
disc_ReadSector ((wrkDirCluster == FAT16_ROOT_DIR_CLUSTER ? filesysRootDir : FAT_ClustToSect(wrkDirCluster)) + wrkDirSector, globalBuffer);
-
+
return FAT_FileTimeToCTime(((DIR_ENT*)globalBuffer)[wrkDirOffset].cTime, ((DIR_ENT*)globalBuffer)[wrkDirOffset].cDate);
}
@@ -1339,7 +1339,7 @@ time_t FAT_GetFileLastWriteTime (void)
{
// Read in the last accessed directory entry
disc_ReadSector ((wrkDirCluster == FAT16_ROOT_DIR_CLUSTER ? filesysRootDir : FAT_ClustToSect(wrkDirCluster)) + wrkDirSector, globalBuffer);
-
+
return FAT_FileTimeToCTime(((DIR_ENT*)globalBuffer)[wrkDirOffset].mTime, ((DIR_ENT*)globalBuffer)[wrkDirOffset].mDate);
}
#endif
@@ -1371,11 +1371,11 @@ DIR_ENT FAT_DirEntFromPath (const char* path)
{
dirEntry.name[0] = FILE_FREE;
dirEntry.attrib = 0x00;
- return;
+ return dirEntry;
}
#endif
-
- if (path[pathPos] == '/')
+
+ if (path[pathPos] == '/')
{
dirCluster = filesysRootDirClus; // Start at root directory
}
@@ -1383,13 +1383,13 @@ DIR_ENT FAT_DirEntFromPath (const char* path)
{
dirCluster = curWorkDirCluster; // Start at current working dir
}
-
+
// Eat any slash /
while ((path[pathPos] == '/') && (path[pathPos] != '\0'))
{
pathPos++;
}
-
+
// Search until can't continue
found = false;
notFound = false;
@@ -1437,7 +1437,7 @@ DIR_ENT FAT_DirEntFromPath (const char* path)
flagLFN = true;
}
}
-
+
// Add end of string char
name[namePos] = '\0';
@@ -1497,7 +1497,7 @@ DIR_ENT FAT_DirEntFromPath (const char* path)
dirEntry = FAT_GetDirEntry (dirCluster, 1, SEEK_CUR);
}
}
-
+
if (found && ((dirEntry.attrib & ATTRIB_DIR) == ATTRIB_DIR) && (path[pathPos] != '\0'))
// It has found a directory from within the path that needs to be followed
{
@@ -1505,7 +1505,7 @@ DIR_ENT FAT_DirEntFromPath (const char* path)
dirCluster = dirEntry.startCluster | (dirEntry.startClusterHigh << 16);
}
}
-
+
if (notFound)
{
dirEntry.name[0] = FILE_FREE;
@@ -1534,11 +1534,11 @@ bool FAT_AddDirEntry (const char* path, DIR_ENT newDirEntry)
bool flagLFN, dotSeen;
char fileAlias[13] = {0};
int tailNum;
-
+
unsigned char chkSum = 0;
-
+
u32 oldWorkDirCluster;
-
+
DIR_ENT* dirEntries = (DIR_ENT*)globalBuffer;
u32 dirCluster;
int secOffset;
@@ -1566,7 +1566,7 @@ bool FAT_AddDirEntry (const char* path, DIR_ENT newDirEntry)
{
curWorkDirCluster = filesysRootDirClus;
}
-
+
pathPos = 0;
filePos = 0;
flagLFN = false;
@@ -1576,7 +1576,7 @@ bool FAT_AddDirEntry (const char* path, DIR_ENT newDirEntry)
if (path[pathPos + filePos] == '/')
{
filename[filePos] = '\0';
- if (FAT_chdir(filename) == false)
+ if (FAT_chdir(filename) == false)
{
curWorkDirCluster = oldWorkDirCluster;
return false; // Couldn't change directory
@@ -1587,17 +1587,17 @@ bool FAT_AddDirEntry (const char* path, DIR_ENT newDirEntry)
filename[filePos] = path[pathPos + filePos];
filePos++;
}
-
+
// Skip over last slashes
while (path[pathPos] == '/')
pathPos++;
-
+
// Check if the filename has a leading "."
// If so, it is an LFN
if (path[pathPos] == '.') {
flagLFN = true;
}
-
+
// Copy name from path
filePos = 0;
dotSeen = false;
@@ -1622,12 +1622,12 @@ bool FAT_AddDirEntry (const char* path, DIR_ENT newDirEntry)
flagLFN = true;
}
}
-
+
if (filePos == 0) // No filename
{
return false;
}
-
+
// Check if a long filename was specified
if (filePos > 12)
{
@@ -1638,7 +1638,7 @@ bool FAT_AddDirEntry (const char* path, DIR_ENT newDirEntry)
if (!flagLFN && (strrchr (filename, '.') != NULL) && (strlen(strrchr(filename, '.')) > 4)) {
flagLFN = true;
}
-
+
lfnPos = (filePos - 1) / 13;
// Add end of string char
@@ -1646,8 +1646,8 @@ bool FAT_AddDirEntry (const char* path, DIR_ENT newDirEntry)
// Clear remaining chars
while (filePos < MAX_FILENAME_LENGTH)
filename[filePos++] = 0x01; // Set for LFN compatibility
-
-
+
+
if (flagLFN)
{
// Generate short filename - always a 2 digit number for tail
@@ -1666,7 +1666,7 @@ bool FAT_AddDirEntry (const char* path, DIR_ENT newDirEntry)
// Pad Alias with underscores
while (aliasPos < 5)
fileAlias[aliasPos++] = '_';
-
+
fileAlias[5] = '~';
fileAlias[8] = '.';
fileAlias[9] = ' ';
@@ -1692,14 +1692,14 @@ bool FAT_AddDirEntry (const char* path, DIR_ENT newDirEntry)
} else {
aliasPos = 9;
}
-
+
// Pad Alias extension with spaces
while (aliasPos < 12)
fileAlias[aliasPos++] = ' ';
-
+
fileAlias[12] = '\0';
-
-
+
+
// Get a valid tail number
tailNum = 0;
do {
@@ -1707,7 +1707,7 @@ bool FAT_AddDirEntry (const char* path, DIR_ENT newDirEntry)
fileAlias[6] = 0x30 + ((tailNum / 10) % 10); // 10's digit
fileAlias[7] = 0x30 + (tailNum % 10); // 1's digit
} while ((FAT_DirEntFromPath(fileAlias).name[0] != FILE_FREE) && (tailNum < 100));
-
+
if (tailNum < 100) // Found an alias not being used
{
// Calculate file checksum
@@ -1725,7 +1725,7 @@ bool FAT_AddDirEntry (const char* path, DIR_ENT newDirEntry)
{
return false;
}
-
+
dirEntryLength = lfnPos + 2;
}
else // Its not a long file name
@@ -1743,7 +1743,7 @@ bool FAT_AddDirEntry (const char* path, DIR_ENT newDirEntry)
dirEntryLength = 1;
}
-
+
// Change dirEntry name to match alias
for (aliasPos = 0; ((fileAlias[aliasPos] != '.') && (fileAlias[aliasPos] != '\0') && (aliasPos < 8)); aliasPos++)
{
@@ -1775,12 +1775,12 @@ bool FAT_AddDirEntry (const char* path, DIR_ENT newDirEntry)
maxSectors = (dirCluster == FAT16_ROOT_DIR_CLUSTER ? (filesysData - filesysRootDir) : filesysSecPerClus);
firstSector = (dirCluster == FAT16_ROOT_DIR_CLUSTER ? filesysRootDir : FAT_ClustToSect(dirCluster));
disc_ReadSector (firstSector + secOffset, dirEntries);
-
+
dirEntryRemain = dirEntryLength;
tempDirCluster = dirCluster;
tempSecOffset = secOffset;
tempEntryOffset = entryOffset;
-
+
// Search for a large enough space to fit in new directory entry
while ((dirEntries[entryOffset].name[0] != FILE_LAST) && (dirEntryRemain > 0))
{
@@ -1803,7 +1803,7 @@ bool FAT_AddDirEntry (const char* path, DIR_ENT newDirEntry)
{
dirCluster = FAT_NextCluster(dirCluster);
}
- firstSector = FAT_ClustToSect(dirCluster);
+ firstSector = FAT_ClustToSect(dirCluster);
}
else if ((dirCluster == FAT16_ROOT_DIR_CLUSTER) && (secOffset == (filesysData - filesysRootDir)))
{
@@ -1824,7 +1824,7 @@ bool FAT_AddDirEntry (const char* path, DIR_ENT newDirEntry)
}
// Modifying the last directory is a special case - have to erase following entries
- if (dirEntries[entryOffset].name[0] == FILE_LAST)
+ if (dirEntries[entryOffset].name[0] == FILE_LAST)
{
dirEndFlag = true;
}
@@ -1843,7 +1843,7 @@ bool FAT_AddDirEntry (const char* path, DIR_ENT newDirEntry)
}
// Add new directory entry
- while (dirEntryRemain > 0)
+ while (dirEntryRemain > 0)
{
// Move to next entry, first pass advances from last used entry
entryOffset++;
@@ -1868,7 +1868,7 @@ bool FAT_AddDirEntry (const char* path, DIR_ENT newDirEntry)
{
dirCluster = FAT_NextCluster(dirCluster);
}
- firstSector = FAT_ClustToSect(dirCluster);
+ firstSector = FAT_ClustToSect(dirCluster);
}
else if ((dirCluster == FAT16_ROOT_DIR_CLUSTER) && (secOffset == (filesysData - filesysRootDir)))
{
@@ -1900,7 +1900,7 @@ bool FAT_AddDirEntry (const char* path, DIR_ENT newDirEntry)
lfnEntry.flag = ATTRIB_LFN;
lfnEntry.reserved1 = 0;
lfnEntry.reserved2 = 0;
-
+
*((DIR_ENT_LFN*)&dirEntries[entryOffset]) = lfnEntry;
lfnPos --;
lfnEntry.ordinal = 0;
@@ -1914,7 +1914,7 @@ bool FAT_AddDirEntry (const char* path, DIR_ENT newDirEntry)
dirEntryRemain--;
}
-
+
// Write directory back to disk
disc_WriteSector (firstSector + secOffset, dirEntries);
@@ -1930,7 +1930,7 @@ FAT_FindNextFile
Gets the name of the next directory entry
(can be a file or subdirectory)
char* filename: OUT filename, must be at least 13 chars long
-FILE_TYPE return: OUT returns FT_NONE if failed,
+FILE_TYPE return: OUT returns FT_NONE if failed,
FT_FILE if it found a file and FT_DIR if it found a directory
-----------------------------------------------------------------*/
FILE_TYPE FAT_FindNextFile(char* filename)
@@ -1963,7 +1963,7 @@ FAT_FindFirstFile
Gets the name of the first directory entry and resets the count
(can be a file or subdirectory)
char* filename: OUT filename, must be at least 13 chars long
-FILE_TYPE return: OUT returns FT_NONE if failed,
+FILE_TYPE return: OUT returns FT_NONE if failed,
FT_FILE if it found a file and FT_DIR if it found a directory
-----------------------------------------------------------------*/
FILE_TYPE FAT_FindFirstFile(char* filename)
@@ -1971,7 +1971,7 @@ FILE_TYPE FAT_FindFirstFile(char* filename)
// Get the first directory entry
DIR_ENT file;
file = FAT_GetDirEntry (curWorkDirCluster, 1, SEEK_SET);
-
+
if (file.name[0] == FILE_FREE)
{
return FT_NONE; // Did not find a file
@@ -1996,7 +1996,7 @@ FAT_FindFirstFileLFN
Gets the long file name of the first directory entry and resets
the count (can be a file or subdirectory)
char* lfn: OUT long file name, must be at least 256 chars long
-FILE_TYPE return: OUT returns FT_NONE if failed,
+FILE_TYPE return: OUT returns FT_NONE if failed,
FT_FILE if it found a file and FT_DIR if it found a directory
-----------------------------------------------------------------*/
FILE_TYPE FAT_FindFirstFileLFN(char* lfn)
@@ -2012,7 +2012,7 @@ FAT_FindNextFileLFN
Gets the long file name of the next directory entry
(can be a file or subdirectory)
char* lfn: OUT long file name, must be at least 256 chars long
-FILE_TYPE return: OUT returns FT_NONE if failed,
+FILE_TYPE return: OUT returns FT_NONE if failed,
FT_FILE if it found a file and FT_DIR if it found a directory
-----------------------------------------------------------------*/
FILE_TYPE FAT_FindNextFileLFN(char* lfn)
@@ -2026,29 +2026,29 @@ FILE_TYPE FAT_FindNextFileLFN(char* lfn)
/*-----------------------------------------------------------------
FAT_FileExists
-Returns the type of file
+Returns the type of file
char* filename: IN filename of the file to look for
-FILE_TYPE return: OUT returns FT_NONE if there is now file with
+FILE_TYPE return: OUT returns FT_NONE if there is now file with
that name, FT_FILE if it is a file and FT_DIR if it is a directory
-----------------------------------------------------------------*/
FILE_TYPE FAT_FileExists(const char* filename)
{
- DIR_ENT dirEntry;
- // Get the dirEntry for the path specified
- dirEntry = FAT_DirEntFromPath (filename);
-
- if (dirEntry.name[0] == FILE_FREE)
- {
- return FT_NONE;
- }
- else if (dirEntry.attrib & ATTRIB_DIR)
- {
- return FT_DIR;
- }
- else
- {
- return FT_FILE;
- }
+ DIR_ENT dirEntry;
+ // Get the dirEntry for the path specified
+ dirEntry = FAT_DirEntFromPath (filename);
+
+ if (dirEntry.name[0] == FILE_FREE)
+ {
+ return FT_NONE;
+ }
+ else if (dirEntry.attrib & ATTRIB_DIR)
+ {
+ return FT_DIR;
+ }
+ else
+ {
+ return FT_FILE;
+ }
}
/*-----------------------------------------------------------------
@@ -2074,7 +2074,7 @@ u32 FAT_GetFileSystemTotalSize (void)
/*-----------------------------------------------------------------
FAT_chdir
Changes the current working directory
-const char* path: IN null terminated string of directory separated by
+const char* path: IN null terminated string of directory separated by
forward slashes, / is root
bool return: OUT returns true if successful
-----------------------------------------------------------------*/
@@ -2090,7 +2090,7 @@ bool FAT_chdir (const char* path)
{
return true;
}
-
+
dir = FAT_DirEntFromPath (path);
if (((dir.attrib & ATTRIB_DIR) == ATTRIB_DIR) && (dir.name[0] != FILE_FREE))
@@ -2111,7 +2111,7 @@ bool FAT_chdir (const char* path)
return true;
}
else
- {
+ {
// Couldn't change directory - wrong path specified
return false;
}
@@ -2120,12 +2120,12 @@ bool FAT_chdir (const char* path)
/*-----------------------------------------------------------------
FAT_fopen(filename, mode)
Opens a file
-const char* path: IN null terminated string of filename and path
+const char* path: IN null terminated string of filename and path
separated by forward slashes, / is root
const char* mode: IN mode to open file in
Supported modes: "r", "r+", "w", "w+", "a", "a+", don't use
"b" or "t" in any mode, as all files are openned in binary mode
-FAT_FILE* return: OUT handle to open file, returns NULL if the file
+FAT_FILE* return: OUT handle to open file, returns NULL if the file
couldn't be openned
-----------------------------------------------------------------*/
FAT_FILE* FAT_fopen(const char* path, const char* mode)
@@ -2149,10 +2149,10 @@ FAT_FILE* FAT_fopen(const char* path, const char* mode)
{
return NULL;
}
-
+
// Get the dirEntry for the path specified
dirEntry = FAT_DirEntFromPath (path);
-
+
// Check that it is not a directory
if (dirEntry.attrib & ATTRIB_DIR)
{
@@ -2174,7 +2174,7 @@ FAT_FILE* FAT_fopen(const char* path, const char* mode)
// Find a free file buffer
for (fileNum = 0; (fileNum < MAX_FILES_OPEN) && (openFiles[fileNum].inUse == true); fileNum++);
-
+
if (fileNum == MAX_FILES_OPEN) // No free files
{
return NULL;
@@ -2191,7 +2191,7 @@ FAT_FILE* FAT_fopen(const char* path, const char* mode)
{
return NULL;
}
-
+
file->read = true;
#ifdef CAN_WRITE_TO_DISC
file->write = ( strchr(mode, '+') != NULL ); //(mode[1] == '+');
@@ -2199,13 +2199,13 @@ FAT_FILE* FAT_fopen(const char* path, const char* mode)
file->write = false;
#endif
file->append = false;
-
+
// Store information about position within the file, for use
// by FAT_fread, FAT_fseek, etc.
file->firstCluster = dirEntry.startCluster | (dirEntry.startClusterHigh << 16);
-
+
#ifdef CAN_WRITE_TO_DISC
- // Check if file is openned for random. If it is, and currently has no cluster, one must be
+ // Check if file is openned for random. If it is, and currently has no cluster, one must be
// assigned to it.
if (file->write && file->firstCluster == CLUSTER_FREE)
{
@@ -2223,7 +2223,7 @@ FAT_FILE* FAT_fopen(const char* path, const char* mode)
disc_WriteSector (file->dirEntSector, globalBuffer);
}
#endif
-
+
file->length = dirEntry.fileSize;
file->curPos = 0;
file->curClus = dirEntry.startCluster | (dirEntry.startClusterHigh << 16);
@@ -2234,7 +2234,7 @@ FAT_FILE* FAT_fopen(const char* path, const char* mode)
file->appByte = 0;
file->appClus = 0;
file->appSect = 0;
-
+
disc_ReadSector( FAT_ClustToSect( file->curClus), file->readBuffer);
file->inUse = true; // We're using this file now
@@ -2248,7 +2248,7 @@ FAT_FILE* FAT_fopen(const char* path, const char* mode)
{
dirEntry.attrib = ATTRIB_ARCH;
dirEntry.reserved = 0;
-
+
// Time and date set to system time and date
dirEntry.cTime_ms = 0;
dirEntry.cTime = getRTCtoFileTime();
@@ -2257,12 +2257,12 @@ FAT_FILE* FAT_fopen(const char* path, const char* mode)
dirEntry.mTime = getRTCtoFileTime();
dirEntry.mDate = getRTCtoFileDate();
}
- else // Already a file entry
+ else // Already a file entry
{
// Free any clusters used
FAT_ClearLinks (dirEntry.startCluster | (dirEntry.startClusterHigh << 16));
}
-
+
// Get a cluster to use
startCluster = FAT_LinkFreeCluster (CLUSTER_FREE);
if (startCluster == CLUSTER_FREE) // Couldn't get a free cluster
@@ -2298,13 +2298,13 @@ FAT_FILE* FAT_fopen(const char* path, const char* mode)
((DIR_ENT*) globalBuffer)[file->dirEntOffset] = dirEntry;
disc_WriteSector (file->dirEntSector, globalBuffer);
}
-
+
// Now that file is created, open it
file->read = ( strchr(mode, '+') != NULL ); //(mode[1] == '+');
file->write = true;
file->append = false;
-
+
// Store information about position within the file, for use
// by FAT_fread, FAT_fseek, etc.
file->firstCluster = startCluster;
@@ -2318,7 +2318,7 @@ FAT_FILE* FAT_fopen(const char* path, const char* mode)
file->appByte = 0;
file->appClus = 0;
file->appSect = 0;
-
+
// Empty file, so empty read buffer
memset (file->readBuffer, 0, BYTE_PER_READ);
file->inUse = true; // We're using this file now
@@ -2332,7 +2332,7 @@ FAT_FILE* FAT_fopen(const char* path, const char* mode)
{
dirEntry.attrib = ATTRIB_ARCH;
dirEntry.reserved = 0;
-
+
// Time and date set to system time and date
dirEntry.cTime_ms = 0;
dirEntry.cTime = getRTCtoFileTime();
@@ -2352,13 +2352,13 @@ FAT_FILE* FAT_fopen(const char* path, const char* mode)
}
dirEntry.startCluster = (startCluster & 0xFFFF);
dirEntry.startClusterHigh = ((startCluster >> 16) & 0xFFFF);
-
+
if(!FAT_AddDirEntry (path, dirEntry))
return NULL;
-
+
// Get the newly created dirEntry
dirEntry = FAT_DirEntFromPath (path);
-
+
// Store append cluster
file->appClus = startCluster;
@@ -2377,7 +2377,7 @@ FAT_FILE* FAT_fopen(const char* path, const char* mode)
{
return NULL;
}
-
+
// Store cluster position into the directory entry
dirEntry.startCluster = (file->firstCluster & 0xFFFF);
dirEntry.startClusterHigh = ((file->firstCluster >> 16) & 0xFFFF);
@@ -2387,7 +2387,7 @@ FAT_FILE* FAT_fopen(const char* path, const char* mode)
// Store append cluster
file->appClus = startCluster;
-
+
} else {
// Follow cluster list until last one is found
@@ -2410,7 +2410,7 @@ FAT_FILE* FAT_fopen(const char* path, const char* mode)
file->read = ( strchr(mode, '+') != NULL );
file->write = false;
file->append = true;
-
+
// Calculate the sector and byte of the current position,
// and store them
file->appSect = (dirEntry.fileSize % filesysBytePerClus) / BYTE_PER_READ;
@@ -2424,7 +2424,7 @@ FAT_FILE* FAT_fopen(const char* path, const char* mode)
file->curClus = file->appClus;
file->curSect = file->appSect;
file->curByte = file->appByte;
-
+
// Read into buffer
disc_ReadSector( FAT_ClustToSect(file->curClus) + file->curSect, file->readBuffer);
file->inUse = true; // We're using this file now
@@ -2464,7 +2464,7 @@ bool FAT_fclose (FAT_FILE* file)
disc_CacheFlush();
}
#endif
- file->inUse = false;
+ file->inUse = false;
return true;
}
else
@@ -2515,14 +2515,14 @@ int FAT_fseek(FAT_FILE* file, s32 offset, int origin)
}
// Can't seek in append only mode
- if (!file->read && !file->write)
+ if (!file->read && !file->write)
{
return -1;
}
curPos = file->curPos;
- switch (origin)
+ switch (origin)
{
case SEEK_SET:
if (offset >= 0)
@@ -2537,13 +2537,13 @@ int FAT_fseek(FAT_FILE* file, s32 offset, int origin)
if (offset >= 0)
{
position = curPos + offset;
- }
+ }
else if ( (u32)(offset * -1) >= curPos )
{
// Tried to seek before start of file
position = 0;
}
- else
+ else
{
// Using u32 to maintain 32 bits of accuracy
position = curPos - (u32)(offset * -1);
@@ -2560,7 +2560,7 @@ int FAT_fseek(FAT_FILE* file, s32 offset, int origin)
// Tried to seek before start of file
position = 0;
}
- else
+ else
{
// Using u32 to maintain 32 bits of accuracy
position = file->length - (u32)(offset * -1);
@@ -2575,7 +2575,7 @@ int FAT_fseek(FAT_FILE* file, s32 offset, int origin)
// Tried to go past end of file
position = file->length;
}
-
+
// Save position
file->curPos = position;
@@ -2608,14 +2608,14 @@ int FAT_fseek(FAT_FILE* file, s32 offset, int origin)
nextCluster = FAT_NextCluster (cluster);
}
// Check if ran out of clusters, and the file is being written to
- if ((clusCount >= 0) && (file->write || file->append))
+ if ((clusCount >= 0) && (file->write || file->append))
{
// Set flag to allocate a new cluster
file->curSect = filesysSecPerClus;
file->curByte = 0;
}
file->curClus = cluster;
-
+
// Reload sector buffer for new position in file, if it is a different sector
if ((curPos ^ position) >= BYTE_PER_READ)
{
@@ -2645,7 +2645,7 @@ u32 FAT_fread (void* buffer, u32 size, u32 count, FAT_FILE* file)
int curSect;
u32 curClus;
u32 tempNextCluster;
-
+
int tempVar;
char* data = (char*)buffer;
@@ -2678,14 +2678,14 @@ u32 FAT_fread (void* buffer, u32 size, u32 count, FAT_FILE* file)
if (tempVar > remain)
tempVar = remain;
- if ((tempVar < BYTE_PER_READ) && flagNoError)
+ if ((tempVar < BYTE_PER_READ) && flagNoError)
{
memcpy(data, &(file->readBuffer[curByte]), tempVar);
remain -= tempVar;
data += tempVar;
curByte += tempVar;
- if (curByte >= BYTE_PER_READ)
+ if (curByte >= BYTE_PER_READ)
{
curByte = 0;
curSect++;
@@ -2694,7 +2694,7 @@ u32 FAT_fread (void* buffer, u32 size, u32 count, FAT_FILE* file)
// align to cluster
// tempVar is number of sectors to read
- if (remain > (filesysSecPerClus - curSect) * BYTE_PER_READ)
+ if (remain > (filesysSecPerClus - curSect) * BYTE_PER_READ)
{
tempVar = filesysSecPerClus - curSect;
} else {
@@ -2789,7 +2789,7 @@ u32 FAT_fread (void* buffer, u32 size, u32 count, FAT_FILE* file)
FAT_fwrite(buffer, size, count, file)
Writes size * count bytes into file from buffer, starting
from current position. It then sets the current position to the
- byte after the last byte written. If the file was openned in
+ byte after the last byte written. If the file was openned in
append mode it always writes to the end of the file.
const void* buffer IN: Pointer to buffer containing data. Should be
at least as big as the number of bytes to be written.
@@ -2870,7 +2870,7 @@ u32 FAT_fwrite (const void* buffer, u32 size, u32 count, FAT_FILE* file)
disc_ReadSector( FAT_ClustToSect( curClus), writeBuffer);
}
}
-
+
// Align to sector
tempVar = BYTE_PER_READ - curByte;
if (tempVar > remain)
@@ -2885,9 +2885,9 @@ u32 FAT_fwrite (const void* buffer, u32 size, u32 count, FAT_FILE* file)
// Write buffer back to disk
disc_WriteSector (curSect + FAT_ClustToSect(curClus), writeBuffer);
-
+
// Move onto next sector
- if (curByte >= BYTE_PER_READ)
+ if (curByte >= BYTE_PER_READ)
{
curByte = 0;
curSect++;
@@ -2896,7 +2896,7 @@ u32 FAT_fwrite (const void* buffer, u32 size, u32 count, FAT_FILE* file)
// Align to cluster
// tempVar is number of sectors to write
- if (remain > (filesysSecPerClus - curSect) * BYTE_PER_READ)
+ if (remain > (filesysSecPerClus - curSect) * BYTE_PER_READ)
{
tempVar = filesysSecPerClus - curSect;
} else {
@@ -2964,7 +2964,7 @@ u32 FAT_fwrite (const void* buffer, u32 size, u32 count, FAT_FILE* file)
remain -= tempVar * BYTE_PER_READ;
curSect += tempVar;
}
-
+
// Last remaining sector
// Check if sector wanted is different to the one started with
if ( (( (file->append ? file->appByte : file->curByte) + length) >= BYTE_PER_READ) && flagNoError)
@@ -2984,7 +2984,7 @@ u32 FAT_fwrite (const void* buffer, u32 size, u32 count, FAT_FILE* file)
disc_WriteSector( curSect + FAT_ClustToSect( curClus), writeBuffer);
}
}
-
+
// Amount read is the originally requested amount minus stuff remaining
length = length - remain;
@@ -3041,14 +3041,14 @@ int FAT_remove (const char* path)
u32 oldWorkDirCluster;
char checkFilename[13];
FILE_TYPE checkFiletype;
-
+
dirEntry = FAT_DirEntFromPath (path);
if (dirEntry.name[0] == FILE_FREE)
{
return -1;
}
-
+
// Only delete directories if the directory is entry
if (dirEntry.attrib & ATTRIB_DIR)
{
@@ -3062,10 +3062,10 @@ int FAT_remove (const char* path)
{
checkFiletype = FAT_FindNextFile (checkFilename);
}
-
+
// Change back to working directory
curWorkDirCluster = oldWorkDirCluster;
-
+
// Check that the directory is empty
if (checkFiletype != FT_NONE)
{
@@ -3084,7 +3084,7 @@ int FAT_remove (const char* path)
disc_ReadSector ( (wrkDirCluster == FAT16_ROOT_DIR_CLUSTER ? filesysRootDir : FAT_ClustToSect(wrkDirCluster)) + wrkDirSector , globalBuffer);
((DIR_ENT*)globalBuffer)[wrkDirOffset].name[0] = FILE_FREE;
disc_WriteSector ( (wrkDirCluster == FAT16_ROOT_DIR_CLUSTER ? filesysRootDir : FAT_ClustToSect(wrkDirCluster)) + wrkDirSector , globalBuffer);
-
+
// Flush any sectors in disc cache
disc_CacheFlush();
@@ -3095,7 +3095,7 @@ int FAT_remove (const char* path)
#ifdef CAN_WRITE_TO_DISC
/*-----------------------------------------------------------------
FAT_mkdir (path)
-Makes a new directory, so long as no other directory or file has
+Makes a new directory, so long as no other directory or file has
the same name.
const char* path IN: Path and filename of directory to make
int return OUT: zero if successful, non-zero if not
@@ -3123,7 +3123,7 @@ int FAT_mkdir (const char* path)
{
curWorkDirCluster = filesysRootDirClus;
}
-
+
pathPos = 0;
filePos = 0;
@@ -3132,7 +3132,7 @@ int FAT_mkdir (const char* path)
if (path[pathPos + filePos] == '/')
{
pathname[filePos] = '\0';
- if (FAT_chdir(pathname) == false)
+ if (FAT_chdir(pathname) == false)
{
curWorkDirCluster = oldDirCluster;
return -1; // Couldn't change directory
@@ -3236,9 +3236,9 @@ FAT_fgets (char *tgtBuffer, int num, FAT_FILE* file)
Gets a up to num bytes from file, stopping at the first
newline.
-CAUTION: does not do strictly streaming. I.e. it's
+CAUTION: does not do strictly streaming. I.e. it's
reading more then needed bytes and seeking back.
- shouldn't matter for random access
+ shouldn't matter for random access
char *tgtBuffer OUT: buffer to write to
int num IN: size of target buffer
@@ -3250,62 +3250,62 @@ bool return OUT: character if successful, EOF if not
* Added check for unix style text files
* Removed seek when no newline is found, since it isn't necessary
-------------------------------------------------------------------*/
-char *FAT_fgets(char *tgtBuffer, int num, FAT_FILE* file)
-{
+char *FAT_fgets(char *tgtBuffer, int num, FAT_FILE* file)
+{
u32 curPos;
u32 readLength;
char *returnChar;
-
- // invalid filehandle
+
+ // invalid filehandle
if (file == NULL)
{
- return NULL ;
+ return NULL ;
}
-
- // end of file
+
+ // end of file
if (FAT_feof(file)==true)
{
- return NULL ;
- }
-
- // save current position
- curPos = FAT_ftell(file);
-
- // read the full buffer (max string chars is num-1 and one end of string \0
- readLength = FAT_fread(tgtBuffer,1,num-1,file) ;
-
- // mark least possible end of string
- tgtBuffer[readLength] = '\0' ;
-
- if (readLength==0) {
- // return error
- return NULL ;
- }
-
- // get position of first return '\r'
- returnChar = strchr(tgtBuffer,'\r');
-
+ return NULL ;
+ }
+
+ // save current position
+ curPos = FAT_ftell(file);
+
+ // read the full buffer (max string chars is num-1 and one end of string \0
+ readLength = FAT_fread(tgtBuffer,1,num-1,file) ;
+
+ // mark least possible end of string
+ tgtBuffer[readLength] = '\0' ;
+
+ if (readLength==0) {
+ // return error
+ return NULL ;
+ }
+
+ // get position of first return '\r'
+ returnChar = strchr(tgtBuffer,'\r');
+
// if no return is found, search for a newline
if (returnChar == NULL)
{
returnChar = strchr(tgtBuffer,'\n');
}
-
- // Mark the return, if existant, as end of line/string
- if (returnChar!=NULL) {
- *returnChar++ = 0 ;
- if (*returnChar=='\n') { // catch newline too when jumping over the end
- // return to location after \r\n (strlen+2)
- FAT_fseek(file,curPos+strlen(tgtBuffer)+2,SEEK_SET) ;
- return tgtBuffer ;
- } else {
- // return to location after \r (strlen+1)
- FAT_fseek(file,curPos+strlen(tgtBuffer)+1,SEEK_SET) ;
- return tgtBuffer ;
+
+ // Mark the return, if existant, as end of line/string
+ if (returnChar!=NULL) {
+ *returnChar++ = 0 ;
+ if (*returnChar=='\n') { // catch newline too when jumping over the end
+ // return to location after \r\n (strlen+2)
+ FAT_fseek(file,curPos+strlen(tgtBuffer)+2,SEEK_SET) ;
+ return tgtBuffer ;
+ } else {
+ // return to location after \r (strlen+1)
+ FAT_fseek(file,curPos+strlen(tgtBuffer)+1,SEEK_SET) ;
+ return tgtBuffer ;
}
}
-
- return tgtBuffer ;
+
+ return tgtBuffer ;
}
#ifdef CAN_WRITE_TO_DISC
@@ -3322,20 +3322,20 @@ bool return OUT: number of characters written if successful,
* Uses FAT_FILE instead of int
* writtenBytes is now u32 instead of int
-------------------------------------------------------------------*/
-int FAT_fputs (const char *string, FAT_FILE* file)
-{
+int FAT_fputs (const char *string, FAT_FILE* file)
+{
u32 writtenBytes;
- // save string except end of string '\0'
- writtenBytes = FAT_fwrite((void *)string, 1, strlen(string), file);
+ // save string except end of string '\0'
+ writtenBytes = FAT_fwrite((void *)string, 1, strlen(string), file);
- // check if we had an error
- if (writtenBytes != strlen(string))
- {
- // return EOF error
+ // check if we had an error
+ if (writtenBytes != strlen(string))
+ {
+ // return EOF error
return EOF;
}
- // return the charcount written
- return writtenBytes ;
+ // return the charcount written
+ return writtenBytes ;
}
#endif
diff --git a/backends/platform/ds/arm9/source/fat/gba_nds_fat.h b/backends/platform/ds/arm9/source/fat/gba_nds_fat.h
index 539f94fef7..f9746560e0 100644
--- a/backends/platform/ds/arm9/source/fat/gba_nds_fat.h
+++ b/backends/platform/ds/arm9/source/fat/gba_nds_fat.h
@@ -147,7 +147,7 @@ bool FAT_GetAlias (char* alias);
/*-----------------------------------------------------------------
FAT_GetLongFilename
-Get the long name of the last file or directory retrived with
+Get the long name of the last file or directory retrived with
GetDirEntry. Also works for FindFirstFile and FindNextFile
char* filename: OUT will be filled with the filename, should be at
least 256 bytes long
@@ -210,7 +210,7 @@ FAT_FindNextFile
Gets the name of the next directory entry
(can be a file or subdirectory)
char* filename: OUT filename, must be at least 13 chars long
-FILE_TYPE return: OUT returns FT_NONE if failed,
+FILE_TYPE return: OUT returns FT_NONE if failed,
FT_FILE if it found a file and FT_DIR if it found a directory
-----------------------------------------------------------------*/
FILE_TYPE FAT_FindNextFile (char* filename);
@@ -220,7 +220,7 @@ FAT_FindFirstFile
Gets the name of the first directory entry and resets the count
(can be a file or subdirectory)
char* filename: OUT filename, must be at least 13 chars long
-FILE_TYPE return: OUT returns FT_NONE if failed,
+FILE_TYPE return: OUT returns FT_NONE if failed,
FT_FILE if it found a file and FT_DIR if it found a directory
-----------------------------------------------------------------*/
FILE_TYPE FAT_FindFirstFile (char* filename);
@@ -230,7 +230,7 @@ FAT_FindFirstFileLFN
Gets the long file name of the first directory entry and resets
the count (can be a file or subdirectory)
char* lfn: OUT long file name, must be at least 256 chars long
-FILE_TYPE return: OUT returns FT_NONE if failed,
+FILE_TYPE return: OUT returns FT_NONE if failed,
FT_FILE if it found a file and FT_DIR if it found a directory
-----------------------------------------------------------------*/
FILE_TYPE FAT_FindFirstFileLFN(char* lfn);
@@ -240,16 +240,16 @@ FAT_FindNextFileLFN
Gets the long file name of the next directory entry
(can be a file or subdirectory)
char* lfn: OUT long file name, must be at least 256 chars long
-FILE_TYPE return: OUT returns FT_NONE if failed,
+FILE_TYPE return: OUT returns FT_NONE if failed,
FT_FILE if it found a file and FT_DIR if it found a directory
-----------------------------------------------------------------*/
FILE_TYPE FAT_FindNextFileLFN(char* lfn);
/*-----------------------------------------------------------------
FAT_FileExists
-Returns the type of file
+Returns the type of file
char* filename: IN filename of the file to look for
-FILE_TYPE return: OUT returns FT_NONE if there is now file with
+FILE_TYPE return: OUT returns FT_NONE if there is now file with
that name, FT_FILE if it is a file and FT_DIR if it is a directory
-----------------------------------------------------------------*/
FILE_TYPE FAT_FileExists (const char* filename);
@@ -269,7 +269,7 @@ u32 FAT_GetFileSystemTotalSize (void);
/*-----------------------------------------------------------------
FAT_chdir
Changes the current working directory
-const char* path: IN null terminated string of directory separated by
+const char* path: IN null terminated string of directory separated by
forward slashes, / is root
bool return: OUT returns true if successful
-----------------------------------------------------------------*/
@@ -282,12 +282,12 @@ bool FAT_chdir (const char* path);
/*-----------------------------------------------------------------
FAT_fopen(filename, mode)
Opens a file
-const char* path: IN null terminated string of filename and path
+const char* path: IN null terminated string of filename and path
separated by forward slashes, / is root
const char* mode: IN mode to open file in
Supported modes: "r", "r+", "w", "w+", "a", "a+", don't use
"b" or "t" in any mode, as all files are openned in binary mode
-FAT_FILE* return: OUT handle to open file, returns -1 if the file
+FAT_FILE* return: OUT handle to open file, returns -1 if the file
couldn't be openned
-----------------------------------------------------------------*/
FAT_FILE* FAT_fopen(const char* path, const char* mode);
@@ -338,7 +338,7 @@ u32 FAT_fread (void* buffer, u32 size, u32 count, FAT_FILE* file);
FAT_fwrite(buffer, size, count, file)
Writes size * count bytes into file from buffer, starting
from current position. It then sets the current position to the
- byte after the last byte written. If the file was openned in
+ byte after the last byte written. If the file was openned in
append mode it always writes to the end of the file.
const void* buffer IN: Pointer to buffer containing data. Should be
at least as big as the number of bytes to be written.
@@ -371,7 +371,7 @@ int FAT_remove (const char* path);
#ifdef CAN_WRITE_TO_DISC
/*-----------------------------------------------------------------
FAT_mkdir (path)
-Makes a new directory, so long as no other directory or file has
+Makes a new directory, so long as no other directory or file has
the same name.
const char* path IN: Path and filename of directory to make
int return OUT: zero if successful, non-zero if not
@@ -403,9 +403,9 @@ FAT_fgets (char *tgtBuffer, int num, FAT_FILE* file)
Gets a up to num bytes from file, stopping at the first
newline.
-CAUTION: does not do strictly streaming. I.e. it's
+CAUTION: does not do strictly streaming. I.e. it's
reading more then needed bytes and seeking back.
- shouldn't matter for random access
+ shouldn't matter for random access
char *tgtBuffer OUT: buffer to write to
int num IN: size of target buffer
diff --git a/backends/platform/ds/arm9/source/fat/io_dldi.h b/backends/platform/ds/arm9/source/fat/io_dldi.h
index 053de3a94c..034c6aace3 100644
--- a/backends/platform/ds/arm9/source/fat/io_dldi.h
+++ b/backends/platform/ds/arm9/source/fat/io_dldi.h
@@ -1,8 +1,8 @@
/*
- io_dldi.h
+ io_dldi.h
Reserved space for new drivers
-
+
This software is completely free. No warranty is provided.
If you use it, please give me credit and email me about your
project at chishm@hotmail.com
diff --git a/backends/platform/ds/arm9/source/fat/io_fcsr.h b/backends/platform/ds/arm9/source/fat/io_fcsr.h
index 2f87c1c8aa..ef390a8ad6 100644
--- a/backends/platform/ds/arm9/source/fat/io_fcsr.h
+++ b/backends/platform/ds/arm9/source/fat/io_fcsr.h
@@ -1,5 +1,5 @@
/*
- io_fcsr.h
+ io_fcsr.h
Hardware Routines for using a GBA Flash Cart with SRAM
@@ -23,7 +23,7 @@ extern LPIO_INTERFACE FCSR_GetInterface(void) ;
#endif // define IO_FCSR_H
/*
- io_fcsr.h
+ io_fcsr.h
Hardware Routines for using a GBA Flash Cart with SRAM
diff --git a/backends/platform/ds/arm9/source/fat/io_m3_common.h b/backends/platform/ds/arm9/source/fat/io_m3_common.h
index 92e6bed980..6d0c669783 100644
--- a/backends/platform/ds/arm9/source/fat/io_m3_common.h
+++ b/backends/platform/ds/arm9/source/fat/io_m3_common.h
@@ -1,5 +1,5 @@
/*
- io_m3_common.h
+ io_m3_common.h
Routines common to all version of the M3
@@ -7,7 +7,7 @@
Some code written by SaTa may have been unknowingly used.
Copyright (c) 2006 Michael "Chishm" Chisholm
-
+
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -40,7 +40,7 @@
// Values for changing mode
#define M3_MODE_ROM 0x00400004
-#define M3_MODE_MEDIA 0x00400003
+#define M3_MODE_MEDIA 0x00400003
extern void _M3_changeMode (u32 mode);
diff --git a/backends/platform/ds/arm9/source/fat/io_m3cf.h b/backends/platform/ds/arm9/source/fat/io_m3cf.h
index bade53f511..006c283adc 100644
--- a/backends/platform/ds/arm9/source/fat/io_m3cf.h
+++ b/backends/platform/ds/arm9/source/fat/io_m3cf.h
@@ -1,5 +1,5 @@
/*
- io_m3cf.h
+ io_m3cf.h
Hardware Routines for reading a compact flash card
using the M3 CF
@@ -24,7 +24,7 @@ extern LPIO_INTERFACE M3CF_GetInterface(void) ;
#endif // define IO_M3CF_H
/*
- io_m3cf.h
+ io_m3cf.h
Hardware Routines for reading a compact flash card
using the M3 CF
diff --git a/backends/platform/ds/arm9/source/fat/io_mmcf.h b/backends/platform/ds/arm9/source/fat/io_mmcf.h
index baa43ac59f..fa9e6536ee 100644
--- a/backends/platform/ds/arm9/source/fat/io_mmcf.h
+++ b/backends/platform/ds/arm9/source/fat/io_mmcf.h
@@ -1,5 +1,5 @@
/*
- io_mmcf.h
+ io_mmcf.h
Hardware Routines for reading a compact flash card
using the GBA Movie Player
diff --git a/backends/platform/ds/arm9/source/fat/io_mpcf.h b/backends/platform/ds/arm9/source/fat/io_mpcf.h
index 58cab41b4c..8ec8859097 100644
--- a/backends/platform/ds/arm9/source/fat/io_mpcf.h
+++ b/backends/platform/ds/arm9/source/fat/io_mpcf.h
@@ -1,5 +1,5 @@
/*
- io_mpcf.h
+ io_mpcf.h
Hardware Routines for reading a compact flash card
using the GBA Movie Player
@@ -24,7 +24,7 @@ extern LPIO_INTERFACE MPCF_GetInterface(void) ;
#endif // define IO_MPCF_H
/*
- io_mpcf.h
+ io_mpcf.h
Hardware Routines for reading a compact flash card
using the GBA Movie Player
diff --git a/backends/platform/ds/arm9/source/fat/io_njsd.h b/backends/platform/ds/arm9/source/fat/io_njsd.h
index a297cda112..dce469cad6 100644
--- a/backends/platform/ds/arm9/source/fat/io_njsd.h
+++ b/backends/platform/ds/arm9/source/fat/io_njsd.h
@@ -1,11 +1,11 @@
/*
- io_njsd.h
+ io_njsd.h
Hardware Routines for reading an SD card using
a NinjaDS SD adapter.
Copyright (c) 2006 Michael "Chishm" Chisholm
-
+
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
diff --git a/backends/platform/ds/arm9/source/fat/io_nmmc.h b/backends/platform/ds/arm9/source/fat/io_nmmc.h
index 5244d21868..0249e3a864 100644
--- a/backends/platform/ds/arm9/source/fat/io_nmmc.h
+++ b/backends/platform/ds/arm9/source/fat/io_nmmc.h
@@ -1,5 +1,5 @@
/*
- io_NMMC.h
+ io_NMMC.h
Hardware Routines for reading an SD or MMC card using
a Neoflash MK2 or MK3.
@@ -26,7 +26,7 @@ extern LPIO_INTERFACE NMMC_GetInterface(void) ;
#endif // define IO_NMMC_H
/*
- io_NMMC.h
+ io_NMMC.h
Hardware Routines for reading an SD or MMC card using
a Neoflash MK2 or MK3.
diff --git a/backends/platform/ds/arm9/source/fat/io_sccf.h b/backends/platform/ds/arm9/source/fat/io_sccf.h
index 961909fbce..2270c4eab1 100644
--- a/backends/platform/ds/arm9/source/fat/io_sccf.h
+++ b/backends/platform/ds/arm9/source/fat/io_sccf.h
@@ -1,5 +1,5 @@
/*
- io_sccf.h
+ io_sccf.h
Hardware Routines for reading a compact flash card
using the Supercard CF
@@ -24,7 +24,7 @@ extern LPIO_INTERFACE SCCF_GetInterface(void) ;
#endif // define IO_SCCF_H
/*
- io_sccf.h
+ io_sccf.h
Hardware Routines for reading a compact flash card
using the Supercard CF
diff --git a/backends/platform/ds/arm9/source/fat/io_scsd.h b/backends/platform/ds/arm9/source/fat/io_scsd.h
index 75115b8d62..492492f619 100644
--- a/backends/platform/ds/arm9/source/fat/io_scsd.h
+++ b/backends/platform/ds/arm9/source/fat/io_scsd.h
@@ -1,12 +1,12 @@
/*
io_scsd.h by SaTa.
based on io_sccf.h
-
-
+
+
*/
/*
- io_sccf.h
+ io_sccf.h
Hardware Routines for reading a compact flash card
using the GBA Movie Player
@@ -26,4 +26,4 @@
// export interface
extern LPIO_INTERFACE SCSD_GetInterface(void) ;
-#endif // define IO_SCSD_H \ No newline at end of file
+#endif // define IO_SCSD_H
diff --git a/backends/platform/ds/arm9/source/fat/io_sd_common.h b/backends/platform/ds/arm9/source/fat/io_sd_common.h
index 09abffab39..8962d88890 100644
--- a/backends/platform/ds/arm9/source/fat/io_sd_common.h
+++ b/backends/platform/ds/arm9/source/fat/io_sd_common.h
@@ -8,7 +8,7 @@
SD routines partially based on sd.s by Romman
Copyright (c) 2006 Michael "Chishm" Chisholm
-
+
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -32,7 +32,7 @@
2006-07-11 - Chishm
* Original release
-
+
2006-07-28 - Chishm
* Changed voltage range that the SD card can use
*/
@@ -76,7 +76,7 @@
#define SD_STATE_IDENT 2 // Identification state, after ALL_SEND_CID
#define SD_STATE_STBY 3 // Standby state, when card is deselected
#define SD_STATE_TRAN 4 // Transfer state, after card is selected and ready for data transfer
-#define SD_STATE_DATA 5 //
+#define SD_STATE_DATA 5 //
#define SD_STATE_RCV 6 // Receive data state
#define SD_STATE_PRG 7 // Programming state
#define SD_STATE_DIS 8 // Disconnect state
@@ -85,7 +85,7 @@
#define READY_FOR_DATA 1 // bit 8 in card status
/*
-Calculate the CRC7 of a command and return it preshifted with
+Calculate the CRC7 of a command and return it preshifted with
an end bit added
*/
extern u8 _SD_CRC7(u8* data, int size);
@@ -106,7 +106,7 @@ cmd_17byte_response: a pointer to a function that sends the SD card a command an
use4bitBus: initialise card to use a 4 bit data bus when communicating with the card
RCA: a pointer to the location to store the card's Relative Card Address, preshifted up by 16 bits.
*/
-extern bool _SD_InitCard (_SD_FN_CMD_6BYTE_RESPONSE cmd_6byte_response,
+extern bool _SD_InitCard (_SD_FN_CMD_6BYTE_RESPONSE cmd_6byte_response,
_SD_FN_CMD_17BYTE_RESPONSE cmd_17byte_response,
bool use4bitBus,
u32 *RCA);
diff --git a/backends/platform/ds/arm9/source/gbampsave.cpp b/backends/platform/ds/arm9/source/gbampsave.cpp
index a53ab9739d..8814fc4957 100644
--- a/backends/platform/ds/arm9/source/gbampsave.cpp
+++ b/backends/platform/ds/arm9/source/gbampsave.cpp
@@ -93,40 +93,40 @@ uint32 GBAMPSaveFile::write(const void *buf, uint32 size) {
memcpy(buffer + bufferPos, buf, size);
bufferPos += size;
-
+
saveSize += size;
/* int pos = 0;
-
+
int rest = SAVE_BUFFER_SIZE - bufferPos;
memcpy(buffer + bufferPos, buf, rest);
bufferPos = 512;
pos += rest;
- flushSaveBuffer();
+ flushSaveBuffer();
size -= rest;
// consolePrintf("First section: %d\n", rest);
-
+
while (size >= 512) {
DS::std_fwrite(((char *) (buf)) + pos, 1, 512, handle);
size -= 512;
pos += 512;
// consolePrintf("Full chunk, %d left ", size);
}
-
+
bufferPos = 0;
memcpy(buffer + bufferPos, ((char *) (buf)) + pos, size);
bufferPos += size;
// consolePrintf("%d left in buffer ", bufferPos);*/
-
+
} else {
-
+
memcpy(buffer + bufferPos, buf, size);
bufferPos += size;
-
+
saveSize += size;
}
-
+
// if ((size > 100) || (size <= 0)) consolePrintf("Write %d bytes\n", size);
return size;
}
@@ -146,24 +146,24 @@ GBAMPSaveFileManager::~GBAMPSaveFileManager() {
GBAMPSaveFile* GBAMPSaveFileManager::openSavefile(char const* name, bool saveOrLoad) {
char fileSpec[128];
-
+
strcpy(fileSpec, getSavePath());
-
+
if (fileSpec[strlen(fileSpec) - 1] == '/') {
sprintf(fileSpec, "%s%s", getSavePath(), name);
} else {
sprintf(fileSpec, "%s/%s", getSavePath(), name);
}
-
+
// consolePrintf("Opening the file: %s\n", fileSpec);
GBAMPSaveFile* sf = new GBAMPSaveFile(fileSpec, saveOrLoad);
if (sf->isOpen()) {
// consolePrintf("Ok");
- return sf;
+ return sf;
} else {
// consolePrintf("Fail");
delete sf;
- return NULL;
+ return NULL;
}
}
@@ -189,11 +189,11 @@ const char *GBAMPSaveFileManager::getSavePath() const {
return dir;
}
-Common::StringList GBAMPSaveFileManager::listSavefiles(const char *pattern) {
+Common::StringList GBAMPSaveFileManager::listSavefiles(const char *pattern) {
enum { TYPE_NO_MORE = 0, TYPE_FILE = 1, TYPE_DIR = 2 };
char name[256];
-
+
{
char dir[128];
strcpy(dir, getSavePath());
@@ -218,13 +218,13 @@ Common::StringList GBAMPSaveFileManager::listSavefiles(const char *pattern) {
// consolePrintf("Save path: '%s', pattern: '%s'\n", getSavePath(), pattern);
-
+
int fileType = FAT_FindFirstFileLFN(name);
Common::StringList list;
do {
-
+
if (fileType == TYPE_FILE) {
FAT_GetLongFilename(name);
@@ -232,18 +232,18 @@ Common::StringList GBAMPSaveFileManager::listSavefiles(const char *pattern) {
for (int r = 0; name[r] != 0; r++) {
name[r] = tolower(name[r]);
}
-
-
+
+
if (Common::matchString(name, pattern)) {
list.push_back(name);
}
}
} while ((fileType = FAT_FindNextFileLFN(name)));
-
+
FAT_chdir("/");
return list;
-}
+}
diff --git a/backends/platform/ds/arm9/source/gbampsave.h b/backends/platform/ds/arm9/source/gbampsave.h
index 6ddc4fd964..c92d5d6151 100644
--- a/backends/platform/ds/arm9/source/gbampsave.h
+++ b/backends/platform/ds/arm9/source/gbampsave.h
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
+
#ifndef _GBAMPSAVE_H_
#define _GBAMPSAVE_H_
@@ -38,19 +38,19 @@ class GBAMPSaveFile : public Common::InSaveFile, public Common::OutSaveFile {
public:
GBAMPSaveFile(char* name, bool saveOrLoad);
virtual ~GBAMPSaveFile();
-
+
virtual uint32 read(void *buf, uint32 size);
virtual uint32 write(const void *buf, uint32 size);
-
+
virtual bool eos() const;
virtual bool skip(uint32 bytes);
virtual int32 pos() const;
virtual int32 size() const;
virtual bool seek(int32 pos, int whence);
-
+
void flushSaveBuffer();
-
+
virtual bool isOpen() const {
return handle != 0;
}
@@ -61,17 +61,17 @@ class GBAMPSaveFileManager : public Common::SaveFileManager {
public:
GBAMPSaveFileManager();
~GBAMPSaveFileManager();
-
+
// static GBAMPSaveFileManager* instance() { return instancePtr; }
GBAMPSaveFile *openSavefile(const char *filename, bool saveOrLoad);
-
+
virtual Common::OutSaveFile* openForSaving(const char* filename) { return openSavefile(filename, true); }
virtual Common::InSaveFile* openForLoading(const char* filename) { return openSavefile(filename, false); }
-
+
virtual bool removeSavefile(const char *filename) { return false; } // TODO: Implement this
virtual Common::StringList listSavefiles(const char *pattern);
-
+
void deleteFile(char* name);
void listFiles();
diff --git a/backends/platform/ds/arm9/source/keys.cpp b/backends/platform/ds/arm9/source/keys.cpp
index dcec2287b9..63fae866e5 100644
--- a/backends/platform/ds/arm9/source/keys.cpp
+++ b/backends/platform/ds/arm9/source/keys.cpp
@@ -1,5 +1,5 @@
/*------------------------------------------------------------------------------
- $Id: keys.c,v 1.13 2006/01/12 09:10:47 wntrmute Exp $
+ $Id$
key input code -- provides slightly higher level input forming
@@ -27,26 +27,26 @@
$Log: keys.c,v $
Revision 1.13 2006/01/12 09:10:47 wntrmute
Added key repeat as suggested by pepsiman
-
+
Revision 1.12 2005/11/27 12:30:25 wntrmute
reverted to correct hardware REGisters
-
+
Revision 1.11 2005/11/27 07:48:45 joatski
Renamed REG_KEYINPUT and REG_KEYCNT back to KEYS and KEYS_CR, as the alternatives are defined in registers_alt.h.
Changed function returns to uint32
-
+
Revision 1.10 2005/11/03 23:38:49 wntrmute
don't use enum for key function returns
-
+
Revision 1.9 2005/10/13 16:30:11 dovoto
Changed KEYPAD_BITS to a typedef enum, this resolved some issues with multiple redefinition of KEYPAD_BITS (although this error did not allways occur).
-
+
Revision 1.8 2005/10/03 21:21:59 wntrmute
use enum types
-
+
Revision 1.7 2005/09/07 18:06:27 wntrmute
use new register names
-
+
Revision 1.6 2005/08/23 17:06:10 wntrmute
converted all endings to unix
@@ -148,4 +148,4 @@ uint32 keysUp(void) {
}
-} // namespace ds \ No newline at end of file
+} // namespace ds
diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp
index 5ddcb50b15..dac9e59588 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.cpp
+++ b/backends/platform/ds/arm9/source/osystem_ds.cpp
@@ -63,7 +63,7 @@ int OSystem_DS::timerHandler(int t) {
tm->handler();
return t;
}
-
+
void OSystem_DS::initBackend() {
ConfMan.setInt("autosave_period", 0);
ConfMan.setBool("FM_medium_quality", true);
@@ -80,7 +80,7 @@ void OSystem_DS::initBackend() {
_mixer->setOutputRate(DS::getSoundFrequency());
_mixer->setReady(true);
-
+
OSystem::initBackend();
}
@@ -149,13 +149,13 @@ void OSystem_DS::setPalette(const byte *colors, uint start, uint num) {
int red = *colors;
int green = *(colors + 1);
int blue = *(colors + 2);
-
+
red >>= 3;
green >>= 3;
blue >>= 3;
-
+
// if (r != 255)
- {
+ {
u16 paletteValue = red | (green << 5) | (blue << 10);
if (DS::getIsDisplayMode8Bit()) {
@@ -168,7 +168,7 @@ void OSystem_DS::setPalette(const byte *colors, uint start, uint num) {
_palette[r] = paletteValue;
}
// if (num == 255) consolePrintf("pal:%d r:%d g:%d b:%d\n", r, red, green, blue);
-
+
colors += 4;
}
}
@@ -180,14 +180,14 @@ void OSystem_DS::setCursorPalette(const byte *colors, uint start, uint num) {
int red = *colors;
int green = *(colors + 1);
int blue = *(colors + 2);
-
+
red >>= 3;
green >>= 3;
blue >>= 3;
-
+
u16 paletteValue = red | (green << 5) | (blue << 10);
_cursorPalette[r] = paletteValue;
-
+
colors += 4;
}
@@ -198,7 +198,7 @@ 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
-
+
const u16* image = (const u16 *) DS::get8BitBackBuffer();
for (int y = 0; y < DS::getGameHeight(); y++)
@@ -215,7 +215,7 @@ bool OSystem_DS::grabRawScreen(Graphics::Surface* surf) {
void OSystem_DS::grabPalette(unsigned char *colors, uint start, uint num) {
// consolePrintf("Grabpalette");
-
+
for (unsigned int r = start; r < start + num; r++) {
*colors++ = (BG_PALETTE[r] & 0x001F) << 3;
*colors++ = (BG_PALETTE[r] & 0x03E0) >> 5 << 3;
@@ -228,11 +228,11 @@ void OSystem_DS::grabPalette(unsigned char *colors, uint start, uint num) {
void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
//consolePrintf("Copy rect %d, %d %d, %d ", x, y, w, h);
- if (!_graphicsEnable) return;
+ if (!_graphicsEnable) return;
if (w <= 1) return;
if (h < 0) return;
if (!DS::getIsDisplayMode8Bit()) return;
-
+
u16* bg;
s32 stride;
u16* bgSub = (u16 *) BG_GFX_SUB;
@@ -258,7 +258,7 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int
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;
@@ -306,7 +306,7 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int
}
by++;
-
+
}
// consolePrintf("Slow method used!\n");
@@ -315,40 +315,40 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int
} else {
// Stuff is aligned to 16-bit boundaries, so it's safe to do DMA.
-
+
u16* src = (u16 *) buf;
-
+
if (DS::getKeyboardEnable()) {
-
+
for (int dy = y; dy < y + h; dy++) {
u16* dest = bg + (dy * (stride >> 1)) + (x >> 1);
-
+
DC_FlushRange(src, w << 1);
DC_FlushRange(dest, w << 1);
dmaCopyHalfWords(3, src, dest, w);
-
+
while (dmaBusy(3));
-
+
src += pitch >> 1;
}
-
+
} else {
for (int dy = y; dy < y + h; dy++) {
u16* dest1 = bg + (dy * (stride >> 1)) + (x >> 1);
u16* dest2 = bgSub + (dy << 8) + (x >> 1);
-
+
DC_FlushRange(src, w << 1);
DC_FlushRange(dest1, w << 1);
DC_FlushRange(dest2, w << 1);
-
+
dmaCopyHalfWords(3, src, dest1, w);
-
+
if ((!_frameBufferExists) || (buf == _framebuffer.pixels)) {
dmaCopyHalfWords(2, src, dest2, w);
}
-
+
while (dmaBusy(2) || dmaBusy(3));
-
+
src += pitch >> 1;
}
}
@@ -402,36 +402,36 @@ void OSystem_DS::grabOverlay (OverlayColor *buf, int pitch) {
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;
-
+
// if (x + w > 256) w = 256 - x;
//if (x + h > 256) h = 256 - y;
// consolePrintf("Copy rect ovl %d, %d %d, %d %d\n", x, y, w, h, pitch);
-
-
+
+
for (int dy = y; dy < y + h; dy++) {
-
-
+
+
// Slow but save copy:
for (int dx = x; dx < x + w; dx++) {
-
+
*(bg + (dy * 512) + dx) = *src;
//if ((*src) != 0) consolePrintf("%d,%d: %d ", dx, dy, *src);
//consolePrintf("%d,", *src);
src++;
}
src += (pitch - w);
-
+
// Fast but broken copy: (why?)
/*
REG_IME = 0;
dmaCopy(src, bg + (dy << 9) + x, w * 2);
REG_IME = 1;
-
+
src += pitch;*/
}
-
+
// consolePrintf("Copy rect ovl done");
}
@@ -446,7 +446,7 @@ int16 OSystem_DS::getOverlayWidth() {
return getWidth();
}
-
+
bool OSystem_DS::showMouse(bool visible) {
DS::setShowCursor(visible);
return true;
@@ -498,7 +498,7 @@ bool OSystem_DS::pollEvent(Common::Event &event) {
return true;
}
}
-
+
return false;
/* if (lastPenFrame != DS::getMillis()) {
@@ -511,7 +511,7 @@ bool OSystem_DS::pollEvent(Common::Event &event) {
if (eventNum == 1) {
eventNum = 0;
lastPenFrame = DS::getMillis();
- if (DS::getPenDown()) {
+ if (DS::getPenDown()) {
event.type = Common::EVENT_LBUTTONDOWN;
event.mouse = Common::Point(DS::getPenX(), DS::getPenY());
consolePrintf("Down %d, %d ", event.mouse.x, event.mouse.y);
@@ -538,12 +538,12 @@ void OSystem_DS::delayMillis(uint msecs) {
int st = getMillis();
DS::addEventsToQueue();
DS::CD::update();
-
+
DS::doSoundCallback();
while (st + msecs >= getMillis()) {
DS::doSoundCallback();
}
-
+
DS::doTimerCallback();
DS::checkSleepMode();
DS::addEventsToQueue();
@@ -599,7 +599,7 @@ void OSystem_DS::quit() {
/* consolePrintf("Soft resetting...");
IPC->reset = 1;
REG_IE = 0;
-
+
asm("swi 0x26\n");
swiSoftReset();*/
}
@@ -618,10 +618,10 @@ Common::SaveFileManager* OSystem_DS::getSavefileManager() {
} else {
forceSram = false;
}
- if (forceSram) {
+ if (forceSram) {
consolePrintf("Using SRAM save method!\n");
}
-
+
if (DS::isGBAMPAvailable() && (!forceSram)) {
return &mpSaveManager;
} else {
@@ -653,21 +653,21 @@ Graphics::Surface* OSystem_DS::createTempFrameBuffer() {
} else {
-
+
s32 height = DS::getGameHeight();
s32 width = DS::getGameWidth();
s32 stride = DS::get8BitBackBufferStride();
-
+
u16* src = DS::get8BitBackBuffer();
u16* dest = DS::getScalerBuffer();
for (int y = 0; y < height; y++) {
-
+
u16* destLine = dest + (y * (width / 2));
u16* srcLine = src + (y * (stride / 2));
DC_FlushRange(srcLine, width);
-
+
dmaCopyHalfWords(3, srcLine, destLine, width);
}
@@ -681,7 +681,7 @@ Graphics::Surface* OSystem_DS::createTempFrameBuffer() {
_frameBufferExists = true;
-/*
+/*
size_t imageStrideInBytes = DS::get8BitBackBufferStride();
size_t imageStrideInWords = imageStrideInBytes / 2;
diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h
index 16c8f41491..ce494011d0 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.h
+++ b/backends/platform/ds/arm9/source/osystem_ds.h
@@ -19,8 +19,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
-
+
+
#ifndef _OSYSTEM_DS_H_
#define _OSYSTEM_DS_H_
#include "common/system.h"
@@ -33,13 +33,13 @@
#include "sound/mixer_intern.h"
#include "graphics/surface.h"
-class DSAudioMixer : public Audio::MixerImpl {
+class DSAudioMixer : public Audio::MixerImpl {
public:
DSAudioMixer(OSystem* system) : Audio::MixerImpl(system) { }
};
-class DSTimerManager : public DefaultTimerManager {
+class DSTimerManager : public DefaultTimerManager {
};
@@ -48,10 +48,10 @@ protected:
int eventNum;
int lastPenFrame;
-
+
Common::Event eventQueue[96];
int queuePos;
-
+
#ifdef GBA_SRAM_SAVE
DSSaveFileManager saveManager;
#endif
@@ -75,7 +75,7 @@ protected:
byte _cursorKey;
int _cursorScale;
-
+
Graphics::Surface* createTempFrameBuffer();
bool _disableCursorPalette;
@@ -113,10 +113,8 @@ public:
virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
virtual int16 getOverlayHeight();
virtual int16 getOverlayWidth();
+ virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<1555>(); }
- inline virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b);
- inline virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b);
-
virtual bool showMouse(bool visible);
virtual void warpMouse(int x, int y);
@@ -148,21 +146,21 @@ public:
virtual void displayMessageOnOSD(const char *msg);
virtual Common::SaveFileManager *getSavefileManager();
-
+
void addEvent(Common::Event& e);
bool isEventQueueEmpty() { return queuePos == 0; }
-
+
virtual bool grabRawScreen(Graphics::Surface* surf);
-
+
virtual void setFocusRectangle(const Common::Rect& rect);
-
+
virtual void clearFocusRectangle();
-
+
virtual void initBackend();
-
+
virtual Graphics::Surface *lockScreen();
virtual void unlockScreen();
-
+
virtual Audio::Mixer* getMixer() { return _mixer; }
Audio::MixerImpl* getMixerImpl() { return _mixer; }
@@ -190,19 +188,4 @@ static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
{0, 0, 0},
};
-OverlayColor OSystem_DS::RGBToColor(uint8 r, uint8 g, uint8 b)
-{
- return 0x8000 | (r >> 3) | ((g >> 3) << 5) | ((b >> 3) << 10);
- //consolePrintf("rgbtocol\n");
- //return 0;
-}
-
-void OSystem_DS::colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b)
-{
- r = (color & 0x001F) << 3;
- g = ((color & 0x03E0) >> 5) << 3;
- b = ((color & 0x7C00) >> 10) << 3;
- //consolePrintf("coltorgb\n");
-}
-
#endif
diff --git a/backends/platform/ds/arm9/source/portdefs.h b/backends/platform/ds/arm9/source/portdefs.h
index 16f3d8cc9b..8a14420907 100644
--- a/backends/platform/ds/arm9/source/portdefs.h
+++ b/backends/platform/ds/arm9/source/portdefs.h
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
+
#ifndef _PORTDEFS_H_
#define _PORTDEFS_H_
@@ -57,7 +57,7 @@ typedef signed int s32;
#ifdef __cplusplus
extern "C" {
#endif
-void consolePrintf(const char* s, ...);
+int consolePrintf(const char* s, ...);
#ifdef __cplusplus
}
#endif
@@ -82,7 +82,7 @@ void consolePrintf(const char* s, ...);
#define ITCM_DATA __attribute__((section(".itcm")))
// Since I can't change the engine at the moment (post lockdown) this define can go here.
-// This define changes the mouse-relative motion which doesn't make sense on a touch screen to
+// This define changes the mouse-relative motion which doesn't make sense on a touch screen to
// a more conventional form of input where the menus can be clicked on.
#define LURE_CLICKABLE_MENUS
diff --git a/backends/platform/ds/arm9/source/ramsave.cpp b/backends/platform/ds/arm9/source/ramsave.cpp
index a9f4e3d2fc..113dd5df72 100644
--- a/backends/platform/ds/arm9/source/ramsave.cpp
+++ b/backends/platform/ds/arm9/source/ramsave.cpp
@@ -17,7 +17,7 @@
* 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.
- *
+ *
*/
#ifdef GBA_SRAM_SAVE
@@ -53,18 +53,18 @@ DSSaveFile::DSSaveFile(SCUMMSave* s, bool compressed, u8* data) {
ownsData = true;
saveCompressed = false;
// consolePrintf("Decompressed. name=%s size=%d (%d)", save.name, save.size, save.compressedSize);
-
+
} else {
ownsData = false;
origHeader = s;
}
-
+
if (save.magic == (int) 0xBEEFCAFE) {
save.isValid = true;
} else {
save.isValid = false;
}
-
+
isTempFile = false;
eosReached = false;
}
@@ -80,7 +80,7 @@ DSSaveFile::~DSSaveFile() {
}
bool DSSaveFile::loadFromSaveRAM(vu8* address) {
-
+
SCUMMSave newSave;
for (int t = 0; t < (int) sizeof(newSave); t++) {
@@ -91,13 +91,13 @@ bool DSSaveFile::loadFromSaveRAM(vu8* address) {
newSave.isValid = true;
*((u16 *) (0x4000204)) |= 0x3;
-
+
saveData = new unsigned char[newSave.compressedSize];
-
+
for (int t = 0; t < (int) newSave.compressedSize; t++) {
((char *) (saveData))[t] = *(address + t + sizeof(newSave));
}
-
+
if (ownsData) delete this->saveData;
save = newSave;
saveCompressed = true;
@@ -107,7 +107,7 @@ bool DSSaveFile::loadFromSaveRAM(vu8* address) {
return true;
}
-
+
return false;
}
@@ -116,11 +116,11 @@ void DSSaveFile::compress() {
unsigned char* compBuffer = new unsigned char[(save.size * 110) / 100];
int compSize = LZ_Compress((u8 *) saveData, compBuffer, save.size);
save.compressedSize = compSize;
-
-
-
+
+
+
delete saveData;
-
+
// Make the save smaller
saveData = (u8 *) realloc(compBuffer, save.compressedSize);
saveCompressed = true;
@@ -131,39 +131,39 @@ int DSSaveFile::saveToSaveRAM(vu8* address) {
unsigned char* compBuffer;
bool failed;
-
+
int compSize;
-
+
compress();
-
+
compSize = save.compressedSize;
compBuffer = saveData;
-
+
if (DSSaveFileManager::instance()->getBytesFree() >= getRamUsage()) {
DSSaveFileManager::instance()->addBytesFree(-getRamUsage());
-
+
// Write header
for (int t = 0; t < sizeof(save); t++) {
while (*(address + t) != ((char *) (&save))[t]) {
*(address + t) = ((char *) (&save))[t];
}
}
-
+
// Write compressed buffer
for (int t = sizeof(save); t < (int) sizeof(save) + compSize; t++) {
while (*(address + t) != compBuffer[t - sizeof(save)]) {
*(address + t) = compBuffer[t - sizeof(save)];
}
}
-
+
failed = false;
} else {
failed = true;
}
-
+
return failed? 0: compSize + sizeof(save);
}
@@ -181,7 +181,7 @@ uint32 DSSaveFile::read(void *buf, uint32 size) {
}
memcpy(buf, saveData + ptr, size);
// consolePrintf("byte: %d ", ((u8 *) (buf))[0]);
-
+
ptr += size;
return size;
}
@@ -260,7 +260,7 @@ bool DSSaveFile::matches(const char *filename) {
return false;
}
}
-
+
void DSSaveFile::setName(char *name) {
save.isValid = true;
save.magic = 0xBEEFCAFE;
@@ -269,7 +269,7 @@ void DSSaveFile::setName(char *name) {
save.compressedSize = 0;
saveData = new unsigned char[DS_MAX_SAVE_SIZE];
strcpy(save.name, name);
-
+
if ((strstr(name, ".s99")) || (strstr(name, ".c"))) {
isTempFile = true;
} else {
@@ -309,10 +309,10 @@ void DSSaveFile::deleteFile() {
DSSaveFileManager::DSSaveFileManager() {
instancePtr = this;
-
+
*((u16 *) (0x4000204)) |= 0x3;
swiWaitForVBlank();
-
+
loadAllFromSRAM();
}
@@ -322,7 +322,7 @@ DSSaveFileManager::~DSSaveFileManager() {
void DSSaveFileManager::loadAllFromSRAM() {
int addr = 1;
-
+
for (int r = 0; r < 8; r++) {
gbaSave[r].deleteFile();
}
@@ -343,7 +343,7 @@ void DSSaveFileManager::formatSram() {
for (int r = 0; r < SRAM_SAVE_MAX; r++) {
*(CART_RAM + r) = 0;
}
-
+
loadAllFromSRAM();
}
@@ -369,7 +369,7 @@ DSSaveFile *DSSaveFileManager::openSavefile(const char* filename, bool saveOrLoa
return gbaSave[r].clone();
}
}
-
+
if (saveOrLoad) {
return makeSaveFile(filename, saveOrLoad);
} else {
@@ -429,20 +429,20 @@ void DSSaveFileManager::listSavefiles(const char *prefix, bool *marks, int num)
}
}
}
-
+
}
*/
DSSaveFile *DSSaveFileManager::makeSaveFile(const char *filename, bool saveOrLoad) {
-
+
// Find a free save slot
int r = 0;
-
+
while ((r < 8) && (gbaSave[r].isValid())) {
r++;
}
-
+
if ((r == 8) && (gbaSave[r].isValid())) {
// No more saves
return NULL;
@@ -459,9 +459,9 @@ void DSSaveFileManager::flushToSaveRAM() {
int cartAddr = 1;
int s;
int extraData = DSSaveFileManager::getExtraData();
-
+
*((u16 *) (0x4000204)) |= 0x3;
-
+
swiWaitForVBlank();
int size = 0;
@@ -471,20 +471,20 @@ void DSSaveFileManager::flushToSaveRAM() {
if (!gbaSave[r].isTemp()) size += gbaSave[r].getRamUsage();
}
}
-
+
if (size <= SRAM_SAVE_MAX) {
for (int r = 0; r < SRAM_SAVE_MAX; r++) {
*(CART_RAM + r) = 0;
}
-
+
sramBytesFree = SRAM_SAVE_MAX;
-
+
for (int r = 0; (r < 8); r++) {
if (gbaSave[r].isValid() && (!gbaSave[r].isTemp())) {
-
+
cartAddr += s = gbaSave[r].saveToSaveRAM(CART_RAM + cartAddr);
-
+
/* if (s == 0) {
consolePrintf("WARNING: Save didn't fit in cart RAM and has been lost!! Delete files and save again.", gbaSave[r].getName());
failed = true;
@@ -495,7 +495,7 @@ void DSSaveFileManager::flushToSaveRAM() {
consolePrintf("WARNING: Save didn't fit in cart RAM and has been lost!! Delete files and save again.");
loadAllFromSRAM();
-
+
}
DSSaveFileManager::setExtraData(extraData);
diff --git a/backends/platform/ds/arm9/source/ramsave.h b/backends/platform/ds/arm9/source/ramsave.h
index 034e957b7f..709b6fc6c1 100644
--- a/backends/platform/ds/arm9/source/ramsave.h
+++ b/backends/platform/ds/arm9/source/ramsave.h
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
+
#ifndef _RAMSAVE_H_
#define _RAMSAVE_H_
@@ -46,58 +46,58 @@ class DSSaveFile : public Common::InSaveFile, public Common::OutSaveFile {
u16 extraMagic; // 32
u32 reserved; // 36
} __attribute__ ((packed));
-
+
SCUMMSave save;
u8* saveData;
SCUMMSave* origHeader;
bool isOpenFlag;
bool isTempFile;
bool eosReached;
-
+
public:
DSSaveFile();
DSSaveFile(SCUMMSave* s, bool saveCompressed, u8* data);
~DSSaveFile();
-
+
void reset();
-
+
bool isOpen() const { return isOpenFlag; }
virtual bool eos() const;
virtual void clearErr();
virtual bool skip(uint32 size);
-
+
virtual int32 pos() const;
virtual int32 size() const;
virtual bool seek(int32 pos, int whence);
uint32 read(void *buf, uint32 size);
uint32 write(const void *buf, uint32 size);
-
+
void setName(char *name);
char* getName() { return save.name; }
-
+
bool isValid() { return save.isValid; }
bool isTemp() { return isTempFile; }
bool matches(const char *prefix, int num);
bool matches(const char *filename);
-
+
void clearData();
void compress();
-
+
int getRamUsage() { return sizeof(save) + save.compressedSize; }
char* getRamImage() { return (char *) &save; }
-
+
int getSize() { return save.size; }
-
+
DSSaveFile* clone();
-
+
bool loadFromSaveRAM(vu8* address);
int saveToSaveRAM(vu8* address);
-
-
+
+
void deleteFile();
-
+
void operator delete(void *p) {
// consolePrintf("Finished! size=%d\n", ((DSSaveFile *) (p))->save->size);
}
@@ -109,25 +109,25 @@ public:
class DSSaveFileManager : public Common::SaveFileManager {
-
+
DSSaveFile gbaSave[8];
static DSSaveFileManager* instancePtr;
int sramBytesFree;
-
+
public:
DSSaveFileManager();
~DSSaveFileManager();
-
+
static DSSaveFileManager* instance() { return instancePtr; }
DSSaveFile *openSavefile(const char *filename, bool saveOrLoad);
-
+
virtual Common::OutSaveFile* openForSaving(const char* filename) { return openSavefile(filename, true); }
virtual Common::InSaveFile* openForLoading(const char* filename) { return openSavefile(filename, false); }
virtual bool removeSavefile(const char *filename);
virtual Common::StringList listSavefiles(const char *pattern);
-
+
void flushToSaveRAM();
void addBytesFree(int size) { sramBytesFree += size; }
@@ -136,7 +136,7 @@ public:
void deleteFile(char* name);
void listFiles();
void formatSram();
-
+
void loadAllFromSRAM();
static bool isExtraDataPresent();
diff --git a/backends/platform/ds/arm9/source/scummconsole.c b/backends/platform/ds/arm9/source/scummconsole.c
index 2145b47353..aafa0f7744 100644
--- a/backends/platform/ds/arm9/source/scummconsole.c
+++ b/backends/platform/ds/arm9/source/scummconsole.c
@@ -440,7 +440,7 @@ void printF(int w, float f)
*/
}
-void consolePrintf(const char* s, ...)
+int consolePrintf(const char* s, ...)
{
int w = 1, z = 0;
@@ -498,7 +498,12 @@ void consolePrintf(const char* s, ...)
break;
case 'f':
case 'F':
- printF(w,va_arg(argp, double));
+/* Need to undo our 'all doubles are floats' definition */
+#define TEMP_DEF double
+#undef double
+ printF(w,va_arg(argp, double));
+#define double TEMP_DEF
+#undef TEMP_DEF
s++;
break;
case 's':
@@ -518,6 +523,8 @@ void consolePrintf(const char* s, ...)
s++;
}
va_end(argp);
+
+ return 0;
}
void consolePutString(int x, int y, char* s)
diff --git a/backends/platform/ds/arm9/source/scummconsole.h b/backends/platform/ds/arm9/source/scummconsole.h
index 01fdfc2f04..f7aa30f125 100644
--- a/backends/platform/ds/arm9/source/scummconsole.h
+++ b/backends/platform/ds/arm9/source/scummconsole.h
@@ -25,7 +25,7 @@
//
// Changelog:
// 0.1: First version
-// 0.2: Fixed sprite mapping bug. 1D mapping should work now.
+// 0.2: Fixed sprite mapping bug. 1D mapping should work now.
// Changed some register defines for consistency.
//
//////////////////////////////////////////////////////////////////////
@@ -45,7 +45,7 @@ void poo(u8 p);
void consoleInit(u16* font, u16* charBase, u16 numCharacters, u8 charStart, u16* map, u8 pal, u8 bitDepth);
void consoleInitDefault(u16* map, u16* charBase, u8 bitDepth);
-void consolePrintf(const char* s, ...);
+int consolePrintf(const char* s, ...);
void consolePrintSet(int x, int y);
diff --git a/backends/platform/ds/arm9/source/scummhelp.cpp b/backends/platform/ds/arm9/source/scummhelp.cpp
index 452f782dc5..f9efd58276 100644
--- a/backends/platform/ds/arm9/source/scummhelp.cpp
+++ b/backends/platform/ds/arm9/source/scummhelp.cpp
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
+
#include "scummhelp.h"
#define ADD_BIND(k,d) do { key[i] = k; dsc[i] = d; i++; } while (0)
diff --git a/backends/platform/ds/arm9/source/scummhelp.h b/backends/platform/ds/arm9/source/scummhelp.h
index e79c863cbd..602cb5f788 100644
--- a/backends/platform/ds/arm9/source/scummhelp.h
+++ b/backends/platform/ds/arm9/source/scummhelp.h
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
+
#ifndef _SCUMMHELP_H_
#define _SCUMMHELP_H_
@@ -30,7 +30,7 @@ namespace DS {
void updateStrings(byte gameId, byte version, Common::Platform platform,
int page, Common::String &title, Common::String *&key, Common::String *&dsc);
-
+
}
#endif
diff --git a/backends/platform/ds/arm9/source/touchkeyboard.cpp b/backends/platform/ds/arm9/source/touchkeyboard.cpp
index 85f80fac92..6ff8a60392 100644
--- a/backends/platform/ds/arm9/source/touchkeyboard.cpp
+++ b/backends/platform/ds/arm9/source/touchkeyboard.cpp
@@ -45,7 +45,7 @@ struct key_data {
key_data keys[DS_NUM_KEYS] = {
// Key number x y character
-
+
// Numbers
{28, 3, 0, '1'},
{29, 5, 0, '2'},
@@ -116,7 +116,7 @@ key_data keys[DS_NUM_KEYS] = {
{54, 29, 8, Common::KEYCODE_DOWN},
{53, 31, 8, Common::KEYCODE_RIGHT},
{51, 29, 6, Common::KEYCODE_UP},
-
+
// Close button
{56, 30, 0, Common::KEYCODE_INVALID},
@@ -133,7 +133,7 @@ key_data keys[DS_NUM_KEYS] = {
{66, 26, -2, Common::KEYCODE_F10},
{67, 28, -2, Common::KEYCODE_F11},
{68, 30, -2, Common::KEYCODE_F12},
-
+
};
int keyboardX;
@@ -162,34 +162,34 @@ void restoreVRAM(int tileBase, int mapBase, u16* saveSpace) {
/* for (int r = 0; r < 32 * 32; r++) {
((u16 *) SCREEN_BASE_BLOCK_SUB(mapBase))[r] = *saveSpace++;
}
-
+
for (int r = 0; r < 4096; r++) {
((u16 *) CHAR_BASE_BLOCK_SUB(tileBase))[r] = *saveSpace++;
}*/
}
void drawKeyboard(int tileBase, int mapBase, u16* saveSpace) {
- int keyboardDataSize = 4736 * 2;
+ /* int keyboardDataSize = 4736 * 2; */
for (int r = 0; r < 32 * 32; r++) {
// *saveSpace++ = ((u16 *) SCREEN_BASE_BLOCK_SUB(mapBase))[r];
((u16 *) SCREEN_BASE_BLOCK_SUB(mapBase))[r] = 0;
}
-
+
for (int r = 0; r < KEYBOARD_DATA_SIZE / 2; r++) {
// *saveSpace++ = ((u16 *) CHAR_BASE_BLOCK_SUB(tileBase))[r];
- ((u16 *) CHAR_BASE_BLOCK_SUB(tileBase))[r] = ((u16 *) (keyboard_raw))[r];
+ ((u16 *) CHAR_BASE_BLOCK_SUB(tileBase))[r] = ((u16 *) (::keyboard_raw))[r];
}
-
+
for (int r = 0; r < 16; r++) {
BG_PALETTE_SUB[r] = ((u16 *) (keyboard_pal_raw))[r];
}
// this is the font
for (int tile = 0; tile < 94; tile++) {
-
+
u16* tileAddr = (u16 *) (CHAR_BASE_BLOCK_SUB(tileBase) + ((KEYBOARD_DATA_SIZE) + (tile * 32)));
- u8* src = ((u8 *) (_8x8font_tga_raw)) + 18 + tile * 8;
+ u8* src = ((u8 *) (::_8x8font_tga_raw)) + 18 + tile * 8;
for (int y = 0 ; y < 8; y++) {
for (int x = 0; x < 2; x++) {
@@ -197,55 +197,55 @@ void drawKeyboard(int tileBase, int mapBase, u16* saveSpace) {
| ((*(src + (y * 752) + (x * 4) + 1) & 0x0F) << 4)
| ((*(src + (y * 752) + (x * 4) + 2) & 0x0F) << 8)
| ((*(src + (y * 752) + (x * 4) + 3) & 0x0F) << 12);
-
+
}
}
}
-
+
for (int r = 0; r < 16; r++) {
int col = ((u16 *) (keyboard_pal_raw))[r];
-
+
int red = col & 0x001F;
int green = (col & 0x03E0) >> 5;
int blue = (col & 0x7C00) >> 10;
-
+
red = (red * 8) / 16;
green = (green * 24) / 16;
blue = (blue * 8) / 16;
if (green > 31) green = 31;
-
+
BG_PALETTE_SUB[16 + r] = red | (green << 5) | (blue << 10);
}
-
+
keyboardX = -2;
keyboardY = 2;
-
+
DS::mapBase = mapBase;
DS::tileBase = tileBase;
-
+
shiftState = false;
capsLockState = false;
-
+
int x = keyboardX;
int y = keyboardY;
-
+
u16* base = ((u16 *) SCREEN_BASE_BLOCK_SUB(mapBase));
baseAddress = base;
-
+
for (int r = 0; r < DS_NUM_KEYS; r++) {
base[(y + keys[r].y) * 32 + x + keys[r].x] = 10 + keys[r].keyNum * 2;
base[(y + keys[r].y) * 32 + x + keys[r].x + 1] = 10 + keys[r].keyNum * 2 + 1;
-
+
base[(y + keys[r].y + 1) * 32 + x + keys[r].x] = 10 + 148 + keys[r].keyNum * 2;
base[(y + keys[r].y + 1) * 32 + x + keys[r].x + 1] = 10 + 148 + keys[r].keyNum * 2 + 1;
-
+
keys[r].pressed = false;
}
-
+
closed = false;
clearAutoComplete();
}
@@ -257,23 +257,23 @@ void drawAutoComplete() {
baseAddress[y * 32 + x] = 0;
}
}
-
+
for (int r = 0; r < autoCompleteCount; r++) {
int y = 12 + (r % 6) * 2;
int x = 0 + ((r / 6) * 16);
- for (int p = 0; p < strlen(autoCompleteWord[r]); p++) {
+ for (int p = 0; autoCompleteWord[r][p] != 0; p++) {
char c = autoCompleteWord[r][p];
-
+
int tile = c - 33 + (KEYBOARD_DATA_SIZE / 32);
if (selectedCompletion == r) {
tile |= 0x1000;
}
- baseAddress[y * 32 + x + p] = tile;
-
+ baseAddress[y * 32 + x + p] = tile;
+
}
}
@@ -317,7 +317,7 @@ void clearAutoComplete() {
void typeCompletion(int current) {
Common::Event event;
- OSystem_DS* system = OSystem_DS::instance();
+ /* OSystem_DS* system = OSystem_DS::instance(); */
strcat(autoCompleteBuffer, &autoCompleteWord[current][charactersEntered]);
strcat(autoCompleteBuffer, " ");
@@ -330,7 +330,7 @@ void typeCompletion(int current) {
event.type = Common::EVENT_KEYDOWN;
event.kbd.flags = 0;
system->addEvent(event);
-
+
event.type = Common::EVENT_KEYUP;
system->addEvent(event);
}
@@ -351,17 +351,17 @@ void updateTypeEvents()
{
Common::Event event;
OSystem_DS* system = OSystem_DS::instance();
-
+
event.kbd.keycode = (Common::KeyCode) autoCompleteBuffer[0];
event.kbd.ascii = autoCompleteBuffer[0];
event.type = Common::EVENT_KEYDOWN;
event.kbd.flags = 0;
system->addEvent(event);
-
+
event.type = Common::EVENT_KEYUP;
system->addEvent(event);
- for (int r = 0; r < strlen(autoCompleteBuffer); r++)
+ for (int r = 0; r < (int)strlen(autoCompleteBuffer); r++)
{
autoCompleteBuffer[r] = autoCompleteBuffer[r + 1];
}
@@ -380,16 +380,16 @@ void createKeyEvent(int keyNum, Common::Event& event)
} else {
event.kbd.keycode = (Common::KeyCode) (Common::KEYCODE_F1 - (keys[keyNum].character - '1'));
event.kbd.ascii = 0;
- }
-
+ }
+
} else if ((keys[keyNum].character >= 'A') && (keys[keyNum].character <= 'Z')) {
-
+
if ((!DS::shiftState) && (!DS::capsLockState)) {
event.kbd.ascii = keys[keyNum].character + 32; // Make key lowercase.
} else {
event.kbd.ascii = keys[keyNum].character;
}
-
+
event.kbd.keycode = (Common::KeyCode) event.kbd.ascii;
} else {
if ((keys[keyNum].character >= Common::KEYCODE_F1) && (keys[keyNum].character >= Common::KEYCODE_F12)) {
@@ -399,7 +399,7 @@ void createKeyEvent(int keyNum, Common::Event& event)
event.kbd.ascii = keys[keyNum].character;
event.kbd.keycode = (Common::KeyCode) keys[keyNum].character;
}
- }
+ }
}
void releaseAllKeys() {
@@ -408,7 +408,7 @@ void releaseAllKeys() {
DS::setKeyHighlight(r, false);
OSystem_DS* system = OSystem_DS::instance();
-
+
Common::Event event;
createKeyEvent(r, event);
event.type = Common::EVENT_KEYUP;
@@ -416,7 +416,7 @@ void releaseAllKeys() {
keys[r].pressed = false;
}
- }
+ }
}
void addKeyboardEvents() {
@@ -427,7 +427,7 @@ void addKeyboardEvents() {
if (DS::getPenDown()) {
int x = IPC->touchXpx;
int y = IPC->touchYpx;
-
+
int tx = (x >> 3);
int ty = (y >> 3);
@@ -451,63 +451,63 @@ void addKeyboardEvents() {
tx -= keyboardX;
ty -= keyboardY;
-
+
// consolePrintf("x=%d y=%d\n", tx, ty);
-
+
for (int r = 0; r < DS_NUM_KEYS; r++) {
- if (( (tx >= keys[r].x) && (tx <= keys[r].x + 1)) &&
+ if (( (tx >= keys[r].x) && (tx <= keys[r].x + 1)) &&
(ty >= keys[r].y) && (ty <= keys[r].y + 1)) {
OSystem_DS* system = OSystem_DS::instance();
Common::Event event;
-
+
// consolePrintf("Key: %d\n", r);
if ((keys[r].character == Common::KEYCODE_INVALID)) {
// Close button
//DS::closed = true;
} else {
createKeyEvent(r, event);
- }
-
- //event.kbd.keycode = keys[r].character;
- //event.kbd.ascii = keys[r].character;
+ }
+
+ //event.kbd.keycode = keys[r].character;
+ //event.kbd.ascii = keys[r].character;
event.type = Common::EVENT_KEYDOWN;
system->addEvent(event);
// event.type = Common::EVENT_KEYUP;
// system->addEvent(event);
-
+
switch (keys[r].character) {
case DS_SHIFT: {
DS::shiftState = !DS::shiftState;
DS::setKeyHighlight(r, DS::shiftState);
break;
}
-
+
case DS_CAPSLOCK: {
DS::capsLockState = !DS::capsLockState;
DS::setKeyHighlight(r, DS::capsLockState);
break;
}
-
+
default: {
DS::setKeyHighlight(r, true);
keys[r].pressed = true;
break;
}
}
-
+
}
}
}
-
+
if (DS::getPenReleased()) {
-
+
for (int r = 0; r < DS_NUM_KEYS; r++) {
if (keys[r].pressed) {
DS::setKeyHighlight(r, false);
OSystem_DS* system = OSystem_DS::instance();
-
+
Common::Event event;
if ((keys[r].character == Common::KEYCODE_INVALID)) {
// Close button
@@ -524,7 +524,7 @@ void addKeyboardEvents() {
resetShift = true;
}
}
- }
+ }
}
diff --git a/backends/platform/ds/arm9/source/touchkeyboard.h b/backends/platform/ds/arm9/source/touchkeyboard.h
index 91efbc1e9a..2f9da16ace 100644
--- a/backends/platform/ds/arm9/source/touchkeyboard.h
+++ b/backends/platform/ds/arm9/source/touchkeyboard.h
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
+
#ifndef _TOUCHKEYBOARD_H_
#define _TOUCHKEYBOARD_H_
diff --git a/backends/platform/ds/arm9/source/wordcompletion.cpp b/backends/platform/ds/arm9/source/wordcompletion.cpp
index ff52572a40..54d74c68d5 100644
--- a/backends/platform/ds/arm9/source/wordcompletion.cpp
+++ b/backends/platform/ds/arm9/source/wordcompletion.cpp
@@ -23,7 +23,7 @@ void addAutoCompleteLine(char* line) {
{
char word[32];
int length;
-
+
// Skip the T9-style numbers
while (*line != ' ')
{
@@ -37,7 +37,7 @@ void addAutoCompleteLine(char* line) {
if (*line == ' ') line++;
- // Copy the new word
+ // Copy the new word
do {
word[length++] = *line++;
} while ((*line != '\0') && (*line != ' ') && (*line != '\n'));
@@ -47,7 +47,7 @@ void addAutoCompleteLine(char* line) {
// Store a pointer to the start of the word
wordBufferPtr[wordBufferPtrPos++] = &wordBuffer[wordBufferPos];
-
+
// copy the new word into the buffer
strcpy(&wordBuffer[wordBufferPos], word);
wordBufferPos += strlen(word) + 1;
@@ -70,7 +70,6 @@ void sortAutoCompleteWordList() {
// Sends the current available words to the virtual keyboard code for display
bool findWordCompletions(char* input)
{
- char testWord[32];
int min = 0;
int max = wordBufferPtrPos - 1;
char* word;
@@ -104,11 +103,11 @@ 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);
-
+
if (result == 0) {
// We've found the whole word. Aren't we good.
break;
@@ -128,15 +127,15 @@ bool findWordCompletions(char* input)
word = wordBufferPtr[position];
//consolePrintf("Final word: %s\n", word);
-
+
system->setCharactersEntered(strlen(partialWord));
-
+
bool match = true;
- for (int r = 0; r < strlen(partialWord); r++) {
+ for (int r = 0; partialWord[r] != 0; r++) {
if (word[r] != partialWord[r]) {
match = false;
break;
@@ -155,13 +154,13 @@ bool findWordCompletions(char* input)
do {
- for (int r = 0; r < strlen(partialWord); r++) {
+ for (int r = 0; partialWord[r] != 0; r++) {
if (word[r] != partialWord[r]) {
match = false;
break;
}
}
-
+
if (match) {
system->addAutoComplete(word);
}
diff --git a/backends/platform/ds/arm9/source/zipreader.cpp b/backends/platform/ds/arm9/source/zipreader.cpp
index 01321f44f5..7af0718a44 100644
--- a/backends/platform/ds/arm9/source/zipreader.cpp
+++ b/backends/platform/ds/arm9/source/zipreader.cpp
@@ -17,7 +17,7 @@
* 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.
- *
+ *
*/
@@ -29,25 +29,25 @@
ZipFile::ZipFile() {
// Locate a zip file in cartridge memory space
-
+
// consolePrintf("ZIP file check...");
-
+
char* p = (char *) ZF_SEARCH_START;
bool found = false;
-
+
_zipFile = NULL;
-
+
while ((p != (char *) ZF_SEARCH_END) && (!found)) {
// Zip file header is: 0x504B0304
-
+
if ( (*p == 0x50) && (*(p + 1) == 0x4B) && (*(p + 2) == 0x03) && (*(p + 3) == 0x04) ) {
// Found header!
found = true;
_zipFile = p;
}
-
+
if (!found) p += ZF_SEARCH_STRIDE;
-
+
}
if (_zipFile) {
@@ -56,14 +56,14 @@ ZipFile::ZipFile() {
// consolePrintf("Not in use!\n");
return;
}
-
+
changeToRoot();
restartFile();
-
+
if (_currentFile->compSize != (u32) getFileSize()) {
consolePrintf("Error: ZIP file contains compression!\n");
}
-
+
_allFilesVisible = false;
}
@@ -83,19 +83,19 @@ bool ZipFile::restartFile() {
getFileName(name);
more = skipFile();
}
-
+
return more;
}
bool ZipFile::currentFileInFolder() {
char name[128];
-
+
if (_allFilesVisible) return true;
-
+
getFileName(name);
// consolePrintf("N:'%s'D:'%s'\n", name, _directory);
-
+
if (_directory[0] == 0) { // Root directory
name[strlen(name) - 1] = 0;
return !strchr(name, '\\'); // Not in root if contains a / character before the last character
@@ -104,52 +104,52 @@ bool ZipFile::currentFileInFolder() {
&& (no slashes after the directory || it's the last character)
&& (slash follows directory)
*/
- if ((strstr(name, _directory) == name) && (strlen(name) != strlen(_directory))
+ if ((strstr(name, _directory) == name) && (strlen(name) != strlen(_directory))
&& ((strchr(name + strlen(_directory) + 1, '\\') == NULL)
|| (strchr(name + strlen(_directory) + 1, '\\') == name + strlen(name) - 1))
&& (*(name + strlen(_directory)) == '\\')) {
return true;
}
}
-
+
return false;
}
void ZipFile::getFileName(char* name) {
strncpy(name, (char *) (_currentFile + 1), _currentFile->nameLength);
-
+
for (int r = 0; r < (int) strlen(name); r++) {
if (name[r] == '/') name[r] = '\\';
}
name[_currentFile->nameLength] = 0;
-
+
if (name[strlen(name) - 1] == '\\') {
name[strlen(name) - 1] = 0;
- }
+ }
}
bool ZipFile::skipFile() {
bool valid;
do {
-
+
// Move on to the next file
_currentFile = (FileHeader *) (
((char *) (_currentFile)) + sizeof(*_currentFile) + _currentFile->nameLength + _currentFile->fileSize + _currentFile->extraLength
);
-
+
// Return true if there are more files. Check this by looking for the magic number
valid = (_currentFile->magic[0] == 0x50) &&
(_currentFile->magic[1] == 0x4B) &&
(_currentFile->magic[2] == 0x03) &&
(_currentFile->magic[3] == 0x04);
-
-
+
+
} while (valid && !currentFileInFolder());
-
+
return valid;
-
+
// Currently doesn't handle data descriptors!
}
@@ -180,7 +180,7 @@ char* ZipFile::getFile() {
bool ZipFile::findFile(char* search) {
changeToRoot();
restartFile();
-
+
char searchName[128];
strcpy(searchName, search);
for (int r = 0; r < (int) strlen(searchName); r++) {
@@ -191,15 +191,15 @@ bool ZipFile::findFile(char* search) {
*(searchName + strlen(searchName) - 1) = '\0'; // which we need to dispose of.
}
-
+
do {
char name[128];
getFileName(name);
if (*(name + strlen(name) - 1) == '\\') { // Directories have a terminating slash
*(name + strlen(name) - 1) = '\0'; // which we need to dispose of.
}
-
-
+
+
if (!stricmp(name, searchName)) {
// consolePrintf("'%s'=='%s'\n", name, searchName);
return true; // Got it!
@@ -222,7 +222,7 @@ void ZipFile::changeDirectory(char* dir) {
for (int r = 0; r < (int) strlen(_directory); r++) {
if (_directory[r] == '/') _directory[r] = '\\';
}
-
+
if (_directory[strlen(_directory) - 1] == '\\') {
_directory[strlen(_directory) - 1] = '\0';
}
diff --git a/backends/platform/ds/arm9/source/zipreader.h b/backends/platform/ds/arm9/source/zipreader.h
index 19aa3d9f31..cd7244dba5 100644
--- a/backends/platform/ds/arm9/source/zipreader.h
+++ b/backends/platform/ds/arm9/source/zipreader.h
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
+
#ifndef _ZIPREADER_H_
#define _ZIPREADER_H_
#include "portdefs.h"
@@ -45,9 +45,9 @@ class ZipFile {
char* _zipFile;
char _directory[128];
-
+
bool _allFilesVisible;
-
+
FileHeader* _currentFile;
public:
@@ -55,25 +55,25 @@ public:
~ZipFile();
bool isReady();
-
+
// These operations set the current file
bool restartFile();
bool skipFile();
- bool findFile(char* search);
+ bool findFile(char* search);
// These return the file's data and information
char* getFile();
int getFileSize();
void getFileName(char* name);
bool isDirectory();
-
+
// These set the current directory
void changeDirectory(char* name);
void changeToRoot();
void setAllFilesVisible(bool state) { _allFilesVisible = state; }
-
+
bool currentFileInFolder();
-
+
u16 misaligned16(u16* v);
u32 misaligned32(u32* v);
diff --git a/backends/platform/gp2x/gp2x-common.h b/backends/platform/gp2x/gp2x-common.h
index 92f625bdc4..de305923a0 100644
--- a/backends/platform/gp2x/gp2x-common.h
+++ b/backends/platform/gp2x/gp2x-common.h
@@ -40,11 +40,6 @@ namespace Audio {
class MixerImpl;
}
-namespace Common {
- class SaveFileManager;
- class TimerManager;
-}
-
//#define DISABLE_SCALERS
enum {
@@ -168,11 +163,6 @@ public:
int16 getOverlayHeight() { return _overlayHeight; }
int16 getOverlayWidth() { return _overlayWidth; }
- // Methods that convert RGB to/from colors suitable for the overlay.
- OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b);
- void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b);
-
-
const GraphicsMode *getSupportedGraphicsModes() const;
int getDefaultGraphicsMode() const;
bool setGraphicsMode(int mode);
diff --git a/backends/platform/gp2x/graphics.cpp b/backends/platform/gp2x/graphics.cpp
index 2f16cf7068..7fa0fddeb1 100644
--- a/backends/platform/gp2x/graphics.cpp
+++ b/backends/platform/gp2x/graphics.cpp
@@ -1160,14 +1160,6 @@ void OSystem_GP2X::copyRectToOverlay(const OverlayColor *buf, int pitch, int x,
SDL_UnlockSurface(_overlayscreen);
}
-OverlayColor OSystem_GP2X::RGBToColor(uint8 r, uint8 g, uint8 b) {
- return SDL_MapRGB(_overlayscreen->format, r, g, b);
-}
-
-void OSystem_GP2X::colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) {
- SDL_GetRGB(color, _overlayscreen->format, &r, &g, &b);
-}
-
#pragma mark -
#pragma mark --- Mouse ---
diff --git a/backends/platform/iphone/osys_iphone.cpp b/backends/platform/iphone/osys_iphone.cpp
index 521e91a87e..c9fd0e4dff 100644
--- a/backends/platform/iphone/osys_iphone.cpp
+++ b/backends/platform/iphone/osys_iphone.cpp
@@ -65,11 +65,11 @@ OSystem_IPHONE::OSystem_IPHONE() :
_needEventRestPeriod(false), _mouseClickAndDragEnabled(false), _touchpadModeEnabled(false),
_gestureStartX(-1), _gestureStartY(-1), _fullScreenIsDirty(false),
_mouseDirty(false), _timeSuspended(0), _lastDragPosX(-1), _lastDragPosY(-1)
-
+
{
_queuedInputEvent.type = (Common::EventType)0;
_lastDrawnMouseRect = Common::Rect(0, 0, 0, 0);
-
+
_fsFactory = new POSIXFilesystemFactory();
}
@@ -180,7 +180,7 @@ void OSystem_IPHONE::setPalette(const byte *colors, uint start, uint num) {
const byte *b = colors;
for (uint i = start; i < start + num; ++i) {
- _palette[i] = RGBToColor(b[0], b[1], b[2]);
+ _palette[i] = Graphics::RGBToColor<ColorMasks<565> >(b[0], b[1], b[2]);
b += 4;
}
@@ -693,7 +693,7 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) {
case kInputMouseUp:
if (!handleEvent_mouseUp(event, x, y))
- return false;
+ return false;
break;
case kInputMouseDragged:
@@ -714,7 +714,7 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) {
break;
case kInputOrientationChanged:
- handleEvent_orientationChanged((int)xUnit);
+ handleEvent_orientationChanged((int)xUnit);
return false;
break;
@@ -762,12 +762,12 @@ bool OSystem_IPHONE::handleEvent_mouseDown(Common::Event &event, int x, int y) {
} else {
_lastMouseDown = getMillis();
}
- return false;
+ return false;
}
bool OSystem_IPHONE::handleEvent_mouseUp(Common::Event &event, int x, int y) {
//printf("Mouse up at (%u, %u)\n", x, y);
-
+
if (_secondaryTapped) {
_secondaryTapped = false;
if (!handleEvent_secondMouseUp(event, x, y))
@@ -791,7 +791,7 @@ bool OSystem_IPHONE::handleEvent_mouseUp(Common::Event &event, int x, int y) {
} else
return false;
}
-
+
return true;
}
@@ -850,14 +850,14 @@ bool OSystem_IPHONE::handleEvent_secondMouseUp(Common::Event &event, int x, int
event.mouse.x = _mouseX;
event.mouse.y = _mouseY;
}
-
- return true;
+
+ return true;
}
bool OSystem_IPHONE::handleEvent_mouseDragged(Common::Event &event, int x, int y) {
if (_lastDragPosX == x && _lastDragPosY == y)
return false;
-
+
_lastDragPosX = x;
_lastDragPosY = y;
@@ -927,13 +927,13 @@ bool OSystem_IPHONE::handleEvent_mouseDragged(Common::Event &event, int x, int y
int mouseNewPosY;
if (_touchpadModeEnabled ) {
int deltaX = _lastPadX - x;
- int deltaY = _lastPadY - y;
+ int deltaY = _lastPadY - y;
_lastPadX = x;
_lastPadY = y;
-
+
mouseNewPosX = (int)(_mouseX - deltaX / 0.5f);
mouseNewPosY = (int)(_mouseY - deltaY / 0.5f);
-
+
if (mouseNewPosX < 0)
mouseNewPosX = 0;
else if (mouseNewPosX > _screenWidth)
@@ -943,18 +943,18 @@ bool OSystem_IPHONE::handleEvent_mouseDragged(Common::Event &event, int x, int y
mouseNewPosY = 0;
else if (mouseNewPosY > _screenHeight)
mouseNewPosY = _screenHeight;
-
+
} else {
mouseNewPosX = x;
mouseNewPosY = y;
}
-
+
event.type = Common::EVENT_MOUSEMOVE;
event.mouse.x = mouseNewPosX;
event.mouse.y = mouseNewPosY;
warpMouse(mouseNewPosX, mouseNewPosY);
}
-
+
return true;
}
@@ -986,7 +986,7 @@ void OSystem_IPHONE::handleEvent_orientationChanged(int orientation) {
dirtyFullScreen();
updateScreen();
- }
+ }
}
void OSystem_IPHONE::handleEvent_keyPressed(Common::Event &event, int keyPressed) {
@@ -1047,9 +1047,9 @@ void OSystem_IPHONE::handleEvent_keyPressed(Common::Event &event, int keyPresse
event.kbd.flags = _queuedInputEvent.kbd.flags = 0;
event.kbd.keycode = _queuedInputEvent.kbd.keycode = (Common::KeyCode)keyPressed;
event.kbd.ascii = _queuedInputEvent.kbd.ascii = ascii;
- _needEventRestPeriod = true;
+ _needEventRestPeriod = true;
}
-
+
bool OSystem_IPHONE::handleEvent_swipe(Common::Event &event, int direction) {
Common::KeyCode keycode = Common::KEYCODE_INVALID;
switch (_screenOrientation) {
@@ -1115,7 +1115,7 @@ bool OSystem_IPHONE::handleEvent_swipe(Common::Event &event, int direction) {
_queuedInputEvent.type = Common::EVENT_KEYUP;
event.kbd.flags = _queuedInputEvent.kbd.flags = 0;
_needEventRestPeriod = true;
-
+
return true;
}
@@ -1126,14 +1126,14 @@ void OSystem_IPHONE::suspendLoop() {
uint32 startTime = getMillis();
stopSoundsystem();
-
+
while (!done) {
if (iPhone_fetchEvent(&eventType, &xUnit, &yUnit))
if ((InputEvent)eventType == kInputApplicationResumed)
done = true;
usleep(100000);
}
-
+
startSoundsystem();
_timeSuspended += getMillis() - startTime;
@@ -1238,7 +1238,7 @@ void OSystem_IPHONE::startSoundsystem() {
for (int i = 0; i < AUDIO_BUFFERS; i++) {
if (AudioQueueAllocateBuffer(s_AudioQueue.queue, bufferBytes, &s_AudioQueue.buffers[i])) {
printf("Error allocating AudioQueue buffer!\n");
- _mixer->setReady(false);
+ _mixer->setReady(false);
return;
}
@@ -1248,10 +1248,10 @@ void OSystem_IPHONE::startSoundsystem() {
AudioQueueSetParameter(s_AudioQueue.queue, kAudioQueueParam_Volume, 1.0);
if (AudioQueueStart(s_AudioQueue.queue, NULL)) {
printf("Error starting the AudioQueue!\n");
- _mixer->setReady(false);
+ _mixer->setReady(false);
return;
}
-
+
_mixer->setOutputRate(AUDIO_SAMPLE_RATE);
_mixer->setReady(true);
}
@@ -1312,8 +1312,14 @@ OSystem *OSystem_IPHONE_create() {
return new OSystem_IPHONE();
}
-const char* OSystem_IPHONE::getConfigPath() {
- return SCUMMVM_PREFS_PATH;
+Common::SeekableReadStream *OSystem_IPHONE::openConfigFileForReading() {
+ Common::FSNode file(SCUMMVM_PREFS_PATH);
+ return file.openForReading();
+}
+
+Common::WriteStream *OSystem_IPHONE::openConfigFileForWriting() {
+ Common::FSNode file(SCUMMVM_PREFS_PATH);
+ return file.openForWriting();
}
void iphone_main(int argc, char *argv[]) {
diff --git a/backends/platform/iphone/osys_iphone.h b/backends/platform/iphone/osys_iphone.h
index a9a3ddad65..1f16a8d0c3 100644
--- a/backends/platform/iphone/osys_iphone.h
+++ b/backends/platform/iphone/osys_iphone.h
@@ -143,6 +143,7 @@ public:
virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
virtual int16 getOverlayHeight();
virtual int16 getOverlayWidth();
+ virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<565>(); }
virtual bool showMouse(bool visible);
@@ -177,7 +178,8 @@ public:
void startSoundsystem();
void stopSoundsystem();
- static const char* getConfigPath();
+ virtual Common::SeekableReadStream *openConfigFileForReading();
+ virtual Common::WriteStream *openConfigFileForWriting();
protected:
inline void addDirtyRect(int16 x1, int16 y1, int16 w, int16 h);
@@ -188,17 +190,17 @@ protected:
void suspendLoop();
static void AQBufferCallback(void *in, AudioQueueRef inQ, AudioQueueBufferRef outQB);
static int timerHandler(int t);
-
+
bool handleEvent_swipe(Common::Event &event, int direction);
void handleEvent_keyPressed(Common::Event &event, int keyPressed);
void handleEvent_orientationChanged(int orientation);
bool handleEvent_mouseDown(Common::Event &event, int x, int y);
bool handleEvent_mouseUp(Common::Event &event, int x, int y);
-
+
bool handleEvent_secondMouseDown(Common::Event &event, int x, int y);
bool handleEvent_secondMouseUp(Common::Event &event, int x, int y);
-
+
bool handleEvent_mouseDragged(Common::Event &event, int x, int y);
};
diff --git a/backends/platform/null/null.cpp b/backends/platform/null/null.cpp
index 610f1d3a42..456ee12539 100644
--- a/backends/platform/null/null.cpp
+++ b/backends/platform/null/null.cpp
@@ -91,9 +91,7 @@ public:
virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
virtual int16 getOverlayHeight();
virtual int16 getOverlayWidth();
-
- virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b);
- virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b);
+ virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<565>(); }
virtual bool showMouse(bool visible);
@@ -257,12 +255,6 @@ int16 OSystem_NULL::getOverlayWidth() {
return getWidth();
}
-OverlayColor OSystem_NULL::RGBToColor(uint8 r, uint8 g, uint8 b) {
- return 0;
-}
-
-void OSystem_NULL::colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) {
-}
bool OSystem_NULL::showMouse(bool visible) {
return true;
diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp
index 92ba731433..51c10c10f2 100644
--- a/backends/platform/ps2/Gs2dScreen.cpp
+++ b/backends/platform/ps2/Gs2dScreen.cpp
@@ -149,7 +149,7 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode tvMode) {
_videoMode = tvMode;
printf("Setting up %s mode\n", (_videoMode == TV_PAL) ? "PAL" : "NTSC");
-
+
// set screen size, 640x544 for pal, 640x448 for ntsc
_tvWidth = 640;
_tvHeight = ((_videoMode == TV_PAL) ? 544 : 448);
@@ -175,7 +175,7 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode tvMode) {
_clutPtrs[TEXT] = _clutPtrs[SCREEN] + 0x2000;
_texPtrs[SCREEN] = _clutPtrs[SCREEN] + 0x3000;
_texPtrs[TEXT] = 0; // these buffers are stored in the alpha gaps of the frame buffers
- _texPtrs[MOUSE] = 128 * 256 * 4;
+ _texPtrs[MOUSE] = 128 * 256 * 4;
_texPtrs[PRINTF] = _texPtrs[MOUSE] + M_SIZE * M_SIZE * 4;
_showOverlay = false;
@@ -224,7 +224,7 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode tvMode) {
updateScreen();
createAnimTextures();
-
+
// create anim thread
ee_thread_t animThread, thisThread;
ReferThreadStatus(GetThreadId(), &thisThread);
@@ -636,7 +636,7 @@ void Gs2dScreen::animThread(void) {
do {
WaitSema(g_AnimSema);
} while ((!_systemQuit) && (!g_RunAnim));
-
+
if (_systemQuit)
break;
@@ -761,7 +761,7 @@ const uint32 Gs2dScreen::_binaryClut[16] __attribute__((aligned(64))) = {
GS_RGBA( 0, 0, 0, 0x20), // scrPrintf: semitransparent
GS_RGBA(0xC0, 0xC0, 0xC0, 0), // scrPrintf: red
GS_RGBA(0x16, 0x16, 0xF0, 0), // scrPrintf: blue
-
+
GS_RGBA(0xFF, 0xFF, 0xFF, 0x80), GS_RGBA(0xFF, 0xFF, 0xFF, 0x80), // unused
GS_RGBA(0xFF, 0xFF, 0xFF, 0x80), GS_RGBA(0xFF, 0xFF, 0xFF, 0x80),
GS_RGBA(0xFF, 0xFF, 0xFF, 0x80), GS_RGBA(0xFF, 0xFF, 0xFF, 0x80),
diff --git a/backends/platform/ps2/fileio.cpp b/backends/platform/ps2/fileio.cpp
index b7fa8d03f1..039e309eb9 100644
--- a/backends/platform/ps2/fileio.cpp
+++ b/backends/platform/ps2/fileio.cpp
@@ -355,7 +355,7 @@ FILE *ps2_fopen(const char *fname, const char *mode) {
file = new Ps2McWriteFile((Ps2SaveFileManager *)g_systemPs2->getSavefileManager());
if (file->open(fname + 4)) // + 4 to skip "mc0:"
return (FILE *)file;
-
+
delete file;
return NULL;
} else {
diff --git a/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h b/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h
index f16c7ca12b..bebbe73d6a 100644
--- a/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h
+++ b/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h
@@ -52,7 +52,7 @@ typedef struct _kbd_rawkey {
#define PS2KBD_READMODE_RAW 2
/* Notes on read mode */
-/* In normal readmode (default) read multiples of 1 character off the keyboard file. These are
+/* In normal readmode (default) read multiples of 1 character off the keyboard file. These are
processed by the keymaps so that you get back ASCII data */
/* In raw readmode must read multiples of 2. First byte indicates state (i.e. Up or Down)
Second byte is the USB key code for that key. This table is presented in the USB HID Usage Tables manaual
diff --git a/backends/platform/ps2/iop/rpckbd/src/irx_imports.h b/backends/platform/ps2/iop/rpckbd/src/irx_imports.h
index 6ecc8e5864..41a90a45f0 100644
--- a/backends/platform/ps2/iop/rpckbd/src/irx_imports.h
+++ b/backends/platform/ps2/iop/rpckbd/src/irx_imports.h
@@ -3,7 +3,7 @@
# ____| | ____| | | |____|
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
#-----------------------------------------------------------------------
-# Copyright (c) 2003 Marcus R. Brown <mrbrown@0xd6.org>
+# Copyright (c) 2003 Marcus R. Brown <mrbrown@0xd6.org>
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.
#
diff --git a/backends/platform/ps2/iop/rpckbd/src/us_keymap.h b/backends/platform/ps2/iop/rpckbd/src/us_keymap.h
index 57f0686cd3..6c41e794cb 100644
--- a/backends/platform/ps2/iop/rpckbd/src/us_keymap.h
+++ b/backends/platform/ps2/iop/rpckbd/src/us_keymap.h
@@ -16,8 +16,8 @@
/* Default US keymap */
-u8 us_keymap[PS2KBD_KEYMAP_SIZE] =
- {
+u8 us_keymap[PS2KBD_KEYMAP_SIZE] =
+ {
0,
0,
0,
@@ -83,7 +83,7 @@ u8 us_keymap[PS2KBD_KEYMAP_SIZE] =
0, // F5
0, // F6
0, // F7
- 0, // F8
+ 0, // F8
0, // F9
0, // F10
0, // F11
@@ -92,7 +92,7 @@ u8 us_keymap[PS2KBD_KEYMAP_SIZE] =
0, // Scroll Lock
0, // Pause
0, // Insert
- 0, // Home
+ 0, // Home
0, // Pg Up
0, // Delete
0, // End
@@ -102,7 +102,7 @@ u8 us_keymap[PS2KBD_KEYMAP_SIZE] =
0, // Down
0, // Up
0, // Numlock
- '/', // Keypad
+ '/', // Keypad
'*',
'-',
'+',
@@ -276,7 +276,7 @@ u8 us_keymap[PS2KBD_KEYMAP_SIZE] =
0
};
-u8 us_shiftkeymap[PS2KBD_KEYMAP_SIZE] =
+u8 us_shiftkeymap[PS2KBD_KEYMAP_SIZE] =
{
0,
0,
@@ -343,7 +343,7 @@ u8 us_shiftkeymap[PS2KBD_KEYMAP_SIZE] =
0, // F5
0, // F6
0, // F7
- 0, // F8
+ 0, // F8
0, // F9
0, // F10
0, // F11
@@ -352,7 +352,7 @@ u8 us_shiftkeymap[PS2KBD_KEYMAP_SIZE] =
0, // Scroll Lock
0, // Pause
0, // Insert
- 0, // Home
+ 0, // Home
0, // Pg Up
0, // Delete
0, // End
@@ -362,7 +362,7 @@ u8 us_shiftkeymap[PS2KBD_KEYMAP_SIZE] =
0, // Down
0, // Up
0, // Numlock
- '/', // Keypad
+ '/', // Keypad
'*',
'-',
'+',
@@ -536,7 +536,7 @@ u8 us_shiftkeymap[PS2KBD_KEYMAP_SIZE] =
0
};
-u8 us_keycap[PS2KBD_KEYMAP_SIZE] =
+u8 us_keycap[PS2KBD_KEYMAP_SIZE] =
{
0,
0,
@@ -603,7 +603,7 @@ u8 us_keycap[PS2KBD_KEYMAP_SIZE] =
0, // F5
0, // F6
0, // F7
- 0, // F8
+ 0, // F8
0, // F9
0, // F10
0, // F11
@@ -612,7 +612,7 @@ u8 us_keycap[PS2KBD_KEYMAP_SIZE] =
0, // Scroll Lock
0, // Pause
0, // Insert
- 0, // Home
+ 0, // Home
0, // Pg Up
0, // Delete
0, // End
@@ -622,7 +622,7 @@ u8 us_keycap[PS2KBD_KEYMAP_SIZE] =
0, // Down
0, // Up
0, // Numlock
- 0, // Keypad
+ 0, // Keypad
0,
0,
0,
@@ -796,7 +796,7 @@ u8 us_keycap[PS2KBD_KEYMAP_SIZE] =
0
};
-u8 us_special_keys[PS2KBD_KEYMAP_SIZE] = {
+u8 us_special_keys[PS2KBD_KEYMAP_SIZE] = {
0,
0,
@@ -863,7 +863,7 @@ u8 us_special_keys[PS2KBD_KEYMAP_SIZE] = {
5, // F5
6, // F6
7, // F7
- 8, // F8
+ 8, // F8
9, // F9
10, // F10
11, // F11
@@ -872,7 +872,7 @@ u8 us_special_keys[PS2KBD_KEYMAP_SIZE] = {
33, // Scroll Lock
34, // Pause
35, // Insert
- 36, // Home
+ 36, // Home
37, // Pg Up
38, // Delete
39, // End
@@ -882,7 +882,7 @@ u8 us_special_keys[PS2KBD_KEYMAP_SIZE] = {
43, // Down
44, // Up
0, // Numlock
- 0, // Keypad /
+ 0, // Keypad /
0, // Keypad *
0, // Keypad -
0, // Keypad +
@@ -1056,7 +1056,7 @@ u8 us_special_keys[PS2KBD_KEYMAP_SIZE] = {
0
};
-u8 us_control_map[PS2KBD_KEYMAP_SIZE] = {
+u8 us_control_map[PS2KBD_KEYMAP_SIZE] = {
0,
0,
@@ -1123,7 +1123,7 @@ u8 us_control_map[PS2KBD_KEYMAP_SIZE] = {
0, // F5
0, // F6
0, // F7
- 0, // F8
+ 0, // F8
0, // F9
0, // F10
0, // F11
@@ -1132,7 +1132,7 @@ u8 us_control_map[PS2KBD_KEYMAP_SIZE] = {
0, // Scroll Lock
0, // Pause
0, // Insert
- 0, // Home
+ 0, // Home
0, // Pg Up
0, // Delete
0, // End
@@ -1142,7 +1142,7 @@ u8 us_control_map[PS2KBD_KEYMAP_SIZE] = {
0, // Down
0, // Up
0, // Numlock
- 0, // Keypad
+ 0, // Keypad
0,
0,
0,
@@ -1316,7 +1316,7 @@ u8 us_control_map[PS2KBD_KEYMAP_SIZE] = {
0
};
-u8 us_alt_map[PS2KBD_KEYMAP_SIZE] = {
+u8 us_alt_map[PS2KBD_KEYMAP_SIZE] = {
0,
0,
@@ -1383,7 +1383,7 @@ u8 us_alt_map[PS2KBD_KEYMAP_SIZE] = {
0, // F5
0, // F6
0, // F7
- 0, // F8
+ 0, // F8
0, // F9
0, // F10
0, // F11
@@ -1392,7 +1392,7 @@ u8 us_alt_map[PS2KBD_KEYMAP_SIZE] = {
0, // Scroll Lock
0, // Pause
0, // Insert
- 0, // Home
+ 0, // Home
0, // Pg Up
0, // Delete
0, // End
@@ -1402,7 +1402,7 @@ u8 us_alt_map[PS2KBD_KEYMAP_SIZE] = {
0, // Down
0, // Up
0, // Numlock
- 0, // Keypad
+ 0, // Keypad
0,
0,
0,
diff --git a/backends/platform/ps2/irxboot.cpp b/backends/platform/ps2/irxboot.cpp
index 65d1e243eb..91c45294c6 100644
--- a/backends/platform/ps2/irxboot.cpp
+++ b/backends/platform/ps2/irxboot.cpp
@@ -74,7 +74,7 @@ BootDevice detectBootPath(const char *elfPath, char *bootPath) {
device = OTHER;
sioprintf("elf path: %s, device %d\n", elfPath, device);
-
+
strcpy(bootPath, elfPath);
char *pathPos = bootPath;
@@ -116,7 +116,7 @@ BootDevice detectBootPath(const char *elfPath, char *bootPath) {
return device;
}
-int loadIrxModules(int device, const char *irxPath, IrxReference **modules) {
+int loadIrxModules(int device, const char *irxPath, IrxReference **modules) {
IrxReference *resModules = (IrxReference *)malloc(numIrxFiles * sizeof(IrxReference));
IrxReference *curModule = resModules;
diff --git a/backends/platform/ps2/savefilemgr.cpp b/backends/platform/ps2/savefilemgr.cpp
index 8fbd98e78a..3e93b954c7 100644
--- a/backends/platform/ps2/savefilemgr.cpp
+++ b/backends/platform/ps2/savefilemgr.cpp
@@ -193,7 +193,7 @@ Ps2SaveFileManager::Ps2SaveFileManager(OSystem_PS2 *system, Gs2dScreen *screen)
saveThread.initial_priority = thisThread.current_priority + 1;
saveThread.stack_size = 8 * 1024;
- _autoSaveStack = malloc(saveThread.stack_size);
+ _autoSaveStack = malloc(saveThread.stack_size);
saveThread.stack = _autoSaveStack;
saveThread.func = (void *)runSaveThread;
saveThread.gp_reg = &_gp;
@@ -409,7 +409,7 @@ Common::StringList Ps2SaveFileManager::listSavefiles(const char *regex) {
_mcNeedsUpdate = true;
mcTable *mcEntries = (mcTable*)memalign(64, sizeof(mcTable) * MAX_MC_ENTRIES);
-
+
char temp[256], mcSearchStr[256], *dir, *ext;
strcpy(temp, regex);
dir = strdup(strtok(temp, "."));
@@ -451,7 +451,7 @@ bool Ps2SaveFileManager::removeSavefile(const char *filename) {
char dir[64], name[64], fullPath[128];
- splitPath(filename, dir, name);
+ splitPath(filename, dir, name);
sprintf(fullPath, "/ScummVM-%s/%s", dir, name);
int res = _mc->remove(fullPath);
diff --git a/backends/platform/ps2/savefilemgr.h b/backends/platform/ps2/savefilemgr.h
index 0164d4551b..794c2aeb9c 100644
--- a/backends/platform/ps2/savefilemgr.h
+++ b/backends/platform/ps2/savefilemgr.h
@@ -43,7 +43,7 @@ public:
int read(int fd, void *buf, int size);
int write(int fd, const void *buf, int size);
int mkDir(const char *name);
- int getDir(const char *name, unsigned int mode, int max, void *dest);
+ int getDir(const char *name, unsigned int mode, int max, void *dest);
int getInfo(int *type, int *free, int *format);
int remove(const char *name);
diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp
index d4dd9aedcf..adf519cee3 100644
--- a/backends/platform/ps2/systemps2.cpp
+++ b/backends/platform/ps2/systemps2.cpp
@@ -197,7 +197,7 @@ void OSystem_PS2::startIrxModules(int numModules, IrxReference *modules) {
}
} else
sioprintf("Module \"%s\" wasn't found: %d\n", modules[i].path, modules[i].errorCode);
-
+
if ((modules[i].errorCode < 0) || (res < 0) || (rv < 0)) {
if (!(modules[i].fileRef->flags & OPTIONAL)) {
if (modules[i].errorCode < 0)
@@ -208,7 +208,7 @@ void OSystem_PS2::startIrxModules(int numModules, IrxReference *modules) {
quit();
}
}
-
+
if (modules[i].buffer)
free(modules[i].buffer);
} else {
@@ -283,7 +283,7 @@ OSystem_PS2::OSystem_PS2(const char *elfPath) {
hddPreparePoweroff();
//poweroffInit();
- dbg_printf("romeo : hddPreparePoweroff done\n");
+ dbg_printf("romeo : hddPreparePoweroff done\n");
hddSetUserPoweroffCallback(gluePowerOffCallback, this);
//poweroffSetCallback(gluePowerOffCallback, this);
@@ -464,7 +464,7 @@ bool OSystem_PS2::hddPresent(void) {
}
bool OSystem_PS2::usbMassPresent(void) {
-
+
if (_usbMassLoaded) {
int testFd = fio.dopen("mass:/");
if (testFd >= 0)
@@ -641,16 +641,6 @@ bool OSystem_PS2::pollEvent(Common::Event &event) {
return res;
}
-OverlayColor OSystem_PS2::RGBToColor(uint8 r, uint8 g, uint8 b) {
- return (r >> 3) | ((g >> 3) << 5) | ((b >> 3) << 10);
-}
-
-void OSystem_PS2::colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) {
- r = (color & 0x1F) << 3;
- g = ((color >> 5) & 0x1F) << 3;
- b = ((color >> 10) & 0x1F) << 3;
-}
-
int16 OSystem_PS2::getHeight(void) {
return _screen->getHeight();
}
@@ -680,7 +670,7 @@ void OSystem_PS2::msgPrintf(int millis, char *format, ...) {
while ((*lnEnd) && (*lnEnd != '\n'))
lnEnd++;
*lnEnd = '\0';
-
+
Common::String str(lnSta);
int width = Graphics::g_sysfont.getStringWidth(str);
if (width > maxWidth)
@@ -770,6 +760,7 @@ void OSystem_PS2::quit(void) {
}
void OSystem_PS2::makeConfigPath(char *dest) {
+ // FIXME: Maybe merge this method into openConfigFileForReading/openConfigFileForWriting ?
FILE *handle;
strcpy(dest, "cdfs:/ScummVM.ini");
handle = ps2_fopen(dest, "r");
@@ -783,6 +774,20 @@ void OSystem_PS2::makeConfigPath(char *dest) {
strcpy(dest, "mc0:ScummVM/scummvm.ini");
}
+Common::SeekableReadStream *OSystem_PS2::openConfigFileForReading() {
+ char configFile[MAXPATHLEN];
+ makeConfigPath(configFile);
+ Common::FSNode file(configFile);
+ return file.openForReading();
+}
+
+Common::WriteStream *OSystem_PS2::openConfigFileForWriting() {
+ char configFile[MAXPATHLEN];
+ makeConfigPath(configFile);
+ Common::FSNode file(configFile);
+ return file.openForWriting();
+}
+
bool OSystem_PS2::runningFromHost(void) {
return (_bootDevice == HOST);
}
diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h
index 08975ab2c8..e4ac410caa 100644
--- a/backends/platform/ps2/systemps2.h
+++ b/backends/platform/ps2/systemps2.h
@@ -107,9 +107,10 @@ public:
virtual void quit();
- virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b);
+ virtual Common::SeekableReadStream *openConfigFileForReading();
+ virtual Common::WriteStream *openConfigFileForWriting();
- virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b);
+ virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<555>(); }
virtual Common::SaveFileManager *getSavefileManager();
virtual FilesystemFactory *getFilesystemFactory();
diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp
index 69be0abcb2..72dd05e664 100644
--- a/backends/platform/psp/osys_psp.cpp
+++ b/backends/platform/psp/osys_psp.cpp
@@ -30,7 +30,7 @@
#include "osys_psp.h"
-#include "backends/saves/default/default-saves.h"
+#include "backends/saves/psp/psp-saves.h"
#include "backends/timer/default/default-timer.h"
#include "graphics/surface.h"
#include "graphics/scaler.h"
@@ -98,20 +98,8 @@ OSystem_PSP::~OSystem_PSP() {
void OSystem_PSP::initBackend() {
- _savefile = new DefaultSaveFileManager("ms0:/scummvm_savegames");
-
- const char *savePath = _savefile->getSavePath().c_str();
-
- //check if the save directory exists
- SceUID fd = sceIoDopen(savePath);
- if (fd < 0) {
- //No? then let's create it.
- sceIoMkdir(savePath, 0777);
- } else {
- //it exists, so close it again.
- sceIoDclose(fd);
- }
-
+ _savefile = new PSPSaveFileManager;
+
_timer = new DefaultTimerManager();
setTimerCallback(&timer_handler, 10);
@@ -365,32 +353,6 @@ int16 OSystem_PSP::getOverlayHeight() {
return _overlayHeight;
}
-OverlayColor OSystem_PSP::RGBToColor(uint8 r, uint8 g, uint8 b) {
- return (((r >> 3) & 0x1F) | (((g >> 3) & 0x1F) << 5) | (((b >> 3) & 0x1F) << 10 ) ) | 0x8000;
-}
-
-void OSystem_PSP::colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) {
- r = ((color & 0x1F) << 3);
- g = (((color >> 5) & 0x1F) << 3);
- b = (((color >> 10) & 0x1F) << 3);
-}
-
-OverlayColor OSystem_PSP::ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b) {
- OverlayColor color = RGBToColor(r, g, b);
-
- if (a == 255)
- color |= 0x8000;
-
- return color;
-}
-
-void OSystem_PSP::colorToARGB(OverlayColor color, uint8 &a, uint8 &r, uint8 &g, uint8 &b) {
- colorToRGB(color, r, g, b);
- if (color & 0x8000)
- a = 255;
- else
- a = 0;
-}
void OSystem_PSP::grabPalette(byte *colors, uint start, uint num) {
uint i;
@@ -452,11 +414,9 @@ bool OSystem_PSP::pollEvent(Common::Event &event) {
if (buttonsChanged & (PSP_CTRL_CROSS | PSP_CTRL_CIRCLE | PSP_CTRL_LTRIGGER | PSP_CTRL_RTRIGGER | PSP_CTRL_START | PSP_CTRL_SELECT | PSP_CTRL_SQUARE)) {
if (buttonsChanged & PSP_CTRL_CROSS) {
event.type = (pad.Buttons & PSP_CTRL_CROSS) ? Common::EVENT_LBUTTONDOWN : Common::EVENT_LBUTTONUP;
- }
- else if (buttonsChanged & PSP_CTRL_CIRCLE) {
+ } else if (buttonsChanged & PSP_CTRL_CIRCLE) {
event.type = (pad.Buttons & PSP_CTRL_CIRCLE) ? Common::EVENT_RBUTTONDOWN : Common::EVENT_RBUTTONUP;
- }
- else {
+ } else {
//any of the other buttons.
event.type = buttonsChanged & pad.Buttons ? Common::EVENT_KEYDOWN : Common::EVENT_KEYUP;
event.kbd.flags = 0;
@@ -494,23 +454,23 @@ bool OSystem_PSP::pollEvent(Common::Event &event) {
if (pad.Lx < 100) {
analogStepAmountX = pad.Lx - 100;
- }
- else if (pad.Lx > 155) {
+ } else if (pad.Lx > 155) {
analogStepAmountX = pad.Lx - 155;
}
if (pad.Ly < 100) {
analogStepAmountY = pad.Ly - 100;
- }
- else if (pad.Ly > 155) {
+ } else if (pad.Ly > 155) {
analogStepAmountY = pad.Ly - 155;
}
if (pad.Buttons & PAD_DIR_MASK ||
analogStepAmountX != 0 || analogStepAmountY != 0) {
if (_prevButtons & PAD_DIR_MASK) {
- if (_padAccel < 16) _padAccel++;
- } else _padAccel = 0;
+ if (_padAccel < 16)
+ _padAccel++;
+ } else
+ _padAccel = 0;
_prevButtons = pad.Buttons;
@@ -526,34 +486,38 @@ bool OSystem_PSP::pollEvent(Common::Event &event) {
// If no movement then this has no effect
if (pad.Buttons & PSP_CTRL_TRIANGLE) {
// Fine control mode for analog
- if (analogStepAmountX != 0)
+ if (analogStepAmountX != 0) {
if (analogStepAmountX > 0)
newX += analogStepAmountX - (analogStepAmountX - 1);
else
newX -= -analogStepAmountX - (-analogStepAmountX - 1);
+ }
- if (analogStepAmountY != 0)
+ if (analogStepAmountY != 0) {
if (analogStepAmountY > 0)
newY += analogStepAmountY - (analogStepAmountY - 1);
else
newY -= -analogStepAmountY - (-analogStepAmountY - 1);
- }
- else {
+ }
+ } else {
newX += analogStepAmountX >> ((_screenWidth == 640) ? 2 : 3);
newY += analogStepAmountY >> ((_screenWidth == 640) ? 2 : 3);
}
- if (newX < 0) newX = 0;
- if (newY < 0) newY = 0;
- if (_overlayVisible)
- {
- if (newX >= _overlayWidth) newX = _overlayWidth - 1;
- if (newY >= _overlayHeight) newY = _overlayHeight - 1;
- }
- else
- {
- if (newX >= _screenWidth) newX = _screenWidth - 1;
- if (newY >= _screenHeight) newY = _screenHeight - 1;
+ if (newX < 0)
+ newX = 0;
+ if (newY < 0)
+ newY = 0;
+ if (_overlayVisible) {
+ if (newX >= _overlayWidth)
+ newX = _overlayWidth - 1;
+ if (newY >= _overlayHeight)
+ newY = _overlayHeight - 1;
+ } else {
+ if (newX >= _screenWidth)
+ newX = _screenWidth - 1;
+ if (newY >= _screenHeight)
+ newY = _screenHeight - 1;
}
if ((_mouseX != newX) || (_mouseY != newY)) {
@@ -650,7 +614,7 @@ void OSystem_PSP::setupMixer(void) {
// least on some platforms SDL will lie and claim it did get the rate
// even if it didn't. Probably only happens for "weird" rates, though.
_samplesPerSec = obtained.freq;
-
+
// Tell the mixer that we are ready and start the sound processing
_mixer->setOutputRate(_samplesPerSec);
_mixer->setReady(true);
@@ -677,3 +641,14 @@ void OSystem_PSP::setWindowCaption(const char *caption) {
void OSystem_PSP::displayMessageOnOSD(const char *msg) {
}
+#define PSP_CONFIG_FILE "ms0:/scummvm.ini"
+
+Common::SeekableReadStream *OSystem_PSP::openConfigFileForReading() {
+ Common::FSNode file(PSP_CONFIG_FILE);
+ return file.openForReading();
+}
+
+Common::WriteStream *OSystem_PSP::openConfigFileForWriting() {
+ Common::FSNode file(PSP_CONFIG_FILE);
+ return file.openForWriting();
+}
diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h
index dca6ccb036..d91526e41c 100644
--- a/backends/platform/psp/osys_psp.h
+++ b/backends/platform/psp/osys_psp.h
@@ -107,11 +107,8 @@ public:
virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
virtual int16 getOverlayHeight();
virtual int16 getOverlayWidth();
- virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b);
- virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b);
- virtual OverlayColor ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b);
- virtual void colorToARGB(OverlayColor color, uint8 &a, uint8 &r, uint8 &g, uint8 &b);
virtual void grabPalette(byte *colors, uint start, uint num);
+ virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<1555>(); }
virtual bool showMouse(bool visible);
@@ -145,5 +142,7 @@ public:
virtual void displayMessageOnOSD(const char *msg);
+ virtual Common::SeekableReadStream *openConfigFileForReading();
+ virtual Common::WriteStream *openConfigFileForWriting();
};
diff --git a/backends/platform/psp/osys_psp_gu.cpp b/backends/platform/psp/osys_psp_gu.cpp
index 1aa3bcd438..a388ef55fe 100644
--- a/backends/platform/psp/osys_psp_gu.cpp
+++ b/backends/platform/psp/osys_psp_gu.cpp
@@ -94,22 +94,22 @@ OSystem_PSP_GU::OSystem_PSP_GU() {
//decompress keyboard data
uLongf kbdSize = KBD_DATA_SIZE;
keyboard_letters = (unsigned char *)memalign(16, KBD_DATA_SIZE);
- if (!uncompress((Bytef *)keyboard_letters, &kbdSize, (const Bytef *)keyboard_letters_compressed, size_keyboard_letters_compressed))
+ if (Z_OK != uncompress((Bytef *)keyboard_letters, &kbdSize, (const Bytef *)keyboard_letters_compressed, size_keyboard_letters_compressed))
error("OSystem_PSP_GU: uncompressing keyboard_letters failed");
-
+
kbdSize = KBD_DATA_SIZE;
keyboard_letters_shift = (unsigned char *)memalign(16, KBD_DATA_SIZE);
- if (!uncompress((Bytef *)keyboard_letters_shift, &kbdSize, (const Bytef *)keyboard_letters_shift_compressed, size_keyboard_letters_shift_compressed))
+ if (Z_OK != uncompress((Bytef *)keyboard_letters_shift, &kbdSize, (const Bytef *)keyboard_letters_shift_compressed, size_keyboard_letters_shift_compressed))
error("OSystem_PSP_GU: uncompressing keyboard_letters_shift failed");
kbdSize = KBD_DATA_SIZE;
keyboard_symbols = (unsigned char *)memalign(16, KBD_DATA_SIZE);
- if (!uncompress((Bytef *)keyboard_symbols, &kbdSize, (const Bytef *)keyboard_symbols_compressed, size_keyboard_symbols_compressed))
+ if (Z_OK != uncompress((Bytef *)keyboard_symbols, &kbdSize, (const Bytef *)keyboard_symbols_compressed, size_keyboard_symbols_compressed))
error("OSystem_PSP_GU: uncompressing keyboard_symbols failed");
kbdSize = KBD_DATA_SIZE;
keyboard_symbols_shift = (unsigned char *)memalign(16, KBD_DATA_SIZE);
- if (!uncompress((Bytef *)keyboard_symbols_shift, &kbdSize, (const Bytef *)keyboard_symbols_shift_compressed, size_keyboard_symbols_shift_compressed))
+ if (Z_OK != uncompress((Bytef *)keyboard_symbols_shift, &kbdSize, (const Bytef *)keyboard_symbols_shift_compressed, size_keyboard_symbols_shift_compressed))
error("OSystem_PSP_GU: uncompressing keyboard_symbols_shift failed");
_keyboardVisible = false;
diff --git a/backends/platform/psp/psp_main.cpp b/backends/platform/psp/psp_main.cpp
index 94ef63488d..e01f63973b 100644
--- a/backends/platform/psp/psp_main.cpp
+++ b/backends/platform/psp/psp_main.cpp
@@ -118,8 +118,7 @@ int SetupCallbacks(void) {
}
#undef main
-int main(void)
-{
+int main(void) {
SetupCallbacks();
static char *argv[] = { "scummvm", NULL };
diff --git a/backends/platform/psp/trace.cpp b/backends/platform/psp/trace.cpp
index a4a409d455..00d19b582c 100644
--- a/backends/platform/psp/trace.cpp
+++ b/backends/platform/psp/trace.cpp
@@ -42,9 +42,7 @@ void PSPDebugTrace (const char *format, ...) {
fd = sceIoOpen("MS0:/DTRACE.TXT", PSP_O_RDWR | PSP_O_CREAT | PSP_O_APPEND, 0777);
if (fd <= 0)
- {
return;
- }
sceIoWrite(fd, (const void*)buff, bufsz);
sceIoClose(fd);
@@ -64,12 +62,9 @@ void PSPDebugTrace (const char * filename, const char *format, ...) {
fd = sceIoOpen(filename, PSP_O_RDWR | PSP_O_CREAT | PSP_O_APPEND, 0777);
if (fd <= 0)
- {
return;
- }
sceIoWrite(fd, (const void*)buff, bufsz);
sceIoClose(fd);
#endif
}
-
diff --git a/backends/platform/sdl/events.cpp b/backends/platform/sdl/events.cpp
index 7a4ccb6e87..7eb86d6c24 100644
--- a/backends/platform/sdl/events.cpp
+++ b/backends/platform/sdl/events.cpp
@@ -78,9 +78,9 @@ void OSystem_SDL::fillMouseEvent(Common::Event &event, int x, int y) {
// Adjust for the screen scaling
if (!_overlayVisible) {
- event.mouse.x /= _scaleFactor;
- event.mouse.y /= _scaleFactor;
- if (_adjustAspectRatio)
+ event.mouse.x /= _videoMode.scaleFactor;
+ event.mouse.y /= _videoMode.scaleFactor;
+ if (_videoMode.aspectRatio)
event.mouse.y = aspect2Real(event.mouse.y);
}
}
@@ -184,7 +184,6 @@ bool OSystem_SDL::pollEvent(Common::Event &event) {
if (_modeChanged) {
_modeChanged = false;
event.type = Common::EVENT_SCREEN_CHANGED;
- _screenChangeCount++;
return true;
}
@@ -197,10 +196,10 @@ bool OSystem_SDL::pollEvent(Common::Event &event) {
if (b == Common::KBD_ALT && (ev.key.keysym.sym == SDLK_RETURN
|| ev.key.keysym.sym == SDLK_KP_ENTER)) {
beginGFXTransaction();
- setFullscreenMode(!_fullscreen);
+ setFullscreenMode(!_videoMode.fullscreen);
endGFXTransaction();
#ifdef USE_OSD
- if (_fullscreen)
+ if (_videoMode.fullscreen)
displayMessageOnOSD("Fullscreen mode");
else
displayMessageOnOSD("Windowed mode");
diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp
index 96b74ecba7..cda14a24ad 100644
--- a/backends/platform/sdl/graphics.cpp
+++ b/backends/platform/sdl/graphics.cpp
@@ -49,7 +49,7 @@ static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
};
// Table of relative scalers magnitudes
-// [definedScale - 1][_scaleFactor - 1]
+// [definedScale - 1][scaleFactor - 1]
static ScalerProc *scalersMagn[3][3] = {
#ifndef DISABLE_SCALERS
{ Normal1x, AdvMame2x, AdvMame3x },
@@ -86,122 +86,161 @@ int OSystem_SDL::getDefaultGraphicsMode() const {
}
void OSystem_SDL::beginGFXTransaction(void) {
- assert (_transactionMode == kTransactionNone);
+ assert(_transactionMode == kTransactionNone);
_transactionMode = kTransactionActive;
- _transactionDetails.modeChanged = false;
_transactionDetails.sizeChanged = false;
- _transactionDetails.arChanged = false;
- _transactionDetails.fsChanged = false;
_transactionDetails.needHotswap = false;
_transactionDetails.needUpdatescreen = false;
- _transactionDetails.needUnload = false;
_transactionDetails.normal1xScaler = false;
+
+ _oldVideoMode = _videoMode;
}
-void OSystem_SDL::endGFXTransaction(void) {
- // for each engine we run initCommonGFX() as first thing in the transaction
- // and initSize() is called later. If user runs launcher at 320x200 with
- // 2x overlay, setting to Nomral1x sclaler in that case will be suppressed
- // and backend is forced to 2x
- //
- // This leads to bad results such as 1280x960 window for 640x480 engines.
- // To prevent that we rerun setGraphicsMode() if there was 1x scaler request
- if (_transactionDetails.normal1xScaler)
- setGraphicsMode(GFX_NORMAL);
+OSystem::TransactionError OSystem_SDL::endGFXTransaction(void) {
+ int errors = kTransactionSuccess;
+
+ assert(_transactionMode != kTransactionNone);
+
+ if (_transactionMode == kTransactionRollback) {
+ if (_videoMode.fullscreen != _oldVideoMode.fullscreen) {
+ errors |= kTransactionFullscreenFailed;
- assert (_transactionMode == kTransactionActive);
+ _videoMode.fullscreen = _oldVideoMode.fullscreen;
+ } else if (_videoMode.aspectRatio != _oldVideoMode.aspectRatio) {
+ errors |= kTransactionAspectRatioFailed;
- _transactionMode = kTransactionCommit;
- if (_transactionDetails.modeChanged)
- setGraphicsMode(_transactionDetails.mode);
+ _videoMode.aspectRatio = _oldVideoMode.aspectRatio;
+ } else if (_videoMode.mode != _oldVideoMode.mode) {
+ errors |= kTransactionModeSwitchFailed;
- if (_transactionDetails.sizeChanged)
- initSize(_transactionDetails.w, _transactionDetails.h);
+ _videoMode.mode = _oldVideoMode.mode;
+ _videoMode.scaleFactor = _oldVideoMode.scaleFactor;
+ } else if (_videoMode.screenWidth != _oldVideoMode.screenWidth || _videoMode.screenHeight != _oldVideoMode.screenHeight) {
+ errors |= kTransactionSizeChangeFailed;
- if (_transactionDetails.arChanged)
- setAspectRatioCorrection(_transactionDetails.ar);
+ _videoMode.screenWidth = _oldVideoMode.screenWidth;
+ _videoMode.screenHeight = _oldVideoMode.screenHeight;
+ _videoMode.overlayWidth = _oldVideoMode.overlayWidth;
+ _videoMode.overlayHeight = _oldVideoMode.overlayHeight;
+ }
+
+ if (_videoMode.fullscreen == _oldVideoMode.fullscreen &&
+ _videoMode.aspectRatio == _oldVideoMode.aspectRatio &&
+ _videoMode.mode == _oldVideoMode.mode &&
+ _videoMode.screenWidth == _oldVideoMode.screenWidth &&
+ _videoMode.screenHeight == _oldVideoMode.screenHeight) {
+
+ // Our new video mode would now be exactly the same as the
+ // old one. Since we still can not assume SDL_SetVideoMode
+ // to be working fine, we need to invalidate the old video
+ // mode, so loadGFXMode would error out properly.
+ _oldVideoMode.setup = false;
+ }
+ }
- if (_transactionDetails.needUnload) {
+ if (_transactionDetails.sizeChanged) {
unloadGFXMode();
- loadGFXMode();
- clearOverlay();
- } else {
- if (!_transactionDetails.fsChanged) {
- if (_transactionDetails.needHotswap)
- hotswapGFXMode();
- else if (_transactionDetails.needUpdatescreen)
+ if (!loadGFXMode()) {
+ if (_oldVideoMode.setup) {
+ _transactionMode = kTransactionRollback;
+ errors |= endGFXTransaction();
+ }
+ } else {
+ setGraphicsModeIntern();
+ clearOverlay();
+
+ _videoMode.setup = true;
+ _modeChanged = true;
+ // OSystem_SDL::pollEvent used to update the screen change count,
+ // but actually it gives problems when a video mode was changed
+ // but OSystem_SDL::pollEvent was not called. This for example
+ // caused a crash under certain circumstances when doing an RTL.
+ // To fix this issue we update the screen change count right here.
+ _screenChangeCount++;
+ }
+ } else if (_transactionDetails.needHotswap) {
+ setGraphicsModeIntern();
+ if (!hotswapGFXMode()) {
+ if (_oldVideoMode.setup) {
+ _transactionMode = kTransactionRollback;
+ errors |= endGFXTransaction();
+ }
+ } else {
+ _videoMode.setup = true;
+ _modeChanged = true;
+ // OSystem_SDL::pollEvent used to update the screen change count,
+ // but actually it gives problems when a video mode was changed
+ // but OSystem_SDL::pollEvent was not called. This for example
+ // caused a crash under certain circumstances when doing an RTL.
+ // To fix this issue we update the screen change count right here.
+ _screenChangeCount++;
+
+ if (_transactionDetails.needUpdatescreen)
internUpdateScreen();
}
+ } else if (_transactionDetails.needUpdatescreen) {
+ setGraphicsModeIntern();
+ internUpdateScreen();
}
- if (_transactionDetails.fsChanged)
- setFullscreenMode(_transactionDetails.fs);
-
_transactionMode = kTransactionNone;
+ return (TransactionError)errors;
}
bool OSystem_SDL::setGraphicsMode(int mode) {
Common::StackLock lock(_graphicsMutex);
+ assert(_transactionMode == kTransactionActive);
+
+ if (_oldVideoMode.setup && _oldVideoMode.mode == mode)
+ return true;
+
int newScaleFactor = 1;
- ScalerProc *newScalerProc;
switch(mode) {
case GFX_NORMAL:
newScaleFactor = 1;
- newScalerProc = Normal1x;
break;
#ifndef DISABLE_SCALERS
case GFX_DOUBLESIZE:
newScaleFactor = 2;
- newScalerProc = Normal2x;
break;
case GFX_TRIPLESIZE:
newScaleFactor = 3;
- newScalerProc = Normal3x;
break;
case GFX_2XSAI:
newScaleFactor = 2;
- newScalerProc = _2xSaI;
break;
case GFX_SUPER2XSAI:
newScaleFactor = 2;
- newScalerProc = Super2xSaI;
break;
case GFX_SUPEREAGLE:
newScaleFactor = 2;
- newScalerProc = SuperEagle;
break;
case GFX_ADVMAME2X:
newScaleFactor = 2;
- newScalerProc = AdvMame2x;
break;
case GFX_ADVMAME3X:
newScaleFactor = 3;
- newScalerProc = AdvMame3x;
break;
#ifndef DISABLE_HQ_SCALERS
case GFX_HQ2X:
newScaleFactor = 2;
- newScalerProc = HQ2x;
break;
case GFX_HQ3X:
newScaleFactor = 3;
- newScalerProc = HQ3x;
break;
#endif
case GFX_TV2X:
newScaleFactor = 2;
- newScalerProc = TV2x;
break;
case GFX_DOTMATRIX:
newScaleFactor = 2;
- newScalerProc = DotMatrix;
break;
#endif // DISABLE_SCALERS
@@ -211,47 +250,81 @@ bool OSystem_SDL::setGraphicsMode(int mode) {
}
_transactionDetails.normal1xScaler = (mode == GFX_NORMAL);
+ if (_oldVideoMode.setup && _oldVideoMode.scaleFactor != newScaleFactor)
+ _transactionDetails.needHotswap = true;
- _mode = mode;
- _scalerProc = newScalerProc;
+ _transactionDetails.needUpdatescreen = true;
- if (_transactionMode == kTransactionActive) {
- _transactionDetails.mode = mode;
- _transactionDetails.modeChanged = true;
+ _videoMode.mode = mode;
+ _videoMode.scaleFactor = newScaleFactor;
- if (newScaleFactor != _scaleFactor) {
- _transactionDetails.needHotswap = true;
- _scaleFactor = newScaleFactor;
- }
+ return true;
+}
- _transactionDetails.needUpdatescreen = true;
+void OSystem_SDL::setGraphicsModeIntern() {
+ Common::StackLock lock(_graphicsMutex);
+ ScalerProc *newScalerProc = 0;
- return true;
- }
+ switch (_videoMode.mode) {
+ case GFX_NORMAL:
+ newScalerProc = Normal1x;
+ break;
+#ifndef DISABLE_SCALERS
+ case GFX_DOUBLESIZE:
+ newScalerProc = Normal2x;
+ break;
+ case GFX_TRIPLESIZE:
+ newScalerProc = Normal3x;
+ break;
- // NOTE: This should not be executed at transaction commit
- // Otherwise there is some unsolicited setGraphicsMode() call
- // which should be properly removed
- if (newScaleFactor != _scaleFactor) {
- assert(_transactionMode != kTransactionCommit);
+ case GFX_2XSAI:
+ newScalerProc = _2xSaI;
+ break;
+ case GFX_SUPER2XSAI:
+ newScalerProc = Super2xSaI;
+ break;
+ case GFX_SUPEREAGLE:
+ newScalerProc = SuperEagle;
+ break;
+ case GFX_ADVMAME2X:
+ newScalerProc = AdvMame2x;
+ break;
+ case GFX_ADVMAME3X:
+ newScalerProc = AdvMame3x;
+ break;
+#ifndef DISABLE_HQ_SCALERS
+ case GFX_HQ2X:
+ newScalerProc = HQ2x;
+ break;
+ case GFX_HQ3X:
+ newScalerProc = HQ3x;
+ break;
+#endif
+ case GFX_TV2X:
+ newScalerProc = TV2x;
+ break;
+ case GFX_DOTMATRIX:
+ newScalerProc = DotMatrix;
+ break;
+#endif // DISABLE_SCALERS
- _scaleFactor = newScaleFactor;
- hotswapGFXMode();
+ default:
+ error("Unknown gfx mode %d", _videoMode.mode);
}
- // Determine the "scaler type", i.e. essentially an index into the
- // s_gfxModeSwitchTable array defined in events.cpp.
- if (_mode != GFX_NORMAL) {
+ _scalerProc = newScalerProc;
+
+ if (_videoMode.mode != GFX_NORMAL) {
for (int i = 0; i < ARRAYSIZE(s_gfxModeSwitchTable); i++) {
- if (s_gfxModeSwitchTable[i][1] == _mode || s_gfxModeSwitchTable[i][2] == _mode) {
+ if (s_gfxModeSwitchTable[i][1] == _videoMode.mode || s_gfxModeSwitchTable[i][2] == _videoMode.mode) {
_scalerType = i;
break;
}
}
}
- if (!_screen)
- return true;
+ if (!_screen || !_hwscreen)
+ return;
// Blit everything to the screen
_forceFull = true;
@@ -259,81 +332,58 @@ bool OSystem_SDL::setGraphicsMode(int mode) {
// Even if the old and new scale factors are the same, we may have a
// different scaler for the cursor now.
blitCursor();
-
- if (_transactionMode != kTransactionCommit)
- internUpdateScreen();
-
- // Make sure that an Common::EVENT_SCREEN_CHANGED gets sent later
- _modeChanged = true;
-
- return true;
}
int OSystem_SDL::getGraphicsMode() const {
assert (_transactionMode == kTransactionNone);
- return _mode;
+ return _videoMode.mode;
}
void OSystem_SDL::initSize(uint w, uint h) {
+ assert(_transactionMode == kTransactionActive);
+
// Avoid redundant res changes
- if ((int)w == _screenWidth && (int)h == _screenHeight &&
- _transactionMode != kTransactionCommit)
+ if ((int)w == _videoMode.screenWidth && (int)h == _videoMode.screenHeight)
return;
- _screenWidth = w;
- _screenHeight = h;
+ _videoMode.screenWidth = w;
+ _videoMode.screenHeight = h;
- _cksumNum = (_screenWidth * _screenHeight / (8 * 8));
+ _cksumNum = (w * h / (8 * 8));
- if (_transactionMode == kTransactionActive) {
- _transactionDetails.w = w;
- _transactionDetails.h = h;
- _transactionDetails.sizeChanged = true;
-
- _transactionDetails.needUnload = true;
-
- return;
- }
+ _transactionDetails.sizeChanged = true;
free(_dirtyChecksums);
_dirtyChecksums = (uint32 *)calloc(_cksumNum * 2, sizeof(uint32));
-
- if (_transactionMode != kTransactionCommit) {
- unloadGFXMode();
- loadGFXMode();
-
- // if initSize() gets called in the middle, overlay is not transparent
- clearOverlay();
- }
}
-void OSystem_SDL::loadGFXMode() {
+bool OSystem_SDL::loadGFXMode() {
assert(_inited);
_forceFull = true;
int hwW, hwH;
#ifndef __MAEMO__
- _overlayWidth = _screenWidth * _scaleFactor;
- _overlayHeight = _screenHeight * _scaleFactor;
+ _videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
+ _videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
- if (_screenHeight != 200 && _screenHeight != 400)
- _adjustAspectRatio = false;
+ if (_videoMode.screenHeight != 200 && _videoMode.screenHeight != 400)
+ _videoMode.aspectRatio = false;
- if (_adjustAspectRatio)
- _overlayHeight = real2Aspect(_overlayHeight);
+ if (_videoMode.aspectRatio)
+ _videoMode.overlayHeight = real2Aspect(_videoMode.overlayHeight);
- hwW = _screenWidth * _scaleFactor;
+ hwW = _videoMode.screenWidth * _videoMode.scaleFactor;
hwH = effectiveScreenHeight();
#else
- hwW = _overlayWidth;
- hwH = _overlayHeight;
+ hwW = _videoMode.overlayWidth;
+ hwH = _videoMode.overlayHeight;
#endif
//
// Create the surface that contains the 8 bit game data
//
- _screen = SDL_CreateRGBSurface(SDL_SWSURFACE, _screenWidth, _screenHeight, 8, 0, 0, 0, 0);
+ _screen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.screenWidth, _videoMode.screenHeight, 8, 0, 0, 0, 0);
if (_screen == NULL)
error("allocating _screen failed");
@@ -342,27 +392,18 @@ void OSystem_SDL::loadGFXMode() {
//
_hwscreen = SDL_SetVideoMode(hwW, hwH, 16,
- _fullscreen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE
+ _videoMode.fullscreen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE
);
if (_hwscreen == NULL) {
// DON'T use error(), as this tries to bring up the debug
// console, which WON'T WORK now that _hwscreen is hosed.
- // FIXME: We should be able to continue the game without
- // shutting down or bringing up the debug console, but at
- // this point we've already screwed up all our member vars.
- // We need to find a way to call SDL_SetVideoMode *before*
- // that happens and revert to all the old settings if we
- // can't pull off the switch to the new settings.
- //
- // Fingolfin says: the "easy" way to do that is not to modify
- // the member vars before we are sure everything is fine. Think
- // of "transactions, commit, rollback" style... we use local vars
- // in place of the member vars, do everything etc. etc.. In case
- // of a failure, rollback is trivial. Only if everything worked fine
- // do we "commit" the changed values to the member vars.
- warning("SDL_SetVideoMode says we can't switch to that mode (%s)", SDL_GetError());
- quit();
+ if (!_oldVideoMode.setup) {
+ warning("SDL_SetVideoMode says we can't switch to that mode (%s)", SDL_GetError());
+ quit();
+ } else {
+ return false;
+ }
}
//
@@ -376,7 +417,7 @@ void OSystem_SDL::loadGFXMode() {
InitScalers(565);
// Need some extra bytes around when using 2xSaI
- _tmpscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _screenWidth + 3, _screenHeight + 3,
+ _tmpscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.screenWidth + 3, _videoMode.screenHeight + 3,
16,
_hwscreen->format->Rmask,
_hwscreen->format->Gmask,
@@ -386,7 +427,7 @@ void OSystem_SDL::loadGFXMode() {
if (_tmpscreen == NULL)
error("allocating _tmpscreen failed");
- _overlayscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _overlayWidth, _overlayHeight,
+ _overlayscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.overlayWidth, _videoMode.overlayHeight,
16,
_hwscreen->format->Rmask,
_hwscreen->format->Gmask,
@@ -396,7 +437,19 @@ void OSystem_SDL::loadGFXMode() {
if (_overlayscreen == NULL)
error("allocating _overlayscreen failed");
- _tmpscreen2 = SDL_CreateRGBSurface(SDL_SWSURFACE, _overlayWidth + 3, _overlayHeight + 3,
+ _overlayFormat.bytesPerPixel = _overlayscreen->format->BytesPerPixel;
+
+ _overlayFormat.rLoss = _overlayscreen->format->Rloss;
+ _overlayFormat.gLoss = _overlayscreen->format->Gloss;
+ _overlayFormat.bLoss = _overlayscreen->format->Bloss;
+ _overlayFormat.aLoss = _overlayscreen->format->Aloss;
+
+ _overlayFormat.rShift = _overlayscreen->format->Rshift;
+ _overlayFormat.gShift = _overlayscreen->format->Gshift;
+ _overlayFormat.bShift = _overlayscreen->format->Bshift;
+ _overlayFormat.aShift = _overlayscreen->format->Ashift;
+
+ _tmpscreen2 = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.overlayWidth + 3, _videoMode.overlayHeight + 3,
16,
_hwscreen->format->Rmask,
_hwscreen->format->Gmask,
@@ -421,10 +474,12 @@ void OSystem_SDL::loadGFXMode() {
#endif
// keyboard cursor control, some other better place for it?
- _km.x_max = _screenWidth * _scaleFactor - 1;
+ _km.x_max = _videoMode.screenWidth * _videoMode.scaleFactor - 1;
_km.y_max = effectiveScreenHeight() - 1;
_km.delay_time = 25;
_km.last_time = 0;
+
+ return true;
}
void OSystem_SDL::unloadGFXMode() {
@@ -462,28 +517,37 @@ void OSystem_SDL::unloadGFXMode() {
DestroyScalers();
}
-void OSystem_SDL::hotswapGFXMode() {
+bool OSystem_SDL::hotswapGFXMode() {
if (!_screen)
- return;
+ return false;
// Keep around the old _screen & _overlayscreen so we can restore the screen data
// after the mode switch.
SDL_Surface *old_screen = _screen;
SDL_Surface *old_overlayscreen = _overlayscreen;
+ _screen = NULL;
+ _overlayscreen = NULL;
// Release the HW screen surface
- SDL_FreeSurface(_hwscreen);
+ SDL_FreeSurface(_hwscreen); _hwscreen = NULL;
- SDL_FreeSurface(_tmpscreen);
- SDL_FreeSurface(_tmpscreen2);
+ SDL_FreeSurface(_tmpscreen); _tmpscreen = NULL;
+ SDL_FreeSurface(_tmpscreen2); _tmpscreen2 = NULL;
#ifdef USE_OSD
// Release the OSD surface
- SDL_FreeSurface(_osdSurface);
+ SDL_FreeSurface(_osdSurface); _osdSurface = NULL;
#endif
// Setup the new GFX mode
- loadGFXMode();
+ if (!loadGFXMode()) {
+ unloadGFXMode();
+
+ _screen = old_screen;
+ _overlayscreen = old_overlayscreen;
+
+ return false;
+ }
// reset palette
SDL_SetColors(_screen, _currentPalette, 0, 256);
@@ -502,8 +566,7 @@ void OSystem_SDL::hotswapGFXMode() {
// Blit everything to the screen
internUpdateScreen();
- // Make sure that an Common::EVENT_SCREEN_CHANGED gets sent later
- _modeChanged = true;
+ return true;
}
void OSystem_SDL::updateScreen() {
@@ -527,9 +590,9 @@ void OSystem_SDL::internUpdateScreen() {
// If the shake position changed, fill the dirty area with blackness
if (_currentShakePos != _newShakePos) {
- SDL_Rect blackrect = {0, 0, _screenWidth * _scaleFactor, _newShakePos * _scaleFactor};
+ SDL_Rect blackrect = {0, 0, _videoMode.screenWidth * _videoMode.scaleFactor, _newShakePos * _videoMode.scaleFactor};
- if (_adjustAspectRatio && !_overlayVisible)
+ if (_videoMode.aspectRatio && !_overlayVisible)
blackrect.h = real2Aspect(blackrect.h - 1) + 1;
SDL_FillRect(_hwscreen, &blackrect, 0);
@@ -574,15 +637,15 @@ void OSystem_SDL::internUpdateScreen() {
if (!_overlayVisible) {
origSurf = _screen;
srcSurf = _tmpscreen;
- width = _screenWidth;
- height = _screenHeight;
+ width = _videoMode.screenWidth;
+ height = _videoMode.screenHeight;
scalerProc = _scalerProc;
- scale1 = _scaleFactor;
+ scale1 = _videoMode.scaleFactor;
} else {
origSurf = _overlayscreen;
srcSurf = _tmpscreen2;
- width = _overlayWidth;
- height = _overlayHeight;
+ width = _videoMode.overlayWidth;
+ height = _videoMode.overlayHeight;
scalerProc = Normal1x;
scale1 = 1;
@@ -635,7 +698,7 @@ void OSystem_SDL::internUpdateScreen() {
orig_dst_y = dst_y;
dst_y = dst_y * scale1;
- if (_adjustAspectRatio && !_overlayVisible)
+ if (_videoMode.aspectRatio && !_overlayVisible)
dst_y = real2Aspect(dst_y);
assert(scalerProc != NULL);
@@ -649,7 +712,7 @@ void OSystem_SDL::internUpdateScreen() {
r->h = dst_h * scale1;
#ifndef DISABLE_SCALERS
- if (_adjustAspectRatio && orig_dst_y < height && !_overlayVisible)
+ if (_videoMode.aspectRatio && orig_dst_y < height && !_overlayVisible)
r->h = stretch200To240((uint8 *) _hwscreen->pixels, dstPitch, r->w, r->h, r->x, r->y, orig_dst_y * scale1);
#endif
}
@@ -691,52 +754,25 @@ bool OSystem_SDL::saveScreenshot(const char *filename) {
void OSystem_SDL::setFullscreenMode(bool enable) {
Common::StackLock lock(_graphicsMutex);
-
- if (_fullscreen == enable)
- return;
- if (_transactionMode == kTransactionCommit) {
- assert(_hwscreen != 0);
- _fullscreen = enable;
-
- // Switch between fullscreen and windowed mode by invoking hotswapGFXMode().
- // We used to use SDL_WM_ToggleFullScreen() in the past, but this caused various
- // problems. E.g. on OS X, it was implemented incorrectly for a long time; on
- // the MAEMO platform, it seems to have caused problems, too.
- // And on Linux, there were some troubles, too (see bug #1705410).
- // So, we just do it "manually" now. There shouldn't be any drawbacks to that
- // anyway.
- hotswapGFXMode();
- } else if (_transactionMode == kTransactionActive) {
- _transactionDetails.fs = enable;
- _transactionDetails.fsChanged = true;
+ if (_oldVideoMode.setup && _oldVideoMode.fullscreen == enable)
+ return;
+ if (_transactionMode == kTransactionActive) {
+ _videoMode.fullscreen = enable;
_transactionDetails.needHotswap = true;
}
}
void OSystem_SDL::setAspectRatioCorrection(bool enable) {
- if (((_screenHeight == 200 || _screenHeight == 400) && _adjustAspectRatio != enable) ||
- _transactionMode == kTransactionCommit) {
- Common::StackLock lock(_graphicsMutex);
-
- //assert(_hwscreen != 0);
- _adjustAspectRatio = enable;
-
- if (_transactionMode == kTransactionActive) {
- _transactionDetails.ar = enable;
- _transactionDetails.arChanged = true;
-
- _transactionDetails.needHotswap = true;
+ Common::StackLock lock(_graphicsMutex);
- return;
- } else {
- if (_transactionMode != kTransactionCommit)
- hotswapGFXMode();
- }
+ if (_oldVideoMode.setup && _oldVideoMode.aspectRatio == enable)
+ return;
- // Make sure that an Common::EVENT_SCREEN_CHANGED gets sent later
- _modeChanged = true;
+ if (_transactionMode == kTransactionActive) {
+ _videoMode.aspectRatio = enable;
+ _transactionDetails.needHotswap = true;
}
}
@@ -751,13 +787,13 @@ void OSystem_SDL::copyRectToScreen(const byte *src, int pitch, int x, int y, int
Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends
- assert(x >= 0 && x < _screenWidth);
- assert(y >= 0 && y < _screenHeight);
- assert(h > 0 && y + h <= _screenHeight);
- assert(w > 0 && x + w <= _screenWidth);
+ assert(x >= 0 && x < _videoMode.screenWidth);
+ assert(y >= 0 && y < _videoMode.screenHeight);
+ assert(h > 0 && y + h <= _videoMode.screenHeight);
+ assert(w > 0 && x + w <= _videoMode.screenWidth);
- if (((long)src & 3) == 0 && pitch == _screenWidth && x == 0 && y == 0 &&
- w == _screenWidth && h == _screenHeight && _modeFlags & DF_WANT_RECT_OPTIM) {
+ if (((long)src & 3) == 0 && pitch == _videoMode.screenWidth && x == 0 && y == 0 &&
+ w == _videoMode.screenWidth && h == _videoMode.screenHeight && _modeFlags & DF_WANT_RECT_OPTIM) {
/* Special, optimized case for full screen updates.
* It tries to determine what areas were actually changed,
* and just updates those, on the actual display. */
@@ -776,12 +812,12 @@ void OSystem_SDL::copyRectToScreen(const byte *src, int pitch, int x, int y, int
y = 0;
}
- if (w > _screenWidth - x) {
- w = _screenWidth - x;
+ if (w > _videoMode.screenWidth - x) {
+ w = _videoMode.screenWidth - x;
}
- if (h > _screenHeight - y) {
- h = _screenHeight - y;
+ if (h > _videoMode.screenHeight - y) {
+ h = _videoMode.screenHeight - y;
}
if (w <= 0 || h <= 0)
@@ -795,15 +831,15 @@ void OSystem_SDL::copyRectToScreen(const byte *src, int pitch, int x, int y, int
if (SDL_LockSurface(_screen) == -1)
error("SDL_LockSurface failed: %s", SDL_GetError());
- byte *dst = (byte *)_screen->pixels + y * _screenWidth + x;
+ byte *dst = (byte *)_screen->pixels + y * _videoMode.screenWidth + x;
- if (_screenWidth == pitch && pitch == w) {
+ if (_videoMode.screenWidth == pitch && pitch == w) {
memcpy(dst, src, h*w);
} else {
do {
memcpy(dst, src, w);
src += pitch;
- dst += _screenWidth;
+ dst += _videoMode.screenWidth;
} while (--h);
}
@@ -863,11 +899,11 @@ void OSystem_SDL::addDirtyRect(int x, int y, int w, int h, bool realCoordinates)
int height, width;
if (!_overlayVisible && !realCoordinates) {
- width = _screenWidth;
- height = _screenHeight;
+ width = _videoMode.screenWidth;
+ height = _videoMode.screenHeight;
} else {
- width = _overlayWidth;
- height = _overlayHeight;
+ width = _videoMode.overlayWidth;
+ height = _videoMode.overlayHeight;
}
// Extend the dirty region by 1 pixel for scalers
@@ -899,7 +935,7 @@ void OSystem_SDL::addDirtyRect(int x, int y, int w, int h, bool realCoordinates)
}
#ifndef DISABLE_SCALERS
- if (_adjustAspectRatio && !_overlayVisible && !realCoordinates) {
+ if (_videoMode.aspectRatio && !_overlayVisible && !realCoordinates) {
makeRectStretchable(x, y, w, h);
}
#endif
@@ -924,14 +960,14 @@ void OSystem_SDL::makeChecksums(const byte *buf) {
assert(buf);
uint32 *sums = _dirtyChecksums;
uint x,y;
- const uint last_x = (uint)_screenWidth / 8;
- const uint last_y = (uint)_screenHeight / 8;
+ const uint last_x = (uint)_videoMode.screenWidth / 8;
+ const uint last_y = (uint)_videoMode.screenHeight / 8;
const uint BASE = 65521; /* largest prime smaller than 65536 */
/* the 8x8 blocks in buf are enumerated starting in the top left corner and
* reading each line at a time from left to right */
- for (y = 0; y != last_y; y++, buf += _screenWidth * (8 - 1))
+ for (y = 0; y != last_y; y++, buf += _videoMode.screenWidth * (8 - 1))
for (x = 0; x != last_x; x++, buf += 8) {
// Adler32 checksum algorithm (from RFC1950, used by gzip and zlib).
// This computes the Adler32 checksum of a 8x8 pixel block. Note
@@ -947,7 +983,7 @@ void OSystem_SDL::makeChecksums(const byte *buf) {
s1 += ptr[subX];
s2 += s1;
}
- ptr += _screenWidth;
+ ptr += _videoMode.screenWidth;
}
s1 %= BASE;
@@ -977,8 +1013,8 @@ void OSystem_SDL::addDirtyRgnAuto(const byte *buf) {
int x, y, w;
uint32 *ck = _dirtyChecksums;
- for (y = 0; y != _screenHeight / 8; y++) {
- for (x = 0; x != _screenWidth / 8; x++, ck++) {
+ for (y = 0; y != _videoMode.screenHeight / 8; y++) {
+ for (x = 0; x != _videoMode.screenWidth / 8; x++, ck++) {
if (ck[0] != ck[_cksumNum]) {
/* found a dirty 8x8 block, now go as far to the right as possible,
and at the same time, unmark the dirty status by setting old to new. */
@@ -986,7 +1022,7 @@ void OSystem_SDL::addDirtyRgnAuto(const byte *buf) {
do {
ck[w + _cksumNum] = ck[w];
w++;
- } while (x + w != _screenWidth / 8 && ck[w] != ck[w + _cksumNum]);
+ } while (x + w != _videoMode.screenWidth / 8 && ck[w] != ck[w + _cksumNum]);
addDirtyRect(x * 8, y * 8, w * 8, 8);
@@ -1003,11 +1039,11 @@ void OSystem_SDL::addDirtyRgnAuto(const byte *buf) {
}
int16 OSystem_SDL::getHeight() {
- return _screenHeight;
+ return _videoMode.screenHeight;
}
int16 OSystem_SDL::getWidth() {
- return _screenWidth;
+ return _videoMode.screenWidth;
}
void OSystem_SDL::setPalette(const byte *colors, uint start, uint num) {
@@ -1093,11 +1129,11 @@ void OSystem_SDL::showOverlay() {
// Since resolution could change, put mouse to adjusted position
// Fixes bug #1349059
- x = _mouseCurState.x * _scaleFactor;
- if (_adjustAspectRatio)
- y = real2Aspect(_mouseCurState.y) * _scaleFactor;
+ x = _mouseCurState.x * _videoMode.scaleFactor;
+ if (_videoMode.aspectRatio)
+ y = real2Aspect(_mouseCurState.y) * _videoMode.scaleFactor;
else
- y = _mouseCurState.y * _scaleFactor;
+ y = _mouseCurState.y * _videoMode.scaleFactor;
warpMouse(x, y);
@@ -1116,9 +1152,9 @@ void OSystem_SDL::hideOverlay() {
// Since resolution could change, put mouse to adjusted position
// Fixes bug #1349059
- x = _mouseCurState.x / _scaleFactor;
- y = _mouseCurState.y / _scaleFactor;
- if (_adjustAspectRatio)
+ x = _mouseCurState.x / _videoMode.scaleFactor;
+ y = _mouseCurState.y / _videoMode.scaleFactor;
+ if (_videoMode.aspectRatio)
y = aspect2Real(y);
warpMouse(x, y);
@@ -1140,20 +1176,20 @@ void OSystem_SDL::clearOverlay() {
SDL_Rect src, dst;
src.x = src.y = 0;
dst.x = dst.y = 1;
- src.w = dst.w = _screenWidth;
- src.h = dst.h = _screenHeight;
+ src.w = dst.w = _videoMode.screenWidth;
+ src.h = dst.h = _videoMode.screenHeight;
if (SDL_BlitSurface(_screen, &src, _tmpscreen, &dst) != 0)
error("SDL_BlitSurface failed: %s", SDL_GetError());
SDL_LockSurface(_tmpscreen);
SDL_LockSurface(_overlayscreen);
_scalerProc((byte *)(_tmpscreen->pixels) + _tmpscreen->pitch + 2, _tmpscreen->pitch,
- (byte *)_overlayscreen->pixels, _overlayscreen->pitch, _screenWidth, _screenHeight);
+ (byte *)_overlayscreen->pixels, _overlayscreen->pitch, _videoMode.screenWidth, _videoMode.screenHeight);
#ifndef DISABLE_SCALERS
- if (_adjustAspectRatio)
+ if (_videoMode.aspectRatio)
stretch200To240((uint8 *)_overlayscreen->pixels, _overlayscreen->pitch,
- _overlayWidth, _screenHeight * _scaleFactor, 0, 0, 0);
+ _videoMode.overlayWidth, _videoMode.screenHeight * _videoMode.scaleFactor, 0, 0, 0);
#endif
SDL_UnlockSurface(_tmpscreen);
SDL_UnlockSurface(_overlayscreen);
@@ -1171,9 +1207,9 @@ void OSystem_SDL::grabOverlay(OverlayColor *buf, int pitch) {
error("SDL_LockSurface failed: %s", SDL_GetError());
byte *src = (byte *)_overlayscreen->pixels;
- int h = _overlayHeight;
+ int h = _videoMode.overlayHeight;
do {
- memcpy(buf, src, _overlayWidth * 2);
+ memcpy(buf, src, _videoMode.overlayWidth * 2);
src += _overlayscreen->pitch;
buf += pitch;
} while (--h);
@@ -1199,12 +1235,12 @@ void OSystem_SDL::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, i
y = 0;
}
- if (w > _overlayWidth - x) {
- w = _overlayWidth - x;
+ if (w > _videoMode.overlayWidth - x) {
+ w = _videoMode.overlayWidth - x;
}
- if (h > _overlayHeight - y) {
- h = _overlayHeight - y;
+ if (h > _videoMode.overlayHeight - y) {
+ h = _videoMode.overlayHeight - y;
}
if (w <= 0 || h <= 0)
@@ -1227,14 +1263,6 @@ void OSystem_SDL::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, i
SDL_UnlockSurface(_overlayscreen);
}
-OverlayColor OSystem_SDL::RGBToColor(uint8 r, uint8 g, uint8 b) {
- return SDL_MapRGB(_overlayscreen->format, r, g, b);
-}
-
-void OSystem_SDL::colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) {
- SDL_GetRGB(color, _overlayscreen->format, &r, &g, &b);
-}
-
#pragma mark -
#pragma mark --- Mouse ---
@@ -1260,12 +1288,12 @@ void OSystem_SDL::setMousePos(int x, int y) {
void OSystem_SDL::warpMouse(int x, int y) {
int y1 = y;
- if (_adjustAspectRatio && !_overlayVisible)
+ if (_videoMode.aspectRatio && !_overlayVisible)
y1 = real2Aspect(y);
if (_mouseCurState.x != x || _mouseCurState.y != y) {
if (!_overlayVisible)
- SDL_WarpMouse(x * _scaleFactor, y1 * _scaleFactor);
+ SDL_WarpMouse(x * _videoMode.scaleFactor, y1 * _videoMode.scaleFactor);
else
SDL_WarpMouse(x, y1);
@@ -1368,7 +1396,7 @@ void OSystem_SDL::blitCursor() {
int rW, rH;
- if (_cursorTargetScale >= _scaleFactor) {
+ if (_cursorTargetScale >= _videoMode.scaleFactor) {
// The cursor target scale is greater or equal to the scale at
// which the rest of the screen is drawn. We do not downscale
// the cursor image, we draw it at its original size. It will
@@ -1381,22 +1409,22 @@ void OSystem_SDL::blitCursor() {
// The virtual dimensions may be larger than the original.
- _mouseCurState.vW = w * _cursorTargetScale / _scaleFactor;
- _mouseCurState.vH = h * _cursorTargetScale / _scaleFactor;
+ _mouseCurState.vW = w * _cursorTargetScale / _videoMode.scaleFactor;
+ _mouseCurState.vH = h * _cursorTargetScale / _videoMode.scaleFactor;
_mouseCurState.vHotX = _mouseCurState.hotX * _cursorTargetScale /
- _scaleFactor;
+ _videoMode.scaleFactor;
_mouseCurState.vHotY = _mouseCurState.hotY * _cursorTargetScale /
- _scaleFactor;
+ _videoMode.scaleFactor;
} else {
// The cursor target scale is smaller than the scale at which
// the rest of the screen is drawn. We scale up the cursor
// image to make it appear correct.
- rW = w * _scaleFactor / _cursorTargetScale;
- rH = h * _scaleFactor / _cursorTargetScale;
- _mouseCurState.rHotX = _mouseCurState.hotX * _scaleFactor /
+ rW = w * _videoMode.scaleFactor / _cursorTargetScale;
+ rH = h * _videoMode.scaleFactor / _cursorTargetScale;
+ _mouseCurState.rHotX = _mouseCurState.hotX * _videoMode.scaleFactor /
_cursorTargetScale;
- _mouseCurState.rHotY = _mouseCurState.hotY * _scaleFactor /
+ _mouseCurState.rHotY = _mouseCurState.hotY * _videoMode.scaleFactor /
_cursorTargetScale;
// The virtual dimensions will be the same as the original.
@@ -1411,7 +1439,7 @@ void OSystem_SDL::blitCursor() {
int rH1 = rH; // store original to pass to aspect-correction function later
#endif
- if (_adjustAspectRatio && _cursorTargetScale == 1) {
+ if (_videoMode.aspectRatio && _cursorTargetScale == 1) {
rH = real2Aspect(rH - 1) + 1;
_mouseCurState.rHotY = real2Aspect(_mouseCurState.rHotY);
}
@@ -1446,17 +1474,17 @@ void OSystem_SDL::blitCursor() {
// the game. This only works well with the non-blurring scalers so we
// actually only use the 1x, 1.5x, 2x and AdvMame scalers.
- if (_cursorTargetScale == 1 && (_mode == GFX_DOUBLESIZE || _mode == GFX_TRIPLESIZE))
+ if (_cursorTargetScale == 1 && (_videoMode.mode == GFX_DOUBLESIZE || _videoMode.mode == GFX_TRIPLESIZE))
scalerProc = _scalerProc;
else
- scalerProc = scalersMagn[_cursorTargetScale - 1][_scaleFactor - 1];
+ scalerProc = scalersMagn[_cursorTargetScale - 1][_videoMode.scaleFactor - 1];
scalerProc((byte *)_mouseOrigSurface->pixels + _mouseOrigSurface->pitch + 2,
_mouseOrigSurface->pitch, (byte *)_mouseSurface->pixels, _mouseSurface->pitch,
_mouseCurState.w, _mouseCurState.h);
#ifndef DISABLE_SCALERS
- if (_adjustAspectRatio && _cursorTargetScale == 1)
+ if (_videoMode.aspectRatio && _cursorTargetScale == 1)
cursorStretch200To240((uint8 *)_mouseSurface->pixels, _mouseSurface->pitch, rW, rH1, 0, 0, 0);
#endif
@@ -1499,7 +1527,7 @@ void OSystem_SDL::undrawMouse() {
// When we switch bigger overlay off mouse jumps. Argh!
// This is intended to prevent undrawing offscreen mouse
- if (!_overlayVisible && (x >= _screenWidth || y >= _screenHeight)) {
+ if (!_overlayVisible && (x >= _videoMode.screenWidth || y >= _videoMode.screenHeight)) {
return;
}
@@ -1522,17 +1550,17 @@ void OSystem_SDL::drawMouse() {
dst.y = _mouseCurState.y;
if (!_overlayVisible) {
- scale = _scaleFactor;
- width = _screenWidth;
- height = _screenHeight;
+ scale = _videoMode.scaleFactor;
+ width = _videoMode.screenWidth;
+ height = _videoMode.screenHeight;
dst.w = _mouseCurState.vW;
dst.h = _mouseCurState.vH;
hotX = _mouseCurState.vHotX;
hotY = _mouseCurState.vHotY;
} else {
scale = 1;
- width = _overlayWidth;
- height = _overlayHeight;
+ width = _videoMode.overlayWidth;
+ height = _videoMode.overlayHeight;
dst.w = _mouseCurState.rW;
dst.h = _mouseCurState.rH;
hotX = _mouseCurState.rHotX;
@@ -1554,7 +1582,7 @@ void OSystem_SDL::drawMouse() {
dst.y += _currentShakePos;
}
- if (_adjustAspectRatio && !_overlayVisible)
+ if (_videoMode.aspectRatio && !_overlayVisible)
dst.y = real2Aspect(dst.y);
dst.x = scale * dst.x - _mouseCurState.rHotX;
@@ -1670,17 +1698,19 @@ void OSystem_SDL::displayMessageOnOSD(const char *msg) {
void OSystem_SDL::handleScalerHotkeys(const SDL_KeyboardEvent &key) {
// Ctrl-Alt-a toggles aspect ratio correction
if (key.keysym.sym == 'a') {
- setFeatureState(kFeatureAspectRatioCorrection, !_adjustAspectRatio);
+ beginGFXTransaction();
+ setFeatureState(kFeatureAspectRatioCorrection, !_videoMode.aspectRatio);
+ endGFXTransaction();
#ifdef USE_OSD
char buffer[128];
- if (_adjustAspectRatio)
+ if (_videoMode.aspectRatio)
sprintf(buffer, "Enabled aspect ratio correction\n%d x %d -> %d x %d",
- _screenWidth, _screenHeight,
+ _videoMode.screenWidth, _videoMode.screenHeight,
_hwscreen->w, _hwscreen->h
);
else
sprintf(buffer, "Disabled aspect ratio correction\n%d x %d -> %d x %d",
- _screenWidth, _screenHeight,
+ _videoMode.screenWidth, _videoMode.screenHeight,
_hwscreen->w, _hwscreen->h
);
displayMessageOnOSD(buffer);
@@ -1690,7 +1720,7 @@ void OSystem_SDL::handleScalerHotkeys(const SDL_KeyboardEvent &key) {
}
int newMode = -1;
- int factor = _scaleFactor - 1;
+ int factor = _videoMode.scaleFactor - 1;
// Increase/decrease the scale factor
if (key.keysym.sym == SDLK_EQUALS || key.keysym.sym == SDLK_PLUS || key.keysym.sym == SDLK_MINUS ||
@@ -1716,13 +1746,15 @@ void OSystem_SDL::handleScalerHotkeys(const SDL_KeyboardEvent &key) {
}
if (newMode >= 0) {
- setGraphicsMode(newMode);
+ beginGFXTransaction();
+ setGraphicsMode(newMode);
+ endGFXTransaction();
#ifdef USE_OSD
if (_osdSurface) {
const char *newScalerName = 0;
const GraphicsMode *g = getSupportedGraphicsModes();
while (g->name) {
- if (g->id == _mode) {
+ if (g->id == _videoMode.mode) {
newScalerName = g->description;
break;
}
@@ -1732,7 +1764,7 @@ void OSystem_SDL::handleScalerHotkeys(const SDL_KeyboardEvent &key) {
char buffer[128];
sprintf(buffer, "Active graphics filter: %s\n%d x %d -> %d x %d",
newScalerName,
- _screenWidth, _screenHeight,
+ _videoMode.screenWidth, _videoMode.screenHeight,
_hwscreen->w, _hwscreen->h
);
displayMessageOnOSD(buffer);
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 83637605a6..94f358db08 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -25,11 +25,9 @@
#if defined(WIN32)
#include <windows.h>
-#if defined(ARRAYSIZE)
// winnt.h defines ARRAYSIZE, but we want our own one... - this is needed before including util.h
#undef ARRAYSIZE
#endif
-#endif
#include "backends/platform/sdl/sdl.h"
#include "common/archive.h"
@@ -37,7 +35,11 @@
#include "common/events.h"
#include "common/util.h"
-#include "backends/saves/default/default-saves.h"
+#ifdef UNIX
+ #include "backends/saves/posix/posix-saves.h"
+#else
+ #include "backends/saves/default/default-saves.h"
+#endif
#include "backends/timer/default/default-timer.h"
#include "sound/mixer_intern.h"
@@ -112,25 +114,29 @@ void OSystem_SDL::initBackend() {
// Enable unicode support if possible
SDL_EnableUNICODE(1);
+ memset(&_oldVideoMode, 0, sizeof(_oldVideoMode));
+ memset(&_videoMode, 0, sizeof(_videoMode));
+ memset(&_transactionDetails, 0, sizeof(_transactionDetails));
+
_cksumValid = false;
#if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) && !defined(DISABLE_SCALERS)
- _mode = GFX_DOUBLESIZE;
- _scaleFactor = 2;
+ _videoMode.mode = GFX_DOUBLESIZE;
+ _videoMode.scaleFactor = 2;
+ _videoMode.aspectRatio = ConfMan.getBool("aspect_ratio");
_scalerProc = Normal2x;
- _adjustAspectRatio = ConfMan.getBool("aspect_ratio");
#else // for small screen platforms
- _mode = GFX_NORMAL;
- _scaleFactor = 1;
+ _videoMode.mode = GFX_NORMAL;
+ _videoMode.scaleFactor = 1;
+ _videoMode.aspectRatio = false;
_scalerProc = Normal1x;
- _adjustAspectRatio = false;
#endif
_scalerType = 0;
_modeFlags = 0;
#if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
- _fullscreen = ConfMan.getBool("fullscreen");
+ _videoMode.fullscreen = ConfMan.getBool("fullscreen");
#else
- _fullscreen = true;
+ _videoMode.fullscreen = true;
#endif
#if !defined(MACOSX) && !defined(__SYMBIAN32__)
@@ -150,7 +156,11 @@ void OSystem_SDL::initBackend() {
// Create the savefile manager, if none exists yet (we check for this to
// allow subclasses to provide their own).
if (_savefile == 0) {
- _savefile = new DefaultSaveFileManager();
+#ifdef UNIX
+ _savefile = new POSIXSaveFileManager();
+#else
+ _savefile = new DefaultSaveFileManager();
+#endif
}
// Create and hook up the mixer, if none exists yet (we check for this to
@@ -189,8 +199,7 @@ OSystem_SDL::OSystem_SDL()
#ifdef USE_OSD
_osdSurface(0), _osdAlpha(SDL_ALPHA_TRANSPARENT), _osdFadeStartTime(0),
#endif
- _hwscreen(0), _screen(0), _screenWidth(0), _screenHeight(0),
- _tmpscreen(0), _overlayWidth(0), _overlayHeight(0),
+ _hwscreen(0), _screen(0), _tmpscreen(0),
_overlayVisible(false),
_overlayscreen(0), _tmpscreen2(0),
_samplesPerSec(0),
@@ -287,8 +296,7 @@ void OSystem_SDL::addSysArchivesToSearchSet(Common::SearchSet &s, int priority)
// FIXME: We use depth = 4 for now, to match the old code. May want to change that
Common::FSNode dataNode(DATA_PATH);
if (dataNode.exists() && dataNode.isDirectory()) {
- Common::ArchivePtr dataArchive(new Common::FSDirectory(dataNode, 4));
- s.add(DATA_PATH, dataArchive, priority);
+ s.add(DATA_PATH, new Common::FSDirectory(dataNode, 4), priority);
}
#endif
@@ -301,8 +309,7 @@ void OSystem_SDL::addSysArchivesToSearchSet(Common::SearchSet &s, int priority)
if (CFURLGetFileSystemRepresentation(fileUrl, true, buf, sizeof(buf))) {
// Success: Add it to the search path
Common::String bundlePath((const char *)buf);
- Common::ArchivePtr bundleArchive(new Common::FSDirectory(bundlePath));
- s.add("__OSX_BUNDLE__", bundleArchive, priority);
+ s.add("__OSX_BUNDLE__", new Common::FSDirectory(bundlePath), priority);
}
CFRelease(fileUrl);
}
@@ -428,9 +435,9 @@ bool OSystem_SDL::getFeatureState(Feature f) {
switch (f) {
case kFeatureFullscreenMode:
- return _fullscreen;
+ return _videoMode.fullscreen;
case kFeatureAspectRatioCorrection:
- return _adjustAspectRatio;
+ return _videoMode.aspectRatio;
case kFeatureAutoComputeDirtyRects:
return _modeFlags & DF_WANT_RECT_OPTIM;
default:
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index 3881e3777f..b6383d65f8 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -41,11 +41,6 @@ namespace Audio {
class MixerImpl;
}
-namespace Common {
- class SaveFileManager;
- class TimerManager;
-}
-
#if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
// Uncomment this to enable the 'on screen display' code.
#define USE_OSD 1
@@ -85,7 +80,7 @@ public:
virtual void initBackend();
void beginGFXTransaction(void);
- void endGFXTransaction(void);
+ TransactionError endGFXTransaction(void);
// Set the size of the video bitmap.
// Typically, 320x200
@@ -179,6 +174,7 @@ public:
void deleteMutex(MutexRef mutex);
// Overlay
+ virtual Graphics::PixelFormat getOverlayFormat() const { return _overlayFormat; }
virtual void showOverlay();
virtual void hideOverlay();
virtual void clearOverlay();
@@ -186,13 +182,8 @@ public:
virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
virtual int16 getHeight();
virtual int16 getWidth();
- virtual int16 getOverlayHeight() { return _overlayHeight; }
- virtual int16 getOverlayWidth() { return _overlayWidth; }
-
- // Methods that convert RGB to/from colors suitable for the overlay.
- virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b);
- virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b);
-
+ virtual int16 getOverlayHeight() { return _videoMode.overlayHeight; }
+ virtual int16 getOverlayWidth() { return _videoMode.overlayWidth; }
virtual const GraphicsMode *getSupportedGraphicsModes() const;
virtual int getDefaultGraphicsMode() const;
@@ -238,17 +229,14 @@ protected:
// unseen game screen
SDL_Surface *_screen;
- // TODO: We could get rid of the following two vars and just use _screen instead
- int _screenWidth, _screenHeight;
-
// temporary screen (for scalers)
SDL_Surface *_tmpscreen;
SDL_Surface *_tmpscreen2;
// overlay
SDL_Surface *_overlayscreen;
- int _overlayWidth, _overlayHeight;
bool _overlayVisible;
+ Graphics::PixelFormat _overlayFormat;
// Audio
int _samplesPerSec;
@@ -264,36 +252,39 @@ protected:
enum {
kTransactionNone = 0,
- kTransactionCommit = 1,
- kTransactionActive = 2
+ kTransactionActive = 1,
+ kTransactionRollback = 2
};
struct TransactionDetails {
- int mode;
- bool modeChanged;
- int w;
- int h;
bool sizeChanged;
- bool fs;
- bool fsChanged;
- bool ar;
- bool arChanged;
bool needHotswap;
bool needUpdatescreen;
- bool needUnload;
- bool needToggle;
bool normal1xScaler;
};
TransactionDetails _transactionDetails;
+ struct VideoState {
+ bool setup;
+
+ bool fullscreen;
+ bool aspectRatio;
+
+ int mode;
+ int scaleFactor;
+
+ int screenWidth, screenHeight;
+ int overlayWidth, overlayHeight;
+ };
+ VideoState _videoMode, _oldVideoMode;
+
+ virtual void setGraphicsModeIntern(); // overloaded by CE backend
+
/** Force full redraw on next updateScreen */
bool _forceFull;
ScalerProc *_scalerProc;
int _scalerType;
- int _scaleFactor;
- int _mode;
int _transactionMode;
- bool _fullscreen;
bool _screenIsLocked;
Graphics::Surface _framebuffer;
@@ -303,9 +294,6 @@ protected:
bool _modeChanged;
int _screenChangeCount;
- /** True if aspect ratio correction is enabled. */
- bool _adjustAspectRatio;
-
enum {
NUM_DIRTY_RECT = 100,
MAX_SCALING = 3
@@ -393,7 +381,7 @@ protected:
SDL_Thread *_soundThread;
bool _soundThreadIsRunning;
bool _soundThreadShouldQuit;
-
+
byte _activeSoundBuf;
uint _soundBufSize;
byte *_soundBuffers[2];
@@ -428,9 +416,9 @@ protected:
virtual void internUpdateScreen(); // overloaded by CE backend
- virtual void loadGFXMode(); // overloaded by CE backend
+ virtual bool loadGFXMode(); // overloaded by CE backend
virtual void unloadGFXMode(); // overloaded by CE backend
- virtual void hotswapGFXMode(); // overloaded by CE backend
+ virtual bool hotswapGFXMode(); // overloaded by CE backend
void setFullscreenMode(bool enable);
void setAspectRatioCorrection(bool enable);
@@ -438,8 +426,8 @@ protected:
virtual bool saveScreenshot(const char *filename); // overloaded by CE backend
int effectiveScreenHeight() const {
- return (_adjustAspectRatio ? real2Aspect(_screenHeight) : _screenHeight)
- * _scaleFactor;
+ return (_videoMode.aspectRatio ? real2Aspect(_videoMode.screenHeight) : _videoMode.screenHeight)
+ * _videoMode.scaleFactor;
}
void setupIcon();
diff --git a/backends/platform/symbian/AdaptAllMMPs.pl b/backends/platform/symbian/AdaptAllMMPs.pl
index d7b5642f1c..9d843d80b9 100644
--- a/backends/platform/symbian/AdaptAllMMPs.pl
+++ b/backends/platform/symbian/AdaptAllMMPs.pl
@@ -14,6 +14,7 @@ chdir("../../../");
"mmp/scummvm_cruise.mmp",
"mmp/scummvm_drascula.mmp",
"mmp/scummvm_gob.mmp",
+ "mmp/scummvm_groovie.mmp",
"mmp/scummvm_igor.mmp",
"mmp/scummvm_kyra.mmp",
"mmp/scummvm_lure.mmp",
@@ -25,17 +26,19 @@ chdir("../../../");
"mmp/scummvm_scumm.mmp",
"mmp/scummvm_sky.mmp",
"mmp/scummvm_sword1.mmp",
- "mmp/scummvm_sword2.mmp",
+ "mmp/scummvm_sword2.mmp",
"mmp/scummvm_touche.mmp",
"mmp/scummvm_tinsel.mmp",
-
+ "mmp/scummvm_tucker.mmp",
# Target Platform Project Files
"S60/ScummVM_S60.mmp",
"S60v3/ScummVM_S60v3.mmp",
+ "S60v3/ScummVM_A0000658_S60v3.mmp",
"S80/ScummVM_S80.mmp",
"S90/ScummVM_S90.mmp",
"UIQ2/ScummVM_UIQ2.mmp",
- "UIQ3/ScummVM_UIQ3.mmp"
+ "UIQ3/ScummVM_UIQ3.mmp",
+ "UIQ3/ScummVM_A0000658_UIQ3.mmp"
);
@@ -123,6 +126,8 @@ ParseModule("_igor", "igor", \@section_empty);
ParseModule("_made", "made", \@section_empty);
ParseModule("_m4", "m4", \@section_empty);
ParseModule("_tinsel", "tinsel", \@section_empty);
+ParseModule("_groovie", "groovie", \@section_empty);
+ParseModule("_tucker", "tucker", \@section_empty);
print "
=======================================================================================
Done. Enjoy :P
diff --git a/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl b/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl
index 8ba743674d..390df09f53 100644
--- a/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl
+++ b/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl
@@ -2,9 +2,15 @@
##################################################################################################################
@WorkingEngines = qw(
- scumm agos sky queen gob saga drascula
+ scumm agos sky queen gob groovie saga drascula
kyra lure agi touche parallaction cine
- cruise igor made m4 tinsel sword1 sword2
+ cruise igor made m4 tinsel tucker sword1 sword2
+ );
+
+ @WorkingEngines_2nd = qw(
+ scumm agos sky queen gob groovie saga drascula
+ kyra lure agi touche parallaction cine
+ cruise igor made m4 tinsel tucker sword1 sword2
);
@TestingEngines = qw(
@@ -19,6 +25,7 @@
@EnablableSubEngines = qw(
scumm_7_8
he
+ ihnm
);
%UseableFeatures = (
@@ -272,10 +279,10 @@
# below here you could specify weird & experimental combinations, non-ready engines
# Separate version for the broken sword engines (1&2)
- $VariationSets{'ALL'}{'brokensword'} = "$DefaultFeatures sword1 sword2";
+ #$VariationSets{'ALL'}{'brokensword'} = "$DefaultFeatures sword1 sword2";
# Separate version for Scumm games (COMI) since memory usage might be high
- $VariationSets{'ALL'}{'scumm'} = "$DefaultFeatures scumm scumm_7_8 he";
+ #$VariationSets{'ALL'}{'scumm'} = "$DefaultFeatures scumm scumm_7_8 he";
# for mega-fast-testing only plz! Warning: contains to engines!
#$VariationSets{'ALL'}{'fast_empty'} = "";
diff --git a/backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in b/backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in
new file mode 100644
index 0000000000..5b77ca83af
--- /dev/null
+++ b/backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in
@@ -0,0 +1,130 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL
+ * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System
+ * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer
+ * Copyright (C) 2005-2006 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+//
+// EPOC S60 MMP makefile project for ScummVM
+//
+
+// *** Definitions
+
+TARGET ScummVM_A0000658.exe
+TARGETPATH sys\bin
+TARGETTYPE exe
+OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char
+
+UID 0x100039ce 0xA0000658
+
+START RESOURCE ScummVM_A0000658_reg.rss
+TARGETPATH \private\10003a3f\apps
+END
+
+START RESOURCE ScummVM_A0000658_loc.rss
+TARGETPATH \Resource\Apps
+LANG SC
+END
+
+SOURCEPATH ..\res
+START RESOURCE ScummVM_A0000658.rss
+HEADER
+TARGETPATH \Resource\Apps
+LANG SC
+END
+
+EPOCSTACKSIZE 80000
+EPOCHEAPSIZE 5000000 64000000
+
+START BITMAP ScummVM.mbm
+TARGETPATH \Resource\Apps
+SOURCEPATH ..\res
+// Source Color-depth Source-bitmap-list
+// c denotes whether the bitmap is a colour bitmap and the digits represent the
+// colour-depth of the bitmap and the bitmap mask respectively
+SOURCE c24 ScummSmall.bmp
+SOURCE 8 ScummSmallMask.bmp
+SOURCE c24 ScummLarge.bmp
+SOURCE 8 ScummLargeMask.bmp
+SOURCE c24 ScummxLarge.bmp
+SOURCE 8 ScummxLargeMask.bmp
+END
+
+MACRO S60
+MACRO S60V3
+
+ALWAYS_BUILD_AS_ARM
+
+//START_AUTO_MACROS_SLAVE//
+
+ // empty base file, will be updated by Perl build scripts
+
+//STOP_AUTO_MACROS_SLAVE//
+
+// *** Static Libraries
+
+STATICLIBRARY esdl.lib
+
+// *** Include paths
+
+USERINCLUDE ..\..\..\.. ..\..\..\..\common ..\..\..\..\gui ..\..\..\..\engines
+USERINCLUDE ..\..\..\..\backends\fs ..\src ..\..\..\..\backends\platform\sdl ..\..\..\..\sound
+
+SYSTEMINCLUDE \epoc32\include\ESDL
+SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version
+SYSTEMINCLUDE \epoc32\include\libc
+SYSTEMINCLUDE \epoc32\include
+SYSTEMINCLUDE ..\src // for portdefs.h
+
+// *** SOURCE files
+
+SOURCEPATH ..\..\..\..\base
+
+//START_AUTO_OBJECTS_BASE_//
+
+ // empty base file, will be updated by Perl build scripts
+
+//STOP_AUTO_OBJECTS_BASE_//
+
+SOURCEPATH ..\..\..\..
+
+// backend EPOC/SDL/ESDL specific includes
+SOURCE backends\platform\sdl\events.cpp
+SOURCE backends\platform\sdl\graphics.cpp
+SOURCE backends\platform\sdl\sdl.cpp
+SOURCE backends\fs\symbian\symbian-fs-factory.cpp
+SOURCE backends\platform\symbian\src\SymbianOS.cpp
+SOURCE backends\platform\symbian\src\SymbianActions.cpp
+SOURCE backends\platform\symbian\src\ScummApp.cpp
+
+SOURCE gui\Key.cpp
+SOURCE gui\KeysDialog.cpp
+SOURCE gui\Actions.cpp
+SOURCE gui\Dialog.cpp
+
+// Special for graphics
+source graphics\iff.cpp
+
+// *** Dynamic Libraries
+LIBRARY cone.lib eikcore.lib
+LIBRARY euser.lib apparc.lib fbscli.lib
+LIBRARY estlib.lib apgrfx.lib
+LIBRARY gdi.lib hal.lib bitgdi.lib
+LIBRARY mediaclientaudiostream.lib efsrv.lib ws32.lib
+library avkon.lib bafl.lib
diff --git a/backends/platform/symbian/S60v3/scummvm_A0000658_loc.rss b/backends/platform/symbian/S60v3/scummvm_A0000658_loc.rss
new file mode 100644
index 0000000000..5b045d0459
--- /dev/null
+++ b/backends/platform/symbian/S60v3/scummvm_A0000658_loc.rss
@@ -0,0 +1,22 @@
+#include <AppInfo.rh>
+
+// This file localise the applications icons and caption
+RESOURCE LOCALISABLE_APP_INFO
+ {
+ caption_and_icon =
+ {
+ CAPTION_AND_ICON_INFO
+ {
+ // The caption text is defined in the rls file
+ caption = "ScummVM Pt2";
+ // Icons are used to represent applications in the
+ // application launcher and application title bar.
+ // The number_of_icons value identifies how many icons
+ // that exist in the icon_file.
+ number_of_icons = 1;
+ // Using the application icons.
+ icon_file = "\\Resource\\Apps\\ScummVM.mif";
+ }
+ };
+ }
+
diff --git a/backends/platform/symbian/S60v3/scummvm_A0000658_reg.rss b/backends/platform/symbian/S60v3/scummvm_A0000658_reg.rss
new file mode 100644
index 0000000000..1b1cc9e64f
--- /dev/null
+++ b/backends/platform/symbian/S60v3/scummvm_A0000658_reg.rss
@@ -0,0 +1,18 @@
+// All registration files need to #include appinfo.rh.
+#include <AppInfo.rh>
+
+// All registration files must define UID2, which is always
+// KUidAppRegistrationResourceFile, and UID3, which is the application's UID.
+UID2 KUidAppRegistrationResourceFile
+UID3 0xA0000658 // application UID
+
+// Registration file need to containo an APP_REGISTRATION_INFO resource that
+// minimally needs to provide the name of the application binary (using the
+// app_file statement).
+RESOURCE APP_REGISTRATION_INFO
+ {
+ app_file = "ScummVM_A0000658"; // filename of application binary (minus extension)
+ // Specify the location of the localisable icon/caption definition file
+ localisable_resource_file = "\\Resource\\Apps\\ScummVM_A0000658_loc";
+ }
+
diff --git a/backends/platform/symbian/UIQ3/ScummVM_A0000658.rss b/backends/platform/symbian/UIQ3/ScummVM_A0000658.rss
new file mode 100644
index 0000000000..71e9ac8881
--- /dev/null
+++ b/backends/platform/symbian/UIQ3/ScummVM_A0000658.rss
@@ -0,0 +1,49 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL
+ * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System
+ * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer
+ * Copyright (C) 2005-2006 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id: ScummVM.rss,v 1.1 2006/06/01 19:00:29 anotherguest Exp $
+ */
+
+// ScummVM.RSS
+
+NAME SCUM
+
+// Include definitions of resource STRUCTS used by this
+// resource script
+#include <eikon.rh>
+#include <qikon.rh>
+#include "..\src\Scummvm.hrh"
+// Include the standard Eikon resource ids
+#include <eikon.rsg>
+
+
+RESOURCE RSS_SIGNATURE
+ {
+ }
+
+RESOURCE TBUF16 { buf=""; }
+
+RESOURCE EIK_APP_INFO
+ {
+ }
+
+#include <sdl.ra>
+
diff --git a/backends/platform/symbian/UIQ3/ScummVM_A0000658_UIQ3.mmp.in b/backends/platform/symbian/UIQ3/ScummVM_A0000658_UIQ3.mmp.in
new file mode 100644
index 0000000000..b3c6f33719
--- /dev/null
+++ b/backends/platform/symbian/UIQ3/ScummVM_A0000658_UIQ3.mmp.in
@@ -0,0 +1,132 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL
+ * Copyright (C) 2003-2009 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System
+ * Copyright (C) 2009 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer
+ * Copyright (C) 2005-2009 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+//
+// EPOC UIQ MMP makefile project for ScummVM
+//
+
+// *** Definitions
+
+TARGET ScummVM_A0000658.exe
+TARGETPATH sys\bin
+TARGETTYPE exe
+
+OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char
+
+UID 0x100039ce 0xA0000658
+
+START RESOURCE ScummVM_A0000658_reg.rss
+TARGETPATH \private\10003a3f\apps
+END
+
+START RESOURCE ScummVM_A0000658_loc.rss
+TARGETPATH \Resource\Apps
+LANG SC
+END
+
+SOURCEPATH .
+START RESOURCE ScummVM_A0000658.rss
+HEADER
+TARGETPATH \Resource\Apps
+LANG SC
+END
+
+EPOCSTACKSIZE 80000
+EPOCHEAPSIZE 5000000 64000000
+
+START BITMAP ScummVM.mbm
+TARGETPATH \Resource\Apps
+SOURCEPATH ..\res
+// Source Color-depth Source-bitmap-list
+// c denotes whether the bitmap is a colour bitmap and the digits represent the
+// colour-depth of the bitmap and the bitmap mask respectively
+SOURCE c24 ScummSmall.bmp
+SOURCE 8 ScummSmallMask.bmp
+SOURCE c24 ScummLarge.bmp
+SOURCE 8 ScummLargeMask.bmp
+SOURCE c24 ScummxLarge.bmp
+SOURCE 8 ScummxLargeMask.bmp
+END
+
+MACRO UIQ
+MACRO UIQ3
+
+ALWAYS_BUILD_AS_ARM
+
+//START_AUTO_MACROS_SLAVE//
+
+ // empty base file, will be updated by Perl build scripts
+
+//STOP_AUTO_MACROS_SLAVE//
+
+// *** Static Libraries
+
+STATICLIBRARY esdl.lib
+
+// *** Include paths
+
+USERINCLUDE ..\..\..\.. ..\..\..\..\common ..\..\..\..\gui ..\..\..\..\engines
+USERINCLUDE ..\..\..\..\backends\fs ..\src ..\..\..\..\backends\platform\sdl ..\..\..\..\sound
+
+SYSTEMINCLUDE \epoc32\include\ESDL
+SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version
+SYSTEMINCLUDE \epoc32\include\libc
+SYSTEMINCLUDE \epoc32\include
+SYSTEMINCLUDE ..\src // for portdefs.h
+
+// *** SOURCE files
+
+SOURCEPATH ..\..\..\..\base
+
+//START_AUTO_OBJECTS_BASE_//
+
+ // empty base file, will be updated by Perl build scripts
+
+//STOP_AUTO_OBJECTS_BASE_//
+
+SOURCEPATH ..\..\..\..\
+
+// backend EPOC/SDL/ESDL specific includes
+SOURCE backends\platform\sdl\events.cpp
+SOURCE backends\platform\sdl\graphics.cpp
+SOURCE backends\platform\sdl\sdl.cpp
+SOURCE backends\fs\symbian\symbian-fs-factory.cpp
+SOURCE backends\platform\symbian\src\SymbianOS.cpp
+SOURCE backends\platform\symbian\src\SymbianActions.cpp
+SOURCE backends\platform\symbian\src\ScummApp.cpp
+
+SOURCE gui\Key.cpp
+SOURCE gui\KeysDialog.cpp
+SOURCE gui\Actions.cpp
+SOURCE gui\Dialog.cpp
+
+// Special for graphics
+source graphics\iff.cpp
+
+// *** Dynamic Libraries
+LIBRARY cone.lib eikcore.lib
+LIBRARY euser.lib apparc.lib fbscli.lib
+LIBRARY estlib.lib apgrfx.lib
+LIBRARY gdi.lib hal.lib bitgdi.lib
+LIBRARY mediaclientaudiostream.lib efsrv.lib ws32.lib
+LIBRARY qikctl.lib
+library qikcore.lib bafl.lib eikcoctl.lib
diff --git a/backends/platform/symbian/UIQ3/scummvm_A0000658_loc.rss b/backends/platform/symbian/UIQ3/scummvm_A0000658_loc.rss
new file mode 100644
index 0000000000..5a42fe2e13
--- /dev/null
+++ b/backends/platform/symbian/UIQ3/scummvm_A0000658_loc.rss
@@ -0,0 +1,59 @@
+#include <AppInfo.rh>
+#include <Qikon.hrh>
+
+// This file localise the applications icons and caption
+RESOURCE LOCALISABLE_APP_INFO
+ {
+ caption_and_icon =
+ {
+ CAPTION_AND_ICON_INFO
+ {
+ // The caption text is defined in the rls file
+ caption = "ScummVM Pt2";
+ // Icons are used to represent applications in the
+ // application launcher and application title bar.
+ // The number_of_icons value identifies how many icons
+ // that exist in the icon_file.
+ number_of_icons = 3;
+ // Using the application icons.
+ icon_file = "\\Resource\\Apps\\ScummVM.mbm";
+ }
+ };
+
+ view_list =
+ {
+ VIEW_DATA
+ {
+ uid = 0x10000001;
+ screen_mode = 0;
+ caption_and_icon = CAPTION_AND_ICON_INFO
+ {
+ };
+ },
+ VIEW_DATA
+ {
+ uid = 0x10000001;
+ screen_mode = EQikScreenModeLandscape;
+ caption_and_icon = CAPTION_AND_ICON_INFO
+ {
+ };
+ },
+ VIEW_DATA
+ {
+ uid = 0x10000001;
+ screen_mode = EQikScreenModeSmallPortrait;
+ caption_and_icon = CAPTION_AND_ICON_INFO
+ {
+ };
+ },
+ VIEW_DATA
+ {
+ uid = 0x10000001;
+ screen_mode = EQikScreenModeSmallPortrait;
+ caption_and_icon = CAPTION_AND_ICON_INFO
+ {
+ };
+ }
+ };
+ }
+
diff --git a/backends/platform/symbian/UIQ3/scummvm_A0000658_reg.rss b/backends/platform/symbian/UIQ3/scummvm_A0000658_reg.rss
new file mode 100644
index 0000000000..2158406d0d
--- /dev/null
+++ b/backends/platform/symbian/UIQ3/scummvm_A0000658_reg.rss
@@ -0,0 +1,18 @@
+// All registration files need to #include appinfo.rh.
+#include <AppInfo.rh>
+
+// All registration files must define UID2, which is always
+// KUidAppRegistrationResourceFile, and UID3, which is the application's UID.
+UID2 KUidAppRegistrationResourceFile
+UID3 0xA0000658 // application UID
+
+// Registration file need to containo an APP_REGISTRATION_INFO resource that
+// minimally needs to provide the name of the application binary (using the
+// app_file statement).
+RESOURCE APP_REGISTRATION_INFO
+ {
+ app_file = "scummVM_A0000658"; // filename of application binary (minus extension)
+ // Specify the location of the localisable icon/caption definition file
+ localisable_resource_file = "\\Resource\\Apps\\ScummVM_A0000658_loc";
+ }
+
diff --git a/backends/platform/symbian/mmp/scummvm_base.mmp.in b/backends/platform/symbian/mmp/scummvm_base.mmp.in
index 3277e34ba3..9e4d60e951 100644
--- a/backends/platform/symbian/mmp/scummvm_base.mmp.in
+++ b/backends/platform/symbian/mmp/scummvm_base.mmp.in
@@ -108,6 +108,7 @@ SOURCE backends\saves\default\default-saves.cpp
SOURCE backends\saves\compressed\compressed-saves.cpp
SOURCE engines\engine.cpp
SOURCE engines\dialogs.cpp
+SOURCE engines\game.cpp
SOURCE backends\fs\abstract-fs.cpp
SOURCE backends\fs\symbian\symbianstream.cpp
// backend specific includes
diff --git a/backends/platform/symbian/mmp/scummvm_groovie.mmp.in b/backends/platform/symbian/mmp/scummvm_groovie.mmp.in
new file mode 100644
index 0000000000..ae6492b813
--- /dev/null
+++ b/backends/platform/symbian/mmp/scummvm_groovie.mmp.in
@@ -0,0 +1,57 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL
+ * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System
+ * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer
+ * Copyright (C) 2005-2006 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+//
+// EPOC MMP makefile project for ScummVM
+//
+
+// *** Definitions
+
+TARGET scummvm_groovie.lib
+TARGETTYPE lib
+OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp
+OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings
+OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char
+ALWAYS_BUILD_AS_ARM
+
+//START_AUTO_MACROS_SLAVE//
+
+ // empty base file, will be updated by Perl build scripts
+
+//STOP_AUTO_MACROS_SLAVE//
+
+// *** SOURCE files
+
+SOURCEPATH ..\..\..\..\engines\groovie
+
+//START_AUTO_OBJECTS_GROOVIE_//
+
+ // empty base file, will be updated by Perl build scripts
+
+//STOP_AUTO_OBJECTS_GROOVIE_//
+
+// *** Include paths
+
+USERINCLUDE ..\..\..\..\engines
+USERINCLUDE ..\..\..\.. ..\..\..\..\common ..\..\..\..\gui ..\..\..\..\sound ..\src
+SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version
+SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src
diff --git a/backends/platform/symbian/mmp/scummvm_tucker.mmp.in b/backends/platform/symbian/mmp/scummvm_tucker.mmp.in
new file mode 100644
index 0000000000..8682992a57
--- /dev/null
+++ b/backends/platform/symbian/mmp/scummvm_tucker.mmp.in
@@ -0,0 +1,57 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL
+ * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System
+ * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer
+ * Copyright (C) 2005-2006 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+//
+// EPOC MMP makefile project for ScummVM
+//
+
+// *** Definitions
+
+TARGET scummvm_tucker.lib
+TARGETTYPE lib
+OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp
+OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings
+OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char
+ALWAYS_BUILD_AS_ARM
+
+//START_AUTO_MACROS_SLAVE//
+
+ // empty base file, will be updated by Perl build scripts
+
+//STOP_AUTO_MACROS_SLAVE//
+
+// *** SOURCE files
+
+SOURCEPATH ..\..\..\..\engines\tucker
+
+//START_AUTO_OBJECTS_TUCKER_//
+
+ // empty base file, will be updated by Perl build scripts
+
+//STOP_AUTO_OBJECTS_TUCKER_//
+
+// *** Include paths
+
+USERINCLUDE ..\..\..\..\engines
+USERINCLUDE ..\..\..\.. ..\..\..\..\common ..\..\..\..\gui ..\..\..\..\sound ..\src
+SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version
+SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src
diff --git a/backends/platform/symbian/res/scummvm_A0000658.rss b/backends/platform/symbian/res/scummvm_A0000658.rss
new file mode 100644
index 0000000000..e1aad95432
--- /dev/null
+++ b/backends/platform/symbian/res/scummvm_A0000658.rss
@@ -0,0 +1,62 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL
+ * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System
+ * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer
+ * Copyright (C) 2005-2006 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/symbian/res/scummvm.rss $
+ */
+
+// ScummVM.RSS
+
+NAME SCUM
+
+// Include definitions of resource STRUCTS used by this
+// resource script
+#include <eikon.rh>
+#include "..\src\Scummvm.hrh"
+// Include the standard Eikon resource ids
+#include <eikon.rsg>
+
+
+RESOURCE RSS_SIGNATURE
+ {
+ }
+
+RESOURCE TBUF16 { buf=""; }
+
+RESOURCE EIK_APP_INFO
+ {
+ menubar = r_scum_menubar;
+ }
+
+RESOURCE MENU_BAR r_scum_menubar // *** Menu bar
+{
+ titles =
+ {
+ MENU_TITLE { menu_pane = r_scum_menu; txt = "ScummVM"; }
+ };
+}
+
+RESOURCE MENU_PANE r_scum_menu // *** Submenu
+{
+ items =
+ {
+
+ MENU_ITEM{command = EEikCmdExit;txt = "Exit";}
+ };
+}
diff --git a/backends/platform/symbian/src/SymbianActions.cpp b/backends/platform/symbian/src/SymbianActions.cpp
index e71b242329..6ad6ff75ce 100644
--- a/backends/platform/symbian/src/SymbianActions.cpp
+++ b/backends/platform/symbian/src/SymbianActions.cpp
@@ -178,7 +178,7 @@ void SymbianActions::initInstanceGame() {
// Skip text
if (!is_cine && !is_parallaction)
_action_enabled[ACTION_SKIP_TEXT] = true;
- if (is_simon || is_sky || is_sword2 || is_queen || is_sword1 || is_gob ||
+ if (is_simon || is_sky || is_sword2 || is_queen || is_sword1 || is_gob ||
is_saga || is_kyra || is_touche || is_lure || is_feeble || is_drascula)
_key_action[ACTION_SKIP_TEXT].setKey(Common::KEYCODE_ESCAPE, Common::KEYCODE_ESCAPE); // Escape key
else {
diff --git a/backends/platform/symbian/src/SymbianOS.cpp b/backends/platform/symbian/src/SymbianOS.cpp
index 254b716927..251ba2c48e 100644
--- a/backends/platform/symbian/src/SymbianOS.cpp
+++ b/backends/platform/symbian/src/SymbianOS.cpp
@@ -25,7 +25,7 @@
#include <eikenv.h> // for CEikonEnv::Static() @ Symbian::FatalError()
#include <sdlapp.h> // for CSDLApp::GetExecutablePathCStr() @ Symbian::GetExecutablePath()
#include <bautils.h>
-
+
#include "backends/fs/symbian/symbian-fs-factory.h"
#include "backends/platform/symbian/src/SymbianOS.h"
#include "backends/platform/symbian/src/SymbianActions.h"
@@ -156,7 +156,7 @@ void OSystem_SDL_Symbian::initBackend() {
// If savepath has not already been set then set it
if (!ConfMan.hasKey("savepath")) {
ConfMan.set("savepath", savePath);
-
+
}
// Ensure that the current set path (might have been altered by the user) exists
@@ -164,7 +164,7 @@ void OSystem_SDL_Symbian::initBackend() {
TFileName fname;
TPtrC8 ptr((const unsigned char*)currentPath.c_str(),currentPath.size());
fname.Copy(ptr);
- BaflUtils::EnsurePathExistsL(static_cast<OSystem_SDL_Symbian*>(g_system)->FsSession(), fname);
+ BaflUtils::EnsurePathExistsL(static_cast<OSystem_SDL_Symbian*>(g_system)->FsSession(), fname);
ConfMan.setBool("FM_high_quality", false);
#if !defined(S60) || defined(S60V3) // S60 has low quality as default
@@ -268,12 +268,12 @@ void OSystem_SDL_Symbian::setupMixer() {
// even if it didn't. Probably only happens for "weird" rates, though.
_samplesPerSec = obtained.freq;
_channels = obtained.channels;
-
+
// Need to create mixbuffer for stereo mix to downmix
if (_channels != 2) {
_stereo_mix_buffer = new byte [obtained.size*2];//*2 for stereo values
}
-
+
// Tell the mixer that we are ready and start the sound processing
_mixer->setOutputRate(_samplesPerSec);
_mixer->setReady(true);
diff --git a/backends/platform/symbian/src/portdefs.h b/backends/platform/symbian/src/portdefs.h
index ab8333c986..8e1ba150cc 100644
--- a/backends/platform/symbian/src/portdefs.h
+++ b/backends/platform/symbian/src/portdefs.h
@@ -35,6 +35,9 @@
#include <e32std.h>
#include <math.h>
+#define DISABLE_COMMAND_LINE
+#define VECTOR_RENDERER_FORMAT 565
+
#if defined(USE_TREMOR) && !defined(USE_VORBIS)
#define USE_VORBIS // make sure this one is defined together with USE_TREMOR!
#endif
diff --git a/backends/platform/symbian/src/vsnprintf.h b/backends/platform/symbian/src/vsnprintf.h
index 5ed04b1980..5a9c836ea3 100644
--- a/backends/platform/symbian/src/vsnprintf.h
+++ b/backends/platform/symbian/src/vsnprintf.h
@@ -1,9 +1,9 @@
/*
- * This is the vsnprintf for scummvm/symbian implementation from the original snprintf.c,
+ * This is the vsnprintf for scummvm/symbian implementation from the original snprintf.c,
* all support functions has been removed and vsnprintf renamed to symbian_vsnprintf
* snprintf.c - a portable implementation of snprintf
* According to the homepage this function could be licensed as either Frontier Aritistic or GPL.
- *
+ *
* AUTHOR
* Mark Martinec <mark.martinec@ijs.si>, April 1999.
*
@@ -230,14 +230,14 @@ static char credits[] = "\n\
@(#)snprintf.c, v2.2: Copyright 1999, Mark Martinec. Frontier Artistic License applies.\n\
@(#)snprintf.c, v2.2: http://www.ijs.si/software/snprintf/\n";
int symbian_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) {
-
+
size_t str_l = 0;
const char *p = fmt;
-
+
/* In contrast with POSIX, the ISO C99 now says
* that str can be NULL and str_m can be 0.
* This is more useful than the old: if (str_m < 1) return -1; */
-
+
if (!p) p = "";
while (*p) {
if (*p != '%') {
@@ -260,7 +260,7 @@ int symbian_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) {
the ' ' flag should be ignored. */
char length_modifier = '\0'; /* allowed values: \0, h, l, L */
char tmp[32];/* temporary buffer for simple numeric->string conversion */
-
+
const char *str_arg; /* string address in case of string argument */
size_t str_arg_l; /* natural field width of arg without padding
and sign */
@@ -268,17 +268,17 @@ int symbian_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) {
/* unsigned char argument value - only defined for c conversion.
N.B. standard explicitly states the char argument for
the c conversion is unsigned */
-
+
size_t number_of_zeros_to_pad = 0;
/* number of zeros to be inserted for numeric conversions
as required by the precision or minimal field width */
-
+
size_t zero_padding_insertion_ind = 0;
/* index into tmp where zero padding is to be inserted */
-
+
char fmt_spec = '\0';
/* current conversion specifier character */
-
+
str_arg = credits;/* just to make compiler happy (defined but not used)*/
str_arg = NULL;
starting_p = p; p++; /* skip '%' */
@@ -298,7 +298,7 @@ int symbian_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) {
p++;
}
/* If the '0' and '-' flags both appear, the '0' flag should be ignored. */
-
+
/* parse field width */
if (*p == '*') {
int j;
@@ -397,21 +397,21 @@ int symbian_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) {
case 'd': case 'u': case 'o': case 'x': case 'X': case 'p': {
/* NOTE: the u, o, x, X and p conversion specifiers imply
the value is unsigned; d implies a signed value */
-
+
int arg_sign = 0;
/* 0 if numeric argument is zero (or if pointer is NULL for 'p'),
+1 if greater than zero (or nonzero for unsigned arguments),
-1 if negative (unsigned argument is never negative) */
-
+
int int_arg = 0; unsigned int uint_arg = 0;
/* only defined for length modifier h, or for no length modifiers */
-
+
long int long_arg = 0; unsigned long int ulong_arg = 0;
/* only defined for length modifier l */
-
+
void *ptr_arg = NULL;
/* pointer argument value -only defined for p conversion */
-
+
#ifdef SNPRINTF_LONGLONG_SUPPORT
long long int long_long_arg = 0;
unsigned long long int ulong_long_arg = 0;
@@ -554,7 +554,7 @@ int symbian_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) {
}
}
/* zero padding to specified precision? */
- if (num_of_digits < precision)
+ if (num_of_digits < precision)
number_of_zeros_to_pad = precision - num_of_digits;
}
/* zero padding to specified minimal field width? */
@@ -659,10 +659,10 @@ int symbian_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) {
int symbian_snprintf(char *text, size_t maxlen, const char *fmt, ...) {
va_list ap;
int retval;
-
+
va_start(ap, fmt);
retval = symbian_vsnprintf(text, maxlen, fmt, ap);
va_end(ap);
-
+
return retval;
}
diff --git a/backends/platform/wii/Makefile b/backends/platform/wii/Makefile
index 90ebcccb66..dd3728a05e 100644
--- a/backends/platform/wii/Makefile
+++ b/backends/platform/wii/Makefile
@@ -14,6 +14,7 @@ ENABLE_CINE = STATIC_PLUGIN
ENABLE_CRUISE = STATIC_PLUGIN
ENABLE_DRASCULA = STATIC_PLUGIN
ENABLE_GOB = STATIC_PLUGIN
+ENABLE_GROOVIE = STATIC_PLUGIN
ENABLE_IGOR = STATIC_PLUGIN
ENABLE_KYRA = STATIC_PLUGIN
ENABLE_LURE = STATIC_PLUGIN
@@ -27,6 +28,7 @@ ENABLE_SWORD1 = STATIC_PLUGIN
ENABLE_SWORD2 = STATIC_PLUGIN
ENABLE_TINSEL = STATIC_PLUGIN
ENABLE_TOUCHE = STATIC_PLUGIN
+ENABLE_TUCKER = STATIC_PLUGIN
DISABLE_HQ_SCALERS = 1
DISABLE_SCALERS = 1
@@ -35,7 +37,7 @@ USE_ZLIB = 1
USE_MAD = 1
USE_TREMOR = 1
USE_FLAC = 1
-USE_MPEG2 = 1
+#USE_MPEG2 = 1
ifeq ($(GAMECUBE),1)
USE_MT32EMU = 0
else
@@ -59,9 +61,10 @@ LD = $(PREFIX)gcc
AR = $(PREFIX)ar cru
RANLIB = $(PREFIX)ranlib
STRIP = $(PREFIX)strip -g
-OBJCOPY = $(PREFIX)objcopy
+GDB = $(PREFIX)gdb
MKDIR = mkdir -p
RM = rm -f
+RM_REC = rm -rf
CP = cp -f
ifeq ($(GAMECUBE),1)
@@ -125,7 +128,6 @@ CXXFLAGS += -DUSE_MT32EMU
endif
OBJS := backends/platform/wii/main.o \
- backends/platform/wii/gecko_console.o \
backends/platform/wii/gx_supp.o \
backends/platform/wii/osystem.o \
backends/platform/wii/osystem_gfx.o \
@@ -139,7 +141,7 @@ include $(srcdir)/Makefile.common
all: $(TARGET).dol
$(TARGET).dol: $(TARGET).elf
- $(OBJCOPY) -O binary $< $@
+ $(DEVKITPPC)/bin/elf2dol $< $@
$(TARGET).elf: $(OBJS)
$(LD) $^ $(LDFLAGS) $(LIBS) -o $@
@@ -147,20 +149,26 @@ $(TARGET).elf: $(OBJS)
clean: clean-wii
clean-wii:
- @-$(RM) $(TARGET).elf $(TARGET).elf.map $(TARGET).dol
+ @$(RM) $(TARGET).elf $(TARGET).elf.map $(TARGET).dol
distclean: distclean-wii
distclean-wii:
- @-$(RM) dist
+ @$(RM_REC) dist
-upload:
+upload: $(TARGET).dol
ifeq ($(GAMECUBE),1)
$(DEVKITPPC)/bin/geckoupload $(TARGET).dol
else
$(DEVKITPPC)/bin/wiiload $(TARGET).dol
endif
+gdb:
+ $(GDB) -n $(TARGET).elf
+
+debug:
+ $(GDB) -n $(TARGET).elf -x gdb.txt
+
dist:
$(MKDIR) dist/scummvm
ifeq ($(GAMECUBE),1)
@@ -177,5 +185,7 @@ endif
$(CP) $(srcdir)/NEWS dist/scummvm/
$(CP) $(srcdir)/README dist/scummvm/
$(CP) $(DIST_FILES_THEMES) dist/scummvm/
+ifneq ($(DIST_FILES_ENGINEDATA),)
$(CP) $(DIST_FILES_ENGINEDATA) dist/scummvm/
+endif
diff --git a/backends/platform/wii/gdb.txt b/backends/platform/wii/gdb.txt
new file mode 100644
index 0000000000..4e6c7928c3
--- /dev/null
+++ b/backends/platform/wii/gdb.txt
@@ -0,0 +1,4 @@
+target remote /dev/ttyUSB0
+info threads
+bt
+
diff --git a/backends/platform/wii/gecko_console.cpp b/backends/platform/wii/gecko_console.cpp
deleted file mode 100644
index c419f6e7e5..0000000000
--- a/backends/platform/wii/gecko_console.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*-------------------------------------------------------------
-
-Copyright (C) 2008
-Hector Martin (marcan)
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any
-damages arising from the use of this software.
-
-Permission is granted to anyone to use this software for any
-purpose, including commercial applications, and to alter it and
-redistribute it freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you
-must not claim that you wrote the original software. If you use
-this software in a product, an acknowledgment in the product
-documentation would be appreciated but is not required.
-
-2. Altered source versions must be plainly marked as such, and
-must not be misrepresented as being the original software.
-
-3. This notice may not be removed or altered from any source
-distribution.
-
--------------------------------------------------------------*/
-
-#include <stdio.h>
-#include <sys/iosupport.h>
-#include <ogcsys.h>
-#include <gccore.h>
-#include <reent.h>
-
-#include "gecko_console.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-static const devoptab_t *dotab_console;
-int usb_sendbuffer_safe(s32 chn,const void *buffer,int size);
-int usb_sendbuffer(s32 chn,const void *buffer,int size);
-
-int __gecko_write(struct _reent *r,int fd,const char *ptr,int len) {
- char *tmp = (char*)ptr;
- u32 level;
- if(dotab_console)
- dotab_console->write_r(r,fd,ptr,len);
-
- if(!tmp || len<=0)
- return -1;
- level = IRQ_Disable();
- usb_sendbuffer(1, ptr, len);
- IRQ_Restore(level);
- return len;
-}
-
-const devoptab_t dotab_gecko = {
- "stdout", // device name
- 0, // size of file structure
- NULL, // device open
- NULL, // device close
- __gecko_write, // device write
- NULL, // device read
- NULL, // device seek
- NULL, // device fstat
- NULL, // device stat
- NULL, // device link
- NULL, // device unlink
- NULL, // device chdir
- NULL, // device rename
- NULL, // device mkdir
- 0, // dirStateSize
- NULL, // device diropen_r
- NULL, // device dirreset_r
- NULL, // device dirnext_r
- NULL, // device dirclose_r
- NULL // device statvfs_r
-};
-
-void gecko_console_init(int chain) {
- dotab_console = NULL;
- if(chain)
- dotab_console = devoptab_list[STD_OUT];
- devoptab_list[STD_OUT] = &dotab_gecko;
- devoptab_list[STD_ERR] = &dotab_gecko;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
diff --git a/backends/platform/wii/gecko_console.h b/backends/platform/wii/gecko_console.h
deleted file mode 100644
index ba7c393add..0000000000
--- a/backends/platform/wii/gecko_console.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _WII_GECKO_CONSOLE_H_
-#define _WII_GECKO_CONSOLE_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void gecko_console_init(int chain);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/backends/platform/wii/gx_supp.cpp b/backends/platform/wii/gx_supp.cpp
index 436deddbb8..f8dacbd8ec 100644
--- a/backends/platform/wii/gx_supp.cpp
+++ b/backends/platform/wii/gx_supp.cpp
@@ -78,8 +78,13 @@ static camera cam = {
void GX_InitVideo() {
vmode = VIDEO_GetPreferredMode(NULL);
- vmode->viWidth = 678;
- vmode->viXOrigin = (VI_MAX_WIDTH_PAL - 678) / 2;
+#ifdef GAMECUBE
+ if(VIDEO_HaveComponentCable())
+ vmode = &TVNtsc480Prog;
+#endif
+
+ vmode->viWidth = 688;
+ vmode->viXOrigin = (VI_MAX_WIDTH_PAL - 688) / 2;
VIDEO_Configure(vmode);
diff --git a/backends/platform/wii/gx_supp.h b/backends/platform/wii/gx_supp.h
index 108a94f0e7..3433ef8df5 100644
--- a/backends/platform/wii/gx_supp.h
+++ b/backends/platform/wii/gx_supp.h
@@ -1,5 +1,5 @@
/****************************************************************************
-* Generic GX Scaler
+* Generic GX Scaler
* softdev 2007
* dhewg 2008
*
diff --git a/backends/platform/wii/main.cpp b/backends/platform/wii/main.cpp
index 8bb1bff904..c1c403bdd8 100644
--- a/backends/platform/wii/main.cpp
+++ b/backends/platform/wii/main.cpp
@@ -19,17 +19,17 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#include <fat.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
#include <unistd.h>
+#include <fat.h>
+
#include "osystem.h"
#ifdef DEBUG_WII
#include <debug.h>
-#include <gecko_console.h>
#endif
#ifdef __cplusplus
@@ -55,11 +55,15 @@ int main(int argc, char *argv[]) {
AUDIO_Init(NULL);
#ifdef DEBUG_WII
- gecko_console_init(0);
+ CON_EnableGecko(1, false);
//DEBUG_Init(GDBSTUB_DEVICE_USB, 1);
#endif
- printf("startup\n");
+ printf("startup as ");
+ if (argc > 0)
+ printf("'%s'\n", argv[0]);
+ else
+ printf("<unknown>\n");
SYS_SetResetCallback(reset_cb);
#ifndef GAMECUBE
@@ -69,15 +73,23 @@ int main(int argc, char *argv[]) {
if (!fatInitDefault()) {
printf("fatInitDefault failed\n");
} else {
+#ifdef LIBFAT_READAHEAD_CACHE
+ fatSetReadAheadDefault(16, 32);
+#else
+ printf("read ahead cache not available\n");
+#endif
// set the default path if libfat couldnt set it
// this allows loading over tcp/usbgecko
- char buf[MAXPATHLEN];
+ char cwd[MAXPATHLEN];
- getcwd(buf, MAXPATHLEN);
- if (!strcmp(buf, "fat:/"))
- chdir("/apps/scummvm");
+ if (getcwd(cwd, MAXPATHLEN)) {
+ size_t len = strlen(cwd);
- fatEnableReadAhead(PI_DEFAULT, 32, 128);
+ if (len > 2 && (cwd[len - 1] == ':' || cwd[len - 2] == ':')) {
+ printf("chdir to default\n");
+ chdir("/apps/scummvm");
+ }
+ }
}
g_system = new OSystem_Wii();
@@ -88,10 +100,9 @@ int main(int argc, char *argv[]) {
printf("shutdown\n");
- if (!fatUnmount(PI_DEFAULT)) {
- printf("fatUnmount failed\n");
- fatUnsafeUnmount(PI_DEFAULT);
- }
+#ifdef LIBFAT_READAHEAD_CACHE
+ fatUnmountDefault();
+#endif
if (power_btn_pressed) {
printf("shutting down\n");
diff --git a/backends/platform/wii/osystem.cpp b/backends/platform/wii/osystem.cpp
index 505f93c820..885a460bac 100644
--- a/backends/platform/wii/osystem.cpp
+++ b/backends/platform/wii/osystem.cpp
@@ -93,7 +93,7 @@ OSystem_Wii::~OSystem_Wii() {
void OSystem_Wii::initBackend() {
_startup_time = gettime();
-
+
char buf[MAXPATHLEN];
if (!getcwd(buf, MAXPATHLEN))
strcpy(buf, "/");
@@ -152,7 +152,7 @@ void OSystem_Wii::delayMillis(uint msecs) {
OSystem::MutexRef OSystem_Wii::createMutex() {
mutex_t *mutex = (mutex_t *) malloc(sizeof(mutex_t));
- s32 res = LWP_MutexInit(mutex, false);
+ s32 res = LWP_MutexInit(mutex, true);
if (res) {
printf("ERROR creating mutex\n");
diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h
index 94c0fa76b3..bedfadd934 100644
--- a/backends/platform/wii/osystem.h
+++ b/backends/platform/wii/osystem.h
@@ -136,12 +136,7 @@ public:
int x, int y, int w, int h);
virtual int16 getOverlayWidth();
virtual int16 getOverlayHeight();
-
- virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b);
- virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b);
- virtual OverlayColor ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b);
- virtual void colorToARGB(OverlayColor color, uint8 &a, uint8 &r,
- uint8 &g, uint8 &b);
+ virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<565>(); }
virtual bool showMouse(bool visible);
diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp
index faad41d5f0..6402ce9a35 100644
--- a/backends/platform/wii/osystem_gfx.cpp
+++ b/backends/platform/wii/osystem_gfx.cpp
@@ -49,7 +49,7 @@ void OSystem_Wii::initGfx() {
#ifndef GAMECUBE
if (CONF_GetAspectRatio() && _fullscreen)
- _overlayHeight = 360;
+ _overlayHeight = 400;
#endif
_overlaySize = _overlayWidth * _overlayHeight * 2;
@@ -197,7 +197,7 @@ int16 OSystem_Wii::getHeight() {
void OSystem_Wii::setPalette(const byte *colors, uint start, uint num) {
const byte *p = colors;
for (uint i = 0; i < num; ++i) {
- _palette[start + i] = RGBToColor(p[0], p[1], p[2]);
+ _palette[start + i] = Graphics::RGBToColor<Graphics::ColorMasks<565> >(p[0], p[1], p[2]);
p += 4;
}
}
@@ -206,7 +206,7 @@ void OSystem_Wii::grabPalette(byte *colors, uint start, uint num) {
byte *p = colors;
u8 r, g, b;
for (uint i = 0; i < num; ++i) {
- colorToRGB(_palette[start + i], r, g, b);
+ Graphics::colorToRGB<Graphics::ColorMasks<565> >(_palette[start + i], r, g, b);
p[0] = r;
p[1] = g;
p[2] = b;
@@ -218,7 +218,7 @@ void OSystem_Wii::grabPalette(byte *colors, uint start, uint num) {
void OSystem_Wii::setCursorPalette(const byte *colors, uint start, uint num) {
const byte *p = colors;
for (uint i = 0; i < num; ++i) {
- _cursorPalette[start + i] = RGBToColor(p[0], p[1], p[2]);
+ _cursorPalette[start + i] = Graphics::RGBToColor<Graphics::ColorMasks<565> >(p[0], p[1], p[2]);
p += 4;
}
@@ -291,7 +291,7 @@ void OSystem_Wii::updateScreen() {
if (_mouseVisible) {
msx = _mouseX - _mouseHotspotX;
- msy = _mouseY - _mouseHotspotY;
+ msy = _mouseY - _mouseHotspotY;
mox = 0;
moy = 0;
mpx = _mouseWidth;
@@ -443,27 +443,6 @@ int16 OSystem_Wii::getOverlayHeight() {
return _overlayHeight;
}
-OverlayColor OSystem_Wii::RGBToColor(uint8 r, uint8 g, uint8 b) {
- return (((r >> 3) & 0x1f) << 11) | (((g >> 2) & 0x3f) << 5 ) |
- ((b >> 3) & 0x1f);
-}
-
-void OSystem_Wii::colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) {
- r = ((color >> 11) & 0x1f) << 3;
- g = ((color >> 5) & 0x3f) << 2;
- b = (color & 0x1f) << 3;
-}
-
-OverlayColor OSystem_Wii::ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b) {
- return RGBToColor(r, g, b);
-}
-
-void OSystem_Wii::colorToARGB(OverlayColor color, uint8 &a, uint8 &r, uint8 &g,
- uint8 &b) {
- a = 0xff;
- colorToRGB(color, r, g, b);
-}
-
bool OSystem_Wii::showMouse(bool visible) {
bool last = _mouseVisible;
_mouseVisible = visible;
diff --git a/backends/platform/wince/CEActionsPocket.cpp b/backends/platform/wince/CEActionsPocket.cpp
index 7f78517762..3a83d4dadf 100644
--- a/backends/platform/wince/CEActionsPocket.cpp
+++ b/backends/platform/wince/CEActionsPocket.cpp
@@ -134,7 +134,7 @@ void CEActionsPocket::initInstanceGame() {
GUI_Actions::initInstanceGame();
// See if a right click mapping could be needed
- if (is_sword1 || is_sword2 || is_sky || is_queen || is_comi || is_gob ||
+ if (is_sword1 || is_sword2 || is_sky || is_queen || is_comi || is_gob ||
is_samnmax || is_cine || is_touche || is_parallaction || is_drascula)
_right_click_needed = true;
@@ -173,7 +173,7 @@ void CEActionsPocket::initInstanceGame() {
// Skip
if (!is_cine && !is_parallaction)
_action_enabled[POCKET_ACTION_SKIP] = true;
- if (is_simon || is_sky || is_sword2 || is_queen || is_sword1 || is_gob ||
+ if (is_simon || is_sky || is_sword2 || is_queen || is_sword1 || is_gob ||
is_saga || is_kyra || is_touche || is_lure || is_feeble || is_drascula)
_key_action[POCKET_ACTION_SKIP].setKey(VK_ESCAPE);
else
diff --git a/backends/platform/wince/CELauncherDialog.cpp b/backends/platform/wince/CELauncherDialog.cpp
index f0dfda5ee4..21a967336e 100644
--- a/backends/platform/wince/CELauncherDialog.cpp
+++ b/backends/platform/wince/CELauncherDialog.cpp
@@ -30,10 +30,11 @@
#include "engines/metaengine.h"
-#include "gui/newgui.h"
+#include "gui/GuiManager.h"
#include "gui/widget.h"
#include "gui/browser.h"
#include "gui/message.h"
+#include "gui/ThemeEval.h"
#include "common/config-manager.h"
@@ -48,16 +49,18 @@ public:
// FIXME: Fingolfin asks: why is there a FIXME here? Please either clarify what
// needs fixing, or remove it!
- addButton(this,(_w - kButtonWidth) / 2, 45, "OK", kCloseCmd, '\r'); // Close dialog - FIXME
+ const int buttonWidth = g_gui.xmlEval()->getVar("Globals.Button.Width", 0);
+ const int buttonHeight = g_gui.xmlEval()->getVar("Globals.Button.Height", 0);
+ new ButtonWidget(this, (_w - buttonWidth) / 2, 45, buttonWidth, buttonHeight, "OK", kCloseCmd, '\r'); // Close dialog - FIXME
Common::String videoDriver("Using SDL driver ");
SDL_VideoDriverName(tempo, sizeof(tempo));
videoDriver += tempo;
- new StaticTextWidget(this, 0, 10, _w, kLineHeight, videoDriver, kTextAlignCenter);
+ new StaticTextWidget(this, 0, 10, _w, kLineHeight, videoDriver, Graphics::kTextAlignCenter);
Common::String displayInfos("Display ");
sprintf(tempo, "%dx%d (real %dx%d)", GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), OSystem_WINCE3::getScreenWidth(), OSystem_WINCE3::getScreenHeight());
displayInfos += tempo;
- new StaticTextWidget(this, 0, 20, _w, kLineHeight, displayInfos, kTextAlignCenter);
+ new StaticTextWidget(this, 0, 20, _w, kLineHeight, displayInfos, Graphics::kTextAlignCenter);
}
};
diff --git a/backends/platform/wince/Makefile b/backends/platform/wince/Makefile
index 9f040bbed1..6e01312cb3 100644
--- a/backends/platform/wince/Makefile
+++ b/backends/platform/wince/Makefile
@@ -27,6 +27,8 @@ ENABLE_GOB = STATIC_PLUGIN
ENABLE_LURE = STATIC_PLUGIN
ENABLE_CINE = STATIC_PLUGIN
ENABLE_SAGA = STATIC_PLUGIN
+ENABLE_IHNM = 1
+#ENABLE_SAGA2 = 1
ENABLE_KYRA = STATIC_PLUGIN
ENABLE_AGI = STATIC_PLUGIN
ENABLE_AGOS = STATIC_PLUGIN
diff --git a/backends/platform/wince/missing/missing.cpp b/backends/platform/wince/missing/missing.cpp
index f03f00bb9a..5f122e0c54 100644
--- a/backends/platform/wince/missing/missing.cpp
+++ b/backends/platform/wince/missing/missing.cpp
@@ -150,8 +150,8 @@ EXT_C FILE *wce_fopen(const char* fname, const char* fmode) {
return NULL;
if (fname[0] != '\\' && fname[0] != '/') {
getcwd(fullname, MAX_PATH);
- strncat(fullname, "\\", MAX_PATH-strlen(fullname)-1);
- strncat(fullname, fname, MAX_PATH-strlen(fullname)-strlen(fname));
+ strcat(fullname, "\\");
+ strcat(fullname, fname);
return fopen(fullname, fmode);
} else
return fopen(fname, fmode);
@@ -168,7 +168,15 @@ int remove(const char* path) {
/* check out file access permissions */
int _access(const char *path, int mode) {
TCHAR fname[MAX_PATH];
- MultiByteToWideChar(CP_ACP, 0, path, -1, fname, sizeof(fname)/sizeof(TCHAR));
+ char fullname[MAX_PATH+1];
+
+ if (path[0] != '\\' && path[0] != '/') {
+ getcwd(fullname, MAX_PATH);
+ strcat(fullname, "\\");
+ strcat(fullname, path);
+ MultiByteToWideChar(CP_ACP, 0, fullname, -1, fname, sizeof(fname)/sizeof(TCHAR));
+ } else
+ MultiByteToWideChar(CP_ACP, 0, path, -1, fname, sizeof(fname)/sizeof(TCHAR));
WIN32_FIND_DATA ffd;
HANDLE h = FindFirstFile(fname, &ffd);
diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp
index f09a483086..b891a83689 100644
--- a/backends/platform/wince/wince-sdl.cpp
+++ b/backends/platform/wince/wince-sdl.cpp
@@ -82,7 +82,7 @@ using namespace CEGUI;
#define NAME_ITEM_OPTIONS "Options"
#define NAME_ITEM_SKIP "Skip"
#define NAME_ITEM_SOUND "Sound"
-#define NAME_ITEM_ORIENTATION "Orientation"
+#define NAME_ITEM_ORIENTATION "Orientation"
#define NAME_ITEM_BINDKEYS "Bindkeys"
// stdin/err redirection
@@ -126,6 +126,7 @@ static const OSystem::GraphicsMode s_supportedGraphicsModesHigh[] = {
{0, 0, 0}
};
+#define DEFAULT_CONFIG_FILE "scummvm.ini"
// ********************************************************************************************
@@ -354,7 +355,7 @@ int dynamic_modules_main(HINSTANCE hInst, HINSTANCE hPrev, LPWSTR szCmdLine, int
argv = (char **) alloca((argc+1)*(sizeof *argv));
ParseCommandLine(cmdline, argv);
- /* fix gdb-emulator combo */
+ // fix gdb-emulator combo
while (argc > 1 && !strstr(argv[0], ".exe")) {
OutputDebugString(TEXT("SDL: gdb argv[0] fixup\n"));
*(argv[1]-1) = ' ';
@@ -454,6 +455,24 @@ bool OSystem_WINCE3::isOzone() {
return _isOzone;
}
+static Common::String getDefaultConfigFileName() {
+ char configFile[MAXPATHLEN];
+ strcpy(configFile, getcwd(NULL, MAX_PATH));
+ strcat(configFile, "\\");
+ strcat(configFile, DEFAULT_CONFIG_FILE);
+ return configFile;
+}
+
+Common::SeekableReadStream *OSystem_WINCE3::openConfigFileForReading() {
+ Common::FSNode file(getDefaultConfigFileName());
+ return file.openForReading();
+}
+
+Common::WriteStream *OSystem_WINCE3::openConfigFileForWriting() {
+ Common::FSNode file(getDefaultConfigFileName());
+ return file.openForWriting();
+}
+
// ********************************************************************************************
@@ -492,7 +511,7 @@ void OSystem_WINCE3::swap_panel_visibility() {
_toolbarHandler.setVisible(_panelVisible);
_toolbarHighDrawn = false;
- if (_screenHeight > 240)
+ if (_videoMode.screenHeight > 240)
addDirtyRect(0, 400, 640, 80);
else
addDirtyRect(0, 200, 320, 40);
@@ -514,7 +533,7 @@ void OSystem_WINCE3::swap_panel() {
else
_toolbarHandler.setActive(NAME_PANEL_KEYBOARD);
- if (_screenHeight > 240)
+ if (_videoMode.screenHeight > 240)
addDirtyRect(0, 400, 640, 80);
else
addDirtyRect(0, 200, 320, 40);
@@ -532,7 +551,7 @@ void OSystem_WINCE3::swap_smartphone_keyboard() {
_toolbarHandler.setActive(NAME_PANEL_KEYBOARD);
_panelVisible = !_panelVisible;
_toolbarHandler.setVisible(_panelVisible);
- if (_screenHeight > 240)
+ if (_videoMode.screenHeight > 240)
addDirtyRect(0, 0, 640, 80);
else
addDirtyRect(0, 0, 320, 40);
@@ -698,8 +717,8 @@ void OSystem_WINCE3::move_cursor_down() {
else
y += _stepY1;
- if (y > _screenHeight*_scaleFactorYm/_scaleFactorYd)
- y = _screenHeight*_scaleFactorYm/_scaleFactorYd;
+ if (y > _videoMode.screenHeight*_scaleFactorYm/_scaleFactorYd)
+ y = _videoMode.screenHeight*_scaleFactorYm/_scaleFactorYd;
EventsBuffer::simulateMouseMove(x, y);
}
@@ -734,8 +753,8 @@ void OSystem_WINCE3::move_cursor_right() {
else
x += _stepX1;
- if (x > _screenWidth*_scaleFactorXm/_scaleFactorXd)
- x = _screenWidth*_scaleFactorXm/_scaleFactorXd;
+ if (x > _videoMode.screenWidth*_scaleFactorXm/_scaleFactorXd)
+ x = _videoMode.screenWidth*_scaleFactorXm/_scaleFactorXd;
EventsBuffer::simulateMouseMove(x, y);
}
@@ -1050,7 +1069,7 @@ void OSystem_WINCE3::update_game_settings() {
_toolbarHandler.setActive(NAME_MAIN_PANEL);
_toolbarHandler.setVisible(true);
- if (_mode == GFX_NORMAL && ConfMan.hasKey("landscape") && ConfMan.getInt("landscape")) {
+ if (_videoMode.mode == GFX_NORMAL && ConfMan.hasKey("landscape") && ConfMan.getInt("landscape")) {
setGraphicsMode(GFX_NORMAL);
hotswapGFXMode();
}
@@ -1077,19 +1096,6 @@ void OSystem_WINCE3::initSize(uint w, uint h) {
ConfMan.flushToDisk();
}
- switch (_transactionMode) {
- case kTransactionActive:
- _transactionDetails.w = w;
- _transactionDetails.h = h;
- _transactionDetails.sizeChanged = true;
- _transactionDetails.needUnload = true;
- return;
- case kTransactionCommit:
- break;
- default:
- break;
- }
-
if (w == 320 && h == 200 && !_hasSmartphoneResolution)
h = 240; // use the extra 40 pixels height for the toolbar
@@ -1107,11 +1113,11 @@ void OSystem_WINCE3::initSize(uint w, uint h) {
else // 176x220
_toolbarHandler.setOffset(0);
- if (w != (uint) _screenWidth || h != (uint) _screenHeight)
+ if (w != (uint) _videoMode.screenWidth || h != (uint) _videoMode.screenHeight)
_scalersChanged = false;
- _overlayWidth = w;
- _overlayHeight = h;
+ _videoMode.overlayWidth = w;
+ _videoMode.overlayHeight = h;
OSystem_SDL::initSize(w, h);
@@ -1129,14 +1135,19 @@ int OSystem_WINCE3::getDefaultGraphicsMode() const {
return GFX_NORMAL;
}
+void OSystem_WINCE3::setGraphicsModeIntern() {
+ // Scalers have been pre-selected for the desired mode.
+ // No further tuning required.
+}
+
bool OSystem_WINCE3::update_scalers() {
- if (_mode != GFX_NORMAL)
+ if (_videoMode.mode != GFX_NORMAL)
return false;
- _adjustAspectRatio = false;
+ _videoMode.aspectRatio = false;
if (CEDevice::hasPocketPCResolution()) {
- if ( (!_orientationLandscape && (_screenWidth == 320 || !_screenWidth))
+ if ( (!_orientationLandscape && (_videoMode.screenWidth == 320 || !_videoMode.screenWidth))
|| CEDevice::hasSquareQVGAResolution() ) {
if (getScreenWidth() != 320) {
_scaleFactorXm = 3;
@@ -1153,8 +1164,8 @@ bool OSystem_WINCE3::update_scalers() {
_scalerProc = Normal1x;
_modeFlags = 0;
}
- } else if ( _orientationLandscape && (_screenWidth == 320 || !_screenWidth)) {
- Common::String gameid(ConfMan.get("gameid")); // consider removing this check and start honoring the _adjustAspectRatio flag
+ } else if ( _orientationLandscape && (_videoMode.screenWidth == 320 || !_videoMode.screenWidth)) {
+ Common::String gameid(ConfMan.get("gameid")); // consider removing this check and start honoring the _videoMode.aspectRatio flag
if (!_panelVisible && !_hasSmartphoneResolution && !_overlayVisible && !(strncmp(gameid.c_str(), "zak", 3) == 0)) {
_scaleFactorXm = 1;
_scaleFactorXd = 1;
@@ -1162,7 +1173,7 @@ bool OSystem_WINCE3::update_scalers() {
_scaleFactorYd = 5;
_scalerProc = PocketPCLandscapeAspect;
_modeFlags = 0;
- _adjustAspectRatio = true;
+ _videoMode.aspectRatio = true;
} else {
_scaleFactorXm = 1;
_scaleFactorXd = 1;
@@ -1171,14 +1182,14 @@ bool OSystem_WINCE3::update_scalers() {
_scalerProc = Normal1x;
_modeFlags = 0;
}
- } else if (_screenWidth == 640 && !(isOzone() && (getScreenWidth() >= 640 || getScreenHeight() >= 640))) {
+ } else if (_videoMode.screenWidth == 640 && !(isOzone() && (getScreenWidth() >= 640 || getScreenHeight() >= 640))) {
_scaleFactorXm = 1;
_scaleFactorXd = 2;
_scaleFactorYm = 1;
_scaleFactorYd = 2;
_scalerProc = PocketPCHalf;
_modeFlags = 0;
- } else if (_screenWidth == 640 && (isOzone() && (getScreenWidth() >= 640 || getScreenHeight() >= 640))) {
+ } else if (_videoMode.screenWidth == 640 && (isOzone() && (getScreenWidth() >= 640 || getScreenHeight() >= 640))) {
_scaleFactorXm = 1;
_scaleFactorXd = 1;
_scaleFactorYm = 1;
@@ -1191,7 +1202,7 @@ bool OSystem_WINCE3::update_scalers() {
}
if (CEDevice::hasSmartphoneResolution()) {
- if (_screenWidth > 320)
+ if (_videoMode.screenWidth > 320)
error("Game resolution not supported on Smartphone");
_scaleFactorXm = 2;
_scaleFactorXd = 3;
@@ -1208,17 +1219,6 @@ bool OSystem_WINCE3::update_scalers() {
bool OSystem_WINCE3::setGraphicsMode(int mode) {
- switch (_transactionMode) {
- case kTransactionActive:
- _transactionDetails.mode = mode;
- _transactionDetails.modeChanged = true;
- return true;
- case kTransactionCommit:
- break;
- default:
- break;
- }
-
Common::StackLock lock(_graphicsMutex);
int oldScaleFactorXm = _scaleFactorXm;
int oldScaleFactorXd = _scaleFactorXd;
@@ -1241,88 +1241,85 @@ bool OSystem_WINCE3::setGraphicsMode(int mode) {
update_scalers();
- // FIXME: Fingolfin asks: why is there a FIXME here? Please either clarify what
- // needs fixing, or remove it!
- // FIXME
if (isOzone() && (getScreenWidth() >= 640 || getScreenHeight() >= 640) && mode)
_scaleFactorXm = -1;
if (CEDevice::hasPocketPCResolution() && !CEDevice::hasWideResolution() && _orientationLandscape)
- _mode = GFX_NORMAL;
+ _videoMode.mode = GFX_NORMAL;
else
- _mode = mode;
+ _videoMode.mode = mode;
if (_scaleFactorXm < 0) {
/* Standard scalers, from the SDL backend */
- switch(_mode) {
+ switch(_videoMode.mode) {
case GFX_NORMAL:
- _scaleFactor = 1;
+ _videoMode.scaleFactor = 1;
_scalerProc = Normal1x;
break;
case GFX_DOUBLESIZE:
- _scaleFactor = 2;
+ _videoMode.scaleFactor = 2;
_scalerProc = Normal2x;
break;
case GFX_TRIPLESIZE:
- _scaleFactor = 3;
+ _videoMode.scaleFactor = 3;
_scalerProc = Normal3x;
break;
case GFX_2XSAI:
- _scaleFactor = 2;
+ _videoMode.scaleFactor = 2;
_scalerProc = _2xSaI;
break;
case GFX_SUPER2XSAI:
- _scaleFactor = 2;
+ _videoMode.scaleFactor = 2;
_scalerProc = Super2xSaI;
break;
case GFX_SUPEREAGLE:
- _scaleFactor = 2;
+ _videoMode.scaleFactor = 2;
_scalerProc = SuperEagle;
break;
case GFX_ADVMAME2X:
- _scaleFactor = 2;
+ _videoMode.scaleFactor = 2;
_scalerProc = AdvMame2x;
break;
case GFX_ADVMAME3X:
- _scaleFactor = 3;
+ _videoMode.scaleFactor = 3;
_scalerProc = AdvMame3x;
break;
#ifndef DISABLE_HQ_SCALERS
case GFX_HQ2X:
- _scaleFactor = 2;
+ _videoMode.scaleFactor = 2;
_scalerProc = HQ2x;
break;
case GFX_HQ3X:
- _scaleFactor = 3;
+ _videoMode.scaleFactor = 3;
_scalerProc = HQ3x;
break;
#endif
case GFX_TV2X:
- _scaleFactor = 2;
+ _videoMode.scaleFactor = 2;
_scalerProc = TV2x;
break;
case GFX_DOTMATRIX:
- _scaleFactor = 2;
+ _videoMode.scaleFactor = 2;
_scalerProc = DotMatrix;
break;
default:
- error("unknown gfx mode %d", _mode);
+ error("unknown gfx mode %d", mode);
}
}
// Check if the scaler can be accepted, if not get back to normal scaler
- if (_scaleFactor && ((_scaleFactor * _screenWidth > getScreenWidth() && _scaleFactor * _screenWidth > getScreenHeight())
- || (_scaleFactor * _screenHeight > getScreenWidth() && _scaleFactor * _screenHeight > getScreenHeight()))) {
- _scaleFactor = 1;
+ if (_videoMode.scaleFactor && ((_videoMode.scaleFactor * _videoMode.screenWidth > getScreenWidth() && _videoMode.scaleFactor * _videoMode.screenWidth > getScreenHeight())
+ || (_videoMode.scaleFactor * _videoMode.screenHeight > getScreenWidth() && _videoMode.scaleFactor * _videoMode.screenHeight > getScreenHeight()))) {
+ _videoMode.scaleFactor = 1;
_scalerProc = Normal1x;
}
// Common scaler system was used
if (_scaleFactorXm < 0) {
- _scaleFactorXm = _scaleFactor;
+ _scaleFactorXm = _videoMode.scaleFactor;
_scaleFactorXd = 1;
- _scaleFactorYm = _scaleFactor;
+ _scaleFactorYm = _videoMode.scaleFactor;
_scaleFactorYd = 1;
}
@@ -1342,12 +1339,12 @@ bool OSystem_WINCE3::setGraphicsMode(int mode) {
}
-void OSystem_WINCE3::loadGFXMode() {
+bool OSystem_WINCE3::loadGFXMode() {
int displayWidth;
int displayHeight;
unsigned int flags = SDL_FULLSCREEN | SDL_SWSURFACE;
- _fullscreen = true; // forced
+ _videoMode.fullscreen = true; // forced
_forceFull = true;
_tmpscreen = NULL;
@@ -1356,18 +1353,18 @@ void OSystem_WINCE3::loadGFXMode() {
update_scalers();
// Create the surface that contains the 8 bit game data
- _screen = SDL_CreateRGBSurface(SDL_SWSURFACE, _screenWidth, _screenHeight, 8, 0, 0, 0, 0);
+ _screen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.screenWidth, _videoMode.screenHeight, 8, 0, 0, 0, 0);
if (_screen == NULL)
error("_screen failed (%s)", SDL_GetError());
// Create the surface that contains the scaled graphics in 16 bit mode
// Always use full screen mode to have a "clean screen"
- if (!_adjustAspectRatio) {
- displayWidth = _screenWidth * _scaleFactorXm / _scaleFactorXd;
- displayHeight = _screenHeight * _scaleFactorYm / _scaleFactorYd;
+ if (!_videoMode.aspectRatio) {
+ displayWidth = _videoMode.screenWidth * _scaleFactorXm / _scaleFactorXd;
+ displayHeight = _videoMode.screenHeight * _scaleFactorYm / _scaleFactorYd;
} else {
- displayWidth = _screenWidth;
- displayHeight = _screenHeight;
+ displayWidth = _videoMode.screenWidth;
+ displayHeight = _videoMode.screenHeight;
}
switch (_orientationLandscape) {
@@ -1404,24 +1401,24 @@ void OSystem_WINCE3::loadGFXMode() {
initCEScaler();
// Need some extra bytes around when using 2xSaI
- _tmpscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _screenWidth + 3, _screenHeight + 3, 16, _hwscreen->format->Rmask, _hwscreen->format->Gmask, _hwscreen->format->Bmask, _hwscreen->format->Amask);
+ _tmpscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.screenWidth + 3, _videoMode.screenHeight + 3, 16, _hwscreen->format->Rmask, _hwscreen->format->Gmask, _hwscreen->format->Bmask, _hwscreen->format->Amask);
if (_tmpscreen == NULL)
error("_tmpscreen creation failed (%s)", SDL_GetError());
// Overlay
if (CEDevice::hasDesktopResolution()) {
- _overlayscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _overlayWidth * _scaleFactorXm / _scaleFactorXd, _overlayHeight * _scaleFactorYm / _scaleFactorYd, 16, 0, 0, 0, 0);
+ _overlayscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.overlayWidth * _scaleFactorXm / _scaleFactorXd, _videoMode.overlayHeight * _scaleFactorYm / _scaleFactorYd, 16, 0, 0, 0, 0);
if (_overlayscreen == NULL)
error("_overlayscreen failed (%s)", SDL_GetError());
- _tmpscreen2 = SDL_CreateRGBSurface(SDL_SWSURFACE, _overlayWidth * _scaleFactorXm / _scaleFactorXd + 3, _overlayHeight * _scaleFactorYm / _scaleFactorYd + 3, 16, 0, 0, 0, 0);
+ _tmpscreen2 = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.overlayWidth * _scaleFactorXm / _scaleFactorXd + 3, _videoMode.overlayHeight * _scaleFactorYm / _scaleFactorYd + 3, 16, 0, 0, 0, 0);
if (_tmpscreen2 == NULL)
error("_tmpscreen2 failed (%s)", SDL_GetError());
} else {
- _overlayscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _overlayWidth, _overlayHeight, 16, 0, 0, 0, 0);
+ _overlayscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.overlayWidth, _videoMode.overlayHeight, 16, 0, 0, 0, 0);
if (_overlayscreen == NULL)
error("_overlayscreen failed (%s)", SDL_GetError());
- _tmpscreen2 = SDL_CreateRGBSurface(SDL_SWSURFACE, _overlayWidth + 3, _overlayHeight + 3, 16, 0, 0, 0, 0);
+ _tmpscreen2 = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.overlayWidth + 3, _videoMode.overlayHeight + 3, 16, 0, 0, 0, 0);
if (_tmpscreen2 == NULL)
error("_tmpscreen2 failed (%s)", SDL_GetError());
}
@@ -1434,7 +1431,7 @@ void OSystem_WINCE3::loadGFXMode() {
if (_toolbarLow == NULL)
error("_toolbarLow failed (%s)", SDL_GetError());
- if (_screenHeight > 240) {
+ if (_videoMode.screenHeight > 240) {
uint16 *toolbar_screen = (uint16 *)calloc(640 * 80, sizeof(uint16));
_toolbarHigh = SDL_CreateRGBSurfaceFrom(toolbar_screen, 640, 80, 16, 640 * 2, _hwscreen->format->Rmask, _hwscreen->format->Gmask, _hwscreen->format->Bmask, _hwscreen->format->Amask);
@@ -1445,10 +1442,12 @@ void OSystem_WINCE3::loadGFXMode() {
// keyboard cursor control, some other better place for it?
- _km.x_max = _screenWidth * _scaleFactorXm / _scaleFactorXd - 1;
- _km.y_max = _screenHeight * _scaleFactorXm / _scaleFactorXd - 1;
+ _km.x_max = _videoMode.screenWidth * _scaleFactorXm / _scaleFactorXd - 1;
+ _km.y_max = _videoMode.screenHeight * _scaleFactorXm / _scaleFactorXd - 1;
_km.delay_time = 25;
_km.last_time = 0;
+
+ return true;
}
void OSystem_WINCE3::unloadGFXMode() {
@@ -1468,9 +1467,9 @@ void OSystem_WINCE3::unloadGFXMode() {
}
}
-void OSystem_WINCE3::hotswapGFXMode() {
+bool OSystem_WINCE3::hotswapGFXMode() {
if (!_screen)
- return;
+ return false;
// Keep around the old _screen & _tmpscreen so we can restore the screen data
// after the mode switch. (also for the overlay)
@@ -1491,7 +1490,14 @@ void OSystem_WINCE3::hotswapGFXMode() {
}
// Setup the new GFX mode
- loadGFXMode();
+ if (!loadGFXMode()) {
+ unloadGFXMode();
+
+ _screen = old_screen;
+ _overlayscreen = old_overlayscreen;
+
+ return false;
+ }
// reset palette
SDL_SetColors(_screen, _currentPalette, 0, 256);
@@ -1516,13 +1522,15 @@ void OSystem_WINCE3::hotswapGFXMode() {
// Make sure that a Common::EVENT_SCREEN_CHANGED gets sent later -> FIXME this crashes when no game has been loaded.
// _modeChanged = true;
+
+ return true;
}
void OSystem_WINCE3::internUpdateScreen() {
SDL_Surface *srcSurf, *origSurf;
static bool old_overlayVisible = false;
int numRectsOut = 0;
- int16 routx, routy, routw, routh, stretch;
+ int16 routx, routy, routw, routh, stretch, shakestretch;
assert(_hwscreen != NULL);
@@ -1534,8 +1542,8 @@ void OSystem_WINCE3::internUpdateScreen() {
// If the shake position changed, fill the dirty area with blackness
if (_currentShakePos != _newShakePos) {
- SDL_Rect blackrect = {0, 0, _screenWidth * _scaleFactorXm / _scaleFactorXd, _newShakePos * _scaleFactorYm / _scaleFactorYd};
- if (_adjustAspectRatio)
+ SDL_Rect blackrect = {0, 0, _videoMode.screenWidth * _scaleFactorXm / _scaleFactorXd, _newShakePos * _scaleFactorYm / _scaleFactorYd};
+ if (_videoMode.aspectRatio)
blackrect.h = real2Aspect(blackrect.h - 1) + 1;
SDL_FillRect(_hwscreen, &blackrect, 0);
_currentShakePos = _newShakePos;
@@ -1574,12 +1582,12 @@ void OSystem_WINCE3::internUpdateScreen() {
if (!_zoomDown)
_dirtyRectList[0].y = 0;
else
- _dirtyRectList[0].y = _screenHeight / 2;
- _dirtyRectList[0].w = _screenWidth;
+ _dirtyRectList[0].y = _videoMode.screenHeight / 2;
+ _dirtyRectList[0].w = _videoMode.screenWidth;
if (!_zoomUp && !_zoomDown)
- _dirtyRectList[0].h = _screenHeight;
+ _dirtyRectList[0].h = _videoMode.screenHeight;
else
- _dirtyRectList[0].h = _screenHeight / 2;
+ _dirtyRectList[0].h = _videoMode.screenHeight / 2;
_toolbarHandler.forceRedraw();
}
@@ -1626,10 +1634,11 @@ void OSystem_WINCE3::internUpdateScreen() {
}
// transform
- routx = r->x * _scaleFactorXm / _scaleFactorXd; // locate position in scaled screen
- routy = (r->y + _currentShakePos) * _scaleFactorYm / _scaleFactorYd; // adjust for shake offset
+ shakestretch = _currentShakePos * _scaleFactorYm / _scaleFactorYd;
+ routx = r->x * _scaleFactorXm / _scaleFactorXd; // locate position in scaled screen
+ routy = r->y * _scaleFactorYm / _scaleFactorYd + shakestretch; // adjust for shake offset
routw = r->w * _scaleFactorXm / _scaleFactorXd;
- routh = r->h * _scaleFactorYm / _scaleFactorYd;
+ routh = r->h * _scaleFactorYm / _scaleFactorYd - shakestretch;
// clipping destination rectangle inside device screen (more strict, also more tricky but more stable)
// note that all current scalers do not make dst rect exceed left/right, unless chosen badly (FIXME)
@@ -1637,7 +1646,9 @@ void OSystem_WINCE3::internUpdateScreen() {
if (routy + routh < 0) continue;
if (routy < 0) {
routh += routy;
+ r->y -= routy * _scaleFactorYd / _scaleFactorYm;
routy = 0;
+ r->h = routh * _scaleFactorYd / _scaleFactorYm;
}
if (_orientationLandscape) {
if (routy > _platformScreenWidth) continue;
@@ -1660,11 +1671,11 @@ void OSystem_WINCE3::internUpdateScreen() {
// blit it (with added voodoo from the sdl backend, shifting the source rect again)
_scalerProc( (byte *)srcSurf->pixels + (r->x * 2 + 2)+ (r->y + 1) * srcPitch, srcPitch,
(byte *)_hwscreen->pixels + routx * 2 + routy * dstPitch, dstPitch,
- r->w, r->h);
+ r->w, r->h - _currentShakePos);
// add this rect to output
- rout->x = routx; rout->y = routy;
- rout->w = routw; rout->h = routh;
+ rout->x = routx; rout->y = routy - shakestretch;
+ rout->w = routw; rout->h = routh + shakestretch;
numRectsOut++;
rout++;
@@ -1679,7 +1690,7 @@ void OSystem_WINCE3::internUpdateScreen() {
uint32 srcPitch, dstPitch;
SDL_Surface *toolbarSurface;
- if (_screenHeight > 240) {
+ if (_videoMode.screenHeight > 240) {
if (!_toolbarHighDrawn) {
// Resize the toolbar
SDL_LockSurface(_toolbarLow);
@@ -1764,12 +1775,12 @@ void OSystem_WINCE3::copyRectToOverlay(const OverlayColor *buf, int pitch, int x
y = 0;
}
- if (w > _overlayWidth - x) {
- w = _overlayWidth - x;
+ if (w > _videoMode.overlayWidth - x) {
+ w = _videoMode.overlayWidth - x;
}
- if (h > _overlayHeight - y) {
- h = _overlayHeight - y;
+ if (h > _videoMode.overlayHeight - y) {
+ h = _videoMode.overlayHeight - y;
}
if (w <= 0 || h <= 0)
@@ -1803,8 +1814,8 @@ void OSystem_WINCE3::copyRectToScreen(const byte *src, int pitch, int x, int y,
Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends
- if (((long)src & 3) == 0 && pitch == _screenWidth && x == 0 && y == 0 &&
- w == _screenWidth && h == _screenHeight && _modeFlags & DF_WANT_RECT_OPTIM) {
+ if (((long)src & 3) == 0 && pitch == _videoMode.screenWidth && x == 0 && y == 0 &&
+ w == _videoMode.screenWidth && h == _videoMode.screenHeight && _modeFlags & DF_WANT_RECT_OPTIM) {
/* Special, optimized case for full screen updates.
* It tries to determine what areas were actually changed,
* and just updates those, on the actual display. */
@@ -1823,12 +1834,12 @@ void OSystem_WINCE3::copyRectToScreen(const byte *src, int pitch, int x, int y,
y = 0;
}
- if (w > _screenWidth - x) {
- w = _screenWidth - x;
+ if (w > _videoMode.screenWidth - x) {
+ w = _videoMode.screenWidth - x;
}
- if (h > _screenHeight - y) {
- h = _screenHeight - y;
+ if (h > _videoMode.screenHeight - y) {
+ h = _videoMode.screenHeight - y;
}
if (w <= 0 || h <= 0)
@@ -1844,15 +1855,15 @@ void OSystem_WINCE3::copyRectToScreen(const byte *src, int pitch, int x, int y,
if (SDL_LockSurface(_screen) == -1)
error("SDL_LockSurface failed: %s", SDL_GetError());
- byte *dst = (byte *)_screen->pixels + y * _screenWidth + x;
+ byte *dst = (byte *)_screen->pixels + y * _videoMode.screenWidth + x;
- if (_screenWidth == pitch && pitch == w) {
+ if (_videoMode.screenWidth == pitch && pitch == w) {
memcpy(dst, src, h*w);
} else {
do {
memcpy(dst, src, w);
src += pitch;
- dst += _screenWidth;
+ dst += _videoMode.screenWidth;
} while (--h);
}
@@ -1925,10 +1936,10 @@ void OSystem_WINCE3::internDrawMouse() {
y = 0;
}
- if (w > _screenWidth - x)
- w = _screenWidth - x;
- if (h > _screenHeight - y)
- h = _screenHeight - y;
+ if (w > _videoMode.screenWidth - x)
+ w = _videoMode.screenWidth - x;
+ if (h > _videoMode.screenHeight - y)
+ h = _videoMode.screenHeight - y;
// Quick check to see if anything has to be drawn at all
if (w <= 0 || h <= 0)
@@ -1945,7 +1956,7 @@ void OSystem_WINCE3::internDrawMouse() {
byte *bak = _mouseBackupOld; // Surface used to backup the area obscured by the mouse
byte *dst; // Surface we are drawing into
- dst = (byte *)_screen->pixels + y * _screenWidth + x;
+ dst = (byte *)_screen->pixels + y * _videoMode.screenWidth + x;
while (h > 0) {
width = w;
while (width > 0) {
@@ -1958,7 +1969,7 @@ void OSystem_WINCE3::internDrawMouse() {
}
src += _mouseCurState.w - w;
bak += _mouseBackupDim - w;
- dst += _screenWidth - w;
+ dst += _videoMode.screenWidth - w;
h--;
}
@@ -1973,7 +1984,7 @@ void OSystem_WINCE3::internDrawMouse() {
*bak++ = *(uint16 *)dst;
color = *src++;
if (color != 0xFF) // 0xFF = transparent, don't draw
- *(uint16 *)dst = RGBToColor(_currentPalette[color].r, _currentPalette[color].g, _currentPalette[color].b);
+ *(uint16 *)dst = SDL_MapRGB(_overlayscreen->format, _currentPalette[color].r, _currentPalette[color].g, _currentPalette[color].b);
dst += 2;
width--;
}
@@ -1991,7 +2002,7 @@ void OSystem_WINCE3::internDrawMouse() {
}
void OSystem_WINCE3::undrawMouse() {
- assert (_transactionMode == kTransactionNone || _transactionMode == kTransactionCommit);
+ assert (_transactionMode == kTransactionNone);
if (!_mouseDrawn)
return;
@@ -2012,10 +2023,10 @@ void OSystem_WINCE3::undrawMouse() {
old_mouse_y = 0;
}
- if (old_mouse_w > _screenWidth - old_mouse_x)
- old_mouse_w = _screenWidth - old_mouse_x;
- if (old_mouse_h > _screenHeight - old_mouse_y)
- old_mouse_h = _screenHeight - old_mouse_y;
+ if (old_mouse_w > _videoMode.screenWidth - old_mouse_x)
+ old_mouse_w = _videoMode.screenWidth - old_mouse_x;
+ if (old_mouse_h > _videoMode.screenHeight - old_mouse_y)
+ old_mouse_h = _videoMode.screenHeight - old_mouse_y;
// Quick check to see if anything has to be drawn at all
if (old_mouse_w <= 0 || old_mouse_h <= 0)
@@ -2030,8 +2041,8 @@ void OSystem_WINCE3::undrawMouse() {
byte *dst, *bak = _mouseBackupOld;
// No need to do clipping here, since drawMouse() did that already
- dst = (byte *)_screen->pixels + old_mouse_y * _screenWidth + old_mouse_x;
- for (y = 0; y < old_mouse_h; ++y, bak += _mouseBackupDim, dst += _screenWidth)
+ dst = (byte *)_screen->pixels + old_mouse_y * _videoMode.screenWidth + old_mouse_x;
+ for (y = 0; y < old_mouse_h; ++y, bak += _mouseBackupDim, dst += _videoMode.screenWidth)
memcpy(dst, bak, old_mouse_w);
} else {
byte *dst;
@@ -2115,6 +2126,9 @@ void OSystem_WINCE3::blitCursor() {
void OSystem_WINCE3::showOverlay() {
assert (_transactionMode == kTransactionNone);
+ if (_overlayVisible)
+ return;
+
undrawMouse();
_overlayVisible = true;
update_scalers();
@@ -2124,8 +2138,10 @@ void OSystem_WINCE3::showOverlay() {
void OSystem_WINCE3::hideOverlay() {
assert (_transactionMode == kTransactionNone);
- undrawMouse();
+ if (!_overlayVisible)
+ return;
+ undrawMouse();
_overlayVisible = false;
clearOverlay();
_forceFull = true;
diff --git a/backends/platform/wince/wince-sdl.h b/backends/platform/wince/wince-sdl.h
index ece8c9b7b1..46070e1180 100644
--- a/backends/platform/wince/wince-sdl.h
+++ b/backends/platform/wince/wince-sdl.h
@@ -65,27 +65,30 @@ public:
// Update the dirty areas of the screen
void internUpdateScreen();
+ void setGraphicsModeIntern();
void initSize(uint w, uint h);
-
void initBackend();
- // Overloaded from SDL_Common (toolbar handling)
+ // Overloaded from SDL backend (toolbar handling)
bool pollEvent(Common::Event &event);
- // Overloaded from SDL_Common (toolbar handling)
+ // Overloaded from SDL backend (toolbar handling)
void drawMouse();
- // Overloaded from SDL_Common (mouse and new scaler handling)
+ // Overloaded from SDL backend (mouse and new scaler handling)
void fillMouseEvent(Common::Event &event, int x, int y);
- // Overloaded from SDL_Common (new scaler handling)
+ // Overloaded from SDL backend (new scaler handling)
void addDirtyRect(int x, int y, int w, int h, bool mouseRect = false);
- // Overloaded from SDL_Common (new scaler handling)
+ // Overloaded from SDL backend (new scaler handling)
void warpMouse(int x, int y);
- // Overloaded from SDL_Commmon
+ // Overloaded from SDL backend
void quit();
- // Overloaded from SDL_Commmon (master volume and sample rate subtleties)
+ // Overloaded from SDL backend (master volume and sample rate subtleties)
void setupMixer();
// Overloaded from OSystem
//void engineInit();
void getTimeAndDate(struct tm &t) const;
+ virtual Common::SeekableReadStream *openConfigFileForReading();
+ virtual Common::WriteStream *openConfigFileForWriting();
+
// Overloaded from SDL_Common (FIXME)
void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, byte keycolor, int cursorTargetScale); // overloaded by CE backend
@@ -131,9 +134,9 @@ public:
static bool isOzone();
protected:
- void loadGFXMode();
+ bool loadGFXMode();
void unloadGFXMode();
- void hotswapGFXMode();
+ bool hotswapGFXMode();
bool saveScreenshot(const char *filename);
@@ -200,7 +203,7 @@ private:
bool _zoomUp; // zooming up mode
bool _zoomDown; // zooming down mode
- bool _noDoubleTapRMB; // disable double tap -> rmb click
+ bool _noDoubleTapRMB; // disable double tap -> rmb click
bool _rbutton; // double tap -> right button simulation
bool _closeClick; // flag when taps are spatially close together