Skip to content

Conversation

pkowal1982
Copy link
Contributor

@pkowal1982 pkowal1982 commented Apr 11, 2023

Using rcedit is little problematic so I've created a POC which shows how it can be dropped.
PR contains only crucial code, if it's decided to go this way I'll fix loose ends.
For now code drops old resources section and replaces it with brand new created from scratch.
Questions which I can think of:

  1. How to test this solution properly?
  2. Do we need to copy anything from original resources?
  3. Is there a minimum set of information which user should provide?
  4. All the editor code regarding rcedit should be probably removed in another dedicated PR?

@Calinou
Copy link
Member

Calinou commented Apr 11, 2023

All the editor code regarding rcedit should be probably removed in another dedicated PR?

I think the rcedit code should be removed in the same PR, as we don't want to support both approaches at the same time. While we try to preserve compatibility across 4.x, this mainly applies to the API, not the export system.

(Also, it should be possible to create compatibility handlers to automatically update old entries' names in the Windows export presets to the new names.)

@akien-mga
Copy link
Member

All the editor code regarding rcedit should be probably removed in another dedicated PR?

I think the rcedit code should be removed in the same PR, as we don't want to support both approaches at the same time. While we try to preserve compatibility across 4.x, this mainly applies to the API, not the export system.

(Also, it should be possible to create compatibility handlers to automatically update old entries' names in the Windows export presets to the new names.)

I think it's fine to first assess whether this approach is good, before doing the extra work to remove the old. If it's not clear whether this PR wouldn't be merged (it hasn't been reviewed yet), there's no point doing removing the code it's meant to replace.

@sammypanda

This comment was marked as off-topic.

@fire
Copy link
Member

fire commented Jul 17, 2023

I am interested in getting this to work since I export from Linux for Windows.

@Maran23
Copy link
Contributor

Maran23 commented Dec 21, 2023

I also think this is a good idea since it has multiple advantages:

  • No rcedit needed on Windows
  • Project can be exported on Linux or MacOS without using Wine (for this particular feature)

Note: This PR needs a rebase. I would be happy to test this as I always used rcedit in the past.

@pkowal1982
Copy link
Contributor Author

Ok, rebased it so you can test it.

Also fixed a bug introduced here which prevented exporting console template.
Looks like it never worked, probably not too popular feature.

@YuriSizov
Copy link
Contributor

Also fixed a bug introduced here which prevented exporting console template.
Looks like it never worked, probably not too popular feature.

This is incorrect. The official export templates (and the editor executable) are named with the underscore:

image

The name with a period is what is produced by our buildsystem by default, but the actual distribution is renamed. So this code was correct and should not be modified.

@YuriSizov YuriSizov requested a review from a team December 22, 2023 13:38
@pkowal1982
Copy link
Contributor Author

Ok, the ones built on github contained in artifact windows-template.zip are named:
godot.windows.template_release.x86_64.console.exe

Would be nice to change the github workflow probably to be consistent.

@YuriSizov
Copy link
Contributor

@pkowal1982 That's not related to the CI. As I mentioned, that's how the name is generated by the buildsystem. It uses a number of suffixes to differentiate between build options, but those get removed for the official distribution. It may be worth discussing the naming scheme of the official distribution, but in the meantime we should not break the system in favor of CI artifacts which are not supposed to be used in development anyway.

@pkowal1982
Copy link
Contributor Author

Ok, reverted _console -> .console change. Though I think it would be nice
to change the CI workflow in another PR to produce _console named templates.
Now editor built from master does not work smoothly with templates built from the same branch.

Copy link
Contributor

@Maran23 Maran23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now, I can not really test this as I always get Wrong number of icon images..
With the old implementation, I just got a bunch of warnings (that I do not provide icons for all formats) but the modify process worked (and the icon worked in the explorer, not when I opened the properties though).

@Maran23
Copy link
Contributor

Maran23 commented Jan 7, 2024

Tested now with an icon containing all 6 required image formats.
Looks good. I can confirm that the icon and all the metadata is set correctly. Nice!
Results below (Note: My Windows is set to German)

Godot 4.2.1 Godot 4.3.dev (this PR)
image image

I would still recommend that if the icon does not contain all 6 image formats, we just print a warning as before, and continue with the modification.

@AThousandShips AThousandShips changed the title Export: Modify template without rcedit, fix #73497 Export: Modify template without rcedit Jan 7, 2024
@pkowal1982 pkowal1982 force-pushed the icon branch 3 times, most recently from ec94441 to 2886ff8 Compare January 25, 2024 10:52
@pkowal1982
Copy link
Contributor Author

@bruzvg Somehow calling FileAccess::open(p_template_path, FileAccess::READ_WRITE) twice on Windows was returning an error. For Linux it was working.
Resolved the issue and I think it's ready for another try.

Copy link
Member

@bruvzg bruvzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it seems to be working with all architectures, icons and metadata are set correctly.

@KoBeWi KoBeWi modified the milestones: 4.x, 4.5 Jun 4, 2025
@pkowal1982 pkowal1982 force-pushed the icon branch 2 times, most recently from e7b6367 to 15196e1 Compare June 4, 2025 11:33
@akien-mga
Copy link
Member

Tested on Linux and it seems to work great, both for setting the icon and other metadata. Checked the resulting binary with exiftool for metadata (version, product name, etc.) and confirmed that the icon is correct in Dolphin.

I think we can remove the rcedit code too. Is there any way it would still be used currently?

@bruvzg
Copy link
Member

bruvzg commented Jun 4, 2025

I think we can remove the rcedit code too. Is there any way it would still be used currently?

Is there any left, it seems to be removed.

@bruvzg
Copy link
Member

bruvzg commented Jun 4, 2025

I think we can remove the rcedit code too. Is there any way it would still be used currently?

Found few lines related to the editor setting which can be removed, the rest is already gone.

String rcedit_path = EDITOR_GET("export/windows/rcedit");
if (p_preset->get("application/modify_resources") && rcedit_path.is_empty()) {
err += TTR("The rcedit tool must be configured in the Editor Settings (Export > Windows > rcedit) to change the icon or app information data.") + "\n";
}

EDITOR_DEF_BASIC("export/windows/rcedit", "");
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/windows/rcedit", PROPERTY_HINT_GLOBAL_FILE, "*.exe"));

@akien-mga
Copy link
Member

Yeah it's just a few, I found those:

platform/windows/export/export_plugin.cpp
524:    String tmp_icon_path = EditorPaths::get_singleton()->get_temp_dir().path_join("_rcedit.ico");
735:    String rcedit_path = EDITOR_GET("export/windows/rcedit");
736:    if (p_preset->get("application/modify_resources") && rcedit_path.is_empty()) {
737:            err += TTR("The rcedit tool must be configured in the Editor Settings (Export > Windows > rcedit) to change the icon or app information data.") + "\n";

platform/windows/export/export.cpp
44:     EDITOR_DEF_BASIC("export/windows/rcedit", "");
45:     EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/windows/rcedit", PROPERTY_HINT_GLOBAL_FILE, "*.exe"));
52:     // On non-Windows we need WINE to run rcedit

editor/editor_property_name_processor.cpp
261:    capitalize_string_remaps["rcedit"] = "rcedit";

(The _rcedit.ico one is actually used by the new system, but maybe we can rename it to not refer to rcedit.)

And I guess we can remove the wine editor setting too, unless we use it for anything else:

$ rg '"export/windows/wine"'
platform/windows/export/export.cpp
53:     EDITOR_DEF_BASIC("export/windows/wine", "");
54:     EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/windows/wine", PROPERTY_HINT_GLOBAL_FILE));

@bruvzg
Copy link
Member

bruvzg commented Jun 4, 2025

Yes, wine is not used by anything else, so can be removed, it's only a setting and a capitalize_string_remaps.

EDITOR_DEF_BASIC("export/windows/wine", "");
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/windows/wine", PROPERTY_HINT_GLOBAL_FILE));

@pkowal1982
Copy link
Contributor Author

I've removed the aforementioned rcedit related code in additional commit so it's easier for track.
When ready and approved it'll be squashed.

Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. You can squash the commits and it's ready to merge.

@akien-mga akien-mga merged commit 6b14aa0 into godotengine:master Jun 5, 2025
20 checks passed
@akien-mga
Copy link
Member

Thanks! Amazing work 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compressed godot.ico breaks Godot Icon tool Provide an easier way to change the executable icon for projects exported to Windows