Files
PS2Recomp/ps2xRuntime/include/runtime/ps2_gs_psmct32.h
T
Ranieri 93e221feaa Feature/runtime ecosystem refactor (#107)
* 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
2026-04-04 23:09:56 -03:00

41 lines
1.3 KiB
C++

#ifndef PS2_GS_PSMCT32_H
#define PS2_GS_PSMCT32_H
#include <cstdint>
namespace GSPSMCT32
{
static constexpr uint8_t blockTable32[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 columnTable32[8][8] = {
{0, 1, 4, 5, 8, 9, 12, 13},
{2, 3, 6, 7, 10, 11, 14, 15},
{16, 17, 20, 21, 24, 25, 28, 29},
{18, 19, 22, 23, 26, 27, 30, 31},
{32, 33, 36, 37, 40, 41, 44, 45},
{34, 35, 38, 39, 42, 43, 46, 47},
{48, 49, 52, 53, 56, 57, 60, 61},
{50, 51, 54, 55, 58, 59, 62, 63},
};
inline uint32_t addrPSMCT32(uint32_t block, uint32_t width, uint32_t x, uint32_t y)
{
const uint32_t pagesPerRow = (width != 0u) ? width : 1u;
const uint32_t page = (block >> 5u) + (y >> 5u) * pagesPerRow + (x >> 6u);
const uint32_t blockId = (block & 0x1Fu) + blockTable32[(y >> 3u) & 3u][(x >> 3u) & 7u];
const uint32_t pageOffset = (blockId >> 5u) << 13u;
const uint32_t localBlock = blockId & 0x1Fu;
return (page << 13u) + pageOffset + localBlock * 256u +
static_cast<uint32_t>(columnTable32[y & 0x7u][x & 0x7u]) * 4u;
}
}
#endif