fix daytona crash

This commit is contained in:
izzy2lost
2026-01-18 00:41:12 -05:00
parent 516e61a960
commit bb501b99dc
4 changed files with 33 additions and 4 deletions
+2 -2
View File
@@ -18,7 +18,7 @@ bool NodeAttributes::Push()
//=============
// check for overflow
if (m_vecAttribs.size() >= 128) {
if (m_vecAttribs.size() >= kMaxAttribStack) {
return false;
}
@@ -54,7 +54,7 @@ bool NodeAttributes::Pop()
bool NodeAttributes::StackLimit()
{
return m_vecAttribs.size() >= 1024;
return m_vecAttribs.size() >= kMaxAttribStack;
}
void NodeAttributes::Reset()
+2
View File
@@ -5,6 +5,7 @@
#include <unordered_map>
#include <memory>
#include <cstring>
#include <cstddef>
#include "Texture.h"
#include "Mat4.h"
@@ -223,6 +224,7 @@ enum class Clip { INSIDE, OUTSIDE, INTERCEPT, NOT_SET };
class NodeAttributes
{
public:
static constexpr size_t kMaxAttribStack = 128;
NodeAttributes();
+27 -2
View File
@@ -684,7 +684,30 @@ void CNew3D::DescendCullingNode(UINT32 addr)
return;
}
node = TranslateCullingAddress(addr);
const UINT32 nodeAddr = addr & 0x00FFFFFF;
struct CullingStackGuard
{
CNew3D &owner;
UINT32 addr;
bool active;
CullingStackGuard(CNew3D &owner, UINT32 addr)
: owner(owner), addr(addr), active(owner.m_cullingStack.insert(addr).second)
{
}
~CullingStackGuard()
{
if (active) {
owner.m_cullingStack.erase(addr);
}
}
} guard(*this, nodeAddr);
if (!guard.active) {
return;
}
node = TranslateCullingAddress(nodeAddr);
if (NULL == node) {
return;
@@ -714,7 +737,9 @@ void CNew3D::DescendCullingNode(UINT32 addr)
m_colorTableAddr &= 0x000FFFFF; // clamp to 4MB (in words) range
}
m_nodeAttribs.Push(); // save current attribs
if (!m_nodeAttribs.Push()) { // save current attribs
return;
}
if (!m_offset) { // Step 1.5+
+2
View File
@@ -48,6 +48,7 @@
#include "R3DScrollFog.h"
#include "PolyHeader.h"
#include "R3DFrameBuffers.h"
#include <unordered_set>
#include <mutex>
#include <memory>
@@ -270,6 +271,7 @@ private:
TextureSheet m_texSheet;
NodeAttributes m_nodeAttribs;
Mat4 m_modelMat; // current modelview matrix
std::unordered_set<UINT32> m_cullingStack; // recursion guard for culling nodes
struct LOS
{