- giving some love and compilation fixes to linux build

- [Psy-X] api improvements
This commit is contained in:
SoapyMan 2020-12-21 23:10:29 +06:00
parent bf244e5560
commit 87621be8f6
8 changed files with 66 additions and 63 deletions

View File

@ -51,7 +51,7 @@ template<int x> struct compile_time_assert_test {};
#endif
#if defined(_DEBUG)
#define UNIMPLEMENTED() { static bool _stop = false; if(!_stop) printMsg("[GAME] " FUNCNAME " - unimplemented!\n"); _stop = true; }
#define UNIMPLEMENTED() { static bool _stop = false; if(!_stop) printMsg("[GAME] %s - unimplemented!\n", FUNCNAME); _stop = true; }
#else
#define UNIMPLEMENTED()
#endif

View File

@ -1477,19 +1477,10 @@ void Emulator_SetupClipMode(const RECT16& rect)
clipRectX += 0.5f;
}
if(g_PreviousScissorState != enabled)
{
g_PreviousScissorState = enabled;
#if defined(RENDERER_OGL) || defined(OGLES)
if (!enabled)
{
glDisable(GL_SCISSOR_TEST);
return;
}
Emulator_SetScissorState(enabled);
glEnable(GL_SCISSOR_TEST);
#endif
}
if(!enabled)
return;
#if defined(RENDERER_OGL) || defined(OGLES)
float flipOffset = g_windowHeight - clipRectH * (float)g_windowHeight;
@ -1704,6 +1695,20 @@ void Emulator_ReadFramebufferDataToVRAM()
// vram_need_update = true;
}
void Emulator_SetScissorState(int enable)
{
if(g_PreviousScissorState == enable)
return;
#if defined(RENDERER_OGL) || defined(OGLES)
if (g_PreviousScissorState)
glDisable(GL_SCISSOR_TEST);
else
glEnable(GL_SCISSOR_TEST);
#endif
g_PreviousScissorState = enable;
}
void Emulator_StoreFrameBuffer(int x, int y, int w, int h)
{
#if defined(RENDERER_OGL) || defined(OGLES)
@ -1711,11 +1716,7 @@ void Emulator_StoreFrameBuffer(int x, int y, int w, int h)
if (g_PreviousFramebuffer.w != w &&
g_PreviousFramebuffer.h != h)
{
if (g_PreviousScissorState)
{
glDisable(GL_SCISSOR_TEST);
g_PreviousScissorState = 0;
}
Emulator_SetScissorState(0);
glBindTexture(GL_TEXTURE_2D, g_fbTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);

View File

@ -194,6 +194,7 @@ extern void Emulator_SetBlendMode(BlendMode blendMode);
extern void Emulator_SetPolygonOffset(float ofs);
extern void Emulator_SetStencilMode(int drawPrim);
extern void Emulator_EnableDepth(int enable);
extern void Emulator_SetScissorState(int enable);
extern void Emulator_LineSwapSourceVerts(VERTTYPE* &p0, VERTTYPE* &p1, unsigned char* &c0, unsigned char* &c1);
extern void Emulator_GenerateLineArray(struct Vertex* vertex, VERTTYPE* p0, VERTTYPE* p1, ushort gteidx);

View File

@ -367,7 +367,7 @@ u_long* ClearOTagR(u_long* ot, int n)
setlen(ot, 0);
// initialize a linked list with it's previous items
for (int i = P_LEN; i < n * P_LEN; i += P_LEN)
for (int i = 1 * P_LEN; i < n * P_LEN; i += P_LEN)
{
setaddr(&ot[i], &ot[i - P_LEN]);
setlen(&ot[i], 0);

View File

@ -1,5 +1,5 @@
#ifndef _SYS_TYPES_H
#define _SYS_TYPES_H
#ifndef TYPES_H
#define TYPES_H
#include "PSYX_CONFIG.H"
@ -49,30 +49,6 @@ typedef unsigned long ulong; /* sys V compat */
#endif
#endif /* ! __psx__ */
#if !__APPLE__
typedef struct _physadr { int r[1]; } *physadr;
typedef struct label_t {
int val[12];
} label_t;
#if !defined(__ANDROID__)
typedef struct _quad { long val[2]; } quad;
typedef long daddr_t;
typedef char * caddr_t;
typedef long * qaddr_t;
//typedef u_long ino_t;
typedef long swblk_t;
#endif
//typedef long time_t;
//typedef short dev_t;
//typedef long off_t;
//typedef u_short uid_t;
//typedef u_short gid_t;
#endif
#define NBBY 8
#endif

View File

@ -22,12 +22,11 @@ project "Psy-X"
includedirs {
SDL2_DIR.."/include",
OPENAL_DIR.."/include",
OPENAL_DIR.."/include",
OPENAL_DIR.."/include"
}
filter "system:Windows"
defines { "_WINDOWS" }
defines { "_WINDOWS" }
links {
"opengl32",
"SDL2",

View File

@ -47,7 +47,8 @@ workspace "REDRIVER2"
filter "configurations:Debug"
defines {
"DEBUG",
"_DEBUG",
"DEBUG"
}
symbols "On"

View File

@ -158,7 +158,6 @@ void SetupMovieRectangle(int image_w, int image_h)
int windowWidth, windowHeight;
Emulator_GetScreenSize(windowWidth, windowHeight);
float psxScreenW = 320.0f;
float psxScreenH = 200.0f; // FIXME: NTSC scaling
@ -183,16 +182,38 @@ void SetupMovieRectangle(int image_w, int image_h)
u_char r = 1;
u_char b = 1;
#ifdef USE_PGXP
Emulator_SetViewPort(0, 0, windowWidth, windowHeight);
Vertex blit_vertices[] =
{
{ clipRectX+ clipRectW, clipRectY + clipRectH, 0, 0, r, t, 0, 0, 0, 0, 0, 0 },
{ clipRectX, clipRectY, 0, 0, l, b, 0, 0, 0, 0, 0, 0 },
{ clipRectX, clipRectY + clipRectH, 0, 0, l, t, 0, 0, 0, 0, 0, 0 },
{ clipRectX+ clipRectW, clipRectY + clipRectH, 0, 0, r, t, 0, 0, 0, 0, 0, 0 },
{ clipRectX, clipRectY, 0, 0, l, b, 0, 0, 0, 0, 0, 0 },
{ clipRectX, clipRectY + clipRectH, 0, 0, l, t, 0, 0, 0, 0, 0, 0 },
{ clipRectX + clipRectW, clipRectY, 0, 0, r, b, 0, 0, 0, 0, 0, 0 },
{ clipRectX, clipRectY, 0, 0, l, b, 0, 0, 0, 0, 0, 0 },
{ clipRectX + clipRectW, clipRectY + clipRectH, 0, 0, r, t, 0, 0, 0, 0, 0, 0 },
{ clipRectX + clipRectW, clipRectY, 0, 0, r, b, 0, 0, 0, 0, 0, 0 },
{ clipRectX, clipRectY, 0, 0, l, b, 0, 0, 0, 0, 0, 0 },
{ clipRectX + clipRectW, clipRectY + clipRectH, 0, 0, r, t, 0, 0, 0, 0, 0, 0 },
};
#else
Emulator_SetViewPort(0, 0, windowWidth, windowHeight);
clipRectX *= 2;
clipRectY *= 2;
clipRectW *= 2;
clipRectH *= 2;
Vertex blit_vertices[] =
{
{ clipRectX+ clipRectW, clipRectY + clipRectH, 0, 0, r, t, 0, 0, 0, 0, 0, 0 },
{ clipRectX, clipRectY, 0, 0, l, b, 0, 0, 0, 0, 0, 0 },
{ clipRectX, clipRectY + clipRectH, 0, 0, l, t, 0, 0, 0, 0, 0, 0 },
{ clipRectX + clipRectW, clipRectY, 0, 0, r, b, 0, 0, 0, 0, 0, 0 },
{ clipRectX, clipRectY, 0, 0, l, b, 0, 0, 0, 0, 0, 0 },
{ clipRectX + clipRectW, clipRectY + clipRectH, 0, 0, r, t, 0, 0, 0, 0, 0, 0 },
};
#endif
Emulator_UpdateVertexBuffer(blit_vertices, 6);
}
@ -437,14 +458,18 @@ void DrawFrame(ReadAVI::stream_format_t& stream_format, int frame_number, int cr
glBindTexture(GL_TEXTURE_2D, g_FMVTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, image_w, image_h, 0, GL_RGB, GL_UNSIGNED_BYTE, g_FMVDecodedImageBuffer);
glBindTexture(GL_TEXTURE_2D, 0);
Emulator_SetViewPort(0, 0, windowWidth, windowHeight);
Emulator_SetTexture(g_FMVTexture, (TexFormat)-1);
Emulator_SetShader(g_FMVShader);
Emulator_SetTexture(g_FMVTexture, (TexFormat)-1);
Emulator_SetScissorState(0);
Emulator_EnableDepth(0);
Emulator_SetStencilMode(0);
Emulator_SetBlendMode(BM_NONE);
SetupMovieRectangle(stream_format.image_width, stream_format.image_height);
Emulator_SetBlendMode(BM_NONE);
Emulator_DrawTriangles(0, 2);
DisplaySubtitles(frame_number);