10-16-2010, 06:40 AM
(10-16-2010, 02:01 AM)Orphis Wrote: 64MB is doable, sure.
For the Gu functions, what are you using them for ?
We've learnt that most people didn't understand quite well how they work and the real intent using them. Since Gu is just a wrapper for the raw GE functionnality, sometimes when it's not used properly, it can make bad results in our emulator.
So can you describe the essential parts of your code that is not working so we can check them against a real PSP and our emulator ? A link to the source code could be useful too.
This is a part of the NanoTile accelerator of Nanodesktop HAL
(HAL_PSP\ndHAL_WindowsRender.c)
Code:
inline void INTERNAL_WindowsRender_NOTRASP_BACKGR ()
/*
Questa subroutine di WindowsRender esegue il render di tutto lo schermo. E' ottimizzata per
funzionare nel caso in cui non vi siano trasparenze ed il background sia attivato
*/
{
register unsigned short int PosPixelX, PosPixelY;
register unsigned short int RgPosX1, RgPosY1, RgPosX2, RgPosY2;
register unsigned short int NotActiveFBPage;
register unsigned short int RPosX, RPosY;
register unsigned char OwnerOfPixel;
register int Counter, CounterX, CounterY;
register int ADR;
NotActiveFBPage=!ActiveFBPage; // Tutte le operazioni di scrittura vengono eseguite nella pagina che
// in quel momento non è attiva
// Provvedi alla visualizzazione delle tiles
INTERNAL_SetupFastPutPixel (NotActiveFBPage);
sceGuStart(GU_DIRECT,ndlist); // Preparati ad inviare comandi al chip grafico della PSP
sceKernelDcacheWritebackAll(); // Pulisci la cache: necessario su PSP per evitare la corruzione dell'immagine
ADR=AddrVideoMemory+NotActiveFBPage*PageSize;
for (Counter=0; Counter<NrNanoTilesEnabled; Counter++)
{
RgPosX1 = ndNanoTile [Counter].PosX1+1; // Forza questi valori dentro ai registri
RgPosX2 = ndNanoTile [Counter].PosX2-1;
RgPosY1 = ndNanoTile [Counter].PosY1+1;
RgPosY2 = ndNanoTile [Counter].PosY2-1;
OwnerOfPixel = ndNanoTile [Counter].Level1;
if (OwnerOfPixel!=255) // Il tile appartiene a qualche finestra
{
RPosX=RgPosX1-(WindowData [OwnerOfPixel].WndLimitX1); // Viene calcolata la coordinata relativa per
RPosY=RgPosY1-(WindowData [OwnerOfPixel].WndLimitY1); // accesso alla ram delle pagine logiche
sceGuCopyImage(GU_PSM_5551, RPosX, RPosY, // Provvede a salvare la tile sullo schermo
RgPosX2-RgPosX1+1, RgPosY2-RgPosY1+1, // usando il chip grafico della PSP
WindowData [OwnerOfPixel].HwWndLength,
WindowData [OwnerOfPixel]._p,
RgPosX1, RgPosY1, 512,
(void *)(ADR));
sceGuTexSync();
}
else // Il tile appartiene allo sfondo, che però in questo caso non è vuoto
{
sceGuCopyImage(GU_PSM_5551, RgPosX1, RgPosY1, // Provvede a salvare la tile sullo schermo
RgPosX2-RgPosX1+1, RgPosY2-RgPosY1+1, // usando il chip grafico della PSP
NDCFG_BASESCREENX, // PntToBaseScreen->Pixel è un multiplo di 16 qui
&PntToBaseScreen->Pixel, // Indirizzo del basescreen
RgPosX1, RgPosY1, 512,
(void *)(ADR));
sceGuTexSync();
}
}
sceGuFinish();
sceGuSync(0,0);
// Provvedi alla visualizzazione dei contorni delle tiles: prima operiamo sui contorni verticali
for (CounterX=0; CounterX<NrXVertexEnabled; CounterX++)
{
for (CounterY=0; CounterY<Windows_MaxScreenY; CounterY++)
{
PosPixelX = ndXVertexBuffer [CounterX].PosX;
PosPixelY = CounterY;
OwnerOfPixel=OwnerArray [PosPixelX][PosPixelY][0];
if (OwnerOfPixel!=255) // Il pixel appartiene a qualche finestra
{
RPosX=PosPixelX-(WindowData[OwnerOfPixel].WndLimitX1); // Viene calcolata la coordinata relativa per
RPosY=PosPixelY-(WindowData[OwnerOfPixel].WndLimitY1); // accesso alla ram delle pagine logiche
INTERNAL_FastPutPixel (PosPixelX, PosPixelY, WINDOWDATA_P (OwnerOfPixel, RPosX, RPosY));
}
else // Il pixel appartiene allo sfondo
{
INTERNAL_FastPutPixel (PosPixelX, PosPixelY, PntToBaseScreen->Pixel [PosPixelY][PosPixelX]);
}
}
}
// Ed ora provvediamo a visualizzare i bordi orizzontali
for (CounterY=0; CounterY<NrYVertexEnabled; CounterY++)
{
PosPixelY = ndYVertexBuffer [CounterY].PosY;
INTERNAL_LoadLine (PosPixelY);
for (CounterX=0; CounterX<Windows_MaxScreenX; CounterX++)
{
PosPixelX = CounterX;
OwnerOfPixel=OwnerArray [PosPixelX][PosPixelY][0];
if (OwnerOfPixel!=255) // Il pixel appartiene a qualche finestra
{
RPosX=PosPixelX-(WindowData[OwnerOfPixel].WndLimitX1); // Viene calcolata la coordinata relativa per
RPosY=PosPixelY-(WindowData[OwnerOfPixel].WndLimitY1); // accesso alla ram delle pagine logiche
INTERNAL_SuperFastPutPixel (PosPixelX, WINDOWDATA_P (OwnerOfPixel, RPosX, RPosY));
}
else // Il pixel appartiene allo sfondo
{
INTERNAL_SuperFastPutPixel (PosPixelX, PntToBaseScreen->Pixel [PosPixelY][PosPixelX]);
}
}
}
}
As JPCSP HAL is written in way to adapt perfectly to the features
of your emulator, for us it would be sufficient to have a routine
that emulates:
void sceGuCopyImage (int psm, int sx, int sy, int width, int height, int srcw, void *src, int dx, int dy, int destw, void *dest)
Image transfer using the GE.
The HAL could recall the special routines of your emulated kernel:
it is not needed to emulate all SceGu routines.