Error running prx by PSPLink

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

Moderators: cheriff, TyRaNiD

Post Reply
zydeoN
Posts: 45
Joined: Sat May 09, 2009 4:01 am

Error running prx by PSPLink

Post by zydeoN »

Hey, new here, but guess u can help me. Im trying to run a prx with psplink. But when i make ./image.prx in pspsh (i am using Eclipse) it gives the error
libpng error: Decompression error
and my psp goes blank...
The source is right here http://codepad.org/4ZQ9LXuu.

Makefile:

Code: Select all

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

CFLAGS = -O2 -G0 -Wall -g -pg
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

BUILD_PRX = 1
LIBDIR =
LIBS = -lpspgu -lpng -lz -lm -lpspgum 
LDFLAGS =

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = image

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak 
Should i add something to the makefile or to the source? Help..
jojojoris
Posts: 255
Joined: Sun Mar 30, 2008 4:06 am

Post by jojojoris »

I didn't look at your source but i think you have to add
PSP_HEAP_SIZE_KB(10*1024)
after
PSP_MODULE_INFO(........)

This code will give your program acces to more RAM. (10*1024kb=10MB)
Normaly without this code your prx wil only use about 64kb of ram memory.

Code: Select all

int main(){
     SetupCallbacks();
     makeNiceGame();
     sceKernelExitGame();
}
zydeoN
Posts: 45
Joined: Sat May 09, 2009 4:01 am

displaying image

Post by zydeoN »

Solved, thanks... :D Btw, im trying to run a simple prx that displays an image but the psp goes blank and nothing happens then... Well here is the code, without callback:

Code: Select all

#include <pspdisplay.h>
#include <pspctrl.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspgu.h>
#include <png.h>
#include <stdio.h>
#include "graphics.h"
#define printf pspDebugScreenPrintf

PSP_HEAP_SIZE_KB&#40;10*1024&#41;;
PSP_MODULE_INFO&#40;"Image Display Program", 0, 1, 1&#41;;
int main&#40;&#41;
&#123;

  pspDebugScreenInit&#40;&#41;;
  SetupCallbacks&#40;&#41;;
  initGraphics&#40;&#41;;
  char buffer&#91;200&#93;;
  Image* ourImage;

  sprintf&#40;buffer, "example.png"&#41;;
  ourImage = loadImage&#40;buffer&#41;;
  if &#40;!ourImage&#41;
  &#123;
  //Image load failed
    printf&#40;"Image load failed!\n"&#41;;
  &#125; else
  &#123;
    sceDisplayWaitVblankStart&#40;&#41;;
    int x = 1;
    while&#40;x == 1&#41;
    &#123;
    blitAlphaImageToScreen&#40;0 ,0 ,400 , 150, ourImage, 1, 1&#41;;
    x++;
    &#125;

  &#125;
  sceKernelSleepThread&#40;&#41;;
  return 0;
&#125;
The image to be loaded is that one (with 400x150 resolution) :
Image

What am i doing wrong? :P
psPea
Posts: 60
Joined: Sat Sep 01, 2007 12:51 pm

Post by psPea »

add filpScreen() after blitAlphaImageToScreen
zydeoN
Posts: 45
Joined: Sat May 09, 2009 4:01 am

Post by zydeoN »

I just added and built the prx but the output is very weird... Here it is:

Image

Well the pic is not perfect, but the image i presented before is outputed more than once and i guess not in 400x150, cause psp has 480x272 and the pic is so small compared to the its resolution. What could actually be wrong? :P


EDIT: well, i discovered recently that some images work perfectly while anothers (such as the one above) dont work.. There must be a rule to specific images work. However i will start using oslib, but if u guys knew more about that, i would appreciate you posted a reply.

EDIT 2: Finally, i discovered my problem. The images i used were created in Corel Draw. So if anybody has the same problem as mine, you should the following: when exporting the image as PNG (in Corel Draw) you have must do it without "Interlace Image" which is an option that appears in the exporting menu. This way, you can blit images to the screen :D (You may close the thread)
Post Reply