aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/dc
diff options
context:
space:
mode:
Diffstat (limited to 'backends/platform/dc')
-rw-r--r--backends/platform/dc/dc.h6
-rw-r--r--backends/platform/dc/display.cpp27
-rw-r--r--backends/platform/dc/input.cpp16
-rw-r--r--backends/platform/dc/selector.cpp2
-rw-r--r--backends/platform/dc/softkbd.cpp4
5 files changed, 31 insertions, 24 deletions
diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h
index 01e86a561b..fa47ed21f5 100644
--- a/backends/platform/dc/dc.h
+++ b/backends/platform/dc/dc.h
@@ -81,8 +81,8 @@ class OSystem_Dreamcast : public OSystem {
// The screen will not be updated to reflect the new bitmap
void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
- // Copies the current screen contents to a new surface.
- bool grabRawScreen(Graphics::Surface *surf);
+ virtual Graphics::Surface *lockScreen();
+ virtual void unlockScreen();
// Clear the screen to black.
void clearScreen();
@@ -213,6 +213,8 @@ class OSystem_Dreamcast : public OSystem {
void *ovl_tx[NUM_BUFFERS];
unsigned short palette[256], cursor_palette[256];
+ Graphics::Surface _framebuffer;
+
int temp_sound_buffer[RING_BUFFER_SAMPLES>>SOUND_BUFFER_SHIFT];
void checkSound();
diff --git a/backends/platform/dc/display.cpp b/backends/platform/dc/display.cpp
index 73312cafed..da9f6e83ff 100644
--- a/backends/platform/dc/display.cpp
+++ b/backends/platform/dc/display.cpp
@@ -609,19 +609,24 @@ int OSystem_Dreamcast::getGraphicsMode() const
return 0;
}
-bool OSystem_Dreamcast::grabRawScreen(Graphics::Surface *surf)
+Graphics::Surface *OSystem_Dreamcast::lockScreen()
{
- if(!screen || !surf)
- return false;
+ if (!screen)
+ return 0;
- surf->create(_screen_w, _screen_h, 1);
- unsigned char *src = screen, *dst = (unsigned char *)surf->pixels;
- for(int h = _screen_h; h>0; --h) {
- memcpy(dst, src, _screen_w);
- src += SCREEN_W;
- dst += _screen_w;
- }
- return true;
+ _framebuffer.pixels = screen;
+ _framebuffer.w = _screen_w;
+ _framebuffer.h = _screen_h;
+ _framebuffer.pitch = SCREEN_W;
+ _framebuffer.bytesPerPixel = 1;
+
+ return &_framebuffer;
+}
+
+void OSystem_Dreamcast::unlockScreen()
+{
+ // Force screen update
+ _screen_dirty = true;
}
void OSystem_Dreamcast::clearScreen()
diff --git a/backends/platform/dc/input.cpp b/backends/platform/dc/input.cpp
index 7a5e5911d8..f3638a28db 100644
--- a/backends/platform/dc/input.cpp
+++ b/backends/platform/dc/input.cpp
@@ -48,7 +48,7 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y,
if(!(buttons & 4)) lmb++;
if(!(buttons & 2)) rmb++;
- if(!(buttons & 8)) newkey = 319;
+ if(!(buttons & 8)) newkey = Common::ASCII_F5;
else if(!(buttons & 512)) newkey = ' ';
else if(!(buttons & 1024)) newkey = numpadmap[(buttons>>4)&15];
@@ -69,7 +69,7 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y,
if(!(buttons & 4)) lmb++;
if(!(buttons & 2)) rmb++;
- if(!(buttons & 8)) newkey = 319;
+ if(!(buttons & 8)) newkey = Common::ASCII_F5;
mouse_x += pad->cond.mouse.axis1;
mouse_y += pad->cond.mouse.axis2;
@@ -101,22 +101,22 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y,
"=¯`{ }+*½<>?" :
"-^@[ ];:§,./")[key - 0x2d];
else if(key >= 0x3a && key <= 0x43)
- newkey = key+(315-0x3a);
+ newkey = key+(Common::ASCII_F1-0x3a);
else if(key >= 0x54 && key <= 0x57)
newkey = "/*-+"[key-0x54];
else switch(key) {
case 0x27: case 0x62:
newkey = ((shift & 0x22)? '~' : '0'); break;
case 0x28: case 0x58:
- newkey = 13; break;
+ newkey = Common::KEYCODE_RETURN; break;
case 0x29:
- newkey = 27; break;
+ newkey = Common::KEYCODE_ESCAPE; break;
case 0x2a:
- newkey = 8; break;
+ newkey = Common::KEYCODE_BACKSPACE; break;
case 0x2b:
- newkey = 9; break;
+ newkey = Common::KEYCODE_TAB; break;
case 0x2c:
- newkey = ' '; break;
+ newkey = Common::KEYCODE_SPACE; break;
case 0x4c:
if((shift & 0x11) && (shift & 0x44))
exit(0);
diff --git a/backends/platform/dc/selector.cpp b/backends/platform/dc/selector.cpp
index a4fec642fe..8262a39614 100644
--- a/backends/platform/dc/selector.cpp
+++ b/backends/platform/dc/selector.cpp
@@ -364,7 +364,7 @@ int gameMenu(Game *games, int num_games)
event = handleInput(locked_get_pads(), mousex, mousey, shiftFlags);
setimask(mask);
- if(event==-Common::EVENT_LBUTTONDOWN || event==13 || event==319) {
+ if(event==-Common::EVENT_LBUTTONDOWN || event==13 || event==Common::ASCII_F5) {
int selected_game = top_game + selector_pos;
for(int fade=0; fade<=256; fade+=4) {
diff --git a/backends/platform/dc/softkbd.cpp b/backends/platform/dc/softkbd.cpp
index e8436fc30a..58b492f6db 100644
--- a/backends/platform/dc/softkbd.cpp
+++ b/backends/platform/dc/softkbd.cpp
@@ -52,7 +52,7 @@ static const char key_names[] =
static const short key_codes[] =
{
- 27, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
+ Common::KEYCODE_ESCAPE, Common::ASCII_F1, Common::ASCII_F2, Common::ASCII_F3, Common::ASCII_F4, Common::ASCII_F5, Common::ASCII_F6, Common::ASCII_F7, Common::ASCII_F8, Common::ASCII_F9, Common::ASCII_F10,
K('1','!'), K('2','"'), K('3','#'), K('4','$'), K('5','%'),
K('6','&'), K('7','\''), K('8','('), K('9',')'), K('0','~'), K('-','='),
K('q','Q'), K('w','W'), K('e','E'), K('r','R'), K('t','T'),
@@ -61,7 +61,7 @@ static const short key_codes[] =
K('h','H'), K('j','J'), K('k','K'), K('l','L'), K(';','+'), K(':','*'),
K('z','Z'), K('x','X'), K('c','C'), K('v','V'), K('b','B'),
K('n','N'), K('m','M'), K(',','<'), K('.','>'), K('/','?'), K('\\','_'),
- ~Common::KBD_SHIFT, ~Common::KBD_CTRL, ~Common::KBD_ALT, ' ', 8, 13
+ ~Common::KBD_SHIFT, ~Common::KBD_CTRL, ~Common::KBD_ALT, ' ', Common::KEYCODE_BACKSPACE, Common::KEYCODE_RETURN
};
SoftKeyboard::SoftKeyboard(const OSystem_Dreamcast *_os)