mirror of
https://github.com/ran-j/PS2Recomp.git
synced 2026-10-05 11:38:24 -04:00
93e221feaa
* feat: remove memory and pad from stub section * feat: add support for resume entry targets in CodeGenerator (this allow jumps in address outside function) feat: refactor entry point discovery one more try to reduce big generated file * feat: optmizations for release build * feat: remove unused file * feat: added some test cases for code gen * feat: added log macro and remove win specific code * feat: refactor runtime folder structure feat: added reset sound driver RPC state and compatibility layout feat: rename and added new test feat: update RPC calls to use defined constants feat: added more PSMC(16, 32) feat: change cd read to try find the asset ignoring case sensitive fix: fix some render problems feat: add logs on pad feat: added more RPC handles * feat: added game override for code veronica * feat: apply vita patch * feat: flags to disable build * feat: fix merges feat: break a lot of tests * feat: better throw error on empty cd path feat: remove recompiler unusde function feat: apply missing patch * feat: gamedp is now part of lib feat: missing file * feat: small cleanup * feat: missing vita changes * feat: fix more merge * feat: fix tests * feat: last missing feature * feat: added missing import * feat: rename test local functions * feat: init syscall on ps2 list * feat: added DMA helpers * feat: faster builds feat: more implement for darkcloud * feat: back missing file * feat: added missing includes * feat: remove test * feat: missing include * feat: read register funtion * feat: build fix * feat: force exit on detach thread
97 lines
2.8 KiB
C++
97 lines
2.8 KiB
C++
#ifndef PS2_GS_PSMCT16_H
|
|
#define PS2_GS_PSMCT16_H
|
|
|
|
#include <cstdint>
|
|
|
|
namespace GSPSMCT16
|
|
{
|
|
|
|
static constexpr uint8_t blockTable16[8][4] = {
|
|
{0, 2, 8, 10},
|
|
{1, 3, 9, 11},
|
|
{4, 6, 12, 14},
|
|
{5, 7, 13, 15},
|
|
{16, 18, 24, 26},
|
|
{17, 19, 25, 27},
|
|
{20, 22, 28, 30},
|
|
{21, 23, 29, 31},
|
|
};
|
|
|
|
static constexpr uint8_t blockTable16S[8][4] = {
|
|
{0, 2, 16, 18},
|
|
{1, 3, 17, 19},
|
|
{8, 10, 24, 26},
|
|
{9, 11, 25, 27},
|
|
{4, 6, 20, 22},
|
|
{5, 7, 21, 23},
|
|
{12, 14, 28, 30},
|
|
{13, 15, 29, 31},
|
|
};
|
|
|
|
static constexpr uint8_t blockTableZ16[8][4] = {
|
|
{24, 26, 16, 18},
|
|
{25, 27, 17, 19},
|
|
{28, 30, 20, 22},
|
|
{29, 31, 21, 23},
|
|
{8, 10, 0, 2},
|
|
{9, 11, 1, 3},
|
|
{12, 14, 4, 6},
|
|
{13, 15, 5, 7},
|
|
};
|
|
|
|
static constexpr uint8_t blockTableZ16S[8][4] = {
|
|
{24, 26, 8, 10},
|
|
{25, 27, 9, 11},
|
|
{16, 18, 0, 2},
|
|
{17, 19, 1, 3},
|
|
{28, 30, 12, 14},
|
|
{29, 31, 13, 15},
|
|
{20, 22, 4, 6},
|
|
{21, 23, 5, 7},
|
|
};
|
|
|
|
static constexpr uint8_t columnTable16[2][16] = {
|
|
{0, 2, 8, 10, 16, 18, 24, 26, 1, 3, 9, 11, 17, 19, 25, 27},
|
|
{4, 6, 12, 14, 20, 22, 28, 30, 5, 7, 13, 15, 21, 23, 29, 31},
|
|
};
|
|
|
|
inline uint32_t addrPSMCT16Like(uint32_t block,
|
|
uint32_t width,
|
|
uint32_t x,
|
|
uint32_t y,
|
|
const uint8_t (&blockTable)[8][4])
|
|
{
|
|
const uint32_t pagesPerRow = (width != 0u) ? width : 1u;
|
|
const uint32_t page = (block >> 5u) + (y >> 6u) * pagesPerRow + (x >> 6u);
|
|
const uint32_t blockId = (block & 0x1Fu) + blockTable[(y >> 3u) & 0x7u][(x >> 4u) & 0x3u];
|
|
const uint32_t pageOffset = (blockId >> 5u) << 13u;
|
|
const uint32_t localBlock = blockId & 0x1Fu;
|
|
const uint32_t columnOffset = ((y >> 1u) & 0x3u) * 64u;
|
|
return (page << 13u) + pageOffset + localBlock * 256u + columnOffset +
|
|
static_cast<uint32_t>(columnTable16[y & 0x1u][x & 0x0Fu]) * 2u;
|
|
}
|
|
|
|
inline uint32_t addrPSMCT16(uint32_t block, uint32_t width, uint32_t x, uint32_t y)
|
|
{
|
|
return addrPSMCT16Like(block, width, x, y, blockTable16);
|
|
}
|
|
|
|
inline uint32_t addrPSMCT16S(uint32_t block, uint32_t width, uint32_t x, uint32_t y)
|
|
{
|
|
return addrPSMCT16Like(block, width, x, y, blockTable16S);
|
|
}
|
|
|
|
inline uint32_t addrPSMZ16(uint32_t block, uint32_t width, uint32_t x, uint32_t y)
|
|
{
|
|
return addrPSMCT16Like(block, width, x, y, blockTableZ16);
|
|
}
|
|
|
|
inline uint32_t addrPSMZ16S(uint32_t block, uint32_t width, uint32_t x, uint32_t y)
|
|
{
|
|
return addrPSMCT16Like(block, width, x, y, blockTableZ16S);
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|