Skip to content
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

Audio support #3

Open
azihassan opened this issue Sep 27, 2024 · 5 comments
Open

Audio support #3

azihassan opened this issue Sep 27, 2024 · 5 comments

Comments

@azihassan
Copy link
Owner

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
Copy link

glebm commented Oct 3, 2024

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
Copy link

glebm commented Oct 3, 2024

I've sent them a PR KallistiOS/KallistiOS#785

@gyrovorbis
Copy link

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

@gyrovorbis
Copy link

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...

@glebm
Copy link

glebm commented Oct 12, 2024

Thanks @gyrovorbis!

@azihassan azihassan moved this to In progress in Devilutionx Dreamcast port Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In progress
Development

No branches or pull requests

3 participants