src/video/ataricommon/SDL_biosevents.c
changeset 3283 1ed5d432e468
parent 3282 10a12f77f597
child 3284 2b95b2c0b6d4
     1.1 --- a/src/video/ataricommon/SDL_biosevents.c	Sun Sep 20 04:13:23 2009 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,140 +0,0 @@
     1.4 -/*
     1.5 -    SDL - Simple DirectMedia Layer
     1.6 -    Copyright (C) 1997-2009 Sam Lantinga
     1.7 -
     1.8 -    This library is free software; you can redistribute it and/or
     1.9 -    modify it under the terms of the GNU Lesser General Public
    1.10 -    License as published by the Free Software Foundation; either
    1.11 -    version 2.1 of the License, or (at your option) any later version.
    1.12 -
    1.13 -    This library is distributed in the hope that it will be useful,
    1.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.16 -    Lesser General Public License for more details.
    1.17 -
    1.18 -    You should have received a copy of the GNU Lesser General Public
    1.19 -    License along with this library; if not, write to the Free Software
    1.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    1.21 -
    1.22 -    Sam Lantinga
    1.23 -    slouken@libsdl.org
    1.24 -*/
    1.25 -#include "SDL_config.h"
    1.26 -
    1.27 -/*
    1.28 - *	Atari keyboard events manager, using BIOS
    1.29 - *
    1.30 - *	Patrice Mandin
    1.31 - */
    1.32 -
    1.33 -/* Mint includes */
    1.34 -#include <mint/osbind.h>
    1.35 -#include <mint/cookie.h>
    1.36 -
    1.37 -#include "../../events/SDL_sysevents.h"
    1.38 -#include "../../events/SDL_events_c.h"
    1.39 -
    1.40 -#include "SDL_atarikeys.h"
    1.41 -#include "SDL_atarievents_c.h"
    1.42 -#include "SDL_xbiosevents_c.h"
    1.43 -#include "SDL_ataridevmouse_c.h"
    1.44 -
    1.45 -static unsigned char bios_currentkeyboard[ATARIBIOS_MAXKEYS];
    1.46 -static unsigned char bios_previouskeyboard[ATARIBIOS_MAXKEYS];
    1.47 -static SDL_bool use_dev_mouse = SDL_FALSE;
    1.48 -
    1.49 -static void UpdateSpecialKeys(int special_keys_state);
    1.50 -
    1.51 -void
    1.52 -AtariBios_InitOSKeymap(_THIS)
    1.53 -{
    1.54 -    int i, vectors_mask;
    1.55 -    unsigned long dummy;
    1.56 -
    1.57 -    SDL_memset(bios_currentkeyboard, 0, sizeof(bios_currentkeyboard));
    1.58 -    SDL_memset(bios_previouskeyboard, 0, sizeof(bios_previouskeyboard));
    1.59 -
    1.60 -    use_dev_mouse = (SDL_AtariDevMouse_Open() != 0) ? SDL_TRUE : SDL_FALSE;
    1.61 -
    1.62 -    vectors_mask = ATARI_XBIOS_JOYSTICKEVENTS;  /* XBIOS joystick events */
    1.63 -    if (!use_dev_mouse) {
    1.64 -        vectors_mask |= ATARI_XBIOS_MOUSEEVENTS;        /* XBIOS mouse events */
    1.65 -    }
    1.66 -    /*if (Getcookie(C_MiNT, &dummy) == C_FOUND) {
    1.67 -       vectors_mask = 0;
    1.68 -       } */
    1.69 -
    1.70 -    SDL_AtariXbios_InstallVectors(vectors_mask);
    1.71 -}
    1.72 -
    1.73 -void
    1.74 -AtariBios_PumpEvents(_THIS)
    1.75 -{
    1.76 -    int i;
    1.77 -    SDL_keysym keysym;
    1.78 -
    1.79 -    /* Update pressed keys */
    1.80 -    SDL_memset(bios_currentkeyboard, 0, ATARIBIOS_MAXKEYS);
    1.81 -
    1.82 -    while (Bconstat(_CON)) {
    1.83 -        unsigned long key_pressed;
    1.84 -        key_pressed = Bconin(_CON);
    1.85 -        bios_currentkeyboard[(key_pressed >> 16) & (ATARIBIOS_MAXKEYS - 1)] =
    1.86 -            0xFF;
    1.87 -    }
    1.88 -
    1.89 -    /* Read special keys */
    1.90 -    UpdateSpecialKeys(Kbshift(-1));
    1.91 -
    1.92 -    /* Now generate events */
    1.93 -    for (i = 0; i < ATARIBIOS_MAXKEYS; i++) {
    1.94 -        /* Key pressed ? */
    1.95 -        if (bios_currentkeyboard[i] && !bios_previouskeyboard[i])
    1.96 -            SDL_PrivateKeyboard(SDL_PRESSED,
    1.97 -                                SDL_Atari_TranslateKey(i, &keysym, SDL_TRUE));
    1.98 -
    1.99 -        /* Key unpressed ? */
   1.100 -        if (bios_previouskeyboard[i] && !bios_currentkeyboard[i])
   1.101 -            SDL_PrivateKeyboard(SDL_RELEASED,
   1.102 -                                SDL_Atari_TranslateKey(i, &keysym,
   1.103 -                                                       SDL_FALSE));
   1.104 -    }
   1.105 -
   1.106 -    if (use_dev_mouse) {
   1.107 -        SDL_AtariDevMouse_PostMouseEvents(_this, SDL_TRUE);
   1.108 -    } else {
   1.109 -        SDL_AtariXbios_PostMouseEvents(_this, SDL_TRUE);
   1.110 -    }
   1.111 -
   1.112 -    /* Will be previous table */
   1.113 -    SDL_memcpy(bios_previouskeyboard, bios_currentkeyboard,
   1.114 -               sizeof(bios_previouskeyboard));
   1.115 -}
   1.116 -
   1.117 -static void
   1.118 -UpdateSpecialKeys(int special_keys_state)
   1.119 -{
   1.120 -#define UPDATE_SPECIAL_KEYS(numbit,scancode) \
   1.121 -	{	\
   1.122 -		if (special_keys_state & (1<<(numbit))) { \
   1.123 -			bios_currentkeyboard[scancode]=0xFF; \
   1.124 -		}	\
   1.125 -	}
   1.126 -
   1.127 -    UPDATE_SPECIAL_KEYS(K_RSHIFT, SCANCODE_RIGHTSHIFT);
   1.128 -    UPDATE_SPECIAL_KEYS(K_LSHIFT, SCANCODE_LEFTSHIFT);
   1.129 -    UPDATE_SPECIAL_KEYS(K_CTRL, SCANCODE_LEFTCONTROL);
   1.130 -    UPDATE_SPECIAL_KEYS(K_ALT, SCANCODE_LEFTALT);
   1.131 -    UPDATE_SPECIAL_KEYS(K_CAPSLOCK, SCANCODE_CAPSLOCK);
   1.132 -}
   1.133 -
   1.134 -void
   1.135 -AtariBios_ShutdownEvents(void)
   1.136 -{
   1.137 -    SDL_AtariXbios_RestoreVectors();
   1.138 -    if (use_dev_mouse) {
   1.139 -        SDL_AtariDevMouse_Close();
   1.140 -    }
   1.141 -}
   1.142 -
   1.143 -/* vi: set ts=4 sw=4 expandtab: */