Discuss the development of new homebrew software, tools and libraries.
	Moderators:  cheriff , TyRaNiD 
			
		
		
			
				
																			
								ne0h 							 
									
		Posts:  386 Joined:  Thu Feb 21, 2008 2:15 am 
		
						
					
													
							
						
									
						Post 
					 
								by ne0h  Mon Aug 18, 2008 1:33 am 
			
			
			
			
			Excuse me,
I'm working on a text editor,
I've already write all the functions, but now I'll add the danzeff osk!
I've writed this:
Code: Select all 
while (1)
{
        psp_main_screen();
        
        if (danzeff)
        {
            guStart();
            danzeff_render();
        }
        
        flipScreen();
      ....
}
( initGraphics(); is called before, and the main_screen blit 2 images to screen using blitAlphaImageToScreen function )
But It doesn't work, 
when I press SELECT ( to active the osk ) the psp freeze, why?
Sorry for my bad english!
					Last edited by 
ne0h  on Mon Aug 18, 2008 4:39 am, edited 1 time in total.
									
 
		 
				
		
		 
	 
				
		
		
			
				
																			
								ne0h 							 
									
		Posts:  386 Joined:  Thu Feb 21, 2008 2:15 am 
		
						
					
						 
													
							
						
									
						Post 
					 
								by ne0h  Mon Aug 18, 2008 2:41 am 
			
			
			
			
			I've try with this solution:
Code: Select all 
while (1)
{
        psp_main_screen();
       
        if (danzeff)
        {
            guStart();
            danzeff_render();
            sceGuFinish();
            sceGuSync(0,0);
        }
       
        flipScreen();
      ....
}
But this is the results:
And this is the screen before try to blit the osk:
Please, help! :(
 
		 
				
		
		 
	 
				
		
		
			
				
																			
								J.F. 							 
									
		Posts:  2906 Joined:  Sun Feb 22, 2004 11:41 am 
		
						
					
						 
													
							
						
									
						Post 
					 
								by J.F.  Mon Aug 18, 2008 3:07 am 
			
			
			
			
			The init code used in graphics.c doesn't work for things like intraFonts or danzeff. Try this one:
Code: Select all 
	// setup GU
	sceGuInit();
	sceGuStart(GU_DIRECT,list);
	sceGuDrawBuffer(GU_PSM_8888,(void*)DRAW_BUF,BUF_WIDTH);
	sceGuDispBuffer(SCR_WIDTH,SCR_HEIGHT,(void*)DISP_BUF,BUF_WIDTH);
	sceGuDepthBuffer((void*)DEBUG_BUF,BUF_WIDTH);
	sceGuOffset(2048 - (SCR_WIDTH/2),2048 - (SCR_HEIGHT/2));
	sceGuViewport(2048,2048,SCR_WIDTH,SCR_HEIGHT);
	sceGuDepthRange(65535,0);
	sceGuDepthMask(GU_TRUE);
	sceGuDisable(GU_DEPTH_TEST);
	sceGuDisable(GU_BLEND);
	sceGuScissor(0,0,SCR_WIDTH,SCR_HEIGHT);
	sceGuEnable(GU_SCISSOR_TEST);
	sceGuFrontFace(GU_CW);
	sceGuEnable(GU_TEXTURE_2D);
	sceGuClear(GU_COLOR_BUFFER_BIT);
	sceGuFinish();
	sceGuSync(0,0);
	sceDisplayWaitVblankStart();
	sceGuDisplay(GU_TRUE);
 
		 
				
		
		 
	 
				
		
		
			
				
																			
								ne0h 							 
									
		Posts:  386 Joined:  Thu Feb 21, 2008 2:15 am 
		
						
					
						 
													
							
						
									
						Post 
					 
								by ne0h  Mon Aug 18, 2008 3:15 am 
			
			
			
			
			Can you post the definition of DRAW_BUF etc?
I've try to set all buf (DRAW_BUF, DISP_BUF and DEBUG_BUF) to 512 and the results is badder than before!
All the screen is black and only little part of it is correctly show! O.O
This is my initGraphics function now:
Code: Select all 
#define DEBUG_BUF (512)
#define DISP_BUF (512)
#define DRAW_BUF (512)
#define BUF_WIDTH (512)
#define SCR_WIDTH (480)
#define SCR_HEIGHT (272)
#define PIXEL_SIZE (4)
#define FRAME_SIZE (BUF_WIDTH * SCR_HEIGHT * PIXEL_SIZE)
#define ZBUF_SIZE (BUF_WIDTH SCR_HEIGHT * 2)
void initGraphics()
{
	dispBufferNumber = 0;
        sceGuInit();
        sceGuStart(GU_DIRECT,list);
        sceGuDrawBuffer(GU_PSM_8888, (void*)DRAW_BUF, BUF_WIDTH);
        sceGuDispBuffer(SCR_WIDTH, SCR_HEIGHT, (void*)DISP_BUF, BUF_WIDTH);
        sceGuDepthBuffer((void*)DEBUG_BUF,BUF_WIDTH);
        sceGuOffset(2048 - (SCR_WIDTH/2),2048 - (SCR_HEIGHT/2));
        sceGuViewport(2048,2048,SCR_WIDTH,SCR_HEIGHT);
        sceGuDepthRange(65535,0);
        sceGuDepthMask(GU_TRUE);
        sceGuDisable(GU_DEPTH_TEST);
        sceGuDisable(GU_BLEND);
        sceGuScissor(0,0,SCR_WIDTH,SCR_HEIGHT);
        sceGuEnable(GU_SCISSOR_TEST);
        sceGuFrontFace(GU_CW);
        sceGuEnable(GU_TEXTURE_2D);
        sceGuClear(GU_COLOR_BUFFER_BIT);
        sceGuFinish();
        sceGuSync(0,0);
        sceDisplayWaitVblankStart();
        sceGuDisplay(GU_TRUE);
        
	initialized = 1;
}
 
		 
				
		
		 
	 
				
		
		
			
				
																			
								KickinAezz 							 
									
		Posts:  328 Joined:  Sun Jun 03, 2007 10:05 pm 
		
						
					
						 
													
							
						
									
						Post 
					 
								by KickinAezz  Mon Aug 18, 2008 4:13 am 
			
			
			
			
			ne0h wrote: Can you post the definition of DRAW_BUF etc?
I've try to set all buf (DRAW_BUF, DISP_BUF and DEBUG_BUF) to 512 and the results is badder than before!
All the screen is black and only little part of it is correctly show! O.O
This is my initGraphics function now:
Code: Select all 
#define DEBUG_BUF (512)
#define DISP_BUF (512)
#define DRAW_BUF (512)
#define BUF_WIDTH (512)
#define SCR_WIDTH (480)
#define SCR_HEIGHT (272)
#define PIXEL_SIZE (4)
#define FRAME_SIZE (BUF_WIDTH * SCR_HEIGHT * PIXEL_SIZE)
#define ZBUF_SIZE (BUF_WIDTH SCR_HEIGHT * 2)
void initGraphics()
{
	dispBufferNumber = 0;
        sceGuInit();
        sceGuStart(GU_DIRECT,list);
        sceGuDrawBuffer(GU_PSM_8888, (void*)DRAW_BUF, BUF_WIDTH);
        sceGuDispBuffer(SCR_WIDTH, SCR_HEIGHT, (void*)DISP_BUF, BUF_WIDTH);
        sceGuDepthBuffer((void*)DEBUG_BUF,BUF_WIDTH);
        sceGuOffset(2048 - (SCR_WIDTH/2),2048 - (SCR_HEIGHT/2));
        sceGuViewport(2048,2048,SCR_WIDTH,SCR_HEIGHT);
        sceGuDepthRange(65535,0);
        sceGuDepthMask(GU_TRUE);
        sceGuDisable(GU_DEPTH_TEST);
        sceGuDisable(GU_BLEND);
        sceGuScissor(0,0,SCR_WIDTH,SCR_HEIGHT);
        sceGuEnable(GU_SCISSOR_TEST);
        sceGuFrontFace(GU_CW);
        sceGuEnable(GU_TEXTURE_2D);
        sceGuClear(GU_COLOR_BUFFER_BIT);
        sceGuFinish();
        sceGuSync(0,0);
        sceDisplayWaitVblankStart();
        sceGuDisplay(GU_TRUE);
        
	initialized = 1;
}
Are you sure YOU coded a text editor? I see a LOT of BARE BASICS missing...
Intrigued by PSP system Since December 2006.
						 
		 
				
		
		 
	 
				
		
		
			
				
																			
								ne0h 							 
									
		Posts:  386 Joined:  Thu Feb 21, 2008 2:15 am 
		
						
					
						 
													
							
						
									
						Post 
					 
								by ne0h  Mon Aug 18, 2008 4:38 am 
			
			
			
			
			Yes I've coded it by myself!
			
			
									
									
						 
		 
				
		
		 
	 
				
		
		
			
				
																			
								kralyk 							 
									
		Posts:  114 Joined:  Sun Apr 06, 2008 8:18 pmLocation:  Czech Republic, central EU 
		
						
					
						 
													
							
						
									
						Post 
					 
								by kralyk  Mon Aug 18, 2008 5:08 am 
			
			
			
			
			try this:
Code: Select all 
#define BUF_WIDTH  (512)
#define SCR_WIDTH  (480)
#define SCR_HEIGHT (272)
void *dList;
void *fbp0;
...
	fbp0 = 0;
	dList = memalign(16, 640);
	sceGuDrawBuffer( GU_PSM_8888, fbp0, BUF_WIDTH );
	sceGuDispBuffer( SCR_WIDTH, SCR_HEIGHT, (void*)0x88000, BUF_WIDTH);
	sceGuDepthBuffer( (void*)0x110000, BUF_WIDTH);
...
And check out sdk samples, can be useful as to the GU stuff...
					Last edited by 
kralyk  on Mon Aug 18, 2008 5:36 am, edited 1 time in total.
									
...sorry for my english... 
						 
		 
				
		
		 
	 
				
		
		
			
				
								Raphael 							 
									
		Posts:  646 Joined:  Tue Jan 17, 2006 4:54 pmLocation:  Germany
				Contact: 
				
			 
				
		 
		
						
					
						 
													
							
						
									
						Post 
					 
								by Raphael  Mon Aug 18, 2008 5:33 am 
			
			
			
			
			kralyk wrote: try this:
Code: Select all 
#define BUF_WIDTH  (512)
#define SCR_WIDTH  (480)
#define SCR_HEIGHT (272)
void *dList;
void *fbp0;
...
	sceGuDrawBuffer( GU_PSM_8888, fbp0, BUF_WIDTH );
	sceGuDispBuffer( SCR_WIDTH, SCR_HEIGHT, (void*)0x88000, BUF_WIDTH);
	sceGuDepthBuffer( (void*)0x110000, BUF_WIDTH);
...
And check out sdk samples, can be useful as to the GU stuff...
Please don't teach people to use uninitialized variables like that.......
if at all then do this:
void *fbp0 = 0;
And the 'correct' defines of the *_BUFs would be this:
#define DRAW_BUF (0)
TBH, it quite sucks to use such hardcoded values though.
PS: Who the hell named the depth buffer define "DEBUG_BUF"?
					Last edited by 
Raphael  on Mon Aug 18, 2008 5:37 am, edited 2 times in total.
									
 
		 
				
		
		 
	 
				
		
		
			
				
																			
								kralyk 							 
									
		Posts:  114 Joined:  Sun Apr 06, 2008 8:18 pmLocation:  Czech Republic, central EU 
		
						
					
						 
													
							
						
									
						Post 
					 
								by kralyk  Mon Aug 18, 2008 5:35 am 
			
			
			
			
			oh yeah sorry, I got that line elswwhere, of course fbp0 = 0, sry, will edit that...
			
			
									
									...sorry for my english... 
						 
		 
				
		
		 
	 
				
		
		
			
				
								jean 							 
									
		Posts:  489 Joined:  Sat Jan 05, 2008 2:44 am 
		
						
					
						 
													
							
						
									
						Post 
					 
								by jean  Mon Aug 18, 2008 5:43 am 
			
			
			
			
			Are you sure YOU coded a text editor? I see a LOT of BARE BASICS missing...
Yes I've coded it by myself!
Same old story... what's so fascinating about making people believe you're a software developer while in reality you're all in the world but that? When i was young, children were willing to become astronauts or super-heroes, not PSP nerds...
 
		 
				
		
		 
	 
				
		
		
			
				
																			
								kralyk 							 
									
		Posts:  114 Joined:  Sun Apr 06, 2008 8:18 pmLocation:  Czech Republic, central EU 
		
						
					
						 
													
							
						
									
						Post 
					 
								by kralyk  Mon Aug 18, 2008 6:13 am 
			
			
			
			
			Not knowing the GU calls makes you think the person is not a programmer?
(Im just curious, I dont wanna to say wheter he wrote it himself or not)
EDIT: I still think he might have done it: 
http://www.psp-hacks.com/2008/08/04/xpl ... e-manager/  (if he the same ne0h)
...sorry for my english... 
						 
		 
				
		
		 
	 
				
		
		
			
				
																			
								J.F. 							 
									
		Posts:  2906 Joined:  Sun Feb 22, 2004 11:41 am 
		
						
					
						 
													
							
						
									
						Post 
					 
								by J.F.  Mon Aug 18, 2008 5:02 pm 
			
			
			
			
			ne0h wrote: Can you post the definition of DRAW_BUF etc?
I used variables since my code had to deal with the TV as well as the LCD.
Code: Select all 
    // set PSP screen variables
    BUF_WIDTH = 768;
    SCR_WIDTH = psp_vidout_select ? 720 : 480;
    SCR_HEIGHT = psp_vidout_select ? 480 : 272;
    FRAME_SIZE = BUF_WIDTH * SCR_HEIGHT * PIXEL_SIZE;
    DISP_BUF = 0;
    if (!psp_tv_laced)
    {
        DRAW_BUF = FRAME_SIZE;
        TEX_BUF = DRAW_BUF + FRAME_SIZE;
        DEBUG_BUF = TEX_BUF + 64*4*576;
    }
    else
    {
        DRAW_BUF = 0; // not double buffered
        TEX_BUF = FRAME_SIZE;
        DEBUG_BUF = TEX_BUF + 64*4*576;
        LACE_BUF = (uint32)sceGeEdramGetAddr() + DEBUG_BUF + 512*4*8;
    }
DISP_BUF and DRAW_BUF are your two double-buffers. TEX_BUF was a small space I used for millions mode refresh. DEBUG_BUF was the offset for the debug printing, and LACE_BUF is the interlaced framebuffer if you were using the TV in interlaced mode. Interlaced mode also implied no double-buffer, so DRAW_BUF was 0. All those buffers (except LACE_BUF) are offsets from the start of video EDRAM.
 
		 
				
		
		 
	 
				
		
		
			
				
								jean 							 
									
		Posts:  489 Joined:  Sat Jan 05, 2008 2:44 am 
		
						
					
						 
													
							
						
									
						Post 
					 
								by jean  Mon Aug 18, 2008 8:44 pm 
			
			
			
			
			Not knowing the GU calls makes you think the person is not a programmer? 
No, it's not that (even if someone willing can open documentation and see by himself) ...he's one of our old stories... anyway i was speaking of children in general...
Apart from the fact that an optimistic 1/10 of people posting here are "programmers" for their formation at university or work, a 4/10 serious hobbyists and the remaining 5/10... well, you know.
 
		 
				
		
		 
	 
				
		
		
			
				
																			
								ne0h 							 
									
		Posts:  386 Joined:  Thu Feb 21, 2008 2:15 am 
		
						
					
						 
													
							
						
									
						Post 
					 
								by ne0h  Tue Aug 19, 2008 2:20 am 
			
			
			
			
			Thanks kralyk, yes, Xplora is a my project (and I've writed it by myself),
			
			
									
									
						 
		 
				
		
		 
	 
				
		
		
			
				
																			
								ne0h 							 
									
		Posts:  386 Joined:  Thu Feb 21, 2008 2:15 am 
		
						
					
						 
													
							
						
									
						Post 
					 
								by ne0h  Tue Aug 19, 2008 2:41 am 
			
			
			
			
			Sorry, but I've still problems! :(
This is my initGraphics function now:
Code: Select all 
#define DRAW_BUF (0)
#define DISP_BUF (0x88000)
#define DEBUG_BUF (0x110000)
#define BUF_WIDTH (512)
#define SCR_WIDTH (480)
#define SCR_HEIGHT (272)
#define PIXEL_SIZE (4)
#define FRAME_SIZE (BUF_WIDTH * SCR_HEIGHT * PIXEL_SIZE)
#define ZBUF_SIZE (BUF_WIDTH SCR_HEIGHT * 2)
void initGraphics()
{
	dispBufferNumber = 0;
        
        void *dList;
        void *fbp0;
        
        fbp0 = 0;
        dList = memalign(16, 640);
        
        sceGuInit();
        sceGuStart(GU_DIRECT,list);
        sceGuDrawBuffer( GU_PSM_8888, fbp0, BUF_WIDTH );
        sceGuDispBuffer( SCR_WIDTH, SCR_HEIGHT, (void*)0x88000, BUF_WIDTH);
        sceGuDepthBuffer( (void*)0x110000, BUF_WIDTH); 
        sceGuOffset(2048 - (SCR_WIDTH/2),2048 - (SCR_HEIGHT/2));
        sceGuViewport(2048,2048,SCR_WIDTH,SCR_HEIGHT);
        sceGuDepthRange(65535,0);
        sceGuDepthMask(GU_TRUE);
        sceGuDisable(GU_DEPTH_TEST);
        sceGuDisable(GU_BLEND);
        sceGuScissor(0,0,SCR_WIDTH,SCR_HEIGHT);
        sceGuEnable(GU_SCISSOR_TEST);
        sceGuFrontFace(GU_CW);
        sceGuEnable(GU_TEXTURE_2D);
        sceGuClear(GU_COLOR_BUFFER_BIT);
        sceGuFinish();
        sceGuSync(0,0);
        sceDisplayWaitVblankStart();
        sceGuDisplay(GU_TRUE); 
        
	initialized = 1;
}
Please, excuse me...
 
		 
				
		
		 
	 
				
		
		
			
				
																			
								J.F. 							 
									
		Posts:  2906 Joined:  Sun Feb 22, 2004 11:41 am 
		
						
					
						 
													
							
						
									
						Post 
					 
								by J.F.  Tue Aug 19, 2008 3:53 am 
			
			
			
			
			Missing a "*" in ZBUF_SIZE.
			
			
									
									
						 
		 
				
		
		 
	 
				
		
		
			
				
																			
								ne0h 							 
									
		Posts:  386 Joined:  Thu Feb 21, 2008 2:15 am 
		
						
					
						 
													
							
						
									
						Post 
					 
								by ne0h  Tue Aug 19, 2008 4:01 am 
			
			
			
			
			Thanks to all, but I've resolved, I've ported the danzeff osk under graphics.c library(simply replaced the blit function with blitAlphaImageToScreen), I'll post the source soon ( now I've to finish the 1.6 of Xplora! )
			
			
									
									
						 
		 
				
		
		 
	 
				
		
		
			
				
																			
								Rangu2057 							 
									
		Posts:  87 Joined:  Mon Jul 23, 2007 8:37 amLocation:  wilmington, NC 
		
						
					
						 
													
							
						
									
						Post 
					 
								by Rangu2057  Thu Aug 21, 2008 12:28 pm 
			
			
			
			
			mm, it makes me wonder
			
			
									
									the questions of today are awnswered by the blood and bullets of tomorrow! ---EagleEye--- (Socom FTB2)