Misc matches (#274)

This commit is contained in:
hatal175
2023-02-09 08:52:32 -07:00
committed by GitHub
parent df44816bec
commit d449897b87
54 changed files with 430 additions and 1915 deletions
+5 -17
View File
@@ -1147,33 +1147,21 @@ void JKRExpHeap::CMemBlock::initiate(JKRExpHeap::CMemBlock* prev, JKRExpHeap::CM
/* 802D0830-802D0874 2CB170 0044+00 3/3 0/0 0/0 .text
* allocFore__Q210JKRExpHeap9CMemBlockFUlUcUcUcUc */
#ifdef NONMATCHING
JKRExpHeap::CMemBlock* JKRExpHeap::CMemBlock::allocFore(u32 size, u8 groupId1, u8 alignment1,
u8 groupId2, u8 alignment2) {
CMemBlock* block = NULL;
mGroupId = groupId1;
mFlags = alignment1;
if (getSize() >= size + sizeof(CMemBlock)) {
CMemBlock* newblock = (CMemBlock*)(size + (u32)this);
newblock[1].mGroupId = groupId2;
newblock[1].mFlags = alignment2;
newblock[1].size = this->size - (size + sizeof(CMemBlock));
block = (CMemBlock*)(size + (u32)this);
block[1].mGroupId = groupId2;
block[1].mFlags = alignment2;
block[1].size = this->size - (size + sizeof(CMemBlock));
this->size = size;
block = newblock + 1;
block = block + 1;
}
return block;
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm JKRExpHeap::CMemBlock* JKRExpHeap::CMemBlock::allocFore(u32 param_0, u8 param_1, u8 param_2,
u8 param_3, u8 param_4) {
nofralloc
#include "asm/JSystem/JKernel/JKRExpHeap/allocFore__Q210JKRExpHeap9CMemBlockFUlUcUcUcUc.s"
}
#pragma pop
#endif
/* 802D0874-802D08CC 2CB1B4 0058+00 1/1 0/0 0/0 .text
* allocBack__Q210JKRExpHeap9CMemBlockFUlUcUcUcUc */
+2 -14
View File
@@ -311,7 +311,6 @@ u32 JKRFileCache::readResource(void* dst, u32 dstLength, u32, const char* path)
/* 802D50D4-802D5164 2CFA14 0090+00 1/0 0/0 0/0 .text removeResourceAll__12JKRFileCacheFv
*/
#ifdef NONMATCHING
void JKRFileCache::removeResourceAll(void) {
ASSERT(isMounted());
@@ -319,22 +318,11 @@ void JKRFileCache::removeResourceAll(void) {
iterator = mCacheBlockList.getFirst();
while (iterator != mCacheBlockList.getEnd()) {
JKRFreeToHeap(mParentHeap, iterator->mMemoryPtr);
mCacheBlockList.remove(iterator.mLink);
JSUListIterator<CCacheBlock> next = iterator++;
CCacheBlock* cacheBlock = next.getObject();
mCacheBlockList.remove(&iterator.getObject()->mCacheBlockLink);
CCacheBlock* cacheBlock = (iterator++).getObject();
delete cacheBlock;
}
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void JKRFileCache::removeResourceAll() {
nofralloc
#include "asm/JSystem/JKernel/JKRFileCache/removeResourceAll__12JKRFileCacheFv.s"
}
#pragma pop
#endif
/* 802D5164-802D51F8 2CFAA4 0094+00 1/0 0/0 0/0 .text removeResource__12JKRFileCacheFPv
*/
+5 -26
View File
@@ -4,27 +4,16 @@
//
#include "JSystem/JUtility/JUTFont.h"
#include "dol2asm.h"
#include "dolphin/types.h"
//
// Forward References:
//
extern "C" void __ct__7JUTFontFv();
extern "C" void initialize_state__7JUTFontFv();
extern "C" void setCharColor__7JUTFontFQ28JUtility6TColor();
extern "C" void setGradColor__7JUTFontFQ28JUtility6TColorQ28JUtility6TColor();
extern "C" void drawString_size_scale__7JUTFontFffffPCcUlb();
//
// External References:
//
extern "C" void _savegpr_27();
extern "C" void _restgpr_27();
extern "C" extern void* __vt__7JUTFont[17];
//
// Declarations:
//
@@ -61,33 +50,23 @@ void JUTFont::setGradColor(JUtility::TColor col1, JUtility::TColor col2) {
/* 802DEE28-802DEF48 2D9768 0120+00 0/0 3/3 0/0 .text drawString_size_scale__7JUTFontFffffPCcUlb
*/
#ifdef NONMATCHING
f32 JUTFont::drawString_size_scale(f32 a1, f32 a2, f32 a3, f32 a4, const char* str, u32 usz,
bool a7) {
f32 temp = a1;
for (; usz > 0; usz--, str++) {
u32 b = *(u8*)str;
u32 c = *(u8*)str;
u32 b = c;
if (isLeadByte(b)) {
str++;
b = (b << 8 | *(u8*)str);
b <<= 8;
b |= *(u8*)str;
usz--;
}
a1 += drawChar_scale(temp, a2, a3, a4, b, a7);
a1 += drawChar_scale(a1, a2, a3, a4, b, a7);
a7 = 1;
}
return a1 - temp;
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm f32 JUTFont::drawString_size_scale(f32 param_0, f32 param_1, f32 param_2, f32 param_3,
char const* param_4, u32 param_5, bool param_6) {
nofralloc
#include "asm/JSystem/JUtility/JUTFont/drawString_size_scale__7JUTFontFffffPCcUlb.s"
}
#pragma pop
#endif
+12 -32
View File
@@ -6,7 +6,6 @@
#include "dolphin/dvd/dvdfs.h"
#include "dolphin/dvd/dvd.h"
#include "dolphin/os/OS.h"
#include "dol2asm.h"
#include "dolphin/types.h"
#include "MSL_C/MSL_Common/Src/ctype.h"
@@ -74,14 +73,6 @@ void __DVDFSInit() {
}
/* ############################################################################################## */
/* 803D1380-803D1448 02E4A0 00C8+00 1/1 0/0 0/0 .data @119 */
SECTION_DATA static char lit_119[] =
"DVDConvertEntrynumToPath(possibly DVDOpen or DVDChangeDir or DVDOpenDir): specified directory "
"or file (%s) doesn't match standard 8.3 format. This is a temporary restriction and will be "
"removed soon\n";
/* 804509E0-804509E8 000460 0008+00 3/3 0/0 0/0 .sdata @118 */
SECTION_SDATA static char lit_118[] = "dvdfs.c";
/* 80451768-8045176C 000C68 0004+00 4/4 0/0 0/0 .sbss currentDirectory */
static u32 currentDirectory;
@@ -175,7 +166,13 @@ int DVDConvertPathToEntrynum(const char* pathPtr) {
illegal = TRUE;
if (illegal)
OSPanic(lit_118, 387, lit_119, origPathPtr);
OSPanic(__FILE__, 387,
"DVDConvertEntrynumToPath(possibly DVDOpen or DVDChangeDir or DVDOpenDir): "
"specified directory "
"or file (%s) doesn't match standard 8.3 format. This is a temporary "
"restriction and will be "
"removed soon\n",
origPathPtr);
} else {
for (ptr = pathPtr; (*ptr != '\0') && (*ptr != '/'); ptr++)
;
@@ -336,22 +333,19 @@ BOOL DVDChangeDir(const char* dirName) {
}
/* ############################################################################################## */
/* 803D1480-803D14B4 02E5A0 0034+00 1/1 0/0 0/0 .data @239 */
SECTION_DATA static char lit_239[] = "DVDReadAsync(): specified area is out of the file ";
#define DVD_MIN_TRANSFER_SIZE 32
/* 80348D54-80348E14 343694 00C0+00 0/0 2/2 0/0 .text DVDReadAsyncPrio */
#ifdef NONMATCHING
BOOL DVDReadAsyncPrio(DVDFileInfo* fileInfo, void* addr, s32 length, s32 offset,
DVDCallback callback, s32 prio) {
if (!((0 <= offset) && (offset <= fileInfo->length))) {
OSPanic(lit_118, 750, lit_239);
OSPanic(__FILE__, 750, "DVDReadAsync(): specified area is out of the file ");
}
if (!((0 <= offset + length) && (offset + length < fileInfo->length + DVD_MIN_TRANSFER_SIZE))) {
OSPanic(lit_118, 756, lit_239);
OSPanic(__FILE__, 756, "DVDReadAsync(): specified area is out of the file ");
}
fileInfo->callback = callback;
@@ -360,17 +354,6 @@ BOOL DVDReadAsyncPrio(DVDFileInfo* fileInfo, void* addr, s32 length, s32 offset,
return TRUE;
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm BOOL DVDReadAsyncPrio(DVDFileInfo* fileInfo, void* addr, s32 length, s32 offset,
DVDCallback callback, s32 prio) {
nofralloc
#include "asm/dolphin/dvd/dvdfs/DVDReadAsyncPrio.s"
}
#pragma pop
#endif
#ifndef offsetof
#define offsetof(type, memb) ((u32) & ((type*)0)->memb)
@@ -397,11 +380,11 @@ int DVDReadPrio(DVDFileInfo* fileInfo, void* addr, s32 length, s32 offset, s32 p
int retVal;
if (!((0 <= offset) && (offset <= fileInfo->length))) {
OSPanic(lit_118, 820, "DVDRead(): specified area is out of the file ");
OSPanic(__FILE__, 820, "DVDRead(): specified area is out of the file ");
}
if (!((0 <= offset + length) && (offset + length < fileInfo->length + DVD_MIN_TRANSFER_SIZE))) {
OSPanic(lit_118, 826, "DVDRead(): specified area is out of the file ");
OSPanic(__FILE__, 826, "DVDRead(): specified area is out of the file ");
}
block = &(fileInfo->block);
@@ -443,9 +426,6 @@ int DVDReadPrio(DVDFileInfo* fileInfo, void* addr, s32 length, s32 offset, s32 p
static void cbForReadSync(s32 result, DVDCommandBlock* block) { OSWakeupThread(&__DVDThreadQueue); }
/* ############################################################################################## */
/* 803D14E4-803D1520 02E604 003A+02 1/1 0/0 0/0 .data @311 */
SECTION_DATA static char lit_311[] = "Warning: DVDOpenDir(): file '%s' was not found under %s.\n";
/* 80348F80-80349040 3438C0 00C0+00 0/0 3/3 0/0 .text DVDOpenDir */
BOOL DVDOpenDir(const char* dirName, DVDDirectory* dir) {
s32 entry;
@@ -454,7 +434,7 @@ BOOL DVDOpenDir(const char* dirName, DVDDirectory* dir) {
if (entry < 0) {
DVDGetCurrentDir(currentDir, 128);
OSReport(lit_311, dirName, currentDir);
OSReport("Warning: DVDOpenDir(): file '%s' was not found under %s.\n", dirName, currentDir);
return FALSE;
}
+85 -99
View File
@@ -55,11 +55,17 @@ OSTime __OSGetSystemTime();
// Declarations:
//
typedef struct DVDBuffer {
void* addr;
u32 length;
u32 offset;
} DVDBuffer;
typedef struct DVDCommand {
s32 _0;
void* _4;
u32 _8;
u32 _c;
s32 cmd;
void* addr;
u32 length;
u32 offset;
DVDLowCallback callback;
} DVDCommand;
@@ -112,7 +118,7 @@ static volatile u32 NextCommandNumber;
/* 80347674-803476B4 341FB4 0040+00 0/0 1/1 0/0 .text __DVDInitWA */
void __DVDInitWA() {
NextCommandNumber = 0;
((DVDCommand*)CommandList)[0]._0 = -1;
((DVDCommand*)CommandList)[0].cmd = -1;
__DVDLowSetWAType(0, 0);
OSInitAlarm();
}
@@ -128,23 +134,13 @@ static OSAlarm AlarmForTimeout;
static OSAlarm AlarmForBreak;
/* 8044C8E8-8044C8F4 079608 000C+00 0/1 0/0 0/0 .bss Prev */
#pragma push
#pragma force_active on
static u32 Prev[3];
#pragma pop
static DVDBuffer Prev;
/* 8044C8F4-8044C900 079614 000C+00 0/2 0/0 0/0 .bss Curr */
#pragma push
#pragma force_active on
static u32 Curr[3];
#pragma pop
static DVDBuffer Curr;
/* 804509D8-804509E0 000458 0004+04 2/2 0/0 0/0 .sdata FirstRead */
SECTION_SDATA static BOOL FirstRead[1 + 1 /* padding */] = {
0x00000001,
/* padding */
0x00000000,
};
SECTION_SDATA static BOOL FirstRead = TRUE;
/* 803476B4-80347994 341FF4 02E0+00 0/0 1/1 0/0 .text __DVDInterruptHandler */
void __DVDInterruptHandler(u32 arg0, OSContext* context) {
@@ -157,10 +153,10 @@ void __DVDInterruptHandler(u32 arg0, OSContext* context) {
OSContext localContext;
if (LastCommandWasRead) {
LastReadFinished = __OSGetSystemTime();
FirstRead[0] = 0;
Prev[0] = Curr[0];
Prev[1] = Curr[1];
Prev[2] = Curr[2];
FirstRead = FALSE;
Prev.addr = Curr.addr;
Prev.length = Curr.length;
Prev.offset = Curr.offset;
if (StopAtNextInt == TRUE) {
val |= 8;
@@ -219,16 +215,16 @@ void __DVDInterruptHandler(u32 arg0, OSContext* context) {
if (val & 1) {
u32 num;
DVDCommand* command;
s32 cmd0 = CommandList[num = NextCommandNumber]._0;
s32 cmd0 = CommandList[num = NextCommandNumber].cmd;
if (cmd0 == 1) {
NextCommandNumber++;
command = &CommandList[num];
Read(command->_4, command->_8, command->_c, command->callback);
Read(command->addr, command->length, command->offset, command->callback);
rv = 1;
} else if (cmd0 == 2) {
NextCommandNumber++;
command = &CommandList[num];
DVDLowSeek(command->_c, command->callback);
DVDLowSeek(command->offset, command->callback);
rv = 1;
} else {
rv = 0;
@@ -238,7 +234,7 @@ void __DVDInterruptHandler(u32 arg0, OSContext* context) {
return;
}
} else {
CommandList[0]._0 = -1;
CommandList[0].cmd = -1;
NextCommandNumber = 0;
}
@@ -261,16 +257,16 @@ void __DVDInterruptHandler(u32 arg0, OSContext* context) {
static void AlarmHandler(OSAlarm* alarm, OSContext* context) {
DVDCommand* cmd;
u32 num;
s32 cmd0 = CommandList[num = NextCommandNumber]._0;
s32 cmd0 = CommandList[num = NextCommandNumber].cmd;
if (cmd0 == 1) {
++NextCommandNumber;
cmd = &CommandList[num];
Read(cmd->_4, cmd->_8, cmd->_c, cmd->callback);
Read(cmd->addr, cmd->length, cmd->offset, cmd->callback);
} else if (cmd0 == 2) {
++NextCommandNumber;
cmd = &CommandList[num];
DVDLowSeek(cmd->_c, cmd->callback);
DVDLowSeek(cmd->offset, cmd->callback);
}
}
@@ -326,96 +322,86 @@ void SeekTwiceBeforeRead(void* arg0, u32 arg1, u32 arg2, DVDLowCallback cb) {
val = temp + WorkAroundSeekLocation[0];
}
CommandList[0]._0 = 2;
CommandList[0]._c = val;
CommandList[0].cmd = 2;
CommandList[0].offset = val;
CommandList[0].callback = cb;
CommandList[1]._0 = 1;
CommandList[1]._4 = arg0;
CommandList[1]._8 = arg1;
CommandList[1]._c = arg2;
CommandList[1].cmd = 1;
CommandList[1].addr = arg0;
CommandList[1].length = arg1;
CommandList[1].offset = arg2;
CommandList[1].callback = cb;
CommandList[2]._0 = -1;
CommandList[2].cmd = -1;
NextCommandNumber = 0;
DVDLowSeek(val, cb);
}
BOOL HitCache() {
u32 uVar1 = (Prev.offset + Prev.length - 1) >> 15;
u32 uVar2 = (Curr.offset >> 15);
u32 iVar3 = (DVDGetCurrentDiskID()->is_streaming ? TRUE : FALSE) ? 5 : 15;
if ((uVar2 > uVar1 - 2) || (uVar2 < uVar1 + iVar3 + 3)) {
return TRUE;
}
return FALSE;
}
static void DoJustRead(void* addr, u32 length, u32 offset, DVDLowCallback callback) {
CommandList[0].cmd = -1;
NextCommandNumber = 0;
Read(addr, length, offset, callback);
}
static void WaitBeforeRead(void* addr, u32 length, u32 offset, DVDLowCallback callback,
OSTime timeout) {
CommandList[0].cmd = 1;
CommandList[0].addr = addr;
CommandList[0].length = length;
CommandList[0].offset = offset;
CommandList[0].callback = callback;
CommandList[1].cmd = -1;
NextCommandNumber = 0;
OSCreateAlarm(&AlarmForWA);
OSSetAlarm(&AlarmForWA, timeout, AlarmHandler);
}
/* 80347C18-80347EB0 342558 0298+00 0/0 4/4 0/0 .text DVDLowRead */
// Issues with alarm time calculation
#ifdef NONMATCHING
BOOL DVDLowRead(void* arg0, u32 arg1, u32 arg2, DVDLowCallback cb) {
BOOL DVDLowRead(void* addr, u32 length, u32 offset, DVDLowCallback cb) {
OSTime diff;
u32 prev;
__DIRegs[6] = length;
Curr.addr = addr;
Curr.length = length;
Curr.offset = offset;
if (WorkAroundType == 0) {
Curr[2] = -1;
NextCommandNumber = 0;
Read(arg0, arg1, arg2, cb);
DoJustRead(addr, length, offset, cb);
} else if (WorkAroundType == 1) {
if (FirstRead[0]) {
SeekTwiceBeforeRead(arg0, arg1, arg2, cb);
if (FirstRead) {
SeekTwiceBeforeRead(addr, length, offset, cb);
} else {
u32 curr2 = Curr[2] >> 15;
u32 prev1 = (Prev[2] + Prev[1] - 1) >> 15;
DVDDiskID* id = DVDGetCurrentDiskID();
BOOL is_streaming = id->is_streaming ? TRUE : FALSE;
u32 val;
BOOL val2;
if (is_streaming) {
val = 5;
if (!HitCache(&Curr, &Prev)) {
DoJustRead(addr, length, offset, cb);
} else {
val = 15;
}
if (curr2 > prev1 - 2 || curr2 < prev1 + (val + 3)) {
val2 = TRUE;
} else {
val2 = FALSE;
}
if (!val2) {
CommandList[0]._0 = -1;
NextCommandNumber = 0;
Read(arg0, arg1, arg2, cb);
} else {
curr2 = Curr[2] >> 15;
prev1 = (Prev[2] + Prev[1] - 1) >> 15;
if (curr2 == prev1 || curr2 + 1 == prev1) {
OSTime diff = __OSGetSystemTime() - LastReadFinished;
OSTime five_ms = (OSTime)OSMillisecondsToTicks(5);
if (diff < five_ms) {
CommandList[0]._0 = -1;
NextCommandNumber = 0;
Read(arg0, arg1, arg2, cb);
prev = (Prev.offset + Prev.length - 1) >> 15;
if (prev == Curr.offset >> 15 || prev + 1 == Curr.offset >> 15) {
diff = __OSGetSystemTime() - LastReadFinished;
if (OSMillisecondsToTicks(5) < diff) {
DoJustRead(addr, length, offset, cb);
} else {
OSTime temp;
temp = diff - five_ms + (OSTime)OSMicrosecondsToTicks(500);
CommandList[0]._0 = 1;
CommandList[0]._4 = arg0;
CommandList[0]._8 = arg1;
CommandList[0]._c = arg2;
CommandList[0].callback = cb;
CommandList[1]._0 = -1;
NextCommandNumber = 0;
OSCreateAlarm(&AlarmForWA);
OSSetAlarm(&AlarmForWA, temp, AlarmHandler);
WaitBeforeRead(addr, length, offset, cb,
OSMillisecondsToTicks(5) - diff +
OSMicrosecondsToTicks(500));
}
} else {
SeekTwiceBeforeRead(arg0, arg1, arg2, cb);
SeekTwiceBeforeRead(addr, length, offset, cb);
}
}
}
}
return TRUE;
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm BOOL DVDLowRead(void* arg0, u32 arg1, u32 arg2, DVDLowCallback cb) {
nofralloc
#include "asm/dolphin/dvd/dvdlow/DVDLowRead.s"
}
#pragma pop
#endif
/* 80347EB0-80347F44 3427F0 0094+00 3/3 2/2 0/0 .text DVDLowSeek */
BOOL DVDLowSeek(u32 arg0, DVDLowCallback cb) {
+11 -2
View File
@@ -6,13 +6,12 @@
#include "dolphin/gf/GFGeometry.h"
#include "dol2asm.h"
#include "dolphin/types.h"
#include "dolphin/gx/GX.h"
//
// Types:
//
struct _GXCullMode {};
//
// Forward References:
//
@@ -43,6 +42,15 @@ SECTION_SDATA static u8 cm2hw[4 + 4 /* padding */] = {
};
/* 802CDDC8-802CDE54 2C8708 008C+00 0/0 0/0 1/1 .text GFSetGenMode2__FUcUcUcUc11_GXCullMode */
// reg alloc
#ifdef NONMATCHING
void GFSetGenMode2(u8 param_0, u8 param_1, u8 param_2, u8 param_3, _GXCullMode param_4) {
GFWriteBPCmd(0xFE07FC3F);
GFWriteBPCmd((param_0) | (param_1 << 4) | ((param_2 - 1) << 10) | (cm2hw[param_4] << 14) | (param_3 << 16));
GFFill(0x1009, param_1);
GFFill(0x103f, param_0);
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
@@ -51,6 +59,7 @@ asm void GFSetGenMode2(u8 param_0, u8 param_1, u8 param_2, u8 param_3, _GXCullMo
#include "asm/dolphin/gf/GFGeometry/GFSetGenMode2__FUcUcUcUc11_GXCullMode.s"
}
#pragma pop
#endif
/* ############################################################################################## */
/* 804508B0-804508B8 000330 0008+00 0/0 2/2 0/0 .sdata None */
+7 -15
View File
@@ -4,23 +4,19 @@
//
#include "dolphin/gf/GFLight.h"
#include "dol2asm.h"
#include "dolphin/types.h"
#include "dolphin/gx/GXEnum.h"
#include "dolphin/gx/GXStruct.h"
#include "dolphin/gx/GX.h"
//
// Types:
//
struct _GXColor {};
struct _GXChannelID {};
//
// Forward References:
//
extern "C" void GFSetChanAmbColor__F12_GXChannelID8_GXColor();
//
// External References:
//
@@ -31,11 +27,7 @@ extern "C" void GFSetChanAmbColor__F12_GXChannelID8_GXColor();
/* 802CDE54-802CDE9C 2C8794 0048+00 0/0 0/0 1/1 .text GFSetChanAmbColor__F12_GXChannelID8_GXColor
*/
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void GFSetChanAmbColor(_GXChannelID param_0, _GXColor param_1) {
nofralloc
#include "asm/dolphin/gf/GFLight/GFSetChanAmbColor__F12_GXChannelID8_GXColor.s"
}
#pragma pop
void GFSetChanAmbColor(_GXChannelID param_0, _GXColor param_1) {
GFFill((param_0 & 1) + 0x100a,
param_1.r << 0x18 | param_1.g << 0x10 | param_1.b << 8 | param_1.a);
}
+48 -78
View File
@@ -4,110 +4,80 @@
//
#include "dolphin/gf/GFPixel.h"
#include "dol2asm.h"
#include "dolphin/gx/GXEnum.h"
#include "dolphin/gx/GX.h"
#include "dolphin/types.h"
//
// Types:
//
struct _GXLogicOp {};
struct _GXFogType {};
struct _GXCompare {};
struct _GXColor {};
struct _GXBlendMode {};
struct _GXBlendFactor {};
//
// Forward References:
//
extern "C" void GFSetFog__F10_GXFogTypeffff8_GXColor();
extern "C" void
GFSetBlendModeEtc__F12_GXBlendMode14_GXBlendFactor14_GXBlendFactor10_GXLogicOpUcUcUc();
extern "C" void GFSetZMode__FUc10_GXCompareUc();
//
// External References:
//
extern "C" void __cvt_fp2unsigned();
extern "C" void _savegpr_28();
extern "C" void _restgpr_28();
//
// Declarations:
//
/* ############################################################################################## */
/* 80455F68-80455F6C 004568 0004+00 1/1 0/0 0/0 .sdata2 @293 */
SECTION_SDATA2 static u8 lit_293[4] = {
0x00,
0x00,
0x00,
0x00,
};
/* 80455F6C-80455F70 00456C 0004+00 1/1 0/0 0/0 .sdata2 @294 */
SECTION_SDATA2 static f32 lit_294 = 0.5f;
/* 80455F70-80455F78 004570 0008+00 1/1 0/0 0/0 .sdata2 @295 */
SECTION_SDATA2 static f64 lit_295 = 1.0;
/* 80455F78-80455F80 004578 0004+04 1/1 0/0 0/0 .sdata2 @296 */
SECTION_SDATA2 static f32 lit_296[1 + 1 /* padding */] = {
2.0f,
/* padding */
0.0f,
};
/* 80455F80-80455F88 004580 0008+00 1/1 0/0 0/0 .sdata2 @297 */
SECTION_SDATA2 static f64 lit_297 = 0.5;
/* 80455F88-80455F90 004588 0004+04 1/1 0/0 0/0 .sdata2 @298 */
SECTION_SDATA2 static f32 lit_298[1 + 1 /* padding */] = {
8388638.0f,
/* padding */
0.0f,
};
/* 80455F90-80455F98 004590 0008+00 1/1 0/0 0/0 .sdata2 @301 */
SECTION_SDATA2 static f64 lit_301 = 4503601774854144.0 /* cast s32 to float */;
/* 802CDE9C-802CE004 2C87DC 0168+00 0/0 1/1 0/0 .text GFSetFog__F10_GXFogTypeffff8_GXColor */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void GFSetFog(_GXFogType param_0, f32 param_1, f32 param_2, f32 param_3, f32 param_4,
_GXColor param_5) {
nofralloc
#include "asm/dolphin/gf/GFPixel/GFSetFog__F10_GXFogTypeffff8_GXColor.s"
void GFSetFog(_GXFogType param_0, f32 param_1, f32 param_2, f32 param_3, f32 param_4,
_GXColor param_5) {
s32 r30;
s32 r30shift2;
u32 stack_c_u32;
f32 stack_c;
f32 r30shift;
f32 f3;
f32 f5;
if (param_4 == param_3 || param_2 == param_1) {
f5 = 0.0f;
f3 = 0.5f;
stack_c = 0.0f;
} else {
f5 = (param_4 * param_3) / ((param_4 - param_3) * (param_2 - param_1));
f3 = param_4 / (param_4 - param_3);
stack_c = param_1 / (param_2 - param_1);
}
r30 = 1;
while (f3 > 1.0) {
f3 *= 0.5f;
r30++;
}
while (f3 > 0.0f && f3 < 0.5) {
f3 *= 2.0f;
r30--;
}
r30shift = (f5 / (1 << r30));
r30shift2 = *(s32*)&r30shift;
stack_c_u32 = (*(u32*)&stack_c);
GFWriteBPCmd(((r30shift2 >> 12) & 0xfffff) | 0xee000000);
GFWriteBPCmd((u32)(8388638.0f * f3) | 0xef000000);
GFWriteBPCmd(r30 | 0xf0000000);
GFWriteBPCmd(((stack_c_u32 >> 12) & 0xfffff) | (((u32)param_0 << 21) & 0xffe00000) | 0xf1000000);
GFWriteBPCmd(param_5.b | param_5.g << 8 | param_5.r << 16 | 0xf2000000);
}
#pragma pop
/* 802CE004-802CE0A4 2C8944 00A0+00 0/0 1/1 0/0 .text
* GFSetBlendModeEtc__F12_GXBlendMode14_GXBlendFactor14_GXBlendFactor10_GXLogicOpUcUcUc */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void GFSetBlendModeEtc(_GXBlendMode param_0, _GXBlendFactor param_1, _GXBlendFactor param_2,
_GXLogicOp param_3, u8 param_4, u8 param_5, u8 param_6) {
nofralloc
#include "asm/dolphin/gf/GFPixel/GFSetBlendModeEtc__F12_GXBlendMode14_GXBlendFactor14_GXBlendFactor10_GXLogicOpUcUcUc.s"
void GFSetBlendModeEtc(_GXBlendMode param_0, _GXBlendFactor param_1, _GXBlendFactor param_2,
_GXLogicOp param_3, u8 param_4, u8 param_5, u8 param_6) {
GFWriteBPCmd(((param_0 == 1) || (param_0 == 3)) | (param_0 == 2) << 1 | param_6 << 2 |
param_4 << 3 | param_5 << 4 | param_2 << 5 | param_1 << 8 | (param_0 == 3) << 11 |
param_3 << 12 | 0x41000000);
}
#pragma pop
/* 802CE0A4-802CE0D0 2C89E4 002C+00 0/0 1/1 0/0 .text GFSetZMode__FUc10_GXCompareUc */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void GFSetZMode(u8 param_0, _GXCompare param_1, u8 param_2) {
nofralloc
#include "asm/dolphin/gf/GFPixel/GFSetZMode__FUc10_GXCompareUc.s"
void GFSetZMode(u8 param_0, _GXCompare param_1, u8 param_2) {
GFWriteBPCmd(param_0 | param_1 << 1 | param_2 << 4 | 0x40000000);
}
#pragma pop
+12 -14
View File
@@ -4,23 +4,19 @@
//
#include "dolphin/gf/GFTev.h"
#include "dol2asm.h"
#include "dolphin/gx/GXEnum.h"
#include "dolphin/gx/GXStruct.h"
#include "dolphin/gx/GX.h"
#include "dolphin/types.h"
//
// Types:
//
struct _GXTevRegID {};
struct _GXColorS10 {};
//
// Forward References:
//
extern "C" void GFSetTevColorS10__F11_GXTevRegID11_GXColorS10();
//
// External References:
//
@@ -31,11 +27,13 @@ extern "C" void GFSetTevColorS10__F11_GXTevRegID11_GXColorS10();
/* 802CE0D0-802CE138 2C8A10 0068+00 0/0 0/0 1/1 .text
* GFSetTevColorS10__F11_GXTevRegID11_GXColorS10 */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void GFSetTevColorS10(_GXTevRegID param_0, _GXColorS10 param_1) {
nofralloc
#include "asm/dolphin/gf/GFTev/GFSetTevColorS10__F11_GXTevRegID11_GXColorS10.s"
void GFSetTevColorS10(_GXTevRegID param_0, _GXColorS10 param_1) {
u32 uVar1 = (param_1.r & 0x7ffU) | ((param_1.a & 0x7ffU) << 12) |
((param_0 * 2 + 0xe0) << 24);
u32 uVar2 = (param_1.b & 0x7ffU) | ((param_1.g & 0x7ffU) << 12) | ((param_0 * 2 + 0xe1) << 24);
GFWriteBPCmd(uVar1);
GFWriteBPCmd(uVar2);
GFWriteBPCmd(uVar2);
GFWriteBPCmd(uVar2);
}
#pragma pop
+1
View File
@@ -15,6 +15,7 @@ LIBGF_A_O_FILES := \
$(BUILD_DIR)/libs/dolphin/gf/GFTev.o \
LIBGF_A_CFLAGS := \
-inline auto \
LIBGF_A_LDFLAGS := \
-nodefaults \
+1
View File
@@ -19,6 +19,7 @@ LIBMTX_A_O_FILES := \
LIBMTX_A_CFLAGS := \
-O4,p \
-lang=c \
-inline auto \
LIBMTX_A_LDFLAGS := \
-nodefaults \
+26 -65
View File
@@ -12,32 +12,37 @@
//
/* ############################################################################################## */
/* 80456528-8045652C 004B28 0004+00 2/2 0/0 0/0 .sdata2 @99 */
SECTION_SDATA2 static f32 lit_99 = 1.0f;
/* 8045652C-80456530 004B2C 0004+00 1/1 0/0 0/0 .sdata2 @100 */
SECTION_SDATA2 static f32 lit_100 = 2.0f;
static void __C_MTXOrtho1(Mtx44 m, f32 l, f32 r, f32 t, f32 b) {
f32 temp_f10 = 1.0F / (r - l);
f32 temp_f8;
m[0][0] = 2.0F * temp_f10;
m[0][1] = 0.0F;
m[0][2] = 0.0F;
m[0][3] = temp_f10 * -(r + l);
/* 80456530-80456534 004B30 0004+00 2/2 0/0 0/0 .sdata2 @101 */
SECTION_SDATA2 static u8 lit_101[4] = {
0x00,
0x00,
0x00,
0x00,
};
temp_f8 = 1.0F / (t - b);
m[1][0] = 0.0F;
m[1][1] = 2.0F * temp_f8;
m[1][2] = 0.0F;
m[1][3] = temp_f8 * -(t + b);
}
/* 80456534-80456538 004B34 0004+00 2/2 0/0 0/0 .sdata2 @102 */
SECTION_SDATA2 static f32 lit_102 = -1.0f;
static void __C_MTXOrtho2(Mtx44 m, f32 f, f32 n) {
f32 temp_f4 = 1.0F / (f - n);
m[2][0] = 0.0F;
m[2][1] = 0.0F;
m[2][2] = -1.0F * temp_f4;
m[2][3] = -f * temp_f4;
/* 80456538-8045653C 004B38 0004+00 1/1 0/0 0/0 .sdata2 @105 */
SECTION_SDATA2 static f32 lit_105 = 0.5f;
/* 8045653C-80456540 004B3C 0004+00 1/1 0/0 0/0 .sdata2 @106 */
SECTION_SDATA2 static f32 lit_106 = 0.01745329238474369f;
m[3][0] = 0.0F;
m[3][1] = 0.0F;
m[3][2] = 0.0F;
m[3][3] = 1.0F;
}
/* 80346F28-80346FF8 341868 00D0+00 0/0 6/6 0/0 .text C_MTXPerspective */
// Functions match but has issues with float constants
#ifdef NONMATCHING
void C_MTXPerspective(Mtx44 m, f32 fovY, f32 aspect, f32 n, f32 f)
{
f32 temp_f3;
@@ -68,55 +73,11 @@ void C_MTXPerspective(Mtx44 m, f32 fovY, f32 aspect, f32 n, f32 f)
m[3][2] = -1.0F;
m[3][3] = 0.0F;
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void C_MTXPerspective(Mtx44 m, f32 fovy, f32 aspect, f32 near, f32 far) {
nofralloc
#include "asm/dolphin/mtx/mtx44/C_MTXPerspective.s"
}
#pragma pop
#endif
/* 80346FF8-80347090 341938 0098+00 0/0 11/11 2/2 .text C_MTXOrtho */
#ifdef NONMATCHING
void C_MTXOrtho(Mtx44 m, f32 t, f32 b, f32 l, f32 r, f32 n, f32 f)
{
f32 temp_f8;
f32 temp_f10;
f32 temp_f4;
__C_MTXOrtho1(m, l, r, t, b);
temp_f10 = 1.0F / (r - l);
m[0][0] = 2.0F * temp_f10;
m[0][1] = 0.0F;
m[0][2] = 0.0F;
m[0][3] = temp_f10 * -(r + l);
temp_f8 = 1.0F / (t - b);
m[1][0] = 0.0F;
m[1][1] = 2.0F * temp_f8;
m[1][2] = 0.0F;
m[1][3] = temp_f8 * -(t + b);
temp_f4 = 1.0F / (f - n);
m[2][0] = 0.0F;
m[2][1] = 0.0F;
m[2][2] = -1.0F * temp_f4;
m[2][3] = -f * temp_f4;
m[3][0] = 0.0F;
m[3][1] = 0.0F;
m[3][2] = 0.0F;
m[3][3] = 1.0F;
__C_MTXOrtho2(m, f, n);
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void C_MTXOrtho(Mtx44 m, f32 top, f32 bottom, f32 left, f32 right, f32 near, f32 far) {
nofralloc
#include "asm/dolphin/mtx/mtx44/C_MTXOrtho.s"
}
#pragma pop
#endif
+7 -4
View File
@@ -18,9 +18,9 @@ volatile OSContext* __OSFPUContext : (OS_BASE_CACHED | 0x00D8);
// External References:
//
extern u32 __OSLastInterruptSrr0;
extern s16 __OSLastInterrupt[4];
extern OSTime __OSLastInterruptTime;
extern volatile u32 __OSLastInterruptSrr0;
extern volatile s16 __OSLastInterrupt;
extern volatile OSTime __OSLastInterruptTime;
//
// Declarations:
@@ -103,7 +103,10 @@ OSErrorHandler OSSetErrorHandler(OSError error, OSErrorHandler handler) {
/* ############################################################################################## */
/* 803CF918-803CF930 02CA38 0016+02 1/1 0/0 0/0 .data @13 */
#pragma push
#pragma force_active on
SECTION_DATA static char lit_13[] = " in \"%s\" on line %d.\n";
#pragma pop
// /* 803CF930-803CF958 02CA50 0026+02 0/0 0/0 0/0 .data @14 */
#pragma push
@@ -321,7 +324,7 @@ void __OSUnhandledException(__OSException exception, OSContext* context, u32 dsi
break;
}
OSReport("\nLast interrupt (%d): SRR0 = 0x%08x TB = 0x%016llx\n", __OSLastInterrupt[0],
OSReport("\nLast interrupt (%d): SRR0 = 0x%08x TB = 0x%016llx\n", __OSLastInterrupt,
__OSLastInterruptSrr0, __OSLastInterruptTime);
PPCHalt();
+1 -1
View File
@@ -44,7 +44,7 @@ extern u32 __PADFixBits;
static u32 Type[4];
/* 8044CB80-8044CBB0 0798A0 0030+00 8/8 0/0 0/0 .bss Origin */
static PADStatus Origin[4];
static volatile PADStatus Origin[4];
/* 80450A24-80450A28 0004A4 0004+00 7/7 0/0 0/0 .sdata ResettingChan */
SECTION_SDATA static s32 ResettingChan = 0x00000020;