mirror of
https://github.com/PrimeDecomp/prime.git
synced 2025-10-10 03:09:00 +00:00
CTextRenderBuffer matches
This commit is contained in:
parent
c47ce6bac4
commit
258aa17509
@ -12245,7 +12245,7 @@ __ct__15CGuiTextSupportFv = .text:0x802C9E3C; // type:function size:0x208 scope:
|
||||
__ct__18CGuiTextPropertiesFv = .text:0x802CA044; // type:function size:0x18 scope:global
|
||||
fn_802CA05C = .text:0x802CA05C; // type:function size:0x94
|
||||
__dt__Q24rstl25list<17CTextRenderBuffer>Fv = .text:0x802CA0F0; // type:function size:0x94 scope:global
|
||||
fn_802CA184 = .text:0x802CA184; // type:function size:0xF4
|
||||
reserve__Q24rstl58vector<21TToken<11CRasterFont>,Q24rstl17rmemory_allocator>Fi = .text:0x802CA184; // type:function size:0xF4
|
||||
fn_802CA278 = .text:0x802CA278; // type:function size:0xD0
|
||||
fn_802CA348 = .text:0x802CA348; // type:function size:0x4C
|
||||
fn_802CA394 = .text:0x802CA394; // type:function size:0x68
|
||||
@ -15000,7 +15000,7 @@ AccumulateTextBounds__17CTextRenderBufferFv = .text:0x80359AEC; // type:function
|
||||
HasSpaceAvailable__17CTextRenderBufferFRC9CVector2iRC9CVector2i = .text:0x80359EB8; // type:function size:0xD0 scope:global
|
||||
SetPrimitive__17CTextRenderBufferFRCQ217CTextRenderBuffer9Primitivei = .text:0x80359F88; // type:function size:0x238 scope:global
|
||||
GetPrimitive__17CTextRenderBufferCFi = .text:0x8035A1C0; // type:function size:0x18C scope:global
|
||||
fn_8035A34C = .text:0x8035A34C; // type:function size:0x38
|
||||
GetCurLen__17CTextRenderBufferFv = .text:0x8035A34C; // type:function size:0x38
|
||||
GetOutStream__17CTextRenderBufferFv = .text:0x8035A384; // type:function size:0x38 scope:global
|
||||
SetMode__17CTextRenderBufferFQ217CTextRenderBuffer5EMode = .text:0x8035A3BC; // type:function size:0x8 scope:global
|
||||
fn_8035A3C4 = .text:0x8035A3C4; // type:function size:0x38
|
||||
|
@ -12245,7 +12245,7 @@ __ct__15CGuiTextSupportFv = .text:0x802C9EE8; // type:function size:0x208 scope:
|
||||
__ct__18CGuiTextPropertiesFv = .text:0x802CA0F0; // type:function size:0x18 scope:global
|
||||
fn_802CA05C = .text:0x802CA108; // type:function size:0x94 scope:global
|
||||
__dt__Q24rstl25list<17CTextRenderBuffer>Fv = .text:0x802CA19C; // type:function size:0x94 scope:global
|
||||
fn_802CA184 = .text:0x802CA230; // type:function size:0xF4 scope:global
|
||||
reserve__Q24rstl58vector<21TToken<11CRasterFont>,Q24rstl17rmemory_allocator>Fi = .text:0x802CA230; // type:function size:0xF4 scope:global
|
||||
fn_802CA278 = .text:0x802CA324; // type:function size:0xD0 scope:global
|
||||
fn_802CA348 = .text:0x802CA3F4; // type:function size:0x4C scope:global
|
||||
fn_802CA394 = .text:0x802CA440; // type:function size:0x68 scope:global
|
||||
@ -15000,7 +15000,7 @@ AccumulateTextBounds__17CTextRenderBufferFv = .text:0x80359BF0; // type:function
|
||||
HasSpaceAvailable__17CTextRenderBufferFRC9CVector2iRC9CVector2i = .text:0x80359FBC; // type:function size:0xD0 scope:global
|
||||
SetPrimitive__17CTextRenderBufferFRCQ217CTextRenderBuffer9Primitivei = .text:0x8035A08C; // type:function size:0x238 scope:global
|
||||
GetPrimitive__17CTextRenderBufferCFi = .text:0x8035A2C4; // type:function size:0x18C scope:global
|
||||
fn_8035A34C = .text:0x8035A450; // type:function size:0x38 scope:global
|
||||
GetCurLen__17CTextRenderBufferFv = .text:0x8035A450; // type:function size:0x38 scope:global
|
||||
GetOutStream__17CTextRenderBufferFv = .text:0x8035A488; // type:function size:0x38 scope:global
|
||||
SetMode__17CTextRenderBufferFQ217CTextRenderBuffer5EMode = .text:0x8035A4C0; // type:function size:0x8 scope:global
|
||||
fn_8035A3C4 = .text:0x8035A4C8; // type:function size:0x38 scope:global
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
class CPVSVisOctree {
|
||||
public:
|
||||
CPVSVisOctree(const CAABox& bounds, int numObjects, int numLights, const char* data);
|
||||
int IterateSearch(uchar a, const CVector3f& pos) const;
|
||||
uint GetNumChildren(uchar a) const;
|
||||
uint GetNumObjects() const { return mNumObjects; }
|
||||
@ -14,11 +15,17 @@ public:
|
||||
|
||||
static CPVSVisOctree MakePVSVisOctree(const char* data, int len);
|
||||
|
||||
void SetTestPoint(const CPVSVisOctree& octree, const CVector3f& point);
|
||||
|
||||
const CAABox& GetBounds() const { return mBounds; }
|
||||
const CAABox& GetSearchBounds() const { return mSearchBounds; }
|
||||
void SetSearchBounds(const CAABox& bounds) { mSearchBounds = bounds; }
|
||||
|
||||
private:
|
||||
CAABox mBounds;
|
||||
uint mNumObjects;
|
||||
uint mNumLights;
|
||||
rstl::auto_ptr< uchar > mOctreeData;
|
||||
rstl::auto_ptr< char > mOctreeData;
|
||||
uint _28;
|
||||
CAABox mSearchBounds;
|
||||
};
|
||||
|
@ -9,6 +9,8 @@ enum EPVSVisSetState {
|
||||
kVSS_OutOfBounds,
|
||||
};
|
||||
|
||||
class CPVSVisOctree;
|
||||
class CVector3f;
|
||||
class CPVSVisSet {
|
||||
public:
|
||||
CPVSVisSet(int numBits, int numLights, const rstl::auto_ptr< uchar >& leafPtr);
|
||||
@ -16,6 +18,8 @@ public:
|
||||
|
||||
EPVSVisSetState GetVisible(int index) const;
|
||||
|
||||
void SetTestPoint(CPVSVisOctree& octree, const CVector3f& point);
|
||||
|
||||
private:
|
||||
EPVSVisSetState x0_state;
|
||||
int x4_numBits;
|
||||
|
@ -31,22 +31,31 @@ public:
|
||||
coutput_stream_helper(t, *this);
|
||||
}
|
||||
|
||||
void WriteReal32(float t) { Put(t); }
|
||||
void WriteInt8(const schar t) { Put(t); }
|
||||
void WriteUint8(const uchar t) { Put(t); }
|
||||
|
||||
void WriteUint32(uint t) { Put(t); }
|
||||
void WriteInt32(int t) { Put(t); }
|
||||
void WriteInt16(const sshort t) { Put(t); }
|
||||
void WriteUint16(const ushort t) { Put(t); }
|
||||
|
||||
void WriteLong(int t) { Put(&t, sizeof(int)); }
|
||||
void WriteReal32(const float t) { Put(t); }
|
||||
|
||||
void WriteChar(u8 c) {
|
||||
void WriteUint32(const uint t) { Put(t); }
|
||||
void WriteInt32(const int t) { Put(t); }
|
||||
|
||||
void WriteShort(const short t) { Put(&t, sizeof(short)); }
|
||||
void WriteLong(const int t) { Put(&t, sizeof(int)); }
|
||||
|
||||
void WriteChar(const uchar c) {
|
||||
FlushShiftRegister();
|
||||
if (mUnwrittenLen >= mBufLen) {
|
||||
DoFlush();
|
||||
}
|
||||
++mNumWrites;
|
||||
*(reinterpret_cast< u8* >(mBufPtr) + mUnwrittenLen++) = c;
|
||||
*(reinterpret_cast< uchar* >(mBufPtr) + mUnwrittenLen++) = c;
|
||||
}
|
||||
|
||||
uint GetWrittenBytes() const { return mNumWrites; }
|
||||
|
||||
private:
|
||||
uint mUnwrittenLen;
|
||||
uint mBufLen;
|
||||
@ -68,6 +77,26 @@ inline void coutput_stream_helper(const float& t, COutputStream& out) {
|
||||
out.Put(&tmp, sizeof(float));
|
||||
}
|
||||
|
||||
template <>
|
||||
inline void coutput_stream_helper(const schar& t, COutputStream& out) {
|
||||
out.WriteChar(t);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline void coutput_stream_helper(const uchar& t, COutputStream& out) {
|
||||
out.WriteChar(t);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline void coutput_stream_helper(const sshort& t, COutputStream& out) {
|
||||
out.WriteShort(t);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline void coutput_stream_helper(const ushort& t, COutputStream& out) {
|
||||
out.WriteShort(t);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline void coutput_stream_helper(const int& t, COutputStream& out) {
|
||||
out.WriteLong(t);
|
||||
|
@ -1,12 +1,69 @@
|
||||
#ifndef _CTEXTRENDERBUFFER
|
||||
#define _CTEXTRENDERBUFFER
|
||||
|
||||
#include "Kyoto/Graphics/CGraphicsPalette.hpp"
|
||||
#include "Kyoto/Math/CVector2i.hpp"
|
||||
#include "Kyoto/TToken.hpp"
|
||||
#include "Kyoto/Text/CFontImageDef.hpp"
|
||||
#include "Kyoto/Text/CTextColor.hpp"
|
||||
|
||||
#include <rstl/reserved_vector.hpp>
|
||||
#include <rstl/vector.hpp>
|
||||
class CRasterFont;
|
||||
class CTextRenderBuffer {
|
||||
public:
|
||||
enum ECmd {
|
||||
kC_CharacterRender,
|
||||
kC_ImageRender,
|
||||
kC_FontChange,
|
||||
kC_PaletteChange,
|
||||
kC_Invalid = -1,
|
||||
};
|
||||
enum EMode {
|
||||
kM_AllocTally,
|
||||
kM_BufferFill,
|
||||
};
|
||||
|
||||
struct Primitive {
|
||||
Primitive(ECmd cmd, short x, short y, short chr, uint color, schar index)
|
||||
: mCmd(cmd), mX(x), mY(y), mChar(chr), mColor(color), mIndex(index) {}
|
||||
|
||||
ECmd mCmd;
|
||||
short mX;
|
||||
short mY;
|
||||
short mChar;
|
||||
uint mColor;
|
||||
schar mIndex;
|
||||
};
|
||||
|
||||
CTextRenderBuffer(EMode mode);
|
||||
|
||||
CGraphicsPalette* GetNextAvailablePalette() const;
|
||||
int GetMatchingPaletteIndex(const CGraphicsPalette& palette) const;
|
||||
void AddFontChange(const TToken< CRasterFont >& font);
|
||||
void AddPaletteChange(const CGraphicsPalette& palette);
|
||||
void AddCharacter(const CVector2i&, short chr, uint color);
|
||||
void AddImage(const CVector2i& offset, const CFontImageDef& image);
|
||||
|
||||
void* GetOutStream();
|
||||
size_t GetCurLen();
|
||||
|
||||
private:
|
||||
void SetPrimitive(const Primitive& prim, int offset) {}
|
||||
|
||||
EMode mMode;
|
||||
rstl::vector< TToken< CRasterFont > > mFonts;
|
||||
rstl::vector< CFontImageDef > mImages;
|
||||
rstl::vector< int > mPrimOffsets;
|
||||
rstl::vector< signed char > mBytecode;
|
||||
uint mBlobSize;
|
||||
uint mCurBytecodeOffset;
|
||||
char mActiveFont;
|
||||
char mActivePalette;
|
||||
char mQueuedFont;
|
||||
char mQueuedPalette;
|
||||
mutable rstl::reserved_vector< rstl::auto_ptr< CGraphicsPalette >, 64 > mPalettes;
|
||||
mutable int mNextPalette;
|
||||
};
|
||||
|
||||
#endif // _CTEXTRENDERBUFFER
|
||||
|
@ -11,7 +11,9 @@ extern "C" {
|
||||
|
||||
// Dolphin u32 is unsigned long
|
||||
typedef unsigned int uint;
|
||||
typedef signed short sshort;
|
||||
typedef unsigned short ushort;
|
||||
typedef signed char schar;
|
||||
typedef unsigned char uchar;
|
||||
|
||||
// Pointer to unknown, to be determined at a later date.
|
||||
|
@ -21,6 +21,8 @@ int strncmp(const char* s1, const char* s2, size_t n);
|
||||
char* strncat(char* dest, const char* src, size_t n);
|
||||
char* strchr(const char* str, int chr);
|
||||
|
||||
int memcmp(const void* a, const void* b, size_t n);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -86,7 +86,7 @@ float CMath::FastSinR(float x) {
|
||||
float f4 = x;
|
||||
f4 *= x;
|
||||
float f5 = x;
|
||||
f5 *= 0.9998508f;
|
||||
f5 *= 0.99980587f;
|
||||
x *= f4;
|
||||
f5 += x * -0.16621658f;
|
||||
x *= f4;
|
||||
|
@ -1,4 +1,6 @@
|
||||
#include "Kyoto/PVS/CPVSVisSet.hpp"
|
||||
#include "Kyoto/PVS/CPVSVisOctree.hpp"
|
||||
#include "Kyoto/Streams/CMemoryInStream.hpp"
|
||||
|
||||
CPVSVisSet::CPVSVisSet(int numBits, int numLights, const rstl::auto_ptr< uchar >& leafPtr)
|
||||
: x0_state(kVSS_NodeFound), x4_numBits(numBits), x8_numLights(numLights), xc_ptr(leafPtr) {}
|
||||
@ -30,3 +32,35 @@ EPVSVisSetState CPVSVisSet::GetVisible(int idx) const {
|
||||
}
|
||||
return static_cast< EPVSVisSetState >(((ptr[0] >> 7) & 1) | ((ptr[1] & 0x1) << 1));
|
||||
}
|
||||
|
||||
CPVSVisOctree::CPVSVisOctree(const CAABox& bounds, const int numObjects, const int numLights,
|
||||
const char* octreeData)
|
||||
: mBounds(bounds)
|
||||
, mNumObjects(numObjects)
|
||||
, mNumLights(numLights)
|
||||
, mOctreeData(const_cast< char* >(octreeData))
|
||||
, mSearchBounds(mBounds) {
|
||||
mOctreeData.release();
|
||||
}
|
||||
|
||||
CPVSVisOctree CPVSVisOctree::MakePVSVisOctree(const char* data, int len) {
|
||||
CMemoryInStream in(data, len);
|
||||
CAABox bounds(in);
|
||||
int numObjects = in.Get< int >();
|
||||
int numLights = in.Get< int >();
|
||||
in.Get< int >();
|
||||
|
||||
return CPVSVisOctree(bounds, numObjects, numLights, data + in.GetReadPosition());
|
||||
}
|
||||
|
||||
void CPVSVisSet::SetTestPoint(CPVSVisOctree& octree, const CVector3f& point) {
|
||||
if (!octree.GetSearchBounds().PointInside(point)) {
|
||||
Reset(kVSS_OutOfBounds);
|
||||
return;
|
||||
}
|
||||
|
||||
octree.SetSearchBounds(octree.GetBounds());
|
||||
|
||||
while (true) {
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user