[PATCH 3/8] Set NVRAM language & layout based on config variables

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


---
 src/configuration.c          | 5 +++++
 src/falcon/nvram.c           | 7 ++++++-
 src/includes/configuration.h | 2 ++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/configuration.c b/src/configuration.c
index 15daca88..26fa05f7 100644
--- a/src/configuration.c
+++ b/src/configuration.c
@@ -36,6 +36,7 @@ const char Configuration_fileid[] = "Hatari configuration.c";
 #include "joy.h"
 #include "falcon/crossbar.h"
 #include "stMemory.h"
+#include "tos.h"
 
 
 CNF_PARAMS ConfigureParams;                 /* List of configuration for the emulator */
@@ -195,6 +196,8 @@ static const struct Config_Tag configs_Keyboard[] =
 {
 	{ "bDisableKeyRepeat", Bool_Tag, &ConfigureParams.Keyboard.bDisableKeyRepeat },
 	{ "nKeymapType", Int_Tag, &ConfigureParams.Keyboard.nKeymapType },
+	{ "nKbdLayout", Int_Tag, &ConfigureParams.Keyboard.nKbdLayout },
+	{ "nLanguage", Int_Tag, &ConfigureParams.Keyboard.nLanguage },
 	{ "szMappingFileName", String_Tag, ConfigureParams.Keyboard.szMappingFileName },
 	{ NULL , Error_Tag, NULL }
 };
@@ -620,6 +623,8 @@ void Configuration_SetDefault(void)
 	/* Set defaults for Keyboard */
 	ConfigureParams.Keyboard.bDisableKeyRepeat = false;
 	ConfigureParams.Keyboard.nKeymapType = KEYMAP_SYMBOLIC;
+	ConfigureParams.Keyboard.nKbdLayout = TOS_LANG_UNKNOWN;
+	ConfigureParams.Keyboard.nLanguage = TOS_LANG_UNKNOWN;
 	strcpy(ConfigureParams.Keyboard.szMappingFileName, "");
   
 	/* Set defaults for Shortcuts */
diff --git a/src/falcon/nvram.c b/src/falcon/nvram.c
index 89240db7..9432c58d 100644
--- a/src/falcon/nvram.c
+++ b/src/falcon/nvram.c
@@ -60,6 +60,7 @@ const char NvRam_fileid[] = "Hatari nvram.c";
 #include "log.h"
 #include "nvram.h"
 #include "paths.h"
+#include "tos.h"
 #include "vdi.h"
 
 // Defs for NVRAM control register A (10) bits
@@ -302,9 +303,13 @@ void NvRam_Init(void)
 			nvram[NVRAM_VMODE2] &= ~0x10;		// TV/RGB mode
 			nvram[NVRAM_VMODE2] |= 0x20;		// 50 Hz
 		}
-		NvRam_SetChecksum();
 	}
+	if (ConfigureParams.Keyboard.nLanguage != TOS_LANG_UNKNOWN)
+		nvram[NVRAM_LANGUAGE] = ConfigureParams.Keyboard.nLanguage;
+	if (ConfigureParams.Keyboard.nKbdLayout != TOS_LANG_UNKNOWN)
+		nvram[NVRAM_KEYBOARDLAYOUT] = ConfigureParams.Keyboard.nKbdLayout;
 
+	NvRam_SetChecksum();
 	NvRam_Reset();
 }
 
diff --git a/src/includes/configuration.h b/src/includes/configuration.h
index a400e2c8..8d220655 100644
--- a/src/includes/configuration.h
+++ b/src/includes/configuration.h
@@ -102,6 +102,8 @@ typedef struct
 {
   bool bDisableKeyRepeat;
   KEYMAPTYPE nKeymapType;
+  int nKbdLayout;
+  int nLanguage;
   char szMappingFileName[FILENAME_MAX];
 } CNF_KEYBOARD;
 
-- 
2.30.2


--------------C9D85C665CB14AB33C38696A
Content-Type: text/x-patch; charset=UTF-8;
 name="0002-Add-TOS-language-kbd-layout-country-code-defines.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename*0="0002-Add-TOS-language-kbd-layout-country-code-defines.patch"



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/