Closed maximilien-noal closed 3 years ago
There is a bug somewhere in MUS2MID.C, it cannot convert the music to MIDI format and that causes the missing music. I'll try to fix it but i'm no expert in mus/midi formats 😅
Thanks for your answer. Now I know where to look. I'm not an expert either, but I'll try to see if this was introduced in a particular commit related to that file.
Same with v0.2. Seems that new code is indeed required.
It works with PrBoom-plus, and the mus2mid.C and mus2mid.H files there are very close.
OK, I have setup everything to compile FastDoom, well, fast (Windows ME VM + TASM + Open Watcom 1.9).
No debug however, which slows things a lot, I wonder how you do it ?
I don't have to debug the game, just the MUS parser part. I guess I could compile it as a library or command line program...
I'm debugging PrBoom-plus with VSCode under Linux with GDB, the sourcecode is very close, but no dice so far...
What I do to debug is include the header "i_debug.h" and use the functions I_DebugWriteLineString, I_DebugWriteLineInteger and I_DebugWriteLineFixed to see the variables in realtime. Those functions write to the monochrome display (port 0xB0000), so it's possible to view the game in the VGA monitor and see the variables in the monochrome one. It's pretty primitive but works. There are DosBox builds that support that dual monitor configuration, and also you can debug this way with real hardware.
It's also possible to use the DosBox debugger, but I prefer the first method.
Thank you ! I have the DOSBox build in question. That should make things easier.
I have updated the debugging functions in the last commits. They are now much easier to work with, as they behave as the original printf functions. I think these changes will help you debugging a lot 😄
Very nice ! I will try it ASAP. Right now it seems that mus2mid is not the culprit. Rather, the problem seems to be further up in the call stack.
PrBoom! Plus -> W_Init finds 6653 lumps. FastDoom -> W_AddFile finds 2784 lumps. Interesting. Edit: red herring. PrBoom Plus first loads FreeDoom, then prboom.wad, then HACKX.WAD ! The number of lumps found for HACKX.WAD itself is the same.
Ok, I found something.
from s_sound.c
void S_ChangeMusic(int musicnum,
int looping)
{
musicinfo_t *music;
char namebuf[9];
I_Printf("%s", "S_ChangeMusic\n");
if (snd_MusicDevice == snd_none)
return;
if (snd_MusicDevice == snd_Adlib && musicnum == mus_intro)
{
musicnum = mus_introa;
}
music = &S_music[musicnum];
if (mus_playing == music)
{
return;
}
// shutdown old music
S_StopMusic();
// get lumpnum if neccessary
if (!music->lumpnum)
{
I_Printf("D_%s\n", music->name);
sprintf(namebuf, "D_%s", music->name);
I_Printf("lumpnum: %d\n", music->lumpnum);
I_Printf("namebuf: %s\n", namebuf);
music->lumpnum = W_GetNumForName(namebuf);
I_Printf("lumpnum updated: %d\n", music->lumpnum);
}
// load & register it
music->data = (void *)W_CacheLumpNum(music->lumpnum, PU_MUSIC);
music->handle = MUS_RegisterSong(music->data);
// play it
MUS_ChainSong(music->handle, looping ? music->handle : -1);
MUS_PlaySong(music->handle, snd_MusicVolume);
mus_playing = music;
}
The name is not correct. 'D_DM2_TTL' (hardcoded inside S_music) is not found (W_GetNumForName returns -1). If I replace it with 'd_haxttl', the menu music plays !
Now, I need to not hardcode it while still make FastDoom find it...
You're right, the problem lies in the music lump names. FastDoom is only compatible with Vanilla Doom WADs, so the music lumps must have the same names as the original IWAD to work. This is a limitation from the original engine.
I got curious about running Hacx : Twitch 'n Kill inside Chrome/Firefox/Edge thanks to FastDoom + JS-DOS.
Right now I'm testing with regular DOSBox 0.74-3 on Windows 10 x64.
What I found is that while the vanilla DOOM2 IWAD has music & sound with FASTDOOM, and HACK.WAD has music and sound with GZDOOM, HACK.WAD with FASTDOOM has sounds, but no music.
The music is in MIDI format. I'm using the lastest FastDoom release (v7 RC1).
All is attached below:
HACK_IWAD + FastDoom + config file.zip
DOSBox config: default (sblaster = sb16, irq = 7 dma = 1, hdma = 5, SET BLASTER at A220 I7 D1 H5 T6
FastDoom config:
Thank you very much for this very interesting project ! :)