Silent Hill 2 no longer overflows the g_IVBTable

This commit is contained in:
Luke Usher 2018-01-15 22:19:21 +00:00
parent 112c5332d9
commit 8139bd833d
3 changed files with 8 additions and 11 deletions

View File

@ -4678,11 +4678,6 @@ VOID WINAPI XTL::EMUPATCH(D3DDevice_Begin)
g_IVBPrimitiveType = PrimitiveType;
if(g_IVBTable == nullptr)
{
g_IVBTable = (struct XTL::_D3DIVB*)g_VMManager.Allocate(sizeof(XTL::_D3DIVB)*IVB_TABLE_SIZE);
}
g_IVBTblOffs = 0;
g_IVBFVF = 0;

2
src/CxbxKrnl/EmuD3D8/VertexBuffer.cpp Normal file → Executable file
View File

@ -53,7 +53,7 @@
XTL::DWORD *XTL::g_pIVBVertexBuffer = nullptr;
XTL::X_D3DPRIMITIVETYPE XTL::g_IVBPrimitiveType = XTL::X_D3DPT_INVALID;
UINT XTL::g_IVBTblOffs = 0;
struct XTL::_D3DIVB *XTL::g_IVBTable = nullptr;
struct XTL::_D3DIVB XTL::g_IVBTable[IVB_TABLE_SIZE];
extern DWORD XTL::g_IVBFVF = 0;
extern XTL::X_D3DVertexBuffer *g_pVertexBuffer = NULL;

12
src/CxbxKrnl/EmuD3D8/VertexBuffer.h Normal file → Executable file
View File

@ -130,12 +130,13 @@ extern DWORD *g_pIVBVertexBuffer;
extern X_D3DPRIMITIVETYPE g_IVBPrimitiveType;
extern DWORD g_IVBFVF;
#define IVB_TABLE_SIZE 1024
#define IVB_BUFFER_SIZE sizeof(_D3DIVB)*1024
#define IVB_TABLE_SIZE ONE_MB // This should be more than enough.. Tweak as necessary if it overflows
#define IVB_BUFFER_SIZE sizeof(_D3DIVB) * IVB_TABLE_SIZE
// TODO : Enlarge IVB_TABLE_SIZE and IVB_BUFFER_SIZE
// TODO : Calculate IVB_BUFFER_SIZE using sizeof(DWORD)
extern struct _D3DIVB
struct _D3DIVB
{
XTL::D3DXVECTOR3 Position; // Position
FLOAT Rhw; // Rhw
@ -147,8 +148,9 @@ extern struct _D3DIVB
XTL::D3DXVECTOR2 TexCoord2; // TexCoord2
XTL::D3DXVECTOR2 TexCoord3; // TexCoord3
XTL::D3DXVECTOR2 TexCoord4; // TexCoord4
}
*g_IVBTable;
};
extern _D3DIVB g_IVBTable[IVB_TABLE_SIZE];
extern UINT g_IVBTblOffs;