mirror of
https://github.com/zeldaret/tp
synced 2026-08-10 19:17:28 -04:00
d_a_kytag06 fully done / d_msg_class/object work (#300)
* d_a_kytag06 OK and d_msg_class/object wip * add some GXDraw functions * cleanup kytag6 * remove asm
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
|
||||
#include "JSystem/JMessage/resource.h"
|
||||
#include "JSystem/JGadget/binary.h"
|
||||
#include "dol2asm.h"
|
||||
#include "MSL_C/MSL_Common/Src/mem.h"
|
||||
#include "dol2asm.h"
|
||||
|
||||
//
|
||||
// Types:
|
||||
@@ -269,39 +269,27 @@ asm bool JMessage::TParse::parseBlock_next(void const** param_0, u32* param_1, u
|
||||
|
||||
/* 802A9490-802A94A8 2A3DD0 0018+00 1/0 0/0 0/0 .text
|
||||
* parseCharacter_1Byte__Q28JMessage6localeFPPCc */
|
||||
// reg swap
|
||||
#ifdef NONMATCHING
|
||||
int JMessage::locale::parseCharacter_1Byte(char const** pString) {
|
||||
u8* c;
|
||||
int ret;
|
||||
int JMessage::locale::parseCharacter_1Byte(char const** string) {
|
||||
u8 parse_char = **string;
|
||||
|
||||
c = (u8*)*pString;
|
||||
ret = *c;
|
||||
|
||||
*pString = *pString + 1;
|
||||
return ret;
|
||||
*string = *string + 1;
|
||||
return parse_char;
|
||||
}
|
||||
#else
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm int JMessage::locale::parseCharacter_1Byte(char const** param_0) {
|
||||
nofralloc
|
||||
#include "asm/JSystem/JMessage/resource/parseCharacter_1Byte__Q28JMessage6localeFPPCc.s"
|
||||
}
|
||||
#pragma pop
|
||||
#endif
|
||||
|
||||
/* 802A94A8-802A94D4 2A3DE8 002C+00 1/0 0/0 0/0 .text
|
||||
* parseCharacter_2Byte__Q28JMessage6localeFPPCc */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm int JMessage::locale::parseCharacter_2Byte(char const** param_0) {
|
||||
nofralloc
|
||||
#include "asm/JSystem/JMessage/resource/parseCharacter_2Byte__Q28JMessage6localeFPPCc.s"
|
||||
int JMessage::locale::parseCharacter_2Byte(char const** string) {
|
||||
u8** tmp_str = (u8**)string;
|
||||
|
||||
u8 hi = **tmp_str;
|
||||
*tmp_str = *tmp_str + 1;
|
||||
|
||||
u8 lo = **tmp_str;
|
||||
int parse_char = (hi << 8) | lo;
|
||||
*tmp_str = *tmp_str + 1;
|
||||
|
||||
return parse_char;
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* 802A94D4-802A9528 2A3E14 0054+00 1/1 0/0 0/0 .text lower_bound<PCUl,Ul>__3stdFPCUlPCUlRCUl */
|
||||
#pragma push
|
||||
|
||||
+259
-2
@@ -4,8 +4,8 @@
|
||||
//
|
||||
|
||||
#include "dolphin/gx/GXAttr.h"
|
||||
#include "dolphin/gx/GXInit.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/gx/GXInit.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
@@ -137,6 +137,107 @@ asm void __GXCalculateVLim(void) {
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
void GXGetVtxDesc(int param_0, GXAttrType* param_1) {
|
||||
int local_38;
|
||||
|
||||
switch (param_0) {
|
||||
case 0:
|
||||
local_38 = __GXData->field_0x14 & 1;
|
||||
break;
|
||||
case 1:
|
||||
local_38 = (__GXData->field_0x14 & 2) >> 1;
|
||||
break;
|
||||
case 2:
|
||||
local_38 = (__GXData->field_0x14 & 4) >> 2;
|
||||
break;
|
||||
case 3:
|
||||
local_38 = (__GXData->field_0x14 & 8) >> 3;
|
||||
break;
|
||||
case 4:
|
||||
local_38 = (__GXData->field_0x14 & 0x10) >> 4;
|
||||
break;
|
||||
case 5:
|
||||
local_38 = (__GXData->field_0x14 & 0x20) >> 5;
|
||||
break;
|
||||
case 6:
|
||||
local_38 = (__GXData->field_0x14 & 0x40) >> 6;
|
||||
break;
|
||||
case 7:
|
||||
local_38 = (__GXData->field_0x14 & 0x80) >> 7;
|
||||
break;
|
||||
case 8:
|
||||
local_38 = (__GXData->field_0x14 & 0x100) >> 8;
|
||||
break;
|
||||
case 9:
|
||||
local_38 = (__GXData->field_0x14 & 0x600) >> 9;
|
||||
break;
|
||||
case 10:
|
||||
if (__GXData->field_0x4d4 != 0) {
|
||||
local_38 = (__GXData->field_0x14 & 0x1800) >> 11;
|
||||
} else {
|
||||
local_38 = 0;
|
||||
}
|
||||
break;
|
||||
case 0x19:
|
||||
if (__GXData->field_0x4d5 != 0) {
|
||||
local_38 = (__GXData->field_0x14 & 0x1800) >> 11;
|
||||
} else {
|
||||
local_38 = 0;
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
local_38 = (__GXData->field_0x14 & 0x6000) >> 13;
|
||||
break;
|
||||
case 12:
|
||||
local_38 = (__GXData->field_0x14 & 0x18000) >> 15;
|
||||
break;
|
||||
case 13:
|
||||
local_38 = (__GXData->field_0x18 & 3);
|
||||
break;
|
||||
case 14:
|
||||
local_38 = (__GXData->field_0x18 & 0xC) >> 2;
|
||||
break;
|
||||
case 15:
|
||||
local_38 = (__GXData->field_0x18 & 0x30) >> 4;
|
||||
break;
|
||||
case 16:
|
||||
local_38 = (__GXData->field_0x18 & 0xC0) >> 6;
|
||||
break;
|
||||
case 17:
|
||||
local_38 = (__GXData->field_0x18 & 0x300) >> 8;
|
||||
break;
|
||||
case 18:
|
||||
local_38 = (__GXData->field_0x18 & 0xC00) >> 10;
|
||||
break;
|
||||
case 19:
|
||||
local_38 = (__GXData->field_0x18 & 0x3000) >> 12;
|
||||
break;
|
||||
case 20:
|
||||
local_38 = (__GXData->field_0x18 & 0xC000) >> 14;
|
||||
break;
|
||||
default:
|
||||
local_38 = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
*param_1 = local_38;
|
||||
}
|
||||
|
||||
void GXGetVtxDescv(GXVtxDescList* attrPtr) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i <= 0x14; i++) {
|
||||
attrPtr[i].attr = (GXAttr)i;
|
||||
GXGetVtxDesc(i, &attrPtr[i].type);
|
||||
}
|
||||
|
||||
attrPtr[i].attr = (GXAttr)0x19;
|
||||
GXGetVtxDesc(0x19, &attrPtr[i].type);
|
||||
|
||||
i++;
|
||||
attrPtr[i].attr = (GXAttr)0xFF;
|
||||
}
|
||||
|
||||
/* 8035B58C-8035B5C4 355ECC 0038+00 0/0 66/66 7/7 .text GXClearVtxDesc */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
@@ -205,6 +306,161 @@ asm void __GXSetVAT(void) {
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
static u8 GetFracForNrm(int param_0) {
|
||||
int var_r31;
|
||||
|
||||
switch (param_0) {
|
||||
case 1:
|
||||
var_r31 = 6;
|
||||
break;
|
||||
case 3:
|
||||
var_r31 = 14;
|
||||
break;
|
||||
default:
|
||||
case 2:
|
||||
var_r31 = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return var_r31;
|
||||
}
|
||||
|
||||
void GXGetVtxAttrFmtv(GXVtxFmt param_0, GXVtxAttrFmtList* param_1) {
|
||||
s32 tmp;
|
||||
s32 tmp2;
|
||||
s32 tmp3;
|
||||
int i;
|
||||
|
||||
#ifdef DEBUG
|
||||
// not fully matching
|
||||
tmp = 1;
|
||||
if (data_8074d3c8 != 0) {
|
||||
OSPanic("GXAttr.c", 941, "\'GXGetVtxAttrFmtv\' is not allowed between GXBegin/GXEnd");
|
||||
tmp = 0;
|
||||
}
|
||||
|
||||
tmp2 = 1;
|
||||
if (param_1 == NULL) {
|
||||
OSPanic("GXAttr.c", 942, "GXSetVtxAttrFmt: list pointer is NULL");
|
||||
tmp2 = 0;
|
||||
}
|
||||
|
||||
tmp3 = 1;
|
||||
if (param_0 >= 8) {
|
||||
OSPanic("GXAttr.c", 943, "GXSetVtxAttrFmt: Format Index is out of range");
|
||||
tmp3 = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 9; i <= 0x14; i++) {
|
||||
param_1->mAttrib = i;
|
||||
GXGetVtxAttrFmt(param_0, i, ¶m_1->mCompCnt, ¶m_1->mCompType, ¶m_1->mCompShift);
|
||||
param_1++;
|
||||
}
|
||||
|
||||
param_1->mAttrib = 0xFF;
|
||||
}
|
||||
|
||||
void GXGetVtxAttrFmt(GXVtxFmt param_0, int param_1, GXCompCnt* param_2, GXCompType* param_3,
|
||||
u8* param_4) {
|
||||
s32 tmp;
|
||||
s32 tmp2;
|
||||
GXCompCnt* tmp_1;
|
||||
GXCompCnt* tmp_2;
|
||||
u32* tmp_3;
|
||||
|
||||
#ifdef DEBUG
|
||||
// not fully matching
|
||||
tmp = 1;
|
||||
if (data_8074d3c8) {
|
||||
OSPanic("GXAttr.c", 844, "\'GXGetVtxAttrFmt\' is not allowed between GXBegin/GXEnd");
|
||||
tmp = 0;
|
||||
}
|
||||
|
||||
tmp2 = 1;
|
||||
if (param_0 >= 8) {
|
||||
OSPanic("GXAttr.c", 845, "GXSetVtxAttrFmt: Format Index is out of range");
|
||||
tmp2 = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
tmp_1 = &__GXData->field_0x1c[param_0];
|
||||
tmp_2 = &__GXData->field_0x3c[param_0];
|
||||
tmp_3 = &__GXData->field_0x5c[param_0];
|
||||
|
||||
switch (param_1) {
|
||||
case 9:
|
||||
*param_2 = *tmp_1 & 1;
|
||||
*param_3 = (*tmp_1 & 0xE) >> 1;
|
||||
*param_4 = (*tmp_1 & 0x1F0) >> 4;
|
||||
break;
|
||||
case 10:
|
||||
case 0x19:
|
||||
*param_2 = (*tmp_1 & 0x200) >> 9;
|
||||
if (*param_2 == 1 && ((*tmp_1 & 0x80000000) >> 31) != 0) {
|
||||
*param_2 = 2;
|
||||
}
|
||||
|
||||
*param_3 = (*tmp_1 & 0x1C00) >> 10;
|
||||
*param_4 = GetFracForNrm(*param_3);
|
||||
break;
|
||||
case 11:
|
||||
*param_2 = (*tmp_1 & 0x2000) >> 0xd;
|
||||
*param_3 = (*tmp_1 & 0x1C000) >> 0xe;
|
||||
*param_4 = 0;
|
||||
break;
|
||||
case 12:
|
||||
*param_2 = (*tmp_1 & 0x20000) >> 0x11;
|
||||
*param_3 = (*tmp_1 & 0x1C0000) >> 0x12;
|
||||
*param_4 = 0;
|
||||
break;
|
||||
case 13:
|
||||
*param_2 = (*tmp_1 & 0x200000) >> 0x15;
|
||||
*param_3 = (*tmp_1 & 0x1C00000) >> 0x16;
|
||||
*param_4 = ((*tmp_1 & 0x3e000000)) >> 25;
|
||||
break;
|
||||
case 14:
|
||||
*param_2 = *tmp_2 & 1;
|
||||
*param_3 = (*tmp_2 & 0xE) >> 1;
|
||||
*param_4 = (*tmp_2 & 0x1F0) >> 4;
|
||||
break;
|
||||
case 15:
|
||||
*param_2 = (*tmp_2 & 0x200) >> 9;
|
||||
*param_3 = (*tmp_2 & 0x1C00) >> 10;
|
||||
*param_4 = (*tmp_2 & 0x3E000) >> 13;
|
||||
break;
|
||||
case 16:
|
||||
*param_2 = (*tmp_2 & 0x40000) >> 0x12;
|
||||
*param_3 = (*tmp_2 & 0x380000) >> 0x13;
|
||||
*param_4 = (*tmp_2 & 0x7C00000) >> 0x16;
|
||||
break;
|
||||
case 17:
|
||||
*param_2 = (*tmp_2 & 0x8000000) >> 0x1B;
|
||||
*param_3 = (*tmp_2 & 0x70000000) >> 0x1C;
|
||||
*param_4 = (*tmp_3 & 0x1F);
|
||||
break;
|
||||
case 18:
|
||||
*param_2 = (*tmp_3 & 0x20) >> 5;
|
||||
*param_3 = (*tmp_3 & 0x1C0) >> 6;
|
||||
*param_4 = (*tmp_3 & 0x3E00) >> 9;
|
||||
break;
|
||||
case 19:
|
||||
*param_2 = (*tmp_3 & 0x4000) >> 0xe;
|
||||
*param_3 = (*tmp_3 & 0x38000) >> 0xf;
|
||||
*param_4 = (*tmp_3 & 0x7c0000) >> 0x12;
|
||||
break;
|
||||
case 20:
|
||||
*param_2 = (*tmp_3 & 0x800000) >> 0x17;
|
||||
*param_3 = (*tmp_3 & 0x7000000) >> 0x18;
|
||||
*param_4 = (*tmp_3 & 0xF8000000) >> 0x1b;
|
||||
break;
|
||||
default:
|
||||
*param_2 = 1;
|
||||
*param_3 = 0;
|
||||
*param_4 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* 8035BB28-8035BB6C 356468 0044+00 0/0 13/13 5/5 .text GXSetArray */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
@@ -253,7 +509,8 @@ SECTION_DATA static void* lit_739[21] = {
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void GXSetTexCoordGen2(GXTexCoordID dst, GXTexGenType type, GXTexGenSrc src, u32 mtx, GXBool renormalize, u32 pt_mtx) {
|
||||
asm void GXSetTexCoordGen2(GXTexCoordID dst, GXTexGenType type, GXTexGenSrc src, u32 mtx,
|
||||
GXBool renormalize, u32 pt_mtx) {
|
||||
nofralloc
|
||||
#include "asm/dolphin/gx/GXAttr/GXSetTexCoordGen2.s"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
#include "dolphin/gx/GXDraw.h"
|
||||
#include "dolphin/gx/GX.h"
|
||||
|
||||
static GXVtxDescList vcd[27];
|
||||
static GXVtxAttrFmtList vat[27];
|
||||
|
||||
void GetVertState(void) {
|
||||
GXGetVtxDescv(vcd);
|
||||
GXGetVtxAttrFmtv(GX_VTXFMT3, vat);
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
GXSetVtxDesc(GX_VA_NRM, GX_DIRECT);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT3, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT3, GX_VA_NRM, GX_NRM_XYZ, GX_F32, 0);
|
||||
}
|
||||
|
||||
void RestoreVertState(void) {
|
||||
GXSetVtxDescv(vcd);
|
||||
GXSetVtxAttrFmtv(GX_VTXFMT3, vat);
|
||||
}
|
||||
|
||||
// doesn't fully match debug
|
||||
void GXDrawCylinder(u8 numEdges) {
|
||||
f32 temp_f29;
|
||||
f32 temp_f30;
|
||||
f32 temp_f31;
|
||||
|
||||
s32 i;
|
||||
|
||||
f32 sp1A0[100];
|
||||
f32 sp10[100];
|
||||
|
||||
temp_f31 = 1.0f;
|
||||
temp_f30 = -temp_f31;
|
||||
|
||||
GetVertState();
|
||||
for (i = 0; i <= numEdges; i++) {
|
||||
temp_f29 = (i * 2.0f * 3.141593f) / numEdges;
|
||||
sp1A0[i] = cosf(temp_f29);
|
||||
sp10[i] = sinf(temp_f29);
|
||||
}
|
||||
|
||||
GXBegin(GX_TRIANGLESTRIP, GX_VTXFMT3, (numEdges + 1) * 2);
|
||||
for (i = 0; i <= numEdges; i++) {
|
||||
GXPosition3f32(sp1A0[i], sp10[i], temp_f30);
|
||||
GXNormal3f32(sp1A0[i], sp10[i], 0.0f);
|
||||
GXPosition3f32(sp1A0[i], sp10[i], temp_f31);
|
||||
GXNormal3f32(sp1A0[i], sp10[i], 0.0f);
|
||||
}
|
||||
i_GXEnd();
|
||||
|
||||
GXBegin(GX_TRIANGLEFAN, GX_VTXFMT3, numEdges + 2);
|
||||
GXPosition3f32(0.0f, 0.0f, temp_f31);
|
||||
GXNormal3f32(0.0f, 0.0f, 1.0f);
|
||||
for (i = 0; i <= numEdges; i++) {
|
||||
GXPosition3f32(sp1A0[i], -sp10[i], temp_f31);
|
||||
GXNormal3f32(0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
i_GXEnd();
|
||||
|
||||
GXBegin(GX_TRIANGLEFAN, GX_VTXFMT3, numEdges + 2);
|
||||
GXPosition3f32(0.0f, 0.0f, temp_f30);
|
||||
GXNormal3f32(0.0f, 0.0f, -1.0f);
|
||||
for (i = 0; i <= numEdges; i++) {
|
||||
GXPosition3f32(sp1A0[i], sp10[i], temp_f30);
|
||||
GXNormal3f32(0.0f, 0.0f, -1.0f);
|
||||
}
|
||||
i_GXEnd();
|
||||
|
||||
RestoreVertState();
|
||||
}
|
||||
@@ -14,6 +14,7 @@ LIBGX_A_CPP_FILES := \
|
||||
libs/dolphin/gx/GXBump.c \
|
||||
libs/dolphin/gx/GXTev.c \
|
||||
libs/dolphin/gx/GXPixel.c \
|
||||
libs/dolphin/gx/GXDraw.c \
|
||||
libs/dolphin/gx/GXDisplayList.c \
|
||||
libs/dolphin/gx/GXTransform.c \
|
||||
libs/dolphin/gx/GXPerf.c \
|
||||
@@ -30,6 +31,7 @@ LIBGX_A_O_FILES := \
|
||||
$(BUILD_DIR)/libs/dolphin/gx/GXBump.o \
|
||||
$(BUILD_DIR)/libs/dolphin/gx/GXTev.o \
|
||||
$(BUILD_DIR)/libs/dolphin/gx/GXPixel.o \
|
||||
$(BUILD_DIR)/libs/dolphin/gx/GXDraw.o \
|
||||
$(BUILD_DIR)/libs/dolphin/gx/GXDisplayList.o \
|
||||
$(BUILD_DIR)/libs/dolphin/gx/GXTransform.o \
|
||||
$(BUILD_DIR)/libs/dolphin/gx/GXPerf.o \
|
||||
|
||||
Reference in New Issue
Block a user