mirror of
https://github.com/blawar/GLideN64.git
synced 2024-06-30 08:24:05 +00:00
Added support for texture packs for OOT.
Fixed an endian issue in `RiceCRC32`. Hardcoded in the hyrule day skybox.
This commit is contained in:
parent
403658b456
commit
ebf714f7a5
|
@ -743,15 +743,175 @@ bool TxFileStorage::add(Checksum checksum, GHQTexInfo *info, int dataSize)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TxFileStorage::get(Checksum checksum, GHQTexInfo *info)
|
std::unordered_map<uint64_t, int64_t> ChecksumPatch = {
|
||||||
|
//side 1
|
||||||
|
{949418576, 0x5FF7ECEC},//5 !
|
||||||
|
{10882665135961641694, 0x2F4EDB9D},//IX !
|
||||||
|
{5414539152399578714, 0xB80E023F},//8 !!
|
||||||
|
{10882665134782356329, 0x4AE635CE},//3 !!
|
||||||
|
{2515104943, 0x0CCCAA5B},//!! X
|
||||||
|
{11186014692243632140, 0x35B9F368},//!! 6
|
||||||
|
|
||||||
|
//side 2
|
||||||
|
{ 10882665136203779059, 0x9015ED9E },//P22 5 !
|
||||||
|
{ 5414539149093704324, 0xD6AB076A },//P21 8 !
|
||||||
|
{ 11186014690300810000, 0x1625825E },//P32 6 !
|
||||||
|
{ 5414539151466847353, 0x05D90B0B },//P31 2 !
|
||||||
|
{ 3404850891, 0x080B6D4B },//P41 3 !
|
||||||
|
{ 1833555532, 0x1A332B7C },//P42 1 !
|
||||||
|
|
||||||
|
//side 3
|
||||||
|
{ 943979577, 0x5E4DF38B },//P21 2 !
|
||||||
|
{ 3533519242, 0xD6ED2362 },//P22 6 !
|
||||||
|
{ 2234966330, 0xB07C6A7E },//P31 5 !
|
||||||
|
{ 1503921592, 0xE05C90EE },//P32 7 !
|
||||||
|
{ 2591730432, 0xF9776A92 },//P41 8 !
|
||||||
|
{ 2964873944, 0x2E24C44F },//P42 1 !
|
||||||
|
|
||||||
|
//side 4
|
||||||
|
{ 5414539151491076179, 0x390CED3F },//P21 5 !
|
||||||
|
{ 5414539151285576078, 0x7A7C2364 },//P31 3 !
|
||||||
|
{ 11186014689284962803, 0x1D829500 },//P32 1 !
|
||||||
|
{3919890579, 0xBF8DACB3},//P41 7 !
|
||||||
|
{10882665136854288861, 0xE48CE0F3},//P42 8 !
|
||||||
|
{ 1423883039, 0x3B14582D },//P22 2 !
|
||||||
|
|
||||||
|
//top
|
||||||
|
{5502028069262581124, 0xC933E141},//P23 12 !
|
||||||
|
{5502028070078972781, 0xE1E006F3},//P24 14 !
|
||||||
|
{14664577533604172876, 0xC996EF57},//P33 13 !
|
||||||
|
{5502028069585931648, 0x26EBC37E},//P43 3 !
|
||||||
|
{5502028067428979633, 0xF2B7A163},//PP34 16 !
|
||||||
|
{5414539148579585546, 0x021684BB},//P44 7 !
|
||||||
|
{ 5502028070045778849, 0x8E0981EC },//P32 !
|
||||||
|
{ 5502028066273592584, 0xEA2D877D },//P22 !
|
||||||
|
{ 5502028069937715905, 0xA75435AE },//P21 !
|
||||||
|
{ 5502028070085518301, 0x01562A8F },//P31 !
|
||||||
|
{ 5502028066402158781, 0xA5659FDF },//P41 !
|
||||||
|
{ 5502028067270540643, 0x352F61EF },//P42 !
|
||||||
|
|
||||||
|
|
||||||
|
{3414363026, 0},//P33 (maps to multiple?)
|
||||||
|
{3622161792, 0},//P43 (maps to multiple?)
|
||||||
|
|
||||||
|
|
||||||
|
{ 10882665136854288861, 0 },//None
|
||||||
|
{5414539151285576078, 0},//None
|
||||||
|
{11186014689284962803, 0},//None
|
||||||
|
|
||||||
|
{ 5414539150103370152, 0 },
|
||||||
|
{10882665138023449373, 0},
|
||||||
|
{5414539149301971536, 0},
|
||||||
|
{5414539150867657903, 0},
|
||||||
|
|
||||||
|
{1183159006, 0},
|
||||||
|
{4047025754, 0},
|
||||||
|
{3873641, 0},
|
||||||
|
{3078320140, 0},
|
||||||
|
{5414539149879856177, 0},
|
||||||
|
{10882665136793763036, 0},
|
||||||
|
|
||||||
|
{5502028067605713056, 0},
|
||||||
|
{5414539152272443539, 0},
|
||||||
|
{5502028069311277329, 0},
|
||||||
|
|
||||||
|
|
||||||
|
{5502028067464568065, 0},
|
||||||
|
{11186014692698831242, 0},
|
||||||
|
{10882665136282404280, 0},
|
||||||
|
{10882665137743356632, 0},
|
||||||
|
|
||||||
|
|
||||||
|
{10882665135986160333, 0},
|
||||||
|
{ 5414539149997265656, 0 },
|
||||||
|
{ 5414539149296532537, 0 },
|
||||||
|
{ 5414539150587519290, 0 },
|
||||||
|
{ 5414539150944283392, 0 },
|
||||||
|
{ 10882665137380901185, 0 },
|
||||||
|
{ 10882665136202365727, 0 },
|
||||||
|
|
||||||
|
{ 5414539151193485679, 0},//N
|
||||||
|
{ 10882665136612038220, 0 },//
|
||||||
|
{ 5414539151757403851, 0 },//
|
||||||
|
{ 5502028067833184045, 0 },//
|
||||||
|
|
||||||
|
|
||||||
|
{ 1260670635, 0 },//N
|
||||||
|
{ 1281040736, 0 },//N
|
||||||
|
|
||||||
|
{1425296371, 0 },
|
||||||
|
{227032586, 0 },
|
||||||
|
{2533817928, 0 },//Maps to multiple
|
||||||
|
|
||||||
|
{262575180, 0 },
|
||||||
|
{1465209777, 0 },
|
||||||
|
{ 4115202925, 0 },
|
||||||
|
{ 2075806173, 0 },
|
||||||
|
{ 3298811268, 0 },
|
||||||
|
{ 2933023118, 0 },
|
||||||
|
{ 119650803, 0 },
|
||||||
|
{ 2604447000, 0 },
|
||||||
|
};
|
||||||
|
|
||||||
|
int active = 1;
|
||||||
|
|
||||||
|
std::vector<uint64_t> unaccounted;
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
|
||||||
|
bool TxFileStorage::get(Checksum checksum, GHQTexInfo* info)
|
||||||
{
|
{
|
||||||
if (!checksum || _storage.empty())
|
if (!checksum || _storage.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
//if (checksum != Checksum(214739547))
|
||||||
|
//return get(Checksum(214739547), info);
|
||||||
|
|
||||||
/* find a match in storage */
|
/* find a match in storage */
|
||||||
auto itMap = _storage.find(checksum);
|
auto itMap = _storage.find(checksum);
|
||||||
if (itMap == _storage.end())
|
if (itMap == _storage.end())
|
||||||
|
{
|
||||||
|
if (active)
|
||||||
|
{
|
||||||
|
auto patch = ChecksumPatch.find(checksum);
|
||||||
|
|
||||||
|
if (patch != ChecksumPatch.end())
|
||||||
|
{
|
||||||
|
if (patch->second == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
bool ret = get(patch->second, info);
|
||||||
|
if (!ret)
|
||||||
|
int t = 54;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool found = false;
|
||||||
|
for (auto& key : unaccounted)
|
||||||
|
{
|
||||||
|
if (key == checksum._checksum)
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
unaccounted.push_back(checksum._checksum);
|
||||||
|
FILE* file;
|
||||||
|
file = fopen("unaccounted.txt", "w");
|
||||||
|
|
||||||
|
if (file)
|
||||||
|
{
|
||||||
|
for (auto& key : unaccounted)
|
||||||
|
fprintf(file, "%" PRIu64 "\n", key);
|
||||||
|
|
||||||
|
fclose(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (_outfile.is_open() || !_infile.is_open())
|
if (_outfile.is_open() || !_infile.is_open())
|
||||||
if (!open(true))
|
if (!open(true))
|
||||||
|
|
|
@ -50,6 +50,12 @@ struct Checksum
|
||||||
operator uint64() {
|
operator uint64() {
|
||||||
return _checksum;
|
return _checksum;
|
||||||
}
|
}
|
||||||
|
bool operator ==(const Checksum& rhs) {
|
||||||
|
return _checksum == rhs._checksum;
|
||||||
|
}
|
||||||
|
bool operator !=(const Checksum& rhs) {
|
||||||
|
return _checksum != rhs._checksum;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class TxCacheImpl;
|
class TxCacheImpl;
|
||||||
|
|
|
@ -140,6 +140,22 @@ TxUtil::checksum64(uint8 *src, int width, int height, int size, int rowStride, u
|
||||||
* (unsigned short)(rdp.tiles[tile].format << 8 | rdp.tiles[tile].size),
|
* (unsigned short)(rdp.tiles[tile].format << 8 | rdp.tiles[tile].size),
|
||||||
* bpl);
|
* bpl);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
uint32_t my_byteswap32(uint32_t num)
|
||||||
|
{
|
||||||
|
uint32_t b0, b1, b2, b3;
|
||||||
|
uint32_t res;
|
||||||
|
|
||||||
|
b0 = (num & 0x000000ff) << 24u;
|
||||||
|
b1 = (num & 0x0000ff00) << 8u;
|
||||||
|
b2 = (num & 0x00ff0000) >> 8u;
|
||||||
|
b3 = (num & 0xff000000) >> 24u;
|
||||||
|
|
||||||
|
res = b0 | b1 | b2 | b3;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32
|
uint32
|
||||||
TxUtil::RiceCRC32(const uint8* src, int width, int height, int size, int rowStride)
|
TxUtil::RiceCRC32(const uint8* src, int width, int height, int size, int rowStride)
|
||||||
{
|
{
|
||||||
|
@ -193,6 +209,11 @@ loop1:
|
||||||
while (x >= 0)
|
while (x >= 0)
|
||||||
{
|
{
|
||||||
esi = *(uint32*)(src + x);
|
esi = *(uint32*)(src + x);
|
||||||
|
|
||||||
|
#ifdef NATIVE
|
||||||
|
esi = my_byteswap32(esi);
|
||||||
|
#endif
|
||||||
|
|
||||||
esi ^= x;
|
esi ^= x;
|
||||||
|
|
||||||
crc32Ret = (crc32Ret << 4) + ((crc32Ret >> 28) & 15);
|
crc32Ret = (crc32Ret << 4) + ((crc32Ret >> 28) & 15);
|
||||||
|
@ -215,17 +236,21 @@ loop1:
|
||||||
static
|
static
|
||||||
uint8 CalculateMaxCI8b(const uint8* src, uint32 width, uint32 height, uint32 rowStride)
|
uint8 CalculateMaxCI8b(const uint8* src, uint32 width, uint32 height, uint32 rowStride)
|
||||||
{
|
{
|
||||||
uint8 val = 0;
|
uint32_t depth = rowStride / width;
|
||||||
|
uint8 max = 0;
|
||||||
|
|
||||||
for (uint32 y = 0; y < height; ++y) {
|
for (uint32 y = 0; y < height; ++y) {
|
||||||
const uint8 * buf = src + rowStride * y;
|
const uint8 * buf = src + rowStride * y;
|
||||||
for (uint32 x = 0; x<width; ++x) {
|
for (uint32 x = 0; x < width; ++x) {
|
||||||
if (buf[x] > val)
|
uint8 val = buf[x];
|
||||||
val = buf[x];
|
|
||||||
if (val == 0xFF)
|
if (buf[x] > max)
|
||||||
|
max = buf[x];
|
||||||
|
if (max == 0xFF)
|
||||||
return 0xFF;
|
return 0xFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return val;
|
return max;
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
|
@ -236,7 +261,7 @@ uint8 CalculateMaxCI4b(const uint8* src, uint32 width, uint32 height, uint32 row
|
||||||
width >>= 1;
|
width >>= 1;
|
||||||
for (uint32 y = 0; y < height; ++y) {
|
for (uint32 y = 0; y < height; ++y) {
|
||||||
const uint8 * buf = src + rowStride * y;
|
const uint8 * buf = src + rowStride * y;
|
||||||
for (uint32 x = 0; x<width; ++x) {
|
for (uint32 x = 0; x < width; ++x) {
|
||||||
val1 = buf[x] >> 4;
|
val1 = buf[x] >> 4;
|
||||||
val2 = buf[x] & 0xF;
|
val2 = buf[x] & 0xF;
|
||||||
if (val1 > val) val = val1;
|
if (val1 > val) val = val1;
|
||||||
|
|
|
@ -54,7 +54,7 @@ void _ProcessDList()
|
||||||
#else
|
#else
|
||||||
RSP.words = *(Gwords*)&RDRAM[RSP.PC[RSP.PCi]];
|
RSP.words = *(Gwords*)&RDRAM[RSP.PC[RSP.PCi]];
|
||||||
RSP.cmd = _SHIFTR(RSP.words.w0, 24, 8);
|
RSP.cmd = _SHIFTR(RSP.words.w0, 24, 8);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG_DUMP
|
#ifdef DEBUG_DUMP
|
||||||
DebugMsg(DEBUG_LOW, "0x%08lX: CMD=0x%02lX W0=0x%08lX W1=0x%08lX\n", RSP.PC[RSP.PCi], _SHIFTR(RSP.words.w0, 24, 8), RSP.words.w0, RSP.words.w1);
|
DebugMsg(DEBUG_LOW, "0x%08lX: CMD=0x%02lX W0=0x%08lX W1=0x%08lX\n", RSP.PC[RSP.PCi], _SHIFTR(RSP.words.w0, 24, 8), RSP.words.w0, RSP.words.w1);
|
||||||
|
|
|
@ -139,6 +139,8 @@ extern "C" {
|
||||||
RDRAMSize = (word)-1;
|
RDRAMSize = (word)-1;
|
||||||
|
|
||||||
api().RomOpen(romName);
|
api().RomOpen(romName);
|
||||||
|
|
||||||
|
config.textureFilter.txHiresEnable = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gfx_force_43(bool enable) {
|
void gfx_force_43(bool enable) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user