Merge master into clang-format

This commit is contained in:
Alex Bates 2020-08-19 01:41:06 +01:00
commit 91d2819d6f
No known key found for this signature in database
GPG Key ID: 5E11C2DB78877706
13 changed files with 30 additions and 138 deletions

View File

@ -1,27 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel fixed_var_to_float
/* 0E92D0 802C4920 3C02F2E3 */ lui $v0, 0xf2e3
/* 0E92D4 802C4924 34421100 */ ori $v0, $v0, 0x1100
/* 0E92D8 802C4928 0044102A */ slt $v0, $v0, $a0
/* 0E92DC 802C492C 10400005 */ beqz $v0, .L802C4944
/* 0E92E0 802C4930 3C020DB5 */ lui $v0, 0xdb5
/* 0E92E4 802C4934 44840000 */ mtc1 $a0, $f0
/* 0E92E8 802C4938 00000000 */ nop
/* 0E92EC 802C493C 03E00008 */ jr $ra
/* 0E92F0 802C4940 46800020 */ cvt.s.w $f0, $f0
.L802C4944:
/* 0E92F4 802C4944 34428580 */ ori $v0, $v0, 0x8580
/* 0E92F8 802C4948 00821021 */ addu $v0, $a0, $v0
/* 0E92FC 802C494C 3C013A80 */ lui $at, 0x3a80
/* 0E9300 802C4950 44811000 */ mtc1 $at, $f2
/* 0E9304 802C4954 44820000 */ mtc1 $v0, $f0
/* 0E9308 802C4958 00000000 */ nop
/* 0E930C 802C495C 46800020 */ cvt.s.w $f0, $f0
/* 0E9310 802C4960 46020002 */ mul.s $f0, $f0, $f2
/* 0E9314 802C4964 03E00008 */ jr $ra
/* 0E9318 802C4968 00000000 */ nop

View File

@ -1,17 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel float_to_fixed_var
/* 0E931C 802C496C 3C014480 */ lui $at, 0x4480
/* 0E9320 802C4970 44810000 */ mtc1 $at, $f0
/* 0E9324 802C4974 00000000 */ nop
/* 0E9328 802C4978 46006302 */ mul.s $f12, $f12, $f0
/* 0E932C 802C497C 00000000 */ nop
/* 0E9330 802C4980 3C03F24A */ lui $v1, 0xf24a
/* 0E9334 802C4984 34637A80 */ ori $v1, $v1, 0x7a80
/* 0E9338 802C4988 4600608D */ trunc.w.s $f2, $f12
/* 0E933C 802C498C 44021000 */ mfc1 $v0, $f2
/* 0E9340 802C4990 03E00008 */ jr $ra
/* 0E9344 802C4994 00431021 */ addu $v0, $v0, $v1

View File

@ -1,18 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_80033B54
/* 00EF54 80033B54 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 00EF58 80033B58 AFBF0010 */ sw $ra, 0x10($sp)
/* 00EF5C 80033B5C 0C00F96C */ jal func_8003E5B0
/* 00EF60 80033B60 00000000 */ nop
/* 00EF64 80033B64 3C02800A */ lui $v0, 0x800a
/* 00EF68 80033B68 80420900 */ lb $v0, 0x900($v0)
/* 00EF6C 80033B6C 04410003 */ bgez $v0, .L80033B7C
/* 00EF70 80033B70 00000000 */ nop
/* 00EF74 80033B74 0C08FA9F */ jal draw_main_battle_ui
/* 00EF78 80033B78 00000000 */ nop
.L80033B7C:
/* 00EF7C 80033B7C 8FBF0010 */ lw $ra, 0x10($sp)
/* 00EF80 80033B80 03E00008 */ jr $ra
/* 00EF84 80033B84 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,18 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_80033B88
/* 00EF88 80033B88 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 00EF8C 80033B8C 3C02800A */ lui $v0, 0x800a
/* 00EF90 80033B90 2442A650 */ addiu $v0, $v0, -0x59b0
/* 00EF94 80033B94 AFBF0010 */ sw $ra, 0x10($sp)
/* 00EF98 80033B98 8C430000 */ lw $v1, ($v0)
/* 00EF9C 80033B9C 34630008 */ ori $v1, $v1, 8
/* 00EFA0 80033BA0 0C018028 */ jal nuContRmbForceStop
/* 00EFA4 80033BA4 AC430000 */ sw $v1, ($v0)
/* 00EFA8 80033BA8 8FBF0010 */ lw $ra, 0x10($sp)
/* 00EFAC 80033BAC 24020005 */ addiu $v0, $zero, 5
/* 00EFB0 80033BB0 3C01800A */ lui $at, 0x800a
/* 00EFB4 80033BB4 A0220900 */ sb $v0, 0x900($at)
/* 00EFB8 80033BB8 03E00008 */ jr $ra
/* 00EFBC 80033BBC 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,8 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_80033E64
/* 00F264 80033E64 03E00008 */ jr $ra
/* 00F268 80033E68 00000000 */ nop
/* 00F26C 80033E6C 00000000 */ nop

View File

@ -1,28 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_802D4CC4
/* 0F9674 802D4CC4 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0F9678 802D4CC8 AFBF0010 */ sw $ra, 0x10($sp)
/* 0F967C 802D4CCC 8C82000C */ lw $v0, 0xc($a0)
/* 0F9680 802D4CD0 0C0B1EAF */ jal get_variable
/* 0F9684 802D4CD4 8C450000 */ lw $a1, ($v0)
/* 0F9688 802D4CD8 04410004 */ bgez $v0, .L802D4CEC
/* 0F968C 802D4CDC 2404000A */ addiu $a0, $zero, 0xa
/* 0F9690 802D4CE0 3C05BF80 */ lui $a1, 0xbf80
/* 0F9694 802D4CE4 080B533F */ j .L802D4CFC
/* 0F9698 802D4CE8 240400FF */ addiu $a0, $zero, 0xff
.L802D4CEC:
/* 0F969C 802D4CEC 44820000 */ mtc1 $v0, $f0
/* 0F96A0 802D4CF0 00000000 */ nop
/* 0F96A4 802D4CF4 46800020 */ cvt.s.w $f0, $f0
/* 0F96A8 802D4CF8 44050000 */ mfc1 $a1, $f0
.L802D4CFC:
/* 0F96AC 802D4CFC 0C04DF69 */ jal func_80137DA4
/* 0F96B0 802D4D00 00000000 */ nop
/* 0F96B4 802D4D04 8FBF0010 */ lw $ra, 0x10($sp)
/* 0F96B8 802D4D08 24020002 */ addiu $v0, $zero, 2
/* 0F96BC 802D4D0C 03E00008 */ jr $ra
/* 0F96C0 802D4D10 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -260,7 +260,7 @@ typedef struct ScriptInstance {
/* 0x14C */ u32 ownerID; /* can be an npcID, a triggerID, a trigger ptr */
/* 0x150 */ f32 timeScale;
/* 0x154 */ f32 frameCounter;
/* 0x158 */ char unk_158[4];
/* 0x158 */ s32 unk_158;
/* 0x15C */ Bytecode* ptrFirstLine;
/* 0x160 */ Bytecode* ptrSavedPosition;
/* 0x164 */ Bytecode* ptrCurrentLine;

View File

@ -4,7 +4,7 @@
if command -v apt-install &> /dev/null; then
echo "Installing packages for Ubuntu"
sudo apt install -y git build-essential binutils-mips-linux-gnu zlib1g-dev libcapstone-dev libyaml-dev || exit 1
sudo apt install -y git build-essential binutils-mips-linux-gnu zlib1g-dev libcapstone-dev libyaml-dev gcc-multilib || exit 1
if [[ $1 == "--extra" ]]; then
echo "Installing extra"
@ -24,7 +24,7 @@ if command -v pacman &> /dev/null; then
sudo pacman -Syu || exit 1
# Install dependencies
sudo pacman -S --noconfirm --needed git base-devel zlib capstone libyaml || exit 1
sudo pacman -S --noconfirm --needed git base-devel zlib capstone libyaml lib32-glibc || exit 1
# Install binutils if required
if ! command -v mips-linux-gnu-ar &> /dev/null; then

View File

@ -19,25 +19,24 @@ INCLUDE_ASM("code_e79b0_len_1920", start_child_script);
INCLUDE_ASM("code_e79b0_len_1920", func_802C39F8);
INCLUDE_ASM("code_e79b0_len_1920", restart_script);
// TODO: Find out why things break when script->timeScale = 1 goes after the previous lines
/*
ScriptInstance* restart_script(ScriptInstance* script) {
script->loopDepth = -1;
script->switchDepth = -1;
script->currentOpcode = 0;
script->frameCounter = 0;
script->frameCounter = 0; // TODO: force compiler to not optimise away this
script->frameCounter = 0;
script->unk_158 = 0;
//script->timeScale = 1;
script->ptrNextLine = script->ptrFirstLine;
script->ptrCurrentLine = script->ptrFirstLine;
script->timeScale = 1.0f;
script->timeScale = gGlobalTimeSpace;
find_script_labels();
func_802C3390(script);
return script;
}
*/

View File

@ -1,17 +1,15 @@
#include "common.h"
INCLUDE_ASM("code_e92d0_len_5da0", fixed_var_to_float);
/*f32 fixed_var_to_float(s32 scriptVar) {
f32 fixed_var_to_float(s32 scriptVar) {
if (scriptVar <= -220000000) {
return (scriptVar + 230000000) * (1 / 1024.f);
return (scriptVar + 230000000) * (1 / 1024.0f);
}
return scriptVar;
}*/
}
INCLUDE_ASM("code_e92d0_len_5da0", float_to_fixed_var);
/*s32 float_to_fixed_var(f32 arg0) {
return (s32)(arg0 * (f32)1024.0f) + -230000000;
}*/
s32 float_to_fixed_var(f32 value) {
return (s32)(value * 1024.0f) - 230000000;
}
ApiStatus si_handle_return(ScriptInstance* script) {
kill_script(script);

View File

@ -52,7 +52,21 @@ void start_battle_countdown(void) {
}
INCLUDE_ASM("code_ebd0_len_6a0", step_battle);
INCLUDE_ASM("code_ebd0_len_6a0", func_80033B54);
INCLUDE_ASM("code_ebd0_len_6a0", func_80033B88);
void func_80033B54(void) {
func_8003E5B0();
if (D_800A0900 < 0) {
draw_main_battle_ui();
}
}
void func_80033B88(void) {
D_8009A650[0] |= 0x08;
nuContRmbForceStop();
D_800A0900 = 5;
}
INCLUDE_ASM("code_ebd0_len_6a0", func_80033BC0);
INCLUDE_ASM("code_ebd0_len_6a0", func_80033E64);
void func_80033E64(void) {
}

View File

@ -222,8 +222,6 @@ ApiStatus func_802D4BDC(ScriptInstance* script, s32 initialCall) {
// Very similar to func_802D4BDC
INCLUDE_API_ASM("code_f8f60_len_1560", func_802D4C4C);
INCLUDE_API_ASM("code_f8f60_len_1560", func_802D4CC4);
/*
ApiStatus func_802D4CC4(ScriptInstance* script, s32 initialCall) {
s32 value = get_variable(script, *script->ptrReadPos);
if (value < 0) {
@ -234,7 +232,6 @@ ApiStatus func_802D4CC4(ScriptInstance* script, s32 initialCall) {
return ApiStatus_DONE2;
}
*/
ApiStatus func_802D4D18(ScriptInstance* script, s32 initialCall) {
s32 value = get_float_variable(script, *script->ptrReadPos);

BIN
tools/cc1

Binary file not shown.