1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-04 06:54:33 +00:00

Match the last function in PreRender.c (#763)

This commit is contained in:
Roman971 2021-04-06 20:56:30 +02:00 committed by GitHub
parent 2126685472
commit 03882c9214
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 587 deletions

View file

@ -471,8 +471,6 @@ void func_800C2500(PreRenderContext* this, s32 x, s32 y) {
this->fbufSave[x + y * this->width] = pxOut.rgba;
}
#ifdef NON_MATCHING
// Redundant conditional is the only nonmatching.
void func_800C2FE4(PreRenderContext* this) {
s32 x;
s32 y;
@ -480,12 +478,10 @@ void func_800C2FE4(PreRenderContext* this) {
u8* buffR = alloca(this->width);
u8* buffG = alloca(this->width);
u8* buffB = alloca(this->width);
s32 pad[3];
s32 pxR;
s32 pxG;
s32 pxB;
s32 medR;
s32 medG;
s32 medB;
for (y = 0; y < this->height; y++) {
for (x = 0; x < this->width; x++) {
@ -496,6 +492,7 @@ void func_800C2FE4(PreRenderContext* this) {
buffG[x] = pxIn.g;
buffB[x] = pxIn.b;
}
for (x = 1; x < this->width - 1; x++) {
Color_RGB5A1 pxOut;
s32 a = this->cvgSave[x + y * this->width];
@ -506,9 +503,7 @@ void func_800C2FE4(PreRenderContext* this) {
}
if (((HREG(80) == 0xF) ? HREG(81) : 0) != 0) {
// There's a redundant branch in the ASM that taken literally looks like this
// phi_v0 = ((HREG(80) == 0xF) ? 0 : 0);
// if (((HREG(80) == 0xF) ? HREG(81) : phi_v0) == 5) {
if (((HREG(80) == 0xF) ? HREG(81) : 0) != 0) {}
if (((HREG(80) == 0xF) ? HREG(81) : 0) == 5) {
pxR = 31;
@ -520,13 +515,12 @@ void func_800C2FE4(PreRenderContext* this) {
u8* temp_s2 = &buffB[x - 1];
if (((HREG(80) == 0xF) ? HREG(81) : 0) == 3) {
medR = MEDIAN3(temp_s0[0], temp_s0[1], temp_s0[2]);
medG = MEDIAN3(temp_s1[0], temp_s1[1], temp_s1[2]);
medB = MEDIAN3(temp_s2[0], temp_s2[1], temp_s2[2]);
osSyncPrintf("red=%3d %3d %3d %3d grn=%3d %3d %3d %3d blu=%3d %3d %3d %3d \n", temp_s0[0],
temp_s0[1], temp_s0[2], medR, temp_s1[0], temp_s1[1], temp_s1[2], medG, temp_s2[0],
temp_s2[1], temp_s2[2], medB);
temp_s0[1], temp_s0[2], MEDIAN3(temp_s0[0], temp_s0[1], temp_s0[2]), temp_s1[0],
temp_s1[1], temp_s1[2], MEDIAN3(temp_s1[0], temp_s1[1], temp_s1[2]), temp_s2[0],
temp_s2[1], temp_s2[2], MEDIAN3(temp_s2[0], temp_s2[1], temp_s2[2]));
}
if (((HREG(80) == 0xF) ? HREG(81) : 0) == 1) {
pxR = MEDIAN3(temp_s0[0], temp_s0[1], temp_s0[2]);
pxG = MEDIAN3(temp_s1[0], temp_s1[1], temp_s1[2]);
@ -546,9 +540,6 @@ void func_800C2FE4(PreRenderContext* this) {
}
}
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/PreRender/func_800C2FE4.s")
#endif
void PreRender_Calc(PreRenderContext* this) {
s32 x;