mirror of
https://github.com/ran-j/PS2Recomp.git
synced 2026-09-27 01:03:31 -04:00
d74a3ce139
* refactor: from guest threads to EE scheduler * feat: bad wip mpeg fix for code veronica * feat: cheap copy from host feat: small perf o vsync tick * feat: added EE clock Hz fix: fix MPEG out of sync with new EE refactor * fix: fix lotr tests * fix: fix cri dtx loading fix: fix wrong mmi instruction translation fix: fix thread info params feat: added EE timers decoder and consumer feat: split SFI and IOP memory to prevent collision and overrides * feat: revert wrong changes * refactor: change GS architecture
48 lines
2.2 KiB
C++
48 lines
2.2 KiB
C++
#ifndef PS2_GS_PSMT8_H
|
|
#define PS2_GS_PSMT8_H
|
|
|
|
#include <cstdint>
|
|
|
|
namespace GSPSMT8
|
|
{
|
|
|
|
static constexpr uint8_t blockTable8[4][8] = {
|
|
{0, 1, 4, 5, 16, 17, 20, 21},
|
|
{2, 3, 6, 7, 18, 19, 22, 23},
|
|
{8, 9, 12, 13, 24, 25, 28, 29},
|
|
{10, 11, 14, 15, 26, 27, 30, 31},
|
|
};
|
|
|
|
static constexpr uint8_t columnTable8[16][16] = {
|
|
{0, 4, 16, 20, 32, 36, 48, 52, 2, 6, 18, 22, 34, 38, 50, 54},
|
|
{8, 12, 24, 28, 40, 44, 56, 60, 10, 14, 26, 30, 42, 46, 58, 62},
|
|
{33, 37, 49, 53, 1, 5, 17, 21, 35, 39, 51, 55, 3, 7, 19, 23},
|
|
{41, 45, 57, 61, 9, 13, 25, 29, 43, 47, 59, 63, 11, 15, 27, 31},
|
|
{96, 100, 112, 116, 64, 68, 80, 84, 98, 102, 114, 118, 66, 70, 82, 86},
|
|
{104, 108, 120, 124, 72, 76, 88, 92, 106, 110, 122, 126, 74, 78, 90, 94},
|
|
{65, 69, 81, 85, 97, 101, 113, 117, 67, 71, 83, 87, 99, 103, 115, 119},
|
|
{73, 77, 89, 93, 105, 109, 121, 125, 75, 79, 91, 95, 107, 111, 123, 127},
|
|
{128, 132, 144, 148, 160, 164, 176, 180, 130, 134, 146, 150, 162, 166, 178, 182},
|
|
{136, 140, 152, 156, 168, 172, 184, 188, 138, 142, 154, 158, 170, 174, 186, 190},
|
|
{161, 165, 177, 181, 129, 133, 145, 149, 163, 167, 179, 183, 131, 135, 147, 151},
|
|
{169, 173, 185, 189, 137, 141, 153, 157, 171, 175, 187, 191, 139, 143, 155, 159},
|
|
{224, 228, 240, 244, 192, 196, 208, 212, 226, 230, 242, 246, 194, 198, 210, 214},
|
|
{232, 236, 248, 252, 200, 204, 216, 220, 234, 238, 250, 254, 202, 206, 218, 222},
|
|
{193, 197, 209, 213, 225, 229, 241, 245, 195, 199, 211, 215, 227, 231, 243, 247},
|
|
{201, 205, 217, 221, 233, 237, 249, 253, 203, 207, 219, 223, 235, 239, 251, 255},
|
|
};
|
|
|
|
inline uint32_t addrPSMT8(uint32_t block, uint32_t width, uint32_t x, uint32_t y)
|
|
{
|
|
const uint32_t pagesPerRow = ((width >> 1u) != 0u) ? (width >> 1u) : 1u;
|
|
const uint32_t page = (block >> 5u) + (y >> 6u) * pagesPerRow + (x >> 7u);
|
|
const uint32_t blockId = (block & 0x1Fu) + blockTable8[(y >> 4) & 3u][(x >> 4) & 7u];
|
|
const uint32_t pageOffset = (blockId >> 5u) << 13u;
|
|
const uint32_t localBlock = blockId & 0x1Fu;
|
|
return (page << 13u) + pageOffset + localBlock * 256u + columnTable8[y & 0x0Fu][x & 0x0Fu];
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|