 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Mon Aug 18, 2008 1:33 am Post subject: danzeff osk and graphics.h library problem |
|
|
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: |
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 |
|
| Back to top |
|
 |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Mon Aug 18, 2008 2:41 am Post subject: |
|
|
I've try with this solution:
| Code: |
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! :( |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Mon Aug 18, 2008 3:07 am Post subject: |
|
|
The init code used in graphics.c doesn't work for things like intraFonts or danzeff. Try this one:
| Code: | // 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);
|
|
|
| Back to top |
|
 |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Mon Aug 18, 2008 3:15 am Post subject: |
|
|
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: |
#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;
}
|
|
|
| Back to top |
|
 |
KickinAezz
Joined: 03 Jun 2007 Posts: 328
|
Posted: Mon Aug 18, 2008 4:13 am Post subject: |
|
|
| 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: |
#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.
Use it more for Development than for Gaming. |
|
| Back to top |
|
 |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Mon Aug 18, 2008 4:38 am Post subject: |
|
|
Yes I've coded it by myself!
Anyway I doesn't know the sceGu library, so please, can you help me? |
|
| Back to top |
|
 |
kralyk
Joined: 06 Apr 2008 Posts: 114 Location: Czech Republic, central EU
|
Posted: Mon Aug 18, 2008 5:08 am Post subject: |
|
|
try this:
| Code: |
#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... _________________ ...sorry for my english...
Last edited by kralyk on Mon Aug 18, 2008 5:36 am; edited 1 time in total |
|
| Back to top |
|
 |
Raphael

Joined: 17 Jan 2006 Posts: 646 Location: Germany
|
Posted: Mon Aug 18, 2008 5:33 am Post subject: |
|
|
| kralyk wrote: | try this:
| Code: |
#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:
And the 'correct' defines of the *_BUFs would be this:
| Quote: |
#define DRAW_BUF (0)
#define DISP_BUF (0x88000)
#define DEBUG_BUF (0x110000)
|
TBH, it quite sucks to use such hardcoded values though.
PS: Who the hell named the depth buffer define "DEBUG_BUF"? _________________ <Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki
Alexander Berl
Last edited by Raphael on Mon Aug 18, 2008 5:37 am; edited 2 times in total |
|
| Back to top |
|
 |
kralyk
Joined: 06 Apr 2008 Posts: 114 Location: Czech Republic, central EU
|
Posted: Mon Aug 18, 2008 5:35 am Post subject: |
|
|
oh yeah sorry, I got that line elswwhere, of course fbp0 = 0, sry, will edit that...
(hope its ok now) _________________ ...sorry for my english... |
|
| Back to top |
|
 |
jean

Joined: 05 Jan 2008 Posts: 489
|
Posted: Mon Aug 18, 2008 5:43 am Post subject: |
|
|
| Quote: | | Are you sure YOU coded a text editor? I see a LOT of BARE BASICS missing... |
| Quote: | Yes I've coded it by myself!
Anyway I doesn't know the sceGu library, so please, can you help me?
|
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... |
|
| Back to top |
|
 |
kralyk
Joined: 06 Apr 2008 Posts: 114 Location: Czech Republic, central EU
|
Posted: Mon Aug 18, 2008 6:13 am Post subject: |
|
|
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/xplora-v15-a-new-homebrew-file-manager/ (if he the same ne0h) _________________ ...sorry for my english... |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Mon Aug 18, 2008 5:02 pm Post subject: |
|
|
| 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
|
I used variables since my code had to deal with the TV as well as the LCD.
| Code: | // 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. |
|
| Back to top |
|
 |
jean

Joined: 05 Jan 2008 Posts: 489
|
Posted: Mon Aug 18, 2008 8:44 pm Post subject: |
|
|
| Quote: | | 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. |
|
| Back to top |
|
 |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Tue Aug 19, 2008 2:20 am Post subject: |
|
|
Thanks kralyk, yes, Xplora is a my project (and I've writed it by myself),
I'm working on the Text editor for Xplora 1.6! :)
Anyway thanks... |
|
| Back to top |
|
 |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Tue Aug 19, 2008 2:41 am Post subject: |
|
|
Sorry, but I've still problems! :(
This is my initGraphics function now:
| Code: |
#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... |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Tue Aug 19, 2008 3:53 am Post subject: |
|
|
| Missing a "*" in ZBUF_SIZE. |
|
| Back to top |
|
 |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Tue Aug 19, 2008 4:01 am Post subject: |
|
|
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! )
Thanks you guys! |
|
| Back to top |
|
 |
Rangu2057
Joined: 23 Jul 2007 Posts: 87 Location: wilmington, NC
|
Posted: Thu Aug 21, 2008 12:28 pm Post subject: |
|
|
mm, it makes me wonder _________________ the questions of today are awnswered by the blood and bullets of tomorrow! ---EagleEye--- (Socom FTB2) |
|
| Back to top |
|
 |
|
|
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
|