almost all of dolphin matched (#2036)

* TRK full match

* remove trk asm

* ar done

* cleanup some dolphin headers

* more dolphin cleanup

* cleanup / GD fully matched

* almost all of GX fully matched

* GX / Mtx full matched

* most of OS done

* pad done

* most of VI

* remove asm

* forgot couple vec funcs

* couple JUtility matches
This commit is contained in:
TakaRikka
2024-01-19 16:22:19 -08:00
committed by GitHub
parent f97fc769df
commit 981cfe7283
461 changed files with 11574 additions and 22635 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
#include "JSystem/J3DGraphBase/J3DTexture.h"
#include "JSystem/JUtility/JUTPalette.h"
#include "JSystem/JUtility/JUTResource.h"
#include "dolphin/os/OS.h"
#include "dolphin/os.h"
f32 J2DGetKeyFrameInterpolationf(f32 param_0, J3DAnmKeyTableBase* param_1, f32* param_2);
f32 J2DGetKeyFrameInterpolations(f32 param_0, J3DAnmKeyTableBase* param_1, s16* param_2);
+4 -4
View File
@@ -1,5 +1,5 @@
#include "JSystem/J2DGraph/J2DGrafContext.h"
#include "dolphin/gx/GX.h"
#include "dolphin/gx.h"
/* 802E8B08-802E8BB4 2E3448 00AC+00 0/0 2/2 0/0 .text __ct__14J2DGrafContextFffff */
J2DGrafContext::J2DGrafContext(f32 x, f32 y, f32 width, f32 height)
@@ -159,7 +159,7 @@ void J2DGrafContext::fillBox(JGeometry::TBox2<f32> const& box) {
GXColor1u32(mColorBL);
GXPosition3f32(box.i.x, box.f.y, 0);
GXColor1u32(mColorBR);
i_GXEnd();
GXEnd();
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0);
}
@@ -181,7 +181,7 @@ void J2DGrafContext::drawFrame(JGeometry::TBox2<f32> const& box) {
GXColor1u32(mColorBR);
GXPosition3f32(box.i.x, box.i.y, 0);
GXColor1u32(mColorTL);
i_GXEnd();
GXEnd();
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0);
}
@@ -197,7 +197,7 @@ void J2DGrafContext::line(JGeometry::TVec2<f32> start, JGeometry::TVec2<f32> end
GXColor1u32(mColorTL);
GXPosition3f32(end.x, end.y, 0);
GXColor1u32(mColorBR);
i_GXEnd();
GXEnd();
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0);
}
+1 -1
View File
@@ -8,7 +8,7 @@
#include "JSystem/JUtility/JUTResFont.h"
#include "JSystem/JUtility/JUTTexture.h"
#include "dol2asm.h"
#include "dolphin/gx/GX.h"
#include "dolphin/gx.h"
//
// Forward References:
+1 -1
View File
@@ -1,5 +1,5 @@
#include "JSystem/J2DGraph/J2DOrthoGraph.h"
#include "dolphin/gx/GX.h"
#include "dolphin/gx.h"
/* 802E9670-802E96D0 2E3FB0 0060+00 3/3 1/1 0/0 .text __ct__13J2DOrthoGraphFv */
J2DOrthoGraph::J2DOrthoGraph() : J2DGrafContext(0, 0, 0, 0) {
+1 -1
View File
@@ -4,7 +4,7 @@
#include "JSystem/J2DGraph/J2DScreen.h"
#include "JSystem/JSupport/JSURandomInputStream.h"
#include "JSystem/JUtility/JUTResource.h"
#include "dolphin/gx/GX.h"
#include "dolphin/gx.h"
/* 802F5BF8-802F5CB8 2F0538 00C0+00 0/0 10/10 0/0 .text __ct__7J2DPaneFv */
J2DPane::J2DPane() : mBounds(), mGlobalBounds(), mClipRect(), mPaneTree(this) {
+2 -2
View File
@@ -7,7 +7,7 @@
#include "JSystem/J2DGraph/J2DScreen.h"
#include "JSystem/JUtility/JUTTexture.h"
#include "dol2asm.h"
#include "dolphin/gx/GX.h"
#include "dolphin/gx.h"
//
// Forward References:
@@ -759,7 +759,7 @@ void J2DPicture::drawTexCoord(f32 param_0, f32 param_1, f32 param_2, f32 param_3
GXColor1u32(black[2]);
GXTexCoord2s16(param_8,param_9);
i_GXEnd();
GXEnd();
GXSetVtxAttrFmt(GX_VTXFMT0,GX_VA_TEX0,GX_CLR_RGBA,GX_RGBX8,0xf);
GXSetVtxAttrFmt(GX_VTXFMT0,GX_VA_POS,GX_CLR_RGBA,GX_RGBA4,0);
+1 -1
View File
@@ -440,7 +440,7 @@ void J2DPictureEx::drawTexCoord(f32 param_0, f32 param_1, f32 param_2, f32 param
GXPosition3f32(param_0, dVar11, 0.0f);
GXColor1u32(TStack_94);
GXTexCoord2s16(param_8, param_9);
i_GXEnd();
GXEnd();
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBX8, 0xf);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0);
}
+1 -1
View File
@@ -558,7 +558,7 @@ void J2DScreen::drawSelf(f32 param_0, f32 param_1, Mtx* param_2) {
GXColor1u32(color);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0);
i_GXEnd();
GXEnd();
}
}
#else
+1 -1
View File
@@ -6,7 +6,7 @@
#include "JSystem/J2DGraph/J2DMatBlock.h"
#include "JSystem/JUtility/TColor.h"
#include "math.h"
#include "dolphin/gx/GX.h"
#include "dolphin/gx.h"
/* 802E9C90-802E9CC4 2E45D0 0034+00 0/0 1/1 0/0 .text load__9J2DTexMtxFUl */
void J2DTexMtx::load(u32 mtxIdx) {
+7 -7
View File
@@ -462,7 +462,7 @@ void J2DWindow::drawContents(JGeometry::TBox2<f32> const& param_0) {
GXColor1u32(color4);
GXPosition3f32(param_0.i.x, param_0.f.y, 0.0f);
GXColor1u32(color2);
i_GXEnd();
GXEnd();
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0);
} else {
GXClearVtxDesc();
@@ -491,17 +491,17 @@ void J2DWindow::drawFrameTexture(JUTTexture* param_0, f32 param_1, f32 param_2,
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
GXPosition3f32(param_1, param_2, 0.0f);
GXColor1u32(stack_64);
i_GXTexCoord2u16(param_7, param_8);
GXTexCoord2u16(param_7, param_8);
GXPosition3f32(f31, param_2, 0.0f);
GXColor1u32(stack_64);
i_GXTexCoord2u16(param_5, param_8);
GXTexCoord2u16(param_5, param_8);
GXPosition3f32(f31, f30, 0.0f);
GXColor1u32(stack_64);
i_GXTexCoord2u16(param_5, param_6);
GXTexCoord2u16(param_5, param_6);
GXPosition3f32(param_1, f30, 0.0f);
GXColor1u32(stack_64);
i_GXTexCoord2u16(param_7, param_6);
i_GXEnd();
GXTexCoord2u16(param_7, param_6);
GXEnd();
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0);
}
@@ -552,7 +552,7 @@ void J2DWindow::drawContentsTexture(f32 param_0, f32 param_1, f32 param_2, f32 p
GXPosition3f32(param_0, f28, 0.0f);
GXColor1u32(stack_f0.field_0x8);
GXTexCoord2f32(f27, f24);
i_GXEnd();
GXEnd();
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBX8, 0xf);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0);
}
+1 -1
View File
@@ -7,7 +7,7 @@
#include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h"
#include "JSystem/J3DGraphBase/J3DMaterial.h"
#include "dol2asm.h"
#include "dolphin/os/OS.h"
#include "dolphin/os.h"
#include "dolphin/types.h"
//
@@ -7,7 +7,7 @@
#include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h"
#include "JSystem/J3DGraphBase/J3DMaterial.h"
#include "dol2asm.h"
#include "dolphin/os/OS.h"
#include "dolphin/os.h"
//
// Forward References:
@@ -6,7 +6,7 @@
#include "JSystem/J3DGraphAnimator/J3DSkinDeform.h"
#include "JSystem/J3DGraphAnimator/J3DModel.h"
#include "dol2asm.h"
#include "dolphin/os/OS.h"
#include "dolphin/os.h"
#include "string.h"
//
+1 -1
View File
@@ -5,7 +5,7 @@
#include "JSystem/J3DGraphBase/J3DGD.h"
#include "dol2asm.h"
#include "dolphin/os/OS.h"
#include "dolphin/os.h"
//
// Forward References:
+1 -1
View File
@@ -5,7 +5,7 @@
#include "JSystem/J3DGraphBase/J3DMatBlock.h"
#include "dol2asm.h"
#include "dolphin/os/OS.h"
#include "dolphin/os.h"
//
// Types:
+4 -4
View File
@@ -7,7 +7,7 @@
#include "JSystem/J3DGraphBase/J3DPacket.h"
#include "JSystem/J3DGraphBase/J3DVertex.h"
#include "dolphin/gd/GDGeometry.h"
#include "dolphin/os/OS.h"
#include "dolphin/os.h"
#include "dolphin/types.h"
//
@@ -136,9 +136,9 @@ u32 J3DShape::countBumpMtxNum() const {
/* 80314E98-80314EB0 30F7D8 0018+00 1/1 0/0 0/0 .text J3DLoadCPCmd__FUcUl */
void J3DLoadCPCmd(u8 cmd, u32 param) {
GFX_FIFO(u8) = GX_CMD_LOAD_CP_REG;
GFX_FIFO(u8) = cmd;
GFX_FIFO(u32) = param;
GXWGFifo.u8 = GX_CMD_LOAD_CP_REG;
GXWGFifo.u8 = cmd;
GXWGFifo.u32 = param;
}
/* 80314EB0-80314EEC 30F7F0 003C+00 1/1 0/0 0/0 .text J3DLoadArrayBasePtr__F7_GXAttrPv */
+1 -1
View File
@@ -5,7 +5,7 @@
#include "JSystem/J3DGraphBase/J3DShapeDraw.h"
#include "string.h"
#include "dolphin/gx/GX.h"
#include "dolphin/gx.h"
#include "dolphin/os/OSCache.h"
#include "dolphin/types.h"
#include "global.h"
+2 -2
View File
@@ -7,7 +7,7 @@
#include "dol2asm.h"
#include "dolphin/gx/GXPixel.h"
#include "dolphin/os/OS.h"
#include "dolphin/os.h"
#include "dolphin/types.h"
#include "global.h"
@@ -244,7 +244,7 @@ void J3DSys::drawInit() {
GXSetTevIndirect((GXTevStageID)i, GX_INDTEXSTAGE0, GX_ITF_8, GX_ITB_NONE, GX_ITM_OFF,
GX_ITW_OFF, GX_ITW_OFF, GX_FALSE, GX_FALSE, GX_ITBA_OFF);
i_OSInitFastCast();
OSInitFastCast();
setTexCacheRegion(GX_TEXCACHE_32K);
}
+1 -1
View File
@@ -4,7 +4,7 @@
//
#include "JSystem/J3DGraphBase/J3DTexture.h"
#include "dolphin/gx/GX.h"
#include "dolphin/gx.h"
#include "dolphin/types.h"
/* 8031204C-803121A4 30C98C 0158+00 0/0 1/1 0/0 .text loadGX__10J3DTextureCFUs11_GXTexMapID */
@@ -5,7 +5,7 @@
#include "JSystem/J3DGraphLoader/J3DClusterLoader.h"
#include "dol2asm.h"
#include "dolphin/os/OS.h"
#include "dolphin/os.h"
//
// Types:
@@ -15,7 +15,7 @@
#include "JSystem/JUtility/JUTNameTab.h"
#include "JSystem/JKernel/JKRHeap.h"
#include "JSystem/JSupport/JSupport.h"
#include "dolphin/os/OS.h"
#include "dolphin/os.h"
#include "dol2asm.h"
//
@@ -7,7 +7,7 @@
#include "JSystem/J3DGraphBase/J3DShape.h"
#include "JSystem/JKernel/JKRHeap.h"
#include "JSystem/JSupport/JSupport.h"
#include "dolphin/os/OS.h"
#include "dolphin/os.h"
#include "global.h"
//
+1 -1
View File
@@ -14,7 +14,7 @@
#include "JSystem/JAudio2/JASReport.h"
#include "JSystem/JKernel/JKRSolidHeap.h"
#include "dol2asm.h"
#include "dolphin/ai/ai.h"
#include "dolphin/ai.h"
#include "dolphin/os/OSCache.h"
#include "dolphin/os/OSTime.h"
+3 -3
View File
@@ -8,8 +8,8 @@
#include "JSystem/JAudio2/JASHeapCtrl.h"
#include "JSystem/JKernel/JKRSolidHeap.h"
#include "dol2asm.h"
#include "dolphin/os/OS.h"
#include "dolphin/dsp/dsp.h"
#include "dolphin/os.h"
#include "dolphin/dsp.h"
//
// Types:
@@ -143,7 +143,7 @@ class JASChannel {
// Maybe location of JASPoolAllocObject_MultiThreaded<JASChannel>
#ifdef NONMATCHING
void* JASAudioThread::run() {
i_OSInitFastCast();
OSInitFastCast();
JASDriver::initAI(DMACallback);
JASDsp::boot(DSPCallback);
JASDsp::initBuffer();
+1 -1
View File
@@ -3,7 +3,7 @@
//
#include "JSystem/JAudio2/JASCmdStack.h"
#include "dolphin/os/OS.h"
#include "dolphin/os.h"
/* 80431684-80431690 05E3A4 000C+00 1/2 0/0 0/0 .bss sCommandListOnce__10JASPortCmd */
JASPortCmd::TPortHead JASPortCmd::sCommandListOnce;
+1 -1
View File
@@ -11,7 +11,7 @@
#include "JSystem/JAudio2/osdsp_task.h"
#include "JSystem/JAudio2/JASCriticalSection.h"
#include "JSystem/JKernel/JKRSolidHeap.h"
#include "dolphin/dsp/dsp.h"
#include "dolphin/dsp.h"
#include "dolphin/os/OSCache.h"
//
+1 -1
View File
@@ -4,7 +4,7 @@
//
#include "JSystem/JAudio2/JASProbe.h"
#include "dolphin/os/OS.h"
#include "dolphin/os.h"
//
// Types:
+2 -2
View File
@@ -9,7 +9,7 @@
#include "JSystem/JKernel/JKRSolidHeap.h"
#include "dol2asm.h"
#include "dolphin/os/OSInterrupt.h"
#include "dolphin/os/OS.h"
#include "dolphin/os.h"
//
// Forward References:
@@ -156,7 +156,7 @@ int JASTaskThread::sendCmdMsg(void (*param_0)(void*), void* param_1) {
// Regalloc
#ifdef NONMATCHING
void JASTaskThread::run() {
i_OSInitFastCast();
OSInitFastCast();
do {
JASThreadCallStack* ppcVar1 = (JASThreadCallStack*)waitMessageBlock();
if (field_0x84) {
+1 -1
View File
@@ -9,7 +9,7 @@
#include "JSystem/JAudio2/JASMutex.h"
#include "JSystem/JKernel/JKRDvdAramRipper.h"
#include "string.h"
#include "dolphin/dvd/dvd.h"
#include "dolphin/dvd.h"
#include "global.h"
//
+1 -1
View File
@@ -19,7 +19,7 @@
#include "JSystem/JKernel/JKRSolidHeap.h"
#include "stdlib.h"
#include "dol2asm.h"
#include "dolphin/dvd/dvd.h"
#include "dolphin/dvd.h"
//
// Types:
+1 -1
View File
@@ -1,5 +1,5 @@
#include "JSystem/JAudio2/JAUStreamFileTable.h"
#include "dolphin/dvd/dvd.h"
#include "dolphin/dvd.h"
#include "global.h"
/* 802A7420-802A742C 2A1D60 000C+00 0/0 1/1 0/0 .text __ct__18JAUStreamFileTableFv */
+2 -2
View File
@@ -6,8 +6,8 @@
#include "JSystem/JAudio2/dsptask.h"
#include "JSystem/JAudio2/osdsp.h"
#include "dol2asm.h"
#include "dolphin/dsp/dsp.h"
#include "dolphin/os/OS.h"
#include "dolphin/dsp.h"
#include "dolphin/os.h"
//
// Types:
+1 -1
View File
@@ -5,7 +5,7 @@
#include "JSystem/JAudio2/osdsp.h"
#include "JSystem/JAudio2/osdsp_task.h"
#include "dolphin/os/OS.h"
#include "dolphin/os.h"
#include "dolphin/dsp/dsp_task.h"
//
+1 -1
View File
@@ -36,7 +36,7 @@ static u8 struct_8045130b;
DSPTaskInfo* DSP_prior_task;
/* 8029EB20-8029EE24 299460 0304+00 0/0 1/1 0/0 .text __DSPHandler */
void __DSPHandler(OSInterrupt interrupt, OSContext* context) {
void __DSPHandler(__OSInterrupt interrupt, OSContext* context) {
OSContext funcContext;
__DSPRegs[5] = ((u16)(__DSPRegs[5]) & ~0x28) | 0x80;
OSClearContext(&funcContext);
+4 -4
View File
@@ -10,8 +10,8 @@
#include "JSystem/JUtility/JUTDbPrint.h"
#include "JSystem/JUtility/JUTProcBar.h"
#include "dol2asm.h"
#include "dolphin/gx/GX.h"
#include "dolphin/os/OS.h"
#include "dolphin/gx.h"
#include "dolphin/os.h"
#include "dolphin/types.h"
//
@@ -585,8 +585,8 @@ static void JFWDrawDoneAlarm() {
static void JFWGXAbortAlarmHandler(OSAlarm* param_0, OSContext* param_1) {
diagnoseGpHang();
GXAbortFrame();
GFX_FIFO(u8) = 0x61;
GFX_FIFO(u32) = 0x5800000F;
GXWGFifo.u8 = 0x61;
GXWGFifo.u32 = 0x5800000F;
GXFifoObj* fifo = GXGetCPUFifo();
if (fifo != NULL) {
-1
View File
@@ -61,7 +61,6 @@ extern "C" void createManager__17JUTConsoleManagerFP7JKRHeap();
extern "C" void OSInit();
extern "C" void DVDInit();
extern "C" extern u8 const JUTResFONT_Ascfont_fix12[16736];
extern "C" extern u8 GXNtsc480IntDf[60];
//
// Declarations:
+1 -1
View File
@@ -10,7 +10,7 @@
#include "JSystem/JKernel/JKRExpHeap.h"
#include "JSystem/JUtility/JUTException.h"
#include "string.h"
#include "dolphin/ar/ar.h"
#include "dolphin/ar.h"
#include "dolphin/os/OSCache.h"
#include "dolphin/os/OSInterrupt.h"
#include "global.h"
+1 -1
View File
@@ -7,7 +7,7 @@
#include "JSystem/JKernel/JKRAram.h"
#include "JSystem/JKernel/JKRDecomp.h"
#include "JSystem/JUtility/JUTException.h"
#include "dolphin/os/OS.h"
#include "dolphin/os.h"
/* 802D3574-802D35F4 2CDEB4 0080+00 1/1 0/0 0/0 .text
* prepareCommand__12JKRAramPieceFiUlUlUlP12JKRAramBlockPFUl_v */
+1 -1
View File
@@ -12,7 +12,7 @@
#include "dol2asm.h"
#include "dolphin/os/OSCache.h"
#include "dolphin/os/OSInterrupt.h"
#include "dolphin/vi/vi.h"
#include "dolphin/vi.h"
#include "global.h"
//
+1 -1
View File
@@ -11,7 +11,7 @@
#include "JSystem/JUtility/JUTException.h"
#include "math.h"
#include "string.h"
#include "dolphin/os/OS.h"
#include "dolphin/os.h"
#include "global.h"
//
+1 -1
View File
@@ -12,7 +12,7 @@
#include "dol2asm.h"
#include "dolphin/os/OSCache.h"
#include "dolphin/os/OSInterrupt.h"
#include "dolphin/vi/vi.h"
#include "dolphin/vi.h"
//
// Forward References:
+1 -1
View File
@@ -4,7 +4,7 @@
//
#include "JSystem/JKernel/JKRFile.h"
#include "dolphin/vi/vi.h"
#include "dolphin/vi.h"
/* 802D9518-802D9584 2D3E58 006C+00 0/0 2/2 0/0 .text read__7JKRFileFPvll */
s32 JKRFile::read(void* data, s32 size, s32 offset) {
+1 -1
View File
@@ -6,7 +6,7 @@
#include "JSystem/JKernel/JKRHeap.h"
#include "JSystem/JUtility/JUTAssert.h"
#include "JSystem/JUtility/JUTException.h"
#include "dolphin/os/OS.h"
#include "dolphin/os.h"
//
// Declarations:
+5 -5
View File
@@ -8,9 +8,9 @@
#include "JSystem/JParticle/JPAEmitter.h"
#include "JSystem/JParticle/JPAResourceManager.h"
#include "JSystem/JMath/JMATrigonometric.h"
#include "dolphin/mtx/mtxvec.h"
#include "dolphin/mtx.h"
#include "dol2asm.h"
#include "dolphin/gx/GX.h"
#include "dolphin/gx.h"
#include "dolphin/types.h"
//
@@ -1326,7 +1326,7 @@ void JPADrawPoint(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
GXBegin(GX_POINTS, GX_VTXFMT1, 1);
GXPosition3f32(ptcl->mPosition.x, ptcl->mPosition.y, ptcl->mPosition.z);
GXTexCoord2f32(0.0f, 0.0f);
i_GXEnd();
GXEnd();
GXSetVtxDesc(GX_VA_POS, GX_INDEX8);
GXSetVtxDesc(GX_VA_TEX0, GX_INDEX8);
}
@@ -1361,7 +1361,7 @@ void JPADrawLine(JPAEmitterWorkData* param_0, JPABaseParticle* param_1) {
GXTexCoord2f32(0.0f, 0.0f);
GXPosition3f32(local_28.x, local_28.y, local_28.z);
GXTexCoord2f32(0.0f, 1.0f);
i_GXEnd();
GXEnd();
GXSetVtxDesc(GX_VA_POS, GX_INDEX8);
GXSetVtxDesc(GX_VA_TEX0, GX_INDEX8);
}
@@ -1482,7 +1482,7 @@ void JPADrawStripe(JPAEmitterWorkData* param_0) {
GXTexCoord2f32(1.0f, dVar16);
}
i_GXEnd();
GXEnd();
GXSetVtxDesc(GX_VA_POS, GX_INDEX8);
GXSetVtxDesc(GX_VA_TEX0, GX_INDEX8);
}
+2 -2
View File
@@ -6,8 +6,8 @@
#include "JSystem/JParticle/JPAChildShape.h"
#include "JSystem/JParticle/JPAParticle.h"
#include "JSystem/JParticle/JPAEmitter.h"
#include "dolphin/gx/GX.h"
#include "dolphin/os/OS.h"
#include "dolphin/gx.h"
#include "dolphin/os.h"
#include "dolphin/types.h"
//
+1 -1
View File
@@ -8,7 +8,7 @@
#include "JSystem/JParticle/JPAParticle.h"
#include "JSystem/JParticle/JPAResourceManager.h"
#include "JSystem/JParticle/JPABaseShape.h"
#include "dolphin/mtx/mtxvec.h"
#include "dolphin/mtx.h"
#include "dolphin/types.h"
//
+1 -1
View File
@@ -6,7 +6,7 @@
#include "JSystem/JParticle/JPAEmitterManager.h"
#include "JSystem/JParticle/JPAEmitter.h"
#include "JSystem/JParticle/JPAResourceManager.h"
#include "dolphin/gx/GX.h"
#include "dolphin/gx.h"
#include "dolphin/types.h"
//
+1 -1
View File
@@ -6,7 +6,7 @@
#include "JSystem/JParticle/JPAExTexShape.h"
#include "JSystem/JParticle/JPAResourceManager.h"
#include "JSystem/JParticle/JPAEmitter.h"
#include "dolphin/gx/GX.h"
#include "dolphin/gx.h"
#include "dolphin/types.h"
/* 8027B040-8027B13C 275980 00FC+00 0/0 1/1 0/0 .text JPALoadExTex__FP18JPAEmitterWorkData */
+2 -2
View File
@@ -7,8 +7,8 @@
#include "JSystem/JMath/JMATrigonometric.h"
#include "JSystem/JParticle/JPAParticle.h"
#include "JSystem/JParticle/JPAEmitter.h"
#include "dolphin/gx/GX.h"
#include "dolphin/os/OS.h"
#include "dolphin/gx.h"
#include "dolphin/os.h"
#include "dolphin/types.h"
//
+1 -1
View File
@@ -6,7 +6,7 @@
#include "JSystem/JParticle/JPAParticle.h"
#include "JSystem/JParticle/JPAEmitter.h"
#include "JSystem/JParticle/JPAEmitterManager.h"
#include "dolphin/mtx/mtxvec.h"
#include "dolphin/mtx.h"
#include "dol2asm.h"
//
+2 -2
View File
@@ -7,8 +7,8 @@
#include "JSystem/JParticle/JPABaseShape.h"
#include "JSystem/JParticle/JPAEmitter.h"
#include "dol2asm.h"
#include "dolphin/gx/GX.h"
#include "dolphin/mtx/mtxvec.h"
#include "dolphin/gx.h"
#include "dolphin/mtx.h"
#include "dolphin/types.h"
//
+1 -1
View File
@@ -8,7 +8,7 @@
#include "JSystem/JUtility/JUTDbPrint.h"
#include "JSystem/JUtility/JUTDirectPrint.h"
#include "stdio.h"
#include "dolphin/vi/vi.h"
#include "dolphin/vi.h"
namespace JUTAssertion {
+1 -1
View File
@@ -8,7 +8,7 @@
#include "JSystem/JUtility/JUTAssert.h"
#include "JSystem/JUtility/JUTConsole.h"
#include "JSystem/JKernel/JKRAram.h"
#include "dolphin/gx/GX.h"
#include "dolphin/gx.h"
/* 802DD188-802DD208 2D7AC8 0080+00 0/0 1/1 0/0 .text __ct__12JUTCacheFontFPC7ResFONTUlP7JKRHeap
*/
+36 -50
View File
@@ -9,9 +9,9 @@
#include "JSystem/JUtility/JUTAssert.h"
#include "JSystem/JUtility/JUTDirectPrint.h"
#include "JSystem/JUtility/JUTVideo.h"
#include "stdio.h"
#include "dol2asm.h"
#include "dolphin/os/OS.h"
#include "dolphin/os.h"
#include "stdio.h"
//
// Forward References:
@@ -262,18 +262,15 @@ void JUTConsole::print_f(char const* fmt, ...) {
}
/* 802E7C38-802E7F30 2E2578 02F8+00 2/2 10/10 0/0 .text print__10JUTConsoleFPCc */
// signed/unsigned
#ifdef NONMATCHING
void JUTConsole::print(char const* param_0) {
void JUTConsole::print(char const* str) {
if (mOutput & 2) {
#ifdef DEBUG
OSReport("%s", param_0);
#endif
OS_REPORT("%s", str);
}
if (mOutput & 1) {
const u8* r29 = (const u8*)param_0;
const u8* r29 = (const u8*)str;
u8* r28 = getLinePtr(field_0x38) + field_0x3c;
while (*r29 != 0) {
while (*r29) {
if (field_0x6a && field_0x34 == nextIndex(field_0x38)) {
break;
}
@@ -303,6 +300,7 @@ void JUTConsole::print(char const* param_0) {
*(r28++) = *(r29++);
field_0x3c++;
}
if (field_0x3c < field_0x20) {
continue;
}
@@ -322,6 +320,7 @@ void JUTConsole::print(char const* param_0) {
if (field_0x38 == field_0x30) {
field_0x30 = nextIndex(field_0x30);
}
if (field_0x6b) {
break;
}
@@ -329,16 +328,6 @@ void JUTConsole::print(char const* param_0) {
*r28 = 0;
}
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void JUTConsole::print(char const* param_0) {
nofralloc
#include "asm/JSystem/JUtility/JUTConsole/print__10JUTConsoleFPCc.s"
}
#pragma pop
#endif
/* 802E7F30-802E7F7C 2E2870 004C+00 1/1 1/1 0/0 .text JUTConsole_print_f_va_ */
extern "C" void JUTConsole_print_f_va_(JUTConsole* console, const char* fmt, va_list args) {
@@ -347,22 +336,13 @@ extern "C" void JUTConsole_print_f_va_(JUTConsole* console, const char* fmt, va_
console->print(buf);
}
/* ############################################################################################## */
/* 8039D9A8-8039D9A8 02A008 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */
#pragma push
#pragma force_active on
SECTION_DEAD static char const* const stringBase_8039D9A8 = "[%03d] %s\n";
SECTION_DEAD static char const* const stringBase_8039D9B3 = "%s\n";
#pragma pop
/* 802E7F7C-802E80A8 2E28BC 012C+00 0/0 2/2 0/0 .text dumpToTerminal__10JUTConsoleFUi */
// signed/unsigned, instruction order
#ifdef NONMATCHING
void JUTConsole::dumpToTerminal(unsigned int param_0) {
if (param_0 == 0) {
return;
}
u32 r29 = field_0x34;
int r29 = field_0x34;
if (param_0 != -1) {
r29 = field_0x38;
for (int i = 0; i != param_0; i++) {
@@ -378,9 +358,8 @@ void JUTConsole::dumpToTerminal(unsigned int param_0) {
}
int r27 = 0;
#ifdef DEBUG
OSReport("\n:::dump of console[%x]--------------------------------\n",this);
#endif
OS_REPORT("\n:::dump of console[%x]--------------------------------\n", this);
do {
u8* r28 = getLinePtr(r29);
u8 r24 = r28[-1];
@@ -394,21 +373,10 @@ void JUTConsole::dumpToTerminal(unsigned int param_0) {
}
r29 = nextIndex(r29);
r27++;
} while (r27 != field_0x34);
#ifdef DEBUG
OSReport(":::dump of console[%x] END----------------------------\n",this);
#endif
} while (r29 != field_0x34);
OS_REPORT(":::dump of console[%x] END----------------------------\n", this);
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void JUTConsole::dumpToTerminal(unsigned int param_0) {
nofralloc
#include "asm/JSystem/JUtility/JUTConsole/dumpToTerminal__10JUTConsoleFUi.s"
}
#pragma pop
#endif
/* 802E80A8-802E8184 2E29E8 00DC+00 0/0 3/3 0/0 .text scroll__10JUTConsoleFi */
void JUTConsole::scroll(int scrollAmnt) {
@@ -436,7 +404,7 @@ void JUTConsole::scroll(int scrollAmnt) {
field_0x30 += mMaxLines;
}
if (field_0x30 >= mMaxLines) {
if (field_0x30 >= (u32)mMaxLines) {
field_0x30 -= mMaxLines;
}
}
@@ -502,6 +470,21 @@ asm void JUTConsoleManager::removeConsole(JUTConsole* param_0) {
#pragma pop
/* 802E8384-802E8450 2E2CC4 00CC+00 0/0 1/1 0/0 .text draw__17JUTConsoleManagerCFv */
#ifdef NONMATCHING
void JUTConsoleManager::draw() const {
JGadget::TLinkList<JUTConsole, 4>::const_iterator iter = mLinkList.begin();
JGadget::TLinkList<JUTConsole, 4>::const_iterator end = mLinkList.end();
for (; iter != end; ++iter) {
const JUTConsole* const console = &(*iter);
if (console != mActiveConsole)
console->doDraw(JUTConsole::CONSOLE_TYPE_1);
}
if (mActiveConsole != NULL)
mActiveConsole->doDraw(JUTConsole::CONSOLE_TYPE_0);
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
@@ -510,6 +493,7 @@ asm void JUTConsoleManager::draw() const {
#include "asm/JSystem/JUtility/JUTConsole/draw__17JUTConsoleManagerCFv.s"
}
#pragma pop
#endif
/* 802E8450-802E84C4 2E2D90 0074+00 0/0 5/5 0/0 .text drawDirect__17JUTConsoleManagerCFb
*/
@@ -615,7 +599,9 @@ void JUTWarningConsole_f_va(const char* fmt, va_list args) {
if (JUTGetWarningConsole() == NULL) {
vsnprintf(buf, sizeof(buf), fmt, args);
OSReport("%s", buf);
} else if (JUTGetWarningConsole()->getOutput() & (JUTConsole::OUTPUT_CONSOLE | JUTConsole::OUTPUT_OSREPORT)) {
} else if (JUTGetWarningConsole()->getOutput() &
(JUTConsole::OUTPUT_CONSOLE | JUTConsole::OUTPUT_OSREPORT))
{
vsnprintf(buf, sizeof(buf), fmt, args);
JUTGetWarningConsole()->print(buf);
}
+2 -2
View File
@@ -11,8 +11,8 @@
#include "stdlib.h"
#include "dol2asm.h"
#include "dolphin/base/PPCArch.h"
#include "dolphin/os/OS.h"
#include "dolphin/vi/vi.h"
#include "dolphin/os.h"
#include "dolphin/vi.h"
#include "global.h"
//
+9 -9
View File
@@ -4,9 +4,9 @@
//
#include "JSystem/JUtility/JUTGamePad.h"
#include "math.h"
#include "dol2asm.h"
#include "dolphin/os/OSResetSW.h"
#include "math.h"
//
// Forward References:
@@ -104,7 +104,7 @@ extern "C" void _restgpr_29();
/* ############################################################################################## */
/* 803CC5F0-803CC600 029710 0010+00 3/3 0/0 0/0 .data sChannelMask__Q210JUTGamePad7CRumble */
SECTION_DATA PADMask JUTGamePad::CRumble::sChannelMask[4] = {
SECTION_DATA u32 JUTGamePad::CRumble::sChannelMask[4] = {
PAD_CHAN0_BIT,
PAD_CHAN1_BIT,
PAD_CHAN2_BIT,
@@ -227,8 +227,8 @@ u32 JUTGamePad::read() {
sStickMode, WS_MAIN_STICK, mPadButton[i].mButton)
<< 0x18;
u32 s_stick = (mPadSStick[i].update(mPadStatus[i].substick_x, mPadStatus[i].substick_y,
sStickMode, WS_SUB_STICK, mPadButton[i].mButton)
<< 0x10);
sStickMode, WS_SUB_STICK, mPadButton[i].mButton)
<< 0x10);
m_stick |= s_stick;
mPadButton[i].update(&mPadStatus[i], m_stick);
} else if (mPadStatus[i].error == -1) {
@@ -275,7 +275,7 @@ u32 JUTGamePad::read() {
}
if (mask != 0) {
PADReset((PADMask)mask);
PADReset(mask);
}
checkResetSwitch();
@@ -310,7 +310,7 @@ void JUTGamePad::assign() {
bool JUTGamePad::CRumble::mStatus[4];
/* 804514E8-804514EC 0009E8 0004+00 5/5 0/0 0/0 .sbss mEnabled__Q210JUTGamePad7CRumble */
PADMask JUTGamePad::CRumble::mEnabled;
u32 JUTGamePad::CRumble::mEnabled;
/* 804514EC-804514F0 0009EC 0004+00 2/2 4/4 0/0 .sbss sCallback__Q210JUTGamePad13C3ButtonReset */
callbackFn JUTGamePad::C3ButtonReset::sCallback;
@@ -608,7 +608,7 @@ void JUTGamePad::CRumble::clear() {
field_0x8 = 0;
field_0xc = 0;
field_0x10 = 0;
mEnabled = (PADMask)(PAD_CHAN3_BIT | PAD_CHAN2_BIT | PAD_CHAN1_BIT | PAD_CHAN0_BIT);
mEnabled = (PAD_CHAN3_BIT | PAD_CHAN2_BIT | PAD_CHAN1_BIT | PAD_CHAN0_BIT);
}
/* 802E15D8-802E1634 2DBF18 005C+00 2/2 0/0 0/0 .text clear__Q210JUTGamePad7CRumbleFP10JUTGamePad
@@ -758,7 +758,7 @@ void JUTGamePad::CRumble::setEnabled(u32 mask) {
}
}
}
mEnabled = (PADMask)(mask & (PAD_CHAN3_BIT | PAD_CHAN2_BIT | PAD_CHAN1_BIT | PAD_CHAN0_BIT));
mEnabled = (mask & (PAD_CHAN3_BIT | PAD_CHAN2_BIT | PAD_CHAN1_BIT | PAD_CHAN0_BIT));
}
/* 802E1A7C-802E1A98 2DC3BC 001C+00 1/1 0/0 0/0 .text setRepeat__Q210JUTGamePad7CButtonFUlUlUl */
@@ -778,7 +778,7 @@ bool JUTGamePad::recalibrate(u32 mask) {
}
}
return PADRecalibrate((PADMask)mask);
return PADRecalibrate(mask);
}
/* 802E1AFC-802E1B60 2DC43C 0064+00 1/1 0/0 0/0 .text checkCallback__19JUTGamePadLongPressFiUl */
+2 -2
View File
@@ -1,6 +1,6 @@
#include "JSystem/JUtility/JUTPalette.h"
#include "dolphin/gx/GX.h"
#include "dolphin/os/OS.h"
#include "dolphin/gx.h"
#include "dolphin/os.h"
void JUTPalette::storeTLUT(_GXTlut param_0, ResTLUT* tlut) {
if (tlut == NULL) {
+145 -140
View File
@@ -1,18 +1,7 @@
//
// Generated By: dol2asm
// Translation Unit: JUTProcBar
//
#include "JSystem/JUtility/JUTProcBar.h"
#include "JSystem/J2DGraph/J2DOrthoGraph.h"
#include "JSystem/JKernel/JKRHeap.h"
#include "JSystem/JUtility/JUTVideo.h"
#include "dol2asm.h"
#include "global.h"
//
// Declarations:
//
/* 802E5888-802E599C 2E01C8 0114+00 1/1 0/0 0/0 .text __ct__10JUTProcBarFv */
JUTProcBar::JUTProcBar() {
@@ -102,8 +91,7 @@ void JUTProcBar::adjustMeterLength(u32 param_0, f32* param_1, f32 param_2, f32 p
BOOL var2 = false;
float var1 = *param_1;
while (var1 > param_2) {
if (param_0 * var1 * 20.0f / 16666.0f <=
mParams.mWidth - 30.0f)
if (param_0 * var1 * 20.0f / 16666.0f <= mParams.mWidth - 30.0f)
break;
var1 -= (1.0f / 10.0f);
@@ -119,8 +107,7 @@ void JUTProcBar::adjustMeterLength(u32 param_0, f32* param_1, f32 param_2, f32 p
(*param_4)++;
if (*param_4 < 0x1e)
break;
if ((param_0 * var1 * 20.0f / 16666.0f) <
(mParams.mWidth - 60.0f))
if ((param_0 * var1 * 20.0f / 16666.0f) < (mParams.mWidth - 60.0f))
var1 += (1.0f / 5.0f);
break;
}
@@ -136,116 +123,142 @@ void JUTProcBar::draw() {
/* 802E5E3C-802E6D3C 2E077C 0F00+00 1/1 0/0 0/0 .text drawProcessBar__10JUTProcBarFv */
void JUTProcBar::drawProcessBar() {
if (mVisible) {
int frameDuration = 16666; // duration in miliseconds? for how long a frame takes,
if (JUTVideo::getManager() && ((JUTVideo::getManager()->getRenderMode()->vi_tv_mode >> 2) & 0x0f) == 1) // possibly a define
frameDuration = 20000; // duration for PAL
int frameDuration = 16666; // duration in miliseconds? for how long a frame takes,
if (JUTVideo::getManager() && ((JUTVideo::getManager()->getRenderMode()->vi_tv_mode >> 2) &
0x0f) == 1) // possibly a define
frameDuration = 20000; // duration for PAL
static int cnt = 0;
adjustMeterLength(mWholeLoop.mCost, &oneFrameRate, 1.0f, 10.0f, &cnt);
int r28 = oneFrameRate * 20.0f;
int r27 = mParams.mBarWidth * 8;
int r26 = mParams.mBarWidth * 2;
int r25 = mParams.mBarWidth * 10;
int r24 = (mParams.mWidth - 4 + r28) / r28;
static int cnt = 0;
adjustMeterLength(mWholeLoop.mCost, &oneFrameRate, 1.0f, 10.0f, &cnt);
int r28 = oneFrameRate * 20.0f;
int r27 = mParams.mBarWidth * 8;
int r26 = mParams.mBarWidth * 2;
int r25 = mParams.mBarWidth * 10;
int r24 = (mParams.mWidth - 4 + r28) / r28;
mIdle.accumePeek();
mGp.accumePeek();
mCpu.accumePeek();
mIdle.accumePeek();
mGp.accumePeek();
mCpu.accumePeek();
u32 totalTime = (mGp.mCost - mGpWait.mCost) - mCpu.mCost; // unsure of types
u32 gpuTime = (mGp.mCost - mGpWait.mCost);
J2DFillBox(mParams.mPosX, mParams.mPosY, mParams.mWidth, r27, JUtility::TColor(0, 0, 50, 200));
J2DDrawFrame(mParams.mPosX, mParams.mPosY, mParams.mWidth, r27, JUtility::TColor(50, 50, 150, 255), 6);
if (mCostFrame > r24)
J2DFillBox(mParams.mPosX, mParams.mPosY + r27 + 1, mParams.mWidth, 1.0f, JUtility::TColor(250, 0, 0, 200));
else
J2DFillBox(mParams.mPosX, mParams.mPosY + r27 + 1, mCostFrame * r28 + 2, 1.0f, JUtility::TColor(0, 250, 250, 200));
u32 totalTime = (mGp.mCost - mGpWait.mCost) - mCpu.mCost; // unsure of types
u32 gpuTime = (mGp.mCost - mGpWait.mCost);
J2DFillBox(mParams.mPosX, mParams.mPosY, mParams.mWidth, r27,
JUtility::TColor(0, 0, 50, 200));
J2DDrawFrame(mParams.mPosX, mParams.mPosY, mParams.mWidth, r27,
JUtility::TColor(50, 50, 150, 255), 6);
if (mCostFrame > r24)
J2DFillBox(mParams.mPosX, mParams.mPosY + r27 + 1, mParams.mWidth, 1.0f,
JUtility::TColor(250, 0, 0, 200));
else
J2DFillBox(mParams.mPosX, mParams.mPosY + r27 + 1, mCostFrame * r28 + 2, 1.0f,
JUtility::TColor(0, 250, 250, 200));
int stack92 = mWholeLoop.mCost * r28 / frameDuration;
if (stack92 > mParams.mWidth)
J2DFillBox(mParams.mPosX, mParams.mPosY, mParams.mWidth, 1.0f, JUtility::TColor(255, 100, 0, 255));
else
J2DFillBox(mParams.mPosX, mParams.mPosY, stack92, 1.0f, JUtility::TColor(50, 255, 0, 255));
int stack92 = mWholeLoop.mCost * r28 / frameDuration;
if (stack92 > mParams.mWidth)
J2DFillBox(mParams.mPosX, mParams.mPosY, mParams.mWidth, 1.0f,
JUtility::TColor(255, 100, 0, 255));
else
J2DFillBox(mParams.mPosX, mParams.mPosY, stack92, 1.0f,
JUtility::TColor(50, 255, 0, 255));
if (field_0x110 == 0) {
int r23 = mParams.mPosY + mParams.mBarWidth;
bar_subroutine(mParams.mPosX + 1, r23, r26, r28, frameDuration, mGp.mCost, mGp.field_0x8, JUtility::TColor(80, 255, 80, 255),
JUtility::TColor(100, 255, 120, 255));
r23 += mParams.mBarWidth * 2;
bar_subroutine(mParams.mPosX + 1, r23, r26, r28, frameDuration, mCpu.mCost, mCpu.field_0x8, JUtility::TColor(255, 80, 80, 255),
JUtility::TColor(255, 100, 100, 255));
r23 += mParams.mBarWidth * 2;
bar_subroutine(mParams.mPosX + 1, r23, r26, r28, frameDuration, mIdle.mCost, mIdle.field_0x8, JUtility::TColor(180, 180, 160, 255),
JUtility::TColor(200, 200, 200, 255));
} else {
int r22 = mParams.mPosY + mParams.mBarWidth;
int r21 = mParams.mPosX + 1;
bar_subroutine(r21, r22, r26, r28, frameDuration, gpuTime, -1, JUtility::TColor(80, 255, 80, 255),
JUtility::TColor(80, 255, 80, 255));
int thingy1 = gpuTime * r28 / frameDuration + r21; // inline or define?
J2DFillBox(thingy1, r22, mGpWait.calcBarSize(r28, frameDuration), r26, JUtility::TColor(0, 255, 0, 255));
int r30 = mGp.calcBarSize(r28, frameDuration) + r21;
r21 += totalTime * r28 / frameDuration;
r22 += mParams.mBarWidth * 2;
bar_subroutine(r21, r22, r26, r28, frameDuration, mCpu.mCost, -1, JUtility::TColor(255, 80, 80, 255),
JUtility::TColor(255, 80, 80, 255));
r22 += mParams.mBarWidth * 2;
bar_subroutine(r30, r22, r26, r28, frameDuration, mIdle.mCost, -1, JUtility::TColor(180, 180, 160, 255),
JUtility::TColor(180, 180, 160, 255));
}
for (int i = 1; i < r24; i++) {
int temp2 = mParams.mPosX + i * r28 + 1;
J2DDrawLine(temp2, mParams.mPosY + mParams.mBarWidth, temp2, mParams.mPosY + r27 - mParams.mBarWidth,
(i % 5) != 0 ? JUtility::TColor(100, 100, 255, 255) : JUtility::TColor(180, 255, 255, 255), 12);
}
u32 temp3 = 0;
for (int i = 0; i < 8; i++) {
CTime* time = &mUsers[i];
if (++time->field_0xc >= 0x10 || time->mCost > time->field_0x8) {
time->field_0x8 = time->mCost;
time->field_0xc = 0;
}
if (time->field_0x8 > temp3)
temp3 = time->field_0x8;
}
if ((bool)temp3 == true) {
static int cntUser = 0;
adjustMeterLength(temp3, &oneFrameRateUser, 1.0f, 10.0f, &cntUser);
int r21 = oneFrameRateUser * 20.0f;
J2DFillBox(mParams.mPosX, mParams.mUserPosition, mParams.mWidth, r25, JUtility::TColor(0, 0, 50, 200));
J2DDrawFrame(mParams.mPosX, mParams.mUserPosition, mParams.mWidth, r25, JUtility::TColor(50, 50, 150, 255), 6);
for (int i = 0; i < 8; i++) {
CTime* time = &mUsers[i];
if (++time->field_0xc >= 0x10 || time->mCost > time->field_0x8) {
time->field_0x8 = time->mCost;
time->field_0xc = 0;
}
if (time->mCost != 0 || time->field_0x8 != 0) {
int temp4 = time->mCost * r21 / frameDuration;
int temp5 = time->field_0x8 * r21 / frameDuration;
time->mCost = 0;
J2DFillBox(mParams.mPosX + 1, mParams.mUserPosition + mParams.mBarWidth + i * mParams.mBarWidth, temp4,
mParams.mBarWidth, JUtility::TColor(time->mR, time->mG, time->mB, 255));
if (field_0x110 == 0) {
int r23 = mParams.mPosY + mParams.mBarWidth;
bar_subroutine(mParams.mPosX + 1, r23, r26, r28, frameDuration, mGp.mCost,
mGp.field_0x8, JUtility::TColor(80, 255, 80, 255),
JUtility::TColor(100, 255, 120, 255));
r23 += mParams.mBarWidth * 2;
bar_subroutine(mParams.mPosX + 1, r23, r26, r28, frameDuration, mCpu.mCost,
mCpu.field_0x8, JUtility::TColor(255, 80, 80, 255),
JUtility::TColor(255, 100, 100, 255));
r23 += mParams.mBarWidth * 2;
bar_subroutine(mParams.mPosX + 1, r23, r26, r28, frameDuration, mIdle.mCost,
mIdle.field_0x8, JUtility::TColor(180, 180, 160, 255),
JUtility::TColor(200, 200, 200, 255));
} else {
int r22 = mParams.mPosY + mParams.mBarWidth;
int r21 = mParams.mPosX + 1;
bar_subroutine(r21, r22, r26, r28, frameDuration, gpuTime, -1,
JUtility::TColor(80, 255, 80, 255), JUtility::TColor(80, 255, 80, 255));
int thingy1 = gpuTime * r28 / frameDuration + r21; // inline or define?
J2DFillBox(thingy1, r22, mGpWait.calcBarSize(r28, frameDuration), r26,
JUtility::TColor(0, 255, 0, 255));
int r30 = mGp.calcBarSize(r28, frameDuration) + r21;
r21 += totalTime * r28 / frameDuration;
r22 += mParams.mBarWidth * 2;
bar_subroutine(r21, r22, r26, r28, frameDuration, mCpu.mCost, -1,
JUtility::TColor(255, 80, 80, 255), JUtility::TColor(255, 80, 80, 255));
r22 += mParams.mBarWidth * 2;
bar_subroutine(r30, r22, r26, r28, frameDuration, mIdle.mCost, -1,
JUtility::TColor(180, 180, 160, 255),
JUtility::TColor(180, 180, 160, 255));
}
for (int i = 1; i < r24; i++) {
int temp2 = mParams.mPosX + i * r28 + 1;
J2DDrawLine(temp2, mParams.mPosY + mParams.mBarWidth, temp2,
mParams.mPosY + r27 - mParams.mBarWidth,
(i % 5) != 0 ? JUtility::TColor(100, 100, 255, 255) :
JUtility::TColor(180, 255, 255, 255),
12);
}
u32 temp3 = 0;
for (int i = 0; i < 8; i++) {
CTime* time = &mUsers[i];
if (++time->field_0xc >= 0x10 || time->mCost > time->field_0x8) {
time->field_0x8 = time->mCost;
time->field_0xc = 0;
}
if (time->field_0x8 > temp3)
temp3 = time->field_0x8;
}
if ((bool)temp3 == true) {
static int cntUser = 0;
adjustMeterLength(temp3, &oneFrameRateUser, 1.0f, 10.0f, &cntUser);
int r21 = oneFrameRateUser * 20.0f;
J2DFillBox(mParams.mPosX, mParams.mUserPosition, mParams.mWidth, r25,
JUtility::TColor(0, 0, 50, 200));
J2DDrawFrame(mParams.mPosX, mParams.mUserPosition, mParams.mWidth, r25,
JUtility::TColor(50, 50, 150, 255), 6);
for (int i = 0; i < 8; i++) {
CTime* time = &mUsers[i];
if (++time->field_0xc >= 0x10 || time->mCost > time->field_0x8) {
time->field_0x8 = time->mCost;
time->field_0xc = 0;
}
if (time->mCost != 0 || time->field_0x8 != 0) {
int temp4 = time->mCost * r21 / frameDuration;
int temp5 = time->field_0x8 * r21 / frameDuration;
time->mCost = 0;
J2DFillBox(mParams.mPosX + 1,
mParams.mUserPosition + mParams.mBarWidth + i * mParams.mBarWidth,
temp4, mParams.mBarWidth,
JUtility::TColor(time->mR, time->mG, time->mB, 255));
if (temp5 < 3u)
J2DFillBox(mParams.mPosX, mParams.mUserPosition + mParams.mBarWidth + i * mParams.mBarWidth, temp5,
mParams.mBarWidth, JUtility::TColor(255, 200, 50, 255));
else
J2DFillBox(mParams.mPosX + temp5 - 3, mParams.mUserPosition + mParams.mBarWidth + i * mParams.mBarWidth, 3.0f,
mParams.mBarWidth, JUtility::TColor(255, 200, 50, 255));
}
}
if (temp5 < 3u)
J2DFillBox(mParams.mPosX,
mParams.mUserPosition + mParams.mBarWidth +
i * mParams.mBarWidth,
temp5, mParams.mBarWidth, JUtility::TColor(255, 200, 50, 255));
else
J2DFillBox(mParams.mPosX + temp5 - 3,
mParams.mUserPosition + mParams.mBarWidth +
i * mParams.mBarWidth,
3.0f, mParams.mBarWidth, JUtility::TColor(255, 200, 50, 255));
}
}
int r22 = (mParams.mWidth - 4 + r21) / r21;
int r22 = (mParams.mWidth - 4 + r21) / r21;
for (int i = 1; i < r22; i++) {
int temp6 = mParams.mPosX + i * r21 + 1;
J2DDrawLine(temp6, mParams.mUserPosition + mParams.mBarWidth, temp6, mParams.mUserPosition + r25 - mParams.mBarWidth,
(i % 5) != 0 ? JUtility::TColor(100, 100, 255, 255) : JUtility::TColor(180, 255, 255, 255), 12);
}
}
field_0x108 = 0;
}
for (int i = 1; i < r22; i++) {
int temp6 = mParams.mPosX + i * r21 + 1;
J2DDrawLine(temp6, mParams.mUserPosition + mParams.mBarWidth, temp6,
mParams.mUserPosition + r25 - mParams.mBarWidth,
(i % 5) != 0 ? JUtility::TColor(100, 100, 255, 255) :
JUtility::TColor(180, 255, 255, 255),
12);
}
}
field_0x108 = 0;
}
}
/* 802E6D3C-802E6DA4 2E167C 0068+00 2/2 0/0 0/0 .text addrToXPos__FPvi */
@@ -272,9 +285,9 @@ static void heapBar(JKRHeap* param_0, int param_1, int param_2, int param_3, int
/* 802E6FA0-802E7340 2E18E0 03A0+00 1/1 0/0 0/0 .text drawHeapBar__10JUTProcBarFv */
void JUTProcBar::drawHeapBar() {
if (mHeapBarVisible)
{
int start; // required/workaround for regswaps, end might be a shared variable too, however doesn't seem to be needed?
if (mHeapBarVisible) {
int start; // required/workaround for regswaps, end might be a shared variable too, however
// doesn't seem to be needed?
int posX = mParams.mPosX;
int posY = mParams.mPosY;
int barHeight = mParams.mBarWidth * 2;
@@ -283,40 +296,32 @@ void JUTProcBar::drawHeapBar() {
// draw main box in opaque bordeaux red and main frame in purple?
J2DFillBox(posX, posY - (height * 2), width, height, JUtility::TColor(100, 0, 50, 200));
J2DDrawFrame(posX, posY - (height * 2), width, height, JUtility::TColor(100, 50, 150, 255), 6);
J2DDrawFrame(posX, posY - (height * 2), width, height, JUtility::TColor(100, 50, 150, 255),
6);
// Draws a pink line that shows the size of the memstart to start of arenalow?
start = posX + addrToXPos(JKRHeap::getCodeStart(), width);
int codeEnd = posX + addrToXPos(JKRHeap::getCodeEnd(), width);
J2DFillBox(start, posY - (height * 2), codeEnd - start, height, JUtility::TColor(255, 50, 150, 255));
J2DFillBox(start, posY - (height * 2), codeEnd - start, height,
JUtility::TColor(255, 50, 150, 255));
// draws a dark blue line that shows how much memory is free?
start = posX + addrToXPos(JKRHeap::getUserRamStart(), width);
int userEnd = posX + addrToXPos(JKRHeap::getUserRamEnd(), width);
J2DFillBox(start, posY - (height * 2), userEnd - start, height, JUtility::TColor(0, 50, 150, 255));
J2DFillBox(start, posY - (height * 2), userEnd - start, height,
JUtility::TColor(0, 50, 150, 255));
// draws a light blue line that shows how much memory is free in the root heap(blends to light pink, not sure how this works)
// draws a light blue line that shows how much memory is free in the root heap(blends to
// light pink, not sure how this works)
int size = byteToXLen(JKRHeap::getRootHeap()->getTotalFreeSize(), width);
J2DFillBox(start, posY - (height * 2), size, height / 2, JUtility::TColor(0, 250, 250, 255));
if (field_0x128 == 0)
{
J2DFillBox(start, posY - (height * 2), size, height / 2,
JUtility::TColor(0, 250, 250, 255));
if (field_0x128 == 0) {
// draws a line of either the watch heap(if available), otherwise draw the current heap
JKRHeap *heap = mWatchHeap ? mWatchHeap : JKRGetCurrentHeap();
JKRHeap* heap = mWatchHeap ? mWatchHeap : JKRGetCurrentHeap();
if (heap != JKRHeap::getSystemHeap()) {
heapBar(heap, posX, posY, barHeight, width, height);
}
}
}
}
/* 802E7340-802E7354 2E1C80 0014+00 1/1 0/0 0/0 .text __ct__Q210JUTProcBar5CTimeFv */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
// asm JUTProcBar::CTime::CTime() {
extern "C" asm void __ct__Q210JUTProcBar5CTimeFv() {
nofralloc
#include "asm/JSystem/JUtility/JUTProcBar/__ct__Q210JUTProcBar5CTimeFv.s"
}
#pragma pop
+5 -5
View File
@@ -8,7 +8,7 @@
#include "JSystem/JSupport/JSupport.h"
#include "JSystem/JUtility/JUTAssert.h"
#include "JSystem/JUtility/JUTConsole.h"
#include "dolphin/gx/GX.h"
#include "dolphin/gx.h"
#define suAboutEncoding_ 3
@@ -274,22 +274,22 @@ f32 JUTResFont::drawChar_scale(f32 pos_x, f32 pos_y, f32 scale_x, f32 scale_y, i
// Bottom Left
GXPosition3f32(x1, y1, 0.0f);
GXColor1u32(mColor1);
i_GXTexCoord2u16(u1, v1);
GXTexCoord2u16(u1, v1);
// Bottom Right
GXPosition3f32(x2, y1, 0.0f);
GXColor1u32(mColor2);
i_GXTexCoord2u16(u2, v1);
GXTexCoord2u16(u2, v1);
// Top Right
GXPosition3f32(x2, y2, 0.0f);
GXColor1u32(mColor4);
i_GXTexCoord2u16(u2, v2);
GXTexCoord2u16(u2, v2);
// Top Left
GXPosition3f32(x1, y2, 0.0f);
GXColor1u32(mColor3);
i_GXTexCoord2u16(u1, v2);
GXTexCoord2u16(u1, v2);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0);
+6 -29
View File
@@ -1,39 +1,16 @@
//
// Generated By: dol2asm
// Translation Unit: JUTResource
//
#include "JSystem/JUtility/JUTResource.h"
#include "JSystem/JKernel/JKRArchive.h"
#include "JSystem/JSupport/JSUInputStream.h"
#include "string.h"
#include "dolphin/types.h"
//
// Types:
//
//
// Forward References:
//
//
// External References:
//
//
// Declarations:
//
/* 802DE078-802DE120 2D89B8 00A8+00 0/0 1/1 0/0 .text
* getResource__15JUTResReferenceFP14JSUInputStreamUlP10JKRArchive */
void *JUTResReference::getResource(JSUInputStream *stream, u32 resType, JKRArchive *archive) {
void* JUTResReference::getResource(JSUInputStream* stream, u32 resType, JKRArchive* archive) {
stream->read(&mType, 1);
stream->read(&mNameLength, 1);
stream->read(&mName, mNameLength);
if (mType == RESTYPE_Unk2 || mType == RESTYPE_Unk3 || mType == RESTYPE_Unk4)
{
if (mType == RESTYPE_Unk2 || mType == RESTYPE_Unk3 || mType == RESTYPE_Unk4) {
mName[mNameLength] = 0;
}
@@ -43,12 +20,12 @@ void *JUTResReference::getResource(JSUInputStream *stream, u32 resType, JKRArchi
/* 802DE120-802DE1BC 2D8A60 009C+00 0/0 2/2 0/0 .text
* getResource__15JUTResReferenceFPCvUlP10JKRArchive */
void *JUTResReference::getResource(const void *data, u32 resType, JKRArchive *archive) {
void* JUTResReference::getResource(const void* data, u32 resType, JKRArchive* archive) {
mType = *(u8*)data;
mNameLength = *((u8*)data + 1);
if (mNameLength != 0) {
memcpy(&mName, &((u8 *)data)[2], mNameLength);
memcpy(&mName, &((u8*)data)[2], mNameLength);
}
if (mType == RESTYPE_Unk2 || mType == RESTYPE_Unk3 || mType == RESTYPE_Unk4) {
@@ -60,8 +37,8 @@ void *JUTResReference::getResource(const void *data, u32 resType, JKRArchive *ar
/* 802DE1BC-802DE234 2D8AFC 0078+00 2/2 0/0 0/0 .text
* getResource__15JUTResReferenceFUlP10JKRArchive */
void *JUTResReference::getResource(u32 resType, JKRArchive *archive) {
void *res = NULL;
void* JUTResReference::getResource(u32 resType, JKRArchive* archive) {
void* res = NULL;
switch (mType) {
case RESTYPE_Unk1:
break;
+1 -18
View File
@@ -1,23 +1,6 @@
//
// Generated By: dol2asm
// Translation Unit: JUTTexture
//
#include "JSystem/JUtility/JUTTexture.h"
#include "JSystem/JUtility/JUTPalette.h"
#include "dolphin/gx/GX.h"
//
// Forward References:
//
//
// External References:
//
//
// Declarations:
//
#include "dolphin/gx.h"
/* 802DE234-802DE2A8 2D8B74 0074+00 0/0 30/30 0/0 .text __dt__10JUTTextureFv */
JUTTexture::~JUTTexture() {
+1 -1
View File
@@ -6,7 +6,7 @@
#include "JSystem/JUtility/JUTVideo.h"
#include "JSystem/JUtility/JUTDirectPrint.h"
#include "JSystem/JUtility/JUTXfb.h"
#include "dolphin/gx/GX.h"
#include "dolphin/gx.h"
/* 80451538-8045153C 000A38 0004+00 4/4 18/18 1/1 .sbss sManager__8JUTVideo */
JUTVideo* JUTVideo::sManager;
+1 -1
View File
@@ -5,7 +5,7 @@
#include "JSystem/JUtility/JUTXfb.h"
#include "JSystem/JKernel/JKRHeap.h"
#include "dolphin/gx/GX.h"
#include "dolphin/gx.h"
//
// Forward References:
@@ -1,5 +1,5 @@
#include "uart_console_io_gcn.h"
#include "dolphin/os/OS.h"
#include "dolphin/os.h"
int InitializeUART(size_t);
int WriteUARTN(unsigned char*, size_t);
+155 -1
View File
@@ -1,7 +1,6 @@
#ifndef __METROTRK_TRK_H__
#define __METROTRK_TRK_H__
#include "TRK_MINNOW_DOLPHIN/MetroTRK/Portable/msgbuf.h"
#include "dolphin/types.h"
#ifdef __cplusplus
@@ -166,6 +165,8 @@ typedef enum {
MEMACCESS_DebuggerMemory = 1,
} MemoryAccessOptions;
typedef int UARTError;
typedef enum {
UART_NoError = 0,
UART_UnknownBaudRate = 1,
@@ -195,6 +196,18 @@ typedef enum {
////////////////////////////////////
typedef int MessageBufferID;
#define TRKMSGBUF_SIZE (0x800 + 0x80)
typedef struct TRKBuffer {
/* 0x00 */ u32 _00;
/* 0x04 */ BOOL isInUse;
/* 0x08 */ u32 length;
/* 0x0C */ u32 position;
/* 0x10 */ u8 data[TRKMSGBUF_SIZE];
} TRKBuffer;
typedef struct TRKFramingState {
MessageBufferID msgBufID; // _00
TRKBuffer* buffer; // _04
@@ -203,6 +216,19 @@ typedef struct TRKFramingState {
u8 fcsType; // _10
} TRKFramingState;
typedef struct TRKState_PPC {
u32 GPR[32]; // 0x0
u32 LR; // 0x80
u32 CTR; // 0x84
u32 XER; // 0x88
u32 MSR; // 0x8c
u32 DAR; // 0x90
u32 DSISR; // 0x94
BOOL stopped; // 0x98
BOOL inputActivated; // 0x9c
u8* inputPendingPtr; // 0xA0
} TRKState_PPC;
typedef struct CommandReply {
u32 _00; // _00
union {
@@ -217,6 +243,134 @@ typedef struct CommandReply {
u8 _10[0x30]; // _10, unknown
} CommandReply;
typedef struct ProcessorRestoreFlags_PPC {
u8 TBR;
u8 DEC;
u8 linker_padding[0x9 - 0x2];
} ProcessorRestoreFlags_PPC;
void TRKSaveExtended1Block();
#define SPR_XER 1
#define SPR_LR 8
#define SPR_CTR 9
#define SPR_DSISR 18
#define SPR_DAR 19
#define SPR_DEC 22
#define SPR_SDR1 25
#define SPR_SRR0 26
#define SPR_SRR1 27
#define SPR_SPRG0 272
#define SPR_SPRG1 273
#define SPR_SPRG2 274
#define SPR_SPRG3 275
#define SPR_EAR 282
#define SPR_TBL 284
#define SPR_TBU 285
#define SPR_PVR 287
#define SPR_IBAT0U 528
#define SPR_IBAT0L 529
#define SPR_IBAT1U 530
#define SPR_IBAT1L 531
#define SPR_IBAT2U 532
#define SPR_IBAT2L 533
#define SPR_IBAT3U 534
#define SPR_IBAT3L 535
#define SPR_IBAT4U 560
#define SPR_IBAT4L 561
#define SPR_IBAT5U 562
#define SPR_IBAT5L 563
#define SPR_IBAT6U 564
#define SPR_IBAT6L 565
#define SPR_IBAT7U 566
#define SPR_IBAT7L 567
#define SPR_DBAT0U 536
#define SPR_DBAT0L 537
#define SPR_DBAT1U 538
#define SPR_DBAT1L 539
#define SPR_DBAT2U 540
#define SPR_DBAT2L 541
#define SPR_DBAT3U 542
#define SPR_DBAT3L 543
#define SPR_DBAT4U 568
#define SPR_DBAT4L 569
#define SPR_DBAT5U 570
#define SPR_DBAT5L 571
#define SPR_DBAT6U 572
#define SPR_DBAT6L 573
#define SPR_DBAT7U 574
#define SPR_DBAT7L 575
#define SPR_GQR0 912
#define SPR_GQR1 913
#define SPR_GQR2 914
#define SPR_GQR3 915
#define SPR_GQR4 916
#define SPR_GQR5 917
#define SPR_GQR6 918
#define SPR_GQR7 919
#define SPR_HID2 920
#define SPR_WPAR 921
#define SPR_DMA_U 922
#define SPR_DMA_L 923
#define SPR_UMMCR0 936
#define SPR_UPMC1 937
#define SPR_UPMC2 938
#define SPR_USIA 939
#define SPR_UMMCR1 940
#define SPR_UPMC3 941
#define SPR_UPMC4 942
#define SPR_USDA 943
#define SPR_MMCR0 952
#define SPR_PMC1 953
#define SPR_PMC2 954
#define SPR_SIA 955
#define SPR_MMCR1 956
#define SPR_PMC3 957
#define SPR_PMC4 958
#define SPR_SDA 959
#define SPR_HID0 1008
#define SPR_HID1 1009
#define SPR_IABR 1010
#define SPR_HID4 1011
#define SPR_DABR 1013
#define SPR_L2CR 1017
#define SPR_ICTC 1019
#define SPR_THRM1 1020
#define SPR_THRM2 1021
#define SPR_FPECR 1022
// PPC exceptions
// 0x000 is reserved
#define PPC_SystemReset 0x100
#define PPC_MachineCheck 0x200
#define PPC_DataStorage 0x300
#define PPC_InstructionStorage 0x400
#define PPC_ExternalInterrupt 0x500
#define PPC_Alignment 0x600
#define PPC_Program 0x700
#define PPC_FloatingPointUnavaiable 0x800
#define PPC_Decrementer 0x900
// 0xA00-0xB00 are reserved
#define PPC_SystemCall 0xC00
#define PPC_Trace 0xD00
#define PPC_FloatingPointAssist 0xE00 // unimplemented in 750CL
#define PPC_PerformanceMonitor 0xF00 // Dolphin/Broadway specific
// 0x1000-0x1200 are unimplemented in 750CL
#define PPC_InstructionAddressBreakpoint 0x1300 // Dolphin/Broadway specific
// 0x1400-0x2F00 are reserved, but TRK uses some
#define PPC_SystemManagementInterrupt 0x1400
// 0x1500-0x1600 are unimplemented in 750CL
#define PPC_ThermalManagementInterrupt 0x1700
#define PPC_1800Exception 0x1800
#define PPC_1900Exception 0x1900
#define PPC_1A00Exception 0x1A00
#define PPC_1B00Exception 0x1B00
#define PPC_1C00Exception 0x1C00 // Data breakpoint?
#define PPC_1D00Exception 0x1D00 // Instruction breakpoint?
#define PPC_1E00Exception 0x1E00 // Peripheral breakpoint?
#define PPC_1F00Exception 0x1F00 // Non maskable development port?
#define PPC_2000Exception 0x2000
#ifdef __cplusplus
}
#endif
@@ -3,7 +3,7 @@
* Description:
*/
#include "dolphin/os/OS.h"
#include "dolphin/os.h"
inline static void InitDefaultHeap(void) {
void* arenaLo;
+1 -1
View File
@@ -6,7 +6,7 @@
#include "SSystem/SComponent/c_lib.h"
#include "string.h"
#include "SSystem/SComponent/c_math.h"
#include "dolphin/mtx/mtxvec.h"
#include "dolphin/mtx.h"
/* 8026F93C-8026F95C 26A27C 0020+00 0/0 3/3 0/0 .text cLib_memCpy__FPvPCvUl */
void cLib_memCpy(void* dst, const void* src, unsigned long size) {
+16 -16
View File
@@ -18,22 +18,22 @@ static u8 gRecvBuf[DDH_BUF_SIZE];
static BOOL gIsInitialized;
/* 80372618-803726A0 36CF58 0088+00 0/0 1/1 0/0 .text ddh_cc_initialize */
BOOL ddh_cc_initialize(vu8** inputPendingPtrRef, AmcEXICallback monitorCallback) {
int ddh_cc_initialize(void* inputPendingPtrRef, AmcEXICallback monitorCallback) {
MWTRACE(1, "CALLING EXI2_Init\n");
EXI2_Init(inputPendingPtrRef, monitorCallback);
MWTRACE(1, "DONE CALLING EXI2_Init\n");
CircleBufferInitialize(&gRecvCB, gRecvBuf, DDH_BUF_SIZE);
return FALSE;
return 0;
}
/* 80372610-80372618 36CF50 0008+00 0/0 1/1 0/0 .text ddh_cc_shutdown */
BOOL ddh_cc_shutdown() {
return FALSE;
int ddh_cc_shutdown() {
return 0;
}
/* 803725EC-80372610 36CF2C 0024+00 0/0 1/1 0/0 .text ddh_cc_open */
int ddh_cc_open() {
if (gIsInitialized != FALSE) {
if (gIsInitialized != 0) {
return DDH_ERR_ALREADY_INITIALIZED;
}
@@ -42,12 +42,12 @@ int ddh_cc_open() {
}
/* 803725E4-803725EC 36CF24 0008+00 0/0 1/1 0/0 .text ddh_cc_close */
BOOL ddh_cc_close() {
return FALSE;
int ddh_cc_close() {
return 0;
}
/* 803724F8-803725E4 36CE38 00EC+00 0/0 1/1 0/0 .text ddh_cc_read */
u32 ddh_cc_read(u8* data, u32 size) {
int ddh_cc_read(u8* data, int size) {
u8 buff[DDH_BUF_SIZE];
int originalDataSize;
u32 result;
@@ -84,12 +84,12 @@ u32 ddh_cc_read(u8* data, u32 size) {
}
/* 80372438-803724F8 36CD78 00C0+00 0/0 1/1 0/0 .text ddh_cc_write */
int ddh_cc_write(u32 bytes, u32 length) {
int ddh_cc_write(const u8* bytes, int length) {
int exi2Len;
int n_copy;
u32 hexCopy;
hexCopy = bytes;
hexCopy = (u32)bytes;
n_copy = length;
if (gIsInitialized == FALSE) {
@@ -113,15 +113,15 @@ int ddh_cc_write(u32 bytes, u32 length) {
}
/* 80372414-80372438 36CD54 0024+00 0/0 1/1 0/0 .text ddh_cc_pre_continue */
BOOL ddh_cc_pre_continue() {
int ddh_cc_pre_continue() {
EXI2_Unreserve();
return FALSE;
return 0;
}
/* 803723F0-80372414 36CD30 0024+00 0/0 1/1 0/0 .text ddh_cc_post_stop */
BOOL ddh_cc_post_stop() {
int ddh_cc_post_stop() {
EXI2_Reserve();
return FALSE;
return 0;
}
/* 80372380-803723F0 36CCC0 0070+00 0/0 1/1 0/0 .text ddh_cc_peek */
@@ -144,7 +144,7 @@ int ddh_cc_peek() {
}
/* 8037235C-80372380 36CC9C 0024+00 0/0 1/1 0/0 .text ddh_cc_initinterrupts */
BOOL ddh_cc_initinterrupts() {
int ddh_cc_initinterrupts() {
EXI2_EnableInterrupts();
return FALSE;
return 0;
}
@@ -1,6 +1,6 @@
#include "TRK_MINNOW_DOLPHIN/utils/common/CircleBuffer.h"
#include "TRK_MINNOW_DOLPHIN/utils/common/MWTrace.h"
#include "dolphin/db/db.h"
#include "dolphin/db.h"
#define GDEV_BUF_SIZE (0x500)
@@ -14,22 +14,22 @@ static u8 gRecvBuf[GDEV_BUF_SIZE];
static BOOL gIsInitialized;
/* 80372BCC-80372C54 36D50C 0088+00 0/0 1/1 0/0 .text gdev_cc_initialize */
BOOL gdev_cc_initialize(vu8** inputPendingPtrRef, AmcEXICallback monitorCallback) {
int gdev_cc_initialize(void* inputPendingPtrRef, AmcEXICallback monitorCallback) {
MWTRACE(1, "CALLING EXI2_Init\n");
DBInitComm(inputPendingPtrRef, monitorCallback);
MWTRACE(1, "DONE CALLING EXI2_Init\n");
CircleBufferInitialize(&gRecvCB, gRecvBuf, GDEV_BUF_SIZE);
return FALSE;
return 0;
}
/* 80372BC4-80372BCC 36D504 0008+00 0/0 1/1 0/0 .text gdev_cc_shutdown */
BOOL gdev_cc_shutdown() {
return FALSE;
int gdev_cc_shutdown() {
return 0;
}
/* 80372BA0-80372BC4 36D4E0 0024+00 0/0 1/1 0/0 .text gdev_cc_open */
int gdev_cc_open() {
if (gIsInitialized != FALSE) {
if (gIsInitialized != 0) {
return -10005;
}
@@ -38,12 +38,12 @@ int gdev_cc_open() {
}
/* 80372B98-80372BA0 36D4D8 0008+00 0/0 1/1 0/0 .text gdev_cc_close */
BOOL gdev_cc_close() {
return FALSE;
int gdev_cc_close() {
return 0;
}
/* 80372AA4-80372B98 36D3E4 00F4+00 0/0 1/1 0/0 .text gdev_cc_read */
u32 gdev_cc_read(u8* data, u32 size) {
int gdev_cc_read(u8* data, int size) {
u8 buff[GDEV_BUF_SIZE];
int p1;
u32 retval;
@@ -79,12 +79,12 @@ u32 gdev_cc_read(u8* data, u32 size) {
}
/* 803729E4-80372AA4 36D324 00C0+00 0/0 1/1 0/0 .text gdev_cc_write */
int gdev_cc_write(int bytes, int length) {
int gdev_cc_write(const u8* bytes, int length) {
int exi2Len;
int n_copy;
u32 hexCopy;
hexCopy = bytes;
hexCopy = (u32)bytes;
n_copy = length;
if (gIsInitialized == FALSE) {
@@ -108,15 +108,15 @@ int gdev_cc_write(int bytes, int length) {
}
/* 803729C0-803729E4 36D300 0024+00 0/0 1/1 0/0 .text gdev_cc_pre_continue */
BOOL gdev_cc_pre_continue() {
int gdev_cc_pre_continue() {
DBClose();
return FALSE;
return 0;
}
/* 8037299C-803729C0 36D2DC 0024+00 0/0 1/1 0/0 .text gdev_cc_post_stop */
BOOL gdev_cc_post_stop() {
int gdev_cc_post_stop() {
DBOpen();
return FALSE;
return 0;
}
/* 8037292C-8037299C 36D26C 0070+00 0/0 1/1 0/0 .text gdev_cc_peek */
@@ -139,7 +139,7 @@ int gdev_cc_peek() {
}
/* 80372908-8037292C 36D248 0024+00 0/0 1/1 0/0 .text gdev_cc_initinterrupts */
BOOL gdev_cc_initinterrupts() {
int gdev_cc_initinterrupts() {
DBInitInterrupts();
return FALSE;
return 0;
}
+4 -1
View File
@@ -76,7 +76,7 @@ LIBTRK_MINNOW_DOLPHIN_A_LDFLAGS := \
-linkmode moreram \
BASE_CFLAGS := -Cpp_exceptions off -proc gekko -fp hard -O4,p -inline deferred -use_lmw_stmw on -nodefaults -str reuse -RTTI off -maxerrors 5 -enum int $(INCLUDES)
BASE_CFLAGS := -Cpp_exceptions off -proc gekko -fp hard -O4,p -inline auto,deferred -use_lmw_stmw on -nodefaults -str reuse -RTTI off -maxerrors 5 -enum int $(INCLUDES)
$(BUILD_DIR)/libs/TRK_MINNOW_DOLPHIN/GCN/EXI2_DDH_GCN/main.o: CFLAGS := $(BASE_CFLAGS) -sdata 8
$(BUILD_DIR)/libs/TRK_MINNOW_DOLPHIN/GCN/EXI2_GDEV_GCN/main.o: CFLAGS := $(BASE_CFLAGS) -sdata 8
@@ -92,8 +92,11 @@ $(BUILD_DIR)/libs/TRK_MINNOW_DOLPHIN/MetroTRK/Portable/nubinit.o: CFLAGS := $(BA
$(BUILD_DIR)/libs/TRK_MINNOW_DOLPHIN/MetroTRK/Portable/serpoll.o: CFLAGS := $(BASE_CFLAGS) -sdata 8
$(BUILD_DIR)/libs/TRK_MINNOW_DOLPHIN/MetroTRK/Portable/support.o: CFLAGS := $(BASE_CFLAGS) -sdata 0 -sdata2 0
$(BUILD_DIR)/libs/TRK_MINNOW_DOLPHIN/Os/dolphin/target_options.o: CFLAGS := $(BASE_CFLAGS) -sdata 0 -sdata2 0
$(BUILD_DIR)/libs/TRK_MINNOW_DOLPHIN/Os/dolphin/dolphin_trk_glue.o: CFLAGS := $(BASE_CFLAGS) -sdata 0 -sdata2 0
$(BUILD_DIR)/libs/TRK_MINNOW_DOLPHIN/Os/dolphin/dolphin_trk.o: CFLAGS := $(BASE_CFLAGS) -sdata 0 -sdata2 0
$(BUILD_DIR)/libs/TRK_MINNOW_DOLPHIN/Os/dolphin/UDP_Stubs.o: CFLAGS := $(BASE_CFLAGS) -sdata 0 -sdata2 0
$(BUILD_DIR)/libs/TRK_MINNOW_DOLPHIN/Os/dolphin/usr_put.o: CFLAGS := $(BASE_CFLAGS) -sdata 0 -sdata2 0
$(BUILD_DIR)/libs/TRK_MINNOW_DOLPHIN/ppc/Generic/targimpl.o: CFLAGS := $(BASE_CFLAGS) -sdata 0 -sdata2 0
$(BUILD_DIR)/libs/TRK_MINNOW_DOLPHIN/utils/common/CircleBuffer.o: CFLAGS := $(BASE_CFLAGS) -sdata 0 -sdata2 0
$(BUILD_DIR)/libs/TRK_MINNOW_DOLPHIN/utils/gc/MWCriticalSection_gc.o: CFLAGS := $(BASE_CFLAGS) -sdata 0 -sdata2 0
@@ -25,15 +25,15 @@ DSIOResult __TRK_write_console(u32 handle, u8* buffer, size_t* count, void* ref_
return __write_file(DS_Stdout, buffer, count, ref_con);
}
static inline DSIOResult __read_file(u32 handle, u8* buffer, size_t* count, void* ref_con) {
static DSIOResult __read_file(u32 handle, u8* buffer, size_t* count, void* ref_con) {
return __access_file(handle, buffer, count, ref_con, DSMSG_ReadFile);
}
static inline DSIOResult __write_file(u32 handle, u8* buffer, size_t* count, void* ref_con) {
static DSIOResult __write_file(u32 handle, u8* buffer, size_t* count, void* ref_con) {
return __access_file(handle, buffer, count, ref_con, DSMSG_WriteFile);
}
static inline DSIOResult __access_file(u32 handle, u8* buffer, size_t* count, void* ref_con,
static DSIOResult __access_file(u32 handle, u8* buffer, size_t* count, void* ref_con,
MessageCommandID cmd) {
size_t countTemp;
u32 r0;
@@ -6,7 +6,6 @@
#include "TRK_MINNOW_DOLPHIN/MetroTRK/Portable/main_TRK.h"
#include "TRK_MINNOW_DOLPHIN/MetroTRK/Portable/nubinit.h"
#include "TRK_MINNOW_DOLPHIN/utils/common/MWTrace.h"
#include "trk.h"
/* 8044F818-8044F820 07C538 0004+04 1/1 0/0 0/0 .bss TRK_mainError */
static DSError TRK_mainError;
+318 -181
View File
@@ -1,189 +1,326 @@
//
// Generated By: dol2asm
// Translation Unit: MetroTRK/Portable/msgbuf
//
#include "TRK_MINNOW_DOLPHIN/MetroTRK/Portable/msgbuf.h"
#include "dol2asm.h"
#include "TRK_MINNOW_DOLPHIN/MetroTRK/Portable/nubinit.h"
#include "trk.h"
//
// Forward References:
//
void TRKReadBuffer_ui32();
void TRKReadBuffer_ui8();
void TRKReadBuffer1_ui64();
void TRKAppendBuffer_ui32();
void TRKAppendBuffer_ui8();
void TRKAppendBuffer1_ui64();
void TRKReadBuffer();
void TRKAppendBuffer();
void TRKResetBuffer();
void TRKReleaseBuffer();
void TRKGetFreeBuffer();
void TRKInitializeMessageBuffers();
//
// External References:
//
SECTION_INIT void TRK_memset();
SECTION_INIT void TRK_memcpy();
void usr_puts_serial();
u8 TRKReleaseMutex();
u8 TRKAcquireMutex();
u8 TRKInitializeMutex();
SECTION_BSS extern u8 gTRKBigEndian[4 + 4 /* padding */];
//
// Declarations:
//
/* 8036D01C-8036D10C 36795C 00F0+00 0/0 2/2 0/0 .text TRKReadBuffer_ui32 */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void TRKReadBuffer_ui32() {
nofralloc
#include "asm/TRK_MINNOW_DOLPHIN/MetroTRK/Portable/msgbuf/TRKReadBuffer_ui32.s"
}
#pragma pop
/* 8036D10C-8036D1A4 367A4C 0098+00 0/0 1/1 0/0 .text TRKReadBuffer_ui8 */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void TRKReadBuffer_ui8() {
nofralloc
#include "asm/TRK_MINNOW_DOLPHIN/MetroTRK/Portable/msgbuf/TRKReadBuffer_ui8.s"
}
#pragma pop
/* 8036D1A4-8036D28C 367AE4 00E8+00 0/0 2/2 0/0 .text TRKReadBuffer1_ui64 */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void TRKReadBuffer1_ui64() {
nofralloc
#include "asm/TRK_MINNOW_DOLPHIN/MetroTRK/Portable/msgbuf/TRKReadBuffer1_ui64.s"
}
#pragma pop
/* 8036D28C-8036D388 367BCC 00FC+00 0/0 2/2 0/0 .text TRKAppendBuffer_ui32 */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void TRKAppendBuffer_ui32() {
nofralloc
#include "asm/TRK_MINNOW_DOLPHIN/MetroTRK/Portable/msgbuf/TRKAppendBuffer_ui32.s"
}
#pragma pop
/* 8036D388-8036D3F0 367CC8 0068+00 0/0 8/8 0/0 .text TRKAppendBuffer_ui8 */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void TRKAppendBuffer_ui8() {
nofralloc
#include "asm/TRK_MINNOW_DOLPHIN/MetroTRK/Portable/msgbuf/TRKAppendBuffer_ui8.s"
}
#pragma pop
/* 8036D3F0-8036D4EC 367D30 00FC+00 0/0 2/2 0/0 .text TRKAppendBuffer1_ui64 */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void TRKAppendBuffer1_ui64() {
nofralloc
#include "asm/TRK_MINNOW_DOLPHIN/MetroTRK/Portable/msgbuf/TRKAppendBuffer1_ui64.s"
}
#pragma pop
/* 8036D4EC-8036D578 367E2C 008C+00 0/0 1/1 0/0 .text TRKReadBuffer */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void TRKReadBuffer() {
nofralloc
#include "asm/TRK_MINNOW_DOLPHIN/MetroTRK/Portable/msgbuf/TRKReadBuffer.s"
}
#pragma pop
/* 8036D578-8036D61C 367EB8 00A4+00 0/0 3/3 0/0 .text TRKAppendBuffer */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void TRKAppendBuffer() {
nofralloc
#include "asm/TRK_MINNOW_DOLPHIN/MetroTRK/Portable/msgbuf/TRKAppendBuffer.s"
}
#pragma pop
/* 8036D61C-8036D64C 367F5C 0030+00 0/0 7/7 0/0 .text TRKSetBufferPosition */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm s32 TRKSetBufferPosition(TRKBuffer*, u32) {
nofralloc
#include "asm/TRK_MINNOW_DOLPHIN/MetroTRK/Portable/msgbuf/TRKSetBufferPosition.s"
}
#pragma pop
/* 8036D64C-8036D68C 367F8C 0040+00 0/0 4/4 0/0 .text TRKResetBuffer */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void TRKResetBuffer() {
nofralloc
#include "asm/TRK_MINNOW_DOLPHIN/MetroTRK/Portable/msgbuf/TRKResetBuffer.s"
}
#pragma pop
/* ############################################################################################## */
/* 8044D8C0-8044F270 07A5E0 19B0+00 4/4 0/0 0/0 .bss gTRKMsgBufs */
static u8 gTRKMsgBufs[6576];
TRKBuffer gTRKMsgBufs[3];
/* 8036D68C-8036D6F0 367FCC 0064+00 0/0 8/8 0/0 .text TRKReleaseBuffer */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void TRKReleaseBuffer() {
nofralloc
#include "asm/TRK_MINNOW_DOLPHIN/MetroTRK/Portable/msgbuf/TRKReleaseBuffer.s"
void TRKSetBufferUsed(TRKBuffer* msg, BOOL state) {
msg->isInUse = state;
}
#pragma pop
/* 8036D6F0-8036D71C 368030 002C+00 0/0 7/7 0/0 .text TRKGetBuffer */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void* TRKGetBuffer(int) {
nofralloc
#include "asm/TRK_MINNOW_DOLPHIN/MetroTRK/Portable/msgbuf/TRKGetBuffer.s"
}
#pragma pop
/* ############################################################################################## */
/* 803A26E0-803A2700 02ED40 001D+03 1/1 0/0 0/0 .rodata @618 */
SECTION_RODATA static char const lit_618[] = "ERROR : No buffer available\n";
COMPILER_STRIP_GATE(0x803A26E0, &lit_618);
/* 8036D71C-8036D7E4 36805C 00C8+00 0/0 6/6 0/0 .text TRKGetFreeBuffer */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void TRKGetFreeBuffer() {
nofralloc
#include "asm/TRK_MINNOW_DOLPHIN/MetroTRK/Portable/msgbuf/TRKGetFreeBuffer.s"
}
#pragma pop
/* 8036D7E4-8036D858 368124 0074+00 0/0 1/1 0/0 .text TRKInitializeMessageBuffers */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void TRKInitializeMessageBuffers() {
nofralloc
#include "asm/TRK_MINNOW_DOLPHIN/MetroTRK/Portable/msgbuf/TRKInitializeMessageBuffers.s"
DSError TRKInitializeMessageBuffers(void) {
int i;
for (i = 0; i < 3; i++) {
TRKInitializeMutex(&gTRKMsgBufs[i]);
TRKAcquireMutex(&gTRKMsgBufs[i]);
TRKSetBufferUsed(&gTRKMsgBufs[i], FALSE);
TRKReleaseMutex(&gTRKMsgBufs[i]);
}
return DS_NoError;
}
/* 8036D71C-8036D7E4 36805C 00C8+00 0/0 6/6 0/0 .text TRKGetFreeBuffer */
DSError TRKGetFreeBuffer(int* msgID, TRKBuffer** outMsg) {
TRKBuffer* buf;
DSError error = DS_NoMessageBufferAvailable;
int i;
*outMsg = NULL;
for (i = 0; i < 3; i++) {
buf = TRKGetBuffer(i);
TRKAcquireMutex(buf);
if (!buf->isInUse) {
TRKResetBuffer(buf, TRUE);
TRKSetBufferUsed(buf, TRUE);
error = DS_NoError;
*outMsg = buf;
*msgID = i;
i = 3; // why not break? weird choice
}
TRKReleaseMutex(buf);
}
if (error == DS_NoMessageBufferAvailable) {
usr_puts_serial("ERROR : No buffer available\n");
}
return error;
}
/* 8036D6F0-8036D71C 368030 002C+00 0/0 7/7 0/0 .text TRKGetBuffer */
void* TRKGetBuffer(int idx) {
TRKBuffer* buf = NULL;
if (idx >= 0 && idx < 3) {
buf = &gTRKMsgBufs[idx];
}
return buf;
}
/* 8036D68C-8036D6F0 367FCC 0064+00 0/0 8/8 0/0 .text TRKReleaseBuffer */
void TRKReleaseBuffer(int idx) {
TRKBuffer* msg;
if (idx != -1 && idx >= 0 && idx < 3) {
msg = &gTRKMsgBufs[idx];
TRKAcquireMutex(msg);
TRKSetBufferUsed(msg, FALSE);
TRKReleaseMutex(msg);
}
}
/* 8036D64C-8036D68C 367F8C 0040+00 0/0 4/4 0/0 .text TRKResetBuffer */
void TRKResetBuffer(TRKBuffer* msg, BOOL keepData) {
msg->length = 0;
msg->position = 0;
if (!keepData) {
TRK_memset(msg->data, 0, 0x880);
}
}
/* 8036D61C-8036D64C 367F5C 0030+00 0/0 7/7 0/0 .text TRKSetBufferPosition */
DSError TRKSetBufferPosition(TRKBuffer* msg, u32 pos) {
DSError error = DS_NoError;
if (pos > 0x880) {
error = DS_MessageBufferOverflow;
} else {
msg->position = pos;
// If the new position is past the current length,
// update the length
if (pos > msg->length) {
msg->length = pos;
}
}
return error;
}
/* 8036D578-8036D61C 367EB8 00A4+00 0/0 3/3 0/0 .text TRKAppendBuffer */
DSError TRKAppendBuffer(TRKBuffer* msg, const void* data, size_t length) {
DSError error = DS_NoError; // r31
u32 bytesLeft;
// Return if no bytes to append
if (length == 0) {
return DS_NoError;
}
bytesLeft = 0x880 - msg->position;
// If there isn't enough space left in the buffer, change the number
// of bytes to append to the remaning number of bytes
if (bytesLeft < length) {
error = DS_MessageBufferOverflow;
length = bytesLeft;
}
if (length == 1) {
// If the length of bytes to append is 1, just copy the byte over
msg->data[msg->position] = ((u8*)data)[0];
} else {
// Otherwise, use memcpy
TRK_memcpy(msg->data + msg->position, data, length);
}
// Update the position and length
msg->position += length;
msg->length = msg->position;
return error;
}
/* 8036D4EC-8036D578 367E2C 008C+00 0/0 1/1 0/0 .text TRKReadBuffer */
DSError TRKReadBuffer(TRKBuffer* msg, void* data, size_t length) {
DSError error = DS_NoError;
unsigned int bytesLeft; // this has to be unsigned int not u32 to match lmfao.
// Return if no bytes to read
if (length == 0) {
return DS_NoError;
}
bytesLeft = msg->length - msg->position;
// If the number of bytes to read exceeds the buffer length, change
// the length to the remaining number of bytes
if (length > bytesLeft) {
error = DS_MessageBufferReadError;
length = bytesLeft;
}
TRK_memcpy(data, msg->data + msg->position, length);
msg->position += length;
return error;
}
DSError TRKAppendBuffer1_ui8(TRKBuffer* buffer, const u8 data) {
if (buffer->position >= 0x880) {
return DS_MessageBufferOverflow;
}
buffer->data[buffer->position++] = data;
buffer->length++;
return DS_NoError;
}
DSError TRKAppendBuffer1_ui32(TRKBuffer* buffer, const u32 data) {
u8* bigEndianData;
u8* byteData;
u8 swapBuffer[sizeof(data)];
if (gTRKBigEndian) {
bigEndianData = (u8*)&data;
} else {
byteData = (u8*)&data;
bigEndianData = swapBuffer;
bigEndianData[0] = byteData[3];
bigEndianData[1] = byteData[2];
bigEndianData[2] = byteData[1];
bigEndianData[3] = byteData[0];
}
return TRKAppendBuffer(buffer, (const void*)bigEndianData, sizeof(data));
}
/* 8036D3F0-8036D4EC 367D30 00FC+00 0/0 2/2 0/0 .text TRKAppendBuffer1_ui64 */
DSError TRKAppendBuffer1_ui64(TRKBuffer* buffer, const u64 data) {
u8* bigEndianData;
u8* byteData;
u8 swapBuffer[sizeof(data)];
if (gTRKBigEndian) {
bigEndianData = (u8*)&data;
} else {
byteData = (u8*)&data;
bigEndianData = swapBuffer;
bigEndianData[0] = byteData[7];
bigEndianData[1] = byteData[6];
bigEndianData[2] = byteData[5];
bigEndianData[3] = byteData[4];
bigEndianData[4] = byteData[3];
bigEndianData[5] = byteData[2];
bigEndianData[6] = byteData[1];
bigEndianData[7] = byteData[0];
}
return TRKAppendBuffer(buffer, (const void*)bigEndianData, sizeof(data));
}
/* 8036D388-8036D3F0 367CC8 0068+00 0/0 8/8 0/0 .text TRKAppendBuffer_ui8 */
DSError TRKAppendBuffer_ui8(TRKBuffer* buffer, const u8* data, int count) {
DSError err;
int i;
for (i = 0, err = DS_NoError; err == DS_NoError && i < count; i++) {
err = TRKAppendBuffer1_ui8(buffer, data[i]);
}
return err;
}
/* 8036D28C-8036D388 367BCC 00FC+00 0/0 2/2 0/0 .text TRKAppendBuffer_ui32 */
DSError TRKAppendBuffer_ui32(TRKBuffer* buffer, const u32* data, int count) {
DSError err;
int i;
for (i = 0, err = DS_NoError; err == DS_NoError && i < count; i++) {
err = TRKAppendBuffer1_ui32(buffer, data[i]);
}
return err;
}
DSError TRKReadBuffer1_ui8(TRKBuffer* buffer, u8* data) {
return TRKReadBuffer(buffer, (void*)data, 1);
}
DSError TRKReadBuffer1_ui32(TRKBuffer* buffer, u32* data) {
DSError err;
u8* bigEndianData;
u8* byteData;
u8 swapBuffer[sizeof(data)];
if (gTRKBigEndian) {
bigEndianData = (u8*)data;
} else {
bigEndianData = swapBuffer;
}
err = TRKReadBuffer(buffer, (void*)bigEndianData, sizeof(*data));
if (!gTRKBigEndian && err == DS_NoError) {
byteData = (u8*)data;
byteData[0] = bigEndianData[3];
byteData[1] = bigEndianData[2];
byteData[2] = bigEndianData[1];
byteData[3] = bigEndianData[0];
}
return err;
// UNUSED FUNCTION
}
/* 8036D1A4-8036D28C 367AE4 00E8+00 0/0 2/2 0/0 .text TRKReadBuffer1_ui64 */
DSError TRKReadBuffer1_ui64(TRKBuffer* buffer, u64* data) {
DSError err;
u8* bigEndianData;
u8* byteData;
u8 swapBuffer[sizeof(data)];
if (gTRKBigEndian) {
bigEndianData = (u8*)data;
} else {
bigEndianData = swapBuffer;
}
err = TRKReadBuffer(buffer, (void*)bigEndianData, sizeof(*data));
if (!gTRKBigEndian && err == 0) {
byteData = (u8*)data;
byteData[0] = bigEndianData[7];
byteData[1] = bigEndianData[6];
byteData[2] = bigEndianData[5];
byteData[3] = bigEndianData[4];
byteData[4] = bigEndianData[3];
byteData[5] = bigEndianData[2];
byteData[6] = bigEndianData[1];
byteData[7] = bigEndianData[0];
}
return err;
}
/* 8036D10C-8036D1A4 367A4C 0098+00 0/0 1/1 0/0 .text TRKReadBuffer_ui8 */
DSError TRKReadBuffer_ui8(TRKBuffer* buffer, u8* data, int count) {
DSError err;
int i;
for (i = 0, err = DS_NoError; err == DS_NoError && i < count; i++) {
err = TRKReadBuffer1_ui8(buffer, &(data[i]));
}
return err;
}
/* 8036D01C-8036D10C 36795C 00F0+00 0/0 2/2 0/0 .text TRKReadBuffer_ui32 */
DSError TRKReadBuffer_ui32(TRKBuffer* buffer, u32* data, int count) {
DSError err;
s32 i;
for (i = 0, err = DS_NoError; err == DS_NoError && i < count; i++) {
err = TRKReadBuffer1_ui32(buffer, &(data[i]));
}
return err;
}
#pragma pop
@@ -33,7 +33,7 @@ void SetTRKConnected(BOOL isTRKConnected) {
IsTRKConnected = isTRKConnected;
}
inline DSError TRKSendACK(TRKBuffer* buffer) {
DSError TRKSendACK(TRKBuffer* buffer) {
DSError err;
MWTRACE(1, "SendACK : Calling MessageSend\n");
err = TRKMessageSend(buffer);
@@ -41,7 +41,7 @@ inline DSError TRKSendACK(TRKBuffer* buffer) {
return err;
}
inline DSError TRKStandardACK(TRKBuffer* buffer, MessageCommandID commandID,
DSError TRKStandardACK(TRKBuffer* buffer, MessageCommandID commandID,
DSReplyError replyError) {
CommandReply reply;
@@ -60,7 +60,7 @@ void TRKNubWelcome(void) {
return;
}
inline BOOL TRKInitializeEndian(void) {
BOOL TRKInitializeEndian(void) {
u8 bendian[4];
BOOL result = FALSE;
gTRKBigEndian = TRUE;
@@ -1,5 +1,6 @@
#include "TRK_MINNOW_DOLPHIN/MetroTRK/Portable/support.h"
#include "TRK_MINNOW_DOLPHIN/utils/common/MWTrace.h"
#include "TRK_MINNOW_DOLPHIN/MetroTRK/Portable/msgbuf.h"
#include "trk.h"
/* 8036F278-8036F498 369BB8 0220+00 0/0 1/1 0/0 .text TRKSuppAccessFile */
@@ -4,10 +4,9 @@
*/
#include "TRK_MINNOW_DOLPHIN/Os/dolphin/UDP_Stubs.h"
#include "dolphin/os/OS.h"
/* 80372354-8037235C 36CC94 0008+00 0/0 1/1 0/0 .text udp_cc_initialize */
__declspec(weak) int udp_cc_initialize(void* flagOut, OSInterruptHandler handler) {
__declspec(weak) int udp_cc_initialize(void* flagOut, __OSInterruptHandler handler) {
return -1;
}
+311 -106
View File
@@ -1,115 +1,37 @@
//
// Generated By: dol2asm
// Translation Unit: Os/dolphin/dolphin_trk
//
#include "TRK_MINNOW_DOLPHIN/Os/dolphin/dolphin_trk.h"
#include "TRK_MINNOW_DOLPHIN/MetroTRK/Portable/main_TRK.h"
#include "TRK_MINNOW_DOLPHIN/Os/dolphin/dolphin_trk_glue.h"
#include "TRK_MINNOW_DOLPHIN/ppc/Generic/targimpl.h"
#include "dol2asm.h"
#include "dolphin/ar.h"
#include "dolphin/os.h"
//
// Forward References:
//
extern u8 _db_stack_addr[];
#define EXCEPTIONMASK_ADDR 0x80000044
void InitMetroTRK();
void InitMetroTRK_BBA();
void TRK__write_aram();
void TRK__read_aram();
int TRKInitializeTarget();
void __TRK_copy_vectors();
u32 TRKTargetTranslate();
void EnableMetroTRKInterrupts();
//
// External References:
//
SECTION_INIT void TRK_memcpy();
extern u8 const __TRK_unknown_data[7988];
void ARGetDMAStatus();
void ARStartDMA();
void __ARClearInterrupt();
void __ARGetInterruptStatus();
void TRK_flush_cache();
void TRKSaveExtended1Block();
void TRK_main();
void EnableEXI2Interrupts();
void InitMetroTRKCommTable();
void regist__9daBgObj_cFP4dBgW();
//
// Declarations:
//
/* 80371560-803715F8 36BEA0 0098+00 0/0 1/1 0/0 .text InitMetroTRK */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void InitMetroTRK() {
nofralloc
#include "asm/TRK_MINNOW_DOLPHIN/Os/dolphin/dolphin_trk/InitMetroTRK.s"
}
#pragma pop
/* 803715F8-8037168C 36BF38 0094+00 0/0 1/1 0/0 .text InitMetroTRK_BBA */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void InitMetroTRK_BBA() {
nofralloc
#include "asm/TRK_MINNOW_DOLPHIN/Os/dolphin/dolphin_trk/InitMetroTRK_BBA.s"
}
#pragma pop
/* 8037168C-80371878 36BFCC 01EC+00 0/0 1/1 0/0 .text TRK__write_aram */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void TRK__write_aram() {
nofralloc
#include "asm/TRK_MINNOW_DOLPHIN/Os/dolphin/dolphin_trk/TRK__write_aram.s"
}
#pragma pop
/* 80371878-803719AC 36C1B8 0134+00 0/0 1/1 0/0 .text TRK__read_aram */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void TRK__read_aram() {
nofralloc
#include "asm/TRK_MINNOW_DOLPHIN/Os/dolphin/dolphin_trk/TRK__read_aram.s"
}
#pragma pop
/* ############################################################################################## */
/* 8044F810-8044F818 07C530 0004+04 3/3 0/0 0/0 .bss lc_base */
SECTION_BSS static u32 lc_base;
static u32 lc_base;
/* 803719AC-803719F8 36C2EC 004C+00 0/0 1/1 0/0 .text TRKInitializeTarget */
int TRKInitializeTarget() {
gTRKState.stopped = TRUE;
gTRKState.MSR = __TRK_get_MSR();
lc_base = 0xE0000000;
return 0;
}
/* ############################################################################################## */
/* 803D3268-803D32A8 030388 003C+04 1/1 0/0 0/0 .data TRK_ISR_OFFSETS */
static u32 TRK_ISR_OFFSETS[15 + 1 /* padding */] = {
0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0x700, 0x800, 0x900, 0xC00, 0xD00, 0xF00, 0x1300,
0x1400, 0x1700,
/* padding */
0};
static u32 TRK_ISR_OFFSETS[15] = {PPC_SystemReset,
PPC_MachineCheck,
PPC_DataStorage,
PPC_InstructionStorage,
PPC_ExternalInterrupt,
PPC_Alignment,
PPC_Program,
PPC_FloatingPointUnavaiable,
PPC_Decrementer,
PPC_SystemCall,
PPC_Trace,
PPC_PerformanceMonitor,
PPC_InstructionAddressBreakpoint,
PPC_SystemManagementInterrupt,
PPC_ThermalManagementInterrupt};
/* 803719F8-80371B24 36C338 012C+00 0/0 1/1 0/0 .text __TRK_copy_vectors */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void __TRK_copy_vectors() {
nofralloc
#include "asm/TRK_MINNOW_DOLPHIN/Os/dolphin/dolphin_trk/__TRK_copy_vectors.s"
/* 80371B7C-80371B9C 36C4BC 0020+00 0/0 1/1 0/0 .text EnableMetroTRKInterrupts */
void EnableMetroTRKInterrupts(void) {
EnableEXI2Interrupts();
}
#pragma pop
/* 80371B24-80371B7C 36C464 0058+00 0/0 1/1 0/0 .text TRKTargetTranslate */
u32 TRKTargetTranslate(u32 param_0) {
@@ -124,7 +46,290 @@ u32 TRKTargetTranslate(u32 param_0) {
return param_0 & 0x3FFFFFFF | 0x80000000;
}
/* 80371B7C-80371B9C 36C4BC 0020+00 0/0 1/1 0/0 .text EnableMetroTRKInterrupts */
void EnableMetroTRKInterrupts() {
EnableEXI2Interrupts();
extern u8 __TRK_unknown_data[];
void TRK_copy_vector(u32 offset) {
void* destPtr = (void*)TRKTargetTranslate(offset);
TRK_memcpy(destPtr, (void*)(__TRK_unknown_data + offset), 0x100);
TRK_flush_cache(destPtr, 0x100);
}
/* 803719F8-80371B24 36C338 012C+00 0/0 1/1 0/0 .text __TRK_copy_vectors */
void __TRK_copy_vectors(void) {
u32 r3 = lc_base;
u32* isrOffsetPtr;
int i;
u32 r29;
if (r3 <= 0x44 && r3 + 0x4000 > 0x44 && gTRKCPUState.Extended1.DBAT3U & 3) {
r3 = 0x44;
} else {
r3 = EXCEPTIONMASK_ADDR;
}
i = 0;
r29 = *(u32*)r3;
isrOffsetPtr = TRK_ISR_OFFSETS;
do {
if ((r29 & (1 << i)) && i != 4) {
TRK_copy_vector(isrOffsetPtr[i]);
}
i++;
} while (i <= 14);
}
/* 803719AC-803719F8 36C2EC 004C+00 0/0 1/1 0/0 .text TRKInitializeTarget */
DSError TRKInitializeTarget() {
gTRKState.isStopped = TRUE;
gTRKState.msr = __TRK_get_MSR();
lc_base = 0xE0000000;
return DS_NoError;
}
#define __dcbi(a, b) asm { dcbi a, b }
#define __dcbfASM(a, b) asm { dcbf a, b }
/* 80371878-803719AC 36C1B8 0134+00 0/0 1/1 0/0 .text TRK__read_aram */
void TRK__read_aram(register int c, register u32 p2, void* p3) {
u32 err;
int i;
register int counter;
u16 r;
u32 g;
u32 x;
u32 size;
if ((size_t)p2 < 0x4000 || p2 + *(u32*)p3 > 0x8000000) {
return;
}
x = p2 & ~0x1F;
size = *(u32*)p3 + (p2 & 0x1F);
size = OSRoundUp32B(size);
counter = 0;
for (i = 0; i < size; i += 0x20) {
__dcbi(counter, c);
counter += 0x20;
}
do {
err = ARGetDMAStatus();
} while (err);
r = __ARGetInterruptStatus();
g = 0x8000000;
__ARClearInterrupt();
ARStartDMA(1, c, x, size);
while (!__ARGetInterruptStatus()) {
}
if (!r) {
__ARClearInterrupt();
}
}
/* 8037168C-80371878 36BFCC 01EC+00 0/0 1/1 0/0 .text TRK__write_aram */
void TRK__write_aram(register int c, register u32 p2, void* p3) {
u8 buff[32] ALIGN_DECL(32);
u32 err;
register int count = c;
register u32 bf;
u32 uVar1;
u32 size;
u16 r;
register u32 g;
register int counter;
u32 i;
if ((size_t)p2 < 0x4000 || p2 + *(u32*)p3 > 0x8000000) {
return;
}
uVar1 = p2 & ~0x1f;
counter = 0;
size = *(u32*)p3 + (p2 & 0x1f);
size = OSRoundUp32B(size);
for (i = 0; i < size; i += 0x20) {
__dcbf((void*)counter, count);
counter += 0x20;
}
do {
err = ARGetDMAStatus();
} while (err);
r = __ARGetInterruptStatus();
g = 0x8000000;
counter = p2 & 0x1f;
if (counter) {
g = uVar1;
bf = (u32)buff;
__dcbi(r0, bf);
__ARClearInterrupt();
ARStartDMA(1, bf, uVar1, 0x20);
while (!__ARGetInterruptStatus()) {
}
TRK_memcpy((void*)c, buff, counter);
__dcbfASM(r0, c);
}
p2 += *(u32*)p3;
counter = p2 & 0x1f;
if (counter) {
u32 val = p2 & ~0x1F;
if (val != g) {
bf = (u32)buff;
__dcbi(r0, bf);
__ARClearInterrupt();
ARStartDMA(1, bf, val, 0x20);
while (!__ARGetInterruptStatus()) {
}
}
g = c + p2;
TRK_memcpy((void*)g, (void*)(buff + counter), 0x20 - counter);
__dcbfASM(r0, g);
}
__sync();
__ARClearInterrupt();
ARStartDMA(0, c, uVar1, size);
if (!r) {
while (!__ARGetInterruptStatus()) {
}
__ARClearInterrupt();
}
}
/* 80371560-803715F8 36BEA0 0098+00 0/0 1/1 0/0 .text InitMetroTRK */
asm void InitMetroTRK() {
// clang-format off
nofralloc
addi r1, r1, -4
stw r3, 0(r1)
lis r3, gTRKCPUState@h
ori r3, r3, gTRKCPUState@l
stmw r0, ProcessorState_PPC.Default.GPR(r3) //Save the gprs
lwz r4, 0(r1)
addi r1, r1, 4
stw r1, ProcessorState_PPC.Default.GPR[1](r3)
stw r4, ProcessorState_PPC.Default.GPR[3](r3)
mflr r4
stw r4, ProcessorState_PPC.Default.LR(r3)
stw r4, ProcessorState_PPC.Default.PC(r3)
mfcr r4
stw r4, ProcessorState_PPC.Default.CR(r3)
//???
mfmsr r4
ori r3, r4, (1 << (31 - 16))
xori r3, r3, (1 << (31 - 16))
mtmsr r3
mtsrr1 r4 //Copy msr to srr1
//Save misc registers to gTRKCPUState
bl TRKSaveExtended1Block
lis r3, gTRKCPUState@h
ori r3, r3, gTRKCPUState@l
lmw r0, ProcessorState_PPC.Default.GPR(r3) //Restore the gprs
//Reset IABR and DABR
li r0, 0
mtspr 0x3f2, r0
mtspr 0x3f5, r0
//Restore stack pointer
lis r1, 0x80459BC8@h
ori r1, r1, 0x80459BC8@l
mr r3, r5
bl InitMetroTRKCommTable //Initialize comm table
/*
If InitMetroTRKCommTable returned 1 (failure), an invalid hardware
id or the id for GDEV was somehow passed. Since only BBA or NDEV
are supported, we return early. Otherwise, we proceed with
starting up TRK.
*/
cmpwi r3, 1
bne initCommTableSuccess
/*
BUG: The code probably orginally reloaded gTRKCPUState here, but
as is it will read the returned value of InitMetroTRKCommTable
as a TRKCPUState struct pointer, causing the CPU to return to
a garbage code address.
*/
lwz r4, ProcessorState_PPC.Default.LR(r3)
mtlr r4
lmw r0, ProcessorState_PPC.Default.GPR(r3) //Restore the gprs
blr
initCommTableSuccess:
b TRK_main //Jump to TRK_main
blr
// clang-format on
}
/* 803715F8-8037168C 36BF38 0094+00 0/0 1/1 0/0 .text InitMetroTRK_BBA */
asm void InitMetroTRK_BBA() {
// clang-format off
nofralloc
addi r1, r1, -4
stw r3, 0(r1)
lis r3, gTRKCPUState@h
ori r3, r3, gTRKCPUState@l
stmw r0, ProcessorState_PPC.Default.GPR(r3) //Save the gprs
lwz r4, 0(r1)
addi r1, r1, 4
stw r1, ProcessorState_PPC.Default.GPR[1](r3)
stw r4, ProcessorState_PPC.Default.GPR[3](r3)
mflr r4
stw r4, ProcessorState_PPC.Default.LR(r3)
stw r4, ProcessorState_PPC.Default.PC(r3)
mfcr r4
stw r4, ProcessorState_PPC.Default.CR(r3)
//Turn on external interrupts
mfmsr r4
ori r3, r4, (1 << (31 - 16))
mtmsr r3
mtsrr1 r4 //Copy original msr to srr1
//Save misc registers to gTRKCPUState
bl TRKSaveExtended1Block
lis r3, gTRKCPUState@h
ori r3, r3, gTRKCPUState@l
lmw r0, ProcessorState_PPC.Default.GPR(r3) //Restore the gprs
//Reset IABR and DABR
li r0, 0
mtspr 0x3f2, r0
mtspr 0x3f5, r0
//Restore the stack pointer
lis r1, 0x80459BC8@h
ori r1, r1, 0x80459BC8@l
li r3, 2
bl InitMetroTRKCommTable //Initialize comm table as BBA hardware
/*
If InitMetroTRKCommTable returned 1 (failure), something went wrong
or whatever reason. If everything goes as expected, we proceed with
starting up TRK.
*/
cmpwi r3, 1
bne initCommTableSuccess
/*
BUG: The code probably orginally reloaded gTRKCPUState here, but
as is it will read the returned value of InitMetroTRKCommTable
as a TRKCPUState struct pointer, causing the CPU to return to
a garbage code address.
*/
lwz r4, ProcessorState_PPC.Default.LR(r3)
mtlr r4
lmw r0, ProcessorState_PPC.Default.GPR(r3)
blr
initCommTableSuccess:
b TRK_main //Jump to TRK_main
blr
// clang-format on
}
@@ -1,94 +1,140 @@
//
// Generated By: dol2asm
// Translation Unit: Os/dolphin/dolphin_trk_glue
//
#include "TRK_MINNOW_DOLPHIN/Os/dolphin/dolphin_trk_glue.h"
#include "dol2asm.h"
#include "TRK_MINNOW_DOLPHIN/Os/dolphin/DDH_Stubs.h"
#include "TRK_MINNOW_DOLPHIN/Os/dolphin/GDEV_Stubs.h"
#include "TRK_MINNOW_DOLPHIN/Os/dolphin/UDP_Stubs.h"
#include "dolphin/base/PPCArch.h"
#include "trk.h"
//
// Forward References:
//
static void TRKLoadContext();
void TRKUARTInterruptHandler();
void InitializeProgramEndTrap();
void TRK_board_display();
int TRKReadUARTN(void*, u32);
int TRKPollUART();
void EnableEXI2Interrupts();
int TRKInitializeIntDrivenUART();
void InitMetroTRKCommTable();
static void TRKEXICallBack(s16 param_0, OSContext* ctx);
SECTION_BSS extern u8 data_8044F828[8];
//
// External References:
//
SECTION_INIT void TRK_memcpy();
void PPCHalt();
void DCFlushRange();
void ICInvalidateRange();
void TRKInterruptHandler();
s32 udp_cc_post_stop();
s32 udp_cc_pre_continue();
u8 udp_cc_peek();
u8 udp_cc_write();
u8 udp_cc_read();
s32 udp_cc_close();
s32 udp_cc_open();
s32 udp_cc_shutdown();
s32 udp_cc_initialize();
void ddh_cc_initinterrupts();
void ddh_cc_peek();
void ddh_cc_post_stop();
void ddh_cc_pre_continue();
void ddh_cc_write();
void ddh_cc_read();
u8 ddh_cc_close();
void ddh_cc_open();
u8 ddh_cc_shutdown();
void ddh_cc_initialize();
void gdev_cc_initinterrupts();
void gdev_cc_peek();
void gdev_cc_post_stop();
void gdev_cc_pre_continue();
void gdev_cc_write();
void gdev_cc_read();
u8 gdev_cc_close();
void gdev_cc_open();
u8 gdev_cc_shutdown();
void gdev_cc_initialize();
u8 AMC_IsStub();
u8 Hu_IsStub();
//
// Declarations:
//
/* 8044F824-8044F828 07C544 0004+00 0/0 0/0 0/0 .bss _MetroTRK_Has_Framing */
BOOL _MetroTRK_Has_Framing;
/* 80371BF4-80371C7C 36C534 0088+00 1/1 0/0 0/0 .text TRKLoadContext */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
static asm void TRKLoadContext() {
nofralloc
#include "asm/TRK_MINNOW_DOLPHIN/Os/dolphin/dolphin_trk_glue/TRKLoadContext.s"
}
#pragma pop
u8 TRK_Use_BBA;
/* 80371C7C-80371C80 36C5BC 0004+00 0/0 1/1 0/0 .text TRKUARTInterruptHandler */
void TRKUARTInterruptHandler() {
/* empty function */
/* 803D32A8-803D32D0 0303C8 0028+00 8/8 0/0 0/0 .data gDBCommTable */
DBCommTable gDBCommTable = {};
/* 80372114-8037214C 36CA54 0038+00 1/1 0/0 0/0 .text TRKEXICallBack */
void TRKEXICallBack(s16 param_0, OSContext* ctx) {
OSEnableScheduler();
TRKLoadContext(ctx, 0x500);
}
/* ############################################################################################## */
/* 803A2C08-803A2C0C 02F268 0004+00 2/2 0/0 0/0 .rodata EndofProgramInstruction$162 */
SECTION_RODATA static u32 const EndofProgramInstruction = 0x00454E44; // \0END
COMPILER_STRIP_GATE(0x803A2C08, &EndofProgramInstruction);
/* 80371EA8-80372114 36C7E8 026C+00 0/0 2/2 0/0 .text InitMetroTRKCommTable */
int InitMetroTRKCommTable(int hwId) {
int result = 1;
OSReport("Devkit set to : %ld\n", hwId);
TRK_Use_BBA = 0;
if (hwId == HARDWARE_BBA) { // BBA hardware
OSReport("MetroTRK : Set to BBA\n");
// Initialize gDBCommTable
TRK_Use_BBA = 1;
gDBCommTable.initialize_func = udp_cc_initialize;
gDBCommTable.open_func = udp_cc_open;
gDBCommTable.close_func = udp_cc_close;
gDBCommTable.read_func = udp_cc_read;
gDBCommTable.write_func = udp_cc_write;
gDBCommTable.shutdown_func = udp_cc_shutdown;
gDBCommTable.peek_func = udp_cc_peek;
gDBCommTable.pre_continue_func = udp_cc_pre_continue;
gDBCommTable.post_stop_func = udp_cc_post_stop;
gDBCommTable.init_interrupts_func = NULL;
return 0;
}
if (hwId == HARDWARE_GDEV) { // NDEV hardware
OSReport("MetroTRK : Set to GDEV hardware\n");
// Initialize gDBCommTable
result = Hu_IsStub();
gDBCommTable.initialize_func = gdev_cc_initialize;
gDBCommTable.open_func = gdev_cc_open;
gDBCommTable.close_func = gdev_cc_close;
gDBCommTable.read_func = gdev_cc_read;
gDBCommTable.write_func = gdev_cc_write;
gDBCommTable.shutdown_func = gdev_cc_shutdown;
gDBCommTable.peek_func = gdev_cc_peek;
gDBCommTable.pre_continue_func = gdev_cc_pre_continue;
gDBCommTable.post_stop_func = gdev_cc_post_stop;
gDBCommTable.init_interrupts_func = gdev_cc_initinterrupts;
} else if (hwId == HARDWARE_AMC_DDH) {
OSReport("MetroTRK : Set to AMC DDH hardware\n");
result = AMC_IsStub();
// Initialize gDBCommTable
gDBCommTable.initialize_func = ddh_cc_initialize;
gDBCommTable.open_func = ddh_cc_open;
gDBCommTable.close_func = ddh_cc_close;
gDBCommTable.read_func = ddh_cc_read;
gDBCommTable.write_func = ddh_cc_write;
gDBCommTable.shutdown_func = ddh_cc_shutdown;
gDBCommTable.peek_func = ddh_cc_peek;
gDBCommTable.pre_continue_func = ddh_cc_pre_continue;
gDBCommTable.post_stop_func = ddh_cc_post_stop;
gDBCommTable.init_interrupts_func = ddh_cc_initinterrupts;
} else { // unknown hardware
OSReport("MetroTRK : Set to UNKNOWN hardware. (%ld)\n", hwId);
OSReport("MetroTRK : Invalid hardware ID passed from OS\n");
OSReport("MetroTRK : Defaulting to GDEV Hardware\n");
}
return result;
}
/* 80371E58-80371EA8 36C798 0050+00 0/0 1/1 0/0 .text TRKInitializeIntDrivenUART */
DSError TRKInitializeIntDrivenUART(u32 param_0, u32 param_1, u32 param_2, void* param_3) {
gDBCommTable.initialize_func(param_3, TRKEXICallBack);
gDBCommTable.open_func();
return DS_NoError;
}
/* 80371E10-80371E58 36C750 0048+00 0/0 1/1 0/0 .text EnableEXI2Interrupts */
void EnableEXI2Interrupts(void) {
if (!TRK_Use_BBA) {
if (gDBCommTable.init_interrupts_func != NULL) {
gDBCommTable.init_interrupts_func();
}
}
}
/* 80371DE0-80371E10 36C720 0030+00 0/0 1/1 0/0 .text TRKPollUART */
int TRKPollUART(void) {
return gDBCommTable.peek_func();
}
/* 80371DA4-80371DE0 36C6E4 003C+00 0/0 1/1 0/0 .text TRKReadUARTN */
UARTError TRKReadUARTN(void* bytes, u32 length) {
int readErr = gDBCommTable.read_func(bytes, length);
return ((-readErr | readErr) >> 31);
}
/* 80371D68-80371DA4 36C6A8 003C+00 0/0 13/13 0/0 .text TRKWriteUARTN */
UARTError TRKWriteUARTN(const void* bytes, u32 length) {
int writeErr = gDBCommTable.write_func(bytes, length);
return ((-writeErr | writeErr) >> 31);
}
/* 80371D38-80371D68 36C678 0030+00 0/0 1/1 0/0 .text ReserveEXI2Port */
void ReserveEXI2Port(void) {
gDBCommTable.post_stop_func();
}
/* 80371D08-80371D38 36C648 0030+00 0/0 1/1 0/0 .text UnreserveEXI2Port */
void UnreserveEXI2Port(void) {
gDBCommTable.pre_continue_func();
}
/* 80371CD8-80371D08 36C618 0030+00 0/0 1/1 0/0 .text TRK_board_display */
void TRK_board_display(char* str) {
OSReport("%s\n", str);
}
/* 80371C80-80371CD8 36C5C0 0058+00 0/0 1/1 0/0 .text InitializeProgramEndTrap */
void InitializeProgramEndTrap() {
DSError InitializeProgramEndTrap(void) {
static const u32 EndofProgramInstruction = 'END';
u8* endOfProgramInstructionBytes = (u8*)&EndofProgramInstruction;
u8* ppcHaltPtr = (u8*)PPCHalt;
TRK_memcpy(ppcHaltPtr + 4, endOfProgramInstructionBytes, 4);
@@ -96,142 +142,48 @@ void InitializeProgramEndTrap() {
DCFlushRange(ppcHaltPtr + 4, 4);
}
/* ############################################################################################## */
/* 803A2C0C-803A2C10 02F26C 0004+00 1/1 0/0 0/0 .rodata @165 */
SECTION_RODATA static char const lit_165[] = "%s\n";
COMPILER_STRIP_GATE(0x803A2C0C, &lit_165);
/* 80371C7C-80371C80 36C5BC 0004+00 0/0 1/1 0/0 .text TRKUARTInterruptHandler */
void TRKUARTInterruptHandler() {}
/* 80371CD8-80371D08 36C618 0030+00 0/0 1/1 0/0 .text TRK_board_display */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void TRK_board_display() {
nofralloc
#include "asm/TRK_MINNOW_DOLPHIN/Os/dolphin/dolphin_trk_glue/TRK_board_display.s"
/* 80371BF4-80371C7C 36C534 0088+00 1/1 0/0 0/0 .text TRKLoadContext */
asm void TRKLoadContext(OSContext* ctx, u32) {
// clang-format off
nofralloc
lwz r0, OSContext.gpr[0](r3)
lwz r1, OSContext.gpr[1](r3)
lwz r2, OSContext.gpr[2](r3)
lhz r5, OSContext.state(r3)
rlwinm. r6, r5, 0, 0x1e, 0x1e
beq lbl_80371C1C
rlwinm r5, r5, 0, 0x1f, 0x1d
sth r5, OSContext.state(r3)
lmw r5, OSContext.gpr[5](r3)
b lbl_80371C20
lbl_80371C1C:
lmw r13, OSContext.gpr[13](r3)
lbl_80371C20:
mr r31, r3
mr r3, r4
lwz r4, OSContext.cr(r31)
mtcrf 0xff, r4
lwz r4, OSContext.lr(r31)
mtlr r4
lwz r4, OSContext.ctr(r31)
mtctr r4
lwz r4, OSContext.xer(r31)
mtxer r4
mfmsr r4
rlwinm r4, r4, 0, 0x11, 0xf //Turn off external exceptions
rlwinm r4, r4, 0, 0x1f, 0x1d //Turn off recoverable exception flag
mtmsr r4
mtsprg 1, r2
lwz r4, OSContext.gpr[3](r31)
mtsprg 2, r4
lwz r4, OSContext.gpr[4](r31)
mtsprg 3, r4
lwz r2, OSContext.srr0(r31)
lwz r4, OSContext.srr1(r31)
lwz r31, OSContext.gpr[31](r31)
b TRKInterruptHandler
// clang-format on
}
#pragma pop
/* ############################################################################################## */
/* 803D32A8-803D32D0 0303C8 0028+00 8/8 0/0 0/0 .data gDBCommTable */
static DBCommTable gDBCommTable = {};
/* 80371D08-80371D38 36C648 0030+00 0/0 1/1 0/0 .text UnreserveEXI2Port */
void UnreserveEXI2Port() {
gDBCommTable.pre_continue_func();
}
/* 80371D38-80371D68 36C678 0030+00 0/0 1/1 0/0 .text ReserveEXI2Port */
void ReserveEXI2Port() {
gDBCommTable.post_stop_func();
}
/* 80371D68-80371DA4 36C6A8 003C+00 0/0 13/13 0/0 .text TRKWriteUARTN */
s32 TRKWriteUARTN(const void* bytes, u32 length) {
int r3 = gDBCommTable.write_func(bytes, length);
return ((-r3 | r3)) >> 31;
}
/* 80371DA4-80371DE0 36C6E4 003C+00 0/0 1/1 0/0 .text TRKReadUARTN */
int TRKReadUARTN(void* bytes, u32 limit) {
int r3 = gDBCommTable.read_func(bytes, limit);
return ((-r3 | r3)) >> 31;
}
/* 80371DE0-80371E10 36C720 0030+00 0/0 1/1 0/0 .text TRKPollUART */
int TRKPollUART() {
return gDBCommTable.peek_func();
}
/* ############################################################################################## */
/* 8044F820-8044F824 07C540 0004+00 2/2 0/0 0/0 .bss None */
SECTION_BSS static u8 data_8044F820[4];
/* 80371E10-80371E58 36C750 0048+00 0/0 1/1 0/0 .text EnableEXI2Interrupts */
void EnableEXI2Interrupts() {
if (!*data_8044F820) {
if (gDBCommTable.initinterrupts_func != NULL) {
gDBCommTable.initinterrupts_func();
}
}
}
/* 80371E58-80371EA8 36C798 0050+00 0/0 1/1 0/0 .text TRKInitializeIntDrivenUART */
int TRKInitializeIntDrivenUART(u32 param_0, u32 param_1, u32 param_2, void* param_3) {
gDBCommTable.initialize_func(param_3, TRKEXICallBack);
gDBCommTable.open_func();
return 0;
}
/* ############################################################################################## */
/* 803A2C10-803A2C28 02F270 0015+03 0/1 0/0 0/0 .rodata @215 */
#pragma push
#pragma force_active on
SECTION_RODATA static char const lit_215[] = "Devkit set to : %ld\n";
COMPILER_STRIP_GATE(0x803A2C10, &lit_215);
#pragma pop
/* 803A2C28-803A2C40 02F288 0017+01 0/1 0/0 0/0 .rodata @216 */
#pragma push
#pragma force_active on
SECTION_RODATA static char const lit_216[] = "MetroTRK : Set to BBA\n";
COMPILER_STRIP_GATE(0x803A2C28, &lit_216);
#pragma pop
/* 803A2C40-803A2C64 02F2A0 0021+03 0/1 0/0 0/0 .rodata @217 */
#pragma push
#pragma force_active on
SECTION_RODATA static char const lit_217[] = "MetroTRK : Set to GDEV hardware\n";
COMPILER_STRIP_GATE(0x803A2C40, &lit_217);
#pragma pop
/* 803A2C64-803A2C88 02F2C4 0024+00 0/1 0/0 0/0 .rodata @218 */
#pragma push
#pragma force_active on
SECTION_RODATA static char const lit_218[] = "MetroTRK : Set to AMC DDH hardware\n";
COMPILER_STRIP_GATE(0x803A2C64, &lit_218);
#pragma pop
/* 803A2C88-803A2CB4 02F2E8 002B+01 0/1 0/0 0/0 .rodata @219 */
#pragma push
#pragma force_active on
SECTION_RODATA static char const lit_219[] = "MetroTRK : Set to UNKNOWN hardware. (%ld)\n";
COMPILER_STRIP_GATE(0x803A2C88, &lit_219);
#pragma pop
/* 803A2CB4-803A2CE4 02F314 002F+01 0/1 0/0 0/0 .rodata @220 */
#pragma push
#pragma force_active on
SECTION_RODATA static char const lit_220[] = "MetroTRK : Invalid hardware ID passed from OS\n";
COMPILER_STRIP_GATE(0x803A2CB4, &lit_220);
#pragma pop
/* 803A2CE4-803A2D10 02F344 0028+04 0/1 0/0 0/0 .rodata @221 */
#pragma push
#pragma force_active on
SECTION_RODATA static char const lit_221[] = "MetroTRK : Defaulting to GDEV Hardware\n";
COMPILER_STRIP_GATE(0x803A2CE4, &lit_221);
#pragma pop
/* 80371EA8-80372114 36C7E8 026C+00 0/0 2/2 0/0 .text InitMetroTRKCommTable */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void InitMetroTRKCommTable() {
nofralloc
#include "asm/TRK_MINNOW_DOLPHIN/Os/dolphin/dolphin_trk_glue/InitMetroTRKCommTable.s"
}
#pragma pop
/* 80372114-8037214C 36CA54 0038+00 1/1 0/0 0/0 .text TRKEXICallBack */
static void TRKEXICallBack(s16 param_0, OSContext* ctx) {
OSEnableScheduler();
TRKLoadContext(ctx, 0x500);
}
/* ############################################################################################## */
/* 8044F828-8044F830 07C548 0008+00 0/0 2/2 0/0 .bss None */
SECTION_BSS extern u8 data_8044F828[8];
SECTION_BSS u8 data_8044F828[8];
/* 8044F824-8044F828 07C544 0004+00 0/0 0/0 0/0 .bss _MetroTRK_Has_Framing */
SECTION_BSS /* static */ u8 _MetroTRK_Has_Framing[4];
+1 -1
View File
@@ -4,7 +4,7 @@
*/
#include "TRK_MINNOW_DOLPHIN/Os/dolphin/usr_put.h"
// #include "dolphin/os/OS.h"
// #include "dolphin/os.h"
// void OSReport(char* fmt, ...) causes extra crclr instruction.
// look into issue later
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -17,7 +17,7 @@
#include "stdio.h"
#include "stdlib.h"
#include "dol2asm.h"
#include "dolphin/os/OS.h"
#include "dolphin/os.h"
//
// Types:
+1 -1
View File
@@ -7,7 +7,7 @@
#include "Z2AudioLib/Z2Creature.h"
#include "d/com/d_com_inf_game.h"
#include "dol2asm.h"
#include "dolphin/os/OS.h"
#include "dolphin/os.h"
#include "global.h"
//
+1 -1
View File
@@ -13,7 +13,7 @@
#include "JSystem/JAudio2/JAUSoundTable.h"
#include "JSystem/JUtility/JUTAssert.h"
#include "dol2asm.h"
#include "dolphin/dvd/dvd.h"
#include "dolphin/dvd.h"
//
// Types:
+1 -1
View File
@@ -10,7 +10,7 @@
#include "Z2AudioLib/Z2SceneMgr.h"
#include "Z2AudioLib/Z2SoundMgr.h"
#include "Z2AudioLib/Z2Audience.h"
#include "dolphin/os/OS.h"
#include "dolphin/os.h"
#include "d/d_demo.h"
/* ############################################################################################## */
+12 -19
View File
@@ -1,12 +1,9 @@
//
// Generated By: dol2asm
// Translation Unit: ai
//
#include "dolphin/ai.h"
#include "dolphin/dsp.h"
#include "dolphin/os.h"
#include "dolphin/ai/ai.h"
#include "dol2asm.h"
#include "dolphin/dsp/dsp.h"
#include "dolphin/os/OS.h"
/* 80450A40-80450A48 -00001 0004+04 1/1 0/0 0/0 .sdata __AIVersion */
char* __AIVersion = "<< Dolphin SDK - AI\trelease build: Apr 5 2004 04:15:02 (0x2301) >>";
void __AISHandler(s16 interrupt, OSContext* context);
void __AIDHandler(s16 interrupt, OSContext* context);
@@ -81,7 +78,7 @@ void AISetStreamPlayState(u32 state) {
}
/* 8034FE44-8034FE54 34A784 0010+00 1/1 0/0 0/0 .text AIGetStreamPlayState */
inline u32 AIGetStreamPlayState(void) {
u32 AIGetStreamPlayState(void) {
return __AIRegs[0] & 1;
}
@@ -177,14 +174,6 @@ u8 AIGetStreamVolRight(void) {
return __AIRegs[1] >> 8;
}
/* ############################################################################################## */
/* 803D1BA0-803D1BE8 02ECC0 0044+04 1/0 0/0 0/0 .data @1 */
SECTION_DATA static char lit_1[] =
"<< Dolphin SDK - AI\trelease build: Apr 5 2004 04:15:02 (0x2301) >>";
/* 80450A40-80450A48 -00001 0004+04 1/1 0/0 0/0 .sdata __AIVersion */
SECTION_SDATA static const char* __AIVersion = lit_1;
/* 80451880-80451884 000D80 0004+00 3/3 0/0 0/0 .sbss __CallbackStack */
static u8* __CallbackStack;
@@ -212,9 +201,13 @@ static OSTime max_wait;
/* 804518B0-804518B4 000DB0 0004+00 2/2 0/0 0/0 .sbss buffer */
static OSTime buffer;
inline void AIResetStreamSampleCount(void) { __AIRegs[0] = (__AIRegs[0] & ~0x20) | 0x20; }
void AIResetStreamSampleCount(void) {
__AIRegs[0] = (__AIRegs[0] & ~0x20) | 0x20;
}
inline void AISetStreamTrigger(u32 trigger) { __AIRegs[3] = trigger; }
void AISetStreamTrigger(u32 trigger) {
__AIRegs[3] = trigger;
}
/* 80350084-803501F0 34A9C4 016C+00 0/0 1/1 0/0 .text AIInit */
void AIInit(u8* stack) {
+1
View File
@@ -16,6 +16,7 @@ LIBAR_A_CFLAGS := \
-fp hard \
-nodefaults \
-str reuse \
-inline auto \
-RTTI off \
-maxerrors 5 \
-enum int $(INCLUDES) \
+195 -167
View File
@@ -1,21 +1,16 @@
//
// Generated By: dol2asm
// Translation Unit: ar
//
#include "dolphin/ar/ar.h"
#include "string.h"
#include "dol2asm.h"
#include "dolphin/ar.h"
#include "dolphin/base/PPCArch.h"
#include "dolphin/dsp/dsp.h"
#include "dolphin/os/OS.h"
#include "dolphin/dsp.h"
#include "dolphin/os.h"
#include "string.h"
/* 80450A48-80450A50 -00001 0004+04 1/1 0/0 0/0 .sdata __ARVersion */
char* __ARVersion = "<< Dolphin SDK - AR\trelease build: Apr 5 2004 04:15:03 (0x2301) >>";
void __ARHandler(s16 interrupt, OSContext* context);
void __ARClearInterrupt();
u16 __ARGetInterruptStatus();
void __ARChecksize();
/* ############################################################################################## */
/* 804518B8-804518BC 000DB8 0004+00 3/3 0/0 0/0 .sbss __AR_Callback */
static ARCallback __AR_Callback;
@@ -91,14 +86,6 @@ u32 ARAlloc(u32 length) {
return tmp;
}
/* ############################################################################################## */
/* 803D1BE8-803D1C30 02ED08 0044+04 1/0 0/0 0/0 .data @1 */
SECTION_DATA static char lit_1[] =
"<< Dolphin SDK - AR\trelease build: Apr 5 2004 04:15:03 (0x2301) >>";
/* 80450A48-80450A50 -00001 0004+04 1/1 0/0 0/0 .sdata __ARVersion */
SECTION_SDATA static const char* __ARVersion = lit_1;
/* 804518D4-804518D8 000DD4 0004+00 1/1 0/0 0/0 .sbss __AR_init_flag */
static volatile BOOL __AR_init_flag;
@@ -164,206 +151,247 @@ static void __ARHandler(s16 interrupt, OSContext* context) {
/* 80350870-80350890 34B1B0 0020+00 0/0 2/2 0/0 .text __ARClearInterrupt */
void __ARClearInterrupt(void) {
u16 tmp;
tmp = __DSPRegs[5];
tmp = (u16)((tmp & ~(0x00000080 | 0x00000008)) | 0x00000020);
__DSPRegs[5] = tmp;
u16 tmp;
tmp = __DSPRegs[5];
tmp = (u16)((tmp & ~(0x00000080 | 0x00000008)) | 0x00000020);
__DSPRegs[5] = tmp;
}
/* 80350890-803508A0 34B1D0 0010+00 0/0 2/2 0/0 .text __ARGetInterruptStatus */
u16 __ARGetInterruptStatus(void) {
u16 __ARGetInterruptStatus(void) {
return ((u16)(__DSPRegs[5] & 0x0020));
}
#define RoundUP32(x) (((u32)(x) + 32 - 1) & ~(32 - 1))
void __ARWaitForDMA() {
while (__DSPRegs[DSP_CONTROL_STATUS] & 0x0200) {
}
}
void __ARWriteDMA(u32 mmem_addr, u32 aram_addr, u32 length) {
// Main mem address
__DSPRegs[DSP_ARAM_DMA_MM_HI] =
(u16)((__DSPRegs[DSP_ARAM_DMA_MM_HI] & ~0x03ff) | (u16)(mmem_addr >> 16));
__DSPRegs[DSP_ARAM_DMA_MM_LO] =
(u16)((__DSPRegs[DSP_ARAM_DMA_MM_LO] & ~0xffe0) | (u16)(mmem_addr & 0xffff));
// ARAM address
__DSPRegs[DSP_ARAM_DMA_ARAM_HI] =
(u16)((__DSPRegs[DSP_ARAM_DMA_ARAM_HI] & ~0x03ff) | (u16)(aram_addr >> 16));
__DSPRegs[DSP_ARAM_DMA_ARAM_LO] =
(u16)((__DSPRegs[DSP_ARAM_DMA_ARAM_LO] & ~0xffe0) | (u16)(aram_addr & 0xffff));
// DMA buffer size
__DSPRegs[DSP_ARAM_DMA_SIZE_HI] = (u16)(__DSPRegs[DSP_ARAM_DMA_SIZE_HI] & ~0x8000);
__DSPRegs[DSP_ARAM_DMA_SIZE_HI] =
(u16)((__DSPRegs[DSP_ARAM_DMA_SIZE_HI] & ~0x03ff) | (u16)(length >> 16));
__DSPRegs[DSP_ARAM_DMA_SIZE_LO] =
(u16)((__DSPRegs[DSP_ARAM_DMA_SIZE_LO] & ~0xffe0) | (u16)(length & 0xffff));
__ARWaitForDMA();
__ARClearInterrupt();
}
void __ARReadDMA(u32 mmem_addr, u32 aram_addr, u32 length) {
// Main mem address
__DSPRegs[DSP_ARAM_DMA_MM_HI] =
(u16)((__DSPRegs[DSP_ARAM_DMA_MM_HI] & ~0x03ff) | (u16)(mmem_addr >> 16));
__DSPRegs[DSP_ARAM_DMA_MM_LO] =
(u16)((__DSPRegs[DSP_ARAM_DMA_MM_LO] & ~0xffe0) | (u16)(mmem_addr & 0xffff));
// ARAM address
__DSPRegs[DSP_ARAM_DMA_ARAM_HI] =
(u16)((__DSPRegs[DSP_ARAM_DMA_ARAM_HI] & ~0x03ff) | (u16)(aram_addr >> 16));
__DSPRegs[DSP_ARAM_DMA_ARAM_LO] =
(u16)((__DSPRegs[DSP_ARAM_DMA_ARAM_LO] & ~0xffe0) | (u16)(aram_addr & 0xffff));
// DMA buffer size
__DSPRegs[DSP_ARAM_DMA_SIZE_HI] = (u16)(__DSPRegs[DSP_ARAM_DMA_SIZE_HI] | 0x8000);
__DSPRegs[DSP_ARAM_DMA_SIZE_HI] =
(u16)((__DSPRegs[DSP_ARAM_DMA_SIZE_HI] & ~0x03ff) | (u16)(length >> 16));
__DSPRegs[DSP_ARAM_DMA_SIZE_LO] =
(u16)((__DSPRegs[DSP_ARAM_DMA_SIZE_LO] & ~0xffe0) | (u16)(length & 0xffff));
__ARWaitForDMA();
__ARClearInterrupt();
}
/* 803508A0-80352094 34B1E0 17F4+00 1/1 0/0 0/0 .text __ARChecksize */
#ifdef NONMATCHING
void __ARChecksize(void) {
void __ARChecksize() {
u8 test_data_pad[0x20 + 31];
u8 dummy_data_pad[0x20 + 31];
u8 buffer_pad[0x20 + 31];
u8 test_data_pad[0x20 + 31];
u8 dummy_data_pad[0x20 + 31];
u8 buffer_pad[0x20 + 31];
u8 save_pad_1[0x20 + 31];
u8 save_pad_2[0x20 + 31];
u8 save_pad_3[0x20 + 31];
u8 save_pad_4[0x20 + 31];
u8 save_pad_5[0x20 + 31];
u8 save_pad_1[0x20 + 31];
u8 save_pad_2[0x20 + 31];
u8 save_pad_3[0x20 + 31];
u8 save_pad_4[0x20 + 31];
u8 save_pad_5[0x20 + 31];
u32* test_data;
u32* dummy_data;
u32* buffer;
u32* save1;
u32* save2;
u32* save3;
u32* save4;
u32* save5;
u16 dspreg9;
u32* test_data;
u32* dummy_data;
u32* buffer;
u32* save1;
u32* save2;
u32* save3;
u32* save4;
u32* save5;
u16 ARAM_mode = 0;
u32 ARAM_size = 0;
u16 ARAM_mode = 0;
u32 ARAM_size = 0;
u32 i;
u32 i;
while (!(__DSPRegs[DSP_ARAM_MODE] & 1)) {
}
while (!(__DSPRegs[11] & 1))
;
ARAM_mode = 3;
ARAM_size = __AR_InternalSize = 0x1000000;
__DSPRegs[DSP_ARAM_SIZE] = (u16)((__DSPRegs[DSP_ARAM_SIZE] & ~(0x7 | 0x38)) | 0x20 | 2 | 1);
ARAM_mode = 3;
__DSPRegs[9] = (u16)((__DSPRegs[9] & ~(0x00000007 | 0x00000038)) | 0x20 | 2 | 1);
ARAM_size = __AR_InternalSize = 0x1000000;
test_data = (u32*)(OSRoundUp32B((u32)(test_data_pad)));
dummy_data = (u32*)(OSRoundUp32B((u32)(dummy_data_pad)));
buffer = (u32*)(OSRoundUp32B((u32)(buffer_pad)));
test_data = (u32*)(RoundUP32((u32)(test_data_pad)));
dummy_data = (u32*)(RoundUP32((u32)(dummy_data_pad)));
buffer = (u32*)(RoundUP32((u32)(buffer_pad)));
save1 = (u32*)(OSRoundUp32B((u32)(save_pad_1)));
save2 = (u32*)(OSRoundUp32B((u32)(save_pad_2)));
save3 = (u32*)(OSRoundUp32B((u32)(save_pad_3)));
save4 = (u32*)(OSRoundUp32B((u32)(save_pad_4)));
save5 = (u32*)(OSRoundUp32B((u32)(save_pad_5)));
save1 = (u32*)(RoundUP32((u32)(save_pad_1)));
save2 = (u32*)(RoundUP32((u32)(save_pad_2)));
save3 = (u32*)(RoundUP32((u32)(save_pad_3)));
save4 = (u32*)(RoundUP32((u32)(save_pad_4)));
save5 = (u32*)(RoundUP32((u32)(save_pad_5)));
for (i = 0; i < 8; i++) {
*(test_data + i) = 0xDEADBEEF;
*(dummy_data + i) = 0xBAD0BAD0;
}
for (i = 0; i < 8; i++) {
*(test_data + i) = 0xdeadbeef;
*(dummy_data + i) = 0xbad0bad0;
}
DCFlushRange((void*)test_data, 0x20);
DCFlushRange((void*)dummy_data, 0x20);
DCFlushRange((void*)test_data, 0x20);
DCFlushRange((void*)dummy_data, 0x20);
__AR_ExpansionSize = 0;
__AR_ExpansionSize = 0;
DCInvalidateRange((void*)save1, 0x20);
__ARReadDMA((u32)save1, ARAM_size + 0, 0x20);
PPCSync();
__ARWriteDMA((u32)test_data, ARAM_size + 0x0000000, 0x20);
memset((void*)buffer, 0, 0x20);
DCFlushRange((void*)buffer, 0x20);
__ARReadDMA((u32)buffer, ARAM_size + 0x0000000, 0x20);
PPCSync();
if (buffer[0] == test_data[0]) {
DCInvalidateRange((void*)save2, 0x20);
__ARReadDMA((u32)save2, ARAM_size + 0x0200000, 0x20);
DCInvalidateRange((void*)save1, 0x20);
__ARReadDMA((u32)save1, ARAM_size + 0, 0x20);
PPCSync();
DCInvalidateRange((void*)save3, 0x20);
__ARReadDMA((u32)save3, ARAM_size + 0x1000000, 0x20);
PPCSync();
DCInvalidateRange((void*)save4, 0x20);
__ARReadDMA((u32)save4, ARAM_size + 0x0000200, 0x20);
PPCSync();
DCInvalidateRange((void*)save5, 0x20);
__ARReadDMA((u32)save5, ARAM_size + 0x0400000, 0x20);
PPCSync();
__ARWriteDMA((u32)dummy_data, ARAM_size + 0x0200000, 0x20);
__ARWriteDMA((u32)test_data, ARAM_size + 0x0000000, 0x20);
memset((void*)buffer, 0, 0x20);
DCFlushRange((void*)buffer, 0x20);
__ARReadDMA((u32)buffer, ARAM_size + 0x0200000, 0x20);
__ARReadDMA((u32)buffer, ARAM_size + 0x0000000, 0x20);
PPCSync();
if (buffer[0] == test_data[0]) {
__ARWriteDMA((u32)save1, ARAM_size + 0x0000000, 0x20);
DCInvalidateRange((void*)save2, 0x20);
__ARReadDMA((u32)save2, ARAM_size + 0x0200000, 0x20);
PPCSync();
ARAM_mode |= 0 << 1;
ARAM_size += 0x0200000;
__AR_ExpansionSize = 0x0200000;
} else {
__ARWriteDMA((u32)dummy_data, ARAM_size + 0x1000000, 0x20);
DCInvalidateRange((void*)save3, 0x20);
__ARReadDMA((u32)save3, ARAM_size + 0x1000000, 0x20);
PPCSync();
__ARWriteDMA((u32)test_data, ARAM_size + 0x0000000, 0x20);
DCInvalidateRange((void*)save4, 0x20);
__ARReadDMA((u32)save4, ARAM_size + 0x0000200, 0x20);
PPCSync();
memset((void*)buffer, 0, 0x20);
DCFlushRange((void*)buffer, 0x20);
DCInvalidateRange((void*)save5, 0x20);
__ARReadDMA((u32)save5, ARAM_size + 0x0400000, 0x20);
PPCSync();
__ARReadDMA((u32)buffer, ARAM_size + 0x1000000, 0x20);
PPCSync();
if (buffer[0] == test_data[0]) {
__ARWriteDMA((u32)save1, ARAM_size + 0x0000000, 0x20);
__ARWriteDMA((u32)save2, ARAM_size + 0x0200000, 0x20);
ARAM_mode |= 4 << 1;
ARAM_size += 0x0400000;
__AR_ExpansionSize = 0x0400000;
} else {
__ARWriteDMA((u32)dummy_data, ARAM_size + 0x0000200, 0x20);
__ARWriteDMA((u32)dummy_data, ARAM_size + 0x0200000, 0x20);
__ARWriteDMA((u32)test_data, ARAM_size + 0x0000000, 0x20);
memset((void*)buffer, 0, 0x20);
DCFlushRange((void*)buffer, 0x20);
__ARReadDMA((u32)buffer, ARAM_size + 0x0000200, 0x20);
__ARReadDMA((u32)buffer, ARAM_size + 0x0200000, 0x20);
PPCSync();
if (buffer[0] == test_data[0]) {
__ARWriteDMA((u32)save1, ARAM_size + 0x0000000, 0x20);
__ARWriteDMA((u32)save2, ARAM_size + 0x0200000, 0x20);
__ARWriteDMA((u32)save3, ARAM_size + 0x1000000, 0x20);
__ARWriteDMA((u32)save1, ARAM_size + 0x0000000, 0x20);
ARAM_mode |= 8 << 1;
ARAM_size += 0x0800000;
__AR_ExpansionSize = 0x0800000;
ARAM_mode |= 0 << 1;
ARAM_size += 0x0200000;
__AR_ExpansionSize = 0x0200000;
} else {
__ARWriteDMA((u32)dummy_data, ARAM_size + 0x0400000, 0x20);
__ARWriteDMA((u32)dummy_data, ARAM_size + 0x1000000, 0x20);
__ARWriteDMA((u32)test_data, ARAM_size + 0x0000000, 0x20);
__ARWriteDMA((u32)test_data, ARAM_size + 0x0000000, 0x20);
memset((void*)buffer, 0, 0x20);
DCFlushRange((void*)buffer, 0x20);
memset((void*)buffer, 0, 0x20);
DCFlushRange((void*)buffer, 0x20);
__ARReadDMA((u32)buffer, ARAM_size + 0x0400000, 0x20);
PPCSync();
__ARReadDMA((u32)buffer, ARAM_size + 0x1000000, 0x20);
PPCSync();
if (buffer[0] == test_data[0]) {
__ARWriteDMA((u32)save1, ARAM_size + 0x0000000, 0x20);
__ARWriteDMA((u32)save2, ARAM_size + 0x0200000, 0x20);
__ARWriteDMA((u32)save3, ARAM_size + 0x1000000, 0x20);
__ARWriteDMA((u32)save4, ARAM_size + 0x0000200, 0x20);
if (buffer[0] == test_data[0]) {
__ARWriteDMA((u32)save1, ARAM_size + 0x0000000, 0x20);
__ARWriteDMA((u32)save2, ARAM_size + 0x0200000, 0x20);
ARAM_mode |= 12 << 1;
ARAM_size += 0x1000000;
__AR_ExpansionSize = 0x1000000;
} else {
__ARWriteDMA((u32)save1, ARAM_size + 0x0000000, 0x20);
__ARWriteDMA((u32)save2, ARAM_size + 0x0200000, 0x20);
__ARWriteDMA((u32)save3, ARAM_size + 0x1000000, 0x20);
__ARWriteDMA((u32)save4, ARAM_size + 0x0000200, 0x20);
__ARWriteDMA((u32)save5, ARAM_size + 0x0400000, 0x20);
ARAM_mode |= 4 << 1;
ARAM_size += 0x0400000;
__AR_ExpansionSize = 0x0400000;
} else {
__ARWriteDMA((u32)dummy_data, ARAM_size + 0x0000200, 0x20);
ARAM_mode |= 16 << 1;
ARAM_size += 0x2000000;
__AR_ExpansionSize = 0x2000000;
}
__ARWriteDMA((u32)test_data, ARAM_size + 0x0000000, 0x20);
memset((void*)buffer, 0, 0x20);
DCFlushRange((void*)buffer, 0x20);
__ARReadDMA((u32)buffer, ARAM_size + 0x0000200, 0x20);
PPCSync();
if (buffer[0] == test_data[0]) {
__ARWriteDMA((u32)save1, ARAM_size + 0x0000000, 0x20);
__ARWriteDMA((u32)save2, ARAM_size + 0x0200000, 0x20);
__ARWriteDMA((u32)save3, ARAM_size + 0x1000000, 0x20);
ARAM_mode |= 8 << 1;
ARAM_size += 0x0800000;
__AR_ExpansionSize = 0x0800000;
} else {
__ARWriteDMA((u32)dummy_data, ARAM_size + 0x0400000, 0x20);
__ARWriteDMA((u32)test_data, ARAM_size + 0x0000000, 0x20);
memset((void*)buffer, 0, 0x20);
DCFlushRange((void*)buffer, 0x20);
__ARReadDMA((u32)buffer, ARAM_size + 0x0400000, 0x20);
PPCSync();
if (buffer[0] == test_data[0]) {
__ARWriteDMA((u32)save1, ARAM_size + 0x0000000, 0x20);
__ARWriteDMA((u32)save2, ARAM_size + 0x0200000, 0x20);
__ARWriteDMA((u32)save3, ARAM_size + 0x1000000, 0x20);
__ARWriteDMA((u32)save4, ARAM_size + 0x0000200, 0x20);
ARAM_mode |= 12 << 1;
ARAM_size += 0x1000000;
__AR_ExpansionSize = 0x1000000;
} else {
__ARWriteDMA((u32)save1, ARAM_size + 0x0000000, 0x20);
__ARWriteDMA((u32)save2, ARAM_size + 0x0200000, 0x20);
__ARWriteDMA((u32)save3, ARAM_size + 0x1000000, 0x20);
__ARWriteDMA((u32)save4, ARAM_size + 0x0000200, 0x20);
__ARWriteDMA((u32)save5, ARAM_size + 0x0400000, 0x20);
ARAM_mode |= 16 << 1;
ARAM_size += 0x2000000;
__AR_ExpansionSize = 0x2000000;
}
}
}
}
}
__DSPRegs[DSP_ARAM_SIZE] = (u16)((__DSPRegs[DSP_ARAM_SIZE] & ~(0x7 | 0x38)) | ARAM_mode);
}
__DSPRegs[9] = (u16)((__DSPRegs[9] & ~(0x07 | 0x38)) | ARAM_mode);
}
*(u32*)OSPhysicalToUncached(0x00D0) = ARAM_size;
*(u32*)OSPhysicalToUncached(0x00D0) = ARAM_size;
__AR_Size = ARAM_size;
__AR_Size = ARAM_size;
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void __ARChecksize() {
nofralloc
#include "asm/dolphin/ar/ar/__ARChecksize.s"
}
#pragma pop
#endif
+5 -24
View File
@@ -1,26 +1,13 @@
//
// Generated By: dol2asm
// Translation Unit: arq
//
#include "dolphin/arq.h"
#include "dolphin/ar.h"
#include "dolphin/ar/arq.h"
#include "dolphin/ar/ar.h"
#include "dolphin/types.h"
//
// Forward References:
//
/* 803D1C30-803D1C78 02ED50 0045+03 1/0 0/0 0/0 .data @1 */
char* __ARQVersion = "<< Dolphin SDK - ARQ\trelease build: Apr 5 2004 04:15:04 (0x2301) >>";
void __ARQServiceQueueLo();
void __ARQCallbackHack();
void __ARQInterruptServiceRoutine();
void ARQInit();
//
// Declarations:
//
/* ############################################################################################## */
/* 804518D8-804518DC 000DD8 0004+00 3/3 0/0 0/0 .sbss __ARQRequestQueueHi */
static ARQRequest* __ARQRequestQueueHi;
@@ -48,13 +35,9 @@ static ARQCallback __ARQCallbackLo;
/* 804518F8-804518FC 000DF8 0004+00 2/2 0/0 0/0 .sbss __ARQChunkSize */
static u32 __ARQChunkSize;
/* 803D1C30-803D1C78 02ED50 0045+03 1/0 0/0 0/0 .data @1 */
const char* __ARQVersion = "<< Dolphin SDK - ARQ\trelease build: Apr 5 2004 04:15:04 (0x2301) >>";
/* 804518FC-80451900 000DFC 0004+00 1/1 0/0 0/0 .sbss __ARQ_init_flag */
static BOOL __ARQ_init_flag;
/* 80352094-80352194 34C9D4 0100+00 2/2 0/0 0/0 .text __ARQServiceQueueLo */
void __ARQServiceQueueLo(void) {
if ((__ARQRequestPendingLo == NULL) && (__ARQRequestQueueLo)) {
@@ -89,9 +72,7 @@ void __ARQServiceQueueLo(void) {
}
/* 80352194-80352198 34CAD4 0004+00 1/1 0/0 0/0 .text __ARQCallbackHack */
void __ARQCallbackHack() {
/* empty function */
}
void __ARQCallbackHack() {}
/* 80352198-80352264 34CAD8 00CC+00 1/1 0/0 0/0 .text __ARQInterruptServiceRoutine */
void __ARQInterruptServiceRoutine(void) {
+1 -1
View File
@@ -165,7 +165,7 @@ void PPCDisableSpeculation(void) {
/* 80339DCC-80339DD4 -00001 0008+00 0/0 0/0 0/0 .text PPCSetFpNonIEEEMode */
asm void PPCSetFpNonIEEEMode() {
nofralloc
mtfsb1 4*7+1
mtfsb1 29
blr
}
// clang-format on
+108 -132
View File
@@ -1,41 +1,22 @@
//
// Generated By: dol2asm
// Translation Unit: CARDBios
//
#include "dol2asm.h"
#include "dolphin/card/card.h"
#include "dolphin/dsp/dsp.h"
#include "dolphin/os/OS.h"
#include "dolphin/card.h"
#include "dolphin/dsp.h"
#include "dolphin/os.h"
#include "dolphin/card/CARDPriv.h"
//
// Forward References:
//
static s32 OnReset(s32);
/* 80450A60-80450A68 -00001 0004+04 1/1 0/0 0/0 .sdata __CARDVersion */
char* __CARDVersion = "<< Dolphin SDK - CARD\trelease build: Apr 5 2004 04:15:35 (0x2301) >>";
static BOOL OnReset(BOOL);
static void TimeoutHandler(OSAlarm* alarm, OSContext* context);
static s32 Retry(s32 chan);
static void UnlockedCallback(s32 chan, s32 result);
//
// External References:
//
void DSPInit();
//
// Declarations:
//
/* 80352A30-80352A34 34D370 0004+00 0/0 5/5 0/0 .text __CARDDefaultApiCallback */
void __CARDDefaultApiCallback(s32 chan, s32 result) {}
/* ############################################################################################## */
/* 8044CDE0-8044CE00 079B00 0020+00 0/1 3/3 0/0 .bss __CARDDiskNone */
DVDDiskID __CARDDiskNone;
/* ############################################################################################## */
/* 8044CBC0-8044CDE0 0798E0 0220+00 16/16 27/27 0/0 .bss __CARDBlock */
CARDControl __CARDBlock[2];
@@ -99,7 +80,8 @@ void __CARDExiHandler(s32 chan, OSContext* context) {
if ((result = (status & 0x18) ? CARD_RESULT_IOERROR : CARD_RESULT_READY) ==
CARD_RESULT_IOERROR &&
--card->retry > 0) {
--card->retry > 0)
{
result = Retry(chan);
if (result >= 0) {
return;
@@ -186,21 +168,21 @@ s32 __CARDReadStatus(s32 chan, u8* status) {
/* 80352F34-80353024 34D874 00F0+00 0/0 1/1 0/0 .text __CARDReadVendorID */
s32 __CARDReadVendorID(s32 chan, u16* vendorId) {
BOOL err;
u32 cmd;
BOOL err;
u32 cmd;
if (!EXISelect(chan, 0, 4)) {
return CARD_RESULT_NOCARD;
}
if (!EXISelect(chan, 0, 4)) {
return CARD_RESULT_NOCARD;
}
cmd = 0x85000000;
err = FALSE;
err |= !EXIImm(chan, &cmd, 2, 1, NULL);
err |= !EXISync(chan);
err |= !EXIImm(chan, vendorId, 2, 0, NULL);
err |= !EXISync(chan);
err |= !EXIDeselect(chan);
return err ? CARD_RESULT_NOCARD : CARD_RESULT_READY;
cmd = 0x85000000;
err = FALSE;
err |= !EXIImm(chan, &cmd, 2, 1, NULL);
err |= !EXISync(chan);
err |= !EXIImm(chan, vendorId, 2, 0, NULL);
err |= !EXISync(chan);
err |= !EXIDeselect(chan);
return err ? CARD_RESULT_NOCARD : CARD_RESULT_READY;
}
/* 80353024-803530D0 34D964 00AC+00 1/1 1/1 0/0 .text __CARDClearStatus */
@@ -245,7 +227,7 @@ static void TimeoutHandler(OSAlarm* alarm, OSContext* context) {
}
}
static inline void SetupTimeoutAlarm(CARDControl* card) {
static void SetupTimeoutAlarm(CARDControl* card) {
OSCancelAlarm(&card->alarm);
switch (card->cmd[0]) {
case 0xF2:
@@ -256,12 +238,12 @@ static inline void SetupTimeoutAlarm(CARDControl* card) {
case 0xF4:
if (card->pageSize > 0x80) {
OSSetAlarm(&card->alarm, OSSecondsToTicks((OSTime)2) * (card->cBlock / 0x40),
TimeoutHandler);
break;
TimeoutHandler);
break;
}
case 0xF1:
OSSetAlarm(&card->alarm, OSSecondsToTicks((OSTime)2) * (card->sectorSize / 0x2000),
TimeoutHandler);
TimeoutHandler);
break;
default:
break;
@@ -270,43 +252,45 @@ static inline void SetupTimeoutAlarm(CARDControl* card) {
/* 80353174-80353414 34DAB4 02A0+00 2/2 0/0 0/0 .text Retry */
static s32 Retry(s32 chan) {
CARDControl* card;
card = &__CARDBlock[chan];
CARDControl* card;
card = &__CARDBlock[chan];
if (!EXISelect(chan, 0, 4)) {
EXIUnlock(chan);
return CARD_RESULT_NOCARD;
}
if (!EXISelect(chan, 0, 4)) {
EXIUnlock(chan);
return CARD_RESULT_NOCARD;
}
SetupTimeoutAlarm(card);
SetupTimeoutAlarm(card);
if (!EXIImmEx(chan, card->cmd, card->cmdlen, 1)) {
EXIDeselect(chan);
EXIUnlock(chan);
return CARD_RESULT_NOCARD;
}
if (!EXIImmEx(chan, card->cmd, card->cmdlen, 1)) {
EXIDeselect(chan);
EXIUnlock(chan);
return CARD_RESULT_NOCARD;
}
if (card->cmd[0] == 0x52 &&
!EXIImmEx(chan, (u8*)card->workArea + sizeof(CARDID), card->latency, 1)) {
EXIDeselect(chan);
EXIUnlock(chan);
return CARD_RESULT_NOCARD;
}
if (card->cmd[0] == 0x52 &&
!EXIImmEx(chan, (u8*)card->workArea + sizeof(CARDID), card->latency, 1))
{
EXIDeselect(chan);
EXIUnlock(chan);
return CARD_RESULT_NOCARD;
}
if (card->mode == 0xffffffff) {
EXIDeselect(chan);
EXIUnlock(chan);
return CARD_RESULT_READY;
}
if (!EXIDma(chan, card->buffer, (s32)((card->cmd[0] == 0x52) ? 512 : card->pageSize),
card->mode, __CARDTxHandler))
{
EXIDeselect(chan);
EXIUnlock(chan);
return CARD_RESULT_NOCARD;
}
if (card->mode == 0xffffffff) {
EXIDeselect(chan);
EXIUnlock(chan);
return CARD_RESULT_READY;
}
if (!EXIDma(chan, card->buffer, (s32)((card->cmd[0] == 0x52) ? 512 : card->pageSize), card->mode,
__CARDTxHandler)) {
EXIDeselect(chan);
EXIUnlock(chan);
return CARD_RESULT_NOCARD;
}
return CARD_RESULT_READY;
}
/* 80353414-80353524 34DD54 0110+00 1/1 0/0 0/0 .text UnlockedCallback */
@@ -360,26 +344,25 @@ static s32 __CARDStart(s32 chan, CARDCallback txCallback, CARDCallback exiCallba
if (!card->attached) {
result = CARD_RESULT_NOCARD;
} else {
if (txCallback) {
card->txCallback = txCallback;
card->txCallback = txCallback;
}
if (exiCallback) {
card->exiCallback = exiCallback;
card->exiCallback = exiCallback;
}
card->unlockCallback = UnlockedCallback;
if (!EXILock(chan, 0, __CARDUnlockedHandler)) {
result = CARD_RESULT_BUSY;
result = CARD_RESULT_BUSY;
} else {
card->unlockCallback = 0;
card->unlockCallback = 0;
if (!EXISelect(chan, 0, 4)) {
EXIUnlock(chan);
result = CARD_RESULT_NOCARD;
} else {
SetupTimeoutAlarm(card);
result = CARD_RESULT_READY;
}
if (!EXISelect(chan, 0, 4)) {
EXIUnlock(chan);
result = CARD_RESULT_NOCARD;
} else {
SetupTimeoutAlarm(card);
result = CARD_RESULT_READY;
}
}
}
@@ -391,7 +374,7 @@ static s32 __CARDStart(s32 chan, CARDCallback txCallback, CARDCallback exiCallba
#define AD1EX(x) ((u8)(AD1(x) | 0x80));
#define AD2(x) ((u8)(((x) >> 9) & 0xff))
#define AD3(x) ((u8)(((x) >> 7) & 0x03))
#define BA(x) ((u8)((x)&0x7f))
#define BA(x) ((u8)((x) & 0x7f))
/* 80353748-8035387C 34E088 0134+00 0/0 2/2 0/0 .text __CARDReadSegment */
s32 __CARDReadSegment(s32 chan, CARDCallback callback) {
@@ -415,7 +398,8 @@ s32 __CARDReadSegment(s32 chan, CARDCallback callback) {
if (!EXIImmEx(chan, card->cmd, card->cmdlen, 1) ||
!EXIImmEx(chan, (u8*)card->workArea + sizeof(CARDID), card->latency,
1) || // XXX use DMA if possible
!EXIDma(chan, card->buffer, 512, card->mode, __CARDTxHandler)) {
!EXIDma(chan, card->buffer, 512, card->mode, __CARDTxHandler))
{
card->txCallback = 0;
EXIDeselect(chan);
EXIUnlock(chan);
@@ -453,7 +437,8 @@ s32 __CARDWritePage(s32 chan, CARDCallback callback) {
result = CARD_RESULT_READY;
} else if (result >= 0) {
if (!EXIImmEx(chan, card->cmd, card->cmdlen, 1) ||
!EXIDma(chan, card->buffer, card->pageSize, card->mode, __CARDTxHandler)) {
!EXIDma(chan, card->buffer, card->pageSize, card->mode, __CARDTxHandler))
{
card->exiCallback = 0;
EXIDeselect(chan);
EXIUnlock(chan);
@@ -502,22 +487,14 @@ s32 __CARDEraseSector(s32 chan, u32 addr, CARDCallback callback) {
return result;
}
/* ############################################################################################## */
/* 803D1E38-803D1E80 02EF58 0046+02 1/0 0/0 0/0 .data @1 */
SECTION_DATA static char lit_1[] =
"<< Dolphin SDK - CARD\trelease build: Apr 5 2004 04:15:35 (0x2301) >>";
/* 803D1E80-803D1EA0 -00001 0010+10 1/1 0/0 0/0 .data ResetFunctionInfo */
SECTION_DATA static OSResetFunctionInfo ResetFunctionInfo = {
static OSResetFunctionInfo ResetFunctionInfo = {
OnReset,
127,
NULL,
NULL,
};
/* 80450A60-80450A68 -00001 0004+04 1/1 0/0 0/0 .sdata __CARDVersion */
SECTION_SDATA static const char* __CARDVersion = lit_1;
/* 80451918-80451920 -00001 0004+04 3/3 0/0 0/0 .sbss None */
/* 80451918 0002+00 data_80451918 __CARDEncode */
static u16 __CARDEncode;
@@ -605,43 +582,42 @@ s32 __CARDPutControlBlock(CARDControl* card, s32 result) {
/* 80353CD0-80353E20 34E610 0150+00 0/0 1/1 0/0 .text CARDFreeBlocks */
s32 CARDFreeBlocks(s32 chan, s32* byteNotUsed, s32* filesNotUsed) {
CARDControl* card;
s32 result;
u16* fat;
CARDDir* dir;
CARDDir* ent;
u16 fileNo;
CARDControl* card;
s32 result;
u16* fat;
CARDDir* dir;
CARDDir* ent;
u16 fileNo;
result = __CARDGetControlBlock(chan, &card);
if (result < 0) {
return result;
}
fat = __CARDGetFatBlock(card);
dir = __CARDGetDirBlock(card);
if (fat == 0 || dir == 0) {
return __CARDPutControlBlock(card, CARD_RESULT_BROKEN);
}
if (byteNotUsed) {
*byteNotUsed = (s32)(card->sectorSize * fat[CARD_FAT_FREEBLOCKS]);
}
if (filesNotUsed) {
*filesNotUsed = 0;
for (fileNo = 0; fileNo < CARD_MAX_FILE; fileNo++) {
ent = &dir[fileNo];
if (ent->fileName[0] == 0xff) {
++*filesNotUsed;
}
result = __CARDGetControlBlock(chan, &card);
if (result < 0) {
return result;
}
}
return __CARDPutControlBlock(card, CARD_RESULT_READY);
fat = __CARDGetFatBlock(card);
dir = __CARDGetDirBlock(card);
if (fat == 0 || dir == 0) {
return __CARDPutControlBlock(card, CARD_RESULT_BROKEN);
}
if (byteNotUsed) {
*byteNotUsed = (s32)(card->sectorSize * fat[CARD_FAT_FREEBLOCKS]);
}
if (filesNotUsed) {
*filesNotUsed = 0;
for (fileNo = 0; fileNo < CARD_MAX_FILE; fileNo++) {
ent = &dir[fileNo];
if (ent->fileName[0] == 0xff) {
++*filesNotUsed;
}
}
}
return __CARDPutControlBlock(card, CARD_RESULT_READY);
}
s32 CARDGetResultCode(s32 chan)
{
s32 CARDGetResultCode(s32 chan) {
CARDControl* card;
if (chan < 0 || chan >= 2) {
return CARD_RESULT_FATAL_ERROR;
@@ -666,7 +642,7 @@ s32 __CARDSync(s32 chan) {
}
/* 80353EB8-80353F08 34E7F8 0050+00 1/0 0/0 0/0 .text OnReset */
static s32 OnReset(s32 f) {
static BOOL OnReset(BOOL f) {
if (!f) {
if (CARDUnmount(0) == CARD_RESULT_BUSY || CARDUnmount(1) == CARD_RESULT_BUSY) {
return FALSE;
+33 -47
View File
@@ -1,25 +1,11 @@
//
// Generated By: dol2asm
// Translation Unit: CARDBlock
//
#include "dolphin/card/CARDBlock.h"
#include "dolphin/card/card.h"
#include "dolphin/dsp/dsp.h"
#include "dolphin/card.h"
#include "dolphin/card/CARDPriv.h"
//
// Forward References:
//
static void WriteCallback(s32 chan, s32 result);
static void EraseCallback(s32 chan, s32 result);
//
// Declarations:
//
/* 80355414-8035541C 34FD54 0008+00 0/0 5/5 0/0 .text __CARDGetFatBlock */
u16* __CARDGetFatBlock(CARDControl* card) {
return card->currentFat;
@@ -60,35 +46,35 @@ static void WriteCallback(s32 chan, s32 result) {
/* 803554F0-803555B8 34FE30 00C8+00 1/1 0/0 0/0 .text EraseCallback */
static void EraseCallback(s32 chan, s32 result) {
CARDControl* card;
CARDCallback callback;
u32 temp[2]; /* this compiler sucks */
u16* fat;
u32 addr;
CARDControl* card;
CARDCallback callback;
u32 temp[2]; /* this compiler sucks */
u16* fat;
u32 addr;
card = &__CARDBlock[chan];
if (result < 0) {
goto error;
}
card = &__CARDBlock[chan];
if (result < 0) {
goto error;
}
fat = __CARDGetFatBlock(card);
addr = ((u32)fat - (u32)card->workArea) / CARD_SYSTEM_BLOCK_SIZE * card->sectorSize;
result = __CARDWrite(chan, addr, CARD_SYSTEM_BLOCK_SIZE, fat, WriteCallback);
if (result < 0) {
goto error;
}
fat = __CARDGetFatBlock(card);
addr = ((u32)fat - (u32)card->workArea) / CARD_SYSTEM_BLOCK_SIZE * card->sectorSize;
result = __CARDWrite(chan, addr, CARD_SYSTEM_BLOCK_SIZE, fat, WriteCallback);
if (result < 0) {
goto error;
}
return;
return;
error:
if (card->apiCallback == NULL) {
__CARDPutControlBlock(card, result);
}
callback = card->eraseCallback;
if (callback) {
card->eraseCallback = NULL;
callback(chan, result);
}
if (card->apiCallback == NULL) {
__CARDPutControlBlock(card, result);
}
callback = card->eraseCallback;
if (callback) {
card->eraseCallback = NULL;
callback(chan, result);
}
}
/* 803555B8-803556D0 34FEF8 0118+00 0/0 1/1 0/0 .text __CARDAllocBlock */
@@ -143,14 +129,14 @@ s32 __CARDAllocBlock(s32 chan, u32 cBlock, CARDCallback callback) {
/* 803556D0-8035577C 350010 00AC+00 1/1 1/1 0/0 .text __CARDUpdateFatBlock */
s32 __CARDUpdateFatBlock(s32 chan, u16* fat, CARDCallback callback) {
CARDControl* card;
CARDControl* card;
card = &__CARDBlock[chan];
++fat[2];
__CARDCheckSum(fat + 2, 0x1FFC, fat, fat + 1);
DCStoreRange(fat, 0x2000);
card->eraseCallback = callback;
card = &__CARDBlock[chan];
++fat[2];
__CARDCheckSum(fat + 2, 0x1FFC, fat, fat + 1);
DCStoreRange(fat, 0x2000);
card->eraseCallback = callback;
return __CARDEraseSector(chan, (((u32)fat - (u32)card->workArea) / 8192u) * card->sectorSize,
EraseCallback);
return __CARDEraseSector(chan, (((u32)fat - (u32)card->workArea) / 8192u) * card->sectorSize,
EraseCallback);
}
+117 -136
View File
@@ -1,33 +1,13 @@
//
// Generated By: dol2asm
// Translation Unit: CARDCheck
//
#include "dolphin/card/CARDCheck.h"
#include "dolphin/card/card.h"
#include "dolphin/dsp/dsp.h"
#include "dolphin/os/OSRtc.h"
#include "dolphin/card.h"
#include "dolphin/card/CARDPriv.h"
//
// Forward References:
//
#include "dolphin/dsp.h"
#include "dolphin/os/OSRtc.h"
static s32 VerifyID(CARDControl* card);
static s32 VerifyDir(CARDControl* card, int* outCurrent);
static s32 VerifyFAT(CARDControl* card, int* outCurrent);
//
// External References:
//
void __shr2i();
//
// Declarations:
//
/* 803559E0-80355B90 350320 01B0+00 0/0 3/3 0/0 .text __CARDCheckSum */
void __CARDCheckSum(void* ptr, int length, u16* checksum, u16* checksumInv) {
u16* p;
@@ -52,141 +32,141 @@ void __CARDCheckSum(void* ptr, int length, u16* checksum, u16* checksumInv) {
/* 80355B90-80355E14 3504D0 0284+00 2/2 0/0 0/0 .text VerifyID */
static s32 VerifyID(CARDControl* card) {
CARDID* id;
u16 checksum;
u16 checksumInv;
OSSramEx* sramEx;
OSTime rand;
int i;
CARDID* id;
u16 checksum;
u16 checksumInv;
OSSramEx* sramEx;
OSTime rand;
int i;
id = card->workArea;
id = card->workArea;
if (id->deviceID != 0 || id->size != card->size) {
return CARD_RESULT_BROKEN;
}
__CARDCheckSum(id, sizeof(CARDID) - sizeof(u32), &checksum, &checksumInv);
if (id->checkSum != checksum || id->checkSumInv != checksumInv) {
return CARD_RESULT_BROKEN;
}
rand = *(OSTime*)&id->serial[12];
sramEx = __OSLockSramEx();
for (i = 0; i < 12; i++) {
rand = (rand * 1103515245 + 12345) >> 16;
if (id->serial[i] != (u8)(sramEx->flashID[card - __CARDBlock][i] + rand)) {
__OSUnlockSramEx(FALSE);
return CARD_RESULT_BROKEN;
if (id->deviceID != 0 || id->size != card->size) {
return CARD_RESULT_BROKEN;
}
rand = ((rand * 1103515245 + 12345) >> 16) & 0x7FFF;
}
__OSUnlockSramEx(FALSE);
if (id->encode != __CARDGetFontEncode()) {
return CARD_RESULT_ENCODING;
}
__CARDCheckSum(id, sizeof(CARDID) - sizeof(u32), &checksum, &checksumInv);
if (id->checkSum != checksum || id->checkSumInv != checksumInv) {
return CARD_RESULT_BROKEN;
}
return CARD_RESULT_READY;
rand = *(OSTime*)&id->serial[12];
sramEx = __OSLockSramEx();
for (i = 0; i < 12; i++) {
rand = (rand * 1103515245 + 12345) >> 16;
if (id->serial[i] != (u8)(sramEx->flashID[card - __CARDBlock][i] + rand)) {
__OSUnlockSramEx(FALSE);
return CARD_RESULT_BROKEN;
}
rand = ((rand * 1103515245 + 12345) >> 16) & 0x7FFF;
}
__OSUnlockSramEx(FALSE);
if (id->encode != __CARDGetFontEncode()) {
return CARD_RESULT_ENCODING;
}
return CARD_RESULT_READY;
}
/* 80355E14-80356054 350754 0240+00 2/2 0/0 0/0 .text VerifyDir */
static s32 VerifyDir(CARDControl* card, int* outCurrent) {
CARDDir* dir[2];
CARDDirCheck* check[2];
u16 checkSum;
u16 checkSumInv;
int i;
int errors;
int current;
CARDDir* dir[2];
CARDDirCheck* check[2];
u16 checkSum;
u16 checkSumInv;
int i;
int errors;
int current;
current = errors = 0;
for (i = 0; i < 2; i++) {
dir[i] = (CARDDir*)((u8*)card->workArea + (1 + i) * CARD_SYSTEM_BLOCK_SIZE);
check[i] = __CARDGetDirCheck(dir[i]);
__CARDCheckSum(dir[i], CARD_SYSTEM_BLOCK_SIZE - sizeof(u32), &checkSum, &checkSumInv);
if (check[i]->checkSum != checkSum || check[i]->checkSumInv != checkSumInv) {
++errors;
current = i;
card->currentDir = 0;
current = errors = 0;
for (i = 0; i < 2; i++) {
dir[i] = (CARDDir*)((u8*)card->workArea + (1 + i) * CARD_SYSTEM_BLOCK_SIZE);
check[i] = __CARDGetDirCheck(dir[i]);
__CARDCheckSum(dir[i], CARD_SYSTEM_BLOCK_SIZE - sizeof(u32), &checkSum, &checkSumInv);
if (check[i]->checkSum != checkSum || check[i]->checkSumInv != checkSumInv) {
++errors;
current = i;
card->currentDir = 0;
}
}
}
if (0 == errors) {
if (card->currentDir == 0) {
if ((check[0]->checkCode - check[1]->checkCode) < 0) {
current = 0;
} else {
current = 1;
}
card->currentDir = dir[current];
memcpy(dir[current], dir[current ^ 1], CARD_SYSTEM_BLOCK_SIZE);
} else {
current = (card->currentDir == dir[0]) ? 0 : 1;
if (0 == errors) {
if (card->currentDir == 0) {
if ((check[0]->checkCode - check[1]->checkCode) < 0) {
current = 0;
} else {
current = 1;
}
card->currentDir = dir[current];
memcpy(dir[current], dir[current ^ 1], CARD_SYSTEM_BLOCK_SIZE);
} else {
current = (card->currentDir == dir[0]) ? 0 : 1;
}
}
}
if (outCurrent) {
*outCurrent = current;
}
return errors;
if (outCurrent) {
*outCurrent = current;
}
return errors;
}
/* 80356054-803562D8 350994 0284+00 2/2 0/0 0/0 .text VerifyFAT */
static s32 VerifyFAT(CARDControl* card, int* outCurrent) {
u16* fat[2];
u16* fatp;
u16 nBlock;
u16 cFree;
int i;
u16 checkSum;
u16 checkSumInv;
int errors;
int current;
u16* fat[2];
u16* fatp;
u16 nBlock;
u16 cFree;
int i;
u16 checkSum;
u16 checkSumInv;
int errors;
int current;
current = errors = 0;
for (i = 0; i < 2; i++) {
fatp = fat[i] = (u16*)((u8*)card->workArea + (3 + i) * CARD_SYSTEM_BLOCK_SIZE);
current = errors = 0;
for (i = 0; i < 2; i++) {
fatp = fat[i] = (u16*)((u8*)card->workArea + (3 + i) * CARD_SYSTEM_BLOCK_SIZE);
__CARDCheckSum(&fatp[CARD_FAT_CHECKCODE], CARD_SYSTEM_BLOCK_SIZE - sizeof(u32), &checkSum,
&checkSumInv);
if (fatp[CARD_FAT_CHECKSUM] != checkSum || fatp[CARD_FAT_CHECKSUMINV] != checkSumInv) {
++errors;
current = i;
card->currentFat = 0;
continue;
__CARDCheckSum(&fatp[CARD_FAT_CHECKCODE], CARD_SYSTEM_BLOCK_SIZE - sizeof(u32), &checkSum,
&checkSumInv);
if (fatp[CARD_FAT_CHECKSUM] != checkSum || fatp[CARD_FAT_CHECKSUMINV] != checkSumInv) {
++errors;
current = i;
card->currentFat = 0;
continue;
}
cFree = 0;
for (nBlock = CARD_NUM_SYSTEM_BLOCK; nBlock < card->cBlock; nBlock++) {
if (fatp[nBlock] == CARD_FAT_AVAIL) {
cFree++;
}
}
if (cFree != fatp[CARD_FAT_FREEBLOCKS]) {
++errors;
current = i;
card->currentFat = 0;
continue;
}
}
cFree = 0;
for (nBlock = CARD_NUM_SYSTEM_BLOCK; nBlock < card->cBlock; nBlock++) {
if (fatp[nBlock] == CARD_FAT_AVAIL) {
cFree++;
}
if (0 == errors) {
if (card->currentFat == 0) {
if (((s16)fat[0][CARD_FAT_CHECKCODE] - (s16)fat[1][CARD_FAT_CHECKCODE]) < 0) {
current = 0;
} else {
current = 1;
}
card->currentFat = fat[current];
memcpy(fat[current], fat[current ^ 1], CARD_SYSTEM_BLOCK_SIZE);
} else {
current = (card->currentFat == fat[0]) ? 0 : 1;
}
}
if (cFree != fatp[CARD_FAT_FREEBLOCKS]) {
++errors;
current = i;
card->currentFat = 0;
continue;
if (outCurrent) {
*outCurrent = current;
}
}
if (0 == errors) {
if (card->currentFat == 0) {
if (((s16)fat[0][CARD_FAT_CHECKCODE] - (s16)fat[1][CARD_FAT_CHECKCODE]) < 0) {
current = 0;
} else {
current = 1;
}
card->currentFat = fat[current];
memcpy(fat[current], fat[current ^ 1], CARD_SYSTEM_BLOCK_SIZE);
} else {
current = (card->currentFat == fat[0]) ? 0 : 1;
}
}
if (outCurrent) {
*outCurrent = current;
}
return errors;
return errors;
}
/* 803562D8-80356364 350C18 008C+00 0/0 1/1 0/0 .text __CARDVerify */
@@ -282,7 +262,8 @@ s32 CARDCheckExAsync(s32 chan, s32* xferBytes, CARDCallback callback) {
}
for (iBlock = ent->startBlock, cBlock = 0; iBlock != 0xFFFF && cBlock < ent->length;
iBlock = card->currentFat[iBlock], ++cBlock) {
iBlock = card->currentFat[iBlock], ++cBlock)
{
if (!CARDIsValidBlockNo(card, iBlock) || 1 < ++map[iBlock]) {
return __CARDPutControlBlock(card, CARD_RESULT_BROKEN);
}
+5 -10
View File
@@ -1,14 +1,8 @@
//
// Generated By: dol2asm
// Translation Unit: CARDCreate
//
#include "dolphin/card/CARDCreate.h"
#include "dolphin/card/card.h"
#include "dolphin/dsp/dsp.h"
#include "dolphin/dvd/dvd.h"
#include "dolphin/card.h"
#include "dolphin/card/CARDPriv.h"
#include "dolphin/dsp.h"
#include "dolphin/dvd.h"
static void CreateCallbackFat(s32 chan, s32 result);
@@ -93,7 +87,8 @@ s32 CARDCreateAsync(s32 chan, const char* fileName, u32 size, CARDFileInfo* file
}
} else if (memcmp(ent->gameName, card->diskID->game_name, sizeof(ent->gameName)) == 0 &&
memcmp(ent->company, card->diskID->company, sizeof(ent->company)) == 0 &&
__CARDCompareFileName(ent, fileName)) {
__CARDCompareFileName(ent, fileName))
{
return __CARDPutControlBlock(card, CARD_RESULT_EXIST);
}
}
+2 -12
View File
@@ -1,21 +1,11 @@
//
// Generated By: dol2asm
// Translation Unit: CARDDir
//
#include "dolphin/card/CARDDir.h"
#include "dolphin/card/card.h"
#include "dolphin/dsp/dsp.h"
#include "dolphin/card.h"
#include "dolphin/card/CARDPriv.h"
#include "dolphin/dsp.h"
static void WriteCallback(s32 chan, s32 result);
static void EraseCallback(s32 chan, s32 result);
//
// Declarations:
//
/* 8035577C-80355784 3500BC 0008+00 0/0 10/10 0/0 .text __CARDGetDirBlock */
CARDDir* __CARDGetDirBlock(CARDControl* card) {
return card->currentDir;
+76 -96
View File
@@ -1,32 +1,12 @@
//
// Generated By: dol2asm
// Translation Unit: CARDFormat
//
#include "dolphin/card/CARDFormat.h"
#include "dolphin/card/card.h"
#include "dolphin/dsp/dsp.h"
#include "dolphin/os/OSRtc.h"
#include "dolphin/vi/vi.h"
#include "dolphin/card.h"
#include "dolphin/card/CARDPriv.h"
//
// Forward References:
//
#include "dolphin/dsp.h"
#include "dolphin/os/OSRtc.h"
#include "dolphin/vi.h"
static void FormatCallback(s32 chan, s32 result);
//
// External References:
//
void __shr2i();
//
// Declarations:
//
/* 80357484-803575C8 351DC4 0144+00 1/1 0/0 0/0 .text FormatCallback */
static void FormatCallback(s32 chan, s32 result) {
CARDControl* card;
@@ -68,80 +48,80 @@ error:
/* 803575C8-80357C20 351F08 0658+00 1/1 0/0 0/0 .text __CARDFormatRegionAsync */
s32 __CARDFormatRegionAsync(s32 chan, u16 encode, CARDCallback callback) {
CARDControl* card;
CARDID* id;
CARDDir* dir;
u16* fat;
s16 i;
s32 result;
OSSram* sram;
OSSramEx* sramEx;
u16 viDTVStatus;
OSTime time;
OSTime rand;
CARDControl* card;
CARDID* id;
CARDDir* dir;
u16* fat;
s16 i;
s32 result;
OSSram* sram;
OSSramEx* sramEx;
u16 viDTVStatus;
OSTime time;
OSTime rand;
result = __CARDGetControlBlock(chan, &card);
if (result < 0) {
result = __CARDGetControlBlock(chan, &card);
if (result < 0) {
return result;
}
id = (CARDID*)card->workArea;
memset(id, 0xff, CARD_SYSTEM_BLOCK_SIZE);
viDTVStatus = __VIRegs[55];
id->encode = encode;
sram = __OSLockSram();
*(u32*)&id->serial[20] = sram->counterBias;
*(u32*)&id->serial[24] = sram->language;
__OSUnlockSram(FALSE);
rand = time = OSGetTime();
sramEx = __OSLockSramEx();
for (i = 0; i < 12; i++) {
rand = (rand * 1103515245 + 12345) >> 16;
id->serial[i] = (u8)(sramEx->flashID[chan][i] + rand);
rand = ((rand * 1103515245 + 12345) >> 16) & 0x7FFF;
}
__OSUnlockSramEx(FALSE);
*(u32*)&id->serial[28] = viDTVStatus;
*(OSTime*)&id->serial[12] = time;
id->deviceID = 0;
id->size = card->size;
__CARDCheckSum(id, sizeof(CARDID) - sizeof(u32), &id->checkSum, &id->checkSumInv);
for (i = 0; i < 2; i++) {
CARDDirCheck* check;
dir = (CARDDir*)((u8*)card->workArea + (1 + i) * CARD_SYSTEM_BLOCK_SIZE);
memset(dir, 0xff, CARD_SYSTEM_BLOCK_SIZE);
check = __CARDGetDirCheck(dir);
check->checkCode = i;
__CARDCheckSum(dir, CARD_SYSTEM_BLOCK_SIZE - sizeof(u32), &check->checkSum,
&check->checkSumInv);
}
for (i = 0; i < 2; i++) {
fat = (u16*)((u8*)card->workArea + (3 + i) * CARD_SYSTEM_BLOCK_SIZE);
memset(fat, 0x00, CARD_SYSTEM_BLOCK_SIZE);
fat[CARD_FAT_CHECKCODE] = (u16)i;
fat[CARD_FAT_FREEBLOCKS] = (u16)(card->cBlock - CARD_NUM_SYSTEM_BLOCK);
fat[CARD_FAT_LASTSLOT] = CARD_NUM_SYSTEM_BLOCK - 1;
__CARDCheckSum(&fat[CARD_FAT_CHECKCODE], CARD_SYSTEM_BLOCK_SIZE - sizeof(u32),
&fat[CARD_FAT_CHECKSUM], &fat[CARD_FAT_CHECKSUMINV]);
}
card->apiCallback = callback ? callback : __CARDDefaultApiCallback;
DCStoreRange(card->workArea, CARD_WORKAREA_SIZE);
card->formatStep = 0;
result = __CARDEraseSector(chan, (u32)card->sectorSize * card->formatStep, FormatCallback);
if (result < 0) {
__CARDPutControlBlock(card, result);
}
return result;
}
id = (CARDID*)card->workArea;
memset(id, 0xff, CARD_SYSTEM_BLOCK_SIZE);
viDTVStatus = __VIRegs[55];
id->encode = encode;
sram = __OSLockSram();
*(u32*)&id->serial[20] = sram->counterBias;
*(u32*)&id->serial[24] = sram->language;
__OSUnlockSram(FALSE);
rand = time = OSGetTime();
sramEx = __OSLockSramEx();
for (i = 0; i < 12; i++) {
rand = (rand * 1103515245 + 12345) >> 16;
id->serial[i] = (u8)(sramEx->flashID[chan][i] + rand);
rand = ((rand * 1103515245 + 12345) >> 16) & 0x7FFF;
}
__OSUnlockSramEx(FALSE);
*(u32*)&id->serial[28] = viDTVStatus;
*(OSTime*)&id->serial[12] = time;
id->deviceID = 0;
id->size = card->size;
__CARDCheckSum(id, sizeof(CARDID) - sizeof(u32), &id->checkSum, &id->checkSumInv);
for (i = 0; i < 2; i++) {
CARDDirCheck* check;
dir = (CARDDir*)((u8*)card->workArea + (1 + i) * CARD_SYSTEM_BLOCK_SIZE);
memset(dir, 0xff, CARD_SYSTEM_BLOCK_SIZE);
check = __CARDGetDirCheck(dir);
check->checkCode = i;
__CARDCheckSum(dir, CARD_SYSTEM_BLOCK_SIZE - sizeof(u32), &check->checkSum,
&check->checkSumInv);
}
for (i = 0; i < 2; i++) {
fat = (u16*)((u8*)card->workArea + (3 + i) * CARD_SYSTEM_BLOCK_SIZE);
memset(fat, 0x00, CARD_SYSTEM_BLOCK_SIZE);
fat[CARD_FAT_CHECKCODE] = (u16)i;
fat[CARD_FAT_FREEBLOCKS] = (u16)(card->cBlock - CARD_NUM_SYSTEM_BLOCK);
fat[CARD_FAT_LASTSLOT] = CARD_NUM_SYSTEM_BLOCK - 1;
__CARDCheckSum(&fat[CARD_FAT_CHECKCODE], CARD_SYSTEM_BLOCK_SIZE - sizeof(u32),
&fat[CARD_FAT_CHECKSUM], &fat[CARD_FAT_CHECKSUMINV]);
}
card->apiCallback = callback ? callback : __CARDDefaultApiCallback;
DCStoreRange(card->workArea, CARD_WORKAREA_SIZE);
card->formatStep = 0;
result = __CARDEraseSector(chan, (u32)card->sectorSize * card->formatStep, FormatCallback);
if (result < 0) {
__CARDPutControlBlock(card, result);
}
return result;
}
/* 80357C20-80357C74 352560 0054+00 0/0 1/1 0/0 .text CARDFormat */
+4 -19
View File
@@ -1,30 +1,15 @@
//
// Generated By: dol2asm
// Translation Unit: CARDMount
//
#include "dolphin/card/CARDMount.h"
#include "dolphin/card/card.h"
#include "dolphin/dsp/dsp.h"
#include "dolphin/card.h"
#include "dolphin/card/CARDPriv.h"
#include "dolphin/dsp.h"
#include "dolphin/os/OSRtc.h"
#include "dolphin/card/CARDPriv.h"
u8 GameChoice : 0x800030E3;
//
// Forward References:
//
static BOOL IsCard(u32 id);
static s32 DoMount(s32 chan);
static void DoUnmount(s32 chan, s32 result);
//
// Declarations:
//
/* ############################################################################################## */
/* 803D2000-803D2020 02F120 0020+00 3/3 0/0 0/0 .data SectorSizeTable */
static u32 SectorSizeTable[8] = {
8 * 1024, 16 * 1024, 32 * 1024, 64 * 1024, 128 * 1024, 256 * 1024, 0, 0,
@@ -383,7 +368,7 @@ s32 CARDMount(s32 chan, void* workArea, CARDCallback attachCb) {
}
/* 8035733C-803573D8 351C7C 009C+00 2/2 0/0 0/0 .text DoUnmount */
static inline void DoUnmount(s32 chan, s32 result) {
static void DoUnmount(s32 chan, s32 result) {
CARDControl* card;
BOOL enabled;
+2 -8
View File
@@ -1,13 +1,7 @@
//
// Generated By: dol2asm
// Translation Unit: CARDNet
//
#include "dolphin/card/CARDNet.h"
#include "dolphin/card/card.h"
#include "dolphin/dsp/dsp.h"
#include "dolphin/card.h"
#include "dolphin/card/CARDPriv.h"
#include "dolphin/dsp.h"
/* 80450A70 0002+00 data_80450A70 __CARDVendorID */
u16 __CARDVendorID = 0xFFFF;
+63 -69
View File
@@ -1,18 +1,8 @@
//
// Generated By: dol2asm
// Translation Unit: CARDOpen
//
#include "dolphin/card/CARDOpen.h"
#include "dolphin/card/card.h"
#include "dolphin/dsp/dsp.h"
#include "dolphin/dvd/dvd.h"
#include "dolphin/card.h"
#include "dolphin/card/CARDPriv.h"
//
// Declarations:
//
#include "dolphin/dsp.h"
#include "dolphin/dvd.h"
/* 80357C74-80357CDC 3525B4 0068+00 1/1 1/1 0/0 .text __CARDCompareFileName */
BOOL __CARDCompareFileName(CARDDir* ent, const char* fileName) {
@@ -45,9 +35,9 @@ s32 __CARDAccess(CARDControl* card, CARDDir* ent) {
return CARD_RESULT_NOFILE;
}
if (diskId == &__CARDDiskNone ||
(memcmp(ent->gameName, diskId->game_name, 4) == 0 &&
memcmp(ent->company, diskId->company, 2) == 0)) {
if (diskId == &__CARDDiskNone || (memcmp(ent->gameName, diskId->game_name, 4) == 0 &&
memcmp(ent->company, diskId->company, 2) == 0))
{
return CARD_RESULT_READY;
}
@@ -61,9 +51,9 @@ s32 __CARDIsWritable(CARDControl* card, CARDDir* ent) {
u8 val;
if ((u8)ent->gameName[0] == 0xFFu) {
retVal = CARD_RESULT_NOFILE;
} else if (diskId == &__CARDDiskNone ||
(memcmp(ent->gameName, diskId->game_name, 4) == 0 &&
memcmp(ent->company, diskId->company, 2) == 0)) {
} else if (diskId == &__CARDDiskNone || (memcmp(ent->gameName, diskId->game_name, 4) == 0 &&
memcmp(ent->company, diskId->company, 2) == 0))
{
retVal = CARD_RESULT_READY;
} else {
retVal = CARD_RESULT_NOPERM;
@@ -72,11 +62,13 @@ s32 __CARDIsWritable(CARDControl* card, CARDDir* ent) {
if (retVal == CARD_RESULT_NOPERM) {
val = ent->permission & data_80450A72;
if (val & 0x20u && (memcmp(ent->gameName, __CARDDiskNone.game_name, 4) == 0 &&
memcmp(ent->company, __CARDDiskNone.company, 2) == 0)) {
memcmp(ent->company, __CARDDiskNone.company, 2) == 0))
{
return CARD_RESULT_READY;
} else if (val & 0x40 && (memcmp(ent->gameName, __CARDDiskNone.game_name, 4) == 0 &&
memcmp(ent->company, diskId->company, 2) == 0)) {
return CARD_RESULT_READY;
memcmp(ent->company, diskId->company, 2) == 0))
{
return CARD_RESULT_READY;
}
}
@@ -88,17 +80,19 @@ s32 __CARDIsReadable(CARDControl* card, CARDDir* ent) {
u8 val;
s32 retVal;
const DVDDiskID* diskId = card->diskID;
retVal = __CARDAccess(card, ent);
if (retVal == CARD_RESULT_NOPERM) {
val = ent->permission & data_80450A72;
if (val & 0x20u && (memcmp(ent->gameName, __CARDDiskNone.game_name, 4) == 0 &&
memcmp(ent->company, __CARDDiskNone.company, 2) == 0)) {
memcmp(ent->company, __CARDDiskNone.company, 2) == 0))
{
retVal = CARD_RESULT_READY;
} else if (val & 0x40 && (memcmp(ent->gameName, __CARDDiskNone.game_name, 4) == 0 &&
memcmp(ent->company, diskId->company, 2) == 0)) {
retVal = CARD_RESULT_READY;
memcmp(ent->company, diskId->company, 2) == 0))
{
retVal = CARD_RESULT_READY;
}
}
@@ -110,58 +104,58 @@ s32 __CARDIsReadable(CARDControl* card, CARDDir* ent) {
}
static inline s32 __CARDGetFileNo(CARDControl* card, const char* fileName, s32* pfileNo) {
CARDDir* dir;
CARDDir* ent;
s32 fileNo;
s32 result;
CARDDir* dir;
CARDDir* ent;
s32 fileNo;
s32 result;
if (!card->attached) {
return CARD_RESULT_NOCARD;
}
dir = __CARDGetDirBlock(card);
for (fileNo = 0; fileNo < CARD_MAX_FILE; fileNo++) {
ent = &dir[fileNo];
result = __CARDAccess(card, ent);
if (result < 0) {
continue;
if (!card->attached) {
return CARD_RESULT_NOCARD;
}
if (__CARDCompareFileName(ent, fileName)) {
*pfileNo = fileNo;
return CARD_RESULT_READY;
}
}
return CARD_RESULT_NOFILE;
dir = __CARDGetDirBlock(card);
for (fileNo = 0; fileNo < CARD_MAX_FILE; fileNo++) {
ent = &dir[fileNo];
result = __CARDAccess(card, ent);
if (result < 0) {
continue;
}
if (__CARDCompareFileName(ent, fileName)) {
*pfileNo = fileNo;
return CARD_RESULT_READY;
}
}
return CARD_RESULT_NOFILE;
}
/* 80357F98-803580B4 3528D8 011C+00 0/0 3/3 0/0 .text CARDOpen */
s32 CARDOpen(s32 chan, const char* fileName, CARDFileInfo* fileInfo) {
CARDControl* card;
CARDDir* dir;
CARDDir* ent;
s32 result;
s32 fileNo;
CARDControl* card;
CARDDir* dir;
CARDDir* ent;
s32 result;
s32 fileNo;
fileInfo->chan = -1;
result = __CARDGetControlBlock(chan, &card);
if (result < 0) {
return result;
}
result = __CARDGetFileNo(card, fileName, &fileNo);
if (0 <= result) {
dir = __CARDGetDirBlock(card);
ent = &dir[fileNo];
if (!CARDIsValidBlockNo(card, ent->startBlock)) {
result = CARD_RESULT_BROKEN;
} else {
fileInfo->chan = chan;
fileInfo->fileNo = fileNo;
fileInfo->offset = 0;
fileInfo->iBlock = ent->startBlock;
fileInfo->chan = -1;
result = __CARDGetControlBlock(chan, &card);
if (result < 0) {
return result;
}
}
return __CARDPutControlBlock(card, result);
result = __CARDGetFileNo(card, fileName, &fileNo);
if (0 <= result) {
dir = __CARDGetDirBlock(card);
ent = &dir[fileNo];
if (!CARDIsValidBlockNo(card, ent->startBlock)) {
result = CARD_RESULT_BROKEN;
} else {
fileInfo->chan = chan;
fileInfo->fileNo = fileNo;
fileInfo->offset = 0;
fileInfo->iBlock = ent->startBlock;
}
}
return __CARDPutControlBlock(card, result);
}
/* 803580B4-80358108 3529F4 0054+00 0/0 3/3 0/0 .text CARDClose */
+26 -41
View File
@@ -1,25 +1,11 @@
//
// Generated By: dol2asm
// Translation Unit: CARDRdwr
//
#include "dolphin/card/CARDRdwr.h"
#include "dolphin/card/card.h"
#include "dolphin/dsp/dsp.h"
#include "dolphin/card.h"
#include "dolphin/card/CARDPriv.h"
//
// Forward References:
//
#include "dolphin/dsp.h"
static void BlockReadCallback(s32 chan, s32 result);
static void BlockWriteCallback(s32 chan, s32 result);
//
// Declarations:
//
/* 80355184-80355260 34FAC4 00DC+00 1/1 0/0 0/0 .text BlockReadCallback */
static void BlockReadCallback(s32 chan, s32 result) {
CARDControl* card;
@@ -73,39 +59,38 @@ s32 __CARDRead(s32 chan, u32 addr, s32 length, void* dst, CARDCallback callback)
/* 803552C4-803553AC 34FC04 00E8+00 1/1 0/0 0/0 .text BlockWriteCallback */
static void BlockWriteCallback(s32 chan, s32 result) {
CARDCallback callback;
CARDControl* card = &__CARDBlock[chan];
CARDCallback callback;
CARDControl* card = &__CARDBlock[chan];
if (result < 0) {
goto error;
}
if (result < 0) {
goto error;
}
card->xferred += card->pageSize;
card->xferred += card->pageSize;
card->addr += card->pageSize;
(u8*)card->buffer += card->pageSize;
if (--card->repeat <= 0) {
goto error;
}
card->addr += card->pageSize;
(u8*)card->buffer += card->pageSize;
if (--card->repeat <= 0) {
goto error;
}
result = __CARDWritePage(chan, BlockWriteCallback);
if (result < 0) {
goto error;
}
return;
result = __CARDWritePage(chan, BlockWriteCallback);
if (result < 0) {
goto error;
}
return;
error:
if (card->apiCallback == 0) {
__CARDPutControlBlock(card, result);
}
callback = card->xferCallback;
if (callback) {
card->xferCallback = 0;
callback(chan, result);
}
if (card->apiCallback == 0) {
__CARDPutControlBlock(card, result);
}
callback = card->xferCallback;
if (callback) {
card->xferCallback = 0;
callback(chan, result);
}
}
/* 803553AC-80355414 34FCEC 0068+00 0/0 4/4 0/0 .text __CARDWrite */
s32 __CARDWrite(s32 chan, u32 addr, s32 length, void* dst, CARDCallback callback) {
CARDControl* card;

Some files were not shown because too many files have changed in this diff Show More