Skip to content
Permalink
Browse files

Added preliminary missingtranslation from Atari to Unicode charset

  • Loading branch information
pmandin committed Jan 1, 2006
1 parent 2e84584 commit 634bb0cbd11fb6d68886c3a03e460ef1da2c73ac
@@ -127,3 +127,13 @@ void Atari_PumpEvents(_THIS)
/* Call choosen routine */
this->PumpEvents(this);
}

Uint16 SDL_AtariToUnicode(Uint8 caracter)
{
/* Translate from Atari charset to Unicode */
if ((caracter>=32) && (caracter<=127)) {
return (Uint16) caracter;
}

return 0;
}
@@ -44,4 +44,6 @@ extern void (*Atari_ShutdownEvents)(void);
extern void Atari_InitOSKeymap(_THIS);
extern void Atari_PumpEvents(_THIS);

extern Uint16 SDL_AtariToUnicode(Uint8 caracter);

#endif /* _SDL_ATARI_EVENTS_H_ */
@@ -41,6 +41,7 @@ static char rcsid =
#include "SDL_events_c.h"

#include "SDL_atarikeys.h"
#include "SDL_atarievents_c.h"
#include "SDL_xbiosevents_c.h"

/* To save state of keyboard */
@@ -64,7 +65,8 @@ enum {
/* The translation tables from a console scancode to a SDL keysym */
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,
SDL_bool pressed);
static void UpdateSpecialKeys(int special_keys_state);

void AtariBios_InitOSKeymap(_THIS)
@@ -135,11 +137,13 @@ void AtariBios_PumpEvents(_THIS)
for (i=0; i<ATARIBIOS_MAXKEYS; i++) {
/* Key pressed ? */
if (bios_currentkeyboard[i] && !bios_previouskeyboard[i])
SDL_PrivateKeyboard(SDL_PRESSED, TranslateKey(i, bios_currentascii[i], &keysym));
SDL_PrivateKeyboard(SDL_PRESSED,
TranslateKey(i, bios_currentascii[i], &keysym, SDL_TRUE));

/* Key unpressed ? */
if (bios_previouskeyboard[i] && !bios_currentkeyboard[i])
SDL_PrivateKeyboard(SDL_RELEASED, TranslateKey(i, bios_currentascii[i], &keysym));
SDL_PrivateKeyboard(SDL_RELEASED,
TranslateKey(i, bios_currentascii[i], &keysym, SDL_FALSE));
}

SDL_AtariXbios_PostMouseEvents(this);
@@ -165,7 +169,8 @@ static void UpdateSpecialKeys(int special_keys_state)
UPDATE_SPECIAL_KEYS(K_CAPSLOCK, SCANCODE_CAPSLOCK);
}

static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym)
static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym,
SDL_bool pressed)
{
/* Set the keysym information */
keysym->scancode = scancode;
@@ -177,6 +182,9 @@ static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym)

keysym->mod = KMOD_NONE;
keysym->unicode = 0;
if (pressed && (asciicode!=0)) {
keysym->unicode = SDL_AtariToUnicode(asciicode);
}

return(keysym);
}
@@ -41,6 +41,7 @@ static char rcsid =
#include "SDL_events_c.h"

#include "SDL_atarikeys.h"
#include "SDL_atarievents_c.h"
#include "SDL_xbiosevents_c.h"

/* To save state of keyboard */
@@ -69,7 +70,8 @@ enum {
/* The translation tables from a console scancode to a SDL keysym */
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,
SDL_bool pressed);
static void UpdateSpecialKeys(int special_keys_state);

void AtariGemdos_InitOSKeymap(_THIS)
@@ -140,11 +142,13 @@ void AtariGemdos_PumpEvents(_THIS)
for (i=0; i<ATARIBIOS_MAXKEYS; i++) {
/* Key pressed ? */
if (gemdos_currentkeyboard[i] && !gemdos_previouskeyboard[i])
SDL_PrivateKeyboard(SDL_PRESSED, TranslateKey(i, gemdos_currentascii[i], &keysym));
SDL_PrivateKeyboard(SDL_PRESSED,
TranslateKey(i, gemdos_currentascii[i], &keysym, SDL_TRUE));

/* Key unpressed ? */
if (gemdos_previouskeyboard[i] && !gemdos_currentkeyboard[i])
SDL_PrivateKeyboard(SDL_RELEASED, TranslateKey(i, gemdos_currentascii[i], &keysym));
SDL_PrivateKeyboard(SDL_RELEASED,
TranslateKey(i, gemdos_currentascii[i], &keysym, SDL_FALSE));
}

SDL_AtariXbios_PostMouseEvents(this);
@@ -170,7 +174,8 @@ static void UpdateSpecialKeys(int special_keys_state)
UPDATE_SPECIAL_KEYS(K_CAPSLOCK, SCANCODE_CAPSLOCK);
}

static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym)
static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym,
SDL_bool pressed)
{
/* Set the keysym information */
keysym->scancode = scancode;
@@ -182,6 +187,9 @@ static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym)

keysym->mod = KMOD_NONE;
keysym->unicode = 0;
if (pressed && (asciicode!=0)) {
keysym->unicode = SDL_AtariToUnicode(asciicode);
}

return(keysym);
}
@@ -41,6 +41,7 @@ static char rcsid =
#include "SDL_events_c.h"

#include "SDL_atarikeys.h"
#include "SDL_atarievents_c.h"
#include "SDL_ikbdinterrupt_s.h"

/* Special keys state */
@@ -75,7 +76,8 @@ _KEYTAB *curtables;
static unsigned char *tab_unshift, *tab_shift, *tab_caps;
static SDLKey keymap[ATARIBIOS_MAXKEYS];

static SDL_keysym *TranslateKey(int scancode, int numkeytable, SDL_keysym *keysym);
static SDL_keysym *TranslateKey(int scancode, int numkeytable, SDL_keysym *keysym,
SDL_bool pressed);

void AtariIkbd_InitOSKeymap(_THIS)
{
@@ -171,13 +173,15 @@ void AtariIkbd_PumpEvents(_THIS)
for (i=0; i<ATARIBIOS_MAXKEYS; i++) {
/* Key pressed ? */
if (SDL_AtariIkbd_keyboard[i]==KEY_PRESSED) {
SDL_PrivateKeyboard(SDL_PRESSED, TranslateKey(i, specialkeys, &keysym));
SDL_PrivateKeyboard(SDL_PRESSED,
TranslateKey(i, specialkeys, &keysym, SDL_TRUE));
SDL_AtariIkbd_keyboard[i]=KEY_UNDEFINED;
}

/* Key released ? */
if (SDL_AtariIkbd_keyboard[i]==KEY_RELEASED) {
SDL_PrivateKeyboard(SDL_RELEASED, TranslateKey(i, specialkeys, &keysym));
SDL_PrivateKeyboard(SDL_RELEASED,
TranslateKey(i, specialkeys, &keysym, SDL_FALSE));
SDL_AtariIkbd_keyboard[i]=KEY_UNDEFINED;
}
}
@@ -209,7 +213,8 @@ void AtariIkbd_PumpEvents(_THIS)
}
}

static SDL_keysym *TranslateKey(int scancode, int numkeytable, SDL_keysym *keysym)
static SDL_keysym *TranslateKey(int scancode, int numkeytable, SDL_keysym *keysym,
SDL_bool pressed)
{
unsigned char asciicode;

@@ -236,6 +241,9 @@ static SDL_keysym *TranslateKey(int scancode, int numkeytable, SDL_keysym *keysy

keysym->mod = KMOD_NONE;
keysym->unicode = 0;
if (pressed && (asciicode!=0)) {
keysym->unicode = SDL_AtariToUnicode(asciicode);
}

return(keysym);
}
@@ -44,6 +44,7 @@ static char rcsid =
#include "SDL_gemvideo.h"
#include "SDL_gemevents_c.h"
#include "SDL_atarikeys.h" /* for keyboard scancodes */
#include "SDL_atarievents_c.h"
#include "SDL_xbiosinterrupt_s.h"

/* Defines */
@@ -61,14 +62,16 @@ static SDLKey keymap[ATARIBIOS_MAXKEYS];

/* Functions prototypes */

static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym);
static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym,
SDL_bool pressed);
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, short ks);

/* Functions */

static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym)
static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym,
SDL_bool pressed)
{
/* Set the keysym information */
keysym->scancode = scancode;
@@ -80,6 +83,9 @@ static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym)

keysym->mod = KMOD_NONE;
keysym->unicode = 0;
if (pressed && (asciicode!=0)) {
keysym->unicode = SDL_AtariToUnicode(asciicode);
}

return(keysym);
}
@@ -205,11 +211,13 @@ void GEM_PumpEvents(_THIS)
for (i=0; i<ATARIBIOS_MAXKEYS; i++) {
/* Key pressed ? */
if (gem_currentkeyboard[i] && !gem_previouskeyboard[i])
SDL_PrivateKeyboard(SDL_PRESSED, TranslateKey(i, gem_currentascii[i], &keysym));
SDL_PrivateKeyboard(SDL_PRESSED,
TranslateKey(i, gem_currentascii[i], &keysym, SDL_TRUE));

/* Key unpressed ? */
if (gem_previouskeyboard[i] && !gem_currentkeyboard[i])
SDL_PrivateKeyboard(SDL_RELEASED, TranslateKey(i, gem_currentascii[i], &keysym));
SDL_PrivateKeyboard(SDL_RELEASED,
TranslateKey(i, gem_currentascii[i], &keysym, SDL_FALSE));
}

memcpy(gem_previouskeyboard,gem_currentkeyboard,sizeof(gem_previouskeyboard));

0 comments on commit 634bb0c

Please sign in to comment.