Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sprite drawing crash #3

Open
Lion-Lawliet opened this issue Jun 11, 2023 · 2 comments
Open

Sprite drawing crash #3

Lion-Lawliet opened this issue Jun 11, 2023 · 2 comments

Comments

@Lion-Lawliet
Copy link

I replaced the display_sprites routine to draw four sprites on the screen, three are static and one moves around based on the Hw32xGetTicks value. However, strangely in the current version, the code crashes whenever the sprite crosses the screen boundaries, either horizontally or vertically.

Using Gens KMod, the horizontal crash seems to happen on address $06000B5C (it also causes the emulator to CTD) and the vertical crash seems to happen on address $06000BCC. Using a decompiler, I figured out that the issue seems to lie on the PIX_LOOP routines, the counter seems to underflow.

Thank you for the attention!

@viciious
Copy link
Owner

I don't think I'll be able to help you without seeing the actual code

@Lion-Lawliet
Copy link
Author

Lion-Lawliet commented Jun 11, 2023

My bad, friend! Just one thing to add, I thought this crash was happening due to my modifications but I can replicate this on a fresh/clean source by replacing display_sprites with this:

void display_sprites(int l, void *p)
{
    int start = Hw32xGetTicks();

    draw_setScissor(0, 0, 320, 224);

    if (sprmode >= 0)
    {
        int mode = DRAWSPR_OVERWRITE|DRAWSPR_MULTICORE;
        if (sprmode <= 3)
            mode |= sprmode | DRAWSPR_PRECISE;
        else
            mode |= (sprmode - 4);
                draw_sprite(start, 0 + 16, 32, 32, 64, test32x32_trans_smileData, DRAWSPR_OVERWRITE | mode);
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants