match load_map_bg

Also added three new symbols to `undefined_syms.h`. Two of these are almost certainly string literals in `load_map_bg`, but we don't have rodata capability yet so they have to be declared in a different way.
This commit is contained in:
Alex Bates 2020-08-14 04:25:16 +01:00
parent 7f83b2c881
commit 86c2917cc0
4 changed files with 24 additions and 59 deletions

View File

@ -1,42 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel load_map_bg
/* 0DC470 80145D70 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 0DC474 80145D74 AFBF001C */ sw $ra, 0x1c($sp)
/* 0DC478 80145D78 1080001B */ beqz $a0, .L80145DE8
/* 0DC47C 80145D7C AFB00018 */ sw $s0, 0x18($sp)
/* 0DC480 80145D80 0080802D */ daddu $s0, $a0, $zero
/* 0DC484 80145D84 0000202D */ daddu $a0, $zero, $zero
/* 0DC488 80145D88 3C05F5DE */ lui $a1, 0xf5de
/* 0DC48C 80145D8C 0C0B1EAF */ jal get_variable
/* 0DC490 80145D90 34A50180 */ ori $a1, $a1, 0x180
/* 0DC494 80145D94 28420035 */ slti $v0, $v0, 0x35
/* 0DC498 80145D98 1440000A */ bnez $v0, .L80145DC4
/* 0DC49C 80145D9C 0200202D */ daddu $a0, $s0, $zero
/* 0DC4A0 80145DA0 3C058015 */ lui $a1, 0x8015
/* 0DC4A4 80145DA4 24A5F120 */ addiu $a1, $a1, -0xee0
/* 0DC4A8 80145DA8 0C01BB5C */ jal strcmp
/* 0DC4AC 80145DAC 0200202D */ daddu $a0, $s0, $zero
/* 0DC4B0 80145DB0 54400004 */ bnel $v0, $zero, .L80145DC4
/* 0DC4B4 80145DB4 0200202D */ daddu $a0, $s0, $zero
/* 0DC4B8 80145DB8 3C108015 */ lui $s0, 0x8015
/* 0DC4BC 80145DBC 2610F128 */ addiu $s0, $s0, -0xed8
/* 0DC4C0 80145DC0 0200202D */ daddu $a0, $s0, $zero
.L80145DC4:
/* 0DC4C4 80145DC4 0C016B3A */ jal load_asset_by_name
/* 0DC4C8 80145DC8 27A50010 */ addiu $a1, $sp, 0x10
/* 0DC4CC 80145DCC 0040802D */ daddu $s0, $v0, $zero
/* 0DC4D0 80145DD0 3C058020 */ lui $a1, 0x8020
/* 0DC4D4 80145DD4 24A50000 */ addiu $a1, $a1, 0
/* 0DC4D8 80145DD8 0C01BB7C */ jal decode_yay0
/* 0DC4DC 80145DDC 0200202D */ daddu $a0, $s0, $zero
/* 0DC4E0 80145DE0 0C00AB1E */ jal general_heap_free
/* 0DC4E4 80145DE4 0200202D */ daddu $a0, $s0, $zero
.L80145DE8:
/* 0DC4E8 80145DE8 8FBF001C */ lw $ra, 0x1c($sp)
/* 0DC4EC 80145DEC 8FB00018 */ lw $s0, 0x18($sp)
/* 0DC4F0 80145DF0 03E00008 */ jr $ra
/* 0DC4F4 80145DF4 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -15,6 +15,9 @@ extern s16* D_80151328;
extern s16 D_8010CD10;
extern s16 D_8010CD12;
extern s32 D_801595A0;
extern u8 gCloudyFlowerFieldsBg; // "fla_bg"
extern u8 gSunnyFlowerFieldsBg; // "flb_bg"
extern UNK_TYPE gBackgroundImage;
extern s8 D_8014F12F;
// Triggers

View File

@ -1,25 +1,26 @@
#include "common.h"
INCLUDE_ASM(code_dc470_len_14c0, load_map_bg);
/* close match
void load_map_bg (s32 arg0) {
s32 tempvar0 = arg0;
s32 flowerfields_bg1 = 0x80140EE0;
s32 tempvar3 = get_variable(0, 0xF5DE0180);
if (tempvar0 == 0) {
return;
}else{
if (tempvar3 > 0x0034) {
if (strcmp(tempvar0, 0x8014F120) == 0) {
tempvar0 = flowerfields_bg1;
}
load_asset_by_name (tempvar0, 0);
void load_map_bg(u8* optAssetName) {
UNK_PTR compressedData;
u32 assetSize;
u8* assetName;
if (!optAssetName) return;
assetName = optAssetName;
// StoryProgress check
if (get_variable(0, 0xF5DE0180) >= 0x35) {
// Use sunny Flower Fields bg rather than cloudy
// TODO: these globals should be string literals
if (!strcmp(assetName, &gCloudyFlowerFieldsBg)) {
assetName = &gSunnyFlowerFieldsBg;
}
}
decode_yay0(tempvar0, 0x80200000);
general_heap_free(tempvar0);
compressedData = load_asset_by_name(assetName, &assetSize);
decode_yay0(compressedData, &gBackgroundImage);
general_heap_free(compressedData);
}
*/
void func_80145DF8(void) {
game_status* gameStatus = *gGameStatusPtr;

View File

@ -36,6 +36,7 @@ D_8009A650 = 0x8009A650;
D_800A0900 = 0x800A0900;
D_800DC500 = 0x800DC500;
D_8010F6D0 = 0x8010F6D0;
gBackgroundImage = 0x80200000;
D_802C3000 = 0x802C3000;
D_802DBD40 = 0x802DBD40;
D_802E0D90 = 0x802E0D90;
@ -52,6 +53,8 @@ D_00316D90 = 0x00316D90;
D_00316F30 = 0x00316F30;
D_8010D000 = 0x8010D000;
gCloudyFlowerFieldsBg = 0x8014F120;
gSunnyFlowerFieldsBg = 0x8014F128;
D_8014F12F = 0x8014F12F;
D_8014F140 = 0x8014F140;
D_80151308 = 0x80151308;