aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorAndre Heider2009-09-03 17:52:38 +0000
committerAndre Heider2009-09-03 17:52:38 +0000
commit9aa7546a3491acbbace93729efed2dc62a1f1855 (patch)
tree74cd030a464db0825a4224d87a9847fc25bc130e /backends
parent05035fd8c34443276d885eac58f9444579d71326 (diff)
downloadscummvm-rg350-9aa7546a3491acbbace93729efed2dc62a1f1855.tar.gz
scummvm-rg350-9aa7546a3491acbbace93729efed2dc62a1f1855.tar.bz2
scummvm-rg350-9aa7546a3491acbbace93729efed2dc62a1f1855.zip
Removed AA modes in favor of bilinear texture filtering, which gives much better results. Renamed a few types and enums to make it clear what they're for.
svn-id: r43919
Diffstat (limited to 'backends')
-rw-r--r--backends/platform/wii/gfx.cpp71
-rw-r--r--backends/platform/wii/gfx.h27
-rw-r--r--backends/platform/wii/options.cpp30
-rw-r--r--backends/platform/wii/options.h6
-rw-r--r--backends/platform/wii/osystem.cpp3
-rw-r--r--backends/platform/wii/osystem.h8
-rw-r--r--backends/platform/wii/osystem_gfx.cpp114
7 files changed, 167 insertions, 92 deletions
diff --git a/backends/platform/wii/gfx.cpp b/backends/platform/wii/gfx.cpp
index a23904e207..3b4a80fc5a 100644
--- a/backends/platform/wii/gfx.cpp
+++ b/backends/platform/wii/gfx.cpp
@@ -23,7 +23,7 @@ extern "C" {
#define ORIGIN_Z (-500)
static GXRModeObj *_vm = NULL;
-static bool _dualstrike = false;
+static bool _doublestrike = false;
static u32 *_fb[2] = { NULL, NULL };
static u8 _fb_active = 0;
@@ -46,63 +46,63 @@ static struct {
{ 0.0f, 0.0f, -0.5f }
};
-// Standard, StandardAa, Ds, DsAa
-static GXRModeObj *mode_table[5][4] = {
- { &TVNtsc480Prog, &TVNtsc480ProgAa, &TVNtsc240Ds, &TVNtsc240DsAa },
- { &TVNtsc480IntDf, &TVNtsc480IntAa, &TVNtsc240Ds, &TVNtsc240DsAa },
- { &TVPal528IntDf, &TVPal524IntAa, &TVPal264Ds, &TVPal264DsAa },
- { &TVEurgb60Hz480IntDf, &TVEurgb60Hz480IntAa, &TVEurgb60Hz240Ds, &TVEurgb60Hz240DsAa },
- { &TVMpal480IntDf, &TVMpal480IntAa, &TVMpal240Ds, &TVMpal240DsAa }
+// Standard, DS
+static GXRModeObj *mode_table[5][2] = {
+ { &TVNtsc480Prog, &TVNtsc240Ds },
+ { &TVNtsc480IntDf, &TVNtsc240Ds },
+ { &TVPal574IntDfScale, &TVPal264Ds },
+ { &TVEurgb60Hz480IntDf, &TVEurgb60Hz240Ds },
+ { &TVMpal480IntDf, &TVMpal240Ds }
};
-static gfx_video_mode_t _gfx_video_get_mode(void) {
- gfx_video_mode_t mode;
+gfx_video_standard_t gfx_video_get_standard(void) {
+ gfx_video_standard_t standard;
#ifdef HW_RVL
if ((CONF_GetProgressiveScan() > 0) && VIDEO_HaveComponentCable()) {
- mode = GFX_MODE_PROGRESSIVE;
+ standard = GFX_STANDARD_PROGRESSIVE;
} else {
switch (CONF_GetVideo()) {
case CONF_VIDEO_PAL:
if (CONF_GetEuRGB60() > 0)
- mode = GFX_MODE_EURGB60;
+ standard = GFX_STANDARD_EURGB60;
else
- mode = GFX_MODE_PAL;
+ standard = GFX_STANDARD_PAL;
break;
case CONF_VIDEO_MPAL:
- mode = GFX_MODE_MPAL;
+ standard = GFX_STANDARD_MPAL;
break;
default:
- mode = GFX_MODE_NTSC;
+ standard = GFX_STANDARD_NTSC;
break;
}
}
#else
switch (VIDEO_GetCurrentTvMode()) {
case VI_PAL:
- mode = GFX_MODE_PAL;
+ standard = GFX_STANDARD_PAL;
break;
case VI_MPAL:
- mode = GFX_MODE_MPAL;
+ standard = GFX_STANDARD_MPAL;
break;
default:
- mode = GFX_MODE_NTSC;
+ standard = GFX_STANDARD_NTSC;
break;
}
#endif
- return mode;
+ return standard;
}
-void gfx_video_init(gfx_video_mode_t mode, gfx_video_setup_t setup) {
+void gfx_video_init(gfx_video_standard_t standard, gfx_video_mode_t mode) {
u8 i;
- if (mode == GFX_MODE_AUTO)
- mode = _gfx_video_get_mode();
+ if (standard == GFX_STANDARD_AUTO)
+ standard = gfx_video_get_standard();
- _vm = mode_table[mode][setup];
+ _vm = mode_table[standard][mode];
_vm->viWidth = 672;
_vm->viXOrigin = (VI_MAX_WIDTH_NTSC - _vm->viWidth) / 2;
@@ -111,6 +111,7 @@ void gfx_video_init(gfx_video_mode_t mode, gfx_video_setup_t setup) {
VIDEO_WaitVSync();
VIDEO_Configure(_vm);
+ VIDEO_Flush();
if (_fb[0])
free(MEM_K1_TO_K0(_fb[0]));
@@ -167,7 +168,7 @@ static void _update_viewport(void) {
u16 usy = _underscan_y;
- if (!_dualstrike)
+ if (!_doublestrike)
usy *= 2;
u16 x1 = _underscan_x * 2;
@@ -191,7 +192,7 @@ static void _update_viewport(void) {
correction = _vm->efbHeight -
(u16) round((f32) _vm->efbHeight * ar / _ar);
- if (_dualstrike)
+ if (_doublestrike)
correction /= 2;
y1 += correction / 2;
@@ -221,13 +222,13 @@ void gfx_init(void) {
_update_viewport();
- _dualstrike = _vm->viHeight == 2 * _vm->xfbHeight;
+ _doublestrike = _vm->viHeight == 2 * _vm->xfbHeight;
yscale = GX_GetYScaleFactor(_vm->efbHeight, _vm->xfbHeight);
xfbHeight = GX_SetDispCopyYScale(yscale);
GX_SetDispCopySrc(0, 0, _vm->fbWidth, _vm->efbHeight);
GX_SetDispCopyDst(_vm->fbWidth, xfbHeight);
GX_SetCopyFilter(_vm->aa, _vm->sample_pattern, GX_TRUE, _vm->vfilter);
- GX_SetFieldMode(_vm->field_rendering, _dualstrike ? GX_ENABLE : GX_DISABLE);
+ GX_SetFieldMode(_vm->field_rendering, _doublestrike ? GX_ENABLE : GX_DISABLE);
if (_vm->aa)
GX_SetPixelFmt(GX_PF_RGB565_Z16, GX_ZC_LINEAR);
@@ -444,6 +445,22 @@ void gfx_coords(gfx_coords_t *coords, gfx_tex_t *tex, gfx_coord_t type) {
}
}
+bool gfx_tex_set_bilinear_filter(gfx_tex_t *tex, bool enable) {
+ if (!tex)
+ return false;
+
+ if (enable) {
+ if (tex->palette)
+ GX_InitTexObjFilterMode(&tex->obj, GX_LIN_MIP_NEAR, GX_LINEAR);
+ else
+ GX_InitTexObjFilterMode(&tex->obj, GX_LIN_MIP_LIN, GX_LINEAR);
+ } else {
+ GX_InitTexObjFilterMode(&tex->obj, GX_NEAR, GX_NEAR);
+ }
+
+ return true;
+}
+
bool gfx_tex_flush_texture(gfx_tex_t *tex) {
if (!tex)
return false;
diff --git a/backends/platform/wii/gfx.h b/backends/platform/wii/gfx.h
index f4c49653c5..93efdc04a3 100644
--- a/backends/platform/wii/gfx.h
+++ b/backends/platform/wii/gfx.h
@@ -18,20 +18,18 @@ extern "C" {
#endif
typedef enum {
- GFX_MODE_AUTO = -1,
- GFX_MODE_PROGRESSIVE = 0,
- GFX_MODE_NTSC,
- GFX_MODE_PAL,
- GFX_MODE_EURGB60,
- GFX_MODE_MPAL
-} gfx_video_mode_t;
+ GFX_STANDARD_AUTO = -1,
+ GFX_STANDARD_PROGRESSIVE = 0,
+ GFX_STANDARD_NTSC,
+ GFX_STANDARD_PAL,
+ GFX_STANDARD_EURGB60,
+ GFX_STANDARD_MPAL
+} gfx_video_standard_t;
typedef enum {
- GFX_SETUP_STANDARD = 0,
- GFX_SETUP_STANDARD_AA,
- GFX_SETUP_DS,
- GFX_SETUP_DS_AA
-} gfx_video_setup_t;
+ GFX_MODE_DEFAULT = 0,
+ GFX_MODE_DS,
+} gfx_video_mode_t;
typedef enum {
GFX_TF_RGB565 = 0,
@@ -63,7 +61,9 @@ typedef struct {
f32 w, h;
} gfx_coords_t;
-void gfx_video_init(gfx_video_mode_t mode, gfx_video_setup_t setup);
+gfx_video_standard_t gfx_video_get_standard(void);
+
+void gfx_video_init(gfx_video_standard_t standard, gfx_video_mode_t mode);
void gfx_video_deinit(void);
u16 gfx_video_get_width(void);
@@ -82,6 +82,7 @@ void gfx_tex_deinit(gfx_tex_t *tex);
void gfx_coords(gfx_coords_t *coords, gfx_tex_t *tex, gfx_coord_t type);
+bool gfx_tex_set_bilinear_filter(gfx_tex_t *tex, bool enable);
bool gfx_tex_flush_texture(gfx_tex_t *tex);
bool gfx_tex_flush_palette(gfx_tex_t *tex);
bool gfx_tex_clear_palette(gfx_tex_t *tex);
diff --git a/backends/platform/wii/options.cpp b/backends/platform/wii/options.cpp
index 52c29a8a24..f8b70804d0 100644
--- a/backends/platform/wii/options.cpp
+++ b/backends/platform/wii/options.cpp
@@ -27,10 +27,17 @@
#include "options.h"
#include "gfx.h"
-WiiOptionsDialog::WiiOptionsDialog(const OSystem::GraphicsMode &gfxMode) :
- Dialog(180, 120, 304, 200) {
-
- _videoModePrefix = String("wii_video_") + gfxMode.name;
+WiiOptionsDialog::WiiOptionsDialog(bool doubleStrike) :
+ Dialog(180, 120, 304, 200),
+ _doubleStrike(doubleStrike) {
+
+ if (_doubleStrike) {
+ _strUnderscanX = "wii_video_ds_underscan_x";
+ _strUnderscanY = "wii_video_ds_underscan_y";
+ } else {
+ _strUnderscanX = "wii_video_default_underscan_x";
+ _strUnderscanY = "wii_video_default_underscan_y";
+ }
new ButtonWidget(this, 56, 160, 108, 24, "Cancel", 'c');
new ButtonWidget(this, 180, 160, 108, 24, "Ok", 'k');
@@ -42,7 +49,8 @@ WiiOptionsDialog::WiiOptionsDialog(const OSystem::GraphicsMode &gfxMode) :
new StaticTextWidget(tab, 16, 16, 128, 16,
"Current video mode:", Graphics::kTextAlignRight);
new StaticTextWidget(tab, 160, 16, 128, 16,
- gfxMode.description, Graphics::kTextAlignLeft);
+ _doubleStrike ? "Double-strike" : "Default",
+ Graphics::kTextAlignLeft);
new StaticTextWidget(tab, 16, 48, 128, 16,
"Horizontal underscan:", Graphics::kTextAlignRight);
@@ -88,16 +96,16 @@ void WiiOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd,
}
void WiiOptionsDialog::revert() {
- gfx_set_underscan(ConfMan.getInt(_videoModePrefix + "_underscan_x",
+ gfx_set_underscan(ConfMan.getInt(_strUnderscanX,
Common::ConfigManager::kApplicationDomain),
- ConfMan.getInt(_videoModePrefix + "_underscan_y",
+ ConfMan.getInt(_strUnderscanY,
Common::ConfigManager::kApplicationDomain));
}
void WiiOptionsDialog::load() {
- int x = ConfMan.getInt(_videoModePrefix + "_underscan_x",
+ int x = ConfMan.getInt(_strUnderscanX,
Common::ConfigManager::kApplicationDomain);
- int y = ConfMan.getInt(_videoModePrefix + "_underscan_y",
+ int y = ConfMan.getInt(_strUnderscanY,
Common::ConfigManager::kApplicationDomain);
_sliderUnderscanX->setValue(x);
@@ -105,10 +113,10 @@ void WiiOptionsDialog::load() {
}
void WiiOptionsDialog::save() {
- ConfMan.setInt(_videoModePrefix + "_underscan_x",
+ ConfMan.setInt(_strUnderscanX,
_sliderUnderscanX->getValue(),
Common::ConfigManager::kApplicationDomain);
- ConfMan.setInt(_videoModePrefix + "_underscan_y",
+ ConfMan.setInt(_strUnderscanY,
_sliderUnderscanY->getValue(),
Common::ConfigManager::kApplicationDomain);
ConfMan.flushToDisk();
diff --git a/backends/platform/wii/options.h b/backends/platform/wii/options.h
index c5e045bdf3..83c8ddd0d6 100644
--- a/backends/platform/wii/options.h
+++ b/backends/platform/wii/options.h
@@ -32,13 +32,15 @@ class WiiOptionsDialog: public GUI::Dialog {
typedef Common::String String;
public:
- WiiOptionsDialog(const OSystem::GraphicsMode &gfxMode);
+ WiiOptionsDialog(bool doubleStrike);
virtual ~WiiOptionsDialog();
virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
private:
- String _videoModePrefix;
+ bool _doubleStrike;
+ String _strUnderscanX;
+ String _strUnderscanY;
SliderWidget *_sliderUnderscanX;
SliderWidget *_sliderUnderscanY;
diff --git a/backends/platform/wii/osystem.cpp b/backends/platform/wii/osystem.cpp
index e928ef30a7..39c6b9df53 100644
--- a/backends/platform/wii/osystem.cpp
+++ b/backends/platform/wii/osystem.cpp
@@ -58,6 +58,7 @@ OSystem_Wii::OSystem_Wii() :
_configGraphicsMode(0),
_actualGraphicsMode(0),
+ _bilinearFilter(false),
#ifdef USE_RGB_COLOR
_pfRGB565(Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)),
_pfRGB3444(Graphics::PixelFormat(2, 4, 4, 4, 3, 8, 4, 0, 12)),
@@ -134,7 +135,7 @@ void OSystem_Wii::engineInit() {
void OSystem_Wii::engineDone() {
_gameRunning = false;
- switchVideoMode(GFX_SETUP_STANDARD);
+ switchVideoMode(gmStandard);
gfx_set_ar(4.0 / 3.0);
}
diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h
index 313e7849ec..c4f79d9386 100644
--- a/backends/platform/wii/osystem.h
+++ b/backends/platform/wii/osystem.h
@@ -85,6 +85,7 @@ private:
s32 _configGraphicsMode;
s32 _actualGraphicsMode;
+ bool _bilinearFilter;
#ifdef USE_RGB_COLOR
const Graphics::PixelFormat _pfRGB565;
const Graphics::PixelFormat _pfRGB3444;
@@ -130,6 +131,13 @@ protected:
DefaultTimerManager *_timer;
public:
+ enum {
+ gmStandard = 0,
+ gmStandardFiltered,
+ gmDoubleStrike,
+ gmDoubleStrikeFiltered
+ };
+
OSystem_Wii();
virtual ~OSystem_Wii();
diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp
index 6e33fb463d..3feaf65c1e 100644
--- a/backends/platform/wii/osystem_gfx.cpp
+++ b/backends/platform/wii/osystem_gfx.cpp
@@ -35,32 +35,41 @@
#define TLUT_MOUSE GX_TLUT1
static const OSystem::GraphicsMode _supportedGraphicsModes[] = {
- { "standard", "Standard", GFX_SETUP_STANDARD },
- { "standardaa", "Standard antialiased", GFX_SETUP_STANDARD_AA },
- { "ds", "Double-strike", GFX_SETUP_DS },
- { "dsaa", "Double-strike antialiased", GFX_SETUP_DS_AA },
+ {
+ "default",
+ "Default",
+ OSystem_Wii::gmStandard
+ },
+ {
+ "defaultbilinear",
+ "Default, bilinear filtering",
+ OSystem_Wii::gmStandardFiltered
+ },
+ {
+ "ds",
+ "Double-strike",
+ OSystem_Wii::gmDoubleStrike
+ },
+ {
+ "dsbilinear",
+ "Double-strike, bilinear filtering",
+ OSystem_Wii::gmDoubleStrikeFiltered
+ },
{ 0, 0, 0 }
};
void OSystem_Wii::initGfx() {
ConfMan.registerDefault("fullscreen", true);
ConfMan.registerDefault("aspect_ratio", true);
+ ConfMan.registerDefault("wii_video_default_underscan_x", 16);
+ ConfMan.registerDefault("wii_video_default_underscan_y", 16);
+ ConfMan.registerDefault("wii_video_ds_underscan_x", 16);
+ ConfMan.registerDefault("wii_video_ds_underscan_y", 16);
- int i = 0;
- while (_supportedGraphicsModes[i].name) {
- Common::String s("wii_video_");
- s += _supportedGraphicsModes[i].name;
-
- ConfMan.registerDefault(s + "_underscan_x", 16);
- ConfMan.registerDefault(s + "_underscan_y", 16);
-
- i++;
- }
-
- gfx_video_init(GFX_MODE_AUTO, GFX_SETUP_STANDARD);
+ gfx_video_init(GFX_STANDARD_AUTO, GFX_MODE_DEFAULT);
gfx_init();
- gfx_set_underscan(ConfMan.getInt("wii_video_standard_underscan_x"),
- ConfMan.getInt("wii_video_standard_underscan_y"));
+ gfx_set_underscan(ConfMan.getInt("wii_video_default_underscan_x"),
+ ConfMan.getInt("wii_video_default_underscan_y"));
_overlayWidth = gfx_video_get_width();
_overlayHeight = gfx_video_get_height();
@@ -134,32 +143,51 @@ void OSystem_Wii::updateScreenResolution() {
}
void OSystem_Wii::switchVideoMode(int mode) {
+ static const struct {
+ gfx_video_mode_t mode;
+ bool filter;
+ } map[] = {
+ { GFX_MODE_DEFAULT, false },
+ { GFX_MODE_DEFAULT, true },
+ { GFX_MODE_DS, false },
+ { GFX_MODE_DS, true }
+ };
+
if (_gameHeight > 240) {
- if (mode == GFX_SETUP_DS)
- mode = GFX_SETUP_STANDARD;
- else if (mode == GFX_SETUP_DS_AA)
- mode = GFX_SETUP_STANDARD_AA;
+ if (mode == gmDoubleStrike)
+ mode = gmStandard;
+ else if (mode == gmDoubleStrikeFiltered)
+ mode = gmStandardFiltered;
}
- if (_actualGraphicsMode == mode)
- return;
-
printf("switchVideoMode %d\n", mode);
- gfx_video_setup_t setup = static_cast<gfx_video_setup_t> (mode);
- gfx_video_deinit();
- gfx_video_init(GFX_MODE_AUTO, setup);
- gfx_init();
-
- Common::String s("wii_video_");
- s += _supportedGraphicsModes[mode].name;
- gfx_set_underscan(ConfMan.getInt(s + "_underscan_x",
- Common::ConfigManager::kApplicationDomain),
- ConfMan.getInt(s + "_underscan_y",
- Common::ConfigManager::kApplicationDomain));
+ if (map[_actualGraphicsMode].mode != map[mode].mode) {
+ gfx_video_deinit();
+ gfx_video_init(GFX_STANDARD_AUTO, map[mode].mode);
+ gfx_init();
+ }
_actualGraphicsMode = mode;
+ _bilinearFilter = map[mode].filter;
+ gfx_tex_set_bilinear_filter(&_texGame, _bilinearFilter);
+ gfx_tex_set_bilinear_filter(&_texMouse, _bilinearFilter);
+
+ u16 usx, usy;
+ if (map[mode].mode == GFX_MODE_DS) {
+ usx = ConfMan.getInt("wii_video_ds_underscan_x",
+ Common::ConfigManager::kApplicationDomain);
+ usy = ConfMan.getInt("wii_video_ds_underscan_y",
+ Common::ConfigManager::kApplicationDomain);
+ } else {
+ usx = ConfMan.getInt("wii_video_default_underscan_x",
+ Common::ConfigManager::kApplicationDomain);
+ usy = ConfMan.getInt("wii_video_default_underscan_y",
+ Common::ConfigManager::kApplicationDomain);
+ }
+
+ gfx_set_underscan(usx, usy);
gfx_coords(&_coordsOverlay, &_texOverlay, GFX_COORD_FULLSCREEN);
gfx_coords(&_coordsGame, &_texGame, GFX_COORD_FULLSCREEN);
updateScreenResolution();
@@ -170,7 +198,7 @@ const OSystem::GraphicsMode* OSystem_Wii::getSupportedGraphicsModes() const {
}
int OSystem_Wii::getDefaultGraphicsMode() const {
- return GFX_SETUP_STANDARD;
+ return gmStandard;
}
bool OSystem_Wii::setGraphicsMode(int mode) {
@@ -270,6 +298,7 @@ void OSystem_Wii::initSize(uint width, uint height,
::abort();
}
+ gfx_tex_set_bilinear_filter(&_texGame, _bilinearFilter);
gfx_coords(&_coordsGame, &_texGame, GFX_COORD_FULLSCREEN);
updateScreenResolution();
@@ -342,6 +371,8 @@ void OSystem_Wii::setCursorPalette(const byte *colors, uint start, uint num) {
printf("could not init the mouse texture\n");
::abort();
}
+
+ gfx_tex_set_bilinear_filter(&_texMouse, _bilinearFilter);
}
if (_cursorPaletteDisabled) {
@@ -493,6 +524,7 @@ void OSystem_Wii::showOverlay() {
_mouseY = _overlayHeight / 2;
_overlayVisible = true;
updateScreenResolution();
+ gfx_tex_set_bilinear_filter(&_texMouse, true);
}
void OSystem_Wii::hideOverlay() {
@@ -500,6 +532,7 @@ void OSystem_Wii::hideOverlay() {
_mouseY = _gameHeight / 2;
_overlayVisible = false;
updateScreenResolution();
+ gfx_tex_set_bilinear_filter(&_texMouse, _bilinearFilter);
}
void OSystem_Wii::clearOverlay() {
@@ -616,6 +649,8 @@ void OSystem_Wii::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX,
::abort();
}
+ gfx_tex_set_bilinear_filter(&_texMouse, _bilinearFilter);
+
if ((tw != w) || (th != h))
tmpBuf = true;
@@ -687,8 +722,11 @@ void OSystem_Wii::showOptionsDialog() {
if (_optionsDlgActive)
return;
+ bool ds = (_actualGraphicsMode == gmDoubleStrike) ||
+ (_actualGraphicsMode == gmDoubleStrikeFiltered);
+
_optionsDlgActive = true;
- WiiOptionsDialog dlg(_supportedGraphicsModes[_actualGraphicsMode]);
+ WiiOptionsDialog dlg(ds);
dlg.runModal();
_optionsDlgActive = false;
}