diff --git a/src/gx/CGxDevice.hpp b/src/gx/CGxDevice.hpp index 539bcab..8cdbcbc 100644 --- a/src/gx/CGxDevice.hpp +++ b/src/gx/CGxDevice.hpp @@ -111,7 +111,7 @@ class CGxDevice { virtual void SceneClear(uint32_t, CImVector) {}; virtual void XformSetProjection(const C44Matrix&); virtual void XformSetView(const C44Matrix&); - virtual void Draw(CGxBatch*, int32_t) {}; + virtual void Draw(CGxBatch* batch, int32_t indexed) {}; virtual void ValidateDraw(CGxBatch*, int32_t); virtual void MasterEnableSet(EGxMasterEnables, int32_t); virtual void PoolSizeSet(CGxPool*, uint32_t) = 0; diff --git a/src/gx/Draw.cpp b/src/gx/Draw.cpp index 82e63bf..c948759 100644 --- a/src/gx/Draw.cpp +++ b/src/gx/Draw.cpp @@ -1,8 +1,8 @@ #include "gx/Draw.hpp" #include "gx/Device.hpp" -void GxDraw(CGxBatch* batches, int32_t count) { - g_theGxDevicePtr->Draw(batches, count); +void GxDraw(CGxBatch* batch, int32_t indexed) { + g_theGxDevicePtr->Draw(batch, indexed); } void GxSceneClear(uint32_t mask, CImVector color) { diff --git a/src/gx/Draw.hpp b/src/gx/Draw.hpp index 040ab84..959ba0d 100644 --- a/src/gx/Draw.hpp +++ b/src/gx/Draw.hpp @@ -8,7 +8,7 @@ class C3Vector; class CImVector; -void GxDraw(CGxBatch*, int32_t); +void GxDraw(CGxBatch* batch, int32_t indexed); void GxSceneClear(uint32_t, CImVector); diff --git a/src/gx/d3d/CGxDeviceD3d.cpp b/src/gx/d3d/CGxDeviceD3d.cpp index c8ab03c..8ca3248 100644 --- a/src/gx/d3d/CGxDeviceD3d.cpp +++ b/src/gx/d3d/CGxDeviceD3d.cpp @@ -357,7 +357,7 @@ void CGxDeviceD3d::DeviceWM(EGxWM wm, uintptr_t param1, uintptr_t param2) { // TODO } -void CGxDeviceD3d::Draw(CGxBatch* batch, int32_t count) { +void CGxDeviceD3d::Draw(CGxBatch* batch, int32_t indexed) { if (!this->m_context || this->intF5C) { return; } @@ -369,7 +369,7 @@ void CGxDeviceD3d::Draw(CGxBatch* batch, int32_t count) { baseIndex = this->m_primVertexFormatBuf[0]->m_index / this->m_primVertexFormatBuf[0]->m_itemSize; } - if (count) { + if (indexed) { this->m_d3dDevice->DrawIndexedPrimitive( CGxDeviceD3d::s_primitiveConversion[batch->m_primType], baseIndex, diff --git a/src/gx/d3d/CGxDeviceD3d.hpp b/src/gx/d3d/CGxDeviceD3d.hpp index 828f0ff..136687b 100644 --- a/src/gx/d3d/CGxDeviceD3d.hpp +++ b/src/gx/d3d/CGxDeviceD3d.hpp @@ -230,7 +230,7 @@ class CGxDeviceD3d : public CGxDevice { virtual void DeviceWM(EGxWM wm, uintptr_t param1, uintptr_t param2); virtual void CapsWindowSize(CRect& dst); virtual void CapsWindowSizeInScreenCoords(CRect& dst); - virtual void Draw(CGxBatch* batch, int32_t count); + virtual void Draw(CGxBatch* batch, int32_t indexed); virtual void PoolSizeSet(CGxPool* pool, uint32_t size); virtual char* BufLock(CGxBuf* buf); virtual int32_t BufUnlock(CGxBuf* buf, uint32_t size); diff --git a/src/gx/gll/CGxDeviceGLL.cpp b/src/gx/gll/CGxDeviceGLL.cpp index 4d8ac43..a776337 100644 --- a/src/gx/gll/CGxDeviceGLL.cpp +++ b/src/gx/gll/CGxDeviceGLL.cpp @@ -334,7 +334,7 @@ int32_t CGxDeviceGLL::DeviceSetFormat(const CGxFormat& format) { return 1; } -void CGxDeviceGLL::Draw(CGxBatch* batch, int32_t count) { +void CGxDeviceGLL::Draw(CGxBatch* batch, int32_t indexed) { if (!this->m_context) { return; } @@ -343,28 +343,26 @@ void CGxDeviceGLL::Draw(CGxBatch* batch, int32_t count) { // unk conditional check early return this->IStateSync(); - this->ValidateDraw(batch, count); + this->ValidateDraw(batch, indexed); - int32_t v4 = 0; + uint32_t baseIndex = 0; + if (!this->m_caps.int10) { + baseIndex = this->m_primVertexFormatBuf[0]->m_index / this->m_primVertexFormatBuf[0]->m_itemSize; + } - // TODO - // if (!this->unk0[154]) { - // v4 = (this->unk6[56] + 24) / (this->unk6[56] + 12); - // } - - if (count) { + if (indexed) { this->m_glDevice.DrawIndexed( CGxDeviceGLL::s_primitiveConversion[batch->m_primType], batch->m_minIndex, batch->m_maxIndex, - v4, - batch->m_start + (this->m_primIndexBuf->m_index >> 1), + baseIndex, + batch->m_start + (this->m_primIndexBuf->m_index / 2), batch->m_count ); } else { this->m_glDevice.Draw( CGxDeviceGLL::s_primitiveConversion[batch->m_primType], - v4, + baseIndex, batch->m_count ); } @@ -672,6 +670,8 @@ void CGxDeviceGLL::ISetCaps(const CGxFormat& format) { this->m_caps.m_generateMipMaps = 1; + this->m_caps.int10 = 1; + this->m_caps.m_texFmt[GxTex_Dxt1] = 1; this->m_caps.m_texFmt[GxTex_Dxt3] = 1; this->m_caps.m_texFmt[GxTex_Dxt5] = 1; diff --git a/src/gx/gll/CGxDeviceGLL.hpp b/src/gx/gll/CGxDeviceGLL.hpp index 7c928ad..73b2b41 100644 --- a/src/gx/gll/CGxDeviceGLL.hpp +++ b/src/gx/gll/CGxDeviceGLL.hpp @@ -38,7 +38,7 @@ class CGxDeviceGLL : public CGxDevice { virtual void SceneClear(uint32_t, CImVector); virtual void XformSetProjection(const C44Matrix&); virtual void XformSetView(const C44Matrix&); - virtual void Draw(CGxBatch*, int32_t); + virtual void Draw(CGxBatch* batch, int32_t indexed); virtual void PoolSizeSet(CGxPool*, uint32_t); virtual char* BufLock(CGxBuf*); virtual int32_t BufUnlock(CGxBuf*, uint32_t);