1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-27 07:07:09 +00:00

Decompile z_kanfont (#443)

* Decompile z_kanfont.c

* Cleanups

* off -> offset

* Kanfont -> Font , Keep so-far unused Font fields as padding, Remove MessageData sub-struct
This commit is contained in:
Tharo 2020-10-12 22:42:17 +01:00 committed by GitHub
parent ed719f3da0
commit fff616d2be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 109 additions and 228 deletions

View file

@ -1,31 +0,0 @@
.rdata
glabel D_8013C190
.asciz "../z_kanfont.c"
.balign 4
.text
glabel func_8006EE60
/* AE6000 8006EE60 27BDFFE0 */ addiu $sp, $sp, -0x20
/* AE6004 8006EE64 AFA50024 */ sw $a1, 0x24($sp)
/* AE6008 8006EE68 AFA60028 */ sw $a2, 0x28($sp)
/* AE600C 8006EE6C 97AF002A */ lhu $t7, 0x2a($sp)
/* AE6010 8006EE70 93B80027 */ lbu $t8, 0x27($sp)
/* AE6014 8006EE74 AFA40020 */ sw $a0, 0x20($sp)
/* AE6018 8006EE78 3C08008C */ lui $t0, %hi(_nes_font_staticSegmentRomStart) # $t0, 0x8c
/* AE601C 8006EE7C AFBF001C */ sw $ra, 0x1c($sp)
/* AE6020 8006EE80 25081000 */ addiu $t0, %lo(_nes_font_staticSegmentRomStart) # addiu $t0, $t0, 0x1000
/* AE6024 8006EE84 3C078014 */ lui $a3, %hi(D_8013C190) # $a3, 0x8014
/* AE6028 8006EE88 2409005D */ li $t1, 93
/* AE602C 8006EE8C 008F2021 */ addu $a0, $a0, $t7
/* AE6030 8006EE90 0018C9C0 */ sll $t9, $t8, 7
/* AE6034 8006EE94 03282821 */ addu $a1, $t9, $t0
/* AE6038 8006EE98 24840008 */ addiu $a0, $a0, 8
/* AE603C 8006EE9C AFA90010 */ sw $t1, 0x10($sp)
/* AE6040 8006EEA0 24E7C190 */ addiu $a3, %lo(D_8013C190) # addiu $a3, $a3, -0x3e70
/* AE6044 8006EEA4 0C0006A8 */ jal DmaMgr_SendRequest1
/* AE6048 8006EEA8 24060080 */ li $a2, 128
/* AE604C 8006EEAC 8FBF001C */ lw $ra, 0x1c($sp)
/* AE6050 8006EEB0 27BD0020 */ addiu $sp, $sp, 0x20
/* AE6054 8006EEB4 03E00008 */ jr $ra
/* AE6058 8006EEB8 00000000 */ nop

View file

@ -1,29 +0,0 @@
.rdata
glabel D_8013C1A0
.asciz "../z_kanfont.c"
.balign 4
.text
glabel func_8006EEBC
/* AE605C 8006EEBC 27BDFFE0 */ addiu $sp, $sp, -0x20
/* AE6060 8006EEC0 AFA50024 */ sw $a1, 0x24($sp)
/* AE6064 8006EEC4 97AE0026 */ lhu $t6, 0x26($sp)
/* AE6068 8006EEC8 3C19008C */ lui $t9, %hi(_message_staticSegmentRomStart) # $t9, 0x8c
/* AE606C 8006EECC AFBF001C */ sw $ra, 0x1c($sp)
/* AE6070 8006EED0 000E79C0 */ sll $t7, $t6, 7
/* AE6074 8006EED4 AFA40020 */ sw $a0, 0x20($sp)
/* AE6078 8006EED8 25F84000 */ addiu $t8, $t7, 0x4000
/* AE607C 8006EEDC 2739A000 */ addiu $t9, %lo(_message_staticSegmentRomStart) # addiu $t9, $t9, -0x6000
/* AE6080 8006EEE0 3C078014 */ lui $a3, %hi(D_8013C1A0) # $a3, 0x8014
/* AE6084 8006EEE4 24080064 */ li $t0, 100
/* AE6088 8006EEE8 AFA80010 */ sw $t0, 0x10($sp)
/* AE608C 8006EEEC 24E7C1A0 */ addiu $a3, %lo(D_8013C1A0) # addiu $a3, $a3, -0x3e60
/* AE6090 8006EEF0 03192821 */ addu $a1, $t8, $t9
/* AE6094 8006EEF4 24843C08 */ addiu $a0, $a0, 0x3c08
/* AE6098 8006EEF8 0C0006A8 */ jal DmaMgr_SendRequest1
/* AE609C 8006EEFC 24060080 */ li $a2, 128
/* AE60A0 8006EF00 8FBF001C */ lw $ra, 0x1c($sp)
/* AE60A4 8006EF04 27BD0020 */ addiu $sp, $sp, 0x20
/* AE60A8 8006EF08 03E00008 */ jr $ra
/* AE60AC 8006EF0C 00000000 */ nop

View file

@ -1,126 +0,0 @@
.rdata
glabel D_8013C1B0
.asciz "../z_kanfont.c"
.balign 4
glabel D_8013C1C0
.asciz "msg_data=%x, msg_data0=%x jj=%x\n"
.balign 4
glabel D_8013C1E4
.asciz " error\n"
# EUC-JP: error | ERROR! ! error! ! ! error! ! ! !|
.balign 4
glabel D_8013C218
.asciz "nes_mes_buf[%d]=%d\n"
.balign 4
glabel D_8013C22C
.asciz "../z_kanfont.c"
.balign 4
.text
glabel func_8006EF10
/* AE60B0 8006EF10 27BDFFB8 */ addiu $sp, $sp, -0x48
/* AE60B4 8006EF14 3C080704 */ lui $t0, %hi(D_070380D4) # $t0, 0x704
/* AE60B8 8006EF18 250880D4 */ addiu $t0, %lo(D_070380D4) # addiu $t0, $t0, -0x7f2c
/* AE60BC 8006EF1C AFB50034 */ sw $s5, 0x34($sp)
/* AE60C0 8006EF20 3C0E0700 */ lui $t6, 0x700
/* AE60C4 8006EF24 3C0F0704 */ lui $t7, %hi(D_0703811C) # $t7, 0x704
/* AE60C8 8006EF28 AFBF0044 */ sw $ra, 0x44($sp)
/* AE60CC 8006EF2C AFBE0040 */ sw $fp, 0x40($sp)
/* AE60D0 8006EF30 AFB7003C */ sw $s7, 0x3c($sp)
/* AE60D4 8006EF34 AFB60038 */ sw $s6, 0x38($sp)
/* AE60D8 8006EF38 AFB40030 */ sw $s4, 0x30($sp)
/* AE60DC 8006EF3C AFB3002C */ sw $s3, 0x2c($sp)
/* AE60E0 8006EF40 AFB20028 */ sw $s2, 0x28($sp)
/* AE60E4 8006EF44 AFB10024 */ sw $s1, 0x24($sp)
/* AE60E8 8006EF48 AFB00020 */ sw $s0, 0x20($sp)
/* AE60EC 8006EF4C 25CE0000 */ addiu $t6, $t6, 0
/* AE60F0 8006EF50 25EF811C */ addiu $t7, %lo(D_0703811C) # addiu $t7, $t7, -0x7ee4
/* AE60F4 8006EF54 010E1023 */ subu $v0, $t0, $t6
/* AE60F8 8006EF58 01E83023 */ subu $a2, $t7, $t0
/* AE60FC 8006EF5C 3C18008C */ lui $t8, %hi(_nes_message_data_staticSegmentRomStart) # $t8, 0x8c
/* AE6100 8006EF60 0080A825 */ move $s5, $a0
/* AE6104 8006EF64 AC820000 */ sw $v0, ($a0)
/* AE6108 8006EF68 AC860004 */ sw $a2, 4($a0)
/* AE610C 8006EF6C 27186000 */ addiu $t8, %lo(_nes_message_data_staticSegmentRomStart) # addiu $t8, $t8, 0x6000
/* AE6110 8006EF70 3401DC88 */ li $at, 56456
/* AE6114 8006EF74 3C078014 */ lui $a3, %hi(D_8013C1B0) # $a3, 0x8014
/* AE6118 8006EF78 2419007A */ li $t9, 122
/* AE611C 8006EF7C AFB90010 */ sw $t9, 0x10($sp)
/* AE6120 8006EF80 24E7C1B0 */ addiu $a3, %lo(D_8013C1B0) # addiu $a3, $a3, -0x3e50
/* AE6124 8006EF84 00812021 */ addu $a0, $a0, $at
/* AE6128 8006EF88 00582821 */ addu $a1, $v0, $t8
/* AE612C 8006EF8C 0C0006A8 */ jal DmaMgr_SendRequest1
/* AE6130 8006EF90 00C08025 */ move $s0, $a2
/* AE6134 8006EF94 3C048014 */ lui $a0, %hi(D_8013C1C0) # $a0, 0x8014
/* AE6138 8006EF98 2484C1C0 */ addiu $a0, %lo(D_8013C1C0) # addiu $a0, $a0, -0x3e40
/* AE613C 8006EF9C 8EA50000 */ lw $a1, ($s5)
/* AE6140 8006EFA0 8EA60004 */ lw $a2, 4($s5)
/* AE6144 8006EFA4 0200B025 */ move $s6, $s0
/* AE6148 8006EFA8 0C00084C */ jal osSyncPrintf
/* AE614C 8006EFAC 02003825 */ move $a3, $s0
/* AE6150 8006EFB0 341E8000 */ li $fp, 32768
/* AE6154 8006EFB4 02BE4821 */ addu $t1, $s5, $fp
/* AE6158 8006EFB8 912A5C88 */ lbu $t2, 0x5c88($t1)
/* AE615C 8006EFBC 24170002 */ li $s7, 2
/* AE6160 8006EFC0 00009025 */ move $s2, $zero
/* AE6164 8006EFC4 12EA0027 */ beq $s7, $t2, .L8006F064
/* AE6168 8006EFC8 00008825 */ move $s1, $zero
/* AE616C 8006EFCC 02D1082A */ slt $at, $s6, $s1
.L8006EFD0:
/* AE6170 8006EFD0 10200006 */ beqz $at, .L8006EFEC
/* AE6174 8006EFD4 02B15821 */ addu $t3, $s5, $s1
/* AE6178 8006EFD8 3C048014 */ lui $a0, %hi(D_8013C1E4) # $a0, 0x8014
/* AE617C 8006EFDC 0C00084C */ jal osSyncPrintf
/* AE6180 8006EFE0 2484C1E4 */ addiu $a0, %lo(D_8013C1E4) # addiu $a0, $a0, -0x3e1c
/* AE6184 8006EFE4 10000020 */ b .L8006F068
/* AE6188 8006EFE8 8FBF0044 */ lw $ra, 0x44($sp)
.L8006EFEC:
/* AE618C 8006EFEC 017E8021 */ addu $s0, $t3, $fp
/* AE6190 8006EFF0 92065C88 */ lbu $a2, 0x5c88($s0)
/* AE6194 8006EFF4 24010001 */ li $at, 1
/* AE6198 8006EFF8 3C048014 */ lui $a0, %hi(D_8013C218) # $a0, 0x8014
/* AE619C 8006EFFC 10C10014 */ beq $a2, $at, .L8006F050
/* AE61A0 8006F000 2484C218 */ addiu $a0, %lo(D_8013C218) # addiu $a0, $a0, -0x3de8
/* AE61A4 8006F004 001260C0 */ sll $t4, $s2, 3
/* AE61A8 8006F008 02AC9821 */ addu $s3, $s5, $t4
/* AE61AC 8006F00C 3C14008C */ lui $s4, %hi(_nes_font_staticSegmentRomStart) # $s4, 0x8c
/* AE61B0 8006F010 26941000 */ addiu $s4, %lo(_nes_font_staticSegmentRomStart) # addiu $s4, $s4, 0x1000
/* AE61B4 8006F014 26733C88 */ addiu $s3, $s3, 0x3c88
/* AE61B8 8006F018 0C00084C */ jal osSyncPrintf
/* AE61BC 8006F01C 02202825 */ move $a1, $s1
/* AE61C0 8006F020 92025C88 */ lbu $v0, 0x5c88($s0)
/* AE61C4 8006F024 3C078014 */ lui $a3, %hi(D_8013C22C) # $a3, 0x8014
/* AE61C8 8006F028 240D0086 */ li $t5, 134
/* AE61CC 8006F02C 000211C0 */ sll $v0, $v0, 7
/* AE61D0 8006F030 2442F000 */ addiu $v0, $v0, -0x1000
/* AE61D4 8006F034 02822821 */ addu $a1, $s4, $v0
/* AE61D8 8006F038 AFAD0010 */ sw $t5, 0x10($sp)
/* AE61DC 8006F03C 24E7C22C */ addiu $a3, %lo(D_8013C22C) # addiu $a3, $a3, -0x3dd4
/* AE61E0 8006F040 02602025 */ move $a0, $s3
/* AE61E4 8006F044 0C0006A8 */ jal DmaMgr_SendRequest1
/* AE61E8 8006F048 24060080 */ li $a2, 128
/* AE61EC 8006F04C 26520010 */ addiu $s2, $s2, 0x10
.L8006F050:
/* AE61F0 8006F050 920E5C89 */ lbu $t6, 0x5c89($s0)
/* AE61F4 8006F054 26310001 */ addiu $s1, $s1, 1
/* AE61F8 8006F058 26100001 */ addiu $s0, $s0, 1
/* AE61FC 8006F05C 56EEFFDC */ bnel $s7, $t6, .L8006EFD0
/* AE6200 8006F060 02D1082A */ slt $at, $s6, $s1
.L8006F064:
/* AE6204 8006F064 8FBF0044 */ lw $ra, 0x44($sp)
.L8006F068:
/* AE6208 8006F068 8FB00020 */ lw $s0, 0x20($sp)
/* AE620C 8006F06C 8FB10024 */ lw $s1, 0x24($sp)
/* AE6210 8006F070 8FB20028 */ lw $s2, 0x28($sp)
/* AE6214 8006F074 8FB3002C */ lw $s3, 0x2c($sp)
/* AE6218 8006F078 8FB40030 */ lw $s4, 0x30($sp)
/* AE621C 8006F07C 8FB50034 */ lw $s5, 0x34($sp)
/* AE6220 8006F080 8FB60038 */ lw $s6, 0x38($sp)
/* AE6224 8006F084 8FB7003C */ lw $s7, 0x3c($sp)
/* AE6228 8006F088 8FBE0040 */ lw $fp, 0x40($sp)
/* AE622C 8006F08C 03E00008 */ jr $ra
/* AE6230 8006F090 27BD0048 */ addiu $sp, $sp, 0x48

View file

@ -235,7 +235,7 @@ glabel L801088E8
/* B7FAE4 80108944 26217FFF */ addiu $at, $s1, 0x7fff
/* B7FAE8 80108948 A0386305 */ sb $t8, 0x6305($at)
/* B7FAEC 8010894C 8FA40058 */ lw $a0, 0x58($sp)
/* B7FAF0 80108950 0C01BBAF */ jal func_8006EEBC
/* B7FAF0 80108950 0C01BBAF */ jal Font_LoadMessageBoxEndIcon
/* B7FAF4 80108954 00002825 */ move $a1, $zero
/* B7FAF8 80108958 10000007 */ b .L80108978
/* B7FAFC 8010895C 8FB80120 */ lw $t8, 0x120($sp)
@ -290,7 +290,7 @@ glabel L801089B8
/* B7FBA8 80108A08 26217FFF */ addiu $at, $s1, 0x7fff
/* B7FBAC 80108A0C A02E6305 */ sb $t6, 0x6305($at)
/* B7FBB0 80108A10 8FA40058 */ lw $a0, 0x58($sp)
/* B7FBB4 80108A14 0C01BBAF */ jal func_8006EEBC
/* B7FBB4 80108A14 0C01BBAF */ jal Font_LoadMessageBoxEndIcon
/* B7FBB8 80108A18 00002825 */ move $a1, $zero
.L80108A1C:
/* B7FBBC 80108A1C 8FB90120 */ lw $t9, 0x120($sp)
@ -365,7 +365,7 @@ glabel L80108AE0
/* B7FCA8 80108B08 A02E6305 */ sb $t6, 0x6305($at)
/* B7FCAC 80108B0C 8FA40138 */ lw $a0, 0x138($sp)
/* B7FCB0 80108B10 00002825 */ move $a1, $zero
/* B7FCB4 80108B14 0C01BBAF */ jal func_8006EEBC
/* B7FCB4 80108B14 0C01BBAF */ jal Font_LoadMessageBoxEndIcon
/* B7FCB8 80108B18 24842200 */ addiu $a0, $a0, 0x2200
/* B7FCBC 80108B1C 8FB90120 */ lw $t9, 0x120($sp)
.L80108B20:
@ -1047,7 +1047,7 @@ glabel L80109528
/* B806F8 80109558 A43862FB */ sh $t8, 0x62fb($at)
/* B806FC 8010955C 8FA40138 */ lw $a0, 0x138($sp)
/* B80700 80109560 24050002 */ li $a1, 2
/* B80704 80109564 0C01BBAF */ jal func_8006EEBC
/* B80704 80109564 0C01BBAF */ jal Font_LoadMessageBoxEndIcon
/* B80708 80109568 24842200 */ addiu $a0, $a0, 0x2200
/* B8070C 8010956C 24080009 */ li $t0, 9
/* B80710 80109570 2409000A */ li $t1, 10
@ -1075,7 +1075,7 @@ glabel L8010958C
/* B8075C 801095BC A43862FB */ sh $t8, 0x62fb($at)
/* B80760 801095C0 8FA40138 */ lw $a0, 0x138($sp)
/* B80764 801095C4 24050002 */ li $a1, 2
/* B80768 801095C8 0C01BBAF */ jal func_8006EEBC
/* B80768 801095C8 0C01BBAF */ jal Font_LoadMessageBoxEndIcon
/* B8076C 801095CC 24842200 */ addiu $a0, $a0, 0x2200
/* B80770 801095D0 24080009 */ li $t0, 9
/* B80774 801095D4 2409000A */ li $t1, 10
@ -1111,7 +1111,7 @@ glabel L801095F0
/* B807E0 80109640 0C03DCE3 */ jal Audio_PlaySoundGeneral
/* B807E4 80109644 24060004 */ li $a2, 4
/* B807E8 80109648 8FA40058 */ lw $a0, 0x58($sp)
/* B807EC 8010964C 0C01BBAF */ jal func_8006EEBC
/* B807EC 8010964C 0C01BBAF */ jal Font_LoadMessageBoxEndIcon
/* B807F0 80109650 24050001 */ li $a1, 1
/* B807F4 80109654 8FAE0138 */ lw $t6, 0x138($sp)
/* B807F8 80109658 91CF1D6C */ lbu $t7, 0x1d6c($t6)
@ -1159,7 +1159,7 @@ glabel L801096B4
/* B80884 801096E4 24050001 */ li $a1, 1
/* B80888 801096E8 A02E63E8 */ sb $t6, 0x63e8($at)
/* B8088C 801096EC 8FA40138 */ lw $a0, 0x138($sp)
/* B80890 801096F0 0C01BBAF */ jal func_8006EEBC
/* B80890 801096F0 0C01BBAF */ jal Font_LoadMessageBoxEndIcon
/* B80894 801096F4 24842200 */ addiu $a0, $a0, 0x2200
/* B80898 801096F8 8FB90138 */ lw $t9, 0x138($sp)
/* B8089C 801096FC 93381D6C */ lbu $t8, 0x1d6c($t9)
@ -1210,7 +1210,7 @@ glabel L8010977C
/* B80934 80109794 A03963E5 */ sb $t9, 0x63e5($at)
/* B80938 80109798 8FA40138 */ lw $a0, 0x138($sp)
/* B8093C 8010979C 00002825 */ move $a1, $zero
/* B80940 801097A0 0C01BBAF */ jal func_8006EEBC
/* B80940 801097A0 0C01BBAF */ jal Font_LoadMessageBoxEndIcon
/* B80944 801097A4 24842200 */ addiu $a0, $a0, 0x2200
/* B80948 801097A8 3C0F8013 */ lui $t7, %hi(D_801333E0)
/* B8094C 801097AC 3C0E8013 */ lui $t6, %hi(D_801333E8) # $t6, 0x8013

View file

@ -364,7 +364,7 @@ glabel func_80109B3C
/* B810B0 80109F10 03C02025 */ move $a0, $fp
/* B810B4 80109F14 2605FFE0 */ addiu $a1, $s0, -0x20
/* B810B8 80109F18 30A500FF */ andi $a1, $a1, 0xff
/* B810BC 80109F1C 0C01BB98 */ jal func_8006EE60
/* B810BC 80109F1C 0C01BB98 */ jal Font_LoadChar
/* B810C0 80109F20 32A6FFFF */ andi $a2, $s5, 0xffff
/* B810C4 80109F24 26B50080 */ addiu $s5, $s5, 0x80
.L80109F28:
@ -463,7 +463,7 @@ glabel func_80109B3C
/* B8120C 8010A06C 30A500FF */ andi $a1, $a1, 0xff
/* B81210 8010A070 02419021 */ addu $s2, $s2, $at
/* B81214 8010A074 03C02025 */ move $a0, $fp
/* B81218 8010A078 0C01BB98 */ jal func_8006EE60
/* B81218 8010A078 0C01BB98 */ jal Font_LoadChar
/* B8121C 8010A07C 32A6FFFF */ andi $a2, $s5, 0xffff
/* B81220 8010A080 86090000 */ lh $t1, ($s0)
/* B81224 8010A084 26D60001 */ addiu $s6, $s6, 1
@ -476,7 +476,7 @@ glabel func_80109B3C
/* B81240 8010A0A0 0016B403 */ sra $s6, $s6, 0x10
/* B81244 8010A0A4 03C02025 */ move $a0, $fp
/* B81248 8010A0A8 24050002 */ li $a1, 2
/* B8124C 8010A0AC 0C01BB98 */ jal func_8006EE60
/* B8124C 8010A0AC 0C01BB98 */ jal Font_LoadChar
/* B81250 8010A0B0 32A6FFFF */ andi $a2, $s5, 0xffff
/* B81254 8010A0B4 02F65821 */ addu $t3, $s7, $s6
/* B81258 8010A0B8 26D60001 */ addiu $s6, $s6, 1
@ -492,7 +492,7 @@ glabel func_80109B3C
/* B8127C 8010A0DC 16610009 */ bne $s3, $at, .L8010A104
/* B81280 8010A0E0 03C02025 */ move $a0, $fp
/* B81284 8010A0E4 24050002 */ li $a1, 2
/* B81288 8010A0E8 0C01BB98 */ jal func_8006EE60
/* B81288 8010A0E8 0C01BB98 */ jal Font_LoadChar
/* B8128C 8010A0EC 32A6FFFF */ andi $a2, $s5, 0xffff
/* B81290 8010A0F0 02F66021 */ addu $t4, $s7, $s6
/* B81294 8010A0F4 25817FFF */ addiu $at, $t4, 0x7fff
@ -591,7 +591,7 @@ glabel func_80109B3C
/* B813DC 8010A23C 24A50010 */ addiu $a1, $a1, 0x10
/* B813E0 8010A240 30A500FF */ andi $a1, $a1, 0xff
/* B813E4 8010A244 02419021 */ addu $s2, $s2, $at
/* B813E8 8010A248 0C01BB98 */ jal func_8006EE60
/* B813E8 8010A248 0C01BB98 */ jal Font_LoadChar
/* B813EC 8010A24C 32A6FFFF */ andi $a2, $s5, 0xffff
/* B813F0 8010A250 86190000 */ lh $t9, ($s0)
/* B813F4 8010A254 26D60001 */ addiu $s6, $s6, 1
@ -678,7 +678,7 @@ glabel func_80109B3C
/* B81514 8010A374 24A50010 */ addiu $a1, $a1, 0x10
/* B81518 8010A378 30A500FF */ andi $a1, $a1, 0xff
/* B8151C 8010A37C 02419021 */ addu $s2, $s2, $at
/* B81520 8010A380 0C01BB98 */ jal func_8006EE60
/* B81520 8010A380 0C01BB98 */ jal Font_LoadChar
/* B81524 8010A384 32A6FFFF */ andi $a2, $s5, 0xffff
/* B81528 8010A388 86180000 */ lh $t8, ($s0)
/* B8152C 8010A38C 3C048015 */ lui $a0, %hi(D_80154120) # $a0, 0x8015
@ -747,7 +747,7 @@ glabel func_80109B3C
/* B81610 8010A470 30A500FF */ andi $a1, $a1, 0xff
/* B81614 8010A474 02419021 */ addu $s2, $s2, $at
/* B81618 8010A478 03C02025 */ move $a0, $fp
/* B8161C 8010A47C 0C01BB98 */ jal func_8006EE60
/* B8161C 8010A47C 0C01BB98 */ jal Font_LoadChar
/* B81620 8010A480 32A6FFFF */ andi $a2, $s5, 0xffff
/* B81624 8010A484 860D0000 */ lh $t5, ($s0)
/* B81628 8010A488 3C048015 */ lui $a0, %hi(D_8015413C) # $a0, 0x8015
@ -993,7 +993,7 @@ glabel L8010A6FC
/* B81998 8010A7F8 24A50010 */ addiu $a1, $a1, 0x10
/* B8199C 8010A7FC 30A500FF */ andi $a1, $a1, 0xff
/* B819A0 8010A800 02419021 */ addu $s2, $s2, $at
/* B819A4 8010A804 0C01BB98 */ jal func_8006EE60
/* B819A4 8010A804 0C01BB98 */ jal Font_LoadChar
/* B819A8 8010A808 32A6FFFF */ andi $a2, $s5, 0xffff
/* B819AC 8010A80C 860F0000 */ lh $t7, ($s0)
/* B819B0 8010A810 26D60001 */ addiu $s6, $s6, 1
@ -1075,7 +1075,7 @@ glabel L8010A850
/* B81AC0 8010A920 30A500FF */ andi $a1, $a1, 0xff
/* B81AC4 8010A924 02419021 */ addu $s2, $s2, $at
/* B81AC8 8010A928 03C02025 */ move $a0, $fp
/* B81ACC 8010A92C 0C01BB98 */ jal func_8006EE60
/* B81ACC 8010A92C 0C01BB98 */ jal Font_LoadChar
/* B81AD0 8010A930 32A6FFFF */ andi $a2, $s5, 0xffff
/* B81AD4 8010A934 860B0000 */ lh $t3, ($s0)
/* B81AD8 8010A938 26D60001 */ addiu $s6, $s6, 1
@ -1088,7 +1088,7 @@ glabel L8010A850
/* B81AF4 8010A954 0016B403 */ sra $s6, $s6, 0x10
/* B81AF8 8010A958 03C02025 */ move $a0, $fp
/* B81AFC 8010A95C 24050002 */ li $a1, 2
/* B81B00 8010A960 0C01BB98 */ jal func_8006EE60
/* B81B00 8010A960 0C01BB98 */ jal Font_LoadChar
/* B81B04 8010A964 32A6FFFF */ andi $a2, $s5, 0xffff
/* B81B08 8010A968 02F67021 */ addu $t6, $s7, $s6
/* B81B0C 8010A96C 26D60001 */ addiu $s6, $s6, 1
@ -1104,7 +1104,7 @@ glabel L8010A850
/* B81B30 8010A990 16610009 */ bne $s3, $at, .L8010A9B8
/* B81B34 8010A994 03C02025 */ move $a0, $fp
/* B81B38 8010A998 24050002 */ li $a1, 2
/* B81B3C 8010A99C 0C01BB98 */ jal func_8006EE60
/* B81B3C 8010A99C 0C01BB98 */ jal Font_LoadChar
/* B81B40 8010A9A0 32A6FFFF */ andi $a2, $s5, 0xffff
/* B81B44 8010A9A4 02F67821 */ addu $t7, $s7, $s6
/* B81B48 8010A9A8 25E17FFF */ addiu $at, $t7, 0x7fff
@ -1203,7 +1203,7 @@ glabel L8010A850
/* B81C9C 8010AAFC 30A500FF */ andi $a1, $a1, 0xff
/* B81CA0 8010AB00 02419021 */ addu $s2, $s2, $at
/* B81CA4 8010AB04 03C02025 */ move $a0, $fp
/* B81CA8 8010AB08 0C01BB98 */ jal func_8006EE60
/* B81CA8 8010AB08 0C01BB98 */ jal Font_LoadChar
/* B81CAC 8010AB0C 32A6FFFF */ andi $a2, $s5, 0xffff
/* B81CB0 8010AB10 860C0000 */ lh $t4, ($s0)
/* B81CB4 8010AB14 26D60001 */ addiu $s6, $s6, 1
@ -1216,7 +1216,7 @@ glabel L8010A850
/* B81CD0 8010AB30 0016B403 */ sra $s6, $s6, 0x10
/* B81CD4 8010AB34 03C02025 */ move $a0, $fp
/* B81CD8 8010AB38 2405001A */ li $a1, 26
/* B81CDC 8010AB3C 0C01BB98 */ jal func_8006EE60
/* B81CDC 8010AB3C 0C01BB98 */ jal Font_LoadChar
/* B81CE0 8010AB40 32A6FFFF */ andi $a2, $s5, 0xffff
/* B81CE4 8010AB44 02F67821 */ addu $t7, $s7, $s6
/* B81CE8 8010AB48 26D60001 */ addiu $s6, $s6, 1
@ -1558,7 +1558,7 @@ glabel L8010A850
/* B821F4 8010B054 03C02025 */ move $a0, $fp
/* B821F8 8010B058 2605FFE0 */ addiu $a1, $s0, -0x20
/* B821FC 8010B05C 30A500FF */ andi $a1, $a1, 0xff
/* B82200 8010B060 0C01BB98 */ jal func_8006EE60
/* B82200 8010B060 0C01BB98 */ jal Font_LoadChar
/* B82204 8010B064 32A6FFFF */ andi $a2, $s5, 0xffff
/* B82208 8010B068 26B50080 */ addiu $s5, $s5, 0x80
.L8010B06C:

View file

@ -88,7 +88,7 @@ glabel func_80811A20
/* 0DE1C 80811B5C 0C2044EA */ jal func_808113A8
/* 0DE20 80811B60 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000
/* 0DE24 80811B64 3401E760 */ ori $at, $zero, 0xE760 ## $at = 0000E760
/* 0DE28 80811B68 0C01BBC4 */ jal func_8006EF10
/* 0DE28 80811B68 0C01BBC4 */ jal Font_LoadOrderedFont
/* 0DE2C 80811B6C 02012021 */ addu $a0, $s0, $at
/* 0DE30 80811B70 3C04F000 */ lui $a0, 0xF000 ## $a0 = F0000000
/* 0DE34 80811B74 0C03E803 */ jal Audio_SetBGM

View file

@ -970,10 +970,10 @@ s32 Jpeg_Decode(void* data, u16* zbuffer, JpegWork* workBuff, u32 workSize);
void KaleidoSetup_Update(GlobalContext* globalCtx);
void KaleidoSetup_Init(GlobalContext* globalCtx);
void KaleidoSetup_Destroy(GlobalContext* globalCtx);
// ? func_8006EE50(?);
// ? func_8006EE60(?);
// ? func_8006EEBC(?);
// ? func_8006EF10(?);
void func_8006EE50(Font* font, s16 arg1, s16 arg2);
void Font_LoadChar(u32 offset, u8 character, u16 codePointIndex);
void Font_LoadMessageBoxEndIcon(Font* font, u16 icon);
void Font_LoadOrderedFont(Font* font);
s32 func_8006F0A0(s32 arg0);
// ? func_8006F0D4(?);
// ? func_8006F0FC(?);

View file

@ -495,9 +495,27 @@ typedef struct {
/* 0x144 */ Vec3f rot;
} SkyboxContext; // size = 0x150
typedef enum {
MESSAGE_ICON_TRIANGLE,
MESSAGE_ICON_SQUARE,
MESSAGE_ICON_ARROW
} MessageBoxIcon;
#define FONT_CHAR_TEX_SIZE 128 // 16x16 I4 texture
typedef struct {
/* 0x0000 */ u32 msgOffset;
/* 0x0004 */ u32 msgLength;
/* 0x0008 */ char unk_8[0x3C00];
/* 0x3C08 */ u8 iconBuf[FONT_CHAR_TEX_SIZE];
/* 0x3C88 */ u8 fontBuf[FONT_CHAR_TEX_SIZE * 320]; // size possibly unconfirmed
/* 0xDC88 */ char msgBuf[1064]; // size unconfirmed
/* 0xE0B0 */ char unk_E0B0[0xD8];
} Font; // size = 0xE188
typedef struct {
/* 0x0000 */ View view;
/* 0x0128 */ char unk_128[0xE188];
/* 0x0128 */ Font font;
/* 0xE2B0 */ void* textboxSegment; // "fukidashiSegment"
/* 0xE2B4 */ char unk_E2B4[0x44];
/* 0xE2FA */ u16 unk_E2F8;

View file

@ -199,7 +199,7 @@ void func_80110F68(GlobalContext* globalCtx) {
__assert("message->fukidashiSegment != NULL", "../z_construct.c", 352);
}
func_8006EF10(&globalCtx->msgCtx.unk_128);
Font_LoadOrderedFont(&globalCtx->msgCtx.font);
YREG(31) = 0;
}

View file

@ -141,6 +141,3 @@ void KaleidoSetup_Init(GlobalContext* globalCtx) {
void KaleidoSetup_Destroy(GlobalContext* globalCtx) {
}
void func_8006EE50(UNK_PTR arg0, s16 arg1, s16 arg2) {
}

View file

@ -1,7 +1,54 @@
#include "global.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kanfont/func_8006EE60.s")
// To be moved to message_data_static header
#define MESSAGE_NEWLINE '\x01'
#define MESSAGE_END '\x02'
// message_data_static symbols
extern const char D_07000000[]; // start of file
extern const char D_070380D4[]; // charset message (id 0xFFFC)
extern const char D_0703811C[]; // end marker of last message
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kanfont/func_8006EEBC.s")
void func_8006EE50(Font* font, s16 arg1, s16 arg2) {
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kanfont/func_8006EF10.s")
void Font_LoadChar(u32 offset, u8 character, u16 codePointIndex) {
DmaMgr_SendRequest1(((u32)offset + codePointIndex) + 8,
&_nes_font_staticSegmentRomStart[character * FONT_CHAR_TEX_SIZE], FONT_CHAR_TEX_SIZE,
"../z_kanfont.c", 93);
}
void Font_LoadMessageBoxEndIcon(Font* font, u16 icon) {
DmaMgr_SendRequest1(font->iconBuf, &_message_staticSegmentRomStart[4 * 0x1000 + icon * FONT_CHAR_TEX_SIZE],
FONT_CHAR_TEX_SIZE, "../z_kanfont.c", 100);
}
void Font_LoadOrderedFont(Font* font) {
s32 len;
s32 jj;
s32 fontStatic;
u32 fontBuf;
s32 codePointIndex;
s32 fontBufIndex;
s32 offset;
font->msgOffset = D_070380D4 - D_07000000;
len = font->msgLength = D_0703811C - D_070380D4;
DmaMgr_SendRequest1(font->msgBuf, &_nes_message_data_staticSegmentRomStart[font->msgOffset], len,
"../z_kanfont.c", 122);
osSyncPrintf("msg_data=%x, msg_data0=%x jj=%x\n", font->msgOffset, font->msgLength, jj = len);
len = jj;
for (fontBufIndex = 0, codePointIndex = 0; font->msgBuf[codePointIndex] != MESSAGE_END; codePointIndex++) {
if (codePointIndex > len) {
osSyncPrintf(" エラー!!! error───\n");
return;
}
if (font->msgBuf[codePointIndex] != MESSAGE_NEWLINE) {
fontBuf = font->fontBuf + fontBufIndex * 8;
fontStatic = _nes_font_staticSegmentRomStart;
osSyncPrintf("nes_mes_buf[%d]=%d\n", codePointIndex, font->msgBuf[codePointIndex]);
offset = (font->msgBuf[codePointIndex] - '\x20') * FONT_CHAR_TEX_SIZE;
DmaMgr_SendRequest1(fontBuf, fontStatic + offset, FONT_CHAR_TEX_SIZE, "../z_kanfont.c", 134);
fontBufIndex += 0x10;
}
}
}

View file

@ -98,7 +98,7 @@ void EnMag_Init(Actor* thisx, GlobalContext* globalCtx) {
gSaveContext.unk_1419 = 255;
}
func_8006EF10(&this->unk_150);
Font_LoadOrderedFont(&this->font);
this->unk_E316 = 0;
this->unk_E318 = 0;
@ -394,7 +394,7 @@ void EnMag_DrawInner(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp) {
0x06020000, 0x06020800, 0x06021000, 0x06021800, 0x06022000, 0x06022800, 0x06023000, 0x06023800, 0x06024000,
};
EnMag* this = THIS;
u8* buf = this->unk_150;
Font* font = &this->font;
s32 pad;
Gfx* gfx = *gfxp;
u16 i, j, k;
@ -496,7 +496,8 @@ void EnMag_DrawInner(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp) {
rectLeft = VREG(19) + 1;
for (i = 0; i < ARRAY_COUNT(noControllerFontIndexes); i++) {
EnMag_DrawCharTexture(&gfx, buf + 0x3C88 + (noControllerFontIndexes[i] * 0x80), rectLeft, YREG(10) + 172);
EnMag_DrawCharTexture(&gfx, font->fontBuf + noControllerFontIndexes[i] * FONT_CHAR_TEX_SIZE, rectLeft,
YREG(10) + 172);
rectLeft += VREG(21);
if (i == 1) {
rectLeft += VREG(23);
@ -509,7 +510,8 @@ void EnMag_DrawInner(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp) {
rectLeft = VREG(19);
for (i = 0; i < ARRAY_COUNT(noControllerFontIndexes); i++) {
EnMag_DrawCharTexture(&gfx, buf + 0x3C88 + (noControllerFontIndexes[i] * 0x80), rectLeft, YREG(10) + 171);
EnMag_DrawCharTexture(&gfx, font->fontBuf + noControllerFontIndexes[i] * FONT_CHAR_TEX_SIZE, rectLeft,
YREG(10) + 171);
rectLeft += VREG(21);
if (i == 1) {
rectLeft += VREG(23);
@ -530,7 +532,8 @@ void EnMag_DrawInner(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp) {
rectLeft = YREG(7) + 1;
for (i = 0; i < ARRAY_COUNT(pressStartFontIndexes); i++) {
EnMag_DrawCharTexture(&gfx, buf + 0x3C88 + (pressStartFontIndexes[i] * 0x80), rectLeft, YREG(10) + 172);
EnMag_DrawCharTexture(&gfx, font->fontBuf + pressStartFontIndexes[i] * FONT_CHAR_TEX_SIZE, rectLeft,
YREG(10) + 172);
rectLeft += YREG(8);
if (i == 4) {
rectLeft += YREG(9);
@ -543,7 +546,8 @@ void EnMag_DrawInner(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp) {
rectLeft = YREG(7);
for (i = 0; i < ARRAY_COUNT(pressStartFontIndexes); i++) {
EnMag_DrawCharTexture(&gfx, buf + 0x3C88 + (pressStartFontIndexes[i] * 0x80), rectLeft, YREG(10) + 171);
EnMag_DrawCharTexture(&gfx, font->fontBuf + pressStartFontIndexes[i] * FONT_CHAR_TEX_SIZE, rectLeft,
YREG(10) + 171);
rectLeft += YREG(8);
if (i == 4) {
rectLeft += YREG(9);

View file

@ -9,7 +9,7 @@ struct EnMag;
typedef struct EnMag {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x0004];
/* 0x0150 */ u8 unk_150[0xE188]; // kanfont struct/buffer
/* 0x0150 */ Font font;
/* 0xE2D8 */ s16 effectFadeInState;
/* 0xE2DA */ s16 effectFadeInTimer;
/* 0xE2DC */ s16 globalState;

View file

@ -271,6 +271,7 @@ D_0602A738 = 0x0602A738;
D_0602CB48 = 0x0602CB48;
D_0602B288 = 0x0602B288;
D_0602AFF0 = 0x0602AFF0;
D_07000000 = 0x07000000;
D_070380D4 = 0x070380D4;
D_0703811C = 0x0703811C;
D_080895C0 = 0x080895C0;