I am porting an existing 3D (PS2) game to PSP and have been having some problems with alignment. My first problem came when I tried to load in my level file. It appears to me that things go wrong when sceIoRead() is called with a read buffer address that is not 16 byte aligned. So I wrote a memalign() function that makes sure the address returned from malloc is 16 byte aligned (by overallocating by 15 bytes, and adjusting the start address). Now my level loading code coes not crash.
The problem is now that it is loaded I try to read from the buffer and the game crashes. Has anyone had similiar problems with reading from buffers loaded from memory card?
I am new to PSP, so also I wanted to ask what people are doing for debug display/feedback. I am building my code off of the gu/cube sample code and pspDebugScreenPrintf() doesn't seem to display anything so I am assuming this is for text mode vs graphics mode???
Alignment and debug question
-
- Posts: 75
- Joined: Mon Sep 19, 2005 5:41 am
Resolved
Looking around more it looks like the issue was that I was trying to read from memory stick without the full path "ms0:/PSP/GAME/..."
Since I don't have debug display yet I must have been mis-interpreting return values to make me think that the read buffer needed to be 16 byte aligned.
Since I don't have debug display yet I must have been mis-interpreting return values to make me think that the read buffer needed to be 16 byte aligned.
Re: Alignment and debug question
just use the std implementation:starman2049 wrote:So I wrote a memalign() function ...
#include <stdlib.h>
void *memalign(size_t blocksize, size_t bytes);
-
- Posts: 75
- Joined: Mon Sep 19, 2005 5:41 am
Performance
The SDK has the appearance of being directly in line with the "pro" SDK. Is this the case, or is the SDK available here a wrapper or some sort of emulation?