Skeetendo

’Cause all games were better on the GBC

You are not logged in.

  • Index
  • → Help/Question
  • → [Pokered] Adding new music tracks after Crysaudio integration

#1 2019-11-10 22:38:27

Wild
Member
Registered: 2016-12-30
Post 15/16

[Pokered] Adding new music tracks after Crysaudio integration

Hi everyone, I've been playing around with the dissassembly for a while now and feel pretty comfortable navigating it and writing custom asm.

I just integrated the Crystal sound engine (thanks Dannye and Sanqui) and it's working fine, but I'm having issues when trying to increase the overall number of music tracks in the game.

By default, there are 45 songs, the last being 'Meet Male Trainer'. When adding a new track, so it is 46th in the list of music constants and pointers, it results in only one of the channels of the track being played in a distorted fashion, as if it's being played through a SFX channel. I know the new music track works fine, as if I replace one of the existing tracks it plays normally. If the new 46th entry is pointed to a track that already exists in the game, the same distorted effect happens.

I have looked around in the code extensively and followed the "PlayMusic" routines all the way through, whilst checking to see if the track's pointer has been correctly loaded in bgb's debugger and it all looks fine.

Does anybody have experience of a similar issue or any pointers? Many thanks!

Offline

#2 2019-11-11 06:00:26

Mateo
Member
Registered: 2009-11-25
Post 3,631/3,655

Re: [Pokered] Adding new music tracks after Crysaudio integration

I've been trying to reply all afternoon but the site won't let me post a link to the commit in question somehow.


So anyway, it seems like all we did to make new songs work correctly for Red++ v3 was to open up crysaudio/engine.asm and go down to this part:

_PlayMusic:: ; e8b30
    call OpenSRAMForSound
    ld a, e
    and a
    jp z, _SoundRestart
; load music
    call MusicOff
    ld hl, MusicID
    ld [hl], e ; song number
    inc hl
    ld [hl], d ; MusicIDHi (always $00)

    ld hl, SongTranspositions
    add hl, de
    ld a, [hl] ; XXX Currently unused

and change that last line from "ld a, [hl] ; XXX Currently unused" to "xor a". I haven't dug through enough to figure out why exactly the transposition table seems to be the issue even when expanded with more zeroes for the new songs. It's hacky, but that change seemed to fix it. The additional songs in v3 (such as Mt Moon Square and Abandoned Ship) play normally for me now. Hopefully this helps you too.

Last edited by Mateo (2019-11-11 06:07:53)


I am not very active on this forum. I only pop in from time to time.

Offline

#3 2019-11-13 12:17:12

Wild
Member
Registered: 2016-12-30
Post 16/16

Re: [Pokered] Adding new music tracks after Crysaudio integration

Thanks a lot for your input Mateo, that was all it needed!

I look forward to seeing where Red++ v4 goes :)

Offline

#4 2019-12-21 04:24:50

ChickenMan1231
Member
From: Canada
Registered: 2019-12-05
Post 2/14

Re: [Pokered] Adding new music tracks after Crysaudio integration

Can someone please help me? I'm trying to use pokered but I get this error when I try to use the "make" command:
rgblink -n baserom.sym -o baserom.gbc
usage: rgblink [-t] [-m mapfile] [-n symfile] [-o outfile] [-p pad_value]
[-s symbol] file [...]
make: *** [Makefile:47: baserom.gbc] Error 1

Offline

#5 2019-12-21 05:13:42

Mateo
Member
Registered: 2009-11-25
Post 3,632/3,655

Re: [Pokered] Adding new music tracks after Crysaudio integration

you must have an extremely outdated version if it even requires a baserom at all. The vanilla repo hasn't needed a baserom in years. But if I remember it was a copy of pokemon red named baserom.gbc and placed in the main folder of the repo.


I am not very active on this forum. I only pop in from time to time.

Offline

  • Index
  • → Help/Question
  • → [Pokered] Adding new music tracks after Crysaudio integration

Board footer

Powered by FluxBB