c0deisme / emu-1964

Automatically exported from code.google.com/p/emu-1964
0 stars 0 forks source link

Forcing TMEM to always on #80

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Force TMEM emulation to true, but when loading hires texture, if unable to find 
TMEM crc then check for corresponding crc without TMEM activated, then rename 
that to the name with TMEM crc on

*ignore my gibberish*

Original issue reported on code.google.com by death2dr...@gmail.com on 24 Apr 2012 at 1:51

GoogleCodeExporter commented 9 years ago

Original comment by death2dr...@gmail.com on 24 Apr 2012 at 1:52

GoogleCodeExporter commented 9 years ago

Original comment by death2dr...@gmail.com on 24 Apr 2012 at 1:59

GoogleCodeExporter commented 9 years ago
"There was a bug with texture CRC calculation in original RiceVideo sources. 
Looking into the change log, I think that it is still there. The problem is 
that CRC of 4bit CI textures depends on state of "Full TMEM emulation" option. 
I'll point on the bug in the original sources. First, RDP_texture.h: 
TxtrCacheEntry* LoadTexture(uint32 tileno)
{
:
if( !options.bUseFullTMEM && tile.dwSize == TXT_SIZE_4b )
gti.PalAddress += 16 * 2 * tile.dwPalette; 
:
}
Here, if "Full TMEM emulation" is off and texture size is 4byte, set correct 
palette to gti.PalAddress. 

Then, TextureManager.cpp

TxtrCacheEntry * CTextureManager::GetTexture(TxtrInfo * pgti, bool fromTMEM, 
bool doCRCCheck, bool AutoExtendTexture)
{
:
if ( doCRCCheck && (pgti->Format == TXT_FMT_CI || (pgti->Format == TXT_FMT_RGBA 
&& pgti->Size <= TXT_SIZE_8b )))
{
:
if( pgti->Size == TXT_SIZE_8b )
{
dwPalSize = 256;
dwOffset = 0;
}
else
{
dwOffset = pgti->Palette << 4;
}

pStart = (uint8*)pgti->PalAddress+dwOffset*2;
:
dwPalCRC = CalculateRDRAMCRC(pStart, 0, 0, maxCI+1, 1, TXT_SIZE_16b, 
dwPalSize*2);
:
}

Here, Rice set palette offset regardless of "Full TMEM emulation". Thus, if 
"Full TMEM emulation" is off, the offset is doubled! Normally, Rice had to get 
"out of bounds" error here, crash or something like this. But he made a trick - 
he doubled the size of palette array! 
As the result, palette CRC depends on "Full TMEM emulation". Thus, if you 
dumped textures with "Full TMEM emulation" off, your replacements for 4bit 
textures will not be loaded if "Full TMEM emulation" is on, unless 
tile.dwPalette is not zero. 

I think, this bug must be fixed. However, all texture pack, which were dumped 
with "Full TMEM emulation" off, will not work after fix."

Just dumping information from gonetz so i dont have to go hunting for it again

Original comment by death2dr...@gmail.com on 10 May 2012 at 1:45

GoogleCodeExporter commented 9 years ago
"This feature is required by certain games. If it is on sprite ucodes may give 
errors. Sorry for an non-perfect implementation."

Are there still problems with sprite ucodes?

Original comment by rato...@gmail.com on 12 May 2012 at 10:55

GoogleCodeExporter commented 9 years ago
Whaaa? whered you get that from?

Original comment by death2dr...@gmail.com on 16 May 2012 at 6:10

GoogleCodeExporter commented 9 years ago
from the tooltip in the configuration dialogue

Original comment by rato...@gmail.com on 17 May 2012 at 9:40