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 

OSLib in XMB possible?

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



Joined: 09 May 2009
Posts: 45

PostPosted: Fri Aug 07, 2009 9:51 am    Post subject: OSLib in XMB possible? Reply with quote

Is it possible to blit images to XMB with OSLib? I know that it is possible with GU, but it seems kind of hard to learn... So if you know something about it, please tell me
Back to top
View user's profile Send private message
slasher2661996



Joined: 22 Feb 2009
Posts: 91
Location: Melbourne Australia ZOMG

PostPosted: Sat Aug 08, 2009 10:22 am    Post subject: Reply with quote

Not without some usage of assembly or the gu
Back to top
View user's profile Send private message
zydeoN



Joined: 09 May 2009
Posts: 45

PostPosted: Sun Aug 09, 2009 8:58 am    Post subject: Reply with quote

Well i just it could be done, but seems impossible. I tried GU, but can't get my image displayed, could you help? The screen just go blank and nothing happens...

Code:
#include <malloc.h>      
#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspdebug.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pspgu.h>
#include <pspgum.h>
#include <psprtc.h>
#include <png.h>
#include "main.h"            
 
#define BUF_WIDTH (512)
#define SCR_WIDTH (480)
#define SCR_HEIGHT (272)

PSP_MODULE_INFO("Lesson1", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER);
PSP_HEAP_SIZE_KB(10000);
 
void *dList;      
void *fbp0;      
 

void InitGU( void )
{
   
   sceGuInit();
        sceGuStart( GU_DIRECT, dList );
   
   sceGuDrawBuffer(GU_PSM_8888,(void*)0,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(0xc350,0x2710);
   
   sceGuScissor( 0, 0, SCR_WIDTH, SCR_HEIGHT);
   sceGuEnable( GU_SCISSOR_TEST );
   sceGuDepthFunc( GU_GEQUAL );
   sceGuEnable( GU_DEPTH_TEST );
   sceGuFrontFace( GU_CW );
   sceGuShadeModel( GU_SMOOTH );
   sceGuEnable( GU_CULL_FACE );
   sceGuEnable( GU_CLIP_PLANES );
        sceGuFinish();
   sceGuSync(0,0);
 
   sceDisplayWaitVblankStart();
   sceGuDisplay(GU_TRUE);
   
}

void SetupProjection( void )
{
   
   sceGumMatrixMode(GU_PROJECTION);
   sceGumLoadIdentity();
   sceGumPerspective( 75.0f, 16.0f/9.0f, 0.5f, 1000.0f);
 
        sceGumMatrixMode(GU_VIEW);
   sceGumLoadIdentity();
 
   sceGuClearColor( GU_COLOR( 0.0f, 0.0f, 0.0f, 1.0f ) );
   sceGuClearDepth(0);   
}

int main(int argc, char **argv)
{
   pspDebugScreenInit();
   SetupCallbacks();

   sceRtcGetCurrentTick( &fpsTickLast );
   tickResolution = sceRtcGetTickResolution();
 
   dList = memalign( 16, 262144 );
   fbp0  = 0;
 
   InitGU();
   SetupProjection();
 
   Image *img=loadPng("ourImage.png");
   sceKernelDcacheWritebackAll();

   while( 1 )
   {
      if(!img) sceKernelExitGame();
      else{
         sceGuStart(GU_DIRECT,dList);
         drawSprite(0,0,32,32,img,0,0);
         sceGuFinish();
         sceGuSync(0,0);
         fbp0 = sceGuSwapBuffers();
         pspDebugScreenSetOffset( (int)fbp0 );
         }
      sceDisplayWaitVblankStart();

        }
 
   sceGuTerm();         
 
   // Free Memory
   free( dList );
   free( fbp0 );
 
   sceKernelExitGame();   
   return 0;
}



Here is the loadPng() and drawSprite() functions:
http://codepad.org/Ey0YeArq
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP 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