[Scummvm-cvs-logs] SF.net SVN: scummvm:[43892] scummvm/trunk/backends/platform/wii
dhewg at users.sourceforge.net
dhewg at users.sourceforge.net
Tue Sep 1 21:33:47 CEST 2009
Revision: 43892
http://scummvm.svn.sourceforge.net/scummvm/?rev=43892&view=rev
Author: dhewg
Date: 2009-09-01 19:33:47 +0000 (Tue, 01 Sep 2009)
Log Message:
-----------
Added an options dialog for some Wii specific settings.
Modified Paths:
--------------
scummvm/trunk/backends/platform/wii/gfx.cpp
scummvm/trunk/backends/platform/wii/module.mk
scummvm/trunk/backends/platform/wii/osystem.cpp
scummvm/trunk/backends/platform/wii/osystem.h
scummvm/trunk/backends/platform/wii/osystem_events.cpp
scummvm/trunk/backends/platform/wii/osystem_gfx.cpp
Added Paths:
-----------
scummvm/trunk/backends/platform/wii/options.cpp
scummvm/trunk/backends/platform/wii/options.h
Modified: scummvm/trunk/backends/platform/wii/gfx.cpp
===================================================================
--- scummvm/trunk/backends/platform/wii/gfx.cpp 2009-09-01 19:05:21 UTC (rev 43891)
+++ scummvm/trunk/backends/platform/wii/gfx.cpp 2009-09-01 19:33:47 UTC (rev 43892)
@@ -165,10 +165,15 @@
f32 ar;
u16 correction;
+ u16 usy = _underscan_y;
+
+ if (!_dualstrike)
+ usy *= 2;
+
u16 x1 = _underscan_x * 2;
- u16 y1 = _underscan_y * 2;
+ u16 y1 = usy;
u16 x2 = _vm->fbWidth - _underscan_x * 4;
- u16 y2 = _vm->efbHeight - _underscan_y * 4;
+ u16 y2 = _vm->efbHeight - usy * 2;
if (_pillarboxing)
ar = 16.0 / 9.0;
Modified: scummvm/trunk/backends/platform/wii/module.mk
===================================================================
--- scummvm/trunk/backends/platform/wii/module.mk 2009-09-01 19:05:21 UTC (rev 43891)
+++ scummvm/trunk/backends/platform/wii/module.mk 2009-09-01 19:33:47 UTC (rev 43892)
@@ -3,6 +3,7 @@
MODULE_OBJS := \
main.o \
gfx.o \
+ options.o \
osystem.o \
osystem_gfx.o \
osystem_sfx.o \
Added: scummvm/trunk/backends/platform/wii/options.cpp
===================================================================
--- scummvm/trunk/backends/platform/wii/options.cpp (rev 0)
+++ scummvm/trunk/backends/platform/wii/options.cpp 2009-09-01 19:33:47 UTC (rev 43892)
@@ -0,0 +1,116 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "common/config-manager.h"
+#include "gui/dialog.h"
+#include "gui/TabWidget.h"
+
+#include "options.h"
+#include "gfx.h"
+
+WiiOptionsDialog::WiiOptionsDialog(const OSystem::GraphicsMode &gfxMode) :
+ Dialog(180, 120, 304, 200) {
+
+ _videoModePrefix = String("wii_video_") + gfxMode.name;
+
+ new ButtonWidget(this, 56, 160, 108, 24, "Cancel", 'c');
+ new ButtonWidget(this, 180, 160, 108, 24, "Ok", 'k');
+
+ TabWidget *tab = new TabWidget(this, 0, 0, 304, 146);
+
+ tab->addTab("Video");
+
+ new StaticTextWidget(tab, 16, 16, 128, 16,
+ "Current video mode:", Graphics::kTextAlignRight);
+ new StaticTextWidget(tab, 160, 16, 128, 16,
+ gfxMode.description, Graphics::kTextAlignLeft);
+
+ new StaticTextWidget(tab, 16, 48, 128, 16,
+ "Horizontal underscan:", Graphics::kTextAlignRight);
+ _sliderUnderscanX = new SliderWidget(tab, 160, 47, 128, 18, 'x');
+ _sliderUnderscanX->setMinValue(0);
+ _sliderUnderscanX->setMaxValue(32);
+
+ new StaticTextWidget(tab, 16, 80, 128, 16,
+ "Vertical underscan:", Graphics::kTextAlignRight);
+ _sliderUnderscanY = new SliderWidget(tab, 160, 79, 128, 18, 'y');
+ _sliderUnderscanY->setMinValue(0);
+ _sliderUnderscanY->setMaxValue(32);
+
+ load();
+}
+
+WiiOptionsDialog::~WiiOptionsDialog() {
+}
+
+void WiiOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd,
+ uint32 data) {
+ switch (cmd) {
+ case 'x':
+ case 'y':
+ gfx_set_underscan(_sliderUnderscanX->getValue(),
+ _sliderUnderscanY->getValue());
+ break;
+
+ case 'k':
+ save();
+ close();
+ break;
+
+ case 'c':
+ revert();
+ close();
+ break;
+
+ default:
+ Dialog::handleCommand(sender, cmd, data);
+ break;
+ }
+}
+
+void WiiOptionsDialog::revert() {
+ gfx_set_underscan(ConfMan.getInt(_videoModePrefix + "_underscan_x",
+ Common::ConfigManager::kApplicationDomain),
+ ConfMan.getInt(_videoModePrefix + "_underscan_y",
+ Common::ConfigManager::kApplicationDomain));
+}
+
+void WiiOptionsDialog::load() {
+ int x = ConfMan.getInt(_videoModePrefix + "_underscan_x",
+ Common::ConfigManager::kApplicationDomain);
+ int y = ConfMan.getInt(_videoModePrefix + "_underscan_y",
+ Common::ConfigManager::kApplicationDomain);
+
+ _sliderUnderscanX->setValue(x);
+ _sliderUnderscanY->setValue(y);
+}
+
+void WiiOptionsDialog::save() {
+ ConfMan.setInt(_videoModePrefix + "_underscan_x",
+ _sliderUnderscanX->getValue(),
+ Common::ConfigManager::kApplicationDomain);
+ ConfMan.setInt(_videoModePrefix + "_underscan_y",
+ _sliderUnderscanY->getValue(),
+ Common::ConfigManager::kApplicationDomain);
+ ConfMan.flushToDisk();
+}
+
Property changes on: scummvm/trunk/backends/platform/wii/options.cpp
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author URL Id
Added: svn:eol-style
+ native
Added: scummvm/trunk/backends/platform/wii/options.h
===================================================================
--- scummvm/trunk/backends/platform/wii/options.h (rev 0)
+++ scummvm/trunk/backends/platform/wii/options.h 2009-09-01 19:33:47 UTC (rev 43892)
@@ -0,0 +1,52 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef _WII_OPTIONS_H_
+#define _WII_OPTIONS_H_
+
+#include "common/str.h"
+#include "gui/dialog.h"
+
+using namespace GUI;
+
+class WiiOptionsDialog: public GUI::Dialog {
+ typedef Common::String String;
+
+public:
+ WiiOptionsDialog(const OSystem::GraphicsMode &gfxMode);
+ virtual ~WiiOptionsDialog();
+
+ virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
+
+private:
+ String _videoModePrefix;
+
+ SliderWidget *_sliderUnderscanX;
+ SliderWidget *_sliderUnderscanY;
+
+ void revert();
+ void load();
+ void save();
+};
+
+#endif
+
Property changes on: scummvm/trunk/backends/platform/wii/options.h
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author URL Id
Added: svn:eol-style
+ native
Modified: scummvm/trunk/backends/platform/wii/osystem.cpp
===================================================================
--- scummvm/trunk/backends/platform/wii/osystem.cpp 2009-09-01 19:05:21 UTC (rev 43891)
+++ scummvm/trunk/backends/platform/wii/osystem.cpp 2009-09-01 19:33:47 UTC (rev 43892)
@@ -66,6 +66,7 @@
_pfCursor(Graphics::PixelFormat::createFormatCLUT8()),
#endif
+ _optionsDlgActive(false),
_fullscreen(false),
_arCorrection(false),
@@ -113,9 +114,6 @@
initSfx();
initEvents();
- ConfMan.registerDefault("fullscreen", true);
- ConfMan.registerDefault("aspect_ratio", true);
-
OSystem::initBackend();
}
Modified: scummvm/trunk/backends/platform/wii/osystem.h
===================================================================
--- scummvm/trunk/backends/platform/wii/osystem.h 2009-09-01 19:05:21 UTC (rev 43891)
+++ scummvm/trunk/backends/platform/wii/osystem.h 2009-09-01 19:33:47 UTC (rev 43892)
@@ -93,6 +93,7 @@
Graphics::PixelFormat _pfCursor;
#endif
+ bool _optionsDlgActive;
bool _fullscreen;
bool _arCorrection;
@@ -121,6 +122,8 @@
void updateEventScreenResolution();
bool pollKeyboard(Common::Event &event);
+ void showOptionsDialog();
+
protected:
Common::SaveFileManager *_savefile;
Audio::MixerImpl *_mixer;
Modified: scummvm/trunk/backends/platform/wii/osystem_events.cpp
===================================================================
--- scummvm/trunk/backends/platform/wii/osystem_events.cpp 2009-09-01 19:05:21 UTC (rev 43891)
+++ scummvm/trunk/backends/platform/wii/osystem_events.cpp 2009-09-01 19:33:47 UTC (rev 43892)
@@ -319,36 +319,19 @@
if (bd || bu) {
byte flags = 0;
- // TODO: add this to an option dialog
- if (bh & PADS_R) {
- static u16 vpo_x = 0;
- static u16 vpo_y = 0;
-
- if (bd & PADS_LEFT)
- vpo_x = (vpo_x - 1) % 32;
-
- if (bd & PADS_RIGHT)
- vpo_x = (vpo_x + 1) % 32;
-
- if (bd & PADS_UP)
- vpo_y = (vpo_y - 1) % 32;
-
- if (bd & PADS_DOWN)
- vpo_y = (vpo_y + 1) % 32;
-
- gfx_set_underscan(vpo_x, vpo_y);
- return false;
- }
-
if (bh & PADS_UP) {
- PAD_EVENT(PADS_START, Common::KEYCODE_F5, Common::ASCII_F5, Common::KBD_CTRL);
-
+ PAD_EVENT(PADS_START, Common::KEYCODE_F5, Common::ASCII_F5,
+ Common::KBD_CTRL);
flags = Common::KBD_SHIFT;
}
+ if (bd & PADS_R) {
+ showOptionsDialog();
+ return false;
+ }
+
if (bd & PADS_RIGHT) {
event.type = Common::EVENT_PREDICTIVE_DIALOG;
-
return true;
}
Modified: scummvm/trunk/backends/platform/wii/osystem_gfx.cpp
===================================================================
--- scummvm/trunk/backends/platform/wii/osystem_gfx.cpp 2009-09-01 19:05:21 UTC (rev 43891)
+++ scummvm/trunk/backends/platform/wii/osystem_gfx.cpp 2009-09-01 19:33:47 UTC (rev 43892)
@@ -26,6 +26,7 @@
#include "backends/fs/wii/wii-fs-factory.h"
#include "osystem.h"
+#include "options.h"
#include "gfx.h"
#define ROUNDUP(x,n) (-(-(x) & -(n)))
@@ -33,7 +34,7 @@
#define TLUT_GAME GX_TLUT0
#define TLUT_MOUSE GX_TLUT1
-static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
+static const OSystem::GraphicsMode _supportedGraphicsModes[] = {
{ "standard", "Standard", GFX_SETUP_STANDARD },
{ "standardaa", "Standard antialiased", GFX_SETUP_STANDARD_AA },
{ "ds", "Double-strike", GFX_SETUP_DS },
@@ -42,8 +43,24 @@
};
void OSystem_Wii::initGfx() {
+ ConfMan.registerDefault("fullscreen", true);
+ ConfMan.registerDefault("aspect_ratio", true);
+
+ 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_init();
+ gfx_set_underscan(ConfMan.getInt("wii_video_standard_underscan_x"),
+ ConfMan.getInt("wii_video_standard_underscan_y"));
_overlayWidth = gfx_video_get_width();
_overlayHeight = gfx_video_get_height();
@@ -134,6 +151,13 @@
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));
+
_actualGraphicsMode = mode;
gfx_coords(&_coordsOverlay, &_texOverlay, GFX_COORD_FULLSCREEN);
@@ -142,7 +166,7 @@
}
const OSystem::GraphicsMode* OSystem_Wii::getSupportedGraphicsModes() const {
- return s_supportedGraphicsModes;
+ return _supportedGraphicsModes;
}
int OSystem_Wii::getDefaultGraphicsMode() const {
@@ -659,3 +683,14 @@
_cursorPaletteDirty = true;
}
+void OSystem_Wii::showOptionsDialog() {
+ if (_optionsDlgActive)
+ return;
+
+ _optionsDlgActive = true;
+ WiiOptionsDialog dlg(_supportedGraphicsModes[_actualGraphicsMode]);
+ dlg.runModal();
+ _optionsDlgActive = false;
+}
+
+
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