CyberEngineTweaks
CyberEngineTweaks copied to clipboard
CET crashes when a mod with a number/period in the name and uses the `registerHotkey` or `registerInput` is reloaded
Bug
Operating system: Windows 10 Game version: v2.12a CET version: v1.32.2 GPU: RTX 3090 Founders Edition
Description
The title is quite a mouthful, so to be clear, CET crashes when a mod that has these conditions is reloaded:
- has a number/period in the title
- uses the
registerHotkey
orregisterInput
function
It looks like whenever CET reloads a mod with the above conditions, it will crash and prevent CET menu from working for future launches, forcing the user to delete bindings.json
to cause CET to re-prompt for a menu key.
I'm certain that the issue is with these functions as I reloaded the mod many times yesterday and nothing happened, but the second I reload while using these functions the game crashes.
I'm not sure if this is important but may be some pointer to the problem, when the mod has 2.0
in the folder, the mod appears first in the keybindings menu, without 2.0
it normally appears alphabetically.
Expected behaviour
The expected behavior when reloading a mod that has the mentioned conditions is for it to reload normally to reflect any new changes in the file.
Reproduction
- Have a mod with a number and period in it, for example, the mod I'm working on is called
WalkByDefault2.0
with only thisinit.lua
file, and start the game. On Start, everything works as expected, all mods are loaded and the CET menu works.
init.lua
registerInput('walk_by_default', 'Toggle Walking', function(keypress)
if not keypress then
Game.GetPlayer():ProcessToggleWalkInput()
end
end)
registerForEvent('onInit', function()
ObserveAfter('activityLogGameController', 'OnInitialize', function()
Game.GetPlayer():ProcessToggleWalkInput()
end)
ObserveAfter('PlayerPuppet', 'OnGameAttached', function()
Game.GetPlayer():ProcessToggleWalkInput()
end)
end)
- Reload all mods, crashes the game with a crash report menu.
- Restart the game, CET menu no longer works, close the game.
- Delete
bin/x64/plugins/cyber_engine_tweaks/bindings.json
to make CET prompt for a menu key again (I am using the home button), then restart the game. - Once the game starts, CET prompts me for a key and works, mods are loaded and the menu works. I exit the game in the main menu and a crash report pops up.
- Restart the game and the menu doesn't work anymore, close game and delete
bindings.json
again, restart game. Rebind the menu key then I reload all mods again, crashes again with report menu. - Rename the mod file to
WalkByDefault
then restart the game. The CET menu key doesn't work, so close game (crash menu pops up) and deletebindings.json
again. - Once game starts, set CET menu key and reload all mods. Does not crash anymore.
- Restart the game to test the CET menu key and it works.
- Close the game and rename the mod's folder to
WalkByDefault2.0
. In the file, comment out all lines forregisterInput
. Mine looks like this.
-- registerInput('walk_by_default', 'Toggle Walking', function(keypress)
-- if not keypress then
-- Game.GetPlayer():ProcessToggleWalkInput()
-- end
-- end)
registerForEvent('onInit', function()
ObserveAfter('activityLogGameController', 'OnInitialize', function()
Game.GetPlayer():ProcessToggleWalkInput()
end)
ObserveAfter('PlayerPuppet', 'OnGameAttached', function()
Game.GetPlayer():ProcessToggleWalkInput()
end)
end)
- Restart game and then reload all mods, works as expected. In the file, uncomment the
registerInput
lines. Reload all mods and it will crash with a report menu (I must say that I had to reload mods twice, the first time it reloaded without crashing). - Restart the game and CET menu key no longer works.