doomhack / GBADoom

A port of prBoom to the Nintendo GBA.
182 stars 25 forks source link

2.2 Problems #27

Closed Kippykip closed 2 years ago

Kippykip commented 2 years ago

Hey Doomhack, just gave the new 2.2 build a try, although I noticed the sound isn't working at all (just a bunch of clicking sounds), and also some of the weapon sprites are glitching? I took a video. https://user-images.githubusercontent.com/33023808/146653177-cafc72a6-8eff-446d-bb79-f43de882f189.mp4

Otherwise the high detail mode looks pretty epic otherwise

doomhack commented 2 years ago

I've just noticed this too! You are on it KippyKip!

Kippykip commented 2 years ago

I've just noticed this too! You are on it KippyKip!

I got this project on email alerts baby 😄 Btw I forgot to check, does the high quality setting save?

doomhack commented 2 years ago

No it won't save.

I need to check if the game settings are stored at the start or end of SRAM as if I saved them at the start I have a backward compatibility issue....

doomhack commented 2 years ago

Got no idea what is breaking the sound though.

I think I'm going to have to do a commit by commit bi-sect. Oh joy.

doomhack commented 2 years ago

So. Heres where we are.

The commit that uses the original iD Zone allocator screws up the sound. I think it's because maxmod is calling malloc to grab some EWRAM and not getting any as we've already allocated it all.

Can test this by only grabbing 200kb and seeing if the music works again.

Kippykip commented 2 years ago

It seems to be somewhere in between "Code tidy. Fix some warnings." (works) and the "Unused globals" commit (breaks). I'm still narrowing them down tho

Kippykip commented 2 years ago

So. Heres where we are.

The commit that uses the original iD Zone allocator screws up the sound. I think it's because maxmod is calling malloc to grab some EWRAM and not getting any as we've already allocated it all.

Can test this by only grabbing 200kb and seeing if the music works again.

oh nevermind, now you're on it lol

doomhack commented 2 years ago

Yes, if we change the Zone allow to only 200kb then the music works again.

If we look here: https://github.com/devkitPro/maxmod/blob/master/source_gba/mm_init_default.s

MaxMod is calling malloc and then not checking the result of the alloc so it is corrupting memory.

We can fix this by using the mmInit call and supplying mix buffers ourselves. The catch here is that an iwram mixbuffer is already created so we want to use that rather than waste iwram by allocating another buffer.

doomhack commented 2 years ago

2.3 should work now!