gskit bugs(minor)

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
ubergeek42
Posts: 83
Joined: Wed Jul 13, 2005 12:25 am

gskit bugs(minor)

Post 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
User avatar
Drakonite
Site Admin
Posts: 990
Joined: Sat Jan 17, 2004 1:30 am
Contact:

Re: gskit bugs(minor)

Post 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)
Shoot Pixels Not People!
Makeshift Development
ubergeek42
Posts: 83
Joined: Wed Jul 13, 2005 12:25 am

Post 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.
User avatar
Orfax
Posts: 21
Joined: Thu Apr 08, 2004 3:41 pm
Location: Adelaide, Australia
Contact:

Post 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.
Look deep into their eyes for what they have to say, Emotions take control of life everyday
Death (Nothing Is Everything)
ubergeek42
Posts: 83
Joined: Wed Jul 13, 2005 12:25 am

Post 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.
Neovanglist
Site Admin
Posts: 72
Joined: Sat May 22, 2004 9:29 pm
Location: Copenhagen, Denmark
Contact:

Post 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.
Regards,
Neovanglist
Neovanglist
Site Admin
Posts: 72
Joined: Sat May 22, 2004 9:29 pm
Location: Copenhagen, Denmark
Contact:

Post by Neovanglist »

Get latest from gsKit SVN. The issue should be resolved now.
Regards,
Neovanglist
Post Reply