mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
some work on PSP CLUT
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@277 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
70357ce525
commit
9112b6ce9f
9 changed files with 312 additions and 111 deletions
36
Pico/Draw2.c
36
Pico/Draw2.c
|
@ -20,6 +20,12 @@
|
||||||
|
|
||||||
#define USE_CACHE
|
#define USE_CACHE
|
||||||
|
|
||||||
|
// note: this is not implemented in ARM asm
|
||||||
|
#if defined(DRAW2_OVERRIDE_LINE_WIDTH)
|
||||||
|
#define LINE_WIDTH DRAW2_OVERRIDE_LINE_WIDTH
|
||||||
|
#else
|
||||||
|
#define LINE_WIDTH 328
|
||||||
|
#endif
|
||||||
|
|
||||||
int currpri = 0;
|
int currpri = 0;
|
||||||
|
|
||||||
|
@ -45,7 +51,7 @@ static int TileXnormYnorm(unsigned char *pd,int addr,unsigned char pal)
|
||||||
unsigned int pack=0; unsigned int t=0, blank = 1;
|
unsigned int pack=0; unsigned int t=0, blank = 1;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i=8; i; i--, addr+=2, pd += 320+8) {
|
for(i=8; i; i--, addr+=2, pd += LINE_WIDTH) {
|
||||||
pack=*(unsigned int *)(Pico.vram+addr); // Get 8 pixels
|
pack=*(unsigned int *)(Pico.vram+addr); // Get 8 pixels
|
||||||
if(!pack) continue;
|
if(!pack) continue;
|
||||||
|
|
||||||
|
@ -68,7 +74,7 @@ static int TileXflipYnorm(unsigned char *pd,int addr,unsigned char pal)
|
||||||
unsigned int pack=0; unsigned int t=0, blank = 1;
|
unsigned int pack=0; unsigned int t=0, blank = 1;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i=8; i; i--, addr+=2, pd += 320+8) {
|
for(i=8; i; i--, addr+=2, pd += LINE_WIDTH) {
|
||||||
pack=*(unsigned int *)(Pico.vram+addr); // Get 8 pixels
|
pack=*(unsigned int *)(Pico.vram+addr); // Get 8 pixels
|
||||||
if(!pack) continue;
|
if(!pack) continue;
|
||||||
|
|
||||||
|
@ -91,7 +97,7 @@ static int TileXnormYflip(unsigned char *pd,int addr,unsigned char pal)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
addr+=14;
|
addr+=14;
|
||||||
for(i=8; i; i--, addr-=2, pd += 320+8) {
|
for(i=8; i; i--, addr-=2, pd += LINE_WIDTH) {
|
||||||
pack=*(unsigned int *)(Pico.vram+addr); // Get 8 pixels
|
pack=*(unsigned int *)(Pico.vram+addr); // Get 8 pixels
|
||||||
if(!pack) continue;
|
if(!pack) continue;
|
||||||
|
|
||||||
|
@ -115,7 +121,7 @@ static int TileXflipYflip(unsigned char *pd,int addr,unsigned char pal)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
addr+=14;
|
addr+=14;
|
||||||
for(i=8; i; i--, addr-=2, pd += 320+8) {
|
for(i=8; i; i--, addr-=2, pd += LINE_WIDTH) {
|
||||||
pack=*(unsigned int *)(Pico.vram+addr); // Get 8 pixels
|
pack=*(unsigned int *)(Pico.vram+addr); // Get 8 pixels
|
||||||
if(!pack) continue;
|
if(!pack) continue;
|
||||||
|
|
||||||
|
@ -164,8 +170,8 @@ static void DrawWindowFull(int start, int end, int prio)
|
||||||
code=Pico.vram[nametab+tile_start];
|
code=Pico.vram[nametab+tile_start];
|
||||||
if ((code>>15) != prio) return; // hack: just assume that whole window uses same priority
|
if ((code>>15) != prio) return; // hack: just assume that whole window uses same priority
|
||||||
|
|
||||||
scrpos+=8*328+8;
|
scrpos+=8*LINE_WIDTH+8;
|
||||||
scrpos+=8*328*(start-START_ROW);
|
scrpos+=8*LINE_WIDTH*(start-START_ROW);
|
||||||
|
|
||||||
// do a window until we reach planestart row
|
// do a window until we reach planestart row
|
||||||
for(trow = start; trow < end; trow++, nametab+=nametab_step) { // current tile row
|
for(trow = start; trow < end; trow++, nametab+=nametab_step) { // current tile row
|
||||||
|
@ -193,7 +199,7 @@ static void DrawWindowFull(int start, int end, int prio)
|
||||||
if(zero) blank=code; // We know this tile is blank now
|
if(zero) blank=code; // We know this tile is blank now
|
||||||
}
|
}
|
||||||
|
|
||||||
scrpos += 328*8;
|
scrpos += LINE_WIDTH*8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,11 +245,11 @@ static void DrawLayerFull(int plane, int *hcache, int planestart, int planeend)
|
||||||
else nametab=(pvid->reg[4]&0x07)<<12; // B
|
else nametab=(pvid->reg[4]&0x07)<<12; // B
|
||||||
|
|
||||||
scrpos = PicoDraw2FB;
|
scrpos = PicoDraw2FB;
|
||||||
scrpos+=8*328*(planestart-START_ROW);
|
scrpos+=8*LINE_WIDTH*(planestart-START_ROW);
|
||||||
|
|
||||||
// Get vertical scroll value:
|
// Get vertical scroll value:
|
||||||
vscroll=Pico.vsram[plane]&0x1ff;
|
vscroll=Pico.vsram[plane]&0x1ff;
|
||||||
scrpos+=(8-(vscroll&7))*328;
|
scrpos+=(8-(vscroll&7))*LINE_WIDTH;
|
||||||
if(vscroll&7) planeend++; // we have vertically clipped tiles due to vscroll, so we need 1 more row
|
if(vscroll&7) planeend++; // we have vertically clipped tiles due to vscroll, so we need 1 more row
|
||||||
|
|
||||||
*hcache++ = 8-(vscroll&7); // push y-offset to tilecache
|
*hcache++ = 8-(vscroll&7); // push y-offset to tilecache
|
||||||
|
@ -302,7 +308,7 @@ static void DrawLayerFull(int plane, int *hcache, int planestart, int planeend)
|
||||||
if(zero) blank=code; // We know this tile is blank now
|
if(zero) blank=code; // We know this tile is blank now
|
||||||
}
|
}
|
||||||
|
|
||||||
scrpos += 328*8;
|
scrpos += LINE_WIDTH*8;
|
||||||
}
|
}
|
||||||
|
|
||||||
*hcache = 0; // terminate cache
|
*hcache = 0; // terminate cache
|
||||||
|
@ -319,7 +325,7 @@ static void DrawTilesFromCacheF(int *hc)
|
||||||
unsigned char *scrpos = PicoDraw2FB, *pd = 0;
|
unsigned char *scrpos = PicoDraw2FB, *pd = 0;
|
||||||
|
|
||||||
// *hcache++ = code|(dx<<16)|(trow<<27); // cache it
|
// *hcache++ = code|(dx<<16)|(trow<<27); // cache it
|
||||||
scrpos+=(*hc++)*328 - START_ROW*328*8;
|
scrpos+=(*hc++)*LINE_WIDTH - START_ROW*LINE_WIDTH*8;
|
||||||
|
|
||||||
while((code=*hc++)) {
|
while((code=*hc++)) {
|
||||||
if((short)code == blank) continue;
|
if((short)code == blank) continue;
|
||||||
|
@ -327,7 +333,7 @@ static void DrawTilesFromCacheF(int *hc)
|
||||||
// y pos
|
// y pos
|
||||||
if(((unsigned)code>>27) != prevy) {
|
if(((unsigned)code>>27) != prevy) {
|
||||||
prevy = (unsigned)code>>27;
|
prevy = (unsigned)code>>27;
|
||||||
pd = scrpos + prevy*328*8;
|
pd = scrpos + prevy*LINE_WIDTH*8;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get tile address/2:
|
// Get tile address/2:
|
||||||
|
@ -380,7 +386,7 @@ static void DrawSpriteFull(unsigned int *sprite)
|
||||||
while(sy <= START_ROW*8) { sy+=8; tile+=tdeltay; height--; }
|
while(sy <= START_ROW*8) { sy+=8; tile+=tdeltay; height--; }
|
||||||
|
|
||||||
scrpos = PicoDraw2FB;
|
scrpos = PicoDraw2FB;
|
||||||
scrpos+=(sy-START_ROW*8)*328;
|
scrpos+=(sy-START_ROW*8)*LINE_WIDTH;
|
||||||
|
|
||||||
for (; height > 0; height--, sy+=8, tile+=tdeltay)
|
for (; height > 0; height--, sy+=8, tile+=tdeltay)
|
||||||
{
|
{
|
||||||
|
@ -402,7 +408,7 @@ static void DrawSpriteFull(unsigned int *sprite)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scrpos+=8*328;
|
scrpos+=8*LINE_WIDTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -488,7 +494,7 @@ static void BackFillFull(int reg7)
|
||||||
back|=back<<8;
|
back|=back<<8;
|
||||||
back|=back<<16;
|
back|=back<<16;
|
||||||
|
|
||||||
for(i = (8+320)*(8+(END_ROW-START_ROW)*8)/16; i; i--) {
|
for(i = LINE_WIDTH*(8+(END_ROW-START_ROW)*8)/16; i; i--) {
|
||||||
*p++ = back; // do 16 pixels per iteration
|
*p++ = back; // do 16 pixels per iteration
|
||||||
*p++ = back;
|
*p++ = back;
|
||||||
*p++ = back;
|
*p++ = back;
|
||||||
|
|
|
@ -523,7 +523,7 @@ static u32 flag_I;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void init_jump_table(void);
|
static int init_jump_table(void);
|
||||||
|
|
||||||
/* Custom function handler */
|
/* Custom function handler */
|
||||||
typedef void (*icust_handler_func)(u32 vector);
|
typedef void (*icust_handler_func)(u32 vector);
|
||||||
|
@ -939,8 +939,12 @@ int m68k_emulate(s32 cycles)
|
||||||
{
|
{
|
||||||
if (!initialised)
|
if (!initialised)
|
||||||
{
|
{
|
||||||
|
#ifdef FAMEC_NO_GOTOS
|
||||||
init_jump_table();
|
init_jump_table();
|
||||||
return 0;
|
return 0;
|
||||||
|
#else
|
||||||
|
goto init_jump_table;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Comprobar si la CPU esta detenida debido a un doble error de bus */
|
/* Comprobar si la CPU esta detenida debido a un doble error de bus */
|
||||||
|
@ -1078,12 +1082,16 @@ famec_Exec:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return cycles - m68kcontext.io_cycle_counter;
|
return cycles - m68kcontext.io_cycle_counter;
|
||||||
|
|
||||||
|
#ifdef FAMEC_NO_GOTOS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int init_jump_table(void)
|
||||||
|
{{
|
||||||
static void init_jump_table(void)
|
#else
|
||||||
|
init_jump_table:
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
u32 i, j;
|
u32 i, j;
|
||||||
|
|
||||||
for(i = 0x0000; i <= 0xFFFF; i += 0x0001)
|
for(i = 0x0000; i <= 0xFFFF; i += 0x0001)
|
||||||
|
@ -5090,6 +5098,7 @@ static void init_jump_table(void)
|
||||||
JumpTable[0xF000 + i] = CAST_OP(0xF000);
|
JumpTable[0xF000 + i] = CAST_OP(0xF000);
|
||||||
|
|
||||||
initialised = 1;
|
initialised = 1;
|
||||||
}
|
return 0;
|
||||||
|
}}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27595,7 +27595,7 @@ OPCODE(0x81C0)
|
||||||
{
|
{
|
||||||
execute_exception(M68K_ZERO_DIVIDE_EX);
|
execute_exception(M68K_ZERO_DIVIDE_EX);
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81C0;
|
||||||
#endif
|
#endif
|
||||||
RET(10)
|
RET(10)
|
||||||
}
|
}
|
||||||
|
@ -27607,7 +27607,7 @@ goto end;
|
||||||
res = 0;
|
res = 0;
|
||||||
DREGu32((Opcode >> 9) & 7) = res;
|
DREGu32((Opcode >> 9) & 7) = res;
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81C0;
|
||||||
#endif
|
#endif
|
||||||
RET(50)
|
RET(50)
|
||||||
}
|
}
|
||||||
|
@ -27621,7 +27621,7 @@ goto end;
|
||||||
{
|
{
|
||||||
flag_V = M68K_SR_V;
|
flag_V = M68K_SR_V;
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81C0;
|
||||||
#endif
|
#endif
|
||||||
RET(80)
|
RET(80)
|
||||||
}
|
}
|
||||||
|
@ -27633,7 +27633,7 @@ goto end;
|
||||||
DREGu32((Opcode >> 9) & 7) = res;
|
DREGu32((Opcode >> 9) & 7) = res;
|
||||||
}
|
}
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
end: m68kcontext.io_cycle_counter -= 50;
|
end81C0: m68kcontext.io_cycle_counter -= 50;
|
||||||
#endif
|
#endif
|
||||||
RET(108)
|
RET(108)
|
||||||
}
|
}
|
||||||
|
@ -27651,7 +27651,7 @@ OPCODE(0x81D0)
|
||||||
{
|
{
|
||||||
execute_exception(M68K_ZERO_DIVIDE_EX);
|
execute_exception(M68K_ZERO_DIVIDE_EX);
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81D0;
|
||||||
#endif
|
#endif
|
||||||
RET(14)
|
RET(14)
|
||||||
}
|
}
|
||||||
|
@ -27663,7 +27663,7 @@ goto end;
|
||||||
res = 0;
|
res = 0;
|
||||||
DREGu32((Opcode >> 9) & 7) = res;
|
DREGu32((Opcode >> 9) & 7) = res;
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81D0;
|
||||||
#endif
|
#endif
|
||||||
RET(54)
|
RET(54)
|
||||||
}
|
}
|
||||||
|
@ -27677,7 +27677,7 @@ goto end;
|
||||||
{
|
{
|
||||||
flag_V = M68K_SR_V;
|
flag_V = M68K_SR_V;
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81D0;
|
||||||
#endif
|
#endif
|
||||||
RET(84)
|
RET(84)
|
||||||
}
|
}
|
||||||
|
@ -27689,7 +27689,7 @@ goto end;
|
||||||
DREGu32((Opcode >> 9) & 7) = res;
|
DREGu32((Opcode >> 9) & 7) = res;
|
||||||
}
|
}
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
end: m68kcontext.io_cycle_counter -= 50;
|
end81D0: m68kcontext.io_cycle_counter -= 50;
|
||||||
#endif
|
#endif
|
||||||
RET(112)
|
RET(112)
|
||||||
}
|
}
|
||||||
|
@ -27708,7 +27708,7 @@ OPCODE(0x81D8)
|
||||||
{
|
{
|
||||||
execute_exception(M68K_ZERO_DIVIDE_EX);
|
execute_exception(M68K_ZERO_DIVIDE_EX);
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81D8;
|
||||||
#endif
|
#endif
|
||||||
RET(14)
|
RET(14)
|
||||||
}
|
}
|
||||||
|
@ -27720,7 +27720,7 @@ goto end;
|
||||||
res = 0;
|
res = 0;
|
||||||
DREGu32((Opcode >> 9) & 7) = res;
|
DREGu32((Opcode >> 9) & 7) = res;
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81D8;
|
||||||
#endif
|
#endif
|
||||||
RET(54)
|
RET(54)
|
||||||
}
|
}
|
||||||
|
@ -27734,7 +27734,7 @@ goto end;
|
||||||
{
|
{
|
||||||
flag_V = M68K_SR_V;
|
flag_V = M68K_SR_V;
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81D8;
|
||||||
#endif
|
#endif
|
||||||
RET(84)
|
RET(84)
|
||||||
}
|
}
|
||||||
|
@ -27746,7 +27746,7 @@ goto end;
|
||||||
DREGu32((Opcode >> 9) & 7) = res;
|
DREGu32((Opcode >> 9) & 7) = res;
|
||||||
}
|
}
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
end: m68kcontext.io_cycle_counter -= 50;
|
end81D8: m68kcontext.io_cycle_counter -= 50;
|
||||||
#endif
|
#endif
|
||||||
RET(112)
|
RET(112)
|
||||||
}
|
}
|
||||||
|
@ -27765,7 +27765,7 @@ OPCODE(0x81E0)
|
||||||
{
|
{
|
||||||
execute_exception(M68K_ZERO_DIVIDE_EX);
|
execute_exception(M68K_ZERO_DIVIDE_EX);
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81E0;
|
||||||
#endif
|
#endif
|
||||||
RET(16)
|
RET(16)
|
||||||
}
|
}
|
||||||
|
@ -27777,7 +27777,7 @@ goto end;
|
||||||
res = 0;
|
res = 0;
|
||||||
DREGu32((Opcode >> 9) & 7) = res;
|
DREGu32((Opcode >> 9) & 7) = res;
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81E0;
|
||||||
#endif
|
#endif
|
||||||
RET(56)
|
RET(56)
|
||||||
}
|
}
|
||||||
|
@ -27791,7 +27791,7 @@ goto end;
|
||||||
{
|
{
|
||||||
flag_V = M68K_SR_V;
|
flag_V = M68K_SR_V;
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81E0;
|
||||||
#endif
|
#endif
|
||||||
RET(86)
|
RET(86)
|
||||||
}
|
}
|
||||||
|
@ -27803,7 +27803,7 @@ goto end;
|
||||||
DREGu32((Opcode >> 9) & 7) = res;
|
DREGu32((Opcode >> 9) & 7) = res;
|
||||||
}
|
}
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
end: m68kcontext.io_cycle_counter -= 50;
|
end81E0: m68kcontext.io_cycle_counter -= 50;
|
||||||
#endif
|
#endif
|
||||||
RET(114)
|
RET(114)
|
||||||
}
|
}
|
||||||
|
@ -27822,7 +27822,7 @@ OPCODE(0x81E8)
|
||||||
{
|
{
|
||||||
execute_exception(M68K_ZERO_DIVIDE_EX);
|
execute_exception(M68K_ZERO_DIVIDE_EX);
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81E8;
|
||||||
#endif
|
#endif
|
||||||
RET(18)
|
RET(18)
|
||||||
}
|
}
|
||||||
|
@ -27834,7 +27834,7 @@ goto end;
|
||||||
res = 0;
|
res = 0;
|
||||||
DREGu32((Opcode >> 9) & 7) = res;
|
DREGu32((Opcode >> 9) & 7) = res;
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81E8;
|
||||||
#endif
|
#endif
|
||||||
RET(58)
|
RET(58)
|
||||||
}
|
}
|
||||||
|
@ -27848,7 +27848,7 @@ goto end;
|
||||||
{
|
{
|
||||||
flag_V = M68K_SR_V;
|
flag_V = M68K_SR_V;
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81E8;
|
||||||
#endif
|
#endif
|
||||||
RET(88)
|
RET(88)
|
||||||
}
|
}
|
||||||
|
@ -27860,7 +27860,7 @@ goto end;
|
||||||
DREGu32((Opcode >> 9) & 7) = res;
|
DREGu32((Opcode >> 9) & 7) = res;
|
||||||
}
|
}
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
end: m68kcontext.io_cycle_counter -= 50;
|
end81E8: m68kcontext.io_cycle_counter -= 50;
|
||||||
#endif
|
#endif
|
||||||
RET(116)
|
RET(116)
|
||||||
}
|
}
|
||||||
|
@ -27879,7 +27879,7 @@ OPCODE(0x81F0)
|
||||||
{
|
{
|
||||||
execute_exception(M68K_ZERO_DIVIDE_EX);
|
execute_exception(M68K_ZERO_DIVIDE_EX);
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81F0;
|
||||||
#endif
|
#endif
|
||||||
RET(20)
|
RET(20)
|
||||||
}
|
}
|
||||||
|
@ -27891,7 +27891,7 @@ goto end;
|
||||||
res = 0;
|
res = 0;
|
||||||
DREGu32((Opcode >> 9) & 7) = res;
|
DREGu32((Opcode >> 9) & 7) = res;
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81F0;
|
||||||
#endif
|
#endif
|
||||||
RET(60)
|
RET(60)
|
||||||
}
|
}
|
||||||
|
@ -27905,7 +27905,7 @@ goto end;
|
||||||
{
|
{
|
||||||
flag_V = M68K_SR_V;
|
flag_V = M68K_SR_V;
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81F0;
|
||||||
#endif
|
#endif
|
||||||
RET(90)
|
RET(90)
|
||||||
}
|
}
|
||||||
|
@ -27917,7 +27917,7 @@ goto end;
|
||||||
DREGu32((Opcode >> 9) & 7) = res;
|
DREGu32((Opcode >> 9) & 7) = res;
|
||||||
}
|
}
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
end: m68kcontext.io_cycle_counter -= 50;
|
end81F0: m68kcontext.io_cycle_counter -= 50;
|
||||||
#endif
|
#endif
|
||||||
RET(118)
|
RET(118)
|
||||||
}
|
}
|
||||||
|
@ -27935,7 +27935,7 @@ OPCODE(0x81F8)
|
||||||
{
|
{
|
||||||
execute_exception(M68K_ZERO_DIVIDE_EX);
|
execute_exception(M68K_ZERO_DIVIDE_EX);
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81F8;
|
||||||
#endif
|
#endif
|
||||||
RET(18)
|
RET(18)
|
||||||
}
|
}
|
||||||
|
@ -27947,7 +27947,7 @@ goto end;
|
||||||
res = 0;
|
res = 0;
|
||||||
DREGu32((Opcode >> 9) & 7) = res;
|
DREGu32((Opcode >> 9) & 7) = res;
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81F8;
|
||||||
#endif
|
#endif
|
||||||
RET(58)
|
RET(58)
|
||||||
}
|
}
|
||||||
|
@ -27961,7 +27961,7 @@ goto end;
|
||||||
{
|
{
|
||||||
flag_V = M68K_SR_V;
|
flag_V = M68K_SR_V;
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81F8;
|
||||||
#endif
|
#endif
|
||||||
RET(88)
|
RET(88)
|
||||||
}
|
}
|
||||||
|
@ -27973,7 +27973,7 @@ goto end;
|
||||||
DREGu32((Opcode >> 9) & 7) = res;
|
DREGu32((Opcode >> 9) & 7) = res;
|
||||||
}
|
}
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
end: m68kcontext.io_cycle_counter -= 50;
|
end81F8: m68kcontext.io_cycle_counter -= 50;
|
||||||
#endif
|
#endif
|
||||||
RET(116)
|
RET(116)
|
||||||
}
|
}
|
||||||
|
@ -27991,7 +27991,7 @@ OPCODE(0x81F9)
|
||||||
{
|
{
|
||||||
execute_exception(M68K_ZERO_DIVIDE_EX);
|
execute_exception(M68K_ZERO_DIVIDE_EX);
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81F9;
|
||||||
#endif
|
#endif
|
||||||
RET(22)
|
RET(22)
|
||||||
}
|
}
|
||||||
|
@ -28003,7 +28003,7 @@ goto end;
|
||||||
res = 0;
|
res = 0;
|
||||||
DREGu32((Opcode >> 9) & 7) = res;
|
DREGu32((Opcode >> 9) & 7) = res;
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81F9;
|
||||||
#endif
|
#endif
|
||||||
RET(62)
|
RET(62)
|
||||||
}
|
}
|
||||||
|
@ -28017,7 +28017,7 @@ goto end;
|
||||||
{
|
{
|
||||||
flag_V = M68K_SR_V;
|
flag_V = M68K_SR_V;
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81F9;
|
||||||
#endif
|
#endif
|
||||||
RET(92)
|
RET(92)
|
||||||
}
|
}
|
||||||
|
@ -28029,7 +28029,7 @@ goto end;
|
||||||
DREGu32((Opcode >> 9) & 7) = res;
|
DREGu32((Opcode >> 9) & 7) = res;
|
||||||
}
|
}
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
end: m68kcontext.io_cycle_counter -= 50;
|
end81F9: m68kcontext.io_cycle_counter -= 50;
|
||||||
#endif
|
#endif
|
||||||
RET(120)
|
RET(120)
|
||||||
}
|
}
|
||||||
|
@ -28048,7 +28048,7 @@ OPCODE(0x81FA)
|
||||||
{
|
{
|
||||||
execute_exception(M68K_ZERO_DIVIDE_EX);
|
execute_exception(M68K_ZERO_DIVIDE_EX);
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81FA;
|
||||||
#endif
|
#endif
|
||||||
RET(18)
|
RET(18)
|
||||||
}
|
}
|
||||||
|
@ -28060,7 +28060,7 @@ goto end;
|
||||||
res = 0;
|
res = 0;
|
||||||
DREGu32((Opcode >> 9) & 7) = res;
|
DREGu32((Opcode >> 9) & 7) = res;
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81FA;
|
||||||
#endif
|
#endif
|
||||||
RET(58)
|
RET(58)
|
||||||
}
|
}
|
||||||
|
@ -28074,7 +28074,7 @@ goto end;
|
||||||
{
|
{
|
||||||
flag_V = M68K_SR_V;
|
flag_V = M68K_SR_V;
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81FA;
|
||||||
#endif
|
#endif
|
||||||
RET(88)
|
RET(88)
|
||||||
}
|
}
|
||||||
|
@ -28086,7 +28086,7 @@ goto end;
|
||||||
DREGu32((Opcode >> 9) & 7) = res;
|
DREGu32((Opcode >> 9) & 7) = res;
|
||||||
}
|
}
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
end: m68kcontext.io_cycle_counter -= 50;
|
end81FA: m68kcontext.io_cycle_counter -= 50;
|
||||||
#endif
|
#endif
|
||||||
RET(116)
|
RET(116)
|
||||||
}
|
}
|
||||||
|
@ -28105,7 +28105,7 @@ OPCODE(0x81FB)
|
||||||
{
|
{
|
||||||
execute_exception(M68K_ZERO_DIVIDE_EX);
|
execute_exception(M68K_ZERO_DIVIDE_EX);
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81FB;
|
||||||
#endif
|
#endif
|
||||||
RET(20)
|
RET(20)
|
||||||
}
|
}
|
||||||
|
@ -28117,7 +28117,7 @@ goto end;
|
||||||
res = 0;
|
res = 0;
|
||||||
DREGu32((Opcode >> 9) & 7) = res;
|
DREGu32((Opcode >> 9) & 7) = res;
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81FB;
|
||||||
#endif
|
#endif
|
||||||
RET(60)
|
RET(60)
|
||||||
}
|
}
|
||||||
|
@ -28131,7 +28131,7 @@ goto end;
|
||||||
{
|
{
|
||||||
flag_V = M68K_SR_V;
|
flag_V = M68K_SR_V;
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81FB;
|
||||||
#endif
|
#endif
|
||||||
RET(90)
|
RET(90)
|
||||||
}
|
}
|
||||||
|
@ -28143,7 +28143,7 @@ goto end;
|
||||||
DREGu32((Opcode >> 9) & 7) = res;
|
DREGu32((Opcode >> 9) & 7) = res;
|
||||||
}
|
}
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
end: m68kcontext.io_cycle_counter -= 50;
|
end81FB: m68kcontext.io_cycle_counter -= 50;
|
||||||
#endif
|
#endif
|
||||||
RET(118)
|
RET(118)
|
||||||
}
|
}
|
||||||
|
@ -28159,7 +28159,7 @@ OPCODE(0x81FC)
|
||||||
{
|
{
|
||||||
execute_exception(M68K_ZERO_DIVIDE_EX);
|
execute_exception(M68K_ZERO_DIVIDE_EX);
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81FC;
|
||||||
#endif
|
#endif
|
||||||
RET(14)
|
RET(14)
|
||||||
}
|
}
|
||||||
|
@ -28171,7 +28171,7 @@ goto end;
|
||||||
res = 0;
|
res = 0;
|
||||||
DREGu32((Opcode >> 9) & 7) = res;
|
DREGu32((Opcode >> 9) & 7) = res;
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81FC;
|
||||||
#endif
|
#endif
|
||||||
RET(54)
|
RET(54)
|
||||||
}
|
}
|
||||||
|
@ -28185,7 +28185,7 @@ goto end;
|
||||||
{
|
{
|
||||||
flag_V = M68K_SR_V;
|
flag_V = M68K_SR_V;
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81FC;
|
||||||
#endif
|
#endif
|
||||||
RET(84)
|
RET(84)
|
||||||
}
|
}
|
||||||
|
@ -28197,7 +28197,7 @@ goto end;
|
||||||
DREGu32((Opcode >> 9) & 7) = res;
|
DREGu32((Opcode >> 9) & 7) = res;
|
||||||
}
|
}
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
end: m68kcontext.io_cycle_counter -= 50;
|
end81FC: m68kcontext.io_cycle_counter -= 50;
|
||||||
#endif
|
#endif
|
||||||
RET(112)
|
RET(112)
|
||||||
}
|
}
|
||||||
|
@ -28216,7 +28216,7 @@ OPCODE(0x81DF)
|
||||||
{
|
{
|
||||||
execute_exception(M68K_ZERO_DIVIDE_EX);
|
execute_exception(M68K_ZERO_DIVIDE_EX);
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81DF;
|
||||||
#endif
|
#endif
|
||||||
RET(14)
|
RET(14)
|
||||||
}
|
}
|
||||||
|
@ -28228,7 +28228,7 @@ goto end;
|
||||||
res = 0;
|
res = 0;
|
||||||
DREGu32((Opcode >> 9) & 7) = res;
|
DREGu32((Opcode >> 9) & 7) = res;
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81DF;
|
||||||
#endif
|
#endif
|
||||||
RET(54)
|
RET(54)
|
||||||
}
|
}
|
||||||
|
@ -28242,7 +28242,7 @@ goto end;
|
||||||
{
|
{
|
||||||
flag_V = M68K_SR_V;
|
flag_V = M68K_SR_V;
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81DF;
|
||||||
#endif
|
#endif
|
||||||
RET(84)
|
RET(84)
|
||||||
}
|
}
|
||||||
|
@ -28254,7 +28254,7 @@ goto end;
|
||||||
DREGu32((Opcode >> 9) & 7) = res;
|
DREGu32((Opcode >> 9) & 7) = res;
|
||||||
}
|
}
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
end: m68kcontext.io_cycle_counter -= 50;
|
end81DF: m68kcontext.io_cycle_counter -= 50;
|
||||||
#endif
|
#endif
|
||||||
RET(112)
|
RET(112)
|
||||||
}
|
}
|
||||||
|
@ -28273,7 +28273,7 @@ OPCODE(0x81E7)
|
||||||
{
|
{
|
||||||
execute_exception(M68K_ZERO_DIVIDE_EX);
|
execute_exception(M68K_ZERO_DIVIDE_EX);
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81E7;
|
||||||
#endif
|
#endif
|
||||||
RET(16)
|
RET(16)
|
||||||
}
|
}
|
||||||
|
@ -28285,7 +28285,7 @@ goto end;
|
||||||
res = 0;
|
res = 0;
|
||||||
DREGu32((Opcode >> 9) & 7) = res;
|
DREGu32((Opcode >> 9) & 7) = res;
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81E7;
|
||||||
#endif
|
#endif
|
||||||
RET(56)
|
RET(56)
|
||||||
}
|
}
|
||||||
|
@ -28299,7 +28299,7 @@ goto end;
|
||||||
{
|
{
|
||||||
flag_V = M68K_SR_V;
|
flag_V = M68K_SR_V;
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
goto end;
|
goto end81E7;
|
||||||
#endif
|
#endif
|
||||||
RET(86)
|
RET(86)
|
||||||
}
|
}
|
||||||
|
@ -28311,7 +28311,7 @@ goto end;
|
||||||
DREGu32((Opcode >> 9) & 7) = res;
|
DREGu32((Opcode >> 9) & 7) = res;
|
||||||
}
|
}
|
||||||
#ifdef USE_CYCLONE_TIMING_DIV
|
#ifdef USE_CYCLONE_TIMING_DIV
|
||||||
end: m68kcontext.io_cycle_counter -= 50;
|
end81E7: m68kcontext.io_cycle_counter -= 50;
|
||||||
#endif
|
#endif
|
||||||
RET(114)
|
RET(114)
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,7 +225,6 @@ void menu_init(void)
|
||||||
int tmp = parse_hex_color(buff+16);
|
int tmp = parse_hex_color(buff+16);
|
||||||
if (tmp >= 0) menu_sel_color = tmp;
|
if (tmp >= 0) menu_sel_color = tmp;
|
||||||
else lprintf("skin.txt: parse error for selection_color\n");
|
else lprintf("skin.txt: parse error for selection_color\n");
|
||||||
lprintf("sel color: %04x\n", menu_sel_color);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
lprintf("skin.txt: parse error: %s\n", buff);
|
lprintf("skin.txt: parse error: %s\n", buff);
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#include <pspthreadman.h>
|
#include <pspthreadman.h>
|
||||||
#include <pspdisplay.h>
|
#include <pspdisplay.h>
|
||||||
|
#include <psputils.h>
|
||||||
|
#include <pspgu.h>
|
||||||
|
|
||||||
#include "psp.h"
|
#include "psp.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
|
@ -18,15 +20,8 @@
|
||||||
#define OSD_FPS_X 260
|
#define OSD_FPS_X 260
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// vram usage map:
|
|
||||||
// 000000-044000 fb0
|
|
||||||
// 044000-088000 fb1
|
|
||||||
// 088000-0ae000 texture0
|
|
||||||
// 0ae000-0d4000 texture1
|
|
||||||
|
|
||||||
char romFileName[PATH_MAX];
|
char romFileName[PATH_MAX];
|
||||||
static unsigned char picoD2FB[(8+320)*(8+240+8)];
|
unsigned char *PicoDraw2FB = (unsigned char *)VRAM_CACHED_STUFF + 8; // +8 to be able to skip border with 1 quadword..
|
||||||
unsigned char *PicoDraw2FB = picoD2FB; // temporary buffer for alt renderer ( (8+320)*(8+240+8) )
|
|
||||||
int engineState;
|
int engineState;
|
||||||
|
|
||||||
static int combo_keys = 0, combo_acts = 0; // keys and actions which need button combos
|
static int combo_keys = 0, combo_acts = 0; // keys and actions which need button combos
|
||||||
|
@ -139,14 +134,117 @@ void emu_setDefaultConfig(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static unsigned short __attribute__((aligned(16))) localPal[0x100];
|
||||||
|
|
||||||
|
struct Vertex
|
||||||
|
{
|
||||||
|
short u,v;
|
||||||
|
short x,y,z;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void EmuScanPrepare(void)
|
||||||
|
{
|
||||||
|
HighCol = VRAM_STUFF;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
sceGuSync(0,0); // sync with prev
|
||||||
|
sceGuStart(GU_DIRECT, guCmdList);
|
||||||
|
// sceGuDispBuffer(480, 272, psp_screen == VRAM_FB0 ? VRAMOFFS_FB1 : VRAMOFFS_FB0, 512);
|
||||||
|
sceGuDrawBuffer(GU_PSM_5650, psp_screen == VRAM_FB0 ? VRAMOFFS_FB0 : VRAMOFFS_FB1, 512); // point to back fb?
|
||||||
|
sceGuFinish();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static int EmuScan16(unsigned int num, void *sdata)
|
static int EmuScan16(unsigned int num, void *sdata)
|
||||||
{
|
{
|
||||||
if (!(Pico.video.reg[1]&8)) num += 8;
|
// struct Vertex* vertices;
|
||||||
DrawLineDest = (unsigned short *) psp_screen + 512*(num+1);
|
|
||||||
|
|
||||||
|
if (!(Pico.video.reg[1]&8)) num += 8;
|
||||||
|
//DrawLineDest = (unsigned short *) psp_screen + 512*(num+1);
|
||||||
|
HighCol = (unsigned char *)psp_screen + num*512;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
sceGuSync(0,0); // sync with prev
|
||||||
|
sceGuStart(GU_DIRECT, guCmdList);
|
||||||
|
|
||||||
|
if (Pico.m.dirtyPal) {
|
||||||
|
int i, *dpal = (void *)localPal, *spal = (int *)Pico.cram;
|
||||||
|
Pico.m.dirtyPal = 0;
|
||||||
|
for (i = 0x3f/2; i >= 0; i--)
|
||||||
|
dpal[i] = ((spal[i]&0x000f000f)<< 1)|((spal[i]&0x00f000f0)<<3)|((spal[i]&0x0f000f00)<<4);
|
||||||
|
|
||||||
|
sceGuClutLoad((256/8), localPal); // upload 32*8 entries (256)
|
||||||
|
}
|
||||||
|
|
||||||
|
// setup CLUT texture
|
||||||
|
|
||||||
|
// sceGuClutMode(GU_PSM_5650,0,0xff,0);
|
||||||
|
// sceGuClutLoad((256/8), localPal); // upload 32*8 entries (256)
|
||||||
|
// sceGuTexMode(GU_PSM_T8,0,0,0); // 8-bit image
|
||||||
|
// sceGuTexImage(0,512,1/*512*/,512,VRAM_STUFF);
|
||||||
|
// sceGuTexFunc(GU_TFX_REPLACE,GU_TCC_RGB);
|
||||||
|
// sceGuTexFilter(GU_LINEAR,GU_LINEAR);
|
||||||
|
// sceGuTexScale(1.0f,1.0f);
|
||||||
|
// sceGuTexOffset(0.0f,0.0f);
|
||||||
|
// sceGuAmbientColor(0xffffffff);
|
||||||
|
|
||||||
|
// render sprite
|
||||||
|
|
||||||
|
// sceGuColor(0xffffffff);
|
||||||
|
vertices = (struct Vertex*)sceGuGetMemory(2 * sizeof(struct Vertex));
|
||||||
|
vertices[0].u = 0; vertices[0].v = 0;
|
||||||
|
vertices[0].x = 0; vertices[0].y = num; vertices[0].z = 0;
|
||||||
|
vertices[1].u = 320; vertices[1].v = 512;
|
||||||
|
vertices[1].x = 320; vertices[1].y = num+1; vertices[1].z = 0;
|
||||||
|
//sceGuDrawArray(GU_SPRITES,GU_TEXTURE_16BIT|GU_VERTEX_16BIT|GU_TRANSFORM_2D,2,0,vertices);
|
||||||
|
|
||||||
|
sceGuFinish();
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void draw2_clut(void)
|
||||||
|
{
|
||||||
|
struct Vertex* vertices;
|
||||||
|
int x;
|
||||||
|
|
||||||
|
sceKernelDcacheWritebackAll(); // for PicoDraw2FB
|
||||||
|
|
||||||
|
sceGuSync(0,0); // sync with prev
|
||||||
|
sceGuStart(GU_DIRECT, guCmdList);
|
||||||
|
// sceGuDispBuffer(480, 272, psp_screen == VRAM_FB0 ? VRAMOFFS_FB1 : VRAMOFFS_FB0, 512);
|
||||||
|
sceGuDrawBuffer(GU_PSM_5650, psp_screen == VRAM_FB0 ? VRAMOFFS_FB0 : VRAMOFFS_FB1, 512); // point to back fb?
|
||||||
|
|
||||||
|
if (Pico.m.dirtyPal) {
|
||||||
|
int i, *dpal = (void *)localPal, *spal = (int *)Pico.cram;
|
||||||
|
Pico.m.dirtyPal = 0;
|
||||||
|
for (i = 0x3f/2; i >= 0; i--)
|
||||||
|
dpal[i] = ((spal[i]&0x000f000f)<< 1)|((spal[i]&0x00f000f0)<<3)|((spal[i]&0x0f000f00)<<4);
|
||||||
|
|
||||||
|
sceGuClutLoad((256/8), localPal); // upload 32*8 entries (256)
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SLICE_WIDTH 32
|
||||||
|
|
||||||
|
for (x = 0; x < 320; x += SLICE_WIDTH)
|
||||||
|
{
|
||||||
|
// render sprite
|
||||||
|
vertices = (struct Vertex*)sceGuGetMemory(2 * sizeof(struct Vertex));
|
||||||
|
vertices[0].u = vertices[0].x = x;
|
||||||
|
vertices[0].v = vertices[0].y = 0;
|
||||||
|
vertices[0].z = 0;
|
||||||
|
vertices[1].u = vertices[1].x = x + SLICE_WIDTH;
|
||||||
|
vertices[1].v = vertices[1].y = 224;
|
||||||
|
vertices[1].z = 0;
|
||||||
|
sceGuDrawArray(GU_SPRITES,GU_TEXTURE_16BIT|GU_VERTEX_16BIT|GU_TRANSFORM_2D,2,0,vertices);
|
||||||
|
}
|
||||||
|
|
||||||
|
sceGuFinish();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int EmuScan8(unsigned int num, void *sdata)
|
static int EmuScan8(unsigned int num, void *sdata)
|
||||||
{
|
{
|
||||||
// draw like the fast renderer
|
// draw like the fast renderer
|
||||||
|
@ -187,26 +285,36 @@ static void cd_leds(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static short localPal[0x100];
|
|
||||||
|
|
||||||
static void blit(const char *fps, const char *notice)
|
static void blit(const char *fps, const char *notice)
|
||||||
{
|
{
|
||||||
int emu_opt = currentConfig.EmuOpt;
|
int emu_opt = currentConfig.EmuOpt;
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (PicoOpt&0x10)
|
if (PicoOpt&0x10)
|
||||||
{
|
{
|
||||||
int lines_flags = 224;
|
#if 1
|
||||||
|
draw2_clut();
|
||||||
|
#else
|
||||||
|
extern void amips_clut(unsigned short *dst, unsigned char *src, unsigned short *pal, int count);
|
||||||
|
int i; // , lines_flags = 224;
|
||||||
|
unsigned short *pd = psp_screen;
|
||||||
|
unsigned char *ps = PicoDraw2FB+328*8+8;
|
||||||
// 8bit fast renderer
|
// 8bit fast renderer
|
||||||
if (Pico.m.dirtyPal) {
|
if (Pico.m.dirtyPal) {
|
||||||
|
int *dpal = (void *)localPal;
|
||||||
|
int *spal = (int *)Pico.cram;
|
||||||
Pico.m.dirtyPal = 0;
|
Pico.m.dirtyPal = 0;
|
||||||
vidConvCpyRGB565(localPal, Pico.cram, 0x40);
|
for (i = 0x3f/2; i >= 0; i--)
|
||||||
|
dpal[i] = ((spal[i]&0x000f000f)<< 1)|((spal[i]&0x00f000f0)<<3)|((spal[i]&0x0f000f00)<<4);
|
||||||
}
|
}
|
||||||
if (!(Pico.video.reg[12]&1)) lines_flags|=0x10000;
|
// if (!(Pico.video.reg[12]&1)) lines_flags|=0x10000;
|
||||||
if (currentConfig.EmuOpt&0x4000)
|
// if (currentConfig.EmuOpt&0x4000)
|
||||||
lines_flags|=0x40000; // (Pico.m.frame_count&1)?0x20000:0x40000;
|
// lines_flags|=0x40000; // (Pico.m.frame_count&1)?0x20000:0x40000;
|
||||||
vidCpy8to16((unsigned short *)giz_screen+321*8, PicoDraw2FB+328*8, localPal, lines_flags);
|
//vidCpy8to16((unsigned short *)giz_screen+321*8, PicoDraw2FB+328*8, localPal, lines_flags);
|
||||||
|
for (i = 224; i > 0; i--, pd+=512, ps+=328)
|
||||||
|
amips_clut(pd, ps, localPal, 320);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
else if (!(emu_opt&0x80))
|
else if (!(emu_opt&0x80))
|
||||||
{
|
{
|
||||||
int lines_flags;
|
int lines_flags;
|
||||||
|
@ -245,6 +353,7 @@ static void blit(const char *fps, const char *notice)
|
||||||
if ((emu_opt & 0x400) && (PicoMCD & 1))
|
if ((emu_opt & 0x400) && (PicoMCD & 1))
|
||||||
cd_leds();
|
cd_leds();
|
||||||
|
|
||||||
|
sceGuSync(0,0);
|
||||||
psp_video_flip(0);
|
psp_video_flip(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,10 +373,30 @@ static void clearArea(int full)
|
||||||
|
|
||||||
static void vidResetMode(void)
|
static void vidResetMode(void)
|
||||||
{
|
{
|
||||||
|
// setup GU
|
||||||
|
sceGuSync(0,0); // sync with prev
|
||||||
|
sceGuStart(GU_DIRECT, guCmdList);
|
||||||
|
|
||||||
|
sceGuClutMode(GU_PSM_5650,0,0xff,0);
|
||||||
|
//sceGuClutLoad((256/8), localPal); // upload 32*8 entries (256)
|
||||||
|
sceGuTexMode(GU_PSM_T8,0,0,0); // 8-bit image
|
||||||
|
sceGuTexFunc(GU_TFX_REPLACE,GU_TCC_RGB);
|
||||||
|
sceGuTexFilter(GU_LINEAR,GU_LINEAR);
|
||||||
|
sceGuTexScale(1.0f,1.0f);
|
||||||
|
sceGuTexOffset(0.0f,0.0f);
|
||||||
|
sceGuAmbientColor(0xffffffff);
|
||||||
|
sceGuColor(0xffffffff);
|
||||||
|
|
||||||
|
|
||||||
if (PicoOpt&0x10) {
|
if (PicoOpt&0x10) {
|
||||||
|
sceGuTexImage(0,512,512,512,(char *)VRAM_STUFF + 8*512+16);
|
||||||
|
|
||||||
} else if (currentConfig.EmuOpt&0x80) {
|
} else if (currentConfig.EmuOpt&0x80) {
|
||||||
PicoDrawSetColorFormat(1);
|
PicoDrawSetColorFormat(/*1*/-1);
|
||||||
PicoScan = EmuScan16;
|
PicoScan = EmuScan16;
|
||||||
|
|
||||||
|
sceGuTexImage(0,512,1/*512*/,512,VRAM_STUFF);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
PicoDrawSetColorFormat(-1);
|
PicoDrawSetColorFormat(-1);
|
||||||
PicoScan = EmuScan8;
|
PicoScan = EmuScan8;
|
||||||
|
@ -281,16 +410,19 @@ static void vidResetMode(void)
|
||||||
}
|
}
|
||||||
Pico.m.dirtyPal = 1;
|
Pico.m.dirtyPal = 1;
|
||||||
|
|
||||||
|
sceGuFinish();
|
||||||
|
sceGuSync(0,0);
|
||||||
|
|
||||||
clearArea(1);
|
clearArea(1);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
static void updateSound(int len)
|
static void updateSound(int len)
|
||||||
{
|
{
|
||||||
if (PicoOpt&8) len<<=1;
|
if (PicoOpt&8) len<<=1;
|
||||||
|
|
||||||
// TODO..
|
// TODO..
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
static void SkipFrame(void)
|
static void SkipFrame(void)
|
||||||
{
|
{
|
||||||
|
@ -310,7 +442,7 @@ void emu_forcedFrame(void)
|
||||||
|
|
||||||
PicoDrawSetColorFormat(1);
|
PicoDrawSetColorFormat(1);
|
||||||
PicoScan = EmuScan16;
|
PicoScan = EmuScan16;
|
||||||
PicoScan((unsigned) -1, NULL);
|
EmuScanPrepare();
|
||||||
Pico.m.dirtyPal = 1;
|
Pico.m.dirtyPal = 1;
|
||||||
PicoFrameDrawOnly();
|
PicoFrameDrawOnly();
|
||||||
|
|
||||||
|
@ -662,7 +794,7 @@ void emu_Loop(void)
|
||||||
updateKeys();
|
updateKeys();
|
||||||
|
|
||||||
if (!(PicoOpt&0x10))
|
if (!(PicoOpt&0x10))
|
||||||
PicoScan((unsigned) -1, NULL);
|
EmuScanPrepare();
|
||||||
|
|
||||||
PicoFrame();
|
PicoFrame();
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,6 @@ static const char * const pspKeyNames[] = {
|
||||||
pspKeyUnkn, pspKeyUnkn, pspKeyUnkn, pspKeyUnkn, pspKeyUnkn, pspKeyUnkn, pspKeyUnkn, pspKeyUnkn
|
pspKeyUnkn, pspKeyUnkn, pspKeyUnkn, pspKeyUnkn, pspKeyUnkn, pspKeyUnkn, pspKeyUnkn, pspKeyUnkn
|
||||||
};
|
};
|
||||||
|
|
||||||
unsigned int __attribute__((aligned(16))) guCmdList[1024]; // TODO: adjust, mv
|
|
||||||
|
|
||||||
static unsigned char bg_buffer[480*272*2] __attribute__((aligned(16))); // TODO: move to vram?
|
static unsigned char bg_buffer[480*272*2] __attribute__((aligned(16))); // TODO: move to vram?
|
||||||
#define menu_screen psp_screen
|
#define menu_screen psp_screen
|
||||||
|
|
||||||
|
@ -92,10 +90,11 @@ static void menu_draw_begin(void)
|
||||||
// for (i = 272; i >= 0; i--, dst += 512, src += 480)
|
// for (i = 272; i >= 0; i--, dst += 512, src += 480)
|
||||||
// memcpy32((int *)dst, (int *)src, 480*2/4);
|
// memcpy32((int *)dst, (int *)src, 480*2/4);
|
||||||
|
|
||||||
|
sceGuSync(0,0); // sync with prev
|
||||||
sceGuStart(GU_DIRECT, guCmdList);
|
sceGuStart(GU_DIRECT, guCmdList);
|
||||||
sceGuCopyImage(GU_PSM_5650, 0, 0, 480, 272, 480, bg_buffer, 0, 0, 512, menu_screen);
|
sceGuCopyImage(GU_PSM_5650, 0, 0, 480, 272, 480, bg_buffer, 0, 0, 512, menu_screen);
|
||||||
sceGuFinish();
|
sceGuFinish();
|
||||||
sceGuSync(0, GU_SYNC_FINISH);
|
sceGuSync(0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,11 +7,12 @@
|
||||||
|
|
||||||
// draw.c
|
// draw.c
|
||||||
#define USE_BGR555 1
|
#define USE_BGR555 1
|
||||||
#define OVERRIDE_HIGHCOL 0
|
#define OVERRIDE_HIGHCOL 1
|
||||||
|
|
||||||
// draw2.c
|
// draw2.c
|
||||||
#define START_ROW 0 // which row of tiles to start rendering at?
|
#define START_ROW 0 // which row of tiles to start rendering at?
|
||||||
#define END_ROW 28 // ..end
|
#define END_ROW 28 // ..end
|
||||||
|
#define DRAW2_OVERRIDE_LINE_WIDTH 512
|
||||||
|
|
||||||
// pico.c
|
// pico.c
|
||||||
#define CAN_HANDLE_240_LINES 1
|
#define CAN_HANDLE_240_LINES 1
|
||||||
|
|
|
@ -13,7 +13,9 @@
|
||||||
|
|
||||||
PSP_MODULE_INFO("PicoDrive", 0, 1, 34);
|
PSP_MODULE_INFO("PicoDrive", 0, 1, 34);
|
||||||
|
|
||||||
void *psp_screen = PSP_VRAM_BASE0;
|
unsigned int __attribute__((aligned(16))) guCmdList[GU_CMDLIST_SIZE];
|
||||||
|
|
||||||
|
void *psp_screen = VRAM_FB0;
|
||||||
static int current_screen = 0; /* front bufer */
|
static int current_screen = 0; /* front bufer */
|
||||||
|
|
||||||
static SceUID logfd = -1;
|
static SceUID logfd = -1;
|
||||||
|
@ -54,13 +56,49 @@ void psp_init(void)
|
||||||
|
|
||||||
/* video */
|
/* video */
|
||||||
sceDisplaySetMode(0, 480, 272);
|
sceDisplaySetMode(0, 480, 272);
|
||||||
sceDisplaySetFrameBuf(PSP_VRAM_BASE1, 512, PSP_DISPLAY_PIXEL_FORMAT_565, PSP_DISPLAY_SETBUF_NEXTFRAME);
|
sceDisplaySetFrameBuf(VRAM_FB1, 512, PSP_DISPLAY_PIXEL_FORMAT_565, PSP_DISPLAY_SETBUF_NEXTFRAME);
|
||||||
current_screen = 1;
|
current_screen = 1;
|
||||||
psp_screen = PSP_VRAM_BASE0;
|
psp_screen = VRAM_FB0;
|
||||||
|
|
||||||
/* gu */
|
/* gu */
|
||||||
sceGuInit();
|
sceGuInit();
|
||||||
|
|
||||||
|
sceGuStart(GU_DIRECT, guCmdList);
|
||||||
|
sceGuDrawBuffer(GU_PSM_5650, VRAMOFFS_FB0, 512); // point to back fb?
|
||||||
|
sceGuDispBuffer(480, 272, VRAMOFFS_FB1, 512);
|
||||||
|
sceGuClear(GU_COLOR_BUFFER_BIT | GU_DEPTH_BUFFER_BIT);
|
||||||
|
sceGuDepthBuffer(VRAMOFFS_DEPTH, 512);
|
||||||
|
sceGuOffset(2048 - (480 / 2), 2048 - (272 / 2));
|
||||||
|
sceGuViewport(2048, 2048, 480, 272);
|
||||||
|
sceGuDepthRange(0xc350, 0x2710);
|
||||||
|
sceGuScissor(0, 0, 480, 272);
|
||||||
|
sceGuEnable(GU_SCISSOR_TEST);
|
||||||
|
// sceGuAlphaFunc(GU_GREATER, 0, 0xff);
|
||||||
|
// sceGuEnable(GU_ALPHA_TEST);
|
||||||
|
// sceGuDepthFunc(GU_ALWAYS); // GU_GEQUAL);
|
||||||
|
// sceGuEnable(GU_DEPTH_TEST);
|
||||||
|
|
||||||
|
sceGuDepthMask(0xffff);
|
||||||
|
sceGuDisable(GU_DEPTH_TEST);
|
||||||
|
|
||||||
|
sceGuFrontFace(GU_CW);
|
||||||
|
// sceGuShadeModel(GU_SMOOTH);
|
||||||
|
// sceGuEnable(GU_CULL_FACE);
|
||||||
|
sceGuEnable(GU_TEXTURE_2D);
|
||||||
|
// sceGuEnable(GU_CLIP_PLANES);
|
||||||
|
sceGuTexMode(GU_PSM_5650, 0, 0, 0);
|
||||||
|
sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGB);
|
||||||
|
sceGuTexFilter(GU_NEAREST, GU_NEAREST);
|
||||||
|
// sceGuAmbientColor(0xffffffff);
|
||||||
|
// sceGuEnable(GU_BLEND);
|
||||||
|
// sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0);
|
||||||
|
sceGuFinish();
|
||||||
|
sceGuSync(0, 0);
|
||||||
|
|
||||||
|
sceDisplayWaitVblankStart();
|
||||||
|
sceGuDisplay(GU_TRUE);
|
||||||
|
|
||||||
|
|
||||||
/* input */
|
/* input */
|
||||||
sceCtrlSetSamplingCycle(0);
|
sceCtrlSetSamplingCycle(0);
|
||||||
sceCtrlSetSamplingMode(0);
|
sceCtrlSetSamplingMode(0);
|
||||||
|
@ -80,17 +118,17 @@ void psp_video_flip(int wait_vsync)
|
||||||
sceDisplaySetFrameBuf(psp_screen, 512, PSP_DISPLAY_PIXEL_FORMAT_565,
|
sceDisplaySetFrameBuf(psp_screen, 512, PSP_DISPLAY_PIXEL_FORMAT_565,
|
||||||
wait_vsync ? PSP_DISPLAY_SETBUF_IMMEDIATE : PSP_DISPLAY_SETBUF_NEXTFRAME);
|
wait_vsync ? PSP_DISPLAY_SETBUF_IMMEDIATE : PSP_DISPLAY_SETBUF_NEXTFRAME);
|
||||||
current_screen ^= 1;
|
current_screen ^= 1;
|
||||||
psp_screen = current_screen ? PSP_VRAM_BASE0 : PSP_VRAM_BASE1;
|
psp_screen = current_screen ? VRAM_FB0 : VRAM_FB1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *psp_video_get_active_fb(void)
|
void *psp_video_get_active_fb(void)
|
||||||
{
|
{
|
||||||
return current_screen ? PSP_VRAM_BASE1 : PSP_VRAM_BASE0;
|
return current_screen ? VRAM_FB1 : VRAM_FB0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void psp_video_switch_to_single(void)
|
void psp_video_switch_to_single(void)
|
||||||
{
|
{
|
||||||
psp_screen = PSP_VRAM_BASE0;
|
psp_screen = VRAM_FB0;
|
||||||
sceDisplaySetFrameBuf(psp_screen, 512, PSP_DISPLAY_PIXEL_FORMAT_565, PSP_DISPLAY_SETBUF_NEXTFRAME);
|
sceDisplaySetFrameBuf(psp_screen, 512, PSP_DISPLAY_PIXEL_FORMAT_565, PSP_DISPLAY_SETBUF_NEXTFRAME);
|
||||||
current_screen = 0;
|
current_screen = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,25 @@ void psp_finish(void);
|
||||||
|
|
||||||
void psp_msleep(int ms);
|
void psp_msleep(int ms);
|
||||||
|
|
||||||
#define PSP_VRAM_BASE0 ((void *) 0x44000000)
|
// vram usage map:
|
||||||
#define PSP_VRAM_BASE1 ((void *) 0x44044000)
|
// 000000-044000 fb0
|
||||||
|
// 044000-088000 fb1
|
||||||
|
// 088000-0cc000 depth (?)
|
||||||
|
// 0cc000-0??000 stuff
|
||||||
|
|
||||||
|
#define VRAMOFFS_FB0 ((void *) 0x00000000)
|
||||||
|
#define VRAMOFFS_FB1 ((void *) 0x00044000)
|
||||||
|
#define VRAMOFFS_DEPTH ((void *) 0x00088000)
|
||||||
|
|
||||||
|
#define VRAM_FB0 ((void *) 0x44000000)
|
||||||
|
#define VRAM_FB1 ((void *) 0x44044000)
|
||||||
|
#define VRAM_STUFF ((void *) 0x440cc000)
|
||||||
|
|
||||||
|
#define VRAM_CACHED_STUFF ((void *) 0x040cc000)
|
||||||
|
|
||||||
|
#define GU_CMDLIST_SIZE (16*1024) // TODO: adjust
|
||||||
|
|
||||||
|
extern unsigned int guCmdList[GU_CMDLIST_SIZE];
|
||||||
|
|
||||||
void *psp_video_get_active_fb(void);
|
void *psp_video_get_active_fb(void);
|
||||||
void psp_video_switch_to_single(void);
|
void psp_video_switch_to_single(void);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue