azihassan / devilutionX

Diablo build for modern operating systems
Other
4 stars 1 forks source link

Audio support #3

Open azihassan opened 1 week ago

azihassan commented 1 week ago

In an attempt to enable audio support, I ran into two issues:

SDL_audiolib compilation errors

These were caused by the fact that it uses keywords instead of symbols for things like "and" or "or" and they don't compile for some reason. After checking it with chatgpt, I decided to circumvent it with:

find /opt/toolchains/dc/kos/devilutionX/build/_deps/sdl_audiolib-src/ -name '*.h' -or -name '*.cpp' | xargs sed -i 's/\bnot\b/!/g' && \
    find /opt/toolchains/dc/kos/devilutionX/build/_deps/sdl_audiolib-src/ -name '*.h' -or -name '*.cpp' | xargs sed -i 's/\bor\b/\|\|/g' && \
    find /opt/toolchains/dc/kos/devilutionX/build/_deps/sdl_audiolib-src/ -name '*.h' -or -name '*.cpp' | xargs sed -i 's/\band\b/\&\&/g'

Thread stack underrun

The game crashes after playing the intro (with sound) due to a thread stack underrun error that happens here. Ignoring this check results in the game playing with sound until the first loading screen, where it crashes with an out-of-memory error.

glebm commented 1 week ago

This is why:

https://github.com/KallistiOS/KallistiOS/blob/495e77fd60d5b09a1ad52a26cd4a7e73cd0d9d51/environ_base.sh#L51

-fno-operator-names disables support for and/or/not. However, and/or/not are part of the C++ and must not be disabled in an SDK that aims to be standards-compatible.

glebm commented 1 week ago

I've sent them a PR https://github.com/KallistiOS/KallistiOS/pull/785

gyrovorbis commented 5 days ago

Absolutely right. Testing right now to make sure we don't have any kos-ports doing anything stupid which relied on that flag...

gyrovorbis commented 5 days ago

Ugh. You guys are like the 4th or so people recently who have overrun the main thread stack, revealing a fundamental shortcoming in KOS... you can configure any thread's stack size... except the built-in one...

For now, go modify this line: https://github.com/KallistiOS/KallistiOS/blob/495e77fd60d5b09a1ad52a26cd4a7e73cd0d9d51/kernel/arch/dreamcast/include/arch/arch.h#L71

Going to open a PR now to do this:

#ifndef THD_KERNEL_STACK_SIZE
#    define THD_KERNEL_STACK_SIZE (64 * 1024)
#endif

So that you guys can gracefully override this default noninvasively when you build KOS...