pkowal1982 / godoticon

Godot Icon creator and replacer
MIT License
120 stars 11 forks source link

Export from Linux: replace causes error "Could not find icons in executable. Wrong template?" #2

Closed hsandt closed 1 year ago

hsandt commented 1 year ago

When exporting Windows from Linux and running the replace script on the target exe, I get the error "Could not find icons in executable. Wrong template?"

Godot version: 4.0.2

My bash script:

preset="Windows Desktop"
version_folder="v${version}/Windows"
target="${title}.exe"
# Replace icon scripts are only for Windows executables
replace_icon=true

target_path="Export/$version_folder/$target"

mkdir -p "Export/$version_folder"

godot --no-window --export-release "$preset" "$target_path" --verbose

godot -s "$godoticon_path/CreateIcon.gd" generated_icon.ico icon_16x16.png icon_32x32.png icon_48x48.png icon_64x64.png icon_128x128.png icon_256x256.png
godot -s "$godoticon_path/ReplaceIcon.gd" generated_icon.ico "$target_path"

Output:

Godot Engine v4.0.2.stable.official.7a0977ce2 - https://godotengine.org OpenGL API 3.3.0 NVIDIA 525.105.17 - Compatibility - Using Device: NVIDIA Corporation - NVIDIA GeForce GTX 860M

ERROR: Condition "_first != nullptr" is true. at: ~List (./core/templates/self_list.h:106) WARNING: ObjectDB instances leaked at exit (run with --verbose for details). at: cleanup (core/object/object.cpp:1982) ERROR: Resources still in use at exit (run with --verbose for details). at: clear (core/io/resource.cpp:489) Godot Engine v4.0.2.stable.official.7a0977ce2 - https://godotengine.org OpenGL API 3.3.0 NVIDIA 525.105.17 - Compatibility - Using Device: NVIDIA Corporation - NVIDIA GeForce GTX 860M

Export/vtest/Windows/Godot Project Bootstrap - Compatibility Renderer.exe generated_icon.ico Could not find icons in executable. Wrong template? ERROR: Condition "_first != nullptr" is true. at: ~List (./core/templates/self_list.h:106) WARNING: ObjectDB instances leaked at exit (run with --verbose for details). at: cleanup (core/object/object.cpp:1982) ERROR: Resources still in use at exit (run with --verbose for details).

pkowal1982 commented 1 year ago

It won't work with Godot 4.0.2 official template. Unfortunately in Godot 4 beta 7 executable icon was changed from fixed size to compressed. There's already https://github.com/godotengine/godot/pull/75950 ready which completely replaces rcedit and allows not only icon changing but also description. Please add comment in mentioned PR and also in this thread https://github.com/godotengine/godot/issues/73497 so it will get merged faster.

Workaround is to check out sources from Godot master branch or one of tags, replace icon file with the one produced by IconCreator and compile it by yourself or on GitHub. Template produced this way will work with IconReplacer.

hsandt commented 1 year ago

OK, for now wine + rcedit causes no error (but I don't know if it truly works, I need to test on Windows with a custom icon), so I'll use it and wait for the PR to be merged.

I didn't have extra info to add so I didn't comment (cause we sometimes get scold when we comment just to +1), but I did +1 the first post. I'll be following how it goes.