Add unaligned load support for vertex PD, fix edge case in sync requirement detection.

This commit is contained in:
Dario 2024-07-21 17:18:35 -03:00
parent e55a7fba59
commit ad1c540d6e
4 changed files with 15 additions and 8 deletions

View File

@ -44,6 +44,7 @@ namespace RT64 {
// Constant Identifier UCode LowP NoN ReJ MVP Point
//
const GBIInstance F3D_SM64 = { "SW Version: 2.0D, 04-01-96 (SM64)", GBIUCode::F3D, { false, false, false, false, false } };
const GBIInstance F3D_PD = { "SW Version: Unknown (PD)", GBIUCode::F3DPD, { false, false, false, false, false } };
const GBIInstance F3DEX_1_21 = { "F3DEX 1.21", GBIUCode::F3DEX, { false, false, false, false, false } };
const GBIInstance F3DLX_1_21_REJ = { "F3DLX 1.21.Rej", GBIUCode::F3DEX, { true, false, true, false, false } };
const GBIInstance F3DEX_1_23 = { "F3DEX 1.23", GBIUCode::F3DEX, { false, false, false, false, false } };
@ -71,8 +72,9 @@ namespace RT64 {
//
// Length Hash Known instances
//
static std::array<GBISegment, 21> textSegments = {
static std::array<GBISegment, 22> textSegments = {
GBISegment{ 0x1408, 0xF50165C013FCB8A2ULL, { &F3D_SM64 } },
GBISegment{ 0x1418, 0xAEBF9966DD0486DDULL, { &F3D_PD } },
GBISegment{ 0x1430, 0x9A7772037D709388ULL, { &F3DEX_1_21 } },
GBISegment{ 0x13D0, 0x1BEA638E869B0195ULL, { &F3DLX_1_21_REJ } }, // Needs confirmation.
GBISegment{ 0x1430, 0xAC03DE5B7B1E710FULL, { &F3DEX_1_23 } },
@ -95,8 +97,9 @@ namespace RT64 {
GBISegment{ 0x18C0, 0x9300F34F3B438634ULL, { &S2DEX2_FIFO_2_08 } },
};
static std::array<GBISegment, 21> dataSegments = {
static std::array<GBISegment, 22> dataSegments = {
GBISegment{ 0x800, 0x276AC049785A7E70ULL, { &F3D_SM64 } },
GBISegment{ 0x800, 0x72AD2373CEC74AA7ULL, { &F3D_PD } },
GBISegment{ 0x800, 0x4B5FDED20C137EC1ULL, { &F3DEX_1_21 } },
GBISegment{ 0x800, 0x3828B4F75B0A0E6AULL, { &F3DEX_1_23 } },
GBISegment{ 0x800, 0x484C6940F5072C39ULL, { &F3DLX_1_21_REJ } }, // Needs confirmation.

View File

@ -91,11 +91,11 @@ namespace RT64 {
}
// Masks addresses as the RSP DMA hardware would.
uint32_t RSP::maskPhysicalAddress(uint32_t address) {
template<uint32_t mask> uint32_t RSP::maskPhysicalAddress(uint32_t address) {
if (state->extended.extendRDRAM && ((address & 0xF0000000) == 0x80000000)) {
return address - 0x80000000;
}
return address & 0x00FFFFF8;
return address & mask;
}
// Performs a lookup in the segment table to convert the given address.
@ -109,7 +109,11 @@ namespace RT64 {
// Converts the given segmented address and then applies the RSP DMA physical address mask.
// Used in cases where the RSP performs a DMA with a segmented address as the input.
uint32_t RSP::fromSegmentedMasked(uint32_t segAddress) {
return maskPhysicalAddress(fromSegmented(segAddress));
return maskPhysicalAddress<0x00FFFFF8>(fromSegmented(segAddress));
}
uint32_t RSP::fromSegmentedMaskedPD(uint32_t segAddress) {
return maskPhysicalAddress<0x00FFFFFC>(fromSegmented(segAddress));
}
void RSP::setSegment(uint32_t seg, uint32_t address) {
@ -324,7 +328,7 @@ namespace RT64 {
return;
}
const uint32_t rdramAddress = fromSegmentedMasked(address);
const uint32_t rdramAddress = fromSegmentedMaskedPD(address);
const VertexPD *dlVerts = reinterpret_cast<const VertexPD *>(state->fromRDRAM(rdramAddress));
for (uint32_t i = 0; i < vtxCount; i++) {
Vertex &dst = vertices[dstIndex + i];

View File

@ -221,9 +221,10 @@ namespace RT64 {
void reset();
Projection::Type getCurrentProjectionType() const;
void addCurrentProjection(Projection::Type type);
uint32_t maskPhysicalAddress(uint32_t address);
template<uint32_t mask> uint32_t maskPhysicalAddress(uint32_t address);
uint32_t fromSegmented(uint32_t segAddress);
uint32_t fromSegmentedMasked(uint32_t segAddress);
uint32_t fromSegmentedMaskedPD(uint32_t segAddress);
void setSegment(uint32_t seg, uint32_t address);
void matrix(uint32_t address, uint8_t params);
void popMatrix(uint32_t count);

View File

@ -975,7 +975,6 @@ namespace RT64 {
const DrawCallTile &callTile = callTiles[callDesc.tileIndex + t];
if (callTile.rawTMEM) {
flags.canDecodeTMEM = true;
break;
}
if (callTile.syncRequired && !callTile.tileCopyUsed) {