Image Blitting on 3.71

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
kid101skater
Posts: 26
Joined: Wed Jun 20, 2007 6:13 am

Image Blitting on 3.71

Post by kid101skater »

Hello. i origionally dev'd for psp 1.50 and did some 2.8 projects... such as flashers, games and shells... and some little other things. anyways to the point. im trying to start on 3.71 and for some reason i cant get the damn graphics to load even simpily. i have this code below to load the image

Main.c

Code: Select all


#include <kubridge.h>
#include <pspkernel.h>
#include <psppower.h>
#include <pspdebug.h>
#include <pspctrl.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <pspiofilemgr.h>
#include <pspdisplay.h>
#include <psputility.h>
#include <pspgu.h>
#include <pspgum.h>
#include <malloc.h>
#include <stdarg.h>
#include "framebuffer.h"
#include "graphics.h"
#include <math.h>
#include <png.h>
#include <pspsdk.h>


#define SCREEN_WIDTH 480
#define SCREEN_HEIGHT 272
#define DATA_WIDTH     240
#define DATA_HEIGHT		 136
#define LINESIZE       512				//in short
#define FRAMESIZE      0xAA000			//in byte

#define printf pspDebugScreenPrintf
#define MAX&#40;X, Y&#41; &#40;&#40;X&#41; > &#40;Y&#41; ? &#40;X&#41; &#58; &#40;Y&#41;&#41; 

PSP_MODULE_INFO&#40;"test", 0, 1, 1&#41;;
PSP_MAIN_THREAD_ATTR&#40;PSP_THREAD_ATTR_USER&#41;;

#define printf    pspDebugScreenPrintf
#define RGB&#40;r, g, b&#41; &#40;&#40;r&#41;|&#40;&#40;g&#41;<<8&#41;|&#40;&#40;b&#41;<<16&#41;&#41;


void ErrorExit&#40;int milisecs, char *fmt, ...&#41;
&#123;
	va_list list;
	char msg&#91;256&#93;;	

	va_start&#40;list, fmt&#41;;
	vsprintf&#40;msg, fmt, list&#41;;
	va_end&#40;list&#41;;

	printf&#40;msg&#41;;
	
	sceKernelDelayThread&#40;milisecs*1000&#41;;
	sceKernelExitGame&#40;&#41;;
&#125;


int main&#40;void&#41;
&#123;
	
	pspDebugScreenInit&#40;&#41;;
	initGraphics&#40;&#41;;
	SceCtrlData pad;
	
	
    Image* player = loadImage&#40;"player.png"&#41;;

    while&#40;1&#41;&#123;
       printf&#40;" Loading player \n"&#41;;
       blitAlphaImageToScreen&#40;0, 0, 60, 60, player, 60, 60&#41;;
       flipScreen&#40;&#41;;
       printf&#40;"loaded correctly =&#93; /n"&#41;;
       &#125;
&#125;



Makefile

Code: Select all


TARGET = Tester
OBJS = main.o graphics.o framebuffer.o

INCDIR = ./include
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $&#40;CFLAGS&#41; -fno-exceptions -fno-rtti
ASFLAGS = $&#40;CFLAGS&#41; -c

LIBDIR = ./lib
LDFLAGS = 
LIBS = -lpspkubridge -lpspgu -lpng -lz -lm -lpsppower

PSP_FW_VERSION = 371

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Tester

BUILD_PRX = 1

PSPSDK=$&#40;shell psp-config --pspsdk-path&#41;
include $&#40;PSPSDK&#41;/lib/build.mak

J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Talk about hammerimg the graphics. You're trying to blit the image as fast as humanly possible. Operations like this usually fail when trying to do that. As a test, you probably just want to do this:

Code: Select all

    printf&#40;" Loading player \n"&#41;;
    blitAlphaImageToScreen&#40;0, 0, 60, 60, player, 60, 60&#41;;
    flipScreen&#40;&#41;;
    printf&#40;"loaded correctly =&#93; /n"&#41;;
    sceKernelDelayThread&#40;10*1000*1000&#41;; // wait 10 seconds
No while loop. If you want to keep the while loop, slow it down. Wait on the vert blank or something.
Post Reply