Match CConsoleOutputWindow, regswaps in constructor

Former-commit-id: 27bd20ff1d
This commit is contained in:
Phillip Stephens 2022-10-08 23:55:24 -07:00
parent 2f62a31d18
commit ac0e3ef534
7 changed files with 117 additions and 20 deletions

View File

@ -1,5 +1,16 @@
.include "macros.inc"
.section .rodata
.balign 8
.global lbl_803CEE00
lbl_803CEE00:
# ROM: 0x3CBE00
.asciz "ConsoleOutputWindow"
.4byte 0x003F3F28
.4byte 0x3F3F2900
.4byte 0
.section .data
.balign 8
@ -32,8 +43,8 @@ lbl_805A7544:
.balign 8
# CConsoleOutputWindow
.global lbl_805A8F00
lbl_805A8F00:
.global mInstance__20CConsoleOutputWindow
mInstance__20CConsoleOutputWindow:
.skip 0x8
.section .sdata2, "a"
@ -139,7 +150,7 @@ __dt__20CConsoleOutputWindowFv:
/* 800FE988 000FB8E8 38 63 FE 50 */ addi r3, r3, lbl_803DFE50@l
/* 800FE98C 000FB8EC 38 00 00 00 */ li r0, 0
/* 800FE990 000FB8F0 90 7E 00 00 */ stw r3, 0(r30)
/* 800FE994 000FB8F4 90 0D A3 40 */ stw r0, lbl_805A8F00@sda21(r13)
/* 800FE994 000FB8F4 90 0D A3 40 */ stw r0, mInstance__20CConsoleOutputWindow@sda21(r13)
/* 800FE998 000FB8F8 41 82 00 44 */ beq lbl_800FE9DC
/* 800FE99C 000FB8FC 80 1E 00 34 */ lwz r0, 0x34(r30)
/* 800FE9A0 000FB900 80 7E 00 3C */ lwz r3, 0x3c(r30)
@ -336,7 +347,7 @@ lbl_800FEC44:
lbl_800FEC54:
/* 800FEC54 000FBBB4 7C 1E E8 00 */ cmpw r30, r29
/* 800FEC58 000FBBB8 41 80 FF 38 */ blt lbl_800FEB90
/* 800FEC5C 000FBBBC 93 8D A3 40 */ stw r28, lbl_805A8F00@sda21(r13)
/* 800FEC5C 000FBBBC 93 8D A3 40 */ stw r28, mInstance__20CConsoleOutputWindow@sda21(r13)
/* 800FEC60 000FBBC0 7F 83 E3 78 */ mr r3, r28
/* 800FEC64 000FBBC4 E3 E1 00 68 */ psq_l f31, 104(r1), 0, qr0
/* 800FEC68 000FBBC8 CB E1 00 60 */ lfd f31, 0x60(r1)
@ -350,14 +361,3 @@ lbl_800FEC54:
/* 800FEC88 000FBBE8 7C 08 03 A6 */ mtlr r0
/* 800FEC8C 000FBBEC 38 21 00 70 */ addi r1, r1, 0x70
/* 800FEC90 000FBBF0 4E 80 00 20 */ blr
.section .rodata
.balign 8
.global lbl_803CEE00
lbl_803CEE00:
# ROM: 0x3CBE00
.asciz "ConsoleOutputWindow"
.4byte 0x003F3F28
.4byte 0x3F3F2900
.4byte 0

View File

@ -0,0 +1,14 @@
#ifndef _CFONT
#define _CFONT
class CFont {
public:
CFont(float scale);
~CFont();
int CharWidth(char) const;
private:
float mFontSize;
float mScale;
};
#endif // _CFONT

View File

@ -6,11 +6,12 @@
#include "MetroidPrime/CArchitectureMessage.hpp"
class CArchMsgParmReal32 : public IArchitectureMessageParm {
float mVal;
public:
CArchMsgParmReal32(float);
~CArchMsgParmReal32();
float GetReal() const { return mVal; }
private:
float mVal;
};
#endif // _CARCHMSGPARMREAL32

View File

@ -31,6 +31,9 @@ struct IArchitectureMessageParm {
IArchitectureMessageParm::~IArchitectureMessageParm() {}
class CArchitectureMessage {
public:
EArchMsgType GetType() const { return x4_type; }
private:
EArchMsgTarget x0_target;
EArchMsgType x4_type;

View File

@ -1,17 +1,29 @@
#ifndef _CCONSOLEOUTPUTWINDOW
#define _CCONSOLEOUTPUTWINDOW
#include "types.h"
#include "MetroidPrime/CIOWin.hpp"
#include "Kyoto/Text/CFont.hpp"
#include <rstl/vector.hpp>
class CConsoleOutputWindow : public CIOWin {
static CConsoleOutputWindow* mInstance;
public:
CConsoleOutputWindow(int, float, float);
~CConsoleOutputWindow() override;
EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&) override;
void Draw() override;
void Update(float);
void Draw() const;
private:
CFont mFont;
float mUnk;
rstl::vector<rstl::string> mText;
rstl::vector<float> mUnkFloats;
int x40_;
int x44_;
int x48_;
};
#endif // _CCONSOLEOUTPUTWINDOW

View File

@ -0,0 +1,15 @@
#ifndef _DECODE
#define _DECODE
#include "MetroidPrime/CArchMsgParmInt32.hpp"
#include "MetroidPrime/CArchMsgParmInt32Int32VoidPtr.hpp"
#include "MetroidPrime/CArchMsgParmNull.hpp"
#include "MetroidPrime/CArchMsgParmReal32.hpp"
#include "MetroidPrime/CArchMsgParmUserInput.hpp"
#include "MetroidPrime/CArchMsgParmControllerStatus.hpp"
namespace MakeMsg {
const CArchMsgParmReal32& GetParmTimerTick(const CArchitectureMessage& msg);
}
#endif // _DECODE

View File

@ -0,0 +1,52 @@
#include "MetroidPrime/CConsoleOutputWindow.hpp"
#include "MetroidPrime/CArchitectureMessage.hpp"
#include "MetroidPrime/Decode.hpp"
#include <rstl/math.hpp>
CConsoleOutputWindow* CConsoleOutputWindow::mInstance = nullptr;
CConsoleOutputWindow::CConsoleOutputWindow(int stringCount, float f1, float fontScale)
: CIOWin(rstl::string_l("ConsoleOutputWindow"))
, mFont(fontScale)
, mUnk(f1)
, x40_(632.f / mFont.CharWidth('0'))
, x44_(0)
, x48_(0) {
mText.reserve(stringCount);
mUnkFloats.reserve(stringCount);
for (int i = 0; i < stringCount; i++) {
mText.push_back(rstl::string("", x40_ + 1));
mUnkFloats.push_back(0.f);
}
mInstance = this;
}
CConsoleOutputWindow::~CConsoleOutputWindow() { mInstance = nullptr; }
CIOWin::EMessageReturn CConsoleOutputWindow::OnMessage(const CArchitectureMessage& msg,
CArchitectureQueue& queue) {
switch (msg.GetType()) {
case kAM_UserInput:
return kMR_Normal;
break;
case kAM_TimerTick:
Update(MakeMsg::GetParmTimerTick(msg).GetReal());
return kMR_Normal;
default:
return kMR_Normal;
}
}
void CConsoleOutputWindow::Update(float dt) {
for (int i = 0; i < mText.size(); ++i) {
mUnkFloats[i] = rstl::max_val(0.f, mUnkFloats[i] - dt);
}
}
void CConsoleOutputWindow::Draw() const {
}