[Scummvm-cvs-logs] SF.net SVN: scummvm:[33787] scummvm/trunk

dhewg at users.sourceforge.net dhewg at users.sourceforge.net
Tue Aug 12 00:43:02 CEST 2008


Revision: 33787
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33787&view=rev
Author:   dhewg
Date:     2008-08-11 22:43:00 +0000 (Mon, 11 Aug 2008)

Log Message:
-----------
video mode polishing:
* proper fullscreen video mode
* multiple graphic modes with different overscan values
* "fullscreen mode" stretches the picture on 16:9 displays
* fixed broken sword 1/2 gfx garbage
* support for setShakePos()

Modified Paths:
--------------
    scummvm/trunk/backends/platform/wii/Makefile
    scummvm/trunk/backends/platform/wii/gx_supp.cpp
    scummvm/trunk/backends/platform/wii/gx_supp.h
    scummvm/trunk/backends/platform/wii/osystem.cpp
    scummvm/trunk/backends/platform/wii/osystem.h
    scummvm/trunk/backends/platform/wii/osystem_gfx.cpp
    scummvm/trunk/dists/wii/READMII

Modified: scummvm/trunk/backends/platform/wii/Makefile
===================================================================
--- scummvm/trunk/backends/platform/wii/Makefile	2008-08-11 22:26:25 UTC (rev 33786)
+++ scummvm/trunk/backends/platform/wii/Makefile	2008-08-11 22:43:00 UTC (rev 33787)
@@ -3,7 +3,7 @@
 DEBUG_WII = 1
 
 # builds a gamecube version. cleanup object files before flipping this
-GAMECUBE = 0
+GAMECUBE = 1
 
 ENABLE_SCUMM = STATIC_PLUGIN
 ENABLE_SCUMM_7_8 = STATIC_PLUGIN
@@ -154,8 +154,10 @@
 distclean-wii:
 	@-$(RM) dist
 
+upload:
 ifeq ($(GAMECUBE),1)
-upload:
+	$(DEVKITPPC)/bin/geckoupload $(TARGET).dol
+else
 	$(DEVKITPPC)/bin/wiiload $(TARGET).dol
 endif
 
@@ -167,6 +169,7 @@
 	$(CP) $(TARGET).dol dist/scummvm/boot.dol
 	$(CP) $(DISTPATH)/meta.xml dist/scummvm/
 	$(CP) $(DISTPATH)/icon.png dist/scummvm/
+endif
 	$(CP) $(DISTPATH)/READMII dist/scummvm/
 	$(CP) $(srcdir)/AUTHORS dist/scummvm/
 	$(CP) $(srcdir)/COPYING dist/scummvm/
@@ -175,5 +178,4 @@
 	$(CP) $(srcdir)/README dist/scummvm/
 	$(CP) $(DIST_FILES_THEMES) dist/scummvm/
 	$(CP) $(DIST_FILES_ENGINEDATA) dist/scummvm/
-endif
 

Modified: scummvm/trunk/backends/platform/wii/gx_supp.cpp
===================================================================
--- scummvm/trunk/backends/platform/wii/gx_supp.cpp	2008-08-11 22:26:25 UTC (rev 33786)
+++ scummvm/trunk/backends/platform/wii/gx_supp.cpp	2008-08-11 22:43:00 UTC (rev 33787)
@@ -1,6 +1,7 @@
 /****************************************************************************
 *	Generic GX Support for Emulators
 *	softdev 2007
+*	dhewg 2008
 *
 *	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
@@ -21,12 +22,13 @@
 * These are pretty standard functions to setup and use GX scaling.
 ****************************************************************************/
 
-#include <gccore.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <malloc.h>
 
+#include "gx_supp.h"
+
 #define DEFAULT_FIFO_SIZE (256 * 1024)
 
 #define HASPECT 320
@@ -39,18 +41,19 @@
 /*** 2D ***/
 static u32 whichfb;
 static u32 *xfb[2];
-static GXRModeObj *vmode;
+GXRModeObj *vmode = NULL;
 
 /*** 3D GX ***/
 static u8 *gp_fifo;
 
 /*** Texture memory ***/
-static u8 *texturemem;
+static u8 *texturemem = NULL;
 static u32 texturesize;
 
-GXTexObj texobj;
+static GXTexObj texobj;
 static Mtx view;
 static u16 vwidth, vheight, oldvwidth, oldvheight;
+static float tex_xT = 0.0f, tex_yT = 0.0f;
 
 /* New texture based scaler */
 typedef struct tagcamera {
@@ -74,6 +77,10 @@
 
 void GX_InitVideo() {
 	vmode = VIDEO_GetPreferredMode(NULL);
+
+	vmode->viWidth = 678;
+	vmode->viXOrigin = (VI_MAX_WIDTH_PAL - 678) / 2;
+
 	VIDEO_Configure(vmode);
 
 	xfb[0] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer(vmode));
@@ -93,6 +100,15 @@
 		VIDEO_WaitVSync();
 }
 
+void GX_SetTexTrans(float xT, float yT) {
+	tex_xT = xT;
+	tex_yT = yT;
+}
+
+void GX_SetCamPosZ(float f) {
+	cam.pos.z = f;
+}
+
 /****************************************************************************
  * Scaler Support Functions
  ****************************************************************************/
@@ -128,7 +144,7 @@
 	Mtx mv;
 
 	guMtxIdentity(m);
-	guMtxTransApply(m, m, 0, 0, -100);
+	guMtxTransApply(m, m, tex_xT, tex_yT, -100);
 	guMtxConcat(v, m, mv);
 
 	GX_LoadPosMtxImm(mv, GX_PNMTX0);
@@ -144,10 +160,10 @@
  * StartGX
  ****************************************************************************/
 void GX_Start(u16 width, u16 height, s16 haspect, s16 vaspect) {
+	static bool inited = false;
 	Mtx p;
+	GXColor gxbackground = { 0, 0, 0, 0xff };
 
-	GX_AbortFrame();
-
 	/*** Set new aspect ***/
 	square[0] = square[9] = -haspect;
 	square[3] = square[6] = haspect;
@@ -156,10 +172,21 @@
 
 	/*** Allocate 32byte aligned texture memory ***/
 	texturesize = (width * height) * 2;
+
+	if (texturemem)
+		free(texturemem);
+
 	texturemem = (u8 *) memalign(32, texturesize);
+	memset(texturemem, 0, texturesize);
 
-	GXColor gxbackground = { 0, 0, 0, 0xff };
+	/*** Setup for first call to scaler ***/
+	oldvwidth = oldvheight = -1;
 
+	if (inited)
+		return;
+
+	inited = true;
+
 	/*** Clear out FIFO area ***/
 	memset(gp_fifo, 0, DEFAULT_FIFO_SIZE);
 
@@ -184,12 +211,8 @@
 
 	guPerspective(p, 60, 1.33f, 10.0f, 1000.0f);
 	GX_LoadProjectionMtx(p, GX_PERSPECTIVE);
-	memset(texturemem, 0, texturesize);
 
 	GX_Flush();
-
-	/*** Setup for first call to scaler ***/
-	vwidth = vheight = -1;
 }
 
 /****************************************************************************

Modified: scummvm/trunk/backends/platform/wii/gx_supp.h
===================================================================
--- scummvm/trunk/backends/platform/wii/gx_supp.h	2008-08-11 22:26:25 UTC (rev 33786)
+++ scummvm/trunk/backends/platform/wii/gx_supp.h	2008-08-11 22:43:00 UTC (rev 33787)
@@ -1,6 +1,7 @@
 /****************************************************************************
 *   Generic GX Scaler 
 *   softdev 2007
+*   dhewg 2008
 *
 *   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
@@ -23,11 +24,17 @@
 #ifndef _WII_GX_SUPP_H_
 #define _WII_GX_SUPP_H_
 
+#include <gccore.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+extern GXRModeObj *vmode;
+
 void GX_InitVideo();
+void GX_SetTexTrans(float xT, float yT);
+void GX_SetCamPosZ(float f);
 
 void GX_Start(u16 width, u16 height, s16 haspect, s16 vaspect);
 void GX_Render(u16 width, u16 height, u8 *buffer, u16 pitch);

Modified: scummvm/trunk/backends/platform/wii/osystem.cpp
===================================================================
--- scummvm/trunk/backends/platform/wii/osystem.cpp	2008-08-11 22:26:25 UTC (rev 33786)
+++ scummvm/trunk/backends/platform/wii/osystem.cpp	2008-08-11 22:43:00 UTC (rev 33787)
@@ -19,9 +19,11 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#include "osystem.h"
 #include "backends/fs/wii/wii-fs-factory.h"
+#include "common/config-manager.h"
 
+#include "osystem.h"
+
 #include <unistd.h>
 
 #include <ogc/mutex.h>
@@ -51,8 +53,10 @@
 	_currentHeight(0),
 
 	_supportedGraphicsModes(NULL),
-	_activeGraphicsMode(-1),
+	_activeGraphicsMode(0),
 
+	_fullscreen(false),
+
 	_mouseVisible(false),
 	_mouseX(0),
 	_mouseY(0),
@@ -98,6 +102,8 @@
 	_mixer = new Audio::MixerImpl(this);
 	_timer = new DefaultTimerManager();
 
+	_fullscreen = ConfMan.getBool("fullscreen");
+
 	initGfx();
 	initSfx();
 	initEvents();
@@ -112,14 +118,28 @@
 }
 
 bool OSystem_Wii::hasFeature(Feature f) {
-	return f == kFeatureCursorHasPalette;
+	return (f == kFeatureFullscreenMode) ||
+			(f == kFeatureCursorHasPalette);
 }
 
 void OSystem_Wii::setFeatureState(Feature f, bool enable) {
+	switch (f) {
+	case kFeatureFullscreenMode:
+		_fullscreen = enable;
+		setGraphicsMode(_activeGraphicsMode);
+		break;
+	default:
+		break;
+	}
 }
 
 bool OSystem_Wii::getFeatureState(Feature f) {
-	return false;
+	switch (f) {
+	case kFeatureFullscreenMode:
+		return _fullscreen;
+	default:
+		return false;
+	}
 }
 
 uint32 OSystem_Wii::getMillis() {

Modified: scummvm/trunk/backends/platform/wii/osystem.h
===================================================================
--- scummvm/trunk/backends/platform/wii/osystem.h	2008-08-11 22:26:25 UTC (rev 33786)
+++ scummvm/trunk/backends/platform/wii/osystem.h	2008-08-11 22:43:00 UTC (rev 33787)
@@ -73,6 +73,8 @@
 	OSystem::GraphicsMode *_supportedGraphicsModes;
 	s32 _activeGraphicsMode;
 
+	bool _fullscreen;
+
 	bool _mouseVisible;
 	s32 _mouseX, _mouseY;
 	u32 _mouseWidth, _mouseHeight;
@@ -110,7 +112,6 @@
 	virtual bool getFeatureState(Feature f);
 	virtual const GraphicsMode *getSupportedGraphicsModes() const;
 	virtual int getDefaultGraphicsMode() const;
-	bool setGraphicsMode(const char *name);
 	virtual bool setGraphicsMode(int mode);
 	virtual int getGraphicsMode() const;
 	virtual void initSize(uint width, uint height);

Modified: scummvm/trunk/backends/platform/wii/osystem_gfx.cpp
===================================================================
--- scummvm/trunk/backends/platform/wii/osystem_gfx.cpp	2008-08-11 22:26:25 UTC (rev 33786)
+++ scummvm/trunk/backends/platform/wii/osystem_gfx.cpp	2008-08-11 22:43:00 UTC (rev 33787)
@@ -27,7 +27,12 @@
 #define MAX_FPS 30
 
 enum GraphicModeID {
-	GM_DEFAULT
+	GM_DEFAULT = 0,
+	GM_OVERSCAN1,
+	GM_OVERSCAN2,
+	GM_OVERSCAN3,
+	GM_OVERSCAN4,
+	GM_OVERSCAN5
 };
 
 void OSystem_Wii::initGfx() {
@@ -42,6 +47,11 @@
 	_overlayWidth = 640;
 	_overlayHeight = 480;
 
+#ifndef GAMECUBE
+	if (CONF_GetAspectRatio() && _fullscreen)
+		_overlayHeight = 360;
+#endif
+
 	_overlaySize = _overlayWidth * _overlayHeight * 2;
 	_overlayPixels = (OverlayColor *) memalign(32, _overlaySize);
 
@@ -51,17 +61,32 @@
 	_cursorPalette = (u16 *) memalign(32, 256 * 2);
 	memset(_cursorPalette, 0, 256 * 2);
 
-	_supportedGraphicsModes = new OSystem::GraphicsMode[2];
-	_supportedGraphicsModes[0].name = strdup("gx");
-	_supportedGraphicsModes[0].description = strdup("wii hardware scaler");
+	_supportedGraphicsModes = new OSystem::GraphicsMode[7];
+	_supportedGraphicsModes[0].name = strdup("standard");
+	_supportedGraphicsModes[0].description = strdup("standard");
 	_supportedGraphicsModes[0].id = GM_DEFAULT;
-	_supportedGraphicsModes[1].name = 0;
-	_supportedGraphicsModes[1].description = 0;
-	_supportedGraphicsModes[1].id = 0;
+	_supportedGraphicsModes[1].name = strdup("overscan1");
+	_supportedGraphicsModes[1].description = strdup("overscan 1");
+	_supportedGraphicsModes[1].id = GM_OVERSCAN1;
+	_supportedGraphicsModes[2].name = strdup("overscan2");
+	_supportedGraphicsModes[2].description = strdup("overscan 2");
+	_supportedGraphicsModes[2].id = GM_OVERSCAN2;
+	_supportedGraphicsModes[3].name = strdup("overscan3");
+	_supportedGraphicsModes[3].description = strdup("overscan 3");
+	_supportedGraphicsModes[3].id = GM_OVERSCAN3;
+	_supportedGraphicsModes[4].name = strdup("overscan4");
+	_supportedGraphicsModes[4].description = strdup("overscan 4");
+	_supportedGraphicsModes[4].id = GM_OVERSCAN4;
+	_supportedGraphicsModes[5].name = strdup("overscan5");
+	_supportedGraphicsModes[5].description = strdup("overscan 5");
+	_supportedGraphicsModes[5].id = GM_OVERSCAN5;
+	_supportedGraphicsModes[6].name = 0;
+	_supportedGraphicsModes[6].description = 0;
+	_supportedGraphicsModes[6].id = 0;
 
-	_texture = (u16 *) memalign(32, _overlaySize);
+	_texture = (u16 *) memalign(32, 640 * 480 * 2);
 
-	GX_Start(_overlayWidth, _overlayHeight, 320, 240);
+	setGraphicsMode(_activeGraphicsMode);
 }
 
 void OSystem_Wii::deinitGfx() {
@@ -111,13 +136,24 @@
 	return GM_DEFAULT;
 }
 
-bool OSystem_Wii::setGraphicsMode(const char *mode) {
-	setGraphicsMode(GM_DEFAULT);
+bool OSystem_Wii::setGraphicsMode(int mode) {
+	s16 xar, yar;
 
-	return true;
-}
+	printf("setGraphicsMode %d\n", mode);
 
-bool OSystem_Wii::setGraphicsMode(int mode) {
+	xar = vmode->viWidth / 2;
+	yar = vmode->xfbHeight / 2;
+
+#ifndef GAMECUBE
+	if (CONF_GetAspectRatio() && !_fullscreen)
+		xar /= 1.33f;
+#endif
+
+	GX_SetCamPosZ(400 - mode * 10);
+	GX_Start(640, 480, xar, yar);
+
+	_activeGraphicsMode = mode;
+
 	return true;
 }
 
@@ -129,6 +165,8 @@
 	if (_gameWidth != width || _gameHeight != height) {
 		printf("initSize %u %u\n", width, height);
 
+		assert((width <= 640) && (height <= 480));
+
 		_gameWidth = width;
 		_gameHeight = height;
 
@@ -136,12 +174,15 @@
 			free(_gamePixels);
 
 		_gamePixels = (u8 *) memalign(32, _gameWidth * _gameHeight);
+		memset(_gamePixels, 0, _gameWidth * _gameHeight);
 
 		if (!_overlayVisible) {
 			_currentWidth = _gameWidth;
 			_currentHeight = _gameHeight;
 			updateEventScreenResolution();
 		}
+
+		setGraphicsMode(_activeGraphicsMode);
 	}
 }
 
@@ -320,6 +361,8 @@
 }
 
 void OSystem_Wii::setShakePos(int shakeOffset) {
+	GX_SetTexTrans(0, (float) -shakeOffset * ((float) vmode->efbHeight /
+												(float) _currentHeight));
 }
 
 void OSystem_Wii::showOverlay() {

Modified: scummvm/trunk/dists/wii/READMII
===================================================================
--- scummvm/trunk/dists/wii/READMII	2008-08-11 22:26:25 UTC (rev 33786)
+++ scummvm/trunk/dists/wii/READMII	2008-08-11 22:43:00 UTC (rev 33787)
@@ -1,5 +1,5 @@
-Wii port of ScummVM README
---------------------------
+Wii/Gamecube port of ScummVM README
+-----------------------------------
 
 features not compiled in:
 - the AGI game engine
@@ -66,6 +66,21 @@
     dpad left: "y"
     dpad right: "n"
 
+DISPLAY SETUP
+
+  "Graphics mode"
+    you can choose between multiple overscan options to adjust the screen size
+    used for drawing. select a higher overscan mode to get rid of black
+    borders or choose a lower overscan mode if parts of the picture get cropped
+
+  "Fullscreen mode"
+    If your wii is set to 16:9, this will stretch the picture to fullscreen.
+    Turning this option off results in black borders on the left and right
+    sides, but the aspect ratio will be kept. This option has no effect on 4:3
+    displays
+
+  you have to restart scummvm after changing one of these options
+
 THANKS
 
   shagkur and WinterMute, for devkitppc/libogc and the coorperation


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