Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
206 changes: 98 additions & 108 deletions config/GM8E01_00/symbols.txt

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions include/GuiSys/CGuiFrame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "GuiSys/CGuiWidgetIdDB.hpp"
#include "rstl/string.hpp"

class CFinalInput;
class CGuiWidget;
class CGuiCamera;
class CGuiLight;
Expand All @@ -13,8 +14,10 @@ class CGuiFrame {
public:
void Update(float dt);
void Draw(const CGuiWidgetDrawParms& parms) const;
void ProcessUserInput(const CFinalInput& input);
CGuiWidget* FindWidget(const char* name) const;
CGuiWidget* FindWidget(const rstl::string& name) const;
bool GetIsFinishedLoading() const;

CGuiCamera* GetFrameCamera() const { return x14_camera; }
void SetFrameCamera(CGuiCamera* camera);
Expand Down
28 changes: 26 additions & 2 deletions include/GuiSys/CGuiTableGroup.hpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,40 @@
#ifndef _CGUITABLEGROUP
#define _CGUITABLEGROUP

#include "GuiSys/CGuiObject.hpp"
#include "GuiSys/CGuiCompoundWidget.hpp"
#include "Kyoto/TFunctor.hpp"

class CGuiTableGroup {
class CColor;

class CGuiTableGroup : public CGuiCompoundWidget {
public:
class CRepeatState {
CRepeatState();
uchar Update(float dt, bool state);
private:
float x0_timer;
};

void SetColors(const CColor& selected, const CColor& unselected) const;
int GetUserSelection() const { return xc4_userSelection; }
void SetUserSelection(int sel) {
xc8_prevUserSelection = xc4_userSelection;
xc4_userSelection = sel;
}
void SetMenuAdvanceCallback(const TFunctor1< CGuiTableGroup* const >& cb);
void SetMenuSelectionChangeCallback(
const TFunctor3< CGuiTableGroup* const, const int, const int >& cb);
void SetMenuCancelCallback(const TFunctor1< CGuiTableGroup* const >& cb);

void SetVertical(bool v) { xd1_vertical = v; }

private:
char xb8_pad[0xc4 - 0xb8];
int xc4_userSelection;
int xc8_prevUserSelection;
int xcc_defaultUserSelection;
bool xd0_selectWraparound;
bool xd1_vertical;
};

#endif // _CGUITABLEGROUP
38 changes: 29 additions & 9 deletions include/GuiSys/CGuiTextSupport.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "Kyoto/SObjectTag.hpp"

#include "Kyoto/Math/CVector2i.hpp"
#include "Kyoto/Text/TextCommon.hpp"

#include "rstl/pair.hpp"
Expand All @@ -21,12 +22,7 @@ class CGuiTextProperties {
public:
CGuiTextProperties(bool wordWrap, bool horizontal, EJustification justification,
EVerticalJustification vertJustification,
const rstl::vector< rstl::pair< CAssetId, CAssetId > >* txtrMap = nullptr)
: x0_wordWrap(wordWrap)
, x1_horizontal(horizontal)
, x4_justification(justification)
, x8_vertJustification(vertJustification)
, xc_txtrMap(txtrMap) {}
const rstl::vector< rstl::pair< CAssetId, CAssetId > >* txtrMap = nullptr);

private:
bool x0_wordWrap;
Expand All @@ -43,25 +39,49 @@ class CGuiTextSupport {
public:
CGuiTextSupport(CAssetId fontId, const CGuiTextProperties& props, const CColor& fontCol,
const CColor& outlineCol, const CColor& geomCol, int extX, int extY,
CSimplePool* store, int /*CGuiWidget::EGuiModelDrawFlags*/ drawFlags);
CSimplePool* store);
~CGuiTextSupport();

void SetText(const rstl::wstring&, bool clearRenderBuffer = false);
void SetText(const rstl::string&, bool multipage = false);
void SetWordWrap(bool wordWrap);
void ClearRenderBuffer();
void SetImageBaseline(bool baseline);
bool SetTypeWriteEffectOptions(bool enable, float fadeTime, float rate);
void SetGeometryColor(const CColor& col);
void SetOutlineColor(const CColor& col);
void SetFontColor(const CColor& col);
void Render() const;
void Render();
const rstl::pair< CVector2i, CVector2i >& GetBounds();
bool GetIsTextSupportFinishedLoading() const;

void SetExtentX(int extent) {
x34_extentX = extent;
ClearRenderBuffer();
}
void SetExtentY(int extent) {
x38_extentY = extent;
ClearRenderBuffer();
}

float GetNumCharsTotal() const;
float GetNumCharactersPrinted() const;
float GetTotalAnimationTime() const;
bool IsAnimationDone() const { return x3c_curTime >= GetTotalAnimationTime(); }
float GetCurTime() const { return x3c_curTime; }
void SetCurTime(float t) { x3c_curTime = t; }

static void Initialize(CTextExecuteBuffer* buf, CTextParser* parser) {
gpExecBuf = buf;
gpTextParser = parser;
}

private:
char x0_pad[0x30c];
char x0_pad[0x34];
int x34_extentX;
int x38_extentY;
float x3c_curTime;
char x40_pad[0x30c - 0x40];
};

#endif // _CGUITEXTSUPPORT
1 change: 1 addition & 0 deletions include/GuiSys/CGuiWidget.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class CGuiWidget : public CGuiObject {
short GetWorkerId() const { return xb4_workerId; }

void SetDepthTest(bool depthTest) { xb6_31_depthTest = depthTest; }
void SetIsSelectable(bool selectable) { xb6_27_isSelectable = selectable; }
void SetIsVisible(bool visible);
void SetIsActive(bool active);
void SetColor(const CColor& color);
Expand Down
3 changes: 1 addition & 2 deletions include/GuiSys/CGuiWidgetDrawParms.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
#include "Kyoto/Math/CVector3f.hpp"

class CGuiWidgetDrawParms {
private:
public:
static CGuiWidgetDrawParms sDefaultDrawParms;

public:
CGuiWidgetDrawParms(float alpha) : mAlpha(alpha), mCameraOffset(0.f, 0.f, 0.f) {}
CGuiWidgetDrawParms(float alpha, const CVector3f& offset) : mAlpha(alpha), mCameraOffset(offset) {}
float GetAlpha() const { return mAlpha; }
Expand Down
2 changes: 1 addition & 1 deletion include/Kyoto/Audio/CAudioSys.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class CAudioSys {
static void SysSetVolume(uchar, ushort, uchar);
static void SysSetSfxVolume(uchar, ushort, uchar, uchar);
static bool SysLoadGroupSet(CSimplePool*, uint);
static bool SysLoadGroupSet(TLockedToken< CAudioGroupSet >, rstl::string, uint);
static bool SysLoadGroupSet(const CToken&, const rstl::string&, uint);
static const rstl::string& SysGetGroupSetName(uint);
static bool SysPushGroupIntoARAM(const rstl::string& name, uchar);
static void SysPopGroupFromARAM();
Expand Down
2 changes: 1 addition & 1 deletion include/Kyoto/Audio/CStaticAudioPlayer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class CStaticAudioPlayer {
void DecodeMonoAndMix(ushort* bufIn, ushort* bufOut, int numSamples,
int curSample, int sampleEnd, int sampleStart,
int vol, g72x_state& state);
void SetVolume(char vol);
void SetVolume(uchar vol);

private:
rstl::string x0_filepath;
Expand Down
3 changes: 2 additions & 1 deletion include/Kyoto/Audio/CStreamAudioManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class CStreamAudioManager {

static void Update(float dt);
static void StopAll();
static void FadeBackIn(float time);
static void StopOneShot();
static void SetMusicVolume(uint vol);
static void SetSfxVolume(uint vol);
Expand All @@ -53,7 +54,7 @@ class CStreamAudioManager {

static void fn_803653F8(float fadeTime);
static void fn_80365424(float fadeTime);
static void fn_8036590C(float fadeTime);
// static void fn_8036590C(float fadeTime); // renamed to FadeBackIn

private:
static void HandleMusicUnmute();
Expand Down
16 changes: 9 additions & 7 deletions include/Kyoto/CResFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,21 @@ class CResFactory : public IFactory {
public:
CResFactory();

~CResFactory();
CFactoryFnReturn Build(const SObjectTag&, const CVParamTransfer&);
void BuildAsync(const SObjectTag&, const CVParamTransfer&, IObj**);
void CancelBuild(const SObjectTag&);
bool CanBuild(const SObjectTag&);
const SObjectTag* GetResourceIdByName(const char* name) const;
~CResFactory() override;
CFactoryFnReturn Build(const SObjectTag&, const CVParamTransfer&) override;
void BuildAsync(const SObjectTag&, const CVParamTransfer&, IObj**) override;
void CancelBuild(const SObjectTag&) override;
bool CanBuild(const SObjectTag&) override;
const SObjectTag* GetResourceIdByName(const char* name) const override;

FourCC GetResourceTypeById(CAssetId id) { return GetResLoader().GetResourceTypeById(id); }

uint ResourceSize(const SObjectTag& tag) const { return x4_resLoader.ResourceSize(tag); }

void AsyncIdle(uint time);

CResLoader& GetResLoader() { return x4_resLoader; }
FourCC GetResourceTypeById(CAssetId id) { return GetResLoader().GetResourceTypeById(id); }

CInputStream* LoadResourceFromMemorySync(const SObjectTag& tag, const void* extBuf) {
return x4_resLoader.LoadResourceFromMemorySync(tag, extBuf);
}
Expand Down
1 change: 1 addition & 0 deletions include/Kyoto/CResLoader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class CResLoader {
CDvdRequest* LoadResourceAsync(const SObjectTag& tag, char*);

FourCC GetResourceTypeById(CAssetId) const;
bool ResourceExists(const SObjectTag& tag) const;
uint ResourceSize(const SObjectTag& tag) const;

private:
Expand Down
4 changes: 2 additions & 2 deletions include/Kyoto/Graphics/CGraphics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,9 @@ class CGraphics {
static void VideoPostCallback(u32 retraceCount);

static const CViewport& GetViewport() { return mViewport; }
static void GetViewport(int& left, int& bottom, int& width, int& height) {
static void GetViewport(int& left, int& top, int& width, int& height) {
left = mViewport.mLeft;
bottom = mViewport.mTop;
top = mViewport.mTop;
width = mViewport.mWidth;
height = mViewport.mHeight;
}
Expand Down
37 changes: 26 additions & 11 deletions include/Kyoto/Graphics/CMoviePlayer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define _CMOVIEPLAYER

#include "Kyoto/CDvdFile.hpp"
#include "Kyoto/Math/CVector3f.hpp"
#include "types.h"

class CMoviePlayer {
Expand All @@ -18,27 +19,41 @@ class CMoviePlayer {
uint GetAudioSamplesConsumed() const;
void SetAudioSamplesConsumed(uint);
};
enum EPlayMode {
kPM_Stopped = 0,
kPM_Playing = 1
};

static void SetSfxVolume(uchar);

CMoviePlayer(const char*, float, bool, bool);
~CMoviePlayer();

void Update(float);
bool DrawVideo() const;
void DrawFrame(const CVector3f& v1, const CVector3f& v2, const CVector3f& v3, const CVector3f& v4);
int GetWidth() const;
int GetHeight() const;
bool CanDrawVideo() const { return xac_drawState == 0; }
bool PumpIndexLoad();
void Rewind();
void SetPlayMode(EPlayMode mode);
float GetTotalSeconds() const;
bool GetIsFullyCached() const;
bool GetIsMovieFinishedPlaying() const;
bool IsLooping() const { return (xf4_flags & 0x80) != 0; }
float GetPlayedSeconds() const;

private:
CDvdFile x0_movieFile;
uint x84_;
uint x88_;
uint x8c_;
uchar x90_;
uint x94_;
uint x98_;
uint x9c_;
uint xa0_;
uint xa4_;
uint xa8_;
// char x0_pad[0x100];
char x28_pad1[0x6c - sizeof(CDvdFile)];
int x6c_width;
int x70_height;
char x74_pad2[0xac - 0x74];
uint xac_drawState;
char xb0_pad3[0xf4 - 0xb0];
uchar xf4_flags;
char xf5_pad4[0x100 - 0xf5];
};

#endif // _CMOVIEPLAYER
1 change: 1 addition & 0 deletions include/Kyoto/IFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define _IFACTORY

#include <Kyoto/CFactoryFnReturn.hpp>
#include <Kyoto/SObjectTag.hpp>

class SObjectTag;
class CVParamTransfer;
Expand Down
82 changes: 82 additions & 0 deletions include/Kyoto/TFunctor.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#ifndef _TFUNCTOR
#define _TFUNCTOR

#include "types.h"
#include <string.h>

template < class A1 >
class TFunctor1 {
public:
typedef void (*CallOp)(void*, void*, A1);

TFunctor1() : x0_callop(nullptr), x4_obj(nullptr) {
x8_ptmf[0] = 0;
x8_ptmf[1] = 0;
x8_ptmf[2] = 0;
}

template < class T, class MFn >
TFunctor1(T* obj, MFn fn) {
int ptmf[3];
memcpy(ptmf, &fn, sizeof(ptmf));
x0_callop = &Thunk< T >;
x4_obj = obj;
memcpy(x8_ptmf, ptmf, sizeof(x8_ptmf));
}

void operator()(A1 a1) const { x0_callop(x4_obj, const_cast< int* >(x8_ptmf), a1); }

private:
template < class T >
static void Thunk(void* obj, void* ptmf_data, A1 a1) {
void (T::*fn)(A1);
memcpy(&fn, ptmf_data, sizeof(fn));
(static_cast< T* >(obj)->*fn)(a1);
}

CallOp x0_callop;
void* x4_obj;
int x8_ptmf[3];
int x14_pad;
};

template < class A1, class A2, class A3 >
class TFunctor3 {
public:
typedef void (*CallOp)(void*, void*, A1, A2);

TFunctor3() : x0_callop(nullptr), x4_obj(nullptr) {
x8_ptmf[0] = 0;
x8_ptmf[1] = 0;
x8_ptmf[2] = 0;
}

template < class T, class MFn >
TFunctor3(T* obj, MFn fn) {
int ptmf[3];
memcpy(ptmf, &fn, sizeof(ptmf));
x0_callop = &Thunk< T >;
x4_obj = obj;
memcpy(x8_ptmf, ptmf, sizeof(x8_ptmf));
}

void operator()(A1 a1, A2 a2, A3 a3) const {
x0_callop(x4_obj, const_cast< int* >(x8_ptmf), a1, a2);
}

private:
template < class T >
static void Thunk(void* obj, void* ptmf_data, A1 a1, A2 a2) {
typedef void (T::*Fn)(A1, A2);
Fn fn;
memcpy(&fn, ptmf_data, sizeof(fn));
(static_cast< T* >(obj)->*fn)(a1, a2);
}

CallOp x0_callop;
void* x4_obj;
int x8_ptmf[3];
int x14_pad;
};

#endif // _TFUNCTOR
Loading
Loading