mirror of
https://github.com/libretro/FBNeo.git
synced 2025-03-09 04:43:17 +00:00
better implimentation of jojoba service mode fix. needs testing! cram is now in 100% LE format, instead of the LE+BE mess it was before
This commit is contained in:
parent
e999edb8e3
commit
7446846adc
@ -21,6 +21,7 @@ Port to FBA by OopsWare
|
||||
#include "sh2_intf.h"
|
||||
|
||||
#define BE_GFX 1
|
||||
#define BE_GFX_CRAM 0 // do not touch!
|
||||
//#define FAST_BOOT 1
|
||||
#define SPEED_HACK 1 // Default should be 1, if not FPS would drop.
|
||||
|
||||
@ -289,7 +290,7 @@ static UINT32 process_byte( UINT8 real_byte, UINT32 destination, INT32 max_lengt
|
||||
INT32 cps3_rle_length = (real_byte&0x3f)+1;
|
||||
//printf("RLE Operation (length %08x\n", cps3_rle_length );
|
||||
while (cps3_rle_length) {
|
||||
#if BE_GFX
|
||||
#if BE_GFX_CRAM
|
||||
dest[((destination+tranfercount)&0x7fffff)] = (last_normal_byte&0x3f);
|
||||
#else
|
||||
dest[((destination+tranfercount)&0x7fffff)^3] = (last_normal_byte&0x3f);
|
||||
@ -307,7 +308,7 @@ static UINT32 process_byte( UINT8 real_byte, UINT32 destination, INT32 max_lengt
|
||||
return tranfercount;
|
||||
} else {
|
||||
//printf("Write Normal Data\n");
|
||||
#if BE_GFX
|
||||
#if BE_GFX_CRAM
|
||||
dest[(destination&0x7fffff)] = real_byte;
|
||||
#else
|
||||
dest[(destination&0x7fffff)^3] = real_byte;
|
||||
@ -325,7 +326,7 @@ static void cps3_do_char_dma( UINT32 real_source, UINT32 real_destination, UINT3
|
||||
INT32 length_remaining = real_length;
|
||||
last_normal_byte = 0;
|
||||
while (length_remaining) {
|
||||
UINT8 current_byte = sourcedata[ real_source ^ 0 ];
|
||||
UINT8 current_byte = sourcedata[ real_source ];
|
||||
real_source++;
|
||||
|
||||
if (current_byte & 0x80) {
|
||||
@ -333,7 +334,7 @@ static void cps3_do_char_dma( UINT32 real_source, UINT32 real_destination, UINT3
|
||||
UINT32 length_processed;
|
||||
current_byte &= 0x7f;
|
||||
|
||||
real_byte = sourcedata[ (chardma_table_address+current_byte*2+0) ^ 0 ];
|
||||
real_byte = sourcedata[ (chardma_table_address+current_byte*2+0) ];
|
||||
//if (real_byte&0x80) return;
|
||||
length_processed = process_byte( real_byte, real_destination, length_remaining );
|
||||
length_remaining -= length_processed; // subtract the number of bytes the operation has taken
|
||||
@ -341,7 +342,7 @@ static void cps3_do_char_dma( UINT32 real_source, UINT32 real_destination, UINT3
|
||||
if (real_destination>0x7fffff) return;
|
||||
if (length_remaining<=0) return; // if we've expired, exit
|
||||
|
||||
real_byte = sourcedata[ (chardma_table_address+current_byte*2+1) ^ 0 ];
|
||||
real_byte = sourcedata[ (chardma_table_address+current_byte*2+1) ];
|
||||
//if (real_byte&0x80) return;
|
||||
length_processed = process_byte( real_byte, real_destination, length_remaining );
|
||||
length_remaining -= length_processed; // subtract the number of bytes the operation has taken
|
||||
@ -371,7 +372,7 @@ static UINT32 ProcessByte8(UINT8 b, UINT32 dst_offset)
|
||||
INT32 rle=(b+1)&0xff;
|
||||
|
||||
for(INT32 i=0;i<rle;++i) {
|
||||
#if BE_GFX
|
||||
#if BE_GFX_CRAM
|
||||
destRAM[(dst_offset&0x7fffff)] = lastb;
|
||||
#else
|
||||
destRAM[(dst_offset&0x7fffff)^3] = lastb;
|
||||
@ -387,7 +388,7 @@ static UINT32 ProcessByte8(UINT8 b, UINT32 dst_offset)
|
||||
} else {
|
||||
lastb2=lastb;
|
||||
lastb=b;
|
||||
#if BE_GFX
|
||||
#if BE_GFX_CRAM
|
||||
destRAM[(dst_offset&0x7fffff)] = b;
|
||||
#else
|
||||
destRAM[(dst_offset&0x7fffff)^3] = b;
|
||||
@ -408,18 +409,18 @@ static void cps3_do_alt_char_dma(UINT32 src, UINT32 real_dest, UINT32 real_lengt
|
||||
lastb2=0xffff;
|
||||
|
||||
while(1) {
|
||||
UINT8 ctrl=px[ src ^ 0 ];
|
||||
UINT8 ctrl=px[ src ];
|
||||
++src;
|
||||
|
||||
for(INT32 i=0;i<8;++i) {
|
||||
UINT8 p = px[ src ^ 0 ];
|
||||
UINT8 p = px[ src ];
|
||||
|
||||
if(ctrl&0x80) {
|
||||
UINT8 real_byte;
|
||||
p &= 0x7f;
|
||||
real_byte = px[ (chardma_table_address+p*2+0) ^ 0 ];
|
||||
real_byte = px[ (chardma_table_address+p*2+0) ];
|
||||
ds += ProcessByte8(real_byte,ds);
|
||||
real_byte = px[ (chardma_table_address+p*2+1) ^ 0 ];
|
||||
real_byte = px[ (chardma_table_address+p*2+1) ];
|
||||
ds += ProcessByte8(real_byte,ds);
|
||||
} else {
|
||||
ds += ProcessByte8(p,ds);
|
||||
@ -466,7 +467,10 @@ static void cps3_process_character_dma(UINT32 address)
|
||||
// Red Earth need this. 8192 byte trans to 0x00003000 (from 0x007ec000???)
|
||||
// seems some stars(6bit alpha) without compress
|
||||
//bprintf(PRINT_NORMAL, _T("Character DMA (redearth) start %08x to %08x with %d\n"), real_source, real_destination, real_length);
|
||||
memcpy( (UINT8 *)RamCRam + real_destination, RomUser + real_source, real_length );
|
||||
|
||||
//memcpy( (UINT8 *)RamCRam + real_destination, RomUser + real_source, real_length );
|
||||
for (INT32 j = 0; j < real_length; j++)
|
||||
((UINT8 *)RamCRam)[real_destination + j] = RomUser[(real_source + j) ^ 3];
|
||||
Sh2SetIRQLine(10, CPU_IRQSTATUS_ACK);
|
||||
break;
|
||||
default:
|
||||
@ -619,9 +623,7 @@ void __fastcall cps3WriteByte(UINT32 addr, UINT8 data)
|
||||
case 0x05050027: break;
|
||||
|
||||
default:
|
||||
if ((addr >= 0x04100000) && (addr <= 0x041fffff)) {
|
||||
((UINT8 *)RamCRam)[ (cram_bank * 0x100000 + (addr & 0xfffff)) ] = data; // no change for byte writes!! -dink
|
||||
} else if ((addr >= 0x05050000) && (addr < 0x05060000)) {
|
||||
if ((addr >= 0x05050000) && (addr < 0x05060000)) {
|
||||
// VideoReg
|
||||
|
||||
} else
|
||||
@ -640,7 +642,7 @@ void __fastcall cps3WriteWord(UINT32 addr, UINT16 data)
|
||||
if (cram_bank != data) {
|
||||
cram_bank = data & 7;
|
||||
//bprintf(PRINT_NORMAL, _T("CRAM bank set to %d\n"), data);
|
||||
Sh2MapMemory(((UINT8 *)RamCRam) + (cram_bank << 20), 0x04100000, 0x041fffff, MAP_ROM); // writes in byte,word,long handler!
|
||||
Sh2MapMemory(((UINT8 *)RamCRam) + (cram_bank << 20), 0x04100000, 0x041fffff, MAP_RAM);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -750,14 +752,6 @@ void __fastcall cps3WriteWord(UINT32 addr, UINT16 data)
|
||||
((UINT16 *)RamVReg)[ (addr >> 1) ] = data;
|
||||
#endif
|
||||
|
||||
} else
|
||||
if ((addr >= 0x04100000) && (addr <= 0x041fffff)) {
|
||||
// RamCRam word write -dink
|
||||
#ifdef LSB_FIRST
|
||||
((UINT16 *)RamCRam)[ ((cram_bank * 0x100000 + (addr & 0xfffff)) >> 1) ^ 1 ] = data;
|
||||
#else
|
||||
((UINT16 *)RamCRam)[ ((cram_bank * 0x100000 + (addr & 0xfffff)) >> 1) ] = data;
|
||||
#endif
|
||||
} else
|
||||
if ((addr >= 0x05000000) && (addr < 0x05001000)) {
|
||||
|
||||
@ -785,17 +779,7 @@ void __fastcall cps3WriteWord(UINT32 addr, UINT16 data)
|
||||
void __fastcall cps3WriteLong(UINT32 addr, UINT32 data)
|
||||
{
|
||||
addr &= 0xc7ffffff;
|
||||
|
||||
if ((addr >= 0x04100000) && (addr <= 0x041fffff)) {
|
||||
// RamCRam long write -dink
|
||||
#ifdef LSB_FIRST
|
||||
RamCRam[ ((cram_bank * 0x100000 + (addr & 0xfffff)) >> 2) ^ 0 ] = data;
|
||||
#else
|
||||
RamCRam[ ((cram_bank * 0x100000 + (addr & 0xfffff)) >> 2) ] = data;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
switch (addr) {
|
||||
case 0x07ff000c:
|
||||
case 0x07ff0048:
|
||||
@ -1058,7 +1042,7 @@ static INT32 Cps3Reset()
|
||||
{
|
||||
// re-map cram_bank
|
||||
cram_bank = 0;
|
||||
Sh2MapMemory((UINT8 *)RamCRam, 0x04100000, 0x041fffff, MAP_ROM); // writes in byte,word,long handler!
|
||||
Sh2MapMemory((UINT8 *)RamCRam, 0x04100000, 0x041fffff, MAP_RAM);
|
||||
|
||||
Cps3PatchRegion();
|
||||
|
||||
@ -1405,7 +1389,7 @@ static void cps3_drawgfxzoom_1(UINT32 code, UINT32 pal, INT32 flipx, INT32 flipy
|
||||
UINT8 * src = (UINT8 *) RamCRam;
|
||||
dst += (drawline * 1024 + x);
|
||||
|
||||
#if BE_GFX
|
||||
#if BE_GFX_CRAM
|
||||
|
||||
if ( flipy ) {
|
||||
src += code * 256 + 16 * (15 - (drawline - y));
|
||||
@ -1628,7 +1612,7 @@ static void cps3_drawgfxzoom_2(UINT32 code, UINT32 pal, INT32 flipx, INT32 flipy
|
||||
UINT32 * dest = RamScreen + y * 512 * 2;
|
||||
INT32 x_index = x_index_base;
|
||||
for(INT32 x=sx; x<ex; x++ ) {
|
||||
#if BE_GFX
|
||||
#if BE_GFX_CRAM
|
||||
UINT8 c = source[ (x_index>>16) ];
|
||||
#else
|
||||
UINT8 c = source[ (x_index>>16) ^ 3 ];
|
||||
@ -1645,7 +1629,7 @@ static void cps3_drawgfxzoom_2(UINT32 code, UINT32 pal, INT32 flipx, INT32 flipy
|
||||
UINT32 * dest = RamScreen + y * 512 * 2;
|
||||
INT32 x_index = x_index_base;
|
||||
for(INT32 x=sx; x<ex; x++ ) {
|
||||
#if BE_GFX
|
||||
#if BE_GFX_CRAM
|
||||
UINT8 c = source[ (x_index>>16)];
|
||||
#else
|
||||
UINT8 c = source[ (x_index>>16) ^ 3 ];
|
||||
@ -1662,7 +1646,7 @@ static void cps3_drawgfxzoom_2(UINT32 code, UINT32 pal, INT32 flipx, INT32 flipy
|
||||
UINT32 * dest = RamScreen + y * 512 * 2;
|
||||
INT32 x_index = x_index_base;
|
||||
for(INT32 x=sx; x<ex; x++ ) {
|
||||
#if BE_GFX
|
||||
#if BE_GFX_CRAM
|
||||
UINT8 c = source[ (x_index>>16) ];
|
||||
#else
|
||||
UINT8 c = source[ (x_index>>16) ^ 3 ];
|
||||
|
Loading…
x
Reference in New Issue
Block a user