- [Psy-X] fix building with PGXP completely disabled

This commit is contained in:
Ilya Shurumov 2020-12-09 03:38:43 +06:00
parent 9aef6b252c
commit 807594c648
4 changed files with 26 additions and 4 deletions

View File

@ -155,7 +155,9 @@ void Debug_Line2D(SXYPAIR& pointA, SXYPAIR& pointB, CVECTOR& color)
line->g0 = color.g; line->g0 = color.g;
line->b0 = color.b; line->b0 = color.b;
#ifdef PGXP
line->pgxp_index = 0xFFFF; line->pgxp_index = 0xFFFF;
#endif
addPrim(current->ot, line); addPrim(current->ot, line);

View File

@ -23,6 +23,8 @@ extern void SetFullscreenDrawing(); // 0x00015E70
extern void InitPercentageBar(PERCENTAGE_BAR *bar, int size, COLOUR_BAND *pColourBand, char *tag); // 0x00015F20 extern void InitPercentageBar(PERCENTAGE_BAR *bar, int size, COLOUR_BAND *pColourBand, char *tag); // 0x00015F20
extern void EnablePercentageBar(PERCENTAGE_BAR *bar, int max); // 0x00015F58 extern void EnablePercentageBar(PERCENTAGE_BAR *bar, int max); // 0x00015F58
extern void DrawProximityBar(PERCENTAGE_BAR* bar);
extern void SetColourByValue(COLOUR_BAND *pColourBand, int value, CVECTOR *pOut); // 0x00015F6C extern void SetColourByValue(COLOUR_BAND *pColourBand, int value, CVECTOR *pOut); // 0x00015F6C
extern void TransparencyOn(void *potz, unsigned short tpage); // 0x00016098 extern void TransparencyOn(void *potz, unsigned short tpage); // 0x00016098

View File

@ -71,6 +71,7 @@ KeyboardMapping g_keyboard_mapping;
// without clamping // without clamping
inline void ScreenCoordsToEmulator(Vertex* vertex, int count) inline void ScreenCoordsToEmulator(Vertex* vertex, int count)
{ {
#ifdef PGXP
while (count--) while (count--)
{ {
float psxScreenW = activeDispEnv.disp.w; float psxScreenW = activeDispEnv.disp.w;
@ -84,6 +85,7 @@ inline void ScreenCoordsToEmulator(Vertex* vertex, int count)
vertex[count].x -= 0.5f; vertex[count].x -= 0.5f;
vertex[count].y -= 0.5f; vertex[count].y -= 0.5f;
} }
#endif
} }
void Emulator_ResetDevice() void Emulator_ResetDevice()
@ -1265,8 +1267,10 @@ void Emulator_CreateGlobalShaders()
#if defined(OGL) || defined(OGLES) #if defined(OGL) || defined(OGLES)
u_Projection = glGetUniformLocation(g_gte_shader_4, "Projection"); u_Projection = glGetUniformLocation(g_gte_shader_4, "Projection");
#ifdef PGXP
u_Projection3D = glGetUniformLocation(g_gte_shader_4, "Projection3D"); u_Projection3D = glGetUniformLocation(g_gte_shader_4, "Projection3D");
#endif #endif
#endif
} }
unsigned short vram[VRAM_WIDTH * VRAM_HEIGHT]; unsigned short vram[VRAM_WIDTH * VRAM_HEIGHT];
@ -1408,9 +1412,14 @@ void Emulator_SetupClipMode(const RECT16& rect)
float clipRectH = (float)(rect.h) / psxScreenH; float clipRectH = (float)(rect.h) / psxScreenH;
// then map to screen // then map to screen
{ {
clipRectX -= 0.5f; clipRectX -= 0.5f;
#ifdef PGXP
float emuScreenAspect = float(windowWidth) / float(windowHeight); float emuScreenAspect = float(windowWidth) / float(windowHeight);
#else
float emuScreenAspect = (320.0f / 240.0f);
#endif
clipRectX /= PSX_SCREEN_ASPECT * emuScreenAspect; clipRectX /= PSX_SCREEN_ASPECT * emuScreenAspect;
clipRectW /= emuScreenAspect * PSX_SCREEN_ASPECT; clipRectW /= emuScreenAspect * PSX_SCREEN_ASPECT;
@ -1437,6 +1446,7 @@ void Emulator_SetupClipMode(const RECT16& rect)
void Emulator_GetPSXWidescreenMappedViewport(RECT16* rect) void Emulator_GetPSXWidescreenMappedViewport(RECT16* rect)
{ {
#ifdef PGXP
float emuScreenAspect = float(windowWidth) / float(windowHeight); float emuScreenAspect = float(windowWidth) / float(windowHeight);
float psxScreenW = activeDispEnv.disp.w; float psxScreenW = activeDispEnv.disp.w;
@ -1451,6 +1461,12 @@ void Emulator_GetPSXWidescreenMappedViewport(RECT16* rect)
rect->x -= (rect->w - activeDispEnv.disp.w) / 2; rect->x -= (rect->w - activeDispEnv.disp.w) / 2;
rect->w += rect->x; rect->w += rect->x;
#else
rect->x = activeDispEnv.screen.x;
rect->y = activeDispEnv.screen.y;
rect->w = activeDispEnv.disp.w;
rect->h = activeDispEnv.disp.h;
#endif
} }
void Emulator_SetShader(const ShaderID &shader) void Emulator_SetShader(const ShaderID &shader)
@ -1461,11 +1477,13 @@ void Emulator_SetShader(const ShaderID &shader)
#error #error
#endif #endif
#ifdef PGXP
float emuScreenAspect = float(windowWidth) / float(windowHeight); float emuScreenAspect = float(windowWidth) / float(windowHeight);
Emulator_Ortho2D(-0.5f * emuScreenAspect * PSX_SCREEN_ASPECT, 0.5f * emuScreenAspect * PSX_SCREEN_ASPECT, 0.5f, -0.5f, -1.0f, 1.0f); Emulator_Ortho2D(-0.5f * emuScreenAspect * PSX_SCREEN_ASPECT, 0.5f * emuScreenAspect * PSX_SCREEN_ASPECT, 0.5f, -0.5f, -1.0f, 1.0f);
Emulator_Perspective3D(0.9265f, 1.0f, 1.0f / (emuScreenAspect * PSX_SCREEN_ASPECT), 1.0f, 1000.0f); Emulator_Perspective3D(0.9265f, 1.0f, 1.0f / (emuScreenAspect * PSX_SCREEN_ASPECT), 1.0f, 1000.0f);
#else
Emulator_Ortho2D(0, activeDispEnv.disp.w, activeDispEnv.disp.h, 0, -1.0f, 1.0f);
#endif
} }
void Emulator_SetTexture(TextureID texture, TexFormat texFormat) void Emulator_SetTexture(TextureID texture, TexFormat texFormat)

View File

@ -642,7 +642,7 @@ int docop2(int op) {
C2_MAC0 = nclip; C2_MAC0 = nclip;
} }
#else #else
MAC0 = int(F((long long)(SX0 * SY1) + (SX1 * SY2) + (SX2 * SY0) - (SX0 * SY2) - (SX1 * SY0) - (SX2 * SY1))); C2_MAC0 = int(F((long long)(C2_SX0 * C2_SY1) + (C2_SX1 * C2_SY2) + (C2_SX2 * C2_SY0) - (C2_SX0 * C2_SY2) - (C2_SX1 * C2_SY0) - (C2_SX2 * C2_SY1)));
#endif #endif
C2_FLAG = 0; C2_FLAG = 0;
return 1; return 1;