changeset 1209:a55ac374271c

Added preliminary missingtranslation from Atari to Unicode charset
author Patrice Mandin <patmandin@gmail.com>
date Sun, 01 Jan 2006 19:14:11 +0000
parents d90b362628ea
children 8609567ea02f
files src/video/ataricommon/SDL_atarievents.c src/video/ataricommon/SDL_atarievents_c.h src/video/ataricommon/SDL_biosevents.c src/video/ataricommon/SDL_gemdosevents.c src/video/ataricommon/SDL_ikbdevents.c src/video/gem/SDL_gemevents.c
diffstat 6 files changed, 60 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/ataricommon/SDL_atarievents.c	Fri Dec 23 09:40:15 2005 +0000
+++ b/src/video/ataricommon/SDL_atarievents.c	Sun Jan 01 19:14:11 2006 +0000
@@ -127,3 +127,13 @@
 	/* 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;
+}
--- a/src/video/ataricommon/SDL_atarievents_c.h	Fri Dec 23 09:40:15 2005 +0000
+++ b/src/video/ataricommon/SDL_atarievents_c.h	Sun Jan 01 19:14:11 2006 +0000
@@ -44,4 +44,6 @@
 extern void Atari_InitOSKeymap(_THIS);
 extern void Atari_PumpEvents(_THIS);
 
+extern Uint16 SDL_AtariToUnicode(Uint8 caracter);
+
 #endif /* _SDL_ATARI_EVENTS_H_ */
--- a/src/video/ataricommon/SDL_biosevents.c	Fri Dec 23 09:40:15 2005 +0000
+++ b/src/video/ataricommon/SDL_biosevents.c	Sun Jan 01 19:14:11 2006 +0000
@@ -41,6 +41,7 @@
 #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 @@
 /* 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 @@
 	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 @@
 	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 @@
 
 	keysym->mod = KMOD_NONE;
 	keysym->unicode = 0;
+	if (pressed && (asciicode!=0)) {
+		keysym->unicode = SDL_AtariToUnicode(asciicode);
+	}
 
 	return(keysym);
 }
--- a/src/video/ataricommon/SDL_gemdosevents.c	Fri Dec 23 09:40:15 2005 +0000
+++ b/src/video/ataricommon/SDL_gemdosevents.c	Sun Jan 01 19:14:11 2006 +0000
@@ -41,6 +41,7 @@
 #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 @@
 /* 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 @@
 	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 @@
 	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 @@
 
 	keysym->mod = KMOD_NONE;
 	keysym->unicode = 0;
+	if (pressed && (asciicode!=0)) {
+		keysym->unicode = SDL_AtariToUnicode(asciicode);
+	}
 
 	return(keysym);
 }
--- a/src/video/ataricommon/SDL_ikbdevents.c	Fri Dec 23 09:40:15 2005 +0000
+++ b/src/video/ataricommon/SDL_ikbdevents.c	Sun Jan 01 19:14:11 2006 +0000
@@ -41,6 +41,7 @@
 #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 @@
 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 @@
 	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 @@
 	}
 }
 
-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 @@
 
 	keysym->mod = KMOD_NONE;
 	keysym->unicode = 0;
+	if (pressed && (asciicode!=0)) {
+		keysym->unicode = SDL_AtariToUnicode(asciicode);
+	}
 
 	return(keysym);
 }
--- a/src/video/gem/SDL_gemevents.c	Fri Dec 23 09:40:15 2005 +0000
+++ b/src/video/gem/SDL_gemevents.c	Sun Jan 01 19:14:11 2006 +0000
@@ -44,6 +44,7 @@
 #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 @@
 
 /* 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 @@
 
 	keysym->mod = KMOD_NONE;
 	keysym->unicode = 0;
+	if (pressed && (asciicode!=0)) {
+		keysym->unicode = SDL_AtariToUnicode(asciicode);
+	}
 
 	return(keysym);
 }
@@ -205,11 +211,13 @@
 	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));