mirror of
https://github.com/zeldaret/tp
synced 2026-05-24 23:22:01 -04:00
d_error_msg mostly done, little Z2LinkMgr work (#2248)
This commit is contained in:
+239
-131
@@ -1,157 +1,265 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: d/d_error_msg
|
||||
//
|
||||
/**
|
||||
* d_error_msg.cpp
|
||||
* Disk Error Message screen handler
|
||||
*/
|
||||
|
||||
#include <cstring.h>
|
||||
#include "d/d_error_msg.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "JSystem/J2DGraph/J2DTextBox.h"
|
||||
#include "JSystem/J2DGraph/J2DPicture.h"
|
||||
#include "JSystem/J2DGraph/J2DOrthoGraph.h"
|
||||
#include "JSystem/JUtility/JUTResFont.h"
|
||||
#include "m_Do/m_Do_graphic.h"
|
||||
#include "JSystem/JUtility/JUTTexture.h"
|
||||
#include "m_Do/m_Do_Reset.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
extern "C" static void messageSet__FUlb();
|
||||
extern "C" void draw__14dDvdErrorMsg_cFl();
|
||||
extern "C" void execute__14dDvdErrorMsg_cFv();
|
||||
extern "C" static void drawCapture__FUc();
|
||||
extern "C" void execute__19dShutdownErrorMsg_cFv();
|
||||
extern "C" extern char const* const d_d_error_msg__stringBase0;
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
// extern "C" void OSReport_Error();
|
||||
extern "C" void mDoAud_resetRecover__Fv();
|
||||
extern "C" void beginRender__13mDoGph_gInf_cFv();
|
||||
extern "C" void mDoGph_drawFilterQuad__FScSc();
|
||||
extern "C" void mDoRst_reset__FiUli();
|
||||
extern "C" void cLib_chaseUC__FPUcUcUc();
|
||||
extern "C" void resetProcess__10Z2AudioMgrFUlb();
|
||||
extern "C" void __ct__10JUTResFontFPC7ResFONTP7JKRHeap();
|
||||
extern "C" void __dt__10JUTResFontFv();
|
||||
extern "C" void __ct__13J2DOrthoGraphFffffff();
|
||||
extern "C" void setPort__13J2DOrthoGraphFv();
|
||||
extern "C" void func_802E980C();
|
||||
extern "C" void func_802FC800();
|
||||
extern "C" void __dt__10J2DPictureFv();
|
||||
extern "C" void draw__10J2DPictureFffffbbb();
|
||||
extern "C" void func_802FFBC4();
|
||||
extern "C" void initiate__10J2DTextBoxFPC7ResFONTPCcs18J2DTextBoxHBinding18J2DTextBoxVBinding();
|
||||
extern "C" void __dt__10J2DTextBoxFv();
|
||||
extern "C" void draw__10J2DTextBoxFfff18J2DTextBoxHBinding();
|
||||
extern "C" void drawInit__6J3DSysFv();
|
||||
extern "C" void GXClearVtxDesc();
|
||||
extern "C" void _savegpr_27();
|
||||
extern "C" void _restgpr_27();
|
||||
extern "C" extern void* __vt__14J2DGrafContext[10];
|
||||
extern "C" extern void* __vt__13J2DOrthoGraph[10];
|
||||
extern "C" u8 mFrameBufferTexObj__13mDoGph_gInf_c[32];
|
||||
extern "C" extern u8 data_80450688[8];
|
||||
extern "C" extern u8 mInitFlag__17mDoAud_zelAudio_c[4];
|
||||
extern "C" u8 mFrameBufferTimg__13mDoGph_gInf_c[4];
|
||||
extern "C" u8 mFrameBufferTex__13mDoGph_gInf_c[4];
|
||||
extern "C" u8 mResetData__6mDoRst[4 + 4 /* padding */];
|
||||
extern "C" extern u8 struct_80450FB0[8];
|
||||
extern "C" u8 sManager__10JFWDisplay[4];
|
||||
extern "C" u8 mAudioMgrPtr__10Z2AudioMgr[4 + 4 /* padding */];
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
|
||||
/* 8037B140-8037B180 0077A0 0040+00 1/1 0/0 0/0 .rodata black_tex */
|
||||
#include "assets/black_tex.h"
|
||||
|
||||
/* 8037B180-8037B3E0 0077E0 0260+00 1/1 0/0 0/0 .rodata msg_data */
|
||||
#include "assets/msg_data.h"
|
||||
|
||||
/* 8037B3E0-8038D640 -00001 12260+00 1/1 0/0 0/0 .rodata font_data */
|
||||
#include "assets/font_data.h"
|
||||
|
||||
/* 80452C18-80452C1C 001218 0004+00 3/3 0/0 0/0 .sdata2 @3758 */
|
||||
SECTION_SDATA2 static u8 lit_3758[4] = {
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
#define MSG_READING_DISC 0
|
||||
#define MSG_COVER_OPEN 1
|
||||
#define MSG_NO_DISK 2
|
||||
#define MSG_WRONG_DISK 3
|
||||
#define MSG_READ_ERROR 4
|
||||
#define MSG_FATAL_ERROR 5
|
||||
|
||||
// made up
|
||||
struct BMG_INF1 : JUTDataBlockHeader {
|
||||
/* 0x08 */ u8 m08[0x10 - 0x08];
|
||||
/* 0x10 */ u32 entries[6];
|
||||
};
|
||||
|
||||
/* 80452C1C-80452C20 00121C 0004+00 2/2 0/0 0/0 .sdata2 @3759 */
|
||||
SECTION_SDATA2 static f32 lit_3759 = 608.0f;
|
||||
|
||||
/* 80452C20-80452C24 001220 0004+00 1/1 0/0 0/0 .sdata2 @3760 */
|
||||
SECTION_SDATA2 static f32 lit_3760 = 200.0f;
|
||||
|
||||
/* 80452C24-80452C28 001224 0004+00 2/2 0/0 0/0 .sdata2 @3761 */
|
||||
SECTION_SDATA2 static f32 lit_3761 = 448.0f;
|
||||
|
||||
/* 80452C28-80452C2C 001228 0004+00 1/1 0/0 0/0 .sdata2 @3762 */
|
||||
SECTION_SDATA2 static f32 lit_3762 = 23.0f;
|
||||
|
||||
/* 80452C2C-80452C30 00122C 0004+00 1/1 0/0 0/0 .sdata2 @3763 */
|
||||
SECTION_SDATA2 static f32 lit_3763 = 22.0f;
|
||||
|
||||
/* 80452C30-80452C34 001230 0004+00 3/3 0/0 0/0 .sdata2 @3764 */
|
||||
SECTION_SDATA2 static f32 lit_3764 = 1.0f;
|
||||
|
||||
/* 80452C34-80452C38 001234 0004+00 1/1 0/0 0/0 .sdata2 @3765 */
|
||||
SECTION_SDATA2 static f32 lit_3765 = 0.5f;
|
||||
|
||||
/* 80452C38-80452C3C 001238 0004+00 1/1 0/0 0/0 .sdata2 @3766 */
|
||||
SECTION_SDATA2 static f32 lit_3766 = 2.0f;
|
||||
|
||||
/* 80452C3C-80452C40 00123C 0004+00 2/2 0/0 0/0 .sdata2 @3767 */
|
||||
SECTION_SDATA2 static f32 lit_3767 = 10.0f;
|
||||
|
||||
/* 80452C40-80452C48 001240 0008+00 1/1 0/0 0/0 .sdata2 @3769 */
|
||||
SECTION_SDATA2 static f64 lit_3769 = 4503601774854144.0 /* cast s32 to float */;
|
||||
|
||||
/* 8009CB88-8009D194 0974C8 060C+00 1/1 0/0 0/0 .text messageSet__FUlb */
|
||||
static void messageSet(u32 param_0, bool param_1) {
|
||||
// NONMATCHING
|
||||
}
|
||||
static void messageSet(u32 status, bool i_drawBg) {
|
||||
BMG_INF1* inf1 = (BMG_INF1*)&msg_data[0x20];
|
||||
const char* msg_p = (const char*)((u8*)inf1->getNext() + sizeof(JUTDataBlockHeader) + inf1->entries[status]);
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 80452C48-80452C50 001248 0004+04 1/1 0/0 0/0 .sdata2 @3835 */
|
||||
SECTION_SDATA2 static f32 lit_3835[1 + 1 /* padding */] = {
|
||||
-1.0f,
|
||||
/* padding */
|
||||
0.0f,
|
||||
};
|
||||
JUT_ASSERT(std::strlen(msg_p)-1 < 512);
|
||||
|
||||
J2DTextBox tpane('TEXT1', JGeometry::TBox2<f32>(0.0f, 0.0f, 608.0f, 200.0f), (ResFONT*)font_data, msg_p, 512, HBIND_CENTER, VBIND_CENTER);
|
||||
J2DTextBox spane('TEXT2', JGeometry::TBox2<f32>(0.0f, 0.0f, 608.0f, 200.0f), (ResFONT*)font_data, msg_p, 512, HBIND_CENTER, VBIND_CENTER);
|
||||
J2DPicture ppane('PICT1', JGeometry::TBox2<f32>(0.0f, 0.0f, 608.0f, 448.0f), (ResTIMG*)black_tex, NULL);
|
||||
|
||||
JUTResFont font((ResFONT*)font_data, NULL);
|
||||
JUTFont* pfont = (JUTFont*)&font;
|
||||
|
||||
JUtility::TColor tcharcolor(0xC8, 0xC8, 0xC8, 0xFF);
|
||||
JUtility::TColor scharcolor(0xFF, 0xFF, 0xFF, 0xFF);
|
||||
JUtility::TColor tgradcolor(0xFF, 0xFF, 0xFF, 0xFF);
|
||||
JUtility::TColor sgradcolor(0xFF, 0xFF, 0xAD, 0xFF);
|
||||
JUtility::TColor twhite(0xC8, 0xC8, 0xC8, 0xFF);
|
||||
JUtility::TColor swhite(0x00, 0x00, 0x00, 0xFF);
|
||||
JUtility::TColor tblack(0x00, 0x00, 0x00, 0x00);
|
||||
JUtility::TColor sblack(0x00, 0x00, 0x00, 0x00);
|
||||
|
||||
J2DTextBox::TFontSize size;
|
||||
size.mSizeX = 23.0f;
|
||||
size.mSizeY = 22.0f;
|
||||
|
||||
tpane.setFontSize(size);
|
||||
tpane.setCharSpace(1.0f);
|
||||
tpane.setLineSpace(23.0f);
|
||||
tpane.setCharColor(tcharcolor);
|
||||
tpane.setGradColor(tgradcolor);
|
||||
tpane.setBlackWhite(tblack, twhite);
|
||||
|
||||
spane.setFontSize(size);
|
||||
spane.setCharSpace(1.0f);
|
||||
spane.setLineSpace(23.0f);
|
||||
spane.setCharColor(scharcolor);
|
||||
spane.setGradColor(sgradcolor);
|
||||
spane.setBlackWhite(sblack, swhite);
|
||||
|
||||
const int lineMax = 10;
|
||||
|
||||
f32 height = 23.0f;
|
||||
f32 maxWidth = 0.0f;
|
||||
int cnt = 0;
|
||||
f32 lineWidth[lineMax];
|
||||
for (int i = 0; i < lineMax; i++) {
|
||||
lineWidth[i] = 0.0f;
|
||||
}
|
||||
|
||||
for (; *msg_p != '\0'; msg_p++) {
|
||||
if (*msg_p == '\n') {
|
||||
height += 23.0f;
|
||||
cnt++;
|
||||
JUT_ASSERT(cnt < lineMax);
|
||||
continue;
|
||||
}
|
||||
|
||||
int c = (u8)*msg_p;
|
||||
if (pfont->isLeadByte_EUC(c)) {
|
||||
msg_p++;
|
||||
c = (c << 8) | (u8)*msg_p;
|
||||
}
|
||||
|
||||
lineWidth[cnt] += 1.0f + size.mSizeX * ((f32)pfont->getWidth(c) / (f32)pfont->getCellWidth());
|
||||
}
|
||||
|
||||
for (int i = 0; i < lineMax; i++) {
|
||||
f32 width = lineWidth[i];
|
||||
if (maxWidth < width)
|
||||
maxWidth = width;
|
||||
}
|
||||
|
||||
f32 temp_0 = 0.0f; // fixes load order
|
||||
f32 x = temp_0 + ((608.0f - maxWidth) / 2);
|
||||
f32 y = temp_0 + ((448.0f - height) / 2);
|
||||
|
||||
if (i_drawBg) {
|
||||
ppane.mAlpha = 0x82;
|
||||
ppane.draw(0.0f, 0.0f, 608.0f, 448.0f, false, false, false);
|
||||
}
|
||||
|
||||
spane.draw(x + 2.0f, y + 10.0f + 2.0f, 608.0f, HBIND_LEFT);
|
||||
tpane.draw(x, y + 10.0f, 608.0f, HBIND_LEFT);
|
||||
}
|
||||
|
||||
/* 8009D194-8009D354 097AD4 01C0+00 1/1 0/0 0/0 .text draw__14dDvdErrorMsg_cFl */
|
||||
void dDvdErrorMsg_c::draw(s32 param_0) {
|
||||
// NONMATCHING
|
||||
}
|
||||
void dDvdErrorMsg_c::draw(s32 status) {
|
||||
JUtility::TColor backColor = g_clearColor;
|
||||
JFWDisplay::getManager()->setClearColor(backColor);
|
||||
mDoGph_gInf_c::beginRender();
|
||||
GXSetAlphaUpdate(GX_FALSE);
|
||||
j3dSys.drawInit();
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 8038D640-8038D640 019CA0 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */
|
||||
#pragma push
|
||||
#pragma force_active on
|
||||
SECTION_DEAD static char const* const stringBase_8038D640 = "DVD Error !! <%d>\n";
|
||||
/* @stringBase0 padding */
|
||||
SECTION_DEAD static char const* const pad_8038D653 = "\0\0\0\0";
|
||||
#pragma pop
|
||||
J2DOrthoGraph draw2D(0.0f, 0.0f, 608.0f, 448.0f, -1.0f, 1.0f);
|
||||
draw2D.setOrtho(0.0f, 0.0f, 608.0f, 448.0f, -1.0f, 1.0f);
|
||||
draw2D.setPort();
|
||||
dComIfGp_setCurrentGrafPort(&draw2D);
|
||||
|
||||
if (status == DVD_STATE_NO_DISK) {
|
||||
messageSet(MSG_NO_DISK, true);
|
||||
} else if (status == DVD_STATE_COVER_OPEN) {
|
||||
messageSet(MSG_COVER_OPEN, true);
|
||||
} else if (status == DVD_STATE_FATAL_ERROR) {
|
||||
messageSet(MSG_FATAL_ERROR, true);
|
||||
} else if (status == DVD_STATE_WRONG_DISK) {
|
||||
messageSet(MSG_WRONG_DISK, true);
|
||||
} else if (status == DVD_STATE_RETRY) {
|
||||
messageSet(MSG_READ_ERROR, true);
|
||||
} else if (status == DVD_STATE_BUSY) {
|
||||
messageSet(MSG_READING_DISC, true);
|
||||
}
|
||||
|
||||
mDoGph_gInf_c::endRender();
|
||||
JFWDisplay::getManager()->resetFader();
|
||||
}
|
||||
|
||||
/* 8009D354-8009D410 097C94 00BC+00 0/0 1/1 0/0 .text execute__14dDvdErrorMsg_cFv */
|
||||
u8 dDvdErrorMsg_c::execute() {
|
||||
// NONMATCHING
|
||||
static u8 l_dvdError;
|
||||
|
||||
s32 drive_status = DVDGetDriveStatus();
|
||||
if (drive_status != DVD_STATE_END && drive_status != DVD_STATE_BUSY && !l_dvdError) {
|
||||
l_dvdError = true;
|
||||
}
|
||||
|
||||
if (l_dvdError) {
|
||||
OSReport_Error("DVD Error !! <%d>\n", drive_status);
|
||||
|
||||
if (drive_status == DVD_STATE_END) {
|
||||
l_dvdError = false;
|
||||
} else if (mDoRst::isReset() &&
|
||||
(drive_status == DVD_STATE_NO_DISK || drive_status == DVD_STATE_COVER_OPEN || drive_status == DVD_STATE_WRONG_DISK || drive_status == DVD_STATE_RETRY))
|
||||
{
|
||||
mDoRst::onReturnToMenu();
|
||||
} else {
|
||||
draw(drive_status);
|
||||
}
|
||||
}
|
||||
|
||||
return l_dvdError;
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 80456B78-80456B80 000018 0004+04 1/1 0/0 0/0 .sbss2 @3873 */
|
||||
SECTION_SBSS2 static u8 lit_3873[4 + 4 /* padding */];
|
||||
static u8 l_captureAlpha = 0xFF;
|
||||
|
||||
/* 8009D410-8009D790 097D50 0380+00 1/1 0/0 0/0 .text drawCapture__FUc */
|
||||
static void drawCapture(u8 param_0) {
|
||||
// NONMATCHING
|
||||
// NONMATCHING - stack too small
|
||||
static void drawCapture(u8 alpha) {
|
||||
static bool l_texCopied = false;
|
||||
|
||||
if (!l_texCopied) {
|
||||
GXSetTexCopySrc(0, 0, 608, 448);
|
||||
GXSetTexCopyDst(304, 224, (GXTexFmt)mDoGph_gInf_c::getFrameBufferTimg()->format, GX_TRUE);
|
||||
GXCopyTex(mDoGph_gInf_c::getFrameBufferTex(), GX_FALSE);
|
||||
l_texCopied = true;
|
||||
}
|
||||
|
||||
JFWDisplay::getManager()->setClearColor(g_clearColor);
|
||||
mDoGph_gInf_c::beginRender();
|
||||
GXSetAlphaUpdate(GX_FALSE);
|
||||
j3dSys.drawInit();
|
||||
|
||||
GXInitTexObj(mDoGph_gInf_c::getFrameBufferTexObj(), mDoGph_gInf_c::getFrameBufferTex(), 304, 224, (GXTexFmt)mDoGph_gInf_c::getFrameBufferTimg()->format, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
GXInitTexObjLOD(mDoGph_gInf_c::getFrameBufferTexObj(), GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE, GX_ANISO_1);
|
||||
GXLoadTexObj(mDoGph_gInf_c::getFrameBufferTexObj(), GX_TEXMAP0);
|
||||
GXSetNumChans(0);
|
||||
GXSetNumIndStages(0);
|
||||
GXSetNumTexGens(1);
|
||||
GXSetTexCoordGen2(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, 60, GX_FALSE, GX_PTIDENTITY);
|
||||
GXSetNumTevStages(1);
|
||||
|
||||
GXColor color = {0, 0, 0, alpha};
|
||||
GXSetTevColor(GX_TEVREG0, color);
|
||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL);
|
||||
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_TEXC, GX_CC_A0, GX_CC_ZERO);
|
||||
GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
|
||||
GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
|
||||
GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
|
||||
GXSetZCompLoc(GX_TRUE);
|
||||
GXSetZMode(GX_DISABLE, GX_ALWAYS, GX_DISABLE);
|
||||
GXSetBlendMode(GX_BM_NONE, GX_BL_SRC_ALPHA, GX_BL_ONE, GX_LO_CLEAR);
|
||||
GXSetAlphaCompare(GX_ALWAYS, 0, GX_AOP_OR, GX_ALWAYS, 0);
|
||||
GXSetFog(GX_FOG_NONE, 0.0f, 0.0f, 0.0f, 0.0f, g_clearColor);
|
||||
GXSetFogRangeAdj(GX_DISABLE, 0, NULL);
|
||||
GXSetCullMode(GX_CULL_NONE);
|
||||
GXSetDither(GX_ENABLE);
|
||||
|
||||
Mtx m;
|
||||
C_MTXOrtho(m, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 10.0f);
|
||||
GXLoadPosMtxImm(g_mDoMtx_identity, GX_PNMTX0);
|
||||
GXSetProjection(m, GX_ORTHOGRAPHIC);
|
||||
GXSetCurrentMtx(0);
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGB, GX_RGB8, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGB8, 0);
|
||||
|
||||
mDoGph_drawFilterQuad(1, 1);
|
||||
mDoGph_gInf_c::endRender();
|
||||
JFWDisplay::getManager()->resetFader();
|
||||
}
|
||||
|
||||
/* 8009D790-8009D87C 0980D0 00EC+00 0/0 1/1 0/0 .text execute__19dShutdownErrorMsg_cFv */
|
||||
bool dShutdownErrorMsg_c::execute() {
|
||||
// NONMATCHING
|
||||
}
|
||||
if (!mDoRst::isShutdown() && !mDoRst::isReturnToMenu()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* 8038D640-8038D640 019CA0 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */
|
||||
if (l_captureAlpha == 0xFF) {
|
||||
if (Z2AudioMgr::getInterface()->isResetting() && !mDoAud_resetRecover()) {
|
||||
drawCapture(l_captureAlpha);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mDoAud_zelAudio_c::isInitFlag()) {
|
||||
Z2AudioMgr::getInterface()->resetProcess(0x10, true);
|
||||
}
|
||||
}
|
||||
|
||||
drawCapture(l_captureAlpha);
|
||||
|
||||
if (cLib_chaseUC(&l_captureAlpha, 0, 15) != 0) {
|
||||
if (mDoRst::isReturnToMenu()) {
|
||||
mDoRst_reset(1, 0x80000000, 0);
|
||||
} else {
|
||||
mDoRst_reset(1, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user