mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-01 08:23:15 +00:00
added samsung tv backend
svn-id: r45775
This commit is contained in:
parent
005624a2a6
commit
9290966e27
358
backends/platform/samsungtv/events.cpp
Normal file
358
backends/platform/samsungtv/events.cpp
Normal file
@ -0,0 +1,358 @@
|
||||
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/sdl/events.cpp $
|
||||
* $Id: events.cpp 43636 2009-08-22 12:35:49Z sev $
|
||||
*
|
||||
*/
|
||||
|
||||
#include "backends/platform/samsungtv/sdl.h"
|
||||
#include "common/util.h"
|
||||
#include "common/events.h"
|
||||
|
||||
#if defined(SAMSUNGTV)
|
||||
|
||||
static int mapKey(SDLKey key, SDLMod mod, Uint16 unicode) {
|
||||
if (key >= SDLK_F1 && key <= SDLK_F9) {
|
||||
return key - SDLK_F1 + Common::ASCII_F1;
|
||||
} else if (key >= SDLK_KP0 && key <= SDLK_KP9) {
|
||||
return key - SDLK_KP0 + '0';
|
||||
} else if (key >= SDLK_UP && key <= SDLK_PAGEDOWN) {
|
||||
return key;
|
||||
} else if (unicode) {
|
||||
return unicode;
|
||||
} else if (key >= 'a' && key <= 'z' && (mod & KMOD_SHIFT)) {
|
||||
return key & ~0x20;
|
||||
} else if (key >= SDLK_NUMLOCK && key <= SDLK_EURO) {
|
||||
return 0;
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
void OSystem_SDL_SamsungTV::fillMouseEvent(Common::Event &event, int x, int y) {
|
||||
event.mouse.x = x;
|
||||
event.mouse.y = y;
|
||||
|
||||
// Update the "keyboard mouse" coords
|
||||
_km.x = x;
|
||||
_km.y = y;
|
||||
|
||||
// Adjust for the screen scaling
|
||||
if (!_overlayVisible) {
|
||||
event.mouse.x /= _videoMode.scaleFactor;
|
||||
event.mouse.y /= _videoMode.scaleFactor;
|
||||
if (_videoMode.aspectRatioCorrection)
|
||||
event.mouse.y = aspect2Real(event.mouse.y);
|
||||
}
|
||||
}
|
||||
|
||||
void OSystem_SDL_SamsungTV::handleKbdMouse() {
|
||||
uint32 curTime = getMillis();
|
||||
if (curTime >= _km.last_time + _km.delay_time) {
|
||||
_km.last_time = curTime;
|
||||
if (_km.x_down_count == 1) {
|
||||
_km.x_down_time = curTime;
|
||||
_km.x_down_count = 2;
|
||||
}
|
||||
if (_km.y_down_count == 1) {
|
||||
_km.y_down_time = curTime;
|
||||
_km.y_down_count = 2;
|
||||
}
|
||||
|
||||
if (_km.x_vel || _km.y_vel) {
|
||||
if (_km.x_down_count) {
|
||||
if (curTime > _km.x_down_time + _km.delay_time * 12) {
|
||||
if (_km.x_vel > 0)
|
||||
_km.x_vel++;
|
||||
else
|
||||
_km.x_vel--;
|
||||
} else if (curTime > _km.x_down_time + _km.delay_time * 8) {
|
||||
if (_km.x_vel > 0)
|
||||
_km.x_vel = 5;
|
||||
else
|
||||
_km.x_vel = -5;
|
||||
}
|
||||
}
|
||||
if (_km.y_down_count) {
|
||||
if (curTime > _km.y_down_time + _km.delay_time * 12) {
|
||||
if (_km.y_vel > 0)
|
||||
_km.y_vel++;
|
||||
else
|
||||
_km.y_vel--;
|
||||
} else if (curTime > _km.y_down_time + _km.delay_time * 8) {
|
||||
if (_km.y_vel > 0)
|
||||
_km.y_vel = 5;
|
||||
else
|
||||
_km.y_vel = -5;
|
||||
}
|
||||
}
|
||||
|
||||
_km.x += _km.x_vel;
|
||||
_km.y += _km.y_vel;
|
||||
|
||||
if (_km.x < 0) {
|
||||
_km.x = 0;
|
||||
_km.x_vel = -1;
|
||||
_km.x_down_count = 1;
|
||||
} else if (_km.x > _km.x_max) {
|
||||
_km.x = _km.x_max;
|
||||
_km.x_vel = 1;
|
||||
_km.x_down_count = 1;
|
||||
}
|
||||
|
||||
if (_km.y < 0) {
|
||||
_km.y = 0;
|
||||
_km.y_vel = -1;
|
||||
_km.y_down_count = 1;
|
||||
} else if (_km.y > _km.y_max) {
|
||||
_km.y = _km.y_max;
|
||||
_km.y_vel = 1;
|
||||
_km.y_down_count = 1;
|
||||
}
|
||||
|
||||
setMousePos(_km.x, _km.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static byte SDLModToOSystemKeyFlags(SDLMod mod) {
|
||||
byte b = 0;
|
||||
|
||||
if (mod & KMOD_SHIFT)
|
||||
b |= Common::KBD_SHIFT;
|
||||
if (mod & KMOD_ALT)
|
||||
b |= Common::KBD_ALT;
|
||||
if (mod & KMOD_CTRL)
|
||||
b |= Common::KBD_CTRL;
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
bool OSystem_SDL_SamsungTV::pollEvent(Common::Event &event) {
|
||||
SDL_Event ev;
|
||||
byte b = 0;
|
||||
|
||||
handleKbdMouse();
|
||||
|
||||
// If the screen mode changed, send an Common::EVENT_SCREEN_CHANGED
|
||||
if (_modeChanged) {
|
||||
_modeChanged = false;
|
||||
event.type = Common::EVENT_SCREEN_CHANGED;
|
||||
return true;
|
||||
}
|
||||
|
||||
while (SDL_PollEvent(&ev)) {
|
||||
preprocessEvents(&ev);
|
||||
|
||||
switch (ev.type) {
|
||||
case SDL_KEYDOWN:{
|
||||
if (ev.key.keysym.sym == SDLK_UP) {
|
||||
_km.y_vel = -1;
|
||||
_km.y_down_count = 1;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
return true;
|
||||
} else if (ev.key.keysym.sym == SDLK_DOWN) {
|
||||
_km.y_vel = 1;
|
||||
_km.y_down_count = 1;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
return true;
|
||||
} else if (ev.key.keysym.sym == SDLK_LEFT) {
|
||||
_km.x_vel = -1;
|
||||
_km.x_down_count = 1;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
return true;
|
||||
} else if (ev.key.keysym.sym == SDLK_RIGHT) {
|
||||
_km.x_vel = 1;
|
||||
_km.x_down_count = 1;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
return true;
|
||||
} else if (ev.key.keysym.sym == SDLK_z) {
|
||||
event.type = Common::EVENT_LBUTTONDOWN;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
return true;
|
||||
} else if (ev.key.keysym.sym == SDLK_HOME) {
|
||||
event.type = Common::EVENT_RBUTTONDOWN;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
return true;
|
||||
} else if (ev.key.keysym.sym == SDLK_F4) {
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = Common::KEYCODE_SPACE;
|
||||
event.kbd.ascii = ' ';
|
||||
return true;
|
||||
}
|
||||
|
||||
b = event.kbd.flags = SDLModToOSystemKeyFlags(SDL_GetModState());
|
||||
|
||||
// Alt-S: Create a screenshot
|
||||
if (b == Common::KBD_ALT && ev.key.keysym.sym == 's') {
|
||||
char filename[20];
|
||||
|
||||
for (int n = 0;; n++) {
|
||||
SDL_RWops *file;
|
||||
|
||||
sprintf(filename, "scummvm%05d.bmp", n);
|
||||
file = SDL_RWFromFile(filename, "r");
|
||||
if (!file)
|
||||
break;
|
||||
SDL_RWclose(file);
|
||||
}
|
||||
if (saveScreenshot(filename))
|
||||
printf("Saved '%s'\n", filename);
|
||||
else
|
||||
printf("Could not save screenshot!\n");
|
||||
break;
|
||||
}
|
||||
|
||||
// On other unices, Control-Q quits
|
||||
if ((ev.key.keysym.mod & KMOD_CTRL) && ev.key.keysym.sym == 'q') {
|
||||
event.type = Common::EVENT_QUIT;
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((ev.key.keysym.mod & KMOD_CTRL) && ev.key.keysym.sym == 'u') {
|
||||
event.type = Common::EVENT_MUTE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Ctrl-Alt-<key> will change the GFX mode
|
||||
if ((b & (Common::KBD_CTRL|Common::KBD_ALT)) == (Common::KBD_CTRL|Common::KBD_ALT)) {
|
||||
|
||||
handleScalerHotkeys(ev.key);
|
||||
break;
|
||||
}
|
||||
const bool event_complete = remapKey(ev, event);
|
||||
|
||||
if (event_complete)
|
||||
return true;
|
||||
|
||||
event.type = Common::EVENT_KEYDOWN;
|
||||
event.kbd.keycode = (Common::KeyCode)ev.key.keysym.sym;
|
||||
event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
|
||||
|
||||
return true;
|
||||
}
|
||||
case SDL_KEYUP:
|
||||
{
|
||||
if (ev.key.keysym.sym == SDLK_UP || ev.key.keysym.sym == SDLK_DOWN || ev.key.keysym.sym == SDLK_LEFT || ev.key.keysym.sym == SDLK_RIGHT) {
|
||||
_km.x_vel = 0;
|
||||
_km.x_down_count = 0;
|
||||
_km.y_vel = 0;
|
||||
_km.y_down_count = 0;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
return true;
|
||||
} else if (ev.key.keysym.sym == SDLK_z) {
|
||||
event.type = Common::EVENT_LBUTTONUP;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
return true;
|
||||
} else if (ev.key.keysym.sym == SDLK_HOME) {
|
||||
event.type = Common::EVENT_RBUTTONUP;
|
||||
fillMouseEvent(event, _km.x, _km.y);
|
||||
return true;
|
||||
} else if (ev.key.keysym.sym == SDLK_F4) {
|
||||
event.type = Common::EVENT_KEYUP;
|
||||
event.kbd.keycode = Common::KEYCODE_SPACE;
|
||||
event.kbd.ascii = ' ';
|
||||
return true;
|
||||
}
|
||||
|
||||
const bool event_complete = remapKey(ev,event);
|
||||
|
||||
if (event_complete)
|
||||
return true;
|
||||
|
||||
event.type = Common::EVENT_KEYUP;
|
||||
event.kbd.keycode = (Common::KeyCode)ev.key.keysym.sym;
|
||||
event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
|
||||
b = event.kbd.flags = SDLModToOSystemKeyFlags(SDL_GetModState());
|
||||
|
||||
// Ctrl-Alt-<key> will change the GFX mode
|
||||
if ((b & (Common::KBD_CTRL|Common::KBD_ALT)) == (Common::KBD_CTRL|Common::KBD_ALT)) {
|
||||
// Swallow these key up events
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
case SDL_MOUSEMOTION:
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
fillMouseEvent(event, ev.motion.x, ev.motion.y);
|
||||
|
||||
setMousePos(event.mouse.x, event.mouse.y);
|
||||
return true;
|
||||
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
if (ev.button.button == SDL_BUTTON_LEFT)
|
||||
event.type = Common::EVENT_LBUTTONDOWN;
|
||||
else if (ev.button.button == SDL_BUTTON_RIGHT)
|
||||
event.type = Common::EVENT_RBUTTONDOWN;
|
||||
#if defined(SDL_BUTTON_WHEELUP) && defined(SDL_BUTTON_WHEELDOWN)
|
||||
else if (ev.button.button == SDL_BUTTON_WHEELUP)
|
||||
event.type = Common::EVENT_WHEELUP;
|
||||
else if (ev.button.button == SDL_BUTTON_WHEELDOWN)
|
||||
event.type = Common::EVENT_WHEELDOWN;
|
||||
#endif
|
||||
#if defined(SDL_BUTTON_MIDDLE)
|
||||
else if (ev.button.button == SDL_BUTTON_MIDDLE)
|
||||
event.type = Common::EVENT_MBUTTONDOWN;
|
||||
#endif
|
||||
else
|
||||
break;
|
||||
|
||||
fillMouseEvent(event, ev.button.x, ev.button.y);
|
||||
|
||||
return true;
|
||||
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
if (ev.button.button == SDL_BUTTON_LEFT)
|
||||
event.type = Common::EVENT_LBUTTONUP;
|
||||
else if (ev.button.button == SDL_BUTTON_RIGHT)
|
||||
event.type = Common::EVENT_RBUTTONUP;
|
||||
#if defined(SDL_BUTTON_MIDDLE)
|
||||
else if (ev.button.button == SDL_BUTTON_MIDDLE)
|
||||
event.type = Common::EVENT_MBUTTONUP;
|
||||
#endif
|
||||
else
|
||||
break;
|
||||
fillMouseEvent(event, ev.button.x, ev.button.y);
|
||||
|
||||
return true;
|
||||
|
||||
case SDL_VIDEOEXPOSE:
|
||||
_forceFull = true;
|
||||
break;
|
||||
|
||||
case SDL_QUIT:
|
||||
event.type = Common::EVENT_QUIT;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OSystem_SDL_SamsungTV::remapKey(SDL_Event &ev, Common::Event &event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
1831
backends/platform/samsungtv/graphics.cpp
Normal file
1831
backends/platform/samsungtv/graphics.cpp
Normal file
File diff suppressed because it is too large
Load Diff
237
backends/platform/samsungtv/hardwarekeys.cpp
Normal file
237
backends/platform/samsungtv/hardwarekeys.cpp
Normal file
@ -0,0 +1,237 @@
|
||||
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/sdl/hardwarekeys.cpp $
|
||||
* $Id: hardwarekeys.cpp 40516 2009-05-12 23:31:02Z fingolfin $
|
||||
*
|
||||
*/
|
||||
|
||||
#include "backends/platform/samsungtv/sdl.h"
|
||||
#include "backends/keymapper/keymapper.h"
|
||||
#include "common/keyboard.h"
|
||||
|
||||
#if defined(SAMSUNGTV)
|
||||
|
||||
#ifdef ENABLE_KEYMAPPER
|
||||
|
||||
using namespace Common;
|
||||
|
||||
struct Key {
|
||||
const char *hwId;
|
||||
KeyCode keycode;
|
||||
uint16 ascii;
|
||||
const char *desc;
|
||||
KeyType preferredAction;
|
||||
bool shiftable;
|
||||
};
|
||||
|
||||
static const Key keys[] = {
|
||||
{"BACKSPACE", KEYCODE_BACKSPACE, ASCII_BACKSPACE, "Backspace", kActionKeyType, false},
|
||||
{"TAB", KEYCODE_TAB, ASCII_TAB, "Tab", kActionKeyType, false},
|
||||
{"CLEAR", KEYCODE_CLEAR, 0, "Clear", kActionKeyType, false},
|
||||
{"RETURN", KEYCODE_RETURN, ASCII_RETURN, "Return", kActionKeyType, false},
|
||||
{"PAUSE", KEYCODE_PAUSE, 0, "Pause", kActionKeyType, false},
|
||||
{"ESCAPE", KEYCODE_ESCAPE, ASCII_ESCAPE, "Esc", kStartKeyType, false},
|
||||
{"SPACE", KEYCODE_SPACE, ASCII_SPACE, "Space", kActionKeyType, false},
|
||||
{"EXCLAIM", KEYCODE_EXCLAIM, '!', "!", kActionKeyType, false},
|
||||
{"QUOTEDBL", KEYCODE_QUOTEDBL, '"', "\"", kActionKeyType, false},
|
||||
{"HASH", KEYCODE_HASH, '#', "#", kActionKeyType, false},
|
||||
{"DOLLAR", KEYCODE_DOLLAR, '$', "$", kActionKeyType, false},
|
||||
{"AMPERSAND", KEYCODE_AMPERSAND, '&', "&", kActionKeyType, false},
|
||||
{"QUOTE", KEYCODE_QUOTE, '\'', "'", kActionKeyType, false},
|
||||
{"LEFTPAREN", KEYCODE_LEFTPAREN, '(', "(", kActionKeyType, false},
|
||||
{"RIGHTPAREN", KEYCODE_RIGHTPAREN, ')', ")", kActionKeyType, false},
|
||||
{"ASTERISK", KEYCODE_ASTERISK, '*', "*", kActionKeyType, false},
|
||||
{"PLUS", KEYCODE_PLUS, '+', "+", kActionKeyType, false},
|
||||
{"COMMA", KEYCODE_COMMA, ',', ",", kActionKeyType, false},
|
||||
{"MINUS", KEYCODE_MINUS, '-', "-", kActionKeyType, false},
|
||||
{"PERIOD", KEYCODE_PERIOD, '.', ".", kActionKeyType, false},
|
||||
{"SLASH", KEYCODE_SLASH, '/', "/", kActionKeyType, false},
|
||||
{"0", KEYCODE_0, '0', "0", kActionKeyType, false},
|
||||
{"1", KEYCODE_1, '1', "1", kActionKeyType, false},
|
||||
{"2", KEYCODE_2, '2', "2", kActionKeyType, false},
|
||||
{"3", KEYCODE_3, '3', "3", kActionKeyType, false},
|
||||
{"4", KEYCODE_4, '4', "4", kActionKeyType, false},
|
||||
{"5", KEYCODE_5, '5', "5", kActionKeyType, false},
|
||||
{"6", KEYCODE_6, '6', "6", kActionKeyType, false},
|
||||
{"7", KEYCODE_7, '7', "7", kActionKeyType, false},
|
||||
{"8", KEYCODE_8, '8', "8", kActionKeyType, false},
|
||||
{"9", KEYCODE_9, '9', "9", kActionKeyType, false},
|
||||
{"COLON", KEYCODE_COLON, ':', ":", kActionKeyType, false},
|
||||
{"SEMICOLON", KEYCODE_SEMICOLON, ';', ";", kActionKeyType, false},
|
||||
{"LESS", KEYCODE_LESS, '<', "<", kActionKeyType, false},
|
||||
{"EQUALS", KEYCODE_EQUALS, '=', "=", kActionKeyType, false},
|
||||
{"GREATER", KEYCODE_GREATER, '>', ">", kActionKeyType, false},
|
||||
{"QUESTION", KEYCODE_QUESTION, '?', "?", kActionKeyType, false},
|
||||
{"AT", KEYCODE_AT, '@', "@", kActionKeyType, false},
|
||||
|
||||
{"LEFTBRACKET", KEYCODE_LEFTBRACKET, '[', "[", kActionKeyType, false},
|
||||
{"BACKSLASH", KEYCODE_BACKSLASH, '\\', "\\", kActionKeyType, false},
|
||||
{"RIGHTBRACKET", KEYCODE_RIGHTBRACKET, ']', "]", kActionKeyType, false},
|
||||
{"CARET", KEYCODE_CARET, '^', "^", kActionKeyType, false},
|
||||
{"UNDERSCORE", KEYCODE_UNDERSCORE, '_', "_", kActionKeyType, false},
|
||||
{"BACKQUOTE", KEYCODE_BACKQUOTE, '`', "`", kActionKeyType, false},
|
||||
{"a", KEYCODE_a, 'a', "a", kActionKeyType, true},
|
||||
{"b", KEYCODE_b, 'b', "b", kActionKeyType, true},
|
||||
{"c", KEYCODE_c, 'c', "c", kActionKeyType, true},
|
||||
{"d", KEYCODE_d, 'd', "d", kActionKeyType, true},
|
||||
{"e", KEYCODE_e, 'e', "e", kActionKeyType, true},
|
||||
{"f", KEYCODE_f, 'f', "f", kActionKeyType, true},
|
||||
{"g", KEYCODE_g, 'g', "g", kActionKeyType, true},
|
||||
{"h", KEYCODE_h, 'h', "h", kActionKeyType, true},
|
||||
{"i", KEYCODE_i, 'i', "i", kActionKeyType, true},
|
||||
{"j", KEYCODE_j, 'j', "j", kActionKeyType, true},
|
||||
{"k", KEYCODE_k, 'k', "k", kActionKeyType, true},
|
||||
{"l", KEYCODE_l, 'l', "l", kActionKeyType, true},
|
||||
{"m", KEYCODE_m, 'm', "m", kActionKeyType, true},
|
||||
{"n", KEYCODE_n, 'n', "n", kActionKeyType, true},
|
||||
{"o", KEYCODE_o, 'o', "o", kActionKeyType, true},
|
||||
{"p", KEYCODE_p, 'p', "p", kActionKeyType, true},
|
||||
{"q", KEYCODE_q, 'q', "q", kActionKeyType, true},
|
||||
{"r", KEYCODE_r, 'r', "r", kActionKeyType, true},
|
||||
{"s", KEYCODE_s, 's', "s", kActionKeyType, true},
|
||||
{"t", KEYCODE_t, 't', "t", kActionKeyType, true},
|
||||
{"u", KEYCODE_u, 'u', "u", kActionKeyType, true},
|
||||
{"v", KEYCODE_v, 'v', "v", kActionKeyType, true},
|
||||
{"w", KEYCODE_w, 'w', "w", kActionKeyType, true},
|
||||
{"x", KEYCODE_x, 'x', "x", kActionKeyType, true},
|
||||
{"y", KEYCODE_y, 'y', "y", kActionKeyType, true},
|
||||
{"z", KEYCODE_z, 'z', "z", kActionKeyType, true},
|
||||
{"DELETE", KEYCODE_DELETE, 0, "Del", kActionKeyType, false},
|
||||
|
||||
// Numeric keypad
|
||||
{"KP0", KEYCODE_KP0, 0, "KP0", kActionKeyType, false},
|
||||
{"KP1", KEYCODE_KP1, 0, "KP1", kActionKeyType, false},
|
||||
{"KP2", KEYCODE_KP2, 0, "KP2", kActionKeyType, false},
|
||||
{"KP3", KEYCODE_KP3, 0, "KP3", kActionKeyType, false},
|
||||
{"KP4", KEYCODE_KP4, 0, "KP4", kActionKeyType, false},
|
||||
{"KP5", KEYCODE_KP5, 0, "KP5", kActionKeyType, false},
|
||||
{"KP6", KEYCODE_KP6, 0, "KP6", kActionKeyType, false},
|
||||
{"KP7", KEYCODE_KP7, 0, "KP7", kActionKeyType, false},
|
||||
{"KP8", KEYCODE_KP8, 0, "KP8", kActionKeyType, false},
|
||||
{"KP9", KEYCODE_KP9, 0, "KP9", kActionKeyType, false},
|
||||
{"KP_PERIOD", KEYCODE_KP_PERIOD, 0, "KP.", kActionKeyType, false},
|
||||
{"KP_DIVIDE", KEYCODE_KP_DIVIDE, 0, "KP/", kActionKeyType, false},
|
||||
{"KP_MULTIPLY", KEYCODE_KP_MULTIPLY, 0, "KP*", kActionKeyType, false},
|
||||
{"KP_MINUS", KEYCODE_KP_MINUS, 0, "KP-", kActionKeyType, false},
|
||||
{"KP_PLUS", KEYCODE_KP_PLUS, 0, "KP+", kActionKeyType, false},
|
||||
{"KP_ENTER", KEYCODE_KP_ENTER, 0, "KP Enter", kActionKeyType, false},
|
||||
{"KP_EQUALS", KEYCODE_KP_EQUALS, 0, "KP=", kActionKeyType, false},
|
||||
|
||||
// Arrows + Home/End pad
|
||||
{"UP", KEYCODE_UP, 0, "Up", kDirUpKeyType, false},
|
||||
{"DOWN", KEYCODE_DOWN, 0, "Down", kDirDownKeyType, false},
|
||||
{"RIGHT", KEYCODE_RIGHT, 0, "Right", kDirRightKeyType, false},
|
||||
{"LEFT", KEYCODE_LEFT, 0, "Left", kDirLeftKeyType, false},
|
||||
{"INSERT", KEYCODE_INSERT, 0, "Insert", kActionKeyType, false},
|
||||
{"HOME", KEYCODE_HOME, 0, "Home", kActionKeyType, false},
|
||||
{"END", KEYCODE_END, 0, "End", kActionKeyType, false},
|
||||
{"PAGEUP", KEYCODE_PAGEUP, 0, "PgUp", kActionKeyType, false},
|
||||
{"PAGEDOWN", KEYCODE_PAGEDOWN, 0, "PgDn", kActionKeyType, false},
|
||||
|
||||
// Function keys
|
||||
{"F1", KEYCODE_F1, ASCII_F1, "F1", kActionKeyType, false},
|
||||
{"F2", KEYCODE_F2, ASCII_F2, "F2", kActionKeyType, false},
|
||||
{"F3", KEYCODE_F3, ASCII_F3, "F3", kActionKeyType, false},
|
||||
{"F4", KEYCODE_F4, ASCII_F4, "F4", kActionKeyType, false},
|
||||
{"F5", KEYCODE_F5, ASCII_F5, "F5", kActionKeyType, false},
|
||||
{"F6", KEYCODE_F6, ASCII_F6, "F6", kActionKeyType, false},
|
||||
{"F7", KEYCODE_F7, ASCII_F7, "F7", kActionKeyType, false},
|
||||
{"F8", KEYCODE_F8, ASCII_F8, "F8", kActionKeyType, false},
|
||||
{"F9", KEYCODE_F9, ASCII_F9, "F9", kActionKeyType, false},
|
||||
{"F10", KEYCODE_F10, ASCII_F10, "F10", kActionKeyType, false},
|
||||
{"F11", KEYCODE_F11, ASCII_F11, "F11", kActionKeyType, false},
|
||||
{"F12", KEYCODE_F12, ASCII_F12, "F12", kActionKeyType, false},
|
||||
{"F13", KEYCODE_F13, 0, "F13", kActionKeyType, false},
|
||||
{"F14", KEYCODE_F14, 0, "F14", kActionKeyType, false},
|
||||
{"F15", KEYCODE_F15, 0, "F15", kActionKeyType, false},
|
||||
|
||||
// Miscellaneous function keys
|
||||
{"HELP", KEYCODE_HELP, 0, "Help", kActionKeyType, false},
|
||||
{"PRINT", KEYCODE_PRINT, 0, "Print", kActionKeyType, false},
|
||||
{"SYSREQ", KEYCODE_SYSREQ, 0, "SysRq", kActionKeyType, false},
|
||||
{"BREAK", KEYCODE_BREAK, 0, "Break", kActionKeyType, false},
|
||||
{"MENU", KEYCODE_MENU, 0, "Menu", kActionKeyType, false},
|
||||
// Power Macintosh power key
|
||||
{"POWER", KEYCODE_POWER, 0, "Power", kActionKeyType, false},
|
||||
// Some european keyboards
|
||||
{"EURO", KEYCODE_EURO, 0, "Euro", kActionKeyType, false},
|
||||
// Atari keyboard has Undo
|
||||
{"UNDO", KEYCODE_UNDO, 0, "Undo", kActionKeyType, false},
|
||||
{0, KEYCODE_INVALID, 0, 0, kGenericKeyType, false}
|
||||
};
|
||||
|
||||
struct Mod {
|
||||
byte flag;
|
||||
const char *id;
|
||||
const char *desc;
|
||||
bool shiftable;
|
||||
};
|
||||
|
||||
static const Mod modifiers[] = {
|
||||
{ 0, "", "", false },
|
||||
{ KBD_CTRL, "C+", "Ctrl+", false },
|
||||
{ KBD_ALT, "A+", "Alt+", false },
|
||||
{ KBD_SHIFT, "", "", true },
|
||||
{ KBD_CTRL | KBD_ALT, "C+A+", "Ctrl+Alt+", false },
|
||||
{ KBD_SHIFT | KBD_CTRL, "S+C+", "Shift+Ctrl+", true },
|
||||
{ KBD_SHIFT | KBD_CTRL | KBD_ALT, "C+A+", "Ctrl+Alt+", true },
|
||||
{ 0, 0, 0, false }
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
Common::HardwareKeySet *OSystem_SDL_SamsungTV::getHardwareKeySet() {
|
||||
#ifdef ENABLE_KEYMAPPER
|
||||
HardwareKeySet *keySet = new HardwareKeySet();
|
||||
const Key *key;
|
||||
const Mod *mod;
|
||||
char fullKeyId[50];
|
||||
char fullKeyDesc[100];
|
||||
uint16 ascii;
|
||||
|
||||
for (mod = modifiers; mod->id; mod++) {
|
||||
for (key = keys; key->hwId; key++) {
|
||||
ascii = key->ascii;
|
||||
|
||||
if (mod->shiftable && key->shiftable) {
|
||||
snprintf(fullKeyId, 50, "%s%c", mod->id, toupper(key->hwId[0]));
|
||||
snprintf(fullKeyDesc, 100, "%s%c", mod->desc, toupper(key->desc[0]));
|
||||
ascii = toupper(key->ascii);
|
||||
} else if (mod->shiftable) {
|
||||
snprintf(fullKeyId, 50, "S+%s%s", mod->id, key->hwId);
|
||||
snprintf(fullKeyDesc, 100, "Shift+%s%s", mod->desc, key->desc);
|
||||
} else {
|
||||
snprintf(fullKeyId, 50, "%s%s", mod->id, key->hwId);
|
||||
snprintf(fullKeyDesc, 100, "%s%s", mod->desc, key->desc);
|
||||
}
|
||||
|
||||
keySet->addHardwareKey(new HardwareKey(fullKeyId, KeyState(key->keycode, ascii, mod->flag), fullKeyDesc, key->preferredAction ));
|
||||
}
|
||||
}
|
||||
|
||||
return keySet;
|
||||
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
91
backends/platform/samsungtv/main.cpp
Normal file
91
backends/platform/samsungtv/main.cpp
Normal file
@ -0,0 +1,91 @@
|
||||
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/sdl/main.cpp $
|
||||
* $Id: main.cpp 43636 2009-08-22 12:35:49Z sev $
|
||||
*
|
||||
*/
|
||||
|
||||
#include "backends/platform/samsungtv/sdl.h"
|
||||
#include "backends/plugins/sdl/sdl-provider.h"
|
||||
#include "base/main.h"
|
||||
|
||||
#if defined(SAMSUNGTV)
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
extern "C" int Game_Main(char *path, char *) {
|
||||
chdir(path);
|
||||
|
||||
//
|
||||
// Set up redirects for stdout/stderr under Windows and Symbian.
|
||||
// Code copied from SDL_main.
|
||||
//
|
||||
/*
|
||||
// Symbian does not like any output to the console through any *print* function
|
||||
char STDOUT_FILE[256], STDERR_FILE[256]; // shhh, don't tell anybody :)
|
||||
strcpy(STDOUT_FILE, "/dtv/usb/sda1/");
|
||||
strcpy(STDERR_FILE, "/dtv/usb/sda1/");
|
||||
strcat(STDOUT_FILE, "scummvm.stdout.txt");
|
||||
strcat(STDERR_FILE, "scummvm.stderr.txt");
|
||||
*/
|
||||
/* Flush the output in case anything is queued */
|
||||
/* fclose(stdout);
|
||||
fclose(stderr);
|
||||
*/
|
||||
/* Redirect standard input and standard output */
|
||||
// FILE *newfp = freopen(STDOUT_FILE, "w", stdout);
|
||||
// if (newfp == NULL) { /* This happens on NT */
|
||||
/*#if !defined(stdout)
|
||||
stdout = fopen(STDOUT_FILE, "w");
|
||||
#else
|
||||
newfp = fopen(STDOUT_FILE, "w");
|
||||
if (newfp) {
|
||||
*stdout = *newfp;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
newfp = freopen(STDERR_FILE, "w", stderr);
|
||||
if (newfp == NULL) {*/ /* This happens on NT */
|
||||
/*#if !defined(stderr)
|
||||
stderr = fopen(STDERR_FILE, "w");
|
||||
#else
|
||||
newfp = fopen(STDERR_FILE, "w");
|
||||
if (newfp) {
|
||||
*stderr = *newfp;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
setbuf(stderr, NULL);*/ /* No buffering */
|
||||
|
||||
g_system = new OSystem_SDL_SamsungTV();
|
||||
assert(g_system);
|
||||
|
||||
#ifdef DYNAMIC_MODULES
|
||||
PluginManager::instance().addPluginProvider(new SDLPluginProvider());
|
||||
#endif
|
||||
|
||||
// Invoke the actual ScummVM main entry point:
|
||||
int res = scummvm_main(0, 0);
|
||||
g_system->quit(); // TODO: Consider removing / replacing this!
|
||||
return res;
|
||||
}
|
||||
|
||||
#endif
|
14
backends/platform/samsungtv/module.mk
Normal file
14
backends/platform/samsungtv/module.mk
Normal file
@ -0,0 +1,14 @@
|
||||
MODULE := backends/platform/samsungtv
|
||||
|
||||
MODULE_OBJS := \
|
||||
events.o \
|
||||
graphics.o \
|
||||
hardwarekeys.o \
|
||||
main.o \
|
||||
sdl.o
|
||||
|
||||
MODULE_DIRS += \
|
||||
backends/platform/samsungtv/
|
||||
|
||||
# We don't use the rules.mk here on purpose
|
||||
OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS)
|
427
backends/platform/samsungtv/sdl.cpp
Normal file
427
backends/platform/samsungtv/sdl.cpp
Normal file
@ -0,0 +1,427 @@
|
||||
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/sdl/sdl.cpp $
|
||||
* $Id: sdl.cpp 44793 2009-10-08 19:41:38Z fingolfin $
|
||||
*
|
||||
*/
|
||||
|
||||
#include "backends/platform/samsungtv/sdl.h"
|
||||
#include "common/archive.h"
|
||||
#include "common/config-manager.h"
|
||||
#include "common/debug.h"
|
||||
#include "common/EventRecorder.h"
|
||||
#include "common/util.h"
|
||||
|
||||
#include "backends/saves/posix/posix-saves.h"
|
||||
#include "backends/timer/default/default-timer.h"
|
||||
#include "sound/mixer_intern.h"
|
||||
|
||||
#include <time.h> // for getTimeAndDate()
|
||||
|
||||
#define SAMPLES_PER_SEC 22050
|
||||
|
||||
/*
|
||||
* Include header files needed for the getFilesystemFactory() method.
|
||||
*/
|
||||
#include "backends/fs/posix/posix-fs-factory.h"
|
||||
|
||||
#if defined(SAMSUNGTV)
|
||||
|
||||
#define DEFAULT_CONFIG_FILE "/dtv/usb/sda1/.scummvmrc"
|
||||
|
||||
static Uint32 timer_handler(Uint32 interval, void *param) {
|
||||
((DefaultTimerManager *)param)->handler();
|
||||
return interval;
|
||||
}
|
||||
|
||||
AspectRatio::AspectRatio(int w, int h) {
|
||||
// TODO : Validation and so on...
|
||||
// Currently, we just ensure the program don't instantiate non-supported aspect ratios
|
||||
_kw = w;
|
||||
_kh = h;
|
||||
}
|
||||
|
||||
static const size_t AR_COUNT = 4;
|
||||
static const char* desiredAspectRatioAsStrings[AR_COUNT] = { "auto", "4/3", "16/9", "16/10" };
|
||||
static const AspectRatio desiredAspectRatios[AR_COUNT] = { AspectRatio(0, 0), AspectRatio(4,3), AspectRatio(16,9), AspectRatio(16,10) };
|
||||
static AspectRatio getDesiredAspectRatio() {
|
||||
//TODO : We could parse an arbitrary string, if we code enough proper validation
|
||||
Common::String desiredAspectRatio = ConfMan.get("desired_screen_aspect_ratio");
|
||||
|
||||
for (size_t i = 0; i < AR_COUNT; i++) {
|
||||
assert(desiredAspectRatioAsStrings[i] != NULL);
|
||||
|
||||
if (!scumm_stricmp(desiredAspectRatio.c_str(), desiredAspectRatioAsStrings[i])) {
|
||||
return desiredAspectRatios[i];
|
||||
}
|
||||
}
|
||||
// TODO : Report a warning
|
||||
return AspectRatio(0, 0);
|
||||
}
|
||||
|
||||
void OSystem_SDL_SamsungTV::initBackend() {
|
||||
assert(!_inited);
|
||||
|
||||
uint32 sdlFlags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER;
|
||||
|
||||
if (ConfMan.hasKey("disable_sdl_parachute"))
|
||||
sdlFlags |= SDL_INIT_NOPARACHUTE;
|
||||
|
||||
if (SDL_Init(sdlFlags) == -1) {
|
||||
error("Could not initialize SDL: %s", SDL_GetError());
|
||||
}
|
||||
|
||||
_graphicsMutex = createMutex();
|
||||
|
||||
// Enable unicode support if possible
|
||||
SDL_EnableUNICODE(1);
|
||||
|
||||
memset(&_oldVideoMode, 0, sizeof(_oldVideoMode));
|
||||
memset(&_videoMode, 0, sizeof(_videoMode));
|
||||
memset(&_transactionDetails, 0, sizeof(_transactionDetails));
|
||||
|
||||
_cksumValid = false;
|
||||
_videoMode.mode = GFX_2XSAI;
|
||||
_videoMode.scaleFactor = 2;
|
||||
_videoMode.aspectRatioCorrection = ConfMan.getBool("aspect_ratio");
|
||||
_videoMode.desiredAspectRatio = getDesiredAspectRatio();
|
||||
_scalerProc = _2xSaI;
|
||||
_scalerType = 0;
|
||||
_modeFlags = 0;
|
||||
_videoMode.fullscreen = true;
|
||||
|
||||
|
||||
// Create the savefile manager, if none exists yet (we check for this to
|
||||
// allow subclasses to provide their own).
|
||||
if (_savefile == NULL) {
|
||||
_savefile = new POSIXSaveFileManager();
|
||||
}
|
||||
|
||||
// Create and hook up the mixer, if none exists yet (we check for this to
|
||||
// allow subclasses to provide their own).
|
||||
if (_mixer == NULL) {
|
||||
setupMixer();
|
||||
}
|
||||
|
||||
// Create and hook up the timer manager, if none exists yet (we check for
|
||||
// this to allow subclasses to provide their own).
|
||||
if (_timer == NULL) {
|
||||
// Note: We could implement a custom SDLTimerManager by using
|
||||
// SDL_AddTimer. That might yield better timer resolution, but it would
|
||||
// also change the semantics of a timer: Right now, ScummVM timers
|
||||
// *never* run in parallel, due to the way they are implemented. If we
|
||||
// switched to SDL_AddTimer, each timer might run in a separate thread.
|
||||
// However, not all our code is prepared for that, so we can't just
|
||||
// switch. Still, it's a potential future change to keep in mind.
|
||||
_timer = new DefaultTimerManager();
|
||||
_timerID = SDL_AddTimer(10, &timer_handler, _timer);
|
||||
}
|
||||
|
||||
// Invoke parent implementation of this method
|
||||
OSystem::initBackend();
|
||||
|
||||
_inited = true;
|
||||
}
|
||||
|
||||
OSystem_SDL_SamsungTV::OSystem_SDL_SamsungTV()
|
||||
:
|
||||
#ifdef USE_OSD
|
||||
_osdSurface(0), _osdAlpha(SDL_ALPHA_TRANSPARENT), _osdFadeStartTime(0),
|
||||
#endif
|
||||
_hwscreen(0), _prehwscreen(0), _screen(0), _tmpscreen(0),
|
||||
_screenFormat(Graphics::PixelFormat::createFormatCLUT8()),
|
||||
_cursorFormat(Graphics::PixelFormat::createFormatCLUT8()),
|
||||
_overlayVisible(false),
|
||||
_overlayscreen(0), _tmpscreen2(0),
|
||||
_samplesPerSec(0),
|
||||
_scalerProc(0), _modeChanged(false), _screenChangeCount(0), _dirtyChecksums(0),
|
||||
_mouseVisible(false), _mouseNeedsRedraw(false), _mouseData(0), _mouseSurface(0),
|
||||
_mouseOrigSurface(0), _cursorTargetScale(1), _cursorPaletteDisabled(true),
|
||||
_currentShakePos(0), _newShakePos(0),
|
||||
_paletteDirtyStart(0), _paletteDirtyEnd(0),
|
||||
_fsFactory(0),
|
||||
_savefile(0),
|
||||
_mixer(0),
|
||||
_timer(0),
|
||||
_screenIsLocked(false),
|
||||
_graphicsMutex(0), _transactionMode(kTransactionNone) {
|
||||
|
||||
// allocate palette storage
|
||||
_currentPalette = (SDL_Color *)calloc(sizeof(SDL_Color), 256);
|
||||
_cursorPalette = (SDL_Color *)calloc(sizeof(SDL_Color), 256);
|
||||
|
||||
_mouseBackup.x = _mouseBackup.y = _mouseBackup.w = _mouseBackup.h = 0;
|
||||
|
||||
// reset mouse state
|
||||
memset(&_km, 0, sizeof(_km));
|
||||
memset(&_mouseCurState, 0, sizeof(_mouseCurState));
|
||||
|
||||
_inited = false;
|
||||
|
||||
_fsFactory = new POSIXFilesystemFactory();
|
||||
}
|
||||
|
||||
OSystem_SDL_SamsungTV::~OSystem_SDL_SamsungTV() {
|
||||
SDL_RemoveTimer(_timerID);
|
||||
closeMixer();
|
||||
|
||||
free(_dirtyChecksums);
|
||||
free(_currentPalette);
|
||||
free(_cursorPalette);
|
||||
free(_mouseData);
|
||||
|
||||
delete _savefile;
|
||||
delete _timer;
|
||||
}
|
||||
|
||||
uint32 OSystem_SDL_SamsungTV::getMillis() {
|
||||
uint32 millis = SDL_GetTicks();
|
||||
g_eventRec.processMillis(millis);
|
||||
return millis;
|
||||
}
|
||||
|
||||
void OSystem_SDL_SamsungTV::delayMillis(uint msecs) {
|
||||
SDL_Delay(msecs);
|
||||
}
|
||||
|
||||
void OSystem_SDL_SamsungTV::getTimeAndDate(TimeDate &td) const {
|
||||
time_t curTime = time(0);
|
||||
struct tm t = *localtime(&curTime);
|
||||
td.tm_sec = t.tm_sec;
|
||||
td.tm_min = t.tm_min;
|
||||
td.tm_hour = t.tm_hour;
|
||||
td.tm_mday = t.tm_mday;
|
||||
td.tm_mon = t.tm_mon;
|
||||
td.tm_year = t.tm_year;
|
||||
}
|
||||
|
||||
Common::TimerManager *OSystem_SDL_SamsungTV::getTimerManager() {
|
||||
assert(_timer);
|
||||
return _timer;
|
||||
}
|
||||
|
||||
Common::SaveFileManager *OSystem_SDL_SamsungTV::getSavefileManager() {
|
||||
assert(_savefile);
|
||||
return _savefile;
|
||||
}
|
||||
|
||||
FilesystemFactory *OSystem_SDL_SamsungTV::getFilesystemFactory() {
|
||||
assert(_fsFactory);
|
||||
return _fsFactory;
|
||||
}
|
||||
|
||||
void OSystem_SDL_SamsungTV::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
|
||||
// Add the global DATA_PATH to the directory search list
|
||||
// FIXME: We use depth = 4 for now, to match the old code. May want to change that
|
||||
Common::FSNode dataNode(".");
|
||||
if (dataNode.exists() && dataNode.isDirectory()) {
|
||||
s.add(DATA_PATH, new Common::FSDirectory(dataNode, 4), priority);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static Common::String getDefaultConfigFileName() {
|
||||
char configFile[MAXPATHLEN];
|
||||
strcpy(configFile, DEFAULT_CONFIG_FILE);
|
||||
return configFile;
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *OSystem_SDL_SamsungTV::createConfigReadStream() {
|
||||
Common::FSNode file(getDefaultConfigFileName());
|
||||
return file.createReadStream();
|
||||
}
|
||||
|
||||
Common::WriteStream *OSystem_SDL_SamsungTV::createConfigWriteStream() {
|
||||
Common::FSNode file(getDefaultConfigFileName());
|
||||
return file.createWriteStream();
|
||||
}
|
||||
|
||||
void OSystem_SDL_SamsungTV::setWindowCaption(const char *caption) {
|
||||
}
|
||||
|
||||
bool OSystem_SDL_SamsungTV::hasFeature(Feature f) {
|
||||
return
|
||||
(f == kFeatureAutoComputeDirtyRects) ||
|
||||
(f == kFeatureCursorHasPalette);
|
||||
}
|
||||
|
||||
void OSystem_SDL_SamsungTV::setFeatureState(Feature f, bool enable) {
|
||||
switch (f) {
|
||||
case kFeatureAspectRatioCorrection:
|
||||
setAspectRatioCorrection(enable);
|
||||
break;
|
||||
case kFeatureAutoComputeDirtyRects:
|
||||
if (enable)
|
||||
_modeFlags |= DF_WANT_RECT_OPTIM;
|
||||
else
|
||||
_modeFlags &= ~DF_WANT_RECT_OPTIM;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool OSystem_SDL_SamsungTV::getFeatureState(Feature f) {
|
||||
assert (_transactionMode == kTransactionNone);
|
||||
|
||||
switch (f) {
|
||||
case kFeatureAspectRatioCorrection:
|
||||
return _videoMode.aspectRatioCorrection;
|
||||
case kFeatureAutoComputeDirtyRects:
|
||||
return _modeFlags & DF_WANT_RECT_OPTIM;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void OSystem_SDL_SamsungTV::quit() {
|
||||
unloadGFXMode();
|
||||
deleteMutex(_graphicsMutex);
|
||||
|
||||
SDL_RemoveTimer(_timerID);
|
||||
closeMixer();
|
||||
|
||||
free(_dirtyChecksums);
|
||||
free(_currentPalette);
|
||||
free(_cursorPalette);
|
||||
free(_mouseData);
|
||||
|
||||
delete _timer;
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
// Even Manager requires save manager for storing
|
||||
// recorded events
|
||||
delete getEventManager();
|
||||
delete _savefile;
|
||||
}
|
||||
|
||||
void OSystem_SDL_SamsungTV::setupIcon() {
|
||||
}
|
||||
|
||||
OSystem::MutexRef OSystem_SDL_SamsungTV::createMutex(void) {
|
||||
return (MutexRef)SDL_CreateMutex();
|
||||
}
|
||||
|
||||
void OSystem_SDL_SamsungTV::lockMutex(MutexRef mutex) {
|
||||
SDL_mutexP((SDL_mutex *) mutex);
|
||||
}
|
||||
|
||||
void OSystem_SDL_SamsungTV::unlockMutex(MutexRef mutex) {
|
||||
SDL_mutexV((SDL_mutex *) mutex);
|
||||
}
|
||||
|
||||
void OSystem_SDL_SamsungTV::deleteMutex(MutexRef mutex) {
|
||||
SDL_DestroyMutex((SDL_mutex *) mutex);
|
||||
}
|
||||
|
||||
void OSystem_SDL_SamsungTV::mixCallback(void *sys, byte *samples, int len) {
|
||||
OSystem_SDL_SamsungTV *this_ = (OSystem_SDL_SamsungTV *)sys;
|
||||
assert(this_);
|
||||
assert(this_->_mixer);
|
||||
|
||||
this_->_mixer->mixCallback(samples, len);
|
||||
}
|
||||
|
||||
void OSystem_SDL_SamsungTV::setupMixer() {
|
||||
SDL_AudioSpec desired;
|
||||
|
||||
// Determine the desired output sampling frequency.
|
||||
_samplesPerSec = 0;
|
||||
if (ConfMan.hasKey("output_rate"))
|
||||
_samplesPerSec = ConfMan.getInt("output_rate");
|
||||
if (_samplesPerSec <= 0)
|
||||
_samplesPerSec = SAMPLES_PER_SEC;
|
||||
|
||||
// Determine the sample buffer size. We want it to store enough data for
|
||||
// about 1/16th of a second. Note that it must be a power of two.
|
||||
// So e.g. at 22050 Hz, we request a sample buffer size of 2048.
|
||||
int samples = 8192;
|
||||
while (16 * samples >= _samplesPerSec) {
|
||||
samples >>= 1;
|
||||
}
|
||||
|
||||
memset(&desired, 0, sizeof(desired));
|
||||
desired.freq = _samplesPerSec;
|
||||
desired.format = AUDIO_S16SYS;
|
||||
desired.channels = 2;
|
||||
desired.samples = (uint16)samples;
|
||||
desired.callback = mixCallback;
|
||||
desired.userdata = this;
|
||||
|
||||
// Create the mixer instance
|
||||
assert(!_mixer);
|
||||
_mixer = new Audio::MixerImpl(this);
|
||||
assert(_mixer);
|
||||
|
||||
if (SDL_OpenAudio(&desired, &_obtainedRate) != 0) {
|
||||
warning("Could not open audio device: %s", SDL_GetError());
|
||||
_samplesPerSec = 0;
|
||||
_mixer->setReady(false);
|
||||
} else {
|
||||
// Note: This should be the obtained output rate, but it seems that at
|
||||
// least on some platforms SDL will lie and claim it did get the rate
|
||||
// even if it didn't. Probably only happens for "weird" rates, though.
|
||||
_samplesPerSec = _obtainedRate.freq;
|
||||
debug(1, "Output sample rate: %d Hz", _samplesPerSec);
|
||||
|
||||
// Tell the mixer that we are ready and start the sound processing
|
||||
_mixer->setOutputRate(_samplesPerSec);
|
||||
_mixer->setReady(true);
|
||||
|
||||
// start the sound system
|
||||
SDL_PauseAudio(0);
|
||||
}
|
||||
}
|
||||
|
||||
void OSystem_SDL_SamsungTV::closeMixer() {
|
||||
if (_mixer)
|
||||
_mixer->setReady(false);
|
||||
|
||||
SDL_CloseAudio();
|
||||
|
||||
delete _mixer;
|
||||
_mixer = 0;
|
||||
}
|
||||
|
||||
Audio::Mixer *OSystem_SDL_SamsungTV::getMixer() {
|
||||
assert(_mixer);
|
||||
return _mixer;
|
||||
}
|
||||
|
||||
bool OSystem_SDL_SamsungTV::openCD(int drive) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void OSystem_SDL_SamsungTV::stopCD() {
|
||||
}
|
||||
|
||||
void OSystem_SDL_SamsungTV::playCD(int track, int num_loops, int start_frame, int duration) {
|
||||
}
|
||||
|
||||
bool OSystem_SDL_SamsungTV::pollCD() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void OSystem_SDL_SamsungTV::updateCD() {
|
||||
}
|
||||
|
||||
#endif
|
436
backends/platform/samsungtv/sdl.h
Normal file
436
backends/platform/samsungtv/sdl.h
Normal file
@ -0,0 +1,436 @@
|
||||
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/sdl/sdl.h $
|
||||
* $Id: sdl.h 44793 2009-10-08 19:41:38Z fingolfin $
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SDL_COMMON_H
|
||||
#define SDL_SAMSUNGTV_COMMON_H
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
#include "backends/base-backend.h"
|
||||
#include "graphics/scaler.h"
|
||||
|
||||
#if defined(SAMSUNGTV)
|
||||
|
||||
namespace Audio {
|
||||
class MixerImpl;
|
||||
}
|
||||
|
||||
#define USE_OSD 1
|
||||
|
||||
enum {
|
||||
GFX_NORMAL = 0,
|
||||
GFX_DOUBLESIZE = 1,
|
||||
GFX_TRIPLESIZE = 2,
|
||||
GFX_2XSAI = 3,
|
||||
GFX_SUPER2XSAI = 4,
|
||||
GFX_SUPEREAGLE = 5,
|
||||
GFX_ADVMAME2X = 6,
|
||||
GFX_ADVMAME3X = 7,
|
||||
GFX_HQ2X = 8,
|
||||
GFX_HQ3X = 9,
|
||||
GFX_TV2X = 10,
|
||||
GFX_DOTMATRIX = 11
|
||||
};
|
||||
|
||||
class AspectRatio {
|
||||
int _kw, _kh;
|
||||
public:
|
||||
AspectRatio() { _kw = _kh = 0; }
|
||||
AspectRatio(int w, int h);
|
||||
|
||||
bool isAuto() const { return (_kw | _kh) == 0; }
|
||||
|
||||
int kw() const { return _kw; }
|
||||
int kh() const { return _kh; }
|
||||
};
|
||||
|
||||
|
||||
class OSystem_SDL_SamsungTV : public BaseBackend {
|
||||
public:
|
||||
OSystem_SDL_SamsungTV();
|
||||
virtual ~OSystem_SDL_SamsungTV();
|
||||
|
||||
virtual void initBackend();
|
||||
|
||||
void beginGFXTransaction();
|
||||
TransactionError endGFXTransaction();
|
||||
|
||||
#ifdef USE_RGB_COLOR
|
||||
// Game screen
|
||||
virtual Graphics::PixelFormat getScreenFormat() const { return _screenFormat; }
|
||||
|
||||
// Highest supported
|
||||
virtual Common::List<Graphics::PixelFormat> getSupportedFormats();
|
||||
#endif
|
||||
|
||||
// Set the size and format of the video bitmap.
|
||||
// Typically, 320x200 CLUT8
|
||||
virtual void initSize(uint w, uint h, const Graphics::PixelFormat *format); // overloaded by CE backend
|
||||
|
||||
virtual int getScreenChangeID() const { return _screenChangeCount; }
|
||||
|
||||
// Set colors of the palette
|
||||
void setPalette(const byte *colors, uint start, uint num);
|
||||
|
||||
// Get colors of the palette
|
||||
void grabPalette(byte *colors, uint start, uint num);
|
||||
|
||||
// Draw a bitmap to screen.
|
||||
// The screen will not be updated to reflect the new bitmap
|
||||
virtual void copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h); // overloaded by CE backend (FIXME)
|
||||
|
||||
virtual Graphics::Surface *lockScreen();
|
||||
virtual void unlockScreen();
|
||||
|
||||
// Update the dirty areas of the screen
|
||||
void updateScreen();
|
||||
|
||||
// Either show or hide the mouse cursor
|
||||
bool showMouse(bool visible);
|
||||
|
||||
// Warp the mouse cursor. Where set_mouse_pos() only informs the
|
||||
// backend of the mouse cursor's current position, this function
|
||||
// actually moves the cursor to the specified position.
|
||||
virtual void warpMouse(int x, int y); // overloaded by CE backend (FIXME)
|
||||
|
||||
// Set the bitmap that's used when drawing the cursor.
|
||||
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format); // overloaded by CE backend (FIXME)
|
||||
|
||||
// Set colors of cursor palette
|
||||
void setCursorPalette(const byte *colors, uint start, uint num);
|
||||
|
||||
// Disables or enables cursor palette
|
||||
void disableCursorPalette(bool disable) {
|
||||
_cursorPaletteDisabled = disable;
|
||||
blitCursor();
|
||||
}
|
||||
|
||||
// Shaking is used in SCUMM. Set current shake position.
|
||||
void setShakePos(int shake_pos);
|
||||
|
||||
// Get the number of milliseconds since the program was started.
|
||||
uint32 getMillis();
|
||||
|
||||
// Delay for a specified amount of milliseconds
|
||||
void delayMillis(uint msecs);
|
||||
|
||||
// Get the next event.
|
||||
// Returns true if an event was retrieved.
|
||||
virtual bool pollEvent(Common::Event &event); // overloaded by CE backend
|
||||
|
||||
// Define all hardware keys for keymapper
|
||||
virtual Common::HardwareKeySet *getHardwareKeySet();
|
||||
|
||||
// Set function that generates samples
|
||||
virtual void setupMixer();
|
||||
static void mixCallback(void *s, byte *samples, int len);
|
||||
|
||||
virtual void closeMixer();
|
||||
|
||||
virtual Audio::Mixer *getMixer();
|
||||
|
||||
// Poll CD status
|
||||
// Returns true if cd audio is playing
|
||||
bool pollCD();
|
||||
|
||||
// Play CD audio track
|
||||
void playCD(int track, int num_loops, int start_frame, int duration);
|
||||
|
||||
// Stop CD audio track
|
||||
void stopCD();
|
||||
|
||||
// Update CD audio status
|
||||
void updateCD();
|
||||
|
||||
// Quit
|
||||
virtual void quit(); // overloaded by CE backend
|
||||
|
||||
virtual void getTimeAndDate(TimeDate &t) const;
|
||||
virtual Common::TimerManager *getTimerManager();
|
||||
|
||||
// Mutex handling
|
||||
MutexRef createMutex();
|
||||
void lockMutex(MutexRef mutex);
|
||||
void unlockMutex(MutexRef mutex);
|
||||
void deleteMutex(MutexRef mutex);
|
||||
|
||||
// Overlay
|
||||
virtual Graphics::PixelFormat getOverlayFormat() const { return _overlayFormat; }
|
||||
|
||||
virtual void showOverlay();
|
||||
virtual void hideOverlay();
|
||||
virtual void clearOverlay();
|
||||
virtual void grabOverlay(OverlayColor *buf, int pitch);
|
||||
virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
|
||||
virtual int16 getHeight();
|
||||
virtual int16 getWidth();
|
||||
virtual int16 getOverlayHeight() { return _videoMode.overlayHeight; }
|
||||
virtual int16 getOverlayWidth() { return _videoMode.overlayWidth; }
|
||||
|
||||
virtual const GraphicsMode *getSupportedGraphicsModes() const;
|
||||
virtual int getDefaultGraphicsMode() const;
|
||||
virtual bool setGraphicsMode(int mode);
|
||||
virtual int getGraphicsMode() const;
|
||||
|
||||
virtual void setWindowCaption(const char *caption);
|
||||
virtual bool openCD(int drive);
|
||||
|
||||
virtual bool hasFeature(Feature f);
|
||||
virtual void setFeatureState(Feature f, bool enable);
|
||||
virtual bool getFeatureState(Feature f);
|
||||
virtual void preprocessEvents(SDL_Event *event) {};
|
||||
|
||||
#ifdef USE_OSD
|
||||
void displayMessageOnOSD(const char *msg);
|
||||
#endif
|
||||
|
||||
virtual Common::SaveFileManager *getSavefileManager();
|
||||
virtual FilesystemFactory *getFilesystemFactory();
|
||||
virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
|
||||
|
||||
virtual Common::SeekableReadStream *createConfigReadStream();
|
||||
virtual Common::WriteStream *createConfigWriteStream();
|
||||
|
||||
protected:
|
||||
bool _inited;
|
||||
SDL_AudioSpec _obtainedRate;
|
||||
|
||||
#ifdef USE_OSD
|
||||
SDL_Surface *_osdSurface;
|
||||
Uint8 _osdAlpha; // Transparency level of the OSD
|
||||
uint32 _osdFadeStartTime; // When to start the fade out
|
||||
enum {
|
||||
kOSDFadeOutDelay = 2 * 1000, // Delay before the OSD is faded out (in milliseconds)
|
||||
kOSDFadeOutDuration = 500, // Duration of the OSD fade out (in milliseconds)
|
||||
kOSDColorKey = 1,
|
||||
kOSDInitialAlpha = 80 // Initial alpha level, in percent
|
||||
};
|
||||
#endif
|
||||
|
||||
// hardware screen
|
||||
SDL_Surface *_hwscreen, *_prehwscreen;
|
||||
|
||||
// unseen game screen
|
||||
SDL_Surface *_screen;
|
||||
#ifdef USE_RGB_COLOR
|
||||
Graphics::PixelFormat _screenFormat;
|
||||
Graphics::PixelFormat _cursorFormat;
|
||||
#endif
|
||||
|
||||
// temporary screen (for scalers)
|
||||
SDL_Surface *_tmpscreen;
|
||||
SDL_Surface *_tmpscreen2;
|
||||
|
||||
// overlay
|
||||
SDL_Surface *_overlayscreen;
|
||||
bool _overlayVisible;
|
||||
Graphics::PixelFormat _overlayFormat;
|
||||
|
||||
// Audio
|
||||
int _samplesPerSec;
|
||||
|
||||
enum {
|
||||
DF_WANT_RECT_OPTIM = 1 << 0
|
||||
};
|
||||
|
||||
enum {
|
||||
kTransactionNone = 0,
|
||||
kTransactionActive = 1,
|
||||
kTransactionRollback = 2
|
||||
};
|
||||
|
||||
struct TransactionDetails {
|
||||
bool sizeChanged;
|
||||
bool needHotswap;
|
||||
bool needUpdatescreen;
|
||||
bool normal1xScaler;
|
||||
#ifdef USE_RGB_COLOR
|
||||
bool formatChanged;
|
||||
#endif
|
||||
};
|
||||
TransactionDetails _transactionDetails;
|
||||
|
||||
struct VideoState {
|
||||
bool setup;
|
||||
|
||||
bool fullscreen;
|
||||
bool aspectRatioCorrection;
|
||||
AspectRatio desiredAspectRatio;
|
||||
|
||||
int mode;
|
||||
int scaleFactor;
|
||||
|
||||
int screenWidth, screenHeight;
|
||||
int overlayWidth, overlayHeight;
|
||||
int hardwareWidth, hardwareHeight;
|
||||
#ifdef USE_RGB_COLOR
|
||||
Graphics::PixelFormat format;
|
||||
#endif
|
||||
};
|
||||
VideoState _videoMode, _oldVideoMode;
|
||||
|
||||
virtual void setGraphicsModeIntern(); // overloaded by CE backend
|
||||
|
||||
/** Force full redraw on next updateScreen */
|
||||
bool _forceFull;
|
||||
ScalerProc *_scalerProc;
|
||||
int _scalerType;
|
||||
int _transactionMode;
|
||||
|
||||
bool _screenIsLocked;
|
||||
Graphics::Surface _framebuffer;
|
||||
|
||||
/** Current video mode flags (see DF_* constants) */
|
||||
uint32 _modeFlags;
|
||||
bool _modeChanged;
|
||||
int _screenChangeCount;
|
||||
|
||||
enum {
|
||||
NUM_DIRTY_RECT = 100,
|
||||
MAX_SCALING = 3
|
||||
};
|
||||
|
||||
// Dirty rect management
|
||||
SDL_Rect _dirtyRectList[NUM_DIRTY_RECT];
|
||||
int _numDirtyRects;
|
||||
uint32 *_dirtyChecksums;
|
||||
bool _cksumValid;
|
||||
int _cksumNum;
|
||||
|
||||
// Keyboard mouse emulation. Disabled by fingolfin 2004-12-18.
|
||||
// I am keeping the rest of the code in for now, since the joystick
|
||||
// code (or rather, "hack") uses it, too.
|
||||
struct KbdMouse {
|
||||
int16 x, y, x_vel, y_vel, x_max, y_max, x_down_count, y_down_count;
|
||||
uint32 last_time, delay_time, x_down_time, y_down_time;
|
||||
};
|
||||
|
||||
struct MousePos {
|
||||
// The mouse position, using either virtual (game) or real
|
||||
// (overlay) coordinates.
|
||||
int16 x, y;
|
||||
|
||||
// The size and hotspot of the original cursor image.
|
||||
int16 w, h;
|
||||
int16 hotX, hotY;
|
||||
|
||||
// The size and hotspot of the pre-scaled cursor image, in real
|
||||
// coordinates.
|
||||
int16 rW, rH;
|
||||
int16 rHotX, rHotY;
|
||||
|
||||
// The size and hotspot of the pre-scaled cursor image, in game
|
||||
// coordinates.
|
||||
int16 vW, vH;
|
||||
int16 vHotX, vHotY;
|
||||
|
||||
MousePos() : x(0), y(0), w(0), h(0), hotX(0), hotY(0),
|
||||
rW(0), rH(0), rHotX(0), rHotY(0), vW(0), vH(0),
|
||||
vHotX(0), vHotY(0)
|
||||
{ }
|
||||
};
|
||||
|
||||
// mouse
|
||||
KbdMouse _km;
|
||||
bool _mouseVisible;
|
||||
bool _mouseNeedsRedraw;
|
||||
byte *_mouseData;
|
||||
SDL_Rect _mouseBackup;
|
||||
MousePos _mouseCurState;
|
||||
byte _mouseKeyColor;
|
||||
int _cursorTargetScale;
|
||||
bool _cursorPaletteDisabled;
|
||||
SDL_Surface *_mouseOrigSurface;
|
||||
SDL_Surface *_mouseSurface;
|
||||
enum {
|
||||
kMouseColorKey = 1
|
||||
};
|
||||
|
||||
// Shake mode
|
||||
int _currentShakePos;
|
||||
int _newShakePos;
|
||||
|
||||
// Palette data
|
||||
SDL_Color *_currentPalette;
|
||||
uint _paletteDirtyStart, _paletteDirtyEnd;
|
||||
|
||||
// Cursor palette data
|
||||
SDL_Color *_cursorPalette;
|
||||
|
||||
/**
|
||||
* Mutex which prevents multiple threads from interfering with each other
|
||||
* when accessing the screen.
|
||||
*/
|
||||
MutexRef _graphicsMutex;
|
||||
|
||||
FilesystemFactory *_fsFactory;
|
||||
Common::SaveFileManager *_savefile;
|
||||
Audio::MixerImpl *_mixer;
|
||||
|
||||
SDL_TimerID _timerID;
|
||||
Common::TimerManager *_timer;
|
||||
|
||||
protected:
|
||||
void addDirtyRgnAuto(const byte *buf);
|
||||
void makeChecksums(const byte *buf);
|
||||
|
||||
virtual void addDirtyRect(int x, int y, int w, int h, bool realCoordinates = false); // overloaded by CE backend
|
||||
|
||||
virtual void drawMouse(); // overloaded by CE backend
|
||||
virtual void undrawMouse(); // overloaded by CE backend (FIXME)
|
||||
virtual void blitCursor(); // overloaded by CE backend (FIXME)
|
||||
|
||||
/** Set the position of the virtual mouse cursor. */
|
||||
void setMousePos(int x, int y);
|
||||
virtual void fillMouseEvent(Common::Event &event, int x, int y); // overloaded by CE backend
|
||||
void toggleMouseGrab();
|
||||
|
||||
virtual void internUpdateScreen(); // overloaded by CE backend
|
||||
|
||||
virtual bool loadGFXMode(); // overloaded by CE backend
|
||||
virtual void unloadGFXMode(); // overloaded by CE backend
|
||||
virtual bool hotswapGFXMode(); // overloaded by CE backend
|
||||
|
||||
void setFullscreenMode(bool enable);
|
||||
void setAspectRatioCorrection(bool enable);
|
||||
|
||||
virtual bool saveScreenshot(const char *filename); // overloaded by CE backend
|
||||
|
||||
int effectiveScreenHeight() const {
|
||||
return (_videoMode.aspectRatioCorrection ? real2Aspect(_videoMode.screenHeight) : _videoMode.screenHeight)
|
||||
* _videoMode.scaleFactor;
|
||||
}
|
||||
|
||||
void setupIcon();
|
||||
void handleKbdMouse();
|
||||
|
||||
virtual bool remapKey(SDL_Event &ev, Common::Event &event);
|
||||
|
||||
void handleScalerHotkeys(const SDL_KeyboardEvent &key);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user