| View previous topic :: View next topic |
| Author |
Message |
TheBuzzer
Joined: 06 Feb 2006 Posts: 49
|
Posted: Thu Sep 07, 2006 7:29 am Post subject: Graphics in vshex? |
|
|
| Is there a way to be able to import a png and let it display in vshex? |
|
| Back to top |
|
 |
weltall
Joined: 20 Feb 2004 Posts: 310
|
Posted: Thu Sep 07, 2006 9:30 pm Post subject: |
|
|
you need to open it, make it to 8888 format and then write trought direct vram access. i tried it yesterday with a raw (something quick and buggy just to see how it worked :P) , this is the sourcecode (it's crimped to 150*141).
| Code: |
#include <pspkernel.h>
#include <stdio.h>
#include <pspiofilemgr.h>
#include <pspctrl.h>
#include <string.h>
#include <pspgu.h>
PSP_MODULE_INFO("GFX", 0x1000, 1, 0);
//PSP_MAIN_THREAD_ATTR(0);
int a = 0;
int mainThread(SceSize args, void *argp)
{
int fd = sceIoOpen("ms0:/boot.raw", PSP_O_RDONLY, 0777);
int lenght = sceIoLseek(fd, 0, SEEK_END);
int id = sceKernelAllocPartitionMemory(2, "imgbuff", 0, lenght, NULL);
u32 *mybuf=sceKernelGetBlockHeadAddr(id);
u64 starttick;
u64 lasttick;
sceIoLseek(fd,0,SEEK_SET);
sceIoRead(fd, mybuf, lenght);
sceIoClose(fd);
sceRtcGetCurrentTick(&starttick);
while(1)
{
static u32* g_vram_base = (u32 *) 0x44000000; //0x04000000;
int y = 0;
int x = 0;
sceDisplayWaitVblankStart();
for(y = 0; y<141; y++)
{
for(x = 0; x<150; x++)
{
*(g_vram_base+(x+250+((y+100)*512))) = mybuf[x+(y*150)];
}
}
//sceKernelDcacheWritebackInvalidateAll();
sceRtcGetCurrentTick(&lasttick);
if(((lasttick-starttick)/sceRtcGetTickResolution()) > 20)
break;
}
sceKernelFreePartitionMemory(id);
sceKernelExitDeleteThread(0);
return 0;
}
int module_start (SceSize args, void *argp)
{
SceUID thid;
thid = sceKernelCreateThread("ch_main", mainThread, 0x64, 0x1000, 0, NULL);
if (thid >= 0) sceKernelStartThread(thid, args, argp);
return 0;
}
int module_stop (void)
{
return 0;
}
|
it has still some problems this function
1-it flikers, it seems to do one write every two vsyncs
2-it doesn't load the entire file or doesn't write it correctly
3-you need to use psptex with all options disabled and the option with 8888 to make a valid raw image |
|
| Back to top |
|
 |
TheBuzzer
Joined: 06 Feb 2006 Posts: 49
|
Posted: Fri Sep 08, 2006 7:20 am Post subject: |
|
|
so it got to be a raw image?
wonder will someone make it using png format.
thx though. maybe this will help someone be able to figure out how to import a png and change it to vshex extendor type prx |
|
| Back to top |
|
 |
weltall
Joined: 20 Feb 2004 Posts: 310
|
Posted: Fri Sep 08, 2006 3:40 pm Post subject: |
|
|
that's not a problem a png image but prepare two buffer (and hope there is space in kernel ram :P)
in one you fill the png image and send it to the libpng. when it's decoded in the second buffer you have a raw image and you can drop the png data.
you can get an example which loads a png image from memory (i didn't try using fopen so if it doesn't work with the kernel libc you need to use sceIoOpen) from the lua graphic library (you can find it under the lua svn folder as graphics.cpp/graphics.h)
then because the vsh is in 8888 format you don't have to do anything more after having decompressed it :) |
|
| Back to top |
|
 |
TheBuzzer
Joined: 06 Feb 2006 Posts: 49
|
Posted: Sat Sep 09, 2006 4:54 pm Post subject: |
|
|
so how does this extectly work?
I been trying to figure out how stuff is getting displied in vshex extendor but I barely know how does displaying even work |
|
| Back to top |
|
 |
dot_blank

Joined: 28 Sep 2005 Posts: 498 Location: Brasil
|
Posted: Sat Sep 09, 2006 5:55 pm Post subject: |
|
|
you def do not want to be in kernel memory for this stuff _________________ 10011011 00101010 11010111 10001001 10111010 |
|
| Back to top |
|
 |
|