I am trying to add current XGM driver to my code, but i can't make it work properly.
I copied the sound files keeping all the files unchanged, except some VDP functions replaced with the ones in my code.
I updated my VINT function to look like the one in SGDK in terms of audio and dma, and then i tried to play some sounds.
Playing fx PCM samples is ok at the 4 channels, and also music is fine playing fm and psg. The problem seems to be the PCM samples ni the music. I have tested it with a lot of audio, including samples and music in the XgmPlayer code.
First, the music sounds perfectly in any emulator (Blastem, Exodus and Fusion) except in Gens Kmod, where instead of the music samples, it can be heard just an annoying sound. When a friend tested it in the console, the roms keep black and quiet, no sound and frozen.
Possibly the buggy sound of Kmod can be a clue to discover why the console freezes, when accurate emulators like Blastem and Exodus seems to skip that issue.
Probably something bad happends in XGM load, that makes Kmod evil noise sounds and console to freeze. In Kmod, when i play a music with the sample noise, then if i play a fx sample in channel 1 it sounds perfectly and the noise is not heard while fx sample is running. So it seems not to be a problem of the channel... it is like the music plays the sample using FM6 like an FM, not like PCM (just a crazy theory

I have tested booting the rom just with the basic stuff for playing a music track. I have tested a lot of different codes of console and Z80/Yamaha/Psg booting (including copy pasting SGDK boot), i have tested different GCC versions and different makefiles implementations, but the problem can not be solved.
I have not any idea of what can i do next, because i have tested tons of ways and my knowledge of the Yamaha and Z80 assembler is zero. I do not know if SGDK does something else to the XGM driver, or if XGM driver needs something else from SGDK at a low level that i can not see. Maybe at the Makefile it needs some special action i can not see... I do not know, i triend hundreds of things and i am now completely lost.
I hope Stef or someone else can help me. Thanks.