XGM driver hangs during fades
Moderator: Stef
XGM driver hangs during fades
Whenever there's a fade, or just a loop of "for (i = 0; i < 180; i++) VDP_waitVSync();", the XGM driver just plays one note, as if it's stuck. Known issue? Any workarounds?
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: XGM driver hangs during fades
Weird issue, the only reason the XGM driver could hangs is that Z80 is interrupted for some reason.
Do you have a simple example as i already used fade and waitVsync() without problems.
Do you have a simple example as i already used fade and waitVsync() without problems.
Re: XGM driver hangs during fades
Taking a closer look, it's not waitVsync(), but just the fade. It happens in multiple emulators.
This code is enough to show the issue. I'll try to make a distributable sample if you can't reproduce.
When I comment out the fades, the second time also plays properly.
Code: Select all
SND_startPlay_XGM(sample);
for (i = 0; i < 180; i++) VDP_waitVSync(); // the first time, this short song plays properly
VDP_fadeIn(1, 15, intropal, 30, 0); // during the fade, the first note hangs. After the fade it continues normally
When I comment out the fades, the second time also plays properly.
Re: XGM driver hangs during fades
Is it perhaps because the fade disables interrupts, and XGM does some processing in vint?
Code: Select all
// process asynchrone fading
if (async) VIntProcess |= PROCESS_PALETTE_FADING;
// process fading immediatly
else
{
// disable interrupts to avoid VDP accesses conflict
SYS_disableInts();
while (VDP_doStepFading(TRUE));
SYS_enableInts();
}
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: XGM driver hangs during fades
Yeah it could be a problem as indeed VInt is used to define the XGM tempo... but normally as soon you re-enabled interrupt the VInt should happen immediately, also interrupts are never disabled for more than 1 frame so you shouldn't miss them. I will try to reproduce the issue and fix it.
In the meantime, just try to change your code that way :
That should be enough to fix your issue.
Edit: You're right, the problem occurs... i'm surprised that i never noticed it before !
In the meantime, just try to change your code that way :
Code: Select all
VDP_fadeIn(1, 15, intropal, 30, TRUE);
VDP_waitFadeCompletion();
Edit: You're right, the problem occurs... i'm surprised that i never noticed it before !
Re: XGM driver hangs during fades
Do you plan to fix this on the xgm side, by allowing interrupts during fades, or by allowing interrupts + clearing the pointers during the fade?
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: XGM driver hangs during fades
The problem is not on XGM side and i fixed it, will work fine in next version.
The problem was that i was disabling Interrupt during all the fading process which is something i shouldn't do ! Now interrupts are disabled only when i'm writing to the VDP
The problem was that i was disabling Interrupt during all the fading process which is something i shouldn't do ! Now interrupts are disabled only when i'm writing to the VDP
Re: XGM driver hangs during fades
I don't see it on github?
It's perfectly fine for master to be broken, or you could use a different branch if it's invasive. There are many people waiting for this new version, even if it's broken right now, please share the code.
It's perfectly fine for master to be broken, or you could use a different branch if it's invasive. There are many people waiting for this new version, even if it's broken right now, please share the code.
Re: XGM driver hangs during fades
Stef, can you post the patch somewhere? I'd like to keep my sgdk in sync with the official fix, and I'd need this to work.
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: XGM driver hangs during fades
Oh sorry cero, i missed your last message. I will try to push on github when i will get back to home (in few hours). Sprite Engine is currently broken in my wip version so you may take only the fix you need (as vdp_pal.c for the fading part and XGM driver related stuff).
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: XGM driver hangs during fades
I updated vdp_pal.c and vdp_pal.h on github, i can't really update others parts, too much broken stuff :p
Re: XGM driver hangs during fades
Thanks. master doesn't build due to multiple issues with vram.c, but I could just pull the relevant commits. I confirm the XGM issue is fixed.
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: XGM driver hangs during fades
Yeah i need to add new commits but then i believe others issues will appears. Anyway it would be better as many people reported me issues which has been already fixed