slight refactor
This commit is contained in:
parent
f2e3846fe1
commit
188257cdee
3 changed files with 18 additions and 8 deletions
|
@ -15,16 +15,14 @@ function this.log(str) mwse.log("[%s] %s", this.modName, str) end
|
||||||
|
|
||||||
function this.changedLayout(layout)
|
function this.changedLayout(layout)
|
||||||
local changed = false
|
local changed = false
|
||||||
|
|
||||||
if keys[layout] and (#keys[layout].lowercase == 256 and #keys[layout].uppercase == 256) then
|
if keys[layout] and (#keys[layout].lowercase == 256 and #keys[layout].uppercase == 256) then
|
||||||
-- Thanks NullCascade
|
-- Thanks NullCascade
|
||||||
mwse.memory.writeBytes({address = 0x775148, bytes = keys[layout].lowercase})
|
mwse.memory.writeBytes({address = 0x775148, bytes = keys[layout].lowercase})
|
||||||
mwse.memory.writeBytes({address = 0x775248, bytes = keys[layout].uppercase})
|
mwse.memory.writeBytes({address = 0x775248, bytes = keys[layout].uppercase})
|
||||||
changed = true
|
changed = true
|
||||||
else
|
|
||||||
local message = "Bad keys.lua file, please re-install."
|
|
||||||
this.log(message)
|
|
||||||
tes3.messageBox(string.format("(%s) %s", this.modName, message))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return changed
|
return changed
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,16 @@ local common = require("celediel.Keyboard Layout Changer.common")
|
||||||
local config = require("celediel.Keyboard Layout Changer.config").getConfig()
|
local config = require("celediel.Keyboard Layout Changer.config").getConfig()
|
||||||
|
|
||||||
local function onInitialized()
|
local function onInitialized()
|
||||||
|
local message = ""
|
||||||
|
|
||||||
if common.changedLayout(config.keyboardLayout) then
|
if common.changedLayout(config.keyboardLayout) then
|
||||||
common.log("Changed layout to " .. config.keyboardLayout)
|
message = "Changed layout to " .. config.keyboardLayout
|
||||||
|
else
|
||||||
|
message = "Bad keys.lua file, please re-install."
|
||||||
|
tes3.messageBox(string.format("(%s) %s", common.modName, message))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
common.log(message)
|
||||||
end
|
end
|
||||||
|
|
||||||
event.register("initialized", onInitialized)
|
event.register("initialized", onInitialized)
|
||||||
|
|
|
@ -25,11 +25,16 @@ local function createOptions()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function applyLayout()
|
local function applyLayout()
|
||||||
|
local message = ""
|
||||||
|
|
||||||
if common.changedLayout(config.keyboardLayout) then
|
if common.changedLayout(config.keyboardLayout) then
|
||||||
local message = "Changed layout to " .. config.keyboardLayout
|
message = "Changed layout to " .. config.keyboardLayout
|
||||||
tes3.messageBox(message)
|
else
|
||||||
common.log(message)
|
message = "Bad keys.lua file, length must be 256."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
tes3.messageBox(message)
|
||||||
|
common.log(message)
|
||||||
end
|
end
|
||||||
|
|
||||||
local template = mwse.mcm.createTemplate(common.modName)
|
local template = mwse.mcm.createTemplate(common.modName)
|
||||||
|
|
Loading…
Add table
Reference in a new issue