Very nice tutorial! I was actually about to make a tutorial on this stuff, because I am still fiddling around with PSP c programming. I made a basic text reader thing that does a similar function with outputting a text file. Your tutorial is much better than mine would have been, though.
Question: can you do "malloc()" on the PSP? I didn't think the PSP had that capability and I didn't want to risk messing it up by trying.
Also, what do you do if you have a text file that is very large (like an ebook or something), and won't display on the screen?
I found that the PSP screen is approximately 67 characters by 34 characters
What I currently have is something like this:
char buffer[33][1000];
FILE* book;
int pg_index=0;
void Next_Page()
{
pg_index=0;
oslCls();
while (fgets(buffer[pg_index], 67, book) && (pg_index < 33)) pg_index++;
Show_Text(pg_index);
}
void Show_Text(int cmd)
{
oslCls();
int i;
oslSetTextColor(RGBA(0,0,0,255));
oslSetBkColor(RGBA(255,255,255,255));
if (cmd==0) oslPrintf_xy(30, 10, "No book loaded or end of book. Press square to load a book.\n\n");
if (cmd) for(i=0; i<cmd; i++) oslPrintf("%s\n", buffer[i]);
}
So when I press x, it calls Next_Page, which reads from the file into a 2D char array, and then calls Show_Text with how many lines it read, and Show_Text oslPrintf's the lines...
It doesn't seem to work right, though
ergei