It looks like this might actually be a bug in packrom or Uzem's handling of the RomHeader. It works fine when I run the GGHOST.HEX file, but when I run the GGHOST.UZE file, it finds a "true" in the mouse field of the RomHeader structure, and then Uzem is enabling mouse support.
Yep, I checked and the RomHeader structure is defined differently in packrom than it is in uzem! The alignment needs to be the same in both, otherwise things like this will happen, and since different compilers arrange things differently, doing an fread() directly into a C structure means that "packed" alignment should be used for both packrom and uzem.
If the previous behavior relied on a weird unspecified alignment, then "packed" should still be used in both cases, but it also means that dummy pad bytes may need to be inserted between some existing variables to maintain backwards compatibility with the implied unspecified alignment.
The other thing that probably needs to be fixed in packrom is the header should be initialized to all zeros before populating any of the fields.
I'll let Uze decide and apply the correct fix for this.
Ghosty Ghost
Re: Ghosty Ghost
Nice catch again. I have added to uzem the same packing as gconvert. It's funny that for so many games it works fine and some had this issue.
Commited to uzem140 branch.
Commited to uzem140 branch.
Re: Ghosty Ghost
Awesome! I verified that it behaves correctly for me with the native and web build. (I wasn't sure that Clang/LLVM was going to like your Microsoft-specific fix, but Clang/LLVM seems to handle it okay; it just makes me cringe.)uze6666 wrote:Nice catch again. I have added to uzem the same packing as gconvert. It's funny that for so many games it works fine and some had this issue.
Commited to uzem140 branch.
Re: Ghosty Ghost
What's the official way to define the packing in GCC then? I have no problem we change it to GCC statndard. GCC mention they included these pragmas , indeed to provide compatibility to VC++.https://gcc.gnu.org/onlinedocs/gcc/Stru ... agmas.html(I wasn't sure that Clang/LLVM was going to like your Microsoft-specific fix, but Clang/LLVM seems to handle it okay; it just makes me cringe.)
Re: Ghosty Ghost
uze6666 wrote:What's the official way to define the packing in GCC then? I have no problem we change it to GCC statndard. GCC mention they included these pragmas , indeed to provide compatibility to VC++.https://gcc.gnu.org/onlinedocs/gcc/Stru ... agmas.html(I wasn't sure that Clang/LLVM was going to like your Microsoft-specific fix, but Clang/LLVM seems to handle it okay; it just makes me cringe.)
Code: Select all
struct S { short f[3]; } __attribute__((packed));
Re: Ghosty Ghost
http://digitalvampire.org/blog/index.ph ... e__packed/
Besides, the current way works so, if it's not broken let's leave it like that.
Besides, the current way works so, if it's not broken let's leave it like that.
Re: Ghosty Ghost
#pragma pack and __attribute__ ((packed)) do the same "dangerous" thing (which doesn't affect us, because the structure actually needs to be packed, and we aren't dereferencing pointers that are unaligned). If you insist on using #pragma pack, then you should use it like this:uze6666 wrote:http://digitalvampire.org/blog/index.ph ... e__packed/
Besides, the current way works so, if it's not broken let's leave it like that.
Code: Select all
#pragma pack(push, 1) // save current pack setting and set to 1
...
#pragma pack(pop) // return to previous pack setting
(Since this issue ended up not being an issue with Ghosty Ghost, could you please move this entire tangent starting from my "For some reason when I try running your game" post to a new thread in the "Tools, Documentation & Tutorials" section?)