Okay, here's peekpoke's raycaster updated to the current sgdk:
raytest8-joe.7z
Found some "weird" things in the current sgdk while doing this... first, there's some obscure timing bug in the VDP functions somewhere. I have to do this to get the demo to work on real hardware:
Code: Select all
void hw_delay()
{
VDP_drawText(" ", 2, 2);
VDP_drawText(" ", 2, 2);
}
int main()
{
char str[16];
textures[0] = 0;
textures[1] = &tex_wood;
textures[2] = &tex_bricks;
textures[3] = &tex_bird;
textures[4] = &tex_bricks2;
hw_delay();
px = 112;
py = 260;
pa = 386;
VDP_setScreenWidth256();
VDP_setHInterrupt(0);
VDP_setHilightShadow(0);
hw_delay();
VDP_setPalette_old(0,palette0);
hw_delay();
BMP_init();
See those hw_delay() calls? All three are needed and MUST be two calls to VDP_drawText() or it fails on real hardware. What you see without any one of them is the screen does a slow fade from black to the gray, and hangs. It's not frozen as you can reset, but it doesn't run. It doesn't show on emulators, only on real hardware.
Next, see that VDP_setPalette_old()? That's called VDP_setPalette() in vdp.h. One or the other needs to be changed to match the other.
Next, in rom_head.c, you have this
Code: Select all
const struct
{
char console[16]; /* Console Name (16) */
char copyright[16]; /* Copyright Information (16) */
char title_local[48]; /* Domestic Name (48) */
char title_int[48]; /* Overseas Name (48) */
char serial[16]; /* Serial Number (2, 14) */
See that "char serial[16];"? It needs to be serial[14]. The rest of the header is two off because of that.
Just minor problems other than the weird VDP issue. The BMP code is much cleaner now than in the old version of sgdk. The main loop in the demo is nice and clean, and it runs at almost the exact same speed as the old devkit.