Godot version: 3.2 beta 1
OS/device including version:
Windows 10
Issue description:
Running an executable that was exported with embedded pck fails to run with the following error:
Error: Could not load game data at path '.'. Is the .pck file missing?
Steps to reproduce:
Minimal reproduction project:
@akien-mga, I'll check this more thoroughly later, but for now it'd be helpful knowing if the export templates are signed.
They are signed indeed, but as per #32310 this shouldn't prevent the embedded PCK from working, it should only lose the signature on export.
But maybe @Wavesonics signed the exported binary themselves, in which case it would be a duplicate of #32310.
@akien-mga I did not sign my windows binaries, nor is Code signing is not enabled in my export options.
I went to make a minimal case project for this bug, but may have instead uncovered a different bug: #33549
Ah I think I found the problem. I am using rcedit-x64.exe to change the icon for the Windows exe, that must screw up the signing that @akien-mga is talking about?
In my windows export options I have an icon specified under the Application header.
If I remove that, it runs just fine, presumable because it doesn't run rcedit-x64.exe?
If the issue is the fact that the template is signed, and then this icon program modifies the template, thus invalidating the signature. Are we in "how did this ever work" territory?
rcedit and embedding PCK will break signature and result in corrupted executable, that can't be signed later. But neither shouldn't prevent it from running.rcedit changes are applied after embedding PCK, it won't run (this is most likely the case here).At the very least we should add clear documentation on the export tutorials about limitations of the embedded PCK.
Users are lured in by the "all in one" aspect but there are lots of non-obvious drawbacks to the approach.
Yes, current problems with resource editing and signing could be considered known issues for the time being.
Both can be fixed. I'll work on it the next chance I have.
* If export template is signed (why is it?), both using `rcedit` and embedding PCK will break signature and result in corrupted executable, that can't be signed later. But neither shouldn't prevent it from running.
I disabled signing of export templates as of 3.2 RC 2.
Is there any workaround for using PCK embedding and having a custom icon at the same time?
There's a potential megahack: tampering the current icon image data in the file with the one you want to use.
You can replace the icon with rcedit in the export template itself, so that it's already good before exporting with embedded PCK.
You can replace the icon with rcedit in the export template itself, so that it's already good before exporting with embedded PCK.
Much better. :)
You can replace the icon with rcedit in the export template itself, so that it's already good before exporting with embedded PCK.
Not quite sure how you do that. Are there instructions somewhere on this strategy ? many thanks. It is true that for non-professionnal gamedevs (speaking for myself), being able to ship one single .exe file does sound more appealing.
@Tsar333 rcedit is a command-line utility you can call manually. Download an executable and run it from a command prompt for instructions.
It is true that for non-professionnal gamedevs (speaking for myself), being able to ship one single .exe file does sound more appealing.
I would really advise distributing a ZIP archive with the executable and PCK for two reasons:
So... what are the constraints now? Because one time I can export an exe with the pck embed in it, but most of the time not. That while I didn't change my export settings. And I've done all the .ico and .png changes.
Ok, this is weird. Although my game works fine in Godot (F5 or F6), when exporting it, there is all sort of weird things happening. Previous mentioned problem, but also game breaking problem.
I have some code in my game to detect if the input is from a keyboard or controller. If it's from the keyboard, certain camera-effects shouldn't be executed. This works fine in Godot itself... and when finally able to export the game, it also does work with the executable... but only for a while.
When I just exported it and tested it, everything worked fine. Now, a few hours later testing it again, the problem occurs again. And I also noticed that the icon image of my executable has changed from the one I made/chose, to the one of Godot again. So what is happening here? Why is the executable fine at first and a few hours later, while doing nothing with it, this happens.
Hope this gets fixed, because if you can't export your game, why bother then.
Edit - so I'm getting closer to the weirdness. Exported it again, everything works fine. I close the executable, then I close Godot, then I launch the executable again... and again the problems occurs. So is there something that isn't being exported that make these problems occur when Godot itself isn't running?
@eyeEmotion If you export your project with a non-embedded PCK then export it again with an embedded PCK, the non-embedded PCK will take priority. This will be fixed by #37937.
As a workaround, remove the PCK file that's next to the exported project executable.
I've done all those things. I've always first removed the old files before exporting the new files.
Removing the "personal" icon in the export seems to help to be able to export the embed pck. But whatever I do, after a while my the game "breaks" some code in trying to execute a function it shouldn't be able to execute. This only happens with the exported file. Don't know if it happens with the Linux/MAC OS version, since I don't have them (although they are available to download on my itch.io game-page.
And it's just a simple code: detect if _input is InputEventKey, set variable either to true or false. That variable is used in another function that will only execute it when it's a controller. So pretty straightforward.
It's just so strange that the first few starts of the executable, this works just fine and then all of a sudden, it doesn't anymore. Even with the seperate exe and pck.
I investigated the use of rcedit recently and encountered this comment which suggests it may no longer be a reliable option.
(I did note that Kaitai Struct does have a PE specification file if anyone wants to code an alternative. ;D )
Most helpful comment
You can replace the icon with rcedit in the export template itself, so that it's already good before exporting with embedded PCK.