1
0
mirror of https://github.com/zeldaret/oot.git synced 2024-09-21 04:24:43 +00:00

Whitespace (#1112)

* remove trailing whitespaces

* minor docs tweaks

* some more trailing whitespaces

* few more tweaks
This commit is contained in:
playerskel 2022-01-24 00:09:02 +01:00 committed by GitHub
parent f344fe648b
commit f4a72303cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
150 changed files with 493 additions and 494 deletions

View File

@ -117,7 +117,7 @@ void EnJj_Init(EnJj *this, GlobalContext *globalCtx) {
ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f);
temp_v0 = this->actor.params;
temp_a1 = this + 0x164;
[...]
[...]
```
Typically for all buth the simplest functions, there is a lot that needs fixing before we are anywhere near seeing how close we are to the original code. You will notice that mips2c creates a lot of temporary variables. Usually most of these will turn out to not be real, and we need to remove the right ones to get the code to match.
@ -593,7 +593,7 @@ Put this between `struct EnJj;` and the actor struct in the header file. This al
We have actually learnt three useful pieces of information from this, the other two being that the function above Init is simply
```C
void func_80A87800(EnJj* this, EnJjActionFunc actionFunc) {
this->actionFunc = actionFunc;
this->actionFunc = actionFunc;
}
```
@ -695,7 +695,7 @@ extern UNK_TYPE D_0600BA8C;
// #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Jj/func_80A87800.s")
void func_80A87800(EnJj* this, EnJjActionFunc actionFunc) {
this->actionFunc = actionFunc;
this->actionFunc = actionFunc;
}
// #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Jj/EnJj_Init.s")
@ -904,7 +904,7 @@ except we still have some stack issues. Now that `temp_v0` is only used once, it
void EnJj_Init(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
EnJj* this = THIS;
...
...
```
It turns out that this is enough to completely fix the diff:

View File

@ -12,29 +12,29 @@
## Decompilation
- [Begining decompilation: order, Init and the actor struct](beginning_decomp.md)
- Order of decompilation
- Init and common actor features
- Initchains
- Actors and dynapoly actors
- Colliders
- Skelanime
- Order of decompilation
- Init and common actor features
- Initchains
- Actors and dynapoly actors
- Colliders
- Skelanime
- Matching
- Using diff
- control flow (branches) -> instruction ordering -> register allocation -> stack
- Matching
- Using diff
- control flow (branches) -> instruction ordering -> register allocation -> stack
- [The rest of the functions in the actor](other_functions.md)
- Order of decompilation
- Action Functions and other functions
- More on matching: the permuter
- More on matching: the permuter
- [Draw functions](draw_functions.md)
- [Data, migration and non-migration](data.md)
- Importing the data: early and late
- Fake symbols
- Inlining
- Importing the data: early and late
- Fake symbols
- Inlining
## [Object Decompilation](object_decomp.md)
- Object files
@ -46,9 +46,9 @@
- [Preparing to merge](merging.md)
- Preliminary documentation
- Preparing to PR
- Pull Requests
- Trello
- Preparing to PR
- Pull Requests
- Trello
## Appendices
- [Types, Structs and Padding](types_structs_padding.md) (a miscellany of useful stuff)

View File

@ -30,7 +30,7 @@ EnJj* this = THIS;
in the declarations as before. From now on, the process is rather different from the decompilation process used for the other functions. Here is the output of mips2c after sorting out the actor struct from Init, and with the arguments set back to `Actor* thisx`:
```C
void EnJj_Draw(Actor *thisx, GlobalContext *globalCtx) {
EnJj* this = THIS;
EnJj* this = THIS;
GraphicsContext *sp4C;
Gfx *sp3C;
@ -289,7 +289,8 @@ static Color_RGBA8 D_809F5E4C[] = {
{ 255, 255, 255, 255 }, { 255, 195, 175, 255 }, { 210, 255, 0, 255 },
{ 255, 255, 255, 255 }, { 210, 255, 0, 255 }, { 255, 195, 175, 255 },
{ 255, 255, 255, 255 }, { 255, 195, 175, 255 }, { 210, 255, 0, 255 },
};```
};
```
Now, we have two things to worry about: how to implement the negative pointer access, and how the second word is built. Negative accesses can be done by just subtracting 1, so that
```C
@ -304,7 +305,7 @@ or rather, since it is a `Color_RGB8`,
temp_v0_3->words.w1 = (temp_v1.b << 8) | (temp_v1.r << 0x18) | (temp_v1.g << 0x10) | 0xFF;
```
The last thing to worry about is how to put this word into the macro. Let's think aboout what the word actually is in a concrete case; it is easiest to see what is going on in hex, so suppose we are in the case
The last thing to worry about is how to put this word into the macro. Let's think about what the word actually is in a concrete case; it is easiest to see what is going on in hex, so suppose we are in the case
```C
temp_v1 = { 0xFF, 0xC3, 0xAF, 0xFF };
```
@ -465,7 +466,7 @@ s32 func_809F58E4(GlobalContext *globalCtx, s32 limbIndex, Gfx **dList, Vec3f *p
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1733);
gDPPipeSync(POLY_OPA_DISP++);
gDPSetEnvColor(POLY_OPA_DISP++, D_809F5E4C[this->type - 1].r, D_809F5E4C[this->type - 1].g, D_809F5E4C[this->type - 1].b, 255);
CLOSE_DISPS(globalCtx->state.gfxCtx, (const char*)"../z_en_dnt_nomal.c", 1743);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1743);
}
return 0;
}

View File

@ -698,7 +698,7 @@ void func_80A87D94(EnJj *this, GlobalContext *globalCtx) {
At the top we have
```C
temp_v0 = *globalCtx->unk1D94;
temp_v0 = *globalCtx->unk1D94;
if (temp_v0 != 1) {
if (temp_v0 != 2) {
if (temp_v0 != 3) {
@ -721,18 +721,18 @@ void func_80A87D94(EnJj *this, GlobalContext *globalCtx) {
switch (globalCtx->csCtx.npcActions[2]->action) {
case 1:
temp_v1_3 = this->unk_30A;
phi_v1 = temp_v1_3;
if ((temp_v1_3 & 2) != 0) {
this->unk_30E = 0;
this->unk_30F = Rand_S16Offset((u16)0x14, (u16)0x14);
this->unk_310 = 0;
temp_t9 = this->unk_30A ^ 2;
this->unk_311 = 0;
this->unk_30A = temp_t9;
phi_v1 = temp_t9 & 0xFFFF;
}
break;
temp_v1_3 = this->unk_30A;
phi_v1 = temp_v1_3;
if ((temp_v1_3 & 2) != 0) {
this->unk_30E = 0;
this->unk_30F = Rand_S16Offset((u16)0x14, (u16)0x14);
this->unk_310 = 0;
temp_t9 = this->unk_30A ^ 2;
this->unk_311 = 0;
this->unk_30A = temp_t9;
phi_v1 = temp_t9 & 0xFFFF;
}
break;
case 2:
temp_t1 = this->unk_30A | 1;
temp_v1_2 = temp_t1 & 0xFFFF;
@ -744,23 +744,23 @@ void func_80A87D94(EnJj *this, GlobalContext *globalCtx) {
this->unk_30A = temp_t4;
phi_v1 = temp_t4 & 0xFFFF;
}
break;
break;
case 3:
temp_v1 = this->unk_30A;
temp_t7 = temp_v1 | 2;
phi_v1 = temp_v1;
if ((temp_v1 & 2) == 0) {
this->unk_30E = 0;
this->unk_30F = 0;
this->unk_310 = 1;
this->unk_311 = 0;
this->unk_30A = temp_t7;
phi_v1 = temp_t7 & 0xFFFF;
}
break;
temp_v1 = this->unk_30A;
temp_t7 = temp_v1 | 2;
phi_v1 = temp_v1;
if ((temp_v1 & 2) == 0) {
this->unk_30E = 0;
this->unk_30F = 0;
this->unk_310 = 1;
this->unk_311 = 0;
this->unk_30A = temp_t7;
phi_v1 = temp_t7 & 0xFFFF;
}
break;
default:
phi_v1 = this->unk_30A;
break;
phi_v1 = this->unk_30A;
break;
}
if ((phi_v1 & 1) != 0) {
Audio_PlayActorSound2((Actor *) this, (u16)0x206DU);
@ -780,7 +780,7 @@ As usual, most of the remaining temps look fake. The only one that does not is p
<details>
<summary>
Matching C for `func_80A87D94`
Matching C for `func_80A87D94`
</summary>
```C

View File

@ -391,7 +391,6 @@ typedef struct {
{ groundAtLerpStepScale, CAM_DATA_GROUND_AT_LERP_STEP_SCALE }
typedef struct {
/* 0x00 */ SwingAnimation swing;
/* 0x1C */ f32 unk_1C;
/* 0x20 */ VecSph unk_20;

View File

@ -39,7 +39,7 @@ typedef enum {
/* 14 */ DEMOGJ_TYPE_RUBBLE_PILE_7,
/* 16 */ DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_1 = 16, // This three rubbles are the ones that Ganon can destroy and drop collectables.
/* 17 */ DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_2, // They are spawned as soon as the others, but they have collision and are rendered only when Ganondorf has transformed into Ganon.
/* 22 */ DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_TALL = 22 //
/* 22 */ DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_TALL = 22
} DemoGjType;
#endif

View File

@ -18,7 +18,7 @@ typedef struct {
/* 0x0028 */ char unk_28[0x4];
/* 0x002C */ s16 primAlpha; // transparency in RGBA colour system
/* 0x002E */ s16 primAlphaState; // 0: increasing (more opaque) 1: decreasing (more transparent) 2: collision
/* 0x0030 */ f32 xyScale; //
/* 0x0030 */ f32 xyScale;
/* 0x0034 */ f32 xyScaleTarget;
/* 0x0038 */ u8 isTimerMod8; // conditional, used to run CollisionCheck_SetAT
} EnFzEffectSsIceSmoke; // size = 0x3C

View File

@ -23,18 +23,18 @@ rm old_list.txt cur_list.txt old_data_list.txt data_list.txt list.txt
if [ "$1" = "-d" ]
then
if [ -s diff.txt ]
then
rm $(cat diff.txt)
fi
rm diff.txt
if [ -s diff.txt ]
then
rm $(cat diff.txt)
fi
rm diff.txt
else
if [ -s diff.txt ]
then
cat diff.txt
rm diff.txt
exit 55
else
rm diff.txt
fi
if [ -s diff.txt ]
then
cat diff.txt
rm diff.txt
exit 55
else
rm diff.txt
fi
fi

View File

@ -294,4 +294,3 @@ run(False)
# command = "echo >> src/overlays/effects/ovl_" + effects[i] + "/z_" + effects[i].lower() + ".c"
# os.system(command) # purpose of this is to "modify" each C file in order to prevent undefined symbol errors.
# # the new line will be removed by format.sh