mirror of
https://github.com/ran-j/PS2Recomp.git
synced 2026-09-26 16:59:35 -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
63 lines
1.1 KiB
C++
63 lines
1.1 KiB
C++
#ifndef PS2_GS_COMMON_H
|
|
#define PS2_GS_COMMON_H
|
|
|
|
#include "ps2_gs_gpu.h"
|
|
#include <cstdint>
|
|
|
|
namespace GSInternal
|
|
{
|
|
static inline uint32_t bitsPerPixel(uint8_t psm)
|
|
{
|
|
switch (psm)
|
|
{
|
|
case GS_PSM_CT32:
|
|
case GS_PSM_Z32:
|
|
return 32;
|
|
case GS_PSM_CT24:
|
|
case GS_PSM_Z24:
|
|
return 32;
|
|
case GS_PSM_CT16:
|
|
case GS_PSM_CT16S:
|
|
case GS_PSM_Z16:
|
|
case GS_PSM_Z16S:
|
|
return 16;
|
|
case GS_PSM_T8:
|
|
case GS_PSM_T8H:
|
|
return 8;
|
|
case GS_PSM_T4:
|
|
case GS_PSM_T4HL:
|
|
case GS_PSM_T4HH:
|
|
return 4;
|
|
default:
|
|
return 32;
|
|
}
|
|
}
|
|
|
|
static inline uint32_t fbStride(uint32_t fbw, uint8_t psm)
|
|
{
|
|
uint32_t pixelsPerRow = fbw * 64u;
|
|
return pixelsPerRow * (bitsPerPixel(psm) / 8u);
|
|
}
|
|
|
|
static inline uint32_t framePageBaseToBlock(uint32_t fbp)
|
|
{
|
|
return fbp << 5u;
|
|
}
|
|
|
|
static inline int clampInt(int v, int lo, int hi)
|
|
{
|
|
if (v < lo) return lo;
|
|
if (v > hi) return hi;
|
|
return v;
|
|
}
|
|
|
|
static inline uint8_t clampU8(int v)
|
|
{
|
|
if (v < 0) return 0;
|
|
if (v > 255) return 255;
|
|
return static_cast<uint8_t>(v);
|
|
}
|
|
}
|
|
|
|
#endif
|