-
-
Notifications
You must be signed in to change notification settings - Fork 20.3k
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
Export: Modify template without rcedit #75950
base: master
Are you sure you want to change the base?
Conversation
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. |
This comment was marked as off-topic.
This comment was marked as off-topic.
I am interested in getting this to work since I export from Linux for Windows. |
I also think this is a good idea since it has multiple advantages:
Note: This PR needs a rebase. I would be happy to test this as I always used |
Ok, rebased it so you can test it. Also fixed a bug introduced here which prevented exporting console template. |
This is incorrect. The official export templates (and the editor executable) are named with the underscore: 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. |
Ok, the ones built on github contained in artifact windows-template.zip are named: Would be nice to change the github workflow probably to be consistent. |
@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. |
Ok, reverted _console -> .console change. Though I think it would be nice |
There was a problem hiding this 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).
ec94441
to
2886ff8
Compare
return; | ||
} | ||
if (p_icon_file->get_16() != IMAGE_COUNT) { | ||
print_error("Wrong number of icon images."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible like with rcedit to also do that operation with just one icon image? Would be nice for backward compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have application/icon_interpolation
option in export settings, which is going to be unused if icon resizing is not implemented. This needs to be resolved.
@KoBeWi What are you thoughts about modifying the template without rcedit? |
This basically reimplements what rcedit does and makes it built-in, no? If it works the same as before then why not I guess. |
And it works on other platforms as well. Currently you need to use Wine on Linux to run rcedit to modify the .exe. Which is annoying for cross platform creation of the game binaries. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- design proposal review: I think it's a great idea
- technical review: unreviewed
- style review: @AThousandShips Can you take a look?
- test plan: untested
String key; | ||
|
||
Vector<uint8_t> save() const; | ||
Vector<uint8_t> &add_length(Vector<uint8_t> &bytes) const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vector<uint8_t> &add_length(Vector<uint8_t> &bytes) const; | |
Vector<uint8_t> &add_length(Vector<uint8_t> &r_bytes) const; |
|
||
Vector<uint8_t> save() const; | ||
StringStructure(); | ||
StringStructure(String p_key, String p_value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StringStructure(String p_key, String p_value); | |
StringStructure(const String &p_key, const String &p_value); |
|
||
uint32_t offset = sizeof(RESOURCE_DIRECTORY_TABLES) + data_entries.size() * ResourceDataEntry::SIZE; | ||
|
||
for (Vector<uint8_t> data_entry : data_entries) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (Vector<uint8_t> data_entry : data_entries) { | |
for (const Vector<uint8_t> &data_entry : data_entries) { |
memcpy(resources.ptrw(), RESOURCE_DIRECTORY_TABLES, sizeof(RESOURCE_DIRECTORY_TABLES)); | ||
|
||
Vector<Vector<uint8_t>> data_entries; | ||
for (Vector<uint8_t> image : p_group_icon.images) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (Vector<uint8_t> image : p_group_icon.images) { | |
for (const Vector<uint8_t> &image : p_group_icon.images) { |
} | ||
} | ||
|
||
for (Vector<uint8_t> data_entry : data_entries) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (Vector<uint8_t> data_entry : data_entries) { | |
for (const Vector<uint8_t> &data_entry : data_entries) { |
print_error("Wrong icon file type."); | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print_error("Wrong icon file type."); | |
return; | |
ERR_FAIL_MSG("Wrong icon file type."); |
print_error("Wrong number of icon images."); | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print_error("Wrong number of icon images."); | |
return; | |
ERR_FAIL_MSG("Wrong number of icon images."); |
Error error; | ||
|
||
Ref<FileAccess> file = FileAccess::open(path, FileAccess::READ, &error); | ||
ERR_FAIL_COND_V(error, ERR_CANT_OPEN); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ERR_FAIL_COND_V(error, ERR_CANT_OPEN); | |
ERR_FAIL_COND_V(error != OK, ERR_CANT_OPEN); |
Be consistent about error check here (you use != OK
below)
|
||
String truncated_path = path + ".truncated"; | ||
Ref<FileAccess> truncated = FileAccess::open(truncated_path, FileAccess::WRITE, &error); | ||
ERR_FAIL_COND_V(error, ERR_CANT_CREATE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ERR_FAIL_COND_V(error, ERR_CANT_CREATE); | |
ERR_FAIL_COND_V(error != OK, ERR_CANT_CREATE); |
|
||
Vector<uint8_t> TemplateModifier::StringTable::save() const { | ||
Vector<uint8_t> bytes = Structure::save(); | ||
for (StringStructure string : strings) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (StringStructure string : strings) { | |
for (const StringStructure &string : strings) { |
Tested on Windows. Using svg icon prints "Wrong icon file type.", using ico generated with GIMP iconify extension, which I'm always using, results in "Wrong number of icon images.". The executables end up without any icon. Both cases worked perfectly before the change. |
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:
and closes Provide an easier way to change the executable icon for projects exported to Windows godot-proposals#1097.