mirror of
https://github.com/ran-j/PS2Recomp.git
synced 2026-09-30 02:04:32 -04:00
Feature/agressive recompiler (#146)
* feat: added guestBranchKind enum to categorize branch types feat: added missingFunctionPolicy enum to define behaviors for missing function scenarios refactor: added handle guest branches and report missing functions feat lookupFunction to utilize new dispatch logic and improve error handling for unregistered functions * fix: fix test conflict * feat: added debug sound driver logs * feat: emmiter for return * feat: added recompiler reporter feat: added strict diagnostics flag for heavy debug calls * feat: staticc table insted of hashmap for runtime * feat: back file to ignore * feat: explode code across helpers and classes * feat: update codegen test feat: better guest nop check * feat: fix link problem on linux * feat: fix Segmentation fault * feat: added recompile replace for DMA and MMIO feat: added a clean memory helpers feat: use memory helpers across the project feat: fix ucrt on msvc * feat: undo messup merge
This commit is contained in:
@@ -65,6 +65,12 @@ namespace
|
||||
std::memcpy(dst.data() + pos, &value, sizeof(uint64_t));
|
||||
}
|
||||
|
||||
void appendGifAd(std::vector<uint8_t> &dst, uint64_t value, uint64_t reg)
|
||||
{
|
||||
appendU64(dst, value);
|
||||
appendU64(dst, reg);
|
||||
}
|
||||
|
||||
template <typename Predicate>
|
||||
bool waitUntil(Predicate pred, std::chrono::milliseconds timeout)
|
||||
{
|
||||
@@ -1917,6 +1923,67 @@ void register_ps2_gs_tests()
|
||||
t.IsTrue(same, "GIF IMAGE transfer should write payload bytes into GS VRAM");
|
||||
});
|
||||
|
||||
tc.Run("GIF load-image packet uses native upload fast path", [](TestCase &t)
|
||||
{
|
||||
std::vector<uint8_t> vram(PS2_GS_VRAM_SIZE, 0u);
|
||||
GS gs;
|
||||
gs.init(vram.data(), static_cast<uint32_t>(vram.size()), nullptr);
|
||||
|
||||
const uint64_t bitblt =
|
||||
(static_cast<uint64_t>(0u) << 0) |
|
||||
(static_cast<uint64_t>(1u) << 16) |
|
||||
(static_cast<uint64_t>(0u) << 24) |
|
||||
(static_cast<uint64_t>(0u) << 32) |
|
||||
(static_cast<uint64_t>(1u) << 48) |
|
||||
(static_cast<uint64_t>(0u) << 56);
|
||||
const uint64_t trxpos = 0ull;
|
||||
const uint64_t trxreg = (2ull << 0) | (2ull << 32);
|
||||
const uint64_t trxdir = 0ull;
|
||||
|
||||
const uint8_t payload[16] = {
|
||||
0x10u, 0x11u, 0x12u, 0x13u,
|
||||
0x20u, 0x21u, 0x22u, 0x23u,
|
||||
0x30u, 0x31u, 0x32u, 0x33u,
|
||||
0x40u, 0x41u, 0x42u, 0x43u,
|
||||
};
|
||||
|
||||
std::vector<uint8_t> packet;
|
||||
appendU64(packet, makeGifTag(4u, GIF_FMT_PACKED, 1u, false));
|
||||
appendU64(packet, 0x0Eull);
|
||||
appendGifAd(packet, bitblt, GS_REG_BITBLTBUF);
|
||||
appendGifAd(packet, trxpos, GS_REG_TRXPOS);
|
||||
appendGifAd(packet, trxreg, GS_REG_TRXREG);
|
||||
appendGifAd(packet, trxdir, GS_REG_TRXDIR);
|
||||
appendU64(packet, makeGifTag(1u, GIF_FMT_IMAGE, 0u, true));
|
||||
appendU64(packet, 0ull);
|
||||
packet.insert(packet.end(), payload, payload + sizeof(payload));
|
||||
|
||||
gs.processGIFPacket(packet.data(), static_cast<uint32_t>(packet.size()));
|
||||
|
||||
t.Equals(gs.nativeImageUploadCount(), 1ull, "load-image packet should use the native image upload fast path");
|
||||
|
||||
bool same = true;
|
||||
for (uint32_t y = 0; y < 2u && same; ++y)
|
||||
{
|
||||
for (uint32_t x = 0; x < 2u; ++x)
|
||||
{
|
||||
const uint32_t pixelIndex = y * 2u + x;
|
||||
const uint32_t off = referenceAddrPSMCT32(0u, 1u, x, y);
|
||||
for (uint32_t c = 0; c < 4u; ++c)
|
||||
{
|
||||
if (vram[off + c] != payload[pixelIndex * 4u + c])
|
||||
{
|
||||
same = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!same)
|
||||
break;
|
||||
}
|
||||
}
|
||||
t.IsTrue(same, "native load-image upload should preserve pixel payload");
|
||||
});
|
||||
|
||||
tc.Run("GS local-to-host transfer supports partial incremental reads", [](TestCase &t)
|
||||
{
|
||||
std::vector<uint8_t> vram(PS2_GS_VRAM_SIZE, 0u);
|
||||
|
||||
Reference in New Issue
Block a user