Match and link CDrawString, CSaveableState, minor OS.c cleanup

This commit is contained in:
Phillip Stephens 2022-12-22 18:15:25 -08:00
parent 914ca994a0
commit f3e0324674
7 changed files with 113 additions and 3 deletions

View File

@ -536,7 +536,7 @@ LIBS = [
"Kyoto/CDvdRequest",
"Kyoto/Text/CColorInstruction",
"Kyoto/Text/CColorOverrideInstruction",
"Kyoto/Text/CDrawStringOptions",
["Kyoto/Text/CDrawStringOptions", True],
"Kyoto/Text/CFontInstruction",
"Kyoto/Text/CFontRenderState",
"Kyoto/Text/CLineExtraSpaceInstruction",
@ -546,7 +546,7 @@ LIBS = [
"Kyoto/Text/CPushStateInstruction",
"Kyoto/Text/CRasterFont",
"Kyoto/Text/CRemoveColorOverrideInstruction",
"Kyoto/Text/CSavableState",
["Kyoto/Text/CSavableState", True],
"Kyoto/Text/CTextExecuteBuffer",
"Kyoto/Text/CTextInstruction",
["Kyoto/Text/CTextParser", False],

View File

@ -0,0 +1,49 @@
#ifndef _CDRAWSTRINGOPTIONS
#define _CDRAWSTRINGOPTIONS
#include "Kyoto/Graphics/CColor.hpp"
#include "rstl/reserved_vector.hpp"
enum ETextDirection {
kTD_Horizontal,
kTD_Vertical,
};
enum EJustification {
kJustification_Left = 0,
kJustification_Center,
kJustification_Right,
kJustification_Full,
kJustification_NLeft,
kJustification_NCenter,
kJustification_NRight,
kJustification_LeftMono,
kJustification_CenterMono,
kJustification_RightMono,
};
enum EVerticalJustification {
kVerticalJustification_Top = 0,
kVerticalJustification_Center,
kVerticalJustification_Bottom,
kVerticalJustification_Full,
kVerticalJustification_NTop,
kVerticalJustification_NCenter,
kVerticalJustification_NBottom,
kVerticalJustification_TopMono,
kVerticalJustification_CenterMono,
kVerticalJustification_RightMono,
};
class CDrawStringOptions {
public:
CDrawStringOptions();
void SetTextDirection(ETextDirection dir) { x0_direction = dir; }
private:
ETextDirection x0_direction;
rstl::reserved_vector<u32, 16> x4_colors;
};
#endif // _CDRAWSTRINGOPTIONS

View File

@ -3,12 +3,14 @@
#include "types.h"
#include "Kyoto/TToken.hpp"
#include "rstl/pair.hpp"
#include "rstl/vector.hpp"
class CGlyph;
class CKernPair;
class CTexture;
class IObjectStore;
class CFontInfo {
private:
@ -25,6 +27,7 @@ public:
~CRasterFont();
void SetTexture(TToken< CTexture > token) { x7c_texture = token; }
bool IsFinishedLoading();
private:
bool x0_initialized;

View File

@ -0,0 +1,28 @@
#ifndef _CSAVABLESTATE
#define _CSAVABLESTATE
#include "Kyoto/Text/CDrawStringOptions.hpp"
#include "Kyoto/Text/CRasterFont.hpp"
#include "Kyoto/Text/CTextColor.hpp"
#include "rstl/optional_object.hpp"
#include "rstl/vector.hpp"
class CSaveableState {
public:
CSaveableState();
bool IsFinishedLoading();
private:
CDrawStringOptions x0_drawStringOptions;
rstl::optional_object< TToken< CRasterFont > > x48_font;
rstl::vector< CTextColor > x54_colors;
rstl::vector<bool> x64_colorOverrides;
float x74_lineSpacing;
int x78_extraLineSpacing;
bool x7c_enableWordWrap;
EJustification x80_just;
EVerticalJustification x84_vjust;
};
#endif // _CSAVABLESTATE

View File

@ -480,7 +480,9 @@ entry __OSDBJUMPSTART
entry __OSDBJUMPEND
/* clang-format on */
} __OSExceptionHandler
}
__OSExceptionHandler
__OSSetExceptionHandler(__OSException exception, __OSExceptionHandler handler) {
__OSExceptionHandler oldHandler;
oldHandler = OSExceptionTable[exception];

View File

@ -0,0 +1,9 @@
#include "Kyoto/Text/CDrawStringOptions.hpp"
static const uint col = 0;
CDrawStringOptions::CDrawStringOptions()
: x0_direction(kTD_Horizontal)
, x4_colors(col) {
}

View File

@ -0,0 +1,19 @@
#include "Kyoto/Text/CSavableState.hpp"
CSaveableState::CSaveableState()
: x54_colors(3, CTextColor(0, 0, 0, 255))
, x64_colorOverrides(16, false)
, x74_lineSpacing(1.f)
, x78_extraLineSpacing(0)
, x7c_enableWordWrap(false)
, x80_just(kJustification_Left)
, x84_vjust(kVerticalJustification_Top) {}
bool CSaveableState::IsFinishedLoading() {
if (x48_font) {
TToken< CRasterFont > font(x48_font.data());
return font.IsLoaded() && font.GetT()->IsFinishedLoading();
}
return false;
}