Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CET crashes when a mod with a number/period in the name and uses the registerHotkey or registerInput is reloaded #946

Open
Norviah opened this issue May 3, 2024 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@Norviah
Copy link

Norviah commented May 3, 2024

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 or registerInput 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 this init.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 delete bindings.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 for registerInput. 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.
@WSSDude
Copy link
Collaborator

WSSDude commented May 31, 2024

Problem is the dot specifically, we use it as a delimiter for IDs. Number shouldn't be an issue I believe. Unsure what could be done atm, bindings.json structure would have to be updated in some way.

@WSSDude WSSDude added the bug Something isn't working label May 31, 2024
@WSSDude WSSDude added the good first issue Good for newcomers label Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants