Page 1 of 1

gskit bugs(minor)

Posted: Sat May 06, 2006 8:27 am
by ubergeek42
not sure if this is the right place to post, but here goes.

first off i really appreciate the work being put into gsKit, it is really nice to have.

anyways, the bugs i have found so far involve fontm support. first when using \n in a string the next line is always 26.0f, i think multiplying by scale would solve this problem maybe?

secondly, sometimes when using sprintf to put a number in a string, it instead displays a letter, like 4 shows a 'u'. i took some screenshots and also wrote a simple demo program to show what happens.

Code: Select all

// this code created from a modified fontm.c file
#include "gsKit.h"
#include "dmaKit.h"
#include "malloc.h"
 
int main(void)
{
        u64 White,BlackFont;
        GSGLOBAL *gsGlobal = gsKit_init_global(GS_MODE_NTSC);
 
        GSFONT *gsFont = gsKit_init_font(GSKIT_FTYPE_FONTM, NULL);
 
        dmaKit_init(D_CTRL_RELE_OFF,D_CTRL_MFD_OFF, D_CTRL_STS_UNSPEC,
                    D_CTRL_STD_OFF, D_CTRL_RCYC_8);
 
        // Initialize the DMAC
        dmaKit_chan_init(DMA_CHANNEL_GIF);
        dmaKit_chan_init(DMA_CHANNEL_FROMSPR);
        dmaKit_chan_init(DMA_CHANNEL_TOSPR);

        White = GS_SETREG_RGBAQ(0xFF,0xFF,0xFF,0x00,0x00);
        BlackFont = GS_SETREG_RGBAQ(0x00,0x00,0x00,0x80,0x00);

        gsGlobal->PrimAlphaEnable = GS_SETTING_ON;
        gsKit_init_screen(gsGlobal);
        gsKit_font_upload(gsGlobal, gsFont);
        gsFont->FontM_Spacing = 0.95f;
 
        gsKit_mode_switch(gsGlobal, GS_ONESHOT);
        int x=0;
        char tempstr[25];
        while(1)
        {
                gsKit_clear(gsGlobal, White);
                sprintf(tempstr, "test : %i", x);
                gsKit_font_print_scaled(gsGlobal, gsFont, 50, 50, 3.0f, 2.f, BlackFont, tempstr);
                gsKit_sync_flip(gsGlobal);
                gsKit_queue_exec(gsGlobal);
                // creates a delay, so the bug can be seen
                double i=0;while&#40;i<100000&#41;i+=.1;
                x++;
                if &#40;x==10000&#41;
                        x=0;
        &#125;
        
        return 0;
&#125;
images:
http://ubergeek.awardspace.com/ps2dev/images/test1.bmp
http://ubergeek.awardspace.com/ps2dev/images/test2.bmp
http://ubergeek.awardspace.com/ps2dev/images/test3.bmp
http://ubergeek.awardspace.com/ps2dev/images/test4.bmp

Re: gskit bugs(minor)

Posted: Sat May 06, 2006 8:42 am
by Drakonite
ubergeek42 wrote:

Code: Select all

                // creates a delay, so the bug can be seen
                double i=0;while&#40;i<100000&#41;i+=.1;
                x++;
                if &#40;x==10000&#41;
                        x=0;
Ewww... Thats ugly... No reason to do that crap... If you need a delay, do something like

Code: Select all

for&#40;i=0;i<60;i++&#41;
   VSync&#40;&#41;;
(assuming VSync() is defined.. I have my own vsync call, there is probably one provided somewhere in gskit as well, or you could just draw it on both front and back buffers and do sync_flip)

Posted: Sat May 06, 2006 8:44 am
by ubergeek42
yeah i know...i use eetimers in my real program for making delays, this was just a rather quick hack to find the bug...which randomly vanishes from me.

Posted: Mon May 08, 2006 12:12 pm
by Orfax
Re: sprintf

The first thing to do is to try and determine if it is sprintf() or gsKit_font_print_scaled() that is buggy. After doing the sprintf, printf the string, and check the console to see what is printed.

Posted: Mon May 08, 2006 9:42 pm
by ubergeek42
i tested that...its the gskit print function that is buggy..although i now think that it is somehting i am doing.

in the small game i am making, if i pause/unpause the screen the numbers are displayed properly. if i pause unpause again they go back to being messed up.

when i pause the game..i site in a loop, which occurs right after i have swapped my buffers..
gsKit_queue_exec(gsGlobal);
gsKit_sync_flip(gsGlobal);
while(pause)
handlekeys();//toggles pause when they press the pause button

i don't know how that makes a difference at all....but it seems to be something i am doing wrong.

Posted: Sun May 14, 2006 3:23 pm
by Neovanglist
Yo!

Thanks for the problem report.

I'm pretty sure I know what the problem is, and I've done some things that should fix it.

I have a big(ish) commit going in sometime in the next couple days, please give it a run and let me know if it fixes the issue for you.

Posted: Fri May 19, 2006 4:59 pm
by Neovanglist
Get latest from gsKit SVN. The issue should be resolved now.