Add MxTrace function (#1054)

This commit is contained in:
MS
2024-07-02 13:46:40 -04:00
committed by GitHub
parent 788cec2560
commit 05fa715550
11 changed files with 148 additions and 39 deletions

View File

@@ -0,0 +1,32 @@
#ifndef MXDEBUG_H
#define MXDEBUG_H
#include "compat.h"
#ifdef _DEBUG
// In debug mode, replace the macro with the function call.
#define MxTrace _MxTrace
void _MxTrace(const char* format, ...);
int DebugHeapState();
#else
// If not debug, MxTrace is a no-op.
#ifdef COMPAT_MODE
// Use variadic args for macro (C99)
#define MxTrace(...)
#else
// MSVC 4.20 does not have variadic args for macros
#define MxTrace(args)
#endif // COMPAT_MODE
#endif // _DEBUG
#endif // MXDEBUG_H

View File

@@ -34,7 +34,10 @@ public:
MxStreamChunk* PeekData();
void FreeDataChunk(MxStreamChunk* p_chunk);
// FUNCTION: BETA10 0x101354f0
inline MxU32 GetObjectId() { return m_objectId; }
// FUNCTION: BETA10 0x10135510
inline MxS16 GetUnknown48() { return m_unk0x48; }
private:

View File

@@ -3,6 +3,7 @@
#include "decomp.h"
#include "mxbitset.h"
#include "mxdebug.h"
#include "mxtypes.h"
#include <assert.h>
@@ -49,11 +50,7 @@ MxU8* MxMemoryPool<BS, NB>::Get()
if (!m_blockRef[i]) {
m_blockRef[i].Flip();
#ifdef _DEBUG
// TODO: This is actually some debug print function, but
// we just need any func with variatic args to eliminate diff noise.
printf("Get> %d pool: busy %d blocks\n", m_blockSize, m_blockRef.Count());
#endif
MxTrace("Get> %d pool: busy %d blocks\n", m_blockSize, m_blockRef.Count());
return &m_pool[i * m_blockSize * 1024];
}
@@ -78,9 +75,7 @@ void MxMemoryPool<BS, NB>::Release(MxU8* p_buf)
m_blockRef[i].Flip();
}
#ifdef _DEBUG
printf("Release> %d pool: busy %d blocks\n", m_blockSize, m_blockRef.Count());
#endif
MxTrace("Release> %d pool: busy %d blocks\n", m_blockSize, m_blockRef.Count());
}
#endif // MXMEMORYPOOL_H

View File

@@ -47,7 +47,7 @@ public:
MxResult FUN_100c1a00(MxDSAction* p_action, MxU32 p_offset);
MxPresenter* FUN_100c1e70(MxDSAction& p_action);
MxResult FUN_100c1f00(MxDSAction* p_action);
MxBool FUN_100c20d0(MxDSObject& p_obj);
MxBool IsStoped(MxDSObject* p_obj);
MxResult InsertActionToList54(MxDSAction* p_action);
MxNextActionDataStart* FindNextActionDataStartFromStreamingAction(MxDSStreamingAction* p_action);

View File

@@ -35,6 +35,7 @@ private:
};
// VTABLE: LEGO1 0x100dc710
// VTABLE: BETA10 0x101c2378
// SIZE 0x2c
class MxStreamer : public MxCore {
public:
@@ -115,6 +116,7 @@ private:
// clang-format off
// TEMPLATE: LEGO1 0x100b9090
// TEMPLATE: BETA10 0x10146720
// list<MxStreamController *,allocator<MxStreamController *> >::~list<MxStreamController *,allocator<MxStreamController *> >
// clang-format on