mirror of
https://github.com/encounter/tp.git
synced 2026-07-11 06:18:46 -07:00
Various matches (#378)
* Maybe improve JMAEulerToQuat * JKRFileLoader OK * JUTCacheFont work * Match J3DModel::prepareShapePackets * JUTDirectFile OK * JUTDirectPrint OK * Work on JUTProcBar * Work on JUTResFont
This commit is contained in:
@@ -680,12 +680,11 @@ void J3DModel::calcBBoardMtx() {
|
||||
}
|
||||
|
||||
/* 803282EC-80328350 322C2C 0064+00 2/2 0/0 0/0 .text prepareShapePackets__8J3DModelFv */
|
||||
#if defined NONMATCHING
|
||||
void J3DModel::prepareShapePackets() {
|
||||
u16 shapeNum = getModelData()->getShapeNum();
|
||||
|
||||
for (u16 i = 0; i < shapeNum; i++) {
|
||||
// two swapped instructions right around here when calling getShapePacket
|
||||
J3DShape* xx = mModelData->getShapeNodePointer(i);
|
||||
J3DShapePacket* pkt = getShapePacket(i);
|
||||
pkt->setMtxBuffer(mMtxBuffer);
|
||||
if (getMtxCalcMode() == 2) {
|
||||
@@ -695,16 +694,6 @@ void J3DModel::prepareShapePackets() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void J3DModel::prepareShapePackets() {
|
||||
nofralloc
|
||||
#include "asm/JSystem/J3DGraphAnimator/J3DModel/prepareShapePackets__8J3DModelFv.s"
|
||||
}
|
||||
#pragma pop
|
||||
#endif
|
||||
|
||||
/* 80328350-803283B4 322C90 0064+00 1/0 0/0 0/0 .text __dt__8J3DModelFv */
|
||||
J3DModel::~J3DModel() {}
|
||||
|
||||
@@ -57,7 +57,7 @@ extern "C" void J3DGQRSetup7__FUlUlUlUl();
|
||||
extern "C" void J3DPSCalcInverseTranspose__FPA4_fPA3_f();
|
||||
extern "C" void makeVcdVatCmd__8J3DShapeFv();
|
||||
extern "C" void __construct_new_array();
|
||||
extern "C" void __save_gpr();
|
||||
extern "C" void _savegpr_14();
|
||||
extern "C" void _savegpr_17();
|
||||
extern "C" void _savegpr_24();
|
||||
extern "C" void _savegpr_25();
|
||||
@@ -65,7 +65,7 @@ extern "C" void _savegpr_26();
|
||||
extern "C" void _savegpr_27();
|
||||
extern "C" void _savegpr_28();
|
||||
extern "C" void _savegpr_29();
|
||||
extern "C" void __restore_gpr();
|
||||
extern "C" void _restgpr_14();
|
||||
extern "C" void _restgpr_17();
|
||||
extern "C" void _restgpr_24();
|
||||
extern "C" void _restgpr_25();
|
||||
|
||||
@@ -51,13 +51,13 @@ extern "C" void J3DFifoLoadTexCached__F11_GXTexMapIDUl15_GXTexCacheSizeUl15_GXTe
|
||||
|
||||
extern "C" void GDOverflowed();
|
||||
extern "C" void __cvt_fp2unsigned();
|
||||
extern "C" void __save_gpr();
|
||||
extern "C" void _savegpr_14();
|
||||
extern "C" void _savegpr_23();
|
||||
extern "C" void _savegpr_24();
|
||||
extern "C" void _savegpr_25();
|
||||
extern "C" void _savegpr_27();
|
||||
extern "C" void _savegpr_29();
|
||||
extern "C" void __restore_gpr();
|
||||
extern "C" void _restgpr_14();
|
||||
extern "C" void _restgpr_23();
|
||||
extern "C" void _restgpr_24();
|
||||
extern "C" void _restgpr_25();
|
||||
|
||||
@@ -5,44 +5,17 @@
|
||||
|
||||
#include "JSystem/JKernel/JKRFileLoader.h"
|
||||
#include "MSL_C/string.h"
|
||||
#include "dol2asm.h"
|
||||
#include "MSL_C/MSL_Common/Src/ctype.h"
|
||||
#include "global.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
extern "C" void __ct__13JKRFileLoaderFv();
|
||||
extern "C" void __dt__13JKRFileLoaderFv();
|
||||
extern "C" void unmount__13JKRFileLoaderFv();
|
||||
extern "C" void getGlbResource__13JKRFileLoaderFPCc();
|
||||
extern "C" void getGlbResource__13JKRFileLoaderFPCcP13JKRFileLoader();
|
||||
extern "C" void removeResource__13JKRFileLoaderFPvP13JKRFileLoader();
|
||||
extern "C" void detachResource__13JKRFileLoaderFPvP13JKRFileLoader();
|
||||
extern "C" void findVolume__13JKRFileLoaderFPPCc();
|
||||
extern "C" void fetchVolumeName__13JKRFileLoaderFPclPCc();
|
||||
extern "C" void __sinit_JKRFileLoader_cpp();
|
||||
extern "C" void func_802D45E4(void* _this);
|
||||
extern "C" extern char const* const JKRFileLoader__stringBase0;
|
||||
extern "C" u8 sVolumeList__13JKRFileLoader[12];
|
||||
extern "C" u8 sCurrentVolume__13JKRFileLoader[4 + 4 /* padding */];
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
extern "C" void __dl__FPv();
|
||||
extern "C" void __ct__11JKRDisposerFv();
|
||||
extern "C" void __dt__11JKRDisposerFv();
|
||||
extern "C" void __ct__10JSUPtrLinkFPv();
|
||||
extern "C" void __dt__10JSUPtrLinkFv();
|
||||
extern "C" void __dt__10JSUPtrListFv();
|
||||
extern "C" void initiate__10JSUPtrListFv();
|
||||
extern "C" void __register_global_object();
|
||||
extern "C" void _savegpr_29();
|
||||
extern "C" void _restgpr_29();
|
||||
extern "C" extern u8 __lower_map[256];
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
@@ -168,20 +141,11 @@ JKRFileLoader* JKRFileLoader::findVolume(const char** volumeName) {
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 8039D150-8039D150 0297B0 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */
|
||||
#pragma push
|
||||
#pragma force_active on
|
||||
SECTION_DEAD static char const* const stringBase_8039D150 = "/";
|
||||
/* @stringBase0 padding */
|
||||
SECTION_DEAD static char const* const pad_8039D152 = "\0\0\0\0\0";
|
||||
#pragma pop
|
||||
|
||||
/* 804508C0-804508C8 000340 0002+06 1/1 0/0 0/0 .sdata rootPath$2498 */
|
||||
SECTION_SDATA static char rootPath[2] = "/";
|
||||
static char rootPath[2] = "/";
|
||||
|
||||
/* 802D44C4-802D45A0 2CEE04 00DC+00 1/1 0/0 0/0 .text fetchVolumeName__13JKRFileLoaderFPclPCc */
|
||||
// matches, but rootPath is accessed through r13
|
||||
#ifdef NONMATCHING
|
||||
const char* JKRFileLoader::fetchVolumeName(char* buffer, long bufferSize, const char* path) {
|
||||
if (strcmp(path, "/") == 0) {
|
||||
strcpy(buffer, rootPath);
|
||||
@@ -191,7 +155,7 @@ const char* JKRFileLoader::fetchVolumeName(char* buffer, long bufferSize, const
|
||||
path++;
|
||||
while (*path != 0 && *path != '/') {
|
||||
if (1 < bufferSize) {
|
||||
u8 lower_char;
|
||||
int lower_char;
|
||||
int ch = (int)*path;
|
||||
if (ch == -1) {
|
||||
lower_char = -1;
|
||||
@@ -213,13 +177,3 @@ const char* JKRFileLoader::fetchVolumeName(char* buffer, long bufferSize, const
|
||||
|
||||
return path;
|
||||
}
|
||||
#else
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm const char* JKRFileLoader::fetchVolumeName(char* param_0, s32 param_1, char const* param_2) {
|
||||
nofralloc
|
||||
#include "asm/JSystem/JKernel/JKRFileLoader/fetchVolumeName__13JKRFileLoaderFPclPCc.s"
|
||||
}
|
||||
#pragma pop
|
||||
#endif
|
||||
|
||||
@@ -38,8 +38,10 @@ void JMAEulerToQuat(s16 x, s16 y, s16 z, Quaternion* quat) {
|
||||
f32 sinY = JMASSin(y / 2);
|
||||
f32 sinZ = JMASSin(z / 2);
|
||||
|
||||
quat->w = cosX * (cosY * cosZ) + sinX * (sinY * sinZ);
|
||||
quat->x = sinX * (cosY * cosZ) - cosX * (sinY * sinZ);
|
||||
f32 cyz = cosY * cosZ;
|
||||
f32 syz = sinY * sinZ;
|
||||
quat->w = cosX * (cyz) + sinX * (syz);
|
||||
quat->x = sinX * (cyz) - cosX * (syz);
|
||||
quat->y = cosZ * (cosX * sinY) + sinZ * (sinX * cosY);
|
||||
quat->z = sinZ * (cosX * cosY) - cosZ * (sinX * sinY);
|
||||
}
|
||||
|
||||
@@ -136,11 +136,11 @@ extern "C" void func_80280588();
|
||||
extern "C" void JPAGetXYZRotateMtx__FsssPA4_f();
|
||||
extern "C" void alloc__7JKRHeapFUliP7JKRHeap();
|
||||
extern "C" void load__10JUTTextureF11_GXTexMapID();
|
||||
extern "C" void __save_gpr();
|
||||
extern "C" void _savegpr_14();
|
||||
extern "C" void _savegpr_25();
|
||||
extern "C" void _savegpr_27();
|
||||
extern "C" void _savegpr_28();
|
||||
extern "C" void __restore_gpr();
|
||||
extern "C" void _restgpr_14();
|
||||
extern "C" void _restgpr_25();
|
||||
extern "C" void _restgpr_27();
|
||||
extern "C" void _restgpr_28();
|
||||
|
||||
@@ -65,13 +65,13 @@ extern "C" void getCellHeight__10JUTResFontCFv();
|
||||
extern "C" void isLeadByte__10JUTResFontCFi();
|
||||
extern "C" void panic_f__12JUTExceptionFPCciPCce();
|
||||
extern "C" void JUTReportConsole(const char*);
|
||||
extern "C" void __save_gpr();
|
||||
extern "C" void _savegpr_14();
|
||||
extern "C" void _savegpr_14();
|
||||
extern "C" void _savegpr_21();
|
||||
extern "C" void _savegpr_27();
|
||||
extern "C" void _savegpr_28();
|
||||
extern "C" void _savegpr_29();
|
||||
extern "C" void __restore_gpr();
|
||||
extern "C" void _restgpr_14();
|
||||
extern "C" void _restgpr_21();
|
||||
extern "C" void _restgpr_27();
|
||||
extern "C" void _restgpr_28();
|
||||
@@ -151,12 +151,6 @@ SECTION_DEAD static char const* const stringBase_8039D2F0 = "JUTCacheFont: Unkno
|
||||
|
||||
/* 802DD35C-802DD4EC 2D7C9C 0190+00 1/1 0/0 0/0 .text
|
||||
* getMemorySize__12JUTCacheFontFPC7ResFONTPUsPUlPUsPUlPUsPUlPUl */
|
||||
#ifdef NONMATCHING
|
||||
struct BlockHeader {
|
||||
u32 magic;
|
||||
u32 size;
|
||||
};
|
||||
|
||||
int JUTCacheFont::getMemorySize(ResFONT const* p_font, u16* o_widCount, u32* o_widSize,
|
||||
u16* o_glyCount, u32* o_glySize, u16* o_mapCount, u32* o_mapSize,
|
||||
u32* o_glyTexSize) {
|
||||
@@ -173,7 +167,7 @@ int JUTCacheFont::getMemorySize(ResFONT const* p_font, u16* o_widCount, u32* o_w
|
||||
u32 maxGlyTexSize = 0;
|
||||
u32 glyTexSize;
|
||||
|
||||
u8* fontInf = (u8*)&p_font + 0x20;
|
||||
u8* fontInf = (u8*)p_font->data;
|
||||
for (int i = 0; i < p_font->numBlocks; i++) {
|
||||
switch (((BlockHeader*)fontInf)->magic) {
|
||||
case 'INF1':
|
||||
@@ -232,18 +226,6 @@ int JUTCacheFont::getMemorySize(ResFONT const* p_font, u16* o_widCount, u32* o_w
|
||||
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm int JUTCacheFont::getMemorySize(ResFONT const* param_0, u16* param_1, u32* param_2,
|
||||
u16* param_3, u32* param_4, u16* param_5, u32* param_6,
|
||||
u32* param_7) {
|
||||
nofralloc
|
||||
#include "asm/JSystem/JUtility/JUTCacheFont/getMemorySize__12JUTCacheFontFPC7ResFONTPUsPUlPUsPUlPUsPUlPUl.s"
|
||||
}
|
||||
#pragma pop
|
||||
#endif
|
||||
|
||||
/* 802DD4EC-802DD54C 2D7E2C 0060+00 1/1 0/0 0/0 .text
|
||||
* initiate__12JUTCacheFontFPC7ResFONTPvUlP7JKRHeap */
|
||||
@@ -345,14 +327,29 @@ bool JUTCacheFont::allocArea(void* param_0, u32 param_1, JKRHeap* heap) {
|
||||
}
|
||||
|
||||
/* 802DD804-802DD8EC 2D8144 00E8+00 1/1 0/0 0/0 .text allocArray__12JUTCacheFontFP7JKRHeap */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm bool JUTCacheFont::allocArray(JKRHeap* param_0) {
|
||||
nofralloc
|
||||
#include "asm/JSystem/JUtility/JUTCacheFont/allocArray__12JUTCacheFontFP7JKRHeap.s"
|
||||
bool JUTCacheFont::allocArray(JKRHeap* param_0) {
|
||||
mMemBlocks = (void**)new (param_0, 0) u32[mWid1BlockNum + mGly1BlockNum + mMap1BlockNum];
|
||||
if (mMemBlocks == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void** blocks = mMemBlocks;
|
||||
if (mWid1BlockNum) {
|
||||
mpWidthBlocks = (ResFONT::WID1**)blocks;
|
||||
blocks = blocks + mWid1BlockNum;
|
||||
}
|
||||
if (mGly1BlockNum) {
|
||||
mpGlyphBlocks = (ResFONT::GLY1**)blocks;
|
||||
blocks = blocks + mGly1BlockNum;
|
||||
for (int i = 0; i < mGly1BlockNum; i++) {
|
||||
mpGlyphBlocks[i] = (ResFONT::GLY1*)((u8*)mCacheBuffer + (field_0x94 * i));
|
||||
}
|
||||
}
|
||||
if (mMap1BlockNum) {
|
||||
mpMapBlocks = (ResFONT::MAP1**)blocks;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 8039D2F0-8039D2F0 029950 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */
|
||||
|
||||
@@ -4,96 +4,182 @@
|
||||
//
|
||||
|
||||
#include "JSystem/JUtility/JUTDirectFile.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "dolphin/os/OSInterrupt.h"
|
||||
#include "global.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
extern "C" void fetch32byte__13JUTDirectFileFv();
|
||||
extern "C" void __ct__13JUTDirectFileFv();
|
||||
extern "C" void __dt__13JUTDirectFileFv();
|
||||
extern "C" void fopen__13JUTDirectFileFPCc();
|
||||
extern "C" void fclose__13JUTDirectFileFv();
|
||||
extern "C" void fgets__13JUTDirectFileFPvi();
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
extern "C" void __dl__FPv();
|
||||
extern "C" void OSEnableInterrupts();
|
||||
extern "C" void OSRestoreInterrupts();
|
||||
extern "C" void DVDOpen();
|
||||
extern "C" void DVDClose();
|
||||
extern "C" void DVDReadAsyncPrio();
|
||||
extern "C" void DVDGetCommandBlockStatus();
|
||||
extern "C" void _savegpr_27();
|
||||
extern "C" void _savegpr_29();
|
||||
extern "C" void _restgpr_27();
|
||||
extern "C" void _restgpr_29();
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
|
||||
/* 802E8730-802E87F8 2E3070 00C8+00 1/1 0/0 0/0 .text fetch32byte__13JUTDirectFileFv */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void JUTDirectFile::fetch32byte() {
|
||||
nofralloc
|
||||
#include "asm/JSystem/JUtility/JUTDirectFile/fetch32byte__13JUTDirectFileFv.s"
|
||||
int JUTDirectFile::fetch32byte() {
|
||||
mToRead = mLength - ALIGN_PREV(mPos, DVD_MIN_TRANSFER_SIZE);
|
||||
|
||||
if (mToRead > JUTDF_BUFSIZE) {
|
||||
mToRead = JUTDF_BUFSIZE;
|
||||
}
|
||||
int interrupts = OSEnableInterrupts();
|
||||
int readRes = DVDReadAsyncPrio(&mFileInfo, mSectorStart, ALIGN_NEXT(mToRead, DVD_MIN_TRANSFER_SIZE),
|
||||
ALIGN_PREV(mPos, DVD_MIN_TRANSFER_SIZE), NULL, 2);
|
||||
OSRestoreInterrupts(interrupts);
|
||||
if (!readRes) {
|
||||
return -1;
|
||||
} else {
|
||||
interrupts = OSEnableInterrupts();
|
||||
while (DVDGetCommandBlockStatus(&mFileInfo.block)) {
|
||||
;
|
||||
}
|
||||
OSRestoreInterrupts(interrupts);
|
||||
return mToRead;
|
||||
}
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* 802E87F8-802E881C 2E3138 0024+00 0/0 1/1 0/0 .text __ct__13JUTDirectFileFv */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm JUTDirectFile::JUTDirectFile() {
|
||||
nofralloc
|
||||
#include "asm/JSystem/JUtility/JUTDirectFile/__ct__13JUTDirectFileFv.s"
|
||||
JUTDirectFile::JUTDirectFile() {
|
||||
mLength = 0;
|
||||
mPos = 0;
|
||||
mToRead = 0;
|
||||
mSectorStart = (u8*)ALIGN_NEXT((u32)mBuffer, DVD_MIN_TRANSFER_SIZE);
|
||||
mIsOpen = false;
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
|
||||
/* 802E881C-802E8860 2E315C 0044+00 0/0 1/1 0/0 .text __dt__13JUTDirectFileFv */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm JUTDirectFile::~JUTDirectFile() {
|
||||
nofralloc
|
||||
#include "asm/JSystem/JUtility/JUTDirectFile/__dt__13JUTDirectFileFv.s"
|
||||
JUTDirectFile::~JUTDirectFile() {
|
||||
mIsOpen = false;
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* 802E8860-802E88FC 2E31A0 009C+00 0/0 1/1 0/0 .text fopen__13JUTDirectFileFPCc */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm bool JUTDirectFile::fopen(char const* param_0) {
|
||||
nofralloc
|
||||
#include "asm/JSystem/JUtility/JUTDirectFile/fopen__13JUTDirectFileFPCc.s"
|
||||
bool JUTDirectFile::fopen(const char* filename) {
|
||||
if (!filename) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int interrupts = OSEnableInterrupts();
|
||||
int dvdRes = DVDOpen(const_cast<char*>(filename), &mFileInfo);
|
||||
OSRestoreInterrupts(interrupts);
|
||||
|
||||
if (!dvdRes) {
|
||||
mIsOpen = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
int interrupts2 = OSEnableInterrupts();
|
||||
mLength = mFileInfo.length;
|
||||
OSRestoreInterrupts(interrupts2);
|
||||
|
||||
mPos = 0;
|
||||
mIsOpen = true;
|
||||
return true;
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* 802E88FC-802E8958 2E323C 005C+00 0/0 1/1 0/0 .text fclose__13JUTDirectFileFv */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm bool JUTDirectFile::fclose() {
|
||||
nofralloc
|
||||
#include "asm/JSystem/JUtility/JUTDirectFile/fclose__13JUTDirectFileFv.s"
|
||||
void JUTDirectFile::fclose() {
|
||||
if (mIsOpen) {
|
||||
int interrupts = OSEnableInterrupts();
|
||||
DVDClose(&mFileInfo);
|
||||
OSRestoreInterrupts(interrupts);
|
||||
mIsOpen = false;
|
||||
}
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* 802E8958-802E8B08 2E3298 01B0+00 0/0 1/1 0/0 .text fgets__13JUTDirectFileFPvi */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm int JUTDirectFile::fgets(void* param_0, int param_1) {
|
||||
nofralloc
|
||||
#include "asm/JSystem/JUtility/JUTDirectFile/fgets__13JUTDirectFileFPvi.s"
|
||||
int JUTDirectFile::fgets(void* buf, int len) {
|
||||
// if file isn't open, return error (-1).
|
||||
if (!mIsOpen) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// if desired length to get is 0, get... 0 bytes.
|
||||
if (len == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// if desired length to get is 1, return 1.
|
||||
// (final byte gotten is always 0, so len 1 is pointless).
|
||||
if (len == 1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// if buffer to read into doesn't exist, return error.
|
||||
if (!buf) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// if we're already beyond the file length, return error.
|
||||
if (mPos >= mLength) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int readMax;
|
||||
u8* byteBuf = (u8*)buf;
|
||||
int readCount = 0;
|
||||
readMax = len - 1; // desired bytes of data to get (last value is then 0).
|
||||
|
||||
while (mPos < mLength) {
|
||||
// if there's nothing left to read, return error.
|
||||
if (mToRead == 0 && fetch32byte() < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// read in each chunk.
|
||||
u32 currPos = mPos & (JUTDF_BUFSIZE - 1);
|
||||
u32 chunkSize = (mToRead - currPos);
|
||||
if (readCount + chunkSize > readMax) {
|
||||
chunkSize = len - readCount - 1;
|
||||
}
|
||||
|
||||
BOOL isAtEnd = FALSE;
|
||||
for (int i = 0; i < chunkSize; i++) {
|
||||
u8 byte = mSectorStart[currPos];
|
||||
currPos++;
|
||||
*byteBuf++ = byte;
|
||||
|
||||
// if we hit the end of a line, stop reading.
|
||||
if (byte == '\n') {
|
||||
isAtEnd = TRUE;
|
||||
chunkSize = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if we exceed the buffer size, stop reading.
|
||||
if (currPos >= JUTDF_BUFSIZE) {
|
||||
mToRead = 0;
|
||||
}
|
||||
|
||||
// if we hit the end of a line, set final byte to 0 and stop reading.
|
||||
if (isAtEnd == TRUE) {
|
||||
*byteBuf = 0;
|
||||
mPos += chunkSize;
|
||||
readCount += chunkSize;
|
||||
break;
|
||||
}
|
||||
|
||||
// we should have read the full chunkSize, so update count/pos.
|
||||
mPos += chunkSize;
|
||||
readCount += chunkSize;
|
||||
|
||||
// if we're at (or beyond) our desired length, set final byte to 0 and stop reading.
|
||||
if (readCount >= readMax) {
|
||||
*byteBuf = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if got to the end of the data, set final byte to 0.
|
||||
if (mPos >= mLength) {
|
||||
*byteBuf = 0;
|
||||
}
|
||||
|
||||
return readCount;
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "JSystem/JUtility/JUTDirectPrint.h"
|
||||
#include "MSL_C/stdio.h"
|
||||
#include "Runtime.PPCEABI.H/__va_arg.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/os/OSCache.h"
|
||||
#include "global.h"
|
||||
|
||||
@@ -14,17 +13,10 @@
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
extern "C" u8 sAsciiTable__14JUTDirectPrint[128];
|
||||
extern "C" void* sFontData__14JUTDirectPrint[64];
|
||||
extern "C" void* sFontData2__14JUTDirectPrint[77];
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
extern "C" void _savegpr_27();
|
||||
extern "C" void _restgpr_27();
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
@@ -76,7 +68,7 @@ void JUTDirectPrint::erase(int x, int y, int width, int height) {
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 803CC6B8-803CC738 0297D8 0080+00 2/2 0/0 0/0 .data sAsciiTable__14JUTDirectPrint */
|
||||
SECTION_DATA u8 JUTDirectPrint::sAsciiTable[128] = {
|
||||
u8 JUTDirectPrint::sAsciiTable[128] = {
|
||||
0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0xFD, 0xFE, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0x29, 0x64, 0x65, 0x66, 0x2B, 0x67, 0x68, 0x25, 0x26, 0x69, 0x2A, 0x6A, 0x27, 0x2C, 0x6B,
|
||||
@@ -88,9 +80,7 @@ SECTION_DATA u8 JUTDirectPrint::sAsciiTable[128] = {
|
||||
};
|
||||
|
||||
/* 803CC738-803CC838 -00001 0100+00 0/1 0/0 0/0 .data sFontData__14JUTDirectPrint */
|
||||
#pragma push
|
||||
#pragma force_active on
|
||||
SECTION_DATA u32 JUTDirectPrint::sFontData[64] = {
|
||||
u32 JUTDirectPrint::sFontData[64] = {
|
||||
0x70871C30, 0x8988A250, 0x88808290, 0x88830C90, 0x888402F8, 0x88882210, 0x71CF9C10, 0xF9CF9C70,
|
||||
0x8208A288, 0xF200A288, 0x0BC11C78, 0x0A222208, 0x8A222208, 0x71C21C70, 0x23C738F8, 0x5228A480,
|
||||
0x8A282280, 0x8BC822F0, 0xFA282280, 0x8A28A480, 0x8BC738F8, 0xF9C89C08, 0x82288808, 0x82088808,
|
||||
@@ -100,12 +90,9 @@ SECTION_DATA u32 JUTDirectPrint::sFontData[64] = {
|
||||
0x70852220, 0xF8011000, 0x08020800, 0x10840400, 0x20040470, 0x40840400, 0x80020800, 0xF8011000,
|
||||
0x70800000, 0x88822200, 0x08820400, 0x108F8800, 0x20821000, 0x00022200, 0x20800020, 0x00000000,
|
||||
};
|
||||
#pragma pop
|
||||
|
||||
/* 803CC838-803CC96C -00001 0134+00 0/1 0/0 0/0 .data sFontData2__14JUTDirectPrint */
|
||||
#pragma push
|
||||
#pragma force_active on
|
||||
SECTION_DATA u32 JUTDirectPrint::sFontData2[77] = {
|
||||
u32 JUTDirectPrint::sFontData2[77] = {
|
||||
0x51421820, 0x53E7A420, 0x014A2C40, 0x01471000, 0x0142AA00, 0x03EAA400, 0x01471A78, 0x00000000,
|
||||
0x50008010, 0x20010820, 0xF8020040, 0x20420820, 0x50441010, 0x00880000, 0x00070E00, 0x01088840,
|
||||
0x78898820, 0x004A8810, 0x788A8810, 0x01098808, 0x00040E04, 0x70800620, 0x11400820, 0x12200820,
|
||||
@@ -117,146 +104,72 @@ SECTION_DATA u32 JUTDirectPrint::sFontData2[77] = {
|
||||
0x00000000, 0x8A28B688, 0x8A2A8888, 0x8A2A8878, 0x894A8808, 0x788536F0, 0x00000000, 0x00000000,
|
||||
0xF8000000, 0x10000000, 0x20000000, 0x40000000, 0xF8000000,
|
||||
};
|
||||
#pragma pop
|
||||
|
||||
/* 803CC96C-803CC980 029A8C 0010+04 0/1 0/0 0/0 .data twiceBit$371 */
|
||||
#pragma push
|
||||
#pragma force_active on
|
||||
SECTION_DATA static u32 twiceBit[4] = {
|
||||
0x00000000,
|
||||
0x00000003,
|
||||
0x0000000C,
|
||||
0x0000000F,
|
||||
static u32 twiceBit[4] = {
|
||||
0,
|
||||
3,
|
||||
12,
|
||||
15,
|
||||
};
|
||||
#pragma pop
|
||||
|
||||
/* 802E431C-802E456C 2DEC5C 0250+00 1/1 0/0 0/0 .text drawChar__14JUTDirectPrintFiii */
|
||||
// incorrect reg-alloc
|
||||
#ifdef NONMATCHING
|
||||
void JUTDirectPrint::drawChar(int position_x, int position_y, int ch) {
|
||||
int codepoint;
|
||||
if (100 <= ch)
|
||||
codepoint = ch - 100;
|
||||
else
|
||||
codepoint = ch;
|
||||
int codepoint = (100 <= ch) ? ch - 100 : ch;
|
||||
int col_index = (codepoint % 5) * 6;
|
||||
int row_index = (codepoint / 5) * 7;
|
||||
|
||||
u32 col_index = (codepoint % 5) * 6;
|
||||
u32 row_index = (codepoint / 5) * 7;
|
||||
const u32 *font_data = (100 > ch) ? sFontData + row_index : sFontData2 + row_index;
|
||||
|
||||
u32* font_data;
|
||||
if (100 > ch)
|
||||
font_data = sFontData + row_index;
|
||||
else
|
||||
font_data = sFontData2 + row_index;
|
||||
int scale_x = (mFrameBufferWidth < 400) ? 1 : 2;
|
||||
int scale_y = (mFrameBufferHeight < 300) ? 1 : 2;
|
||||
|
||||
s32 scale_x;
|
||||
if (mFrameBufferWidth < 400)
|
||||
scale_x = 1;
|
||||
else
|
||||
scale_x = 2;
|
||||
|
||||
s32 scale_y;
|
||||
if (mFrameBufferHeight < 300)
|
||||
scale_y = 1;
|
||||
else
|
||||
scale_y = 2;
|
||||
|
||||
u16* pixel = mFrameBuffer + mStride * position_y * scale_y + position_x * scale_x;
|
||||
for (u32 y = 0; y < 7; y++) {
|
||||
u16 *pixel = mFrameBuffer + mStride * position_y * scale_y + position_x * scale_x;
|
||||
for (int y = 0; y < 7; y++)
|
||||
{
|
||||
u32 data = *font_data << col_index;
|
||||
font_data += 1;
|
||||
|
||||
if (scale_x == 1) {
|
||||
data = data >> 1 & 0x7e000000;
|
||||
} else {
|
||||
if (scale_x == 1)
|
||||
{
|
||||
data = (data & 0xfc000000) >> 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
u32 a = twiceBit[(data >> 26) & 3];
|
||||
u32 b = twiceBit[(data >> 28) & 3] << 4;
|
||||
u32 c = twiceBit[(data >> 30) & 3] << 8;
|
||||
data = (a | b | c) << 0x13;
|
||||
data = (a | b | c) << 19;
|
||||
}
|
||||
|
||||
for (int x = 0; x < scale_x * 6; x += 2) {
|
||||
u16 C1;
|
||||
u16 C2;
|
||||
u16 C3;
|
||||
u16 Y;
|
||||
for (int x = 0; x < scale_x * 6; x += 2)
|
||||
{
|
||||
u16 value;
|
||||
|
||||
if (data & 0x40000000) {
|
||||
C1 = mCharColor_Cb2;
|
||||
} else {
|
||||
C1 = 0x40;
|
||||
}
|
||||
|
||||
if (data & 0x80000000) {
|
||||
C2 = mCharColor_Cb4;
|
||||
} else {
|
||||
C2 = 0x20;
|
||||
}
|
||||
|
||||
if (data & 0x20000000) {
|
||||
C3 = mCharColor_Cb4;
|
||||
} else {
|
||||
C3 = 0x20;
|
||||
}
|
||||
|
||||
if (data & 0x40000000) {
|
||||
Y = mCharColor_Y;
|
||||
} else {
|
||||
Y = 0x00;
|
||||
}
|
||||
|
||||
value = Y | (C2 + C1 + C3);
|
||||
value = (((data & 0x40000000) ? mCharColor_Y : 0) |
|
||||
((data & 0x80000000) ? mCharColor_Cb4 : 32) +
|
||||
((data & 0x40000000) ? mCharColor_Cb2 : 64) +
|
||||
((data & 0x20000000) ? mCharColor_Cb4 : 32));
|
||||
pixel[0] = value;
|
||||
if (scale_y > 1)
|
||||
pixel[mStride] = value;
|
||||
|
||||
if (data & 0x20000000) {
|
||||
C1 = mCharColor_Cr2;
|
||||
} else {
|
||||
C1 = 0x40;
|
||||
}
|
||||
|
||||
if (data & 0x40000000) {
|
||||
C2 = mCharColor_Cr4;
|
||||
} else {
|
||||
C2 = 0x20;
|
||||
}
|
||||
|
||||
if (data & 0x10000000) {
|
||||
C3 = mCharColor_Cr4;
|
||||
} else {
|
||||
C3 = 0x20;
|
||||
}
|
||||
|
||||
if (data & 0x20000000) {
|
||||
Y = mCharColor_Y;
|
||||
} else {
|
||||
Y = 0x00;
|
||||
}
|
||||
|
||||
value = Y | (C2 + C1 + C3);
|
||||
value = (((data & 0x20000000) ? mCharColor_Y : 0) |
|
||||
((data & 0x40000000) ? mCharColor_Cr4 : 32) +
|
||||
((data & 0x20000000) ? mCharColor_Cr2 : 64) +
|
||||
((data & 0x10000000) ? mCharColor_Cr4 : 32));
|
||||
pixel[1] = value;
|
||||
if (scale_y > 1)
|
||||
pixel[1 + mStride] = value;
|
||||
|
||||
data <<= 2;
|
||||
pixel += 2;
|
||||
data <<= 2;
|
||||
|
||||
}
|
||||
|
||||
pixel += mStride * scale_y - scale_x * 6;
|
||||
pixel += mStride * scale_y - 6 * scale_x;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void JUTDirectPrint::drawChar(int param_0, int param_1, int param_2) {
|
||||
nofralloc
|
||||
#include "asm/JSystem/JUtility/JUTDirectPrint/drawChar__14JUTDirectPrintFiii.s"
|
||||
}
|
||||
#pragma pop
|
||||
#endif
|
||||
|
||||
/* 802E456C-802E45A4 2DEEAC 0038+00 1/1 4/4 0/0 .text changeFrameBuffer__14JUTDirectPrintFPvUsUs
|
||||
*/
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "JSystem/JUtility/JUTProcBar.h"
|
||||
#include "JSystem/J2DGraph/J2DOrthoGraph.h"
|
||||
#include "JSystem/JUtility/JUTVideo.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "global.h"
|
||||
@@ -71,17 +72,17 @@ JUTProcBar::JUTProcBar() {
|
||||
field_0x108 = 0;
|
||||
s32 height = JUTGetVideoManager()->getRenderMode()->efb_height;
|
||||
if (height > 400) {
|
||||
field_0x114.mBarWidth = 2;
|
||||
field_0x114.mPosX = 0x27;
|
||||
field_0x114.mPosY = height - 0x28;
|
||||
field_0x114.mWidth = 0x232;
|
||||
field_0x114.mUserPosition = height - 0x46;
|
||||
mParams.mBarWidth = 2;
|
||||
mParams.mPosX = 0x27;
|
||||
mParams.mPosY = height - 0x28;
|
||||
mParams.mWidth = 0x232;
|
||||
mParams.mUserPosition = height - 0x46;
|
||||
} else {
|
||||
field_0x114.mBarWidth = 1;
|
||||
field_0x114.mPosX = 0x27;
|
||||
field_0x114.mPosY = height - 0x14;
|
||||
field_0x114.mWidth = 0x232;
|
||||
field_0x114.mUserPosition = height - 0x23;
|
||||
mParams.mBarWidth = 1;
|
||||
mParams.mPosX = 0x27;
|
||||
mParams.mPosY = height - 0x14;
|
||||
mParams.mWidth = 0x232;
|
||||
mParams.mUserPosition = height - 0x23;
|
||||
}
|
||||
field_0x110 = 1;
|
||||
field_0x128 = 0;
|
||||
@@ -140,7 +141,7 @@ SECTION_SDATA2 static f32 lit_2259 = 10.0f;
|
||||
#ifdef NONMATCHING // data
|
||||
void JUTProcBar::clear() {
|
||||
sManager->idleStart();
|
||||
sManager->gpWaitStart();
|
||||
sManager->cpuStart();
|
||||
sManager->gpStart();
|
||||
sManager->wholeLoopStart();
|
||||
sManager->mCostFrame = 0;
|
||||
@@ -229,7 +230,7 @@ void JUTProcBar::adjustMeterLength(u32 param_0, f32* param_1, f32 param_2, f32 p
|
||||
float var1 = *param_1;
|
||||
while (var1 > param_2) {
|
||||
if (param_0 * var1 * FLOAT_LABEL(lit_2308) / FLOAT_LABEL(lit_2309) <=
|
||||
field_0x114.mWidth - FLOAT_LABEL(lit_2310))
|
||||
mParams.mWidth - FLOAT_LABEL(lit_2310))
|
||||
break;
|
||||
|
||||
var1 -= FLOAT_LABEL(lit_2311);
|
||||
@@ -246,7 +247,7 @@ void JUTProcBar::adjustMeterLength(u32 param_0, f32* param_1, f32 param_2, f32 p
|
||||
if (*param_4 < 0x1e)
|
||||
break;
|
||||
if ((param_0 * var1 * FLOAT_LABEL(lit_2308) / FLOAT_LABEL(lit_2309)) <
|
||||
(field_0x114.mWidth - FLOAT_LABEL(lit_2313)))
|
||||
(mParams.mWidth - FLOAT_LABEL(lit_2313)))
|
||||
var1 += FLOAT_LABEL(lit_2312);
|
||||
break;
|
||||
}
|
||||
@@ -292,150 +293,117 @@ SECTION_SDATA2 static f32 lit_2581 = 3.0f;
|
||||
/* 802E5E3C-802E6D3C 2E077C 0F00+00 1/1 0/0 0/0 .text drawProcessBar__10JUTProcBarFv */
|
||||
#ifdef NONMATCHING // regalloc, signed/unsigned, instruction order
|
||||
void JUTProcBar::drawProcessBar() {
|
||||
if (!mVisible) {
|
||||
return;
|
||||
}
|
||||
int r29 = 16666;
|
||||
if (JUTGetVideoManager() &&
|
||||
((JUTGetVideoManager()->getRenderMode()->vi_tv_mode >> 2) & 0x0f) == 1)
|
||||
{
|
||||
r29 = 20000;
|
||||
}
|
||||
static int cnt = 0;
|
||||
adjustMeterLength(mWholeLoop.field_0x4, &oneFrameRate, 1.0f, 10.0f, &cnt);
|
||||
int r28 = oneFrameRate * 20.0f;
|
||||
int r27 = field_0x114.mBarWidth * 8;
|
||||
int r26 = field_0x114.mBarWidth * 2;
|
||||
int r25 = field_0x114.mBarWidth * 10;
|
||||
int r24 = (field_0x114.mWidth - 4 + r28) / r28;
|
||||
if (++mIdle.field_0xc >= 0x10 || mIdle.field_0x4 >= mIdle.field_0x8) {
|
||||
mIdle.field_0x8 = mIdle.field_0x4;
|
||||
mIdle.field_0xc = 0;
|
||||
}
|
||||
if (++mGp.field_0xc >= 0x10 || mGp.field_0x4 >= mGp.field_0x8) {
|
||||
mGp.field_0x8 = mGp.field_0x4;
|
||||
mGp.field_0xc = 0;
|
||||
}
|
||||
if (++mCpu.field_0xc >= 0x10 || mCpu.field_0x4 >= mCpu.field_0x8) {
|
||||
mCpu.field_0x8 = mCpu.field_0x4;
|
||||
mCpu.field_0xc = 0;
|
||||
}
|
||||
int temp1 = mCpu.field_0x4;
|
||||
int r30 = mGp.field_0x4 - mGpWait.field_0x4;
|
||||
int r23 = r30 - temp1;
|
||||
J2DFillBox(field_0x114.mPosX, field_0x114.mPosY, field_0x114.mWidth, r27,
|
||||
JUtility::TColor(0, 0, 50, 200));
|
||||
J2DDrawFrame(field_0x114.mPosX, field_0x114.mPosY, field_0x114.mWidth, r27,
|
||||
JUtility::TColor(50, 50, 150, 255), 6);
|
||||
if (mCostFrame > r24) {
|
||||
J2DFillBox(field_0x114.mPosX, field_0x114.mPosY + r27 + 1, field_0x114.mWidth, 1.0f,
|
||||
JUtility::TColor(250, 0, 0, 200));
|
||||
} else {
|
||||
J2DFillBox(field_0x114.mPosX, field_0x114.mPosY + r27 + 1, mCostFrame * r28 + 2, 1.0f,
|
||||
JUtility::TColor(0, 250, 250, 200));
|
||||
}
|
||||
int stack92 = mWholeLoop.field_0x4 * r28 / r29;
|
||||
if (stack92 > field_0x114.mWidth) {
|
||||
J2DFillBox(field_0x114.mPosX, field_0x114.mPosY, field_0x114.mWidth, 1.0f,
|
||||
JUtility::TColor(255, 100, 0, 255));
|
||||
} else {
|
||||
J2DFillBox(field_0x114.mPosX, field_0x114.mPosY, stack92, 1.0f,
|
||||
JUtility::TColor(50, 255, 0, 255));
|
||||
}
|
||||
if (field_0x110 == 0) {
|
||||
r23 = field_0x114.mPosY + field_0x114.mBarWidth;
|
||||
bar_subroutine(field_0x114.mPosX + 1, r23, r26, r28, r29, mGp.field_0x4, mGp.field_0x8,
|
||||
JUtility::TColor(80, 255, 80, 255), JUtility::TColor(100, 255, 120, 255));
|
||||
r23 += field_0x114.mBarWidth * 2;
|
||||
bar_subroutine(field_0x114.mPosX + 1, r23, r26, r28, r29, mCpu.field_0x4, mCpu.field_0x8,
|
||||
JUtility::TColor(255, 80, 80, 255), JUtility::TColor(255, 100, 100, 255));
|
||||
r23 += field_0x114.mBarWidth * 2;
|
||||
bar_subroutine(field_0x114.mPosX + 1, r23, r26, r28, r29, mIdle.field_0x4, mIdle.field_0x8,
|
||||
JUtility::TColor(180, 180, 160, 255), JUtility::TColor(200, 200, 200, 255));
|
||||
} else {
|
||||
int r22 = field_0x114.mPosY + field_0x114.mBarWidth;
|
||||
int r21 = field_0x114.mPosX + 1;
|
||||
bar_subroutine(r21, r22, r26, r28, r29, r30, -1, JUtility::TColor(80, 255, 80, 255),
|
||||
JUtility::TColor(80, 255, 80, 255));
|
||||
J2DFillBox(r21 + r30 * r28 / r29, r22, mGpWait.field_0x4 * r28 / r29, r26,
|
||||
JUtility::TColor(0, 255, 0, 255));
|
||||
r30 = mGp.field_0x4 * r28 / r29 + r21;
|
||||
r21 += r23 * r28 / r29;
|
||||
r22 += field_0x114.mBarWidth * 2;
|
||||
bar_subroutine(r21, r22, r26, r28, r29, mCpu.field_0x4, -1,
|
||||
JUtility::TColor(255, 80, 80, 255), JUtility::TColor(255, 80, 80, 255));
|
||||
r22 += field_0x114.mBarWidth * 2;
|
||||
bar_subroutine(r30, r22, r26, r28, r29, mIdle.field_0x4, -1,
|
||||
JUtility::TColor(180, 180, 160, 255), JUtility::TColor(180, 180, 160, 255));
|
||||
}
|
||||
for (int i = 1; i < r24; i++) {
|
||||
int temp2 = field_0x114.mPosX + i * r28 + 1;
|
||||
J2DDrawLine(temp2, field_0x114.mPosY + field_0x114.mBarWidth, temp2,
|
||||
field_0x114.mPosY + r27 - field_0x114.mBarWidth,
|
||||
i - (i / 5) * 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 = field_0x64 + i;
|
||||
if (++time->field_0xc >= 0x10 || time->field_0x4 > time->field_0x8) {
|
||||
time->field_0x8 = time->field_0x4;
|
||||
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(field_0x114.mPosX, field_0x114.mUserPosition, field_0x114.mWidth, r25,
|
||||
JUtility::TColor(0, 0, 50, 200));
|
||||
J2DDrawFrame(field_0x114.mPosX, field_0x114.mUserPosition, field_0x114.mWidth, r25,
|
||||
JUtility::TColor(50, 50, 150, 255), 6);
|
||||
for (int i = 0; i < 8; i++) {
|
||||
CTime* time = field_0x64 + i;
|
||||
if (++time->field_0xc >= 0x10 || time->field_0x4 > time->field_0x8) {
|
||||
time->field_0x8 = time->field_0x4;
|
||||
time->field_0xc = 0;
|
||||
}
|
||||
if (time->field_0x4 != 0 || time->field_0x8 != 0) {
|
||||
int temp4 = time->field_0x4 * r21 / r29;
|
||||
u32 temp5 = time->field_0x8 * r21 / r29;
|
||||
time->field_0x4 = 0;
|
||||
J2DFillBox(
|
||||
field_0x114.mPosX + 1,
|
||||
field_0x114.mUserPosition + field_0x114.mBarWidth + i * field_0x114.mBarWidth,
|
||||
temp4, field_0x114.mBarWidth,
|
||||
JUtility::TColor(time->field_0x10, time->field_0x11, time->field_0x12, 255));
|
||||
if (temp5 < 3) {
|
||||
J2DFillBox(field_0x114.mPosX,
|
||||
field_0x114.mUserPosition + field_0x114.mBarWidth +
|
||||
i * field_0x114.mBarWidth,
|
||||
temp5, field_0x114.mBarWidth, JUtility::TColor(255, 200, 50, 255));
|
||||
} else {
|
||||
J2DFillBox(field_0x114.mPosX + temp5 - 3,
|
||||
field_0x114.mUserPosition + field_0x114.mBarWidth +
|
||||
i * field_0x114.mBarWidth,
|
||||
3.0f, field_0x114.mBarWidth, JUtility::TColor(255, 200, 50, 255));
|
||||
}
|
||||
}
|
||||
}
|
||||
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 r22 = (field_0x114.mWidth - 4 + r21) / r21;
|
||||
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;
|
||||
|
||||
for (int i = 1; i < r22; i++) {
|
||||
int temp6 = field_0x114.mPosX + i * r21 + 1;
|
||||
J2DDrawLine(temp6, field_0x114.mUserPosition + field_0x114.mBarWidth, temp6,
|
||||
field_0x114.mUserPosition + r25 - field_0x114.mBarWidth,
|
||||
i - (i / 5) * 5 != 0 ? JUtility::TColor(100, 100, 255, 255) :
|
||||
JUtility::TColor(180, 255, 255, 255),
|
||||
12);
|
||||
}
|
||||
}
|
||||
field_0x108 = 0;
|
||||
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));
|
||||
|
||||
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 (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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#pragma push
|
||||
@@ -507,33 +475,41 @@ static asm void heapBar(JKRHeap* param_0, int param_1, int param_2, int param_3,
|
||||
/* 802E6FA0-802E7340 2E18E0 03A0+00 1/1 0/0 0/0 .text drawHeapBar__10JUTProcBarFv */
|
||||
#ifdef NONMATCHING // regalloc
|
||||
void JUTProcBar::drawHeapBar() {
|
||||
if (!mHeapBarVisible) {
|
||||
return;
|
||||
}
|
||||
int posX = field_0x114.mPosX;
|
||||
int posY = field_0x114.mPosY;
|
||||
int barWidth = field_0x114.mBarWidth;
|
||||
int var1 = barWidth << 1;
|
||||
int width = field_0x114.mWidth;
|
||||
J2DFillBox(posX, posY - barWidth * 4, width, var1, JUtility::TColor(100, 0, 50, 200));
|
||||
J2DDrawFrame(posX, posY - barWidth * 4, width, var1, JUtility::TColor(100, 50, 150, 255), 6);
|
||||
int codeStart = posX + addrToXPos(JKRHeap::mCodeStart, width);
|
||||
int codeEnd = posX + addrToXPos(JKRHeap::mCodeEnd, width);
|
||||
J2DFillBox(codeStart, posY - barWidth * 4, codeEnd - codeStart, var1,
|
||||
JUtility::TColor(255, 50, 150, 255));
|
||||
int userRamStart = posX + addrToXPos(JKRHeap::mUserRamStart, width);
|
||||
int userRamEnd = posX + addrToXPos(JKRHeap::mUserRamEnd, width);
|
||||
J2DFillBox(userRamStart, posY - barWidth * 4, userRamEnd - userRamStart, var1,
|
||||
JUtility::TColor(0, 50, 150, 255));
|
||||
int totalFreeSize = byteToXLen(JKRHeap::sRootHeap->getTotalFreeSize(), width);
|
||||
J2DFillBox(userRamStart, posY - barWidth * 4, totalFreeSize, var1 / 2,
|
||||
JUtility::TColor(0, 250, 250, 255));
|
||||
if (field_0x128 != 0) {
|
||||
return;
|
||||
}
|
||||
JKRHeap* heap = mWatchHeap ? mWatchHeap : JKRHeap::sCurrentHeap;
|
||||
if (heap != JKRHeap::sSystemHeap) {
|
||||
heapBar(heap, posX, posY, var1, width, var1);
|
||||
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;
|
||||
int width = mParams.mWidth;
|
||||
int height = mParams.mBarWidth * 2;
|
||||
|
||||
// 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);
|
||||
|
||||
// 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));
|
||||
|
||||
// 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));
|
||||
|
||||
// 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)
|
||||
{
|
||||
// draws a line of either the watch heap(if available), otherwise draw the current heap
|
||||
JKRHeap *heap = mWatchHeap ? mWatchHeap : JKRGetCurrentHeap();
|
||||
if (heap != JKRHeap::getSystemHeap()) {
|
||||
heapBar(heap, posX, posY, barHeight, width, height);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
@@ -227,14 +227,45 @@ SECTION_DEAD static char const* const stringBase_8039D47C = "Unknown data block\
|
||||
#pragma pop
|
||||
|
||||
/* 802DF344-802DF48C 2D9C84 0148+00 1/0 0/0 0/0 .text setBlock__10JUTResFontFv */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void JUTResFont::setBlock() {
|
||||
nofralloc
|
||||
#include "asm/JSystem/JUtility/JUTResFont/setBlock__10JUTResFontFv.s"
|
||||
void JUTResFont::setBlock() {
|
||||
s32 widthNum, glyphNum, mapNum;
|
||||
widthNum = 0;
|
||||
glyphNum = 0;
|
||||
mapNum = 0;
|
||||
mMaxCode = -1;
|
||||
|
||||
BlockHeader* data = (BlockHeader*)mResFont->data;
|
||||
for (u32 i = 0; i < mResFont->numBlocks; i++, data = (BlockHeader*)data->getNext()) {
|
||||
switch (data->magic) {
|
||||
case 'INF1':
|
||||
mInf1Ptr = (ResFONT::INF1*)data;
|
||||
mIsLeadByte = (IsLeadByte_func*)&saoAboutEncoding_[mInf1Ptr->fontType];
|
||||
break;
|
||||
|
||||
case 'WID1':
|
||||
mpWidthBlocks[widthNum] = (ResFONT::WID1*)data;
|
||||
widthNum++;
|
||||
break;
|
||||
|
||||
case 'GLY1':
|
||||
mpGlyphBlocks[glyphNum] = (ResFONT::GLY1*)data;
|
||||
glyphNum++;
|
||||
break;
|
||||
|
||||
case 'MAP1':
|
||||
mpMapBlocks[mapNum] = (ResFONT::MAP1*)data;
|
||||
if (mMaxCode > mpMapBlocks[mapNum]->startCode) {
|
||||
mMaxCode = mpMapBlocks[mapNum]->startCode;
|
||||
}
|
||||
mapNum++;
|
||||
break;
|
||||
|
||||
default:
|
||||
JUTReportConsole("Unknown data block\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* 802DF48C-802DF584 2D9DCC 00F8+00 1/0 1/0 0/0 .text setGX__10JUTResFontFv */
|
||||
void JUTResFont::setGX() {
|
||||
@@ -525,8 +556,42 @@ asm int JUTResFont::getFontCode(int param_0) const {
|
||||
#endif
|
||||
|
||||
/* 802DFF60-802E00C4 2DA8A0 0164+00 1/0 0/0 0/0 .text loadImage__10JUTResFontFi11_GXTexMapID */
|
||||
// Matches with literals
|
||||
#ifdef NONMATCHING
|
||||
asm void JUTResFont::loadImage(int param_0, _GXTexMapID param_1) {}
|
||||
void JUTResFont::loadImage(int code, GXTexMapID id){
|
||||
int i = 0;
|
||||
for (; i < mGly1BlockNum; i++)
|
||||
{
|
||||
if (mpGlyphBlocks[i]->startCode <= code && code <= mpGlyphBlocks[i]->endCode)
|
||||
{
|
||||
code -= mpGlyphBlocks[i]->startCode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == mGly1BlockNum)
|
||||
return;
|
||||
|
||||
s32 pageNumCells = mpGlyphBlocks[i]->numRows * mpGlyphBlocks[i]->numColumns;
|
||||
s32 pageIdx = code / pageNumCells;
|
||||
s32 cellIdxInPage = code % pageNumCells;
|
||||
s32 cellCol = (cellIdxInPage % mpGlyphBlocks[i]->numRows);
|
||||
s32 cellRow = (cellIdxInPage / mpGlyphBlocks[i]->numRows);
|
||||
mWidth = cellCol * mpGlyphBlocks[i]->cellWidth;
|
||||
mHeight = cellRow * mpGlyphBlocks[i]->cellHeight;
|
||||
|
||||
if (pageIdx != field_0x44 || i != field_0x66)
|
||||
{
|
||||
GXInitTexObj(&field_0x24, &mpGlyphBlocks[i]->data[pageIdx * mpGlyphBlocks[i]->textureSize], mpGlyphBlocks[i]->textureWidth,
|
||||
mpGlyphBlocks[i]->textureHeight, (GXTexFmt)mpGlyphBlocks[i]->textureFormat, GX_CLAMP, GX_CLAMP, 0);
|
||||
|
||||
GXInitTexObjLOD(&field_0x24, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, 0U, 0U, GX_ANISO_1);
|
||||
field_0x44 = pageIdx;
|
||||
field_0x66 = i;
|
||||
}
|
||||
|
||||
GXLoadTexObj(&field_0x24, id);
|
||||
}
|
||||
#else
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
|
||||
Reference in New Issue
Block a user