mirror of https://github.com/zeldaret/tp.git
dolphin work (#2238)
This commit is contained in:
parent
98f8e7e741
commit
80f30409f1
41
configure.py
41
configure.py
|
|
@ -226,6 +226,9 @@ elif args.warn == "off":
|
|||
elif args.warn == "error":
|
||||
cflags_base.append("-W error")
|
||||
|
||||
cflags_noopt = cflags_base[:]
|
||||
cflags_noopt.remove("-O4,p")
|
||||
|
||||
# Metrowerks library flags
|
||||
cflags_runtime = [
|
||||
*cflags_base,
|
||||
|
|
@ -868,15 +871,18 @@ config.libs = [
|
|||
Object(NonMatching, "Z2AudioLib/Z2AudioMgr.cpp"),
|
||||
],
|
||||
},
|
||||
DolphinLib(
|
||||
"gf",
|
||||
[
|
||||
Object(NonMatching, "dolphin/gf/GFGeometry.cpp"),
|
||||
Object(NonMatching, "dolphin/gf/GFLight.cpp"),
|
||||
Object(NonMatching, "dolphin/gf/GFPixel.cpp"),
|
||||
Object(NonMatching, "dolphin/gf/GFTev.cpp"),
|
||||
{
|
||||
"lib": "gf",
|
||||
"mw_version": "GC/2.7",
|
||||
"cflags": cflags_noopt,
|
||||
"progress_category": "sdk",
|
||||
"objects": [
|
||||
Object(NonMatching, "dolphin/gf/GFGeometry.cpp", extra_cflags=["-O3"]),
|
||||
Object(Matching, "dolphin/gf/GFLight.cpp", extra_cflags=["-O3"]),
|
||||
Object(Matching, "dolphin/gf/GFPixel.cpp", extra_cflags=["-O3"]),
|
||||
Object(Matching, "dolphin/gf/GFTev.cpp", extra_cflags=["-O3"]),
|
||||
],
|
||||
),
|
||||
},
|
||||
JSystemLib(
|
||||
"JKernel",
|
||||
[
|
||||
|
|
@ -1063,13 +1069,16 @@ config.libs = [
|
|||
Object(Matching, "dolphin/os/__ppc_eabi_init.cpp"),
|
||||
],
|
||||
),
|
||||
DolphinLib(
|
||||
"exi",
|
||||
[
|
||||
Object(NonMatching, "dolphin/exi/EXIBios.c", extra_cflags=["-O3"]),
|
||||
Object(Matching, "dolphin/exi/EXIUart.c"),
|
||||
{
|
||||
"lib": "exi",
|
||||
"mw_version": "GC/1.2.5n",
|
||||
"cflags": cflags_noopt,
|
||||
"progress_category": "sdk",
|
||||
"objects": [
|
||||
Object(Matching, "dolphin/exi/EXIBios.c", extra_cflags=["-O3,p"]),
|
||||
Object(Matching, "dolphin/exi/EXIUart.c", extra_cflags=["-O4,p"]),
|
||||
],
|
||||
),
|
||||
},
|
||||
DolphinLib(
|
||||
"si",
|
||||
[
|
||||
|
|
@ -1109,7 +1118,7 @@ config.libs = [
|
|||
DolphinLib(
|
||||
"vi",
|
||||
[
|
||||
Object(NonMatching, "dolphin/vi/vi.c"),
|
||||
Object(Matching, "dolphin/vi/vi.c"),
|
||||
],
|
||||
),
|
||||
DolphinLib(
|
||||
|
|
@ -1169,7 +1178,7 @@ config.libs = [
|
|||
Object(Matching, "dolphin/gx/GXGeometry.c"),
|
||||
Object(Matching, "dolphin/gx/GXFrameBuf.c"),
|
||||
Object(Matching, "dolphin/gx/GXLight.c", extra_cflags=["-fp_contract off"]),
|
||||
Object(NonMatching, "dolphin/gx/GXTexture.c"),
|
||||
Object(Matching, "dolphin/gx/GXTexture.c"),
|
||||
Object(Matching, "dolphin/gx/GXBump.c"),
|
||||
Object(Matching, "dolphin/gx/GXTev.c"),
|
||||
Object(Matching, "dolphin/gx/GXPixel.c"),
|
||||
|
|
|
|||
|
|
@ -4,58 +4,18 @@
|
|||
//
|
||||
|
||||
#include "dolphin/gf/GFGeometry.h"
|
||||
#include "dol2asm.h"
|
||||
|
||||
//
|
||||
// Types:
|
||||
//
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
extern "C" void GFSetGenMode2__FUcUcUcUc11_GXCullMode();
|
||||
extern "C" extern u8 data_804508B0[8];
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 804508A8-804508B0 000328 0004+04 1/1 0/0 0/0 .sdata cm2hw$539 */
|
||||
SECTION_SDATA static u8 cm2hw[4 + 4 /* padding */] = {
|
||||
0x00,
|
||||
0x02,
|
||||
0x01,
|
||||
0x03,
|
||||
/* padding */
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
};
|
||||
|
||||
/* 802CDDC8-802CDE54 2C8708 008C+00 0/0 0/0 1/1 .text GFSetGenMode2__FUcUcUcUc11_GXCullMode */
|
||||
// reg alloc
|
||||
#ifdef NONMATCHING
|
||||
// NONMATCHING regalloc
|
||||
void GFSetGenMode2(u8 param_0, u8 param_1, u8 param_2, u8 param_3, _GXCullMode param_4) {
|
||||
static u8 cm2hw[4] = {0, 2, 1, 3};
|
||||
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
|
||||
void GFSetGenMode2(u8 param_0, u8 param_1, u8 param_2, u8 param_3, _GXCullMode param_4) {
|
||||
// NONMATCHING
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 804508B0-804508B8 000330 0008+00 0/0 2/2 0/0 .sdata None */
|
||||
SECTION_SDATA extern u8 data_804508B0[8] = {
|
||||
extern u8 data_804508B0[8] = {
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -459,7 +459,17 @@ GXTlutRegionCallback GXSetTlutRegionCallback(GXTlutRegionCallback callback) {
|
|||
|
||||
/* 8035E6D4-8035E750 359014 007C+00 0/0 1/1 0/0 .text GXSetTexCoordScaleManually */
|
||||
void GXSetTexCoordScaleManually(GXTexCoordID coord, GXBool enable, u16 s_scale, u16 t_scale) {
|
||||
// NONMATCHING
|
||||
__GXData->tcsManEnab = (__GXData->tcsManEnab & ~(1 << coord)) | (enable << coord);
|
||||
if (enable == GX_FALSE) {
|
||||
return;
|
||||
}
|
||||
GX_SET_REG(__GXData->suTs0[coord], (u16)(s_scale - 1), 16, 31);
|
||||
GX_SET_REG(__GXData->suTs1[coord], (u16)(t_scale - 1), 16, 31);
|
||||
GXWGFifo.u8 = 0x61;
|
||||
GXWGFifo.u32 = __GXData->suTs0[coord];
|
||||
GXWGFifo.u8 = 0x61;
|
||||
GXWGFifo.u32 = __GXData->suTs1[coord];
|
||||
__GXData->bpSentNot = 0;
|
||||
}
|
||||
|
||||
/* 8035E750-8035E7F0 359090 00A0+00 1/1 0/0 0/0 .text __SetSURegs */
|
||||
|
|
@ -623,4 +633,4 @@ void __GXSetTmemConfig(u32 config) {
|
|||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include "dolphin/vi.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/os.h"
|
||||
#include "gx/GXStruct.h"
|
||||
|
||||
#define CLAMP(x, l, h) (((x) > (h)) ? (h) : (((x) < (l)) ? (l) : (x)))
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
|
|
@ -402,17 +403,16 @@ static VITimingInfo* getTiming(VITVMode mode) {
|
|||
}
|
||||
|
||||
/* 8034C310-8034C514 346C50 0204+00 1/1 0/0 0/0 .text __VIInit */
|
||||
#ifdef NONMATCHING
|
||||
void __VIInit(VITVMode mode) {
|
||||
VITimingInfo* tm;
|
||||
u32 nonInter;
|
||||
vu32 a;
|
||||
vu32 a, b;
|
||||
u32 tv, tvForReg;
|
||||
|
||||
u16 hct, vct;
|
||||
|
||||
nonInter = mode & 2;
|
||||
tv = (u32)mode >> 2;
|
||||
nonInter = mode & 3;
|
||||
|
||||
*(u32*)OSPhysicalToCached(0xCC) = tv;
|
||||
|
||||
|
|
@ -454,23 +454,28 @@ void __VIInit(VITVMode mode) {
|
|||
vct = (tm->numHalfLines / 2 + 1) | (1 << 12) | (0 << 15);
|
||||
__VIRegs[VI_DISP_INT_0U] = hct << 0;
|
||||
__VIRegs[VI_DISP_INT_0] = vct;
|
||||
|
||||
switch (tv) {
|
||||
case VI_TVMODE_NTSC_DS:
|
||||
case VI_TVMODE_NTSC_PROG:
|
||||
case VI_TVMODE_NTSC_3D:
|
||||
tvForReg = tv;
|
||||
break;
|
||||
default:
|
||||
tvForReg = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (mode != VI_TVMODE_NTSC_PROG && mode != VI_TVMODE_NTSC_3D && mode != VI_TVMODE_GCA_PROG) {
|
||||
if (nonInter <= 1) {
|
||||
__VIRegs[VI_DISP_CONFIG] =
|
||||
(1 << 0) | (0 << 1) | (nonInter << 2) | (0 << 3) | (0 << 4) | (0 << 6) | (tv << 8);
|
||||
(1 << 0) | (0 << 1) | ((nonInter & 1) << 2) | (0 << 3) | (0 << 4) | (0 << 6) | (tvForReg << 8);
|
||||
__VIRegs[VI_CLOCK_SEL] = 0;
|
||||
|
||||
} else {
|
||||
__VIRegs[VI_DISP_CONFIG] =
|
||||
(1 << 0) | (0 << 1) | (1 << 2) | (0 << 3) | (0 << 4) | (0 << 6) | (tv << 8);
|
||||
(1 << 0) | (0 << 1) | (1 << 2) | (0 << 3) | (0 << 4) | (0 << 6) | (tvForReg << 8);
|
||||
__VIRegs[VI_CLOCK_SEL] = 1;
|
||||
}
|
||||
}
|
||||
#else
|
||||
void __VIInit() {
|
||||
// NONMATCHING
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 80450A10-80450A14 -00001 0004+00 1/1 0/0 0/0 .sdata __VIVersion */
|
||||
SECTION_SDATA static void* __VIVersion = (void*)&lit_1;
|
||||
|
|
@ -847,21 +852,10 @@ static void PrintDebugPalCaution(void) {
|
|||
}
|
||||
}
|
||||
|
||||
/* 803D1AD8-803D1B24 02EBF8 004B+01 0/1 0/0 0/0 .data @538 */
|
||||
#pragma push
|
||||
#pragma force_active on
|
||||
SECTION_DATA static char lit_538[] =
|
||||
"VIConfigure(): Tried to change mode from (%d) to (%d), which is forbidden\n";
|
||||
#pragma pop
|
||||
|
||||
/* 80450A14-80450A1C 000494 0005+03 1/1 0/0 0/0 .sdata @537 */
|
||||
SECTION_SDATA static char lit_537[] = "vi.c";
|
||||
|
||||
/* 8034CE8C-8034D694 3477CC 0808+00 0/0 2/2 0/0 .text VIConfigure */
|
||||
#ifdef NONMATCHING
|
||||
void VIConfigure(const GXRenderModeObj* obj) {
|
||||
VITimingInfo* tm;
|
||||
u32 regDspCfg;
|
||||
u32 regDspCfg, regClockSel, regClockSel2;
|
||||
BOOL enabled;
|
||||
u32 newNonInter, tvInBootrom, tvInGame;
|
||||
|
||||
|
|
@ -885,7 +879,7 @@ void VIConfigure(const GXRenderModeObj* obj) {
|
|||
case VI_NTSC:
|
||||
case VI_GCA:
|
||||
case 7:
|
||||
if (tvInGame == VI_NTSC || tvInGame == VI_MPAL || tvInGame == VI_GCA) {
|
||||
if (tvInGame == VI_NTSC || tvInGame == VI_MPAL || tvInGame == VI_GCA || tvInGame == 7) {
|
||||
break;
|
||||
}
|
||||
goto panic;
|
||||
|
|
@ -936,35 +930,38 @@ void VIConfigure(const GXRenderModeObj* obj) {
|
|||
setInterruptRegs(tm);
|
||||
|
||||
regDspCfg = regs[VI_DISP_CONFIG];
|
||||
regClockSel = regs[VI_CLOCK_SEL];
|
||||
// TODO: USE BIT MACROS OR SOMETHING
|
||||
if ((HorVer.nonInter == VI_PROGRESSIVE) || (HorVer.nonInter == VI_3D)) {
|
||||
regDspCfg = (((u32)(regDspCfg)) & ~0x00000004) | (((u32)(1)) << 2);
|
||||
regClockSel2 = (regClockSel & ~1) | 1;
|
||||
} else {
|
||||
regDspCfg = (((u32)(regDspCfg)) & ~0x00000004) | (((u32)(HorVer.nonInter & 1)) << 2);
|
||||
regClockSel2 = regClockSel & ~1;
|
||||
}
|
||||
|
||||
regDspCfg = (((u32)(regDspCfg)) & ~0x00000008) | (((u32)(HorVer.is3D)) << 3);
|
||||
|
||||
if ((HorVer.tv == VI_DEBUG_PAL) || (HorVer.tv == VI_EURGB60) || (HorVer.tv == VI_GCA)) {
|
||||
regDspCfg = (((u32)(regDspCfg)) & ~0x00000300);
|
||||
} else {
|
||||
if ((HorVer.tv == VI_TVMODE_NTSC_DS) || (HorVer.tv == VI_TVMODE_NTSC_PROG) || (HorVer.tv == VI_TVMODE_NTSC_3D)) {
|
||||
regDspCfg = (((u32)(regDspCfg)) & ~0x00000300) | (((u32)(HorVer.tv)) << 8);
|
||||
} else {
|
||||
regDspCfg = (((u32)(regDspCfg)) & ~0x00000300);
|
||||
}
|
||||
|
||||
regs[VI_DISP_CONFIG] = (u16)regDspCfg;
|
||||
|
||||
// regDspCfg = regs[VI_CLOCK_SEL];
|
||||
// if (obj->vi_tv_mode == VI_TVMODE_NTSC_PROG || obj->vi_tv_mode == VI_TVMODE_NTSC_3D ||
|
||||
// obj->vi_tv_mode == VI_TVMODE_GCA_PROG)
|
||||
// {
|
||||
// regDspCfg = (u32)(regDspCfg & ~0x1) | 1;
|
||||
// } else {
|
||||
// regDspCfg = (u32)(regDspCfg & ~0x1);
|
||||
// }
|
||||
|
||||
regs[VI_CLOCK_SEL] = (u16)regClockSel2;
|
||||
|
||||
changed |= VI_BITMASK(0x01);
|
||||
|
||||
regDspCfg = regs[VI_CLOCK_SEL];
|
||||
if (obj->vi_tv_mode == VI_TVMODE_NTSC_PROG || obj->vi_tv_mode == VI_TVMODE_NTSC_3D ||
|
||||
obj->vi_tv_mode == VI_TVMODE_GCA_PROG)
|
||||
{
|
||||
regDspCfg = (u32)(regDspCfg & ~0x1) | 1;
|
||||
} else {
|
||||
regDspCfg = (u32)(regDspCfg & ~0x1);
|
||||
}
|
||||
|
||||
regs[VI_CLOCK_SEL] = (u16)regDspCfg;
|
||||
|
||||
changed |= 0x200;
|
||||
|
||||
setScalingRegs(HorVer.panSizeX, HorVer.dispSizeX, HorVer.is3D);
|
||||
|
|
@ -981,11 +978,9 @@ void VIConfigure(const GXRenderModeObj* obj) {
|
|||
tm->prbEven, tm->psbOdd, tm->psbEven, HorVer.isBlack);
|
||||
OSRestoreInterrupts(enabled);
|
||||
}
|
||||
#else
|
||||
void VIConfigure(const GXRenderModeObj*) {
|
||||
// NONMATCHING
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 80450A14-80450A1C 000494 0005+03 1/1 0/0 0/0 .sdata @537 */
|
||||
SECTION_SDATA static char lit_537[] = "vi.c";
|
||||
|
||||
/* 8034D694-8034D7C4 347FD4 0130+00 0/0 9/9 0/0 .text VIFlush */
|
||||
void VIFlush(void) {
|
||||
|
|
@ -1204,4 +1199,4 @@ void __VIGetCurrentPosition(s16* x, s16* y) {
|
|||
u32 h, v;
|
||||
GetCurrentDisplayPosition(&h, &v);
|
||||
__VIDisplayPositionToXY(h, v, x, y);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue