Commit a437e285 authored by Sam Lantinga's avatar Sam Lantinga

*** empty log message ***

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40320
parent 75baede7
...@@ -45,7 +45,7 @@ III. Enjoy! :) ...@@ -45,7 +45,7 @@ III. Enjoy! :)
============================================================================== ==============================================================================
IV. What is supported: IV. What is supported:
Keyboard (GEMDOS, BIOS, Ikbd) Keyboard (GEMDOS, BIOS, GEM, Ikbd)
Mouse (XBIOS, GEM, Ikbd) Mouse (XBIOS, GEM, Ikbd)
Video (XBIOS (Fullscreen), GEM (Windowed and Fullscreen)) Video (XBIOS (Fullscreen), GEM (Windowed and Fullscreen))
Timer (VBL vector) Timer (VBL vector)
...@@ -61,7 +61,10 @@ Video Kbd Mouse Timer Jstick Joypads ...@@ -61,7 +61,10 @@ Video Kbd Mouse Timer Jstick Joypads
xbios ikbd ikbd vbl ikbd hardware xbios ikbd ikbd vbl ikbd hardware
xbios gemdos xbios vbl xbios hardware xbios gemdos xbios vbl xbios hardware
xbios bios xbios vbl xbios hardware xbios bios xbios vbl xbios hardware
gem gem gem vbl xbios hardware gem gem gem(*) vbl xbios hardware
(*) GEM does not report relative mouse motion, so xbios mouse driver is used
to report this type event.
============================================================================== ==============================================================================
V. Environment variables: V. Environment variables:
...@@ -108,6 +111,48 @@ SDL_JOYSTICK_ATARI: ...@@ -108,6 +111,48 @@ SDL_JOYSTICK_ATARI:
Lightpen and analog paddle are 2 buttons, 2 axis controllers. The 2 Lightpen and analog paddle are 2 buttons, 2 axis controllers. The 2
buttons are those affected to 1 button joysticks on the same port. buttons are those affected to 1 button joysticks on the same port.
==============================================================================
VI. More informations about drivers:
Xbios video:
Video chip is detected using the _VDO cookie.
Screen enhancers are not supported, but could be if you know how to
use them.
ST, STE, Mega ST, Mega STE:
320x200x4 bits, shades of grey, available only for the purpose
of testing SDL.
TT:
320x480x8 and 320x240x8 (software double-lined mode).
Falcon:
All modes supported by the current monitor (RVB or VGA).
Clones and any machine with monochrome monitor:
Not supported.
Gem video:
Automatically used if xbios not available.
All machines:
Only the current resolution, if 8 bits or higher depth.
IKBD keyboard, mouse and joystick driver:
Available if _MCH cookie is ST, Mega ST, STE, Mega STE, TT or Falcon.
Hades has an IKBD, but xbios is not available for video, so IKBD
driver is disabled.
Gemdos and bios keyboard driver:
Available on all machines.
Mouse and joystick xbios driver:
Available on all machines (I think).
Joypad driver:
Available if _MCH cookie is STE or Falcon.
VBL timer driver:
Available all machines (I think).
-- --
Patrice Mandin <pmandin@caramail.com> Patrice Mandin <pmandin@caramail.com>
http://membres.lycos.fr/pmandin/ http://membres.lycos.fr/pmandin/
...@@ -43,7 +43,8 @@ static char rcsid = ...@@ -43,7 +43,8 @@ static char rcsid =
#include "SDL_events_c.h" #include "SDL_events_c.h"
#include "SDL_gemvideo.h" #include "SDL_gemvideo.h"
#include "SDL_gemevents_c.h" #include "SDL_gemevents_c.h"
#include "../ataricommon/SDL_atarikeys.h" /* for keyboard scancodes */ #include "SDL_atarikeys.h" /* for keyboard scancodes */
#include "SDL_xbiosinterrupt_s.h"
/* Defines */ /* Defines */
...@@ -55,8 +56,6 @@ static unsigned char gem_currentkeyboard[ATARIBIOS_MAXKEYS]; ...@@ -55,8 +56,6 @@ static unsigned char gem_currentkeyboard[ATARIBIOS_MAXKEYS];
static unsigned char gem_previouskeyboard[ATARIBIOS_MAXKEYS]; static unsigned char gem_previouskeyboard[ATARIBIOS_MAXKEYS];
static unsigned char gem_currentascii[ATARIBIOS_MAXKEYS]; static unsigned char gem_currentascii[ATARIBIOS_MAXKEYS];
static short prevmousex, prevmousey, prevmouseb;
/* The translation tables from a console scancode to a SDL keysym */ /* The translation tables from a console scancode to a SDL keysym */
static SDLKey keymap[ATARIBIOS_MAXKEYS]; static SDLKey keymap[ATARIBIOS_MAXKEYS];
...@@ -65,7 +64,7 @@ static SDLKey keymap[ATARIBIOS_MAXKEYS]; ...@@ -65,7 +64,7 @@ static SDLKey keymap[ATARIBIOS_MAXKEYS];
static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym); static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym);
static int do_messages(_THIS, short *message); static int do_messages(_THIS, short *message);
static void do_keyboard(short kc, short ks); static void do_keyboard(short kc, short ks);
static void do_mouse(_THIS, short mx, short my, short mb); static void do_mouse(_THIS, short mx, short my, short mb, short ks);
/* Functions */ /* Functions */
...@@ -124,22 +123,23 @@ void GEM_InitOSKeymap(_THIS) ...@@ -124,22 +123,23 @@ void GEM_InitOSKeymap(_THIS)
keymap[SCANCODE_CAPSLOCK] = SDLK_CAPSLOCK; keymap[SCANCODE_CAPSLOCK] = SDLK_CAPSLOCK;
/* Mouse init */ /* Mouse init */
prevmousex = prevmousey = prevmouseb = 0;
GEM_mouse_relative = SDL_FALSE; GEM_mouse_relative = SDL_FALSE;
} }
void GEM_PumpEvents(_THIS) void GEM_PumpEvents(_THIS)
{ {
short mx, my, mb, dummy; short mousex, mousey, mouseb, dummy;
short kstate, prevkc, prevks;
int i; int i;
SDL_keysym keysym; SDL_keysym keysym;
memset(gem_currentkeyboard,0,sizeof(gem_currentkeyboard)); memset(gem_currentkeyboard,0,sizeof(gem_currentkeyboard));
prevkc = prevks = 0;
for (;;) for (;;)
{ {
int quit, resultat; int quit, resultat;
short buffer[8], kc, ks; short buffer[8], kc;
quit = 0; quit = 0;
...@@ -150,7 +150,7 @@ void GEM_PumpEvents(_THIS) ...@@ -150,7 +150,7 @@ void GEM_PumpEvents(_THIS)
0,0,0,0,0, 0,0,0,0,0,
buffer, buffer,
10, 10,
&dummy,&dummy,&dummy,&ks,&kc,&dummy &dummy,&dummy,&dummy,&kstate,&kc,&dummy
); );
/* Message event ? */ /* Message event ? */
...@@ -158,10 +158,14 @@ void GEM_PumpEvents(_THIS) ...@@ -158,10 +158,14 @@ void GEM_PumpEvents(_THIS)
quit = do_messages(this, buffer); quit = do_messages(this, buffer);
/* Keyboard event ? */ /* Keyboard event ? */
if (resultat & MU_KEYBD) if (resultat & MU_KEYBD) {
do_keyboard(kc,ks); if ((prevkc != kc) || (prevks != kstate)) {
else do_keyboard(kc,kstate);
do_keyboard(0,0); } else {
/* Avoid looping, if repeating same key */
break;
}
}
/* Timer event ? */ /* Timer event ? */
if ((resultat & MU_TIMER) || quit) if ((resultat & MU_TIMER) || quit)
...@@ -169,10 +173,10 @@ void GEM_PumpEvents(_THIS) ...@@ -169,10 +173,10 @@ void GEM_PumpEvents(_THIS)
} }
/* Update mouse */ /* Update mouse */
graf_mkstate(&mx, &my, &mb, &dummy); graf_mkstate(&mousex, &mousey, &mouseb, &kstate);
do_mouse(this, mx, my, mb); do_mouse(this, mousex, mousey, mouseb, kstate);
/* Now generates keyboard events */ /* Now generate keyboard events */
for (i=0; i<ATARIBIOS_MAXKEYS; i++) { for (i=0; i<ATARIBIOS_MAXKEYS; i++) {
/* Key pressed ? */ /* Key pressed ? */
if (gem_currentkeyboard[i] && !gem_previouskeyboard[i]) if (gem_currentkeyboard[i] && !gem_previouskeyboard[i])
...@@ -259,7 +263,6 @@ static int do_messages(_THIS, short *message) ...@@ -259,7 +263,6 @@ static int do_messages(_THIS, short *message)
static void do_keyboard(short kc, short ks) static void do_keyboard(short kc, short ks)
{ {
int scancode, asciicode; int scancode, asciicode;
short dummy;
if (kc) { if (kc) {
scancode=(kc>>8) & 127; scancode=(kc>>8) & 127;
...@@ -269,9 +272,6 @@ static void do_keyboard(short kc, short ks) ...@@ -269,9 +272,6 @@ static void do_keyboard(short kc, short ks)
gem_currentascii[scancode]=asciicode; gem_currentascii[scancode]=asciicode;
} }
if (!ks)
graf_mkstate(&dummy, &dummy, &dummy, &ks);
/* Read special keys */ /* Read special keys */
if (ks & K_RSHIFT) if (ks & K_RSHIFT)
gem_currentkeyboard[SCANCODE_RIGHTSHIFT]=0xFF; gem_currentkeyboard[SCANCODE_RIGHTSHIFT]=0xFF;
...@@ -283,16 +283,15 @@ static void do_keyboard(short kc, short ks) ...@@ -283,16 +283,15 @@ static void do_keyboard(short kc, short ks)
gem_currentkeyboard[SCANCODE_LEFTALT]=0xFF; gem_currentkeyboard[SCANCODE_LEFTALT]=0xFF;
} }
static void do_mouse(_THIS, short mx, short my, short mb) static void do_mouse(_THIS, short mx, short my, short mb, short ks)
{ {
static short prevmousex=0, prevmousey=0, prevmouseb=0;
/* Mouse motion ? */ /* Mouse motion ? */
if ((prevmousex!=mx) || (prevmousey!=my)) { if ((prevmousex!=mx) || (prevmousey!=my)) {
if (GEM_mouse_relative) { if (GEM_mouse_relative) {
short wind_pxy[8]; SDL_PrivateMouseMotion(0, 1, SDL_AtariXbios_mousex, SDL_AtariXbios_mousey);
SDL_AtariXbios_mousex = SDL_AtariXbios_mousey = 0;
wind_get(GEM_handle, WF_WORKXYWH, &wind_pxy[0], &wind_pxy[1], &wind_pxy[2], &wind_pxy[3]);
SDL_PrivateMouseMotion(0, 1, mx-wind_pxy[0], my-wind_pxy[1]);
} else { } else {
SDL_PrivateMouseMotion(0, 1, mx, my); SDL_PrivateMouseMotion(0, 1, mx, my);
} }
...@@ -304,19 +303,29 @@ static void do_mouse(_THIS, short mx, short my, short mb) ...@@ -304,19 +303,29 @@ static void do_mouse(_THIS, short mx, short my, short mb)
if (prevmouseb!=mb) { if (prevmouseb!=mb) {
int i; int i;
for (i=0;i<3;i++) { for (i=0;i<2;i++) {
int curbutton, prevbutton; int curbutton, prevbutton;
curbutton = mb & (1<<i); curbutton = mb & (1<<i);
prevbutton = prevmouseb & (1<<i); prevbutton = prevmouseb & (1<<i);
if (curbutton & !prevbutton) { if (curbutton && !prevbutton) {
SDL_PrivateMouseButton(SDL_PRESSED, i, 0, 0); SDL_PrivateMouseButton(SDL_PRESSED, i+1, 0, 0);
} }
if (!curbutton & prevbutton) { if (!curbutton && prevbutton) {
SDL_PrivateMouseButton(SDL_RELEASED, i, 0, 0); SDL_PrivateMouseButton(SDL_RELEASED, i+1, 0, 0);
} }
} }
prevmouseb = mb; prevmouseb = mb;
} }
/* Read special keys */
if (ks & K_RSHIFT)
gem_currentkeyboard[SCANCODE_RIGHTSHIFT]=0xFF;
if (ks & K_LSHIFT)
gem_currentkeyboard[SCANCODE_LEFTSHIFT]=0xFF;
if (ks & K_CTRL)
gem_currentkeyboard[SCANCODE_LEFTCONTROL]=0xFF;
if (ks & K_ALT)
gem_currentkeyboard[SCANCODE_LEFTALT]=0xFF;
} }
...@@ -136,21 +136,26 @@ int GEM_ShowWMCursor(_THIS, WMcursor *cursor) ...@@ -136,21 +136,26 @@ int GEM_ShowWMCursor(_THIS, WMcursor *cursor)
return 1; return 1;
} }
#if 0
void GEM_WarpWMCursor(_THIS, Uint16 x, Uint16 y) void GEM_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
{ {
/* This seems to work only on AES 3.4 (Falcon) */
EVNTREC warpevent; EVNTREC warpevent;
warpevent.ap_event = APPEVNT_MOUSE; warpevent.ap_event = APPEVNT_MOUSE;
warpevent.ap_value = (y << 16) | x; warpevent.ap_value = (x << 16) | y;
appl_tplay(&warpevent, 1, 1000); appl_tplay(&warpevent, 1, 1000);
} }
#endif
void GEM_CheckMouseMode(_THIS) void GEM_CheckMouseMode(_THIS)
{ {
/* If the mouse is hidden and input is grabbed, we use relative mode */ /* If the mouse is hidden and input is grabbed, we use relative mode */
if ( !(SDL_cursorstate & CURSOR_VISIBLE) && if ( !(SDL_cursorstate & CURSOR_VISIBLE) &&
(this->input_grab != SDL_GRAB_OFF) ) { (this->input_grab != SDL_GRAB_OFF) &&
(SDL_GetAppState() & SDL_APPACTIVE) ) {
GEM_mouse_relative = SDL_TRUE; GEM_mouse_relative = SDL_TRUE;
} else { } else {
GEM_mouse_relative = SDL_FALSE; GEM_mouse_relative = SDL_FALSE;
......
...@@ -32,6 +32,7 @@ extern void GEM_FreeWMCursor(_THIS, WMcursor *cursor); ...@@ -32,6 +32,7 @@ extern void GEM_FreeWMCursor(_THIS, WMcursor *cursor);
extern WMcursor *GEM_CreateWMCursor(_THIS, extern WMcursor *GEM_CreateWMCursor(_THIS,
Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y); Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);
extern int GEM_ShowWMCursor(_THIS, WMcursor *cursor); extern int GEM_ShowWMCursor(_THIS, WMcursor *cursor);
#if 0
extern void GEM_WarpWMCursor(_THIS, Uint16 x, Uint16 y); extern void GEM_WarpWMCursor(_THIS, Uint16 x, Uint16 y);
extern void GEM_CheckMouseModeNoLock(_THIS); #endif
extern void GEM_CheckMouseMode(_THIS); extern void GEM_CheckMouseMode(_THIS);
This diff is collapsed.
...@@ -639,7 +639,10 @@ static void XBIOS_UpdateRects(_THIS, int numrects, SDL_Rect *rects) ...@@ -639,7 +639,10 @@ static void XBIOS_UpdateRects(_THIS, int numrects, SDL_Rect *rects)
int x1,x2; int x1,x2;
x1 = rects[i].x & ~15; x1 = rects[i].x & ~15;
x2 = ((rects[i].x+rects[i].w) | 15) +1; x2 = rects[i].x+rects[i].w;
if (x2 & 15) {
x2 = (x2 | 15) +1;
}
source = surface->pixels; source = surface->pixels;
source += surface->pitch * rects[i].y; source += surface->pitch * rects[i].y;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment