[Scummvm-cvs-logs] SF.net SVN: scummvm:[41152] scummvm/branches/gsoc2009-16bit
upthorn at users.sourceforge.net
upthorn at users.sourceforge.net
Thu Jun 4 01:36:23 CEST 2009
Revision: 41152
http://scummvm.svn.sourceforge.net/scummvm/?rev=41152&view=rev
Author: upthorn
Date: 2009-06-03 23:36:23 +0000 (Wed, 03 Jun 2009)
Log Message:
-----------
Applying the temporary 16-bit SDL hack.
Modified Paths:
--------------
scummvm/branches/gsoc2009-16bit/backends/platform/sdl/graphics.cpp
scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.cpp
scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.h
scummvm/branches/gsoc2009-16bit/dists/msvc8/scummvm.vcproj
Modified: scummvm/branches/gsoc2009-16bit/backends/platform/sdl/graphics.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/backends/platform/sdl/graphics.cpp 2009-06-03 21:02:20 UTC (rev 41151)
+++ scummvm/branches/gsoc2009-16bit/backends/platform/sdl/graphics.cpp 2009-06-03 23:36:23 UTC (rev 41152)
@@ -407,7 +407,21 @@
}
}
+#ifdef ENABLE_16BIT
//
+ // Create the surface that contains the 16 bit game data
+ //
+ _screen16 = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.screenWidth, _videoMode.screenHeight,
+ 16,
+ 0x7C00,
+ 0x3E0,
+ 0x1F,
+ 0); //555, not 565
+ if (_screen16 == NULL)
+ error("allocating _screen16 failed");
+#endif
+
+ //
// Create the surface used for the graphics in 16 bit before scaling, and also the overlay
//
@@ -484,10 +498,17 @@
}
void OSystem_SDL::unloadGFXMode() {
+#ifdef ENABLE_16BIT
+ if (_screen16) {
+ SDL_FreeSurface(_screen16);
+ _screen16 = NULL;
+ }
+#else
if (_screen) {
SDL_FreeSurface(_screen);
_screen = NULL;
}
+#endif
if (_hwscreen) {
SDL_FreeSurface(_hwscreen);
@@ -519,14 +540,23 @@
}
bool OSystem_SDL::hotswapGFXMode() {
+#ifdef ENABLE_16BIT
+ if (!_screen16)
+#else
if (!_screen)
+#endif
return false;
// Keep around the old _screen & _overlayscreen so we can restore the screen data
// after the mode switch.
+#ifdef ENABLE_16BIT
+ SDL_Surface *old_screen = _screen16;
+ _screen16 = NULL;
+#else
SDL_Surface *old_screen = _screen;
+ _screen = NULL;
+#endif
SDL_Surface *old_overlayscreen = _overlayscreen;
- _screen = NULL;
_overlayscreen = NULL;
// Release the HW screen surface
@@ -544,7 +574,11 @@
if (!loadGFXMode()) {
unloadGFXMode();
+#ifdef ENABLE_16BIT
+ _screen16 = old_screen;
+#else
_screen = old_screen;
+#endif
_overlayscreen = old_overlayscreen;
return false;
@@ -554,7 +588,11 @@
SDL_SetColors(_screen, _currentPalette, 0, 256);
// Restore old screen content
+#ifdef ENABLE_16BIT
+ SDL_BlitSurface(old_screen, NULL, _screen16, NULL);
+#else
SDL_BlitSurface(old_screen, NULL, _screen, NULL);
+#endif
SDL_BlitSurface(old_overlayscreen, NULL, _overlayscreen, NULL);
// Free the old surfaces
@@ -636,7 +674,11 @@
#endif
if (!_overlayVisible) {
+#ifdef ENABLE_16BIT
+ origSurf = _screen16;
+#else
origSurf = _screen;
+#endif
srcSurf = _tmpscreen;
width = _videoMode.screenWidth;
height = _videoMode.screenHeight;
@@ -781,6 +823,12 @@
assert (_transactionMode == kTransactionNone);
assert(src);
+#ifdef ENABLE_16BIT
+ if (_screen16 == NULL) {
+ warning("OSystem_SDL::copyRectToScreen: _screen16 == NULL");
+ return;
+ }
+#endif
if (_screen == NULL) {
warning("OSystem_SDL::copyRectToScreen: _screen == NULL");
return;
@@ -829,11 +877,29 @@
}
// Try to lock the screen surface
+#ifdef ENABLE_16BIT
+ if (SDL_LockSurface(_screen16) == -1)
+#else
if (SDL_LockSurface(_screen) == -1)
+#endif
error("SDL_LockSurface failed: %s", SDL_GetError());
+#ifdef ENABLE_16BIT
+ byte *dst = (byte *)_screen16->pixels + y * _videoMode.screenWidth * 2 + x * 2;
+ if (_videoMode.screenWidth == w && pitch == w * 2) {
+ memcpy(dst, src, h*w*2);
+ } else {
+ do {
+ memcpy(dst, src, w * 2);
+ src += pitch;
+ dst += _videoMode.screenWidth * 2;
+ } while (--h);
+ }
+
+ // Unlock the screen surface
+ SDL_UnlockSurface(_screen16);
+#else
byte *dst = (byte *)_screen->pixels + y * _videoMode.screenWidth + x;
-
if (_videoMode.screenWidth == pitch && pitch == w) {
memcpy(dst, src, h*w);
} else {
@@ -846,6 +912,7 @@
// Unlock the screen surface
SDL_UnlockSurface(_screen);
+#endif
}
Graphics::Surface *OSystem_SDL::lockScreen() {
@@ -859,14 +926,26 @@
_screenIsLocked = true;
// Try to lock the screen surface
+#ifdef ENABLE_16BIT
+ if (SDL_LockSurface(_screen16) == -1)
+#else
if (SDL_LockSurface(_screen) == -1)
+#endif
error("SDL_LockSurface failed: %s", SDL_GetError());
+#ifdef ENABLE_16BIT
+ _framebuffer.pixels = _screen16->pixels;
+ _framebuffer.w = _screen16->w;
+ _framebuffer.h = _screen16->h;
+ _framebuffer.pitch = _screen16->pitch;
+ _framebuffer.bytesPerPixel = 2;
+#else
_framebuffer.pixels = _screen->pixels;
_framebuffer.w = _screen->w;
_framebuffer.h = _screen->h;
_framebuffer.pitch = _screen->pitch;
_framebuffer.bytesPerPixel = 1;
+#endif
return &_framebuffer;
}
@@ -879,7 +958,11 @@
_screenIsLocked = false;
// Unlock the screen surface
+#ifdef ENABLE_16BIT
+ SDL_UnlockSurface(_screen16);
+#else
SDL_UnlockSurface(_screen);
+#endif
// Trigger a full screen update
_forceFull = true;
@@ -1054,8 +1137,13 @@
// since we don't actually set the palette until the screen is updated.
// But it could indicate a programming error, so let's warn about it.
+#ifdef ENABLE_16BIT
+ if (!_screen16)
+ warning("OSystem_SDL::setPalette: _screen16 == NULL");
+#else
if (!_screen)
warning("OSystem_SDL::setPalette: _screen == NULL");
+#endif
const byte *b = colors;
uint i;
@@ -1179,7 +1267,11 @@
dst.x = dst.y = 1;
src.w = dst.w = _videoMode.screenWidth;
src.h = dst.h = _videoMode.screenHeight;
+#ifdef ENABLE_16BIT
+ if (SDL_BlitSurface(_screen16, &src, _tmpscreen, &dst) != 0)
+#else
if (SDL_BlitSurface(_screen, &src, _tmpscreen, &dst) != 0)
+#endif
error("SDL_BlitSurface failed: %s", SDL_GetError());
SDL_LockSurface(_tmpscreen);
Modified: scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.cpp 2009-06-03 21:02:20 UTC (rev 41151)
+++ scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.cpp 2009-06-03 23:36:23 UTC (rev 41152)
@@ -196,6 +196,9 @@
_osdSurface(0), _osdAlpha(SDL_ALPHA_TRANSPARENT), _osdFadeStartTime(0),
#endif
_hwscreen(0), _screen(0), _tmpscreen(0),
+#ifdef ENABLE_16BIT
+ _screen16(0),
+#endif
_overlayVisible(false),
_overlayscreen(0), _tmpscreen2(0),
_samplesPerSec(0),
Modified: scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.h 2009-06-03 21:02:20 UTC (rev 41151)
+++ scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.h 2009-06-03 23:36:23 UTC (rev 41152)
@@ -227,6 +227,9 @@
// unseen game screen
SDL_Surface *_screen;
+#ifdef ENABLE_16BIT
+ SDL_Surface *_screen16;
+#endif
// temporary screen (for scalers)
SDL_Surface *_tmpscreen;
Modified: scummvm/branches/gsoc2009-16bit/dists/msvc8/scummvm.vcproj
===================================================================
--- scummvm/branches/gsoc2009-16bit/dists/msvc8/scummvm.vcproj 2009-06-03 21:02:20 UTC (rev 41151)
+++ scummvm/branches/gsoc2009-16bit/dists/msvc8/scummvm.vcproj 2009-06-03 23:36:23 UTC (rev 41152)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="8,00"
+ Version="8.00"
Name="scummvm"
ProjectGUID="{8434CB15-D08F-427D-9E6D-581AE5B28440}"
RootNamespace="scummvm"
@@ -43,7 +43,7 @@
Optimization="0"
InlineFunctionExpansion="0"
AdditionalIncludeDirectories="../../;../../engines"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_ZLIB;USE_MAD;USE_VORBIS;USE_MPEG2;USE_NASM;USE_MT32EMU;ENABLE_AGI;ENABLE_AGOS;ENABLE_CINE;ENABLE_CRUISE;ENABLE_DRASCULA;ENABLE_GOB;ENABLE_IGOR;ENABLE_KYRA;ENABLE_LURE;ENABLE_M4;ENABLE_MADE;ENABLE_PARALLACTION;ENABLE_QUEEN;ENABLE_SAGA;ENABLE_SCI;ENABLE_SCUMM;ENABLE_SKY;ENABLE_SWORD1;ENABLE_SWORD2;ENABLE_TOUCHE;ENABLE_SCUMM_7_8;ENABLE_HE;ENABLE_TINSEL;ENABLE_TUCKER;ENABLE_GROOVIE"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_ZLIB;USE_MAD;USE_VORBIS;USE_MPEG2;USE_NASM;USE_MT32EMU;ENABLE_AGI;ENABLE_AGOS;ENABLE_CINE;ENABLE_CRUISE;ENABLE_DRASCULA;ENABLE_GOB;ENABLE_IGOR;ENABLE_KYRA;ENABLE_LURE;ENABLE_M4;ENABLE_MADE;ENABLE_PARALLACTION;ENABLE_QUEEN;ENABLE_SAGA;ENABLE_SCI;ENABLE_SCUMM;ENABLE_SKY;ENABLE_SWORD1;ENABLE_SWORD2;ENABLE_TOUCHE;ENABLE_SCUMM_7_8;ENABLE_HE;ENABLE_TINSEL;ENABLE_TUCKER;ENABLE_GROOVIE; ENABLE_16BIT"
MinimalRebuild="true"
ExceptionHandling="1"
BasicRuntimeChecks="3"
@@ -100,6 +100,9 @@
Name="VCAppVerifierTool"
/>
<Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
@@ -192,6 +195,9 @@
Name="VCAppVerifierTool"
/>
<Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list