forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

gskit bugs(minor)

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development
View previous topic :: View next topic  
Author Message
ubergeek42



Joined: 13 Jul 2005
Posts: 83

PostPosted: Sat May 06, 2006 8:27 am    Post subject: gskit bugs(minor) Reply with quote

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:

// 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(i<100000)i+=.1;
                x++;
                if (x==10000)
                        x=0;
        }
       
        return 0;
}

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
Back to top
View user's profile Send private message AIM Address MSN Messenger
Drakonite
Site Admin


Joined: 17 Jan 2004
Posts: 989

PostPosted: Sat May 06, 2006 8:42 am    Post subject: Re: gskit bugs(minor) Reply with quote

ubergeek42 wrote:

Code:

                // creates a delay, so the bug can be seen
                double i=0;while(i<100000)i+=.1;
                x++;
                if (x==10000)
                        x=0;



Ewww... Thats ugly... No reason to do that crap... If you need a delay, do something like
Code:

for(i=0;i<60;i++)
   VSync();

(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
Back to top
View user's profile Send private message Visit poster's website
ubergeek42



Joined: 13 Jul 2005
Posts: 83

PostPosted: Sat May 06, 2006 8:44 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address MSN Messenger
Orfax



Joined: 08 Apr 2004
Posts: 21
Location: Adelaide, Australia

PostPosted: Mon May 08, 2006 12:12 pm    Post subject: Reply with quote

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)
Back to top
View user's profile Send private message Visit poster's website
ubergeek42



Joined: 13 Jul 2005
Posts: 83

PostPosted: Mon May 08, 2006 9:42 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address MSN Messenger
Neovanglist
Site Admin


Joined: 22 May 2004
Posts: 72
Location: Copenhagen, Denmark

PostPosted: Sun May 14, 2006 3:23 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
Neovanglist
Site Admin


Joined: 22 May 2004
Posts: 72
Location: Copenhagen, Denmark

PostPosted: Fri May 19, 2006 4:59 pm    Post subject: Reply with quote

Get latest from gsKit SVN. The issue should be resolved now.
_________________
Regards,
Neovanglist
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group