rsubtil / controller_icons

Automatic keyboard/mouse/controller icons and remapper for Godot.
https://godotengine.org/asset-library/asset/1429
MIT License
261 stars 18 forks source link

Showing an action that uses certain symbols will crash the game #106

Closed TacticalLaptopBag closed 1 month ago

TacticalLaptopBag commented 1 month ago

In my game, players can press , (Comma) to perform a certain action. Trying to show this as a key hint using this plugin simply results in the game crashing.

Here's a list of symbols I've been able to replicate this crash with:

Using any of these symbols results in the following error:

E 0:00:00:0454   ControllerIconTexture.gd:367 @ _stitch_texture(): Invalid image: null
  <C++ Error>    Condition "p_image.is_null()" is true. Returning: Ref<ImageTexture>()
  <C++ Source>   scene/resources/image_texture.cpp:76 @ create_from_image()
  <Stack Trace>  ControllerIconTexture.gd:367 @ _stitch_texture()
                 ControllerIconTexture.gd:379 @ _get_rid()

Reading the error message, it just looks like the icons are missing from the keyboard icon set. I can probably learn how the icons were made and contribute some icons to the pack, if necessary.

Interestingly, this error happens even if the shown key is not one of these symbols. For example, I use a Dvorak keyboard, and where , is on QWERTY, it should show W. However, it instead throws the error above. It does display the correct key if I use other keys, though, so I'm not sure what could cause this since it shouldn't be looking for , when displaying W.

TacticalLaptopBag commented 1 month ago

I added these symbols in with #107. Once that is merged, this can be closed.

rsubtil commented 1 month ago

Thank you for your contribution! This crash should also be fixed by #105.

Interestingly, this error happens even if the shown key is not one of these symbols. For example, I use a Dvorak keyboard, and where , is on QWERTY, it should show W. However, it instead throws the error above. It does display the correct key if I use other keys, though, so I'm not sure what could cause this since it shouldn't be looking for , when displaying W.

This addon parses physical input keys if defined in the project (which I think now is the default on Godot 4). So this is expected behavior; on a QWERTY keyboard, it displays W, and on a DVORAK keyboard, it shows ,.

If this is not what you intend, you need to change the input action in your project to a non-physical key.