mirror of
https://github.com/zeldaret/ss
synced 2026-08-18 21:47:41 -04:00
nw4r ut almost matching
This commit is contained in:
@@ -159,6 +159,7 @@ public:
|
||||
|
||||
void SetupGX();
|
||||
void SetFontSize(f32 width, f32 height);
|
||||
void SetFontSize(f32 height);
|
||||
f32 GetFontWidth() const;
|
||||
f32 GetFontHeight() const;
|
||||
f32 GetFontAscent() const;
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
DvdFileStream(s32 entrynum);
|
||||
DvdFileStream(long entrynum);
|
||||
DvdFileStream(const DVDFileInfo *info, bool close);
|
||||
virtual ~DvdFileStream(); // at 0xC
|
||||
|
||||
@@ -67,15 +67,15 @@ public:
|
||||
|
||||
virtual void Close(); // at 0x10
|
||||
|
||||
virtual s32 Read(void *dst, u32 size); // at 0x14
|
||||
virtual bool ReadAsync(void *dst, u32 size, AsyncCallback callback,
|
||||
virtual long Read(void *dst, unsigned long size); // at 0x14
|
||||
virtual bool ReadAsync(void *dst, unsigned long size, AsyncCallback callback,
|
||||
void *arg); // at 0x18
|
||||
|
||||
virtual s32 Peek(void *dst, u32 size); // at 0x5C
|
||||
virtual bool PeekAsync(void *dst, u32 size, AsyncCallback callback,
|
||||
virtual long Peek(void *dst, unsigned long size); // at 0x5C
|
||||
virtual bool PeekAsync(void *dst, unsigned long size, AsyncCallback callback,
|
||||
void *arg); // at 0x60
|
||||
|
||||
virtual void Seek(s32 offset, u32 origin); // at 0x44
|
||||
virtual void Seek(long offset, unsigned long origin); // at 0x44
|
||||
|
||||
virtual void Cancel(); // at 0x48
|
||||
virtual bool CancelAsync(AsyncCallback callback, void *arg); // at 0x4C
|
||||
@@ -88,11 +88,11 @@ public:
|
||||
bool Open(const DVDFileInfo *info, bool close);
|
||||
|
||||
private:
|
||||
static void DvdAsyncCallback_(s32 result, DVDFileInfo *info);
|
||||
static void DvdCBAsyncCallback_(s32 result, DVDCommandBlock *block);
|
||||
static void DvdAsyncCallback_(long result, DVDFileInfo *info);
|
||||
static void DvdCBAsyncCallback_(long result, DVDCommandBlock *block);
|
||||
|
||||
void Initialize_();
|
||||
u32 AdjustReadLength_(u32 len);
|
||||
unsigned long AdjustReadLength_(unsigned long len);
|
||||
|
||||
private:
|
||||
FilePosition mFilePosition; // at 0x14
|
||||
|
||||
@@ -11,17 +11,19 @@ class DvdLockedFileStream : public DvdFileStream {
|
||||
public:
|
||||
NW4R_UT_RTTI_DECL(DvdLockedFileStream);
|
||||
|
||||
DvdLockedFileStream(s32 entrynum);
|
||||
DvdLockedFileStream(long entrynum);
|
||||
DvdLockedFileStream(const DVDFileInfo *info, bool close);
|
||||
virtual ~DvdLockedFileStream(); // at 0xC
|
||||
|
||||
virtual s32 Read(void *dst, u32 size); // at 0x14
|
||||
virtual bool ReadAsync(void *dst, u32 size, AsyncCallback callback, void *arg) {
|
||||
virtual void Close(); // at 0x10
|
||||
|
||||
virtual long Read(void *dst, unsigned long size); // at 0x14
|
||||
virtual bool ReadAsync(void *dst, unsigned long size, AsyncCallback callback, void *arg) {
|
||||
return false;
|
||||
} // at 0x18
|
||||
|
||||
virtual s32 Peek(void *dst, u32 size); // at 0x5C
|
||||
virtual bool PeekAsync(void *dst, u32 size, AsyncCallback callback, void *arg) {
|
||||
virtual long Peek(void *dst, unsigned long size); // at 0x5C
|
||||
virtual bool PeekAsync(void *dst, unsigned long size, AsyncCallback callback, void *arg) {
|
||||
return false;
|
||||
} // at 0x60
|
||||
|
||||
@@ -29,11 +31,18 @@ public:
|
||||
return false;
|
||||
} // at 0x28
|
||||
|
||||
private:
|
||||
static void InitMutex_();
|
||||
void Cancel();
|
||||
|
||||
private:
|
||||
static void InitMutex_();
|
||||
bool LockMutex();
|
||||
static void UnlockMutex();
|
||||
void CancelMutex();
|
||||
|
||||
private:
|
||||
volatile bool mCancelFlag; // 0x6f
|
||||
static bool sInitialized;
|
||||
static OSThreadQueue sThreadQueue;
|
||||
static OSMutex sMutex;
|
||||
};
|
||||
|
||||
|
||||
@@ -52,13 +52,12 @@ public:
|
||||
virtual int GetCharWidth(u16 c) const = 0; // at 0x48
|
||||
virtual CharWidths GetCharWidths(u16 c) const = 0; // at 0x4C
|
||||
virtual void GetGlyph(Glyph *out, u16 c) const = 0; // at 0x50
|
||||
virtual bool HasGlyph(u16 c) const = 0; // at 0x50
|
||||
virtual FontEncoding GetEncoding() const = 0; // at 0x54
|
||||
|
||||
void InitReaderFunc(FontEncoding encode);
|
||||
|
||||
CharStrmReader GetCharStrmReader() const {
|
||||
return CharStrmReader(mReadFunc);
|
||||
}
|
||||
CharStrmReader GetCharStrmReader() const;
|
||||
|
||||
private:
|
||||
CharStrmReader::ReadFunc mReadFunc; // at 0x4
|
||||
|
||||
@@ -15,11 +15,11 @@ public:
|
||||
IOStream() : mIsOpen(false), mCallback(NULL), mCallbackArg(NULL) {}
|
||||
virtual ~IOStream() {} // at 0xC
|
||||
|
||||
virtual void Close() = 0; // at 0x10
|
||||
virtual s32 Read(void *dst, u32 size) = 0; // at 0x14
|
||||
virtual void Close() = 0; // at 0x10
|
||||
virtual long Read(void *dst, unsigned long size) = 0; // at 0x14
|
||||
virtual bool ReadAsync(void *dst, unsigned long size, AsyncCallback callback,
|
||||
void *arg); // at 0x18
|
||||
virtual bool Write(const void *src, unsigned long size); // at 0x1C
|
||||
virtual long Write(const void *src, unsigned long size); // at 0x1C
|
||||
virtual bool WriteAsync(const void *src, unsigned long size, AsyncCallback callback,
|
||||
void *arg); // at 0x20
|
||||
virtual bool IsBusy() const; // at 0x24
|
||||
|
||||
@@ -25,8 +25,8 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
NandFileStream(const char *path, u32 access);
|
||||
NandFileStream(const NANDFileInfo *info, u32 access, bool close);
|
||||
NandFileStream(const char *path, unsigned long access);
|
||||
NandFileStream(const NANDFileInfo *info, unsigned long access, bool close);
|
||||
virtual ~NandFileStream(); // at 0xC
|
||||
|
||||
virtual bool IsBusy() const {
|
||||
@@ -68,32 +68,32 @@ public:
|
||||
|
||||
virtual void Close(); // at 0x10
|
||||
|
||||
virtual s32 Read(void *dst, u32 size); // at 0x14
|
||||
virtual bool ReadAsync(void *dst, u32 size, AsyncCallback callback,
|
||||
virtual long Read(void *dst, unsigned long size); // at 0x14
|
||||
virtual bool ReadAsync(void *dst, unsigned long size, AsyncCallback callback,
|
||||
void *arg); // at 0x18
|
||||
|
||||
virtual void Write(const void *src, u32 size); // at 0x1C
|
||||
virtual bool WriteAsync(const void *src, u32 size, AsyncCallback callback,
|
||||
virtual long Write(const void *src, unsigned long size); // at 0x1C
|
||||
virtual bool WriteAsync(const void *src, unsigned long size, AsyncCallback callback,
|
||||
void *arg); // at 0x20
|
||||
|
||||
virtual void Seek(s32 offset, u32 origin); // at 0x44
|
||||
virtual void Seek(long offset, unsigned long origin); // at 0x44
|
||||
|
||||
bool Open(const char *path, u32 access);
|
||||
bool Open(const NANDFileInfo *info, u32 access, bool close) DECOMP_DONT_INLINE;
|
||||
bool Open(const char *path, unsigned long access);
|
||||
bool Open(const NANDFileInfo *info, unsigned long access, bool close) DECOMP_DONT_INLINE;
|
||||
|
||||
private:
|
||||
static void NandAsyncCallback_(s32 result, NANDCommandBlock *block);
|
||||
static void NandAsyncCallback_(long result, NANDCommandBlock *block);
|
||||
|
||||
void Initialize_();
|
||||
|
||||
private:
|
||||
FilePosition mFilePosition; // at 0x14
|
||||
AsyncContext mAsyncContext; // at 0x1C
|
||||
bool mCanRead; // at 0x164
|
||||
bool mCanWrite; // at 0x165
|
||||
volatile bool mIsBusy; // at 0x166
|
||||
bool mCloseOnDestroy; // at 0x167
|
||||
bool mAllowClose; // at 0x168
|
||||
bool mCanRead; // at 0x168
|
||||
bool mCanWrite; // at 0x169
|
||||
volatile bool mIsBusy; // at 0x16A
|
||||
bool mCloseOnDestroy; // at 0x16B
|
||||
bool mAllowClose; // at 0x16C
|
||||
};
|
||||
|
||||
} // namespace ut
|
||||
|
||||
@@ -8,12 +8,13 @@ namespace ut {
|
||||
|
||||
class ResFont : public detail::ResFontBase {
|
||||
public:
|
||||
static FontInformation* Rebuild(BinaryFileHeader* header);
|
||||
static FontInformation *Rebuild(BinaryFileHeader *header);
|
||||
|
||||
ResFont();
|
||||
~ResFont();
|
||||
|
||||
bool SetResource(void* buffer);
|
||||
bool SetResource(void *buffer);
|
||||
void *RemoveResource();
|
||||
};
|
||||
|
||||
} // namespace ut
|
||||
|
||||
@@ -6,11 +6,7 @@
|
||||
namespace nw4r {
|
||||
namespace ut {
|
||||
|
||||
enum FontMapMethod {
|
||||
FONT_MAPMETHOD_LINEAR,
|
||||
FONT_MAPMETHOD_ARRAY,
|
||||
FONT_MAPMETHOD_SCAN
|
||||
};
|
||||
enum FontMapMethod { FONT_MAPMETHOD_LINEAR, FONT_MAPMETHOD_ARRAY, FONT_MAPMETHOD_SCAN };
|
||||
|
||||
struct FontTextureGlyph {
|
||||
u8 cellWidth; // at 0x0
|
||||
@@ -24,13 +20,13 @@ struct FontTextureGlyph {
|
||||
u16 sheetLine; // at 0xE
|
||||
u16 sheetWidth; // at 0x10
|
||||
u16 sheetHeight; // at 0x12
|
||||
u8* sheetImage; // at 0x14
|
||||
u8 *sheetImage; // at 0x14
|
||||
};
|
||||
|
||||
struct FontWidth {
|
||||
u16 firstChar; // at 0x0
|
||||
u16 lastChar; // at 0x2
|
||||
FontWidth* next; // at 0x4
|
||||
FontWidth *next; // at 0x4
|
||||
CharWidths widthTable[]; // at 0x8
|
||||
};
|
||||
|
||||
@@ -39,7 +35,7 @@ struct FontCodeMap {
|
||||
u16 lastChar; // at 0x2
|
||||
u16 mappingMethod; // at 0x4
|
||||
u16 reserved; // at 0x6
|
||||
FontCodeMap* next; // at 0x8
|
||||
FontCodeMap *next; // at 0x8
|
||||
u16 mapInfo[]; // at 0xc
|
||||
};
|
||||
|
||||
@@ -49,9 +45,9 @@ struct FontInformation {
|
||||
u16 alterCharIndex; // at 0x2
|
||||
CharWidths defaultWidth; // at 0x4
|
||||
u8 encoding; // at 0x7
|
||||
FontTextureGlyph* fontGlyph; // at 0x8
|
||||
FontWidth* fontWidth; // at 0xC
|
||||
FontCodeMap* fontMap; // at 0x10
|
||||
FontTextureGlyph *fontGlyph; // at 0x8
|
||||
FontWidth *fontWidth; // at 0xC
|
||||
FontCodeMap *fontMap; // at 0x10
|
||||
u8 height; // at 0x14
|
||||
u8 width; // at 0x15
|
||||
u8 ascent; // at 0x16
|
||||
@@ -76,34 +72,37 @@ public:
|
||||
virtual GXTexFmt GetTextureFormat() const; // at 0x30
|
||||
virtual int GetLineFeed() const; // at 0x34
|
||||
virtual CharWidths GetDefaultCharWidths() const; // at 0x38
|
||||
virtual void SetDefaultCharWidths(const CharWidths& widths); // at 0x3C
|
||||
virtual void SetDefaultCharWidths(const CharWidths &widths); // at 0x3C
|
||||
virtual bool SetAlternateChar(u16 c); // at 0x40
|
||||
virtual void SetLineFeed(int lf); // at 0x44
|
||||
virtual int GetCharWidth(u16 c) const; // at 0x48
|
||||
virtual CharWidths GetCharWidths(u16 c) const; // at 0x4C
|
||||
virtual void GetGlyph(Glyph* out, u16 c) const; // at 0x50
|
||||
virtual FontEncoding GetEncoding() const; // at 0x54
|
||||
virtual void GetGlyph(Glyph *out, u16 c) const; // at 0x50
|
||||
virtual bool HasGlyph(u16 c) const; // at 0x54
|
||||
virtual FontEncoding GetEncoding() const; // at 0x58
|
||||
|
||||
bool IsManaging(const void* buffer) const { return mResource == buffer; }
|
||||
bool IsManaging(const void *buffer) const {
|
||||
return mResource == buffer;
|
||||
}
|
||||
|
||||
void SetResourceBuffer(void* buffer, FontInformation* info);
|
||||
void SetResourceBuffer(void *buffer, FontInformation *info);
|
||||
void *RemoveResourceBuffer();
|
||||
|
||||
u16 GetGlyphIndex(u16 c) const;
|
||||
|
||||
u16 FindGlyphIndex(u16 c) const;
|
||||
u16 FindGlyphIndex(const FontCodeMap* map, u16 c) const;
|
||||
u16 FindGlyphIndex(const FontCodeMap *map, u16 c) const;
|
||||
|
||||
const CharWidths& GetCharWidthsFromIndex(u16 index) const;
|
||||
const CharWidths& GetCharWidthsFromIndex(const FontWidth* width,
|
||||
u16 index) const;
|
||||
const CharWidths &GetCharWidthsFromIndex(u16 index) const;
|
||||
const CharWidths &GetCharWidthsFromIndex(const FontWidth *width, u16 index) const;
|
||||
|
||||
void GetGlyphFromIndex(Glyph* out, u16 index) const;
|
||||
void GetGlyphFromIndex(Glyph *out, u16 index) const;
|
||||
|
||||
private:
|
||||
void* mResource; // at 0x10
|
||||
FontInformation* mFontInfo; // at 0x14
|
||||
u16 mLastCharCode; // at 0x18
|
||||
u16 mLastGlyphIndex; // at 0x18
|
||||
void *mResource; // at 0x10
|
||||
FontInformation *mFontInfo; // at 0x14
|
||||
mutable u16 mLastCharCode; // at 0x18
|
||||
mutable u16 mLastGlyphIndex; // at 0x1A
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
@@ -30,7 +30,8 @@ public:
|
||||
virtual int GetCharWidth(u16 c) const; // at 0x48
|
||||
virtual CharWidths GetCharWidths(u16 c) const; // at 0x4C
|
||||
virtual void GetGlyph(Glyph *out, u16 c) const; // at 0x50
|
||||
virtual FontEncoding GetEncoding() const; // at 0x54
|
||||
virtual bool HasGlyph(u16 c) const; // at 0x54
|
||||
virtual FontEncoding GetEncoding() const; // at 0x58
|
||||
|
||||
bool Load(void *buffer);
|
||||
u32 GetRequireBufferSize();
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
void SetDrawFlag(u32 flag) {
|
||||
mDrawFlag = flag;
|
||||
}
|
||||
bool IsDrawFlagSet(u32 mask, u32 flag) const {
|
||||
bool IsDrawFlagSet(unsigned long mask, u32 flag) const {
|
||||
return (mDrawFlag & mask) == flag;
|
||||
}
|
||||
|
||||
@@ -78,20 +78,39 @@ public:
|
||||
mTagProcessor = &mDefaultTagProcessor;
|
||||
}
|
||||
|
||||
void SetLineHeight(f32 height);
|
||||
f32 GetLineHeight() const;
|
||||
|
||||
f32 CalcLineWidth(const T *str, int len);
|
||||
f32 CalcStringWidth(const T *str, int len) const;
|
||||
void CalcStringRect(Rect *rect, const T *str, int len) const;
|
||||
f32 CalcFormatStringWidth(const T *str, ...) const;
|
||||
f32 CalcFormatStringHeight(const T *str, ...) const;
|
||||
void CalcFormatStringRect(Rect *rect, const T *str, ...) const;
|
||||
void CalcVStringRect(Rect *rect, const T *str, va_list args) const;
|
||||
|
||||
int VSNPrintf(T *buffer, u32 count, const T *fmt, va_list args);
|
||||
f32 CalcStringWidth(const T *format, int len) const;
|
||||
f32 CalcStringHeight(const T *format, int len) const;
|
||||
void CalcStringRect(Rect *rect, const T *format, int len) const;
|
||||
|
||||
f32 Printf(const T *format, ...);
|
||||
f32 VPrintf(const T *str, va_list args);
|
||||
f32 Print(const T *str, int len);
|
||||
f32 PrintfMutable(const T *format, ...);
|
||||
f32 VPrintfMutable(const T *format, va_list args);
|
||||
f32 PrintMutable(const T *str, int n);
|
||||
|
||||
// static int VSNPrintf(T *buffer, unsigned long count, const T *fmt, va_list args);
|
||||
|
||||
static int VSNPrintf(char *buffer, unsigned long count, const char *fmt, va_list args) {
|
||||
return vsnprintf(buffer, count, fmt, args);
|
||||
}
|
||||
|
||||
static int VSNPrintf(wchar_t *buffer, unsigned long count, const wchar_t *fmt, va_list args) {
|
||||
return vswprintf(buffer, count, fmt, args);
|
||||
}
|
||||
|
||||
f32 CalcLineWidth(const T *format, int len);
|
||||
bool CalcLineRectImpl(Rect *rect, const T **str, int len);
|
||||
void CalcStringRectImpl(Rect *rect, const T *str, int len);
|
||||
|
||||
f32 PrintImpl(const T *str, int len);
|
||||
f32 PrintImpl(const T *str, int len, bool m);
|
||||
f32 AdjustCursor(f32 *x1, f32 *y1, const T *str, int len);
|
||||
|
||||
private:
|
||||
@@ -103,19 +122,19 @@ private:
|
||||
TagProcessorBase<T> *mTagProcessor; // at 0x60
|
||||
|
||||
static T *mFormatBuffer;
|
||||
static u32 mFormatBufferSize;
|
||||
static int mFormatBufferSize;
|
||||
static TagProcessorBase<T> mDefaultTagProcessor;
|
||||
};
|
||||
|
||||
template <>
|
||||
inline int TextWriterBase<char>::VSNPrintf(char *buffer, u32 count, const char *fmt, va_list args) {
|
||||
return vsnprintf(buffer, count, fmt, args);
|
||||
}
|
||||
// template <>
|
||||
// int TextWriterBase<char>::VSNPrintf(char *buffer, unsigned long count, const char *fmt, va_list args) {
|
||||
// return vsnprintf(buffer, count, fmt, args);
|
||||
// }
|
||||
|
||||
template <>
|
||||
inline int TextWriterBase<wchar_t>::VSNPrintf(wchar_t *buffer, u32 count, const wchar_t *fmt, va_list args) {
|
||||
return vswprintf(buffer, count, fmt, args);
|
||||
}
|
||||
// template <>
|
||||
// int TextWriterBase<wchar_t>::VSNPrintf(wchar_t *buffer, unsigned long count, const wchar_t *fmt, va_list args) {
|
||||
// return vswprintf(buffer, count, fmt, args);
|
||||
// }
|
||||
|
||||
} // namespace ut
|
||||
} // namespace nw4r
|
||||
|
||||
Reference in New Issue
Block a user