From 62146dc52311013f352b18e9a0d8267100a50364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lilian=20J=C3=B3nsd=C3=B3ttir?= Date: Thu, 9 Jul 2020 21:35:21 -0700 Subject: [PATCH] initial commit --- .gitignore | 86 ++++++ MWSE/mods/Keyboard Layout Changer/common.lua | 23 ++ MWSE/mods/Keyboard Layout Changer/config.lua | 16 ++ MWSE/mods/Keyboard Layout Changer/keys.lua | 276 +++++++++++++++++++ MWSE/mods/Keyboard Layout Changer/main.lua | 14 + MWSE/mods/Keyboard Layout Changer/mcm.lua | 56 ++++ README.md | 26 ++ 7 files changed, 497 insertions(+) create mode 100644 .gitignore create mode 100644 MWSE/mods/Keyboard Layout Changer/common.lua create mode 100644 MWSE/mods/Keyboard Layout Changer/config.lua create mode 100644 MWSE/mods/Keyboard Layout Changer/keys.lua create mode 100644 MWSE/mods/Keyboard Layout Changer/main.lua create mode 100644 MWSE/mods/Keyboard Layout Changer/mcm.lua diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e5e3127 --- /dev/null +++ b/.gitignore @@ -0,0 +1,86 @@ + +# Created by https://www.toptal.com/developers/gitignore/api/lua,visualstudiocode,windows +# Edit at https://www.toptal.com/developers/gitignore?templates=lua,visualstudiocode,windows + +### Lua ### +# Compiled Lua sources +luac.out + +# luarocks build files +*.src.rock +*.zip +*.tar.gz + +# Object files +*.o +*.os +*.ko +*.obj +*.elf + +# Precompiled Headers +*.gch +*.pch + +# Libraries +*.lib +*.a +*.la +*.lo +*.def +*.exp + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# End of https://www.toptal.com/developers/gitignore/api/lua,visualstudiocode,windows diff --git a/MWSE/mods/Keyboard Layout Changer/common.lua b/MWSE/mods/Keyboard Layout Changer/common.lua new file mode 100644 index 0000000..bdd6005 --- /dev/null +++ b/MWSE/mods/Keyboard Layout Changer/common.lua @@ -0,0 +1,23 @@ +local keys = require("Keyboard Layout Changer.keys") +local supportedLayouts = "" +for name, _ in pairs(keys) do + supportedLayouts = supportedLayouts .. name .. " " +end + +local this = {} + +this.modName = "Keyboard Layout Changer" +this.author = "Celediel" +this.version = "1.0.0" +this.configString = string.gsub(this.modName, "%s+", "") +this.modInfo = "Allows use of non-qwerty keyboard layouts.\n\nCurrently supported:\n" .. supportedLayouts + +function this.log(str) mwse.log("[%s] %s", this.modName, str) end + +function this.changeLayout(keys) + -- Thanks NullCascade + mwse.memory.writeBytes({address = 0x775148, bytes = keys.lowercase}) + mwse.memory.writeBytes({address = 0x775248, bytes = keys.uppercase}) +end + +return this \ No newline at end of file diff --git a/MWSE/mods/Keyboard Layout Changer/config.lua b/MWSE/mods/Keyboard Layout Changer/config.lua new file mode 100644 index 0000000..2aa7b02 --- /dev/null +++ b/MWSE/mods/Keyboard Layout Changer/config.lua @@ -0,0 +1,16 @@ +local common = require("Keyboard Layout Changer.common") + +local this = {} + +local currentConfig + +this.default = { + keyboardLayout = "qwerty" +} + +function this.getConfig() + currentConfig = currentConfig or mwse.loadConfig(common.configString, this.default) + return currentConfig +end + +return this diff --git a/MWSE/mods/Keyboard Layout Changer/keys.lua b/MWSE/mods/Keyboard Layout Changer/keys.lua new file mode 100644 index 0000000..fa2b34a --- /dev/null +++ b/MWSE/mods/Keyboard Layout Changer/keys.lua @@ -0,0 +1,276 @@ +return { + ["dvorak"] = { + lowercase = { + 0x20, 0x1b, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, + 0x30, 0x5b, 0x5d, 0x08, 0x09, 0x27, 0x2c, 0x2e, 0x70, 0x79, 0x66, + 0x67, 0x63, 0x72, 0x6c, 0x2f, 0x3d, 0x0d, 0x20, 0x61, 0x6f, 0x65, + 0x75, 0x69, 0x64, 0x68, 0x74, 0x6e, 0x73, 0x2d, 0x60, 0x20, 0x5c, + 0x3b, 0x71, 0x6a, 0x6b, 0x78, 0x62, 0x6d, 0x77, 0x76, 0x7a, 0x20, + 0x2a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2d, 0x20, 0x20, + 0x20, 0x2b, 0x20, 0x20, 0x20, 0x20, 0x7f, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, + 0x20, 0x20, 0x40, 0x3a, 0x5f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x0d, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x2c, 0x20, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20 + }, + uppercase = { + 0x20, 0x1b, 0x21, 0x40, 0x23, 0x24, 0x25, 0x5e, 0x26, 0x2a, 0x28, + 0x29, 0x7b, 0x7d, 0x08, 0x09, 0x22, 0x3c, 0x3e, 0x50, 0x59, 0x46, + 0x47, 0x43, 0x52, 0x4c, 0x3f, 0x2b, 0x0d, 0x20, 0x41, 0x4f, 0x45, + 0x55, 0x49, 0x44, 0x48, 0x54, 0x4e, 0x53, 0x5f, 0x7e, 0x20, 0x7c, + 0x3a, 0x51, 0x4a, 0x4b, 0x58, 0x42, 0x4d, 0x57, 0x56, 0x5a, 0x20, + 0x2a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2d, 0x20, 0x20, + 0x20, 0x2b, 0x20, 0x20, 0x20, 0x20, 0x7f, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, + 0x20, 0x20, 0x40, 0x3a, 0x5f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x0d, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x2c, 0x20, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20 + } + }, + + ["qwerty"] = { + lowercase = { + 0x00, 0x1B, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, + 0x30, 0x2D, 0x3D, 0x08, 0x09, 0x71, 0x77, 0x65, 0x72, 0x74, 0x79, + 0x75, 0x69, 0x6F, 0x70, 0x5B, 0x5D, 0x0D, 0x00, 0x61, 0x73, 0x64, + 0x66, 0x67, 0x68, 0x6A, 0x6B, 0x6C, 0x3B, 0x27, 0x60, 0x00, 0x5C, + 0x7A, 0x78, 0x63, 0x76, 0x62, 0x6E, 0x6D, 0x2C, 0x2E, 0x2F, 0x00, + 0x2A, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2D, 0x00, 0x00, + 0x00, 0x2B, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3D, 0x00, + 0x00, 0x00, 0x40, 0x3A, 0x5F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x2C, 0x00, 0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00 + }, + uppercase = { + 0x00, 0x1B, 0x21, 0x40, 0x23, 0x24, 0x25, 0x5E, 0x26, 0x2A, 0x28, + 0x29, 0x5F, 0x2B, 0x08, 0x09, 0x51, 0x57, 0x45, 0x52, 0x54, 0x59, + 0x55, 0x49, 0x4F, 0x50, 0x7B, 0x7D, 0x0D, 0x00, 0x41, 0x53, 0x44, + 0x46, 0x47, 0x48, 0x4A, 0x4B, 0x4C, 0x3A, 0x22, 0x7E, 0x00, 0x7C, + 0x5A, 0x58, 0x43, 0x56, 0x42, 0x4E, 0x4D, 0x3C, 0x3E, 0x3F, 0x00, + 0x2A, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2D, 0x00, 0x00, + 0x00, 0x2B, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3D, 0x00, + 0x00, 0x00, 0x40, 0x3A, 0x5F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x2C, 0x00, 0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00 + } + }, + + ["colemak"] = { + lowercase = { + 0x20, 0x1b, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, + 0x30, 0x2d, 0x3d, 0x08, 0x09, 0x71, 0x77, 0x66, 0x70, 0x67, 0x6a, + 0x6c, 0x75, 0x79, 0x3b, 0x5b, 0x5d, 0x0d, 0x20, 0x61, 0x72, 0x73, + 0x74, 0x64, 0x68, 0x6e, 0x65, 0x69, 0x6f, 0x27, 0x60, 0x20, 0x5c, + 0x7a, 0x78, 0x63, 0x76, 0x62, 0x6b, 0x6d, 0x2c, 0x2e, 0x2f, 0x20, + 0x2a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2d, 0x20, 0x20, + 0x20, 0x2b, 0x20, 0x20, 0x20, 0x20, 0x7f, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, + 0x20, 0x20, 0x40, 0x3a, 0x5f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x0d, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x2c, 0x20, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20 + }, + uppercase = { + 0x20, 0x1b, 0x21, 0x40, 0x23, 0x24, 0x25, 0x5e, 0x26, 0x2a, 0x28, + 0x29, 0x5f, 0x2b, 0x08, 0x09, 0x51, 0x57, 0x46, 0x50, 0x47, 0x4a, + 0x4c, 0x55, 0x59, 0x3a, 0x7b, 0x7d, 0x0d, 0x20, 0x41, 0x52, 0x53, + 0x54, 0x44, 0x48, 0x4e, 0x45, 0x49, 0x4f, 0x22, 0x7e, 0x20, 0x7c, + 0x5a, 0x58, 0x43, 0x56, 0x42, 0x4b, 0x4d, 0x3c, 0x3e, 0x3f, 0x20, + 0x2a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2d, 0x20, 0x20, + 0x20, 0x2b, 0x20, 0x20, 0x20, 0x20, 0x7f, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, + 0x20, 0x20, 0x40, 0x3a, 0x5f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x0d, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x2c, 0x20, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20 + } + }, + + ["workman_us"] = { + lowercase = { + 0x20, 0x1b, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, + 0x30, 0x2d, 0x3d, 0x08, 0x09, 0x71, 0x64, 0x72, 0x77, 0x62, 0x6a, + 0x66, 0x75, 0x70, 0x3b, 0x5b, 0x5d, 0x0d, 0x20, 0x61, 0x73, 0x68, + 0x74, 0x67, 0x79, 0x6e, 0x65, 0x6f, 0x69, 0x27, 0x60, 0x20, 0x5c, + 0x7a, 0x78, 0x6d, 0x63, 0x76, 0x6b, 0x6c, 0x2c, 0x2e, 0x2f, 0x20, + 0x2a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2d, 0x20, 0x20, + 0x20, 0x2b, 0x20, 0x20, 0x20, 0x20, 0x7f, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, + 0x20, 0x20, 0x40, 0x3a, 0x5f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x0d, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x2c, 0x20, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20 + }, + uppercase = { + 0x20, 0x1b, 0x21, 0x40, 0x23, 0x24, 0x25, 0x5e, 0x26, 0x2a, 0x28, + 0x29, 0x5f, 0x2b, 0x08, 0x09, 0x51, 0x44, 0x52, 0x57, 0x42, 0x4a, + 0x46, 0x55, 0x50, 0x3a, 0x7b, 0x7d, 0x0d, 0x20, 0x41, 0x53, 0x48, + 0x54, 0x47, 0x59, 0x4e, 0x45, 0x4f, 0x49, 0x22, 0x7e, 0x20, 0x7c, + 0x5a, 0x58, 0x4d, 0x43, 0x56, 0x4b, 0x4c, 0x3c, 0x3e, 0x3f, 0x20, + 0x2a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2d, 0x20, 0x20, + 0x20, 0x2b, 0x20, 0x20, 0x20, 0x20, 0x7f, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, + 0x20, 0x20, 0x40, 0x3a, 0x5f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x0d, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x2c, 0x20, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20 + } + }, + + ["workman_uk"] = { + lowercase = { + 0x20, 0x1b, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, + 0x30, 0x2d, 0x3d, 0x08, 0x09, 0x71, 0x64, 0x72, 0x77, 0x62, 0x6a, + 0x66, 0x75, 0x70, 0x3b, 0x5b, 0x5d, 0x0d, 0x20, 0x61, 0x73, 0x68, + 0x74, 0x67, 0x79, 0x6e, 0x65, 0x6f, 0x69, 0x27, 0x60, 0x20, 0x23, + 0x7a, 0x78, 0x6d, 0x63, 0x76, 0x6b, 0x6c, 0x2c, 0x2e, 0x2f, 0x20, + 0x2a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2d, 0x20, 0x20, + 0x20, 0x2b, 0x20, 0x20, 0x20, 0x20, 0x7f, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, + 0x20, 0x20, 0x40, 0x3a, 0x5f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x0d, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x2c, 0x20, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20 + }, + uppercase = { + 0x20, 0x1b, 0x21, 0x22, 0xa3, 0x24, 0x25, 0x5e, 0x26, 0x2a, 0x28, + 0x29, 0x5f, 0x2b, 0x08, 0x09, 0x51, 0x44, 0x52, 0x57, 0x42, 0x4a, + 0x46, 0x55, 0x50, 0x3a, 0x7b, 0x7d, 0x0d, 0x20, 0x41, 0x53, 0x48, + 0x54, 0x47, 0x59, 0x4e, 0x45, 0x4f, 0x49, 0x40, 0xac, 0x20, 0x7e, + 0x5a, 0x58, 0x4d, 0x43, 0x56, 0x4b, 0x4c, 0x3c, 0x3e, 0x3f, 0x20, + 0x2a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2d, 0x20, 0x20, + 0x20, 0x2b, 0x20, 0x20, 0x20, 0x20, 0x7f, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, + 0x20, 0x20, 0x40, 0x3a, 0x5f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x0d, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x2c, 0x20, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20 + } + } +} diff --git a/MWSE/mods/Keyboard Layout Changer/main.lua b/MWSE/mods/Keyboard Layout Changer/main.lua new file mode 100644 index 0000000..83e2061 --- /dev/null +++ b/MWSE/mods/Keyboard Layout Changer/main.lua @@ -0,0 +1,14 @@ +local keys = require("Keyboard Layout Changer.keys") +local common = require("Keyboard Layout Changer.common") +local config = require("Keyboard Layout Changer.config").getConfig() + +local function onInitialized() + common.log("Changing layout to " .. config.keyboardLayout) + common.changeLayout(keys[config.keyboardLayout]) +end + +event.register("initialized", onInitialized) + +event.register("modConfigReady", function() + mwse.mcm.register(require("Keyboard Layout Changer.mcm")) +end) diff --git a/MWSE/mods/Keyboard Layout Changer/mcm.lua b/MWSE/mods/Keyboard Layout Changer/mcm.lua new file mode 100644 index 0000000..d99cd99 --- /dev/null +++ b/MWSE/mods/Keyboard Layout Changer/mcm.lua @@ -0,0 +1,56 @@ +local keys = require("Keyboard Layout Changer.keys") +local common = require("Keyboard Layout Changer.common") +local config = require("Keyboard Layout Changer.config").getConfig() + +local restartMessage = "Restart the game or click the Apply button to apply changes." + +local function createTableVar(id) + return mwse.mcm.createTableVariable({ + id = id, + table = config, + restartRequired = true, + restartRequiredMessage = restartMessage + }) +end + +local function createOptions() + local options = {} + -- I guess I don't know how ipairs works + local i = 1 + for name, _ in pairs(keys) do + options[i] = {label = name:gsub("^%l", string.upper), value = name} + i = i + 1 -- wtf lua + end + return options +end + +local function applyLayout() + tes3.messageBox("Layout changes applied!") + common.log("Changing layout to " .. config.keyboardLayout) + common.changeLayout(keys[config.keyboardLayout]) +end + +local template = mwse.mcm.createTemplate(common.modName) +template:saveOnClose(common.configString, config) + +local page = template:createSideBarPage({ + label = "Sidebar page", + description = string.format("%s v%s by %s\n\n%s\n\n", common.modName, + common.version, common.author, common.modInfo) +}) + +local category = page:createCategory(common.modName) + +category:createDropdown({ + label = "Keyboard layout", + options = createOptions(), + variable = createTableVar("keyboardLayout") +}) + +category:createButton({ + label = "Apply changes", + buttonText = "Apply", + callback = applyLayout +}) + +return template diff --git a/README.md b/README.md index c6bb8e6..0e12677 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,28 @@ # Morrowind-Keyboard-Layout-Changer + +## What it does ## + MWSE Lua mod to allow non-Qwerty keyboard layouts in vanilla engine Morrowind. + +**Currently supported:** + +* Dvorak +* Colemak +* Workman (US and UK varieties) + +## Known Issues ## + +Layouts that use letters outside the standard and extended ASCII tables will remain unsupported, due to the way Morrowind translate key presses to text. + +i.e. Turkish FGĞIOD, Latvian ĄŽERTY + +## Requirements ## +MWSE 2.1 nightly @ [github](https://github.com/MWSE/MWSE) + +## Credits ## +* MWSE Team for MWSE with Lua support +* NullCascade for the initial code snippets I built this mod upon + +## License ## + +MIT License. See LICENSE file. \ No newline at end of file