Added an options dialog for some Wii specific settings.
svn-id: r43892
This commit is contained in:
parent
a191728945
commit
cf112f9a43
8 changed files with 224 additions and 31 deletions
|
@ -165,10 +165,15 @@ static void _update_viewport(void) {
|
||||||
f32 ar;
|
f32 ar;
|
||||||
u16 correction;
|
u16 correction;
|
||||||
|
|
||||||
|
u16 usy = _underscan_y;
|
||||||
|
|
||||||
|
if (!_dualstrike)
|
||||||
|
usy *= 2;
|
||||||
|
|
||||||
u16 x1 = _underscan_x * 2;
|
u16 x1 = _underscan_x * 2;
|
||||||
u16 y1 = _underscan_y * 2;
|
u16 y1 = usy;
|
||||||
u16 x2 = _vm->fbWidth - _underscan_x * 4;
|
u16 x2 = _vm->fbWidth - _underscan_x * 4;
|
||||||
u16 y2 = _vm->efbHeight - _underscan_y * 4;
|
u16 y2 = _vm->efbHeight - usy * 2;
|
||||||
|
|
||||||
if (_pillarboxing)
|
if (_pillarboxing)
|
||||||
ar = 16.0 / 9.0;
|
ar = 16.0 / 9.0;
|
||||||
|
|
|
@ -3,6 +3,7 @@ MODULE := backends/platform/wii
|
||||||
MODULE_OBJS := \
|
MODULE_OBJS := \
|
||||||
main.o \
|
main.o \
|
||||||
gfx.o \
|
gfx.o \
|
||||||
|
options.o \
|
||||||
osystem.o \
|
osystem.o \
|
||||||
osystem_gfx.o \
|
osystem_gfx.o \
|
||||||
osystem_sfx.o \
|
osystem_sfx.o \
|
||||||
|
|
116
backends/platform/wii/options.cpp
Normal file
116
backends/platform/wii/options.cpp
Normal file
|
@ -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();
|
||||||
|
}
|
||||||
|
|
52
backends/platform/wii/options.h
Normal file
52
backends/platform/wii/options.h
Normal file
|
@ -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
|
||||||
|
|
|
@ -66,6 +66,7 @@ OSystem_Wii::OSystem_Wii() :
|
||||||
_pfCursor(Graphics::PixelFormat::createFormatCLUT8()),
|
_pfCursor(Graphics::PixelFormat::createFormatCLUT8()),
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
_optionsDlgActive(false),
|
||||||
_fullscreen(false),
|
_fullscreen(false),
|
||||||
_arCorrection(false),
|
_arCorrection(false),
|
||||||
|
|
||||||
|
@ -113,9 +114,6 @@ void OSystem_Wii::initBackend() {
|
||||||
initSfx();
|
initSfx();
|
||||||
initEvents();
|
initEvents();
|
||||||
|
|
||||||
ConfMan.registerDefault("fullscreen", true);
|
|
||||||
ConfMan.registerDefault("aspect_ratio", true);
|
|
||||||
|
|
||||||
OSystem::initBackend();
|
OSystem::initBackend();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,7 @@ private:
|
||||||
Graphics::PixelFormat _pfCursor;
|
Graphics::PixelFormat _pfCursor;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool _optionsDlgActive;
|
||||||
bool _fullscreen;
|
bool _fullscreen;
|
||||||
bool _arCorrection;
|
bool _arCorrection;
|
||||||
|
|
||||||
|
@ -121,6 +122,8 @@ private:
|
||||||
void updateEventScreenResolution();
|
void updateEventScreenResolution();
|
||||||
bool pollKeyboard(Common::Event &event);
|
bool pollKeyboard(Common::Event &event);
|
||||||
|
|
||||||
|
void showOptionsDialog();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Common::SaveFileManager *_savefile;
|
Common::SaveFileManager *_savefile;
|
||||||
Audio::MixerImpl *_mixer;
|
Audio::MixerImpl *_mixer;
|
||||||
|
|
|
@ -319,36 +319,19 @@ bool OSystem_Wii::pollEvent(Common::Event &event) {
|
||||||
if (bd || bu) {
|
if (bd || bu) {
|
||||||
byte flags = 0;
|
byte flags = 0;
|
||||||
|
|
||||||
// TODO: add this to an option dialog
|
if (bh & PADS_UP) {
|
||||||
if (bh & PADS_R) {
|
PAD_EVENT(PADS_START, Common::KEYCODE_F5, Common::ASCII_F5,
|
||||||
static u16 vpo_x = 0;
|
Common::KBD_CTRL);
|
||||||
static u16 vpo_y = 0;
|
flags = Common::KBD_SHIFT;
|
||||||
|
|
||||||
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) {
|
if (bd & PADS_R) {
|
||||||
PAD_EVENT(PADS_START, Common::KEYCODE_F5, Common::ASCII_F5, Common::KBD_CTRL);
|
showOptionsDialog();
|
||||||
|
return false;
|
||||||
flags = Common::KBD_SHIFT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bd & PADS_RIGHT) {
|
if (bd & PADS_RIGHT) {
|
||||||
event.type = Common::EVENT_PREDICTIVE_DIALOG;
|
event.type = Common::EVENT_PREDICTIVE_DIALOG;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "backends/fs/wii/wii-fs-factory.h"
|
#include "backends/fs/wii/wii-fs-factory.h"
|
||||||
|
|
||||||
#include "osystem.h"
|
#include "osystem.h"
|
||||||
|
#include "options.h"
|
||||||
#include "gfx.h"
|
#include "gfx.h"
|
||||||
|
|
||||||
#define ROUNDUP(x,n) (-(-(x) & -(n)))
|
#define ROUNDUP(x,n) (-(-(x) & -(n)))
|
||||||
|
@ -33,7 +34,7 @@
|
||||||
#define TLUT_GAME GX_TLUT0
|
#define TLUT_GAME GX_TLUT0
|
||||||
#define TLUT_MOUSE GX_TLUT1
|
#define TLUT_MOUSE GX_TLUT1
|
||||||
|
|
||||||
static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
|
static const OSystem::GraphicsMode _supportedGraphicsModes[] = {
|
||||||
{ "standard", "Standard", GFX_SETUP_STANDARD },
|
{ "standard", "Standard", GFX_SETUP_STANDARD },
|
||||||
{ "standardaa", "Standard antialiased", GFX_SETUP_STANDARD_AA },
|
{ "standardaa", "Standard antialiased", GFX_SETUP_STANDARD_AA },
|
||||||
{ "ds", "Double-strike", GFX_SETUP_DS },
|
{ "ds", "Double-strike", GFX_SETUP_DS },
|
||||||
|
@ -42,8 +43,24 @@ static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
void OSystem_Wii::initGfx() {
|
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_video_init(GFX_MODE_AUTO, GFX_SETUP_STANDARD);
|
||||||
gfx_init();
|
gfx_init();
|
||||||
|
gfx_set_underscan(ConfMan.getInt("wii_video_standard_underscan_x"),
|
||||||
|
ConfMan.getInt("wii_video_standard_underscan_y"));
|
||||||
|
|
||||||
_overlayWidth = gfx_video_get_width();
|
_overlayWidth = gfx_video_get_width();
|
||||||
_overlayHeight = gfx_video_get_height();
|
_overlayHeight = gfx_video_get_height();
|
||||||
|
@ -134,6 +151,13 @@ void OSystem_Wii::switchVideoMode(int mode) {
|
||||||
gfx_video_init(GFX_MODE_AUTO, setup);
|
gfx_video_init(GFX_MODE_AUTO, setup);
|
||||||
gfx_init();
|
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;
|
_actualGraphicsMode = mode;
|
||||||
|
|
||||||
gfx_coords(&_coordsOverlay, &_texOverlay, GFX_COORD_FULLSCREEN);
|
gfx_coords(&_coordsOverlay, &_texOverlay, GFX_COORD_FULLSCREEN);
|
||||||
|
@ -142,7 +166,7 @@ void OSystem_Wii::switchVideoMode(int mode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const OSystem::GraphicsMode* OSystem_Wii::getSupportedGraphicsModes() const {
|
const OSystem::GraphicsMode* OSystem_Wii::getSupportedGraphicsModes() const {
|
||||||
return s_supportedGraphicsModes;
|
return _supportedGraphicsModes;
|
||||||
}
|
}
|
||||||
|
|
||||||
int OSystem_Wii::getDefaultGraphicsMode() const {
|
int OSystem_Wii::getDefaultGraphicsMode() const {
|
||||||
|
@ -659,3 +683,14 @@ void OSystem_Wii::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX,
|
||||||
_cursorPaletteDirty = true;
|
_cursorPaletteDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OSystem_Wii::showOptionsDialog() {
|
||||||
|
if (_optionsDlgActive)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_optionsDlgActive = true;
|
||||||
|
WiiOptionsDialog dlg(_supportedGraphicsModes[_actualGraphicsMode]);
|
||||||
|
dlg.runModal();
|
||||||
|
_optionsDlgActive = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue