Match an unsused printf function, and almost match render_printf

This commit is contained in:
Ryan Myers
2021-10-20 14:36:39 -04:00
parent 0967209981
commit 84fda38879
3 changed files with 33 additions and 24 deletions
-13
View File
@@ -1,13 +0,0 @@
glabel func_800B4A14
/* 0B5614 800B4A14 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 0B5618 800B4A18 AFBF0014 */ sw $ra, 0x14($sp)
/* 0B561C 800B4A1C AFA60028 */ sw $a2, 0x28($sp)
/* 0B5620 800B4A20 AFA50024 */ sw $a1, 0x24($sp)
/* 0B5624 800B4A24 AFA7002C */ sw $a3, 0x2c($sp)
/* 0B5628 800B4A28 0C02D290 */ jal sprintf
/* 0B562C 800B4A2C 27A60028 */ addiu $a2, $sp, 0x28
/* 0B5630 800B4A30 8FBF0014 */ lw $ra, 0x14($sp)
/* 0B5634 800B4A34 27BD0020 */ addiu $sp, $sp, 0x20
/* 0B5638 800B4A38 03E00008 */ jr $ra
/* 0B563C 800B4A3C 00000000 */ nop
+5 -1
View File
@@ -172,7 +172,11 @@ s32 D_80127CCC;
s16 D_80127CD0;
s16 D_80127CD2;
s32 D_80127CD4;
s32 D_80127CD8[576];
s8 D_80127CD8;
s8 D_80127CD9;
s8 D_80127CDA;
s8 D_80127CDB;
s32 D_80127CDC[574];
s32 D_801285D8[1026];
s32 D_801295E0[108];
s32 D_80129790[6];
+28 -10
View File
@@ -6,6 +6,9 @@
#include "macros.h"
#include "f3ddkr.h"
#include "thread0_epc.h"
#include "stdarg.h"
#include "textures_sprites.h"
#include "stdio.h"
/************ .data ************/
@@ -61,7 +64,7 @@ const char D_800E8C64[] = "*** diPrintf Error *** ---> Out of string space. (Pri
extern s32 D_80127CA0;
extern s32 D_80127CA4;
extern s32 D_80127CA8;
extern u8 D_80127CD8[576];
extern u8 D_80127CD8;
extern u8 *D_801285D8;
/******************************/
@@ -81,15 +84,12 @@ void func_800B4A08(s32 arg0) {
D_800E2EF0 = arg0;
}
#ifdef NON_MATCHING
// Unused.
// Regalloc issues. I can't get sprintf to work properly.
void func_800B4A14(char *arg0, s32 arg1, s32 arg2, s32 arg3) {
sprintf(arg0, &arg2);
void func_800B4A14(char *s, char *format, ...) {
va_list args;
va_start(args, format);
sprintf(s, format, args);
va_end(args);
}
#else
GLOBAL_ASM("asm/non_matchings/printf/func_800B4A14.s")
#endif
GLOBAL_ASM("asm/non_matchings/printf/sprintf.s")
@@ -97,10 +97,28 @@ void func_800B5E88(void) {
D_80127CA0 = load_texture(0);
D_80127CA4 = load_texture(1);
D_80127CA8 = load_texture(2);
D_801285D8 = &D_80127CD8[0];
D_801285D8 = &D_80127CD8;
}
#if 0
s32 render_printf(const char *format, ...) {
s32 written;
va_list args;
va_start(args, format);
if ((D_801285D8 - &D_80127CD8) >= 0x801) {
return -1;
}
func_800B4A08(1);
written = sprintf(D_801285D8, format, args);
func_800B4A08(0);
if (written > 0) {
D_801285D8 = &D_801285D8[written] + 1;
}
return 0;
}
#else
GLOBAL_ASM("asm/non_matchings/printf/render_printf.s")
#endif
GLOBAL_ASM("asm/non_matchings/printf/func_800B5F78.s")
void set_render_printf_color(u8 red, u8 green, u8 blue, u8 alpha) {