First, here is my setup
- PSP 2000 on CFW '6.60 ME-1.6'
- Linux Mint 12 (based on the latest Ubuntu with an usable Gnome Interface)
- PSP Toolchain 'minpspw_0.10.0-1ubuntu0_amd64'
I have installed the Plugins on the PSP and i can compile and run the samples from the PSPSDK with psplink just fine.
I have started with the SimpleTutorials and if i try to draw an image, it won´t show up.
Here is my main.c
- Code: Select all
/*
* PSP Software Development Kit - http://www.pspdev.org
* -----------------------------------------------------------------------
* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
*
* main.c - A basic example of getting code onto the ME. This was based on
* the sample code written by crazyc on the pspdev forums.
*
* Copyright (c) 2005 James Forshaw <tyranid@gmail.com>
*
* $Id: main.c 1095 2005-09-27 21:02:16Z jim $
*/
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspctrl.h>
#include <pspdisplay.h>
#include <stdlib.h>
#include <string.h>
#include <pspgu.h>
#include "./common/graphics.h"
#include "./common/framebuffer.h"
#include "./common/callbacks.h"
#include "./common/vram.h"
/* Define the module info section */
# ifdef PSPFW3X
PSP_MODULE_INFO("test prx", 0x0, 1, 1);
PSP_HEAP_SIZE_KB(6*1024);
# else
PSP_MODULE_INFO("test", 0x1000, 1, 1);
# endif
#define BUF_WIDTH (512)
#define SCR_WIDTH (480)
#define SCR_HEIGHT (272)
#define GRID_WIDTH 18
#define GRID_HEIGHT 18
static unsigned int __attribute__((aligned(16))) list[262144];
/* Define the main thread's attribute value (optional) */
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
/* Define printf, just to make typing easier */
#define printf pspDebugScreenPrintf
#define Max(X,Y)((X) > (Y) ? (X) : (Y))
#define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16))
Color White = RGB(255, 255, 255);
Color Black = RGB(0, 0, 0);
void dump_threadstatus(void);
int done = 0;
/* Exit callback */
int exit_callback(int arg1, int arg2, void *common)
{
done = 1;
return 0;
}
/* Callback thread */
int CallbackThread(SceSize args, void *argp)
{
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void)
{
int thid = 0;
thid = sceKernelCreateThread("update_thread", CallbackThread,
0x11, 0xFA0, 0, 0);
if(thid >= 0)
{
sceKernelStartThread(thid, 0, 0);
}
return thid;
}
void initMyGraphics(void) {
sceGuInit();
// setup GU
void* fbp0 = getStaticVramBuffer(BUF_WIDTH,SCR_HEIGHT,GU_PSM_8888);
void* fbp1 = getStaticVramBuffer(BUF_WIDTH,SCR_HEIGHT,GU_PSM_8888);
void* zbp = getStaticVramBuffer(BUF_WIDTH,SCR_HEIGHT,GU_PSM_4444);
sceGuStart(GU_DIRECT,list);
sceGuDrawBuffer(GU_PSM_8888,fbp0,BUF_WIDTH);
sceGuDispBuffer(SCR_WIDTH,SCR_HEIGHT,fbp1,BUF_WIDTH);
sceGuDepthBuffer(zbp,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);
}
int main(void) {
SetupCallbacks();
initMyGraphics();
pspDebugScreenInit();
SceCtrlData pad;
sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
Image* image = loadImage("DemoTexture.png");
while (1) {
sceGuStart(GU_DIRECT,list);
// clear screen
sceGuClearColor(0x000000);
sceGuClearDepth(0);
sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT);
fillScreenRect(White, 0, 0, 480, 272);
flipScreen();
pspDebugScreenSetXY(0, 2);
sceDisplayWaitVblankStart();
if (!image) {
printf("image was not found");
} else {
printf("drawing image (%i,%i)", image->imageWidth, image->imageHeight);
blitAlphaImageToScreen(0, 0, image->imageWidth, image->imageHeight, image, 20, 40);
}
sceCtrlReadBufferPositive(&pad, 1);
pspDebugScreenSetXY(0, 3);
printf("Analog X = %d ", pad.Lx);
printf("Analog Y = %d \n", pad.Ly);
if (pad.Buttons != 0){
if (pad.Buttons & PSP_CTRL_SQUARE){
printf("Square pressed \n");
}
if (pad.Buttons & PSP_CTRL_TRIANGLE){
printf("Triangle pressed \n");
}
if (pad.Buttons & PSP_CTRL_CIRCLE){
printf("Cicle pressed \n");
}
if (pad.Buttons & PSP_CTRL_CROSS){
printf("Cross pressed \n");
}
if (pad.Buttons & PSP_CTRL_UP){
printf("Up pressed \n");
}
if (pad.Buttons & PSP_CTRL_DOWN){
printf("Down pressed \n");
}
if (pad.Buttons & PSP_CTRL_LEFT){
printf("Left pressed \n");
}
if (pad.Buttons & PSP_CTRL_RIGHT){
printf("Right pressed \n");
}
if (pad.Buttons & PSP_CTRL_START){
printf("Start pressed \n");
}
if (pad.Buttons & PSP_CTRL_SELECT){
printf("Select pressed \n");
}
if (pad.Buttons & PSP_CTRL_LTRIGGER){
printf("L-trigger pressed \n");
}
if (pad.Buttons & PSP_CTRL_RTRIGGER){
printf("R-trigger pressed \n");
}
}
//sceDisplayWaitVblankStart();
//blitImageToScreen(0, 0, 128, 128, image, 0, 0);
flipScreen();
}
sceKernelSleepThread();
sceKernelExitGame();
return 0;
}
If i run this code, the debug output appears just fine and it changes correctly, if i press a button. But the image does not appear. I have tried many other pngs but with no success.
I hope someone can help me.
With best regards
remus

