Skip to content
Permalink
Browse files

*** empty log message ***

  • Loading branch information
slouken committed Mar 26, 2002
1 parent f277baf commit 63970309cc4960c55f8658a38536295d8845fecb
@@ -45,7 +45,7 @@ III. Enjoy! :)
==============================================================================
IV. What is supported:

Keyboard (GEMDOS, BIOS, Ikbd)
Keyboard (GEMDOS, BIOS, GEM, Ikbd)
Mouse (XBIOS, GEM, Ikbd)
Video (XBIOS (Fullscreen), GEM (Windowed and Fullscreen))
Timer (VBL vector)
@@ -61,7 +61,10 @@ Video Kbd Mouse Timer Jstick Joypads
xbios ikbd ikbd vbl ikbd hardware
xbios gemdos 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:
@@ -108,6 +111,48 @@ SDL_JOYSTICK_ATARI:
Lightpen and analog paddle are 2 buttons, 2 axis controllers. The 2
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>
http://membres.lycos.fr/pmandin/
@@ -43,7 +43,8 @@ static char rcsid =
#include "SDL_events_c.h"
#include "SDL_gemvideo.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 */

@@ -55,8 +56,6 @@ static unsigned char gem_currentkeyboard[ATARIBIOS_MAXKEYS];
static unsigned char gem_previouskeyboard[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 */
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 int do_messages(_THIS, short *message);
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 */

@@ -124,22 +123,23 @@ void GEM_InitOSKeymap(_THIS)
keymap[SCANCODE_CAPSLOCK] = SDLK_CAPSLOCK;

/* Mouse init */
prevmousex = prevmousey = prevmouseb = 0;
GEM_mouse_relative = SDL_FALSE;
}

void GEM_PumpEvents(_THIS)
{
short mx, my, mb, dummy;
short mousex, mousey, mouseb, dummy;
short kstate, prevkc, prevks;
int i;
SDL_keysym keysym;

memset(gem_currentkeyboard,0,sizeof(gem_currentkeyboard));
prevkc = prevks = 0;

for (;;)
{
int quit, resultat;
short buffer[8], kc, ks;
short buffer[8], kc;

quit = 0;

@@ -150,29 +150,33 @@ void GEM_PumpEvents(_THIS)
0,0,0,0,0,
buffer,
10,
&dummy,&dummy,&dummy,&ks,&kc,&dummy
&dummy,&dummy,&dummy,&kstate,&kc,&dummy
);

/* Message event ? */
if (resultat & MU_MESAG)
quit = do_messages(this, buffer);

/* Keyboard event ? */
if (resultat & MU_KEYBD)
do_keyboard(kc,ks);
else
do_keyboard(0,0);
if (resultat & MU_KEYBD) {
if ((prevkc != kc) || (prevks != kstate)) {
do_keyboard(kc,kstate);
} else {
/* Avoid looping, if repeating same key */
break;
}
}

/* Timer event ? */
if ((resultat & MU_TIMER) || quit)
break;
}

/* Update mouse */
graf_mkstate(&mx, &my, &mb, &dummy);
do_mouse(this, mx, my, mb);
graf_mkstate(&mousex, &mousey, &mouseb, &kstate);
do_mouse(this, mousex, mousey, mouseb, kstate);

/* Now generates keyboard events */
/* Now generate keyboard events */
for (i=0; i<ATARIBIOS_MAXKEYS; i++) {
/* Key pressed ? */
if (gem_currentkeyboard[i] && !gem_previouskeyboard[i])
@@ -259,7 +263,6 @@ static int do_messages(_THIS, short *message)
static void do_keyboard(short kc, short ks)
{
int scancode, asciicode;
short dummy;

if (kc) {
scancode=(kc>>8) & 127;
@@ -269,9 +272,6 @@ static void do_keyboard(short kc, short ks)
gem_currentascii[scancode]=asciicode;
}

if (!ks)
graf_mkstate(&dummy, &dummy, &dummy, &ks);

/* Read special keys */
if (ks & K_RSHIFT)
gem_currentkeyboard[SCANCODE_RIGHTSHIFT]=0xFF;
@@ -283,16 +283,15 @@ static void do_keyboard(short kc, short ks)
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 ? */
if ((prevmousex!=mx) || (prevmousey!=my)) {
if (GEM_mouse_relative) {
short wind_pxy[8];

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]);
SDL_PrivateMouseMotion(0, 1, SDL_AtariXbios_mousex, SDL_AtariXbios_mousey);
SDL_AtariXbios_mousex = SDL_AtariXbios_mousey = 0;
} else {
SDL_PrivateMouseMotion(0, 1, mx, my);
}
@@ -304,19 +303,29 @@ static void do_mouse(_THIS, short mx, short my, short mb)
if (prevmouseb!=mb) {
int i;

for (i=0;i<3;i++) {
for (i=0;i<2;i++) {
int curbutton, prevbutton;

curbutton = mb & (1<<i);
prevbutton = prevmouseb & (1<<i);

if (curbutton & !prevbutton) {
SDL_PrivateMouseButton(SDL_PRESSED, i, 0, 0);
if (curbutton && !prevbutton) {
SDL_PrivateMouseButton(SDL_PRESSED, i+1, 0, 0);
}
if (!curbutton & prevbutton) {
SDL_PrivateMouseButton(SDL_RELEASED, i, 0, 0);
if (!curbutton && prevbutton) {
SDL_PrivateMouseButton(SDL_RELEASED, i+1, 0, 0);
}
}
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)
return 1;
}

#if 0
void GEM_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
{
/* This seems to work only on AES 3.4 (Falcon) */

EVNTREC warpevent;

warpevent.ap_event = APPEVNT_MOUSE;
warpevent.ap_value = (y << 16) | x;
warpevent.ap_value = (x << 16) | y;

appl_tplay(&warpevent, 1, 1000);
}
#endif

void GEM_CheckMouseMode(_THIS)
{
/* If the mouse is hidden and input is grabbed, we use relative mode */
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;
} else {
GEM_mouse_relative = SDL_FALSE;
@@ -32,6 +32,7 @@ extern void GEM_FreeWMCursor(_THIS, WMcursor *cursor);
extern WMcursor *GEM_CreateWMCursor(_THIS,
Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);
extern int GEM_ShowWMCursor(_THIS, WMcursor *cursor);
#if 0
extern void GEM_WarpWMCursor(_THIS, Uint16 x, Uint16 y);
extern void GEM_CheckMouseModeNoLock(_THIS);
#endif
extern void GEM_CheckMouseMode(_THIS);

0 comments on commit 6397030

Please sign in to comment.