Skip to content

Conversation

@glebm
Copy link
Collaborator

@glebm glebm commented May 17, 2025

This unifies a lot of the code between the MPQ and UNPACKED_MPQS versions, so we actually end up with less code as a result.

@glebm glebm requested a review from AJenbo May 17, 2025 06:00
@glebm glebm enabled auto-merge (rebase) May 17, 2025 06:01
@glebm glebm force-pushed the mods-unpk branch 3 times, most recently from 6079931 to 45e55a4 Compare May 17, 2025 06:46
glebm added 2 commits May 17, 2025 07:47
We no longer use exceptions anywhere in the codebase
Now that Amiga is on GCC 13, we no longer need this.
@glebm
Copy link
Collaborator Author

glebm commented May 17, 2025

I have no idea why the Amiga build fails to link 🤔

/opt/m68k-amigaos/lib/gcc/m68k-amigaos/13.2.0/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx_init.dir/init.cpp.obj:(.text._ZN10devilution12_GLOBAL__N_115AssetContentsEqEONS_8AssetRefESt17basic_string_viewIcSt11char_traitsIcEE.constprop.0+0x26): undefined reference to devilution::MpqArchive::GetUnpackedFileSize(unsigned int, int&)' /opt/m68k-amigaos/lib/gcc/m68k-amigaos/13.2.0/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx_init.dir/init.cpp.obj:(.text._ZN10devilution22AreExtraFontsOutOfDateERNS_10MpqArchiveE+0x54): undefined reference to devilution::MpqArchive::GetFileNumber(std::array<unsigned int, 3ul>, unsigned int&)'

@glebm
Copy link
Collaborator Author

glebm commented May 17, 2025

The symbol is there but the arguments are unsigned long rather than an unsigned int. Interesting

$ /opt/m68k-amigaos/bin/m68k-amigaos-nm -C mpq_reader.cpp.obj
...
00000000 T devilution::MpqArchive::GetFileNumber(std::array<unsigned long, 3ul>, unsigned long&)
00000000 T devilution::MpqArchive::GetUnpackedFileSize(unsigned long, long&)

vs init.cpp.obj:

$ /opt/m68k-amigaos/bin/m68k-amigaos-nm -C libdevilutionx_init.dir/init.cpp.obj
...
         U devilution::MpqArchive::GetFileNumber(std::array<unsigned int, 3ul>, unsigned int&)
         U devilution::MpqArchive::GetUnpackedFileSize(unsigned int, int&)

@StephenCWills
Copy link
Member

StephenCWills commented May 18, 2025

It's because you included SDL.h before cstdint.

root@4e48afd807d8:~# cat test-nosdl.cpp
#include <cstdint>

void test(uint32_t *num) { num = 0; }

int main()
{
    uint32_t num;
    test(&num);
    return num;
}
root@4e48afd807d8:~# g++ -c test-nosdl.cpp 
root@4e48afd807d8:~# m68k-amigaos-nm -C test-nosdl.o
00000000 T test(unsigned long*)
0000000e T main
root@4e48afd807d8:~# cat test-sdl.cpp 
#include <SDL.h>
#include <cstdint>

void test(uint32_t *num) { num = 0; }

int main()
{
    uint32_t num;
    test(&num);
    return num;
}
root@4e48afd807d8:~# g++ -c test-sdl.cpp 
root@4e48afd807d8:~# m68k-amigaos-nm -C test-sdl.o
00000000 T test(unsigned int*)
0000000e T main

@glebm
Copy link
Collaborator Author

glebm commented May 18, 2025

Thanks! I remember encountering a similar issue in the past. Need to look into SDL to see why it does that.

@glebm
Copy link
Collaborator Author

glebm commented May 18, 2025

@MBeijer We're using https://github.com/AmigaPorts/libSDL12, should we be using something else these days?

@glebm glebm merged commit 18070db into diasurgical:master May 18, 2025
24 checks passed
@AJenbo
Copy link
Member

AJenbo commented May 18, 2025

Nice that things could be unified a bit :)

@glebm glebm deleted the mods-unpk branch May 19, 2025 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants