text.c
16
Makefile
@ -30,12 +30,12 @@ PREPROC := tools/preproc/preproc
|
||||
|
||||
.PRECIOUS: %.1bpp %.4bpp %.8bpp %.gbapal %.lz
|
||||
|
||||
.PHONY: rom clean compare
|
||||
.PHONY: all rom clean compare generated
|
||||
|
||||
C_SRCS := $(wildcard src/*.c)
|
||||
C_OBJS := $(C_SRCS:%.c=%.o)
|
||||
|
||||
ASM_OBJS := asm/crt0.o asm/rom1.o asm/rom2.o asm/rom3.o asm/rom4.o asm/rom5.o \
|
||||
ASM_OBJS := asm/crt0.o asm/rom2.o asm/rom3.o asm/rom4.o asm/rom5.o \
|
||||
asm/libgcnmultiboot.o asm/m4a_1.o asm/m4a_3.o asm/libagbsyscall.o asm/libc.o
|
||||
|
||||
DATA_ASM_OBJS := data/data1.o data/data2.o data/graphics.o data/sound_data.o
|
||||
@ -45,18 +45,24 @@ OBJS := $(C_OBJS) $(ASM_OBJS) $(DATA_ASM_OBJS)
|
||||
ROM := pokeruby.gba
|
||||
ELF := $(ROM:.gba=.elf)
|
||||
|
||||
all:
|
||||
$(MAKE) generated
|
||||
$(MAKE) rom
|
||||
|
||||
rom: $(ROM)
|
||||
|
||||
# For contributors to make sure a change didn't affect the contents of the ROM.
|
||||
compare: $(ROM)
|
||||
compare: all
|
||||
@$(SHA1) rom.sha1
|
||||
|
||||
clean:
|
||||
rm -f $(ROM) $(ELF) $(OBJS) $(C_SRCS:%.c=%.i)
|
||||
find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.latfont' -o -iname '*.hwjpnfont' -o -iname '*.fwjpnfont' \) -exec rm {} +
|
||||
find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' \) -exec rm {} +
|
||||
|
||||
include castform.mk
|
||||
include tilesets.mk
|
||||
include fonts.mk
|
||||
include generated.mk
|
||||
|
||||
%.png: ;
|
||||
%.pal: ;
|
||||
@ -92,4 +98,4 @@ $(DATA_ASM_OBJS): %.o: %.s $$(dep)
|
||||
# Link objects to produce the ROM.
|
||||
$(ROM): $(OBJS)
|
||||
$(LD) $(LDFLAGS) -o $(ELF) $(OBJS) $(LIBGCC)
|
||||
$(OBJCOPY) -O binary --gap-fill 0xFF $(ELF) $(ROM)
|
||||
$(OBJCOPY) -O binary --gap-fill 0xFF --pad-to 0x9000000 $(ELF) $(ROM)
|
||||
|
8684
asm/rom1.s
14
asm/rom2.s
@ -151,7 +151,7 @@ _08007190: .4byte 0x040000d4
|
||||
_08007194: .4byte gUnknown_081E7350
|
||||
_08007198: .4byte 0x80000110
|
||||
_0800719C: .4byte 0x03002fb0
|
||||
_080071A0: .4byte gUnknown_081E29A8
|
||||
_080071A0: .4byte gBGControlRegs
|
||||
thumb_func_end sub_8007128
|
||||
|
||||
thumb_func_start sub_80071A4
|
||||
@ -164,7 +164,7 @@ sub_80071A4: @ 80071A4
|
||||
bl SetVBlankCallback
|
||||
ldr r4, _0800724C
|
||||
adds r0, r4, 0
|
||||
bl sub_8002A34
|
||||
bl SetUpWindowConfig
|
||||
adds r0, r4, 0
|
||||
bl sub_8071C4C
|
||||
bl sub_8007CEC
|
||||
@ -221,7 +221,7 @@ _080071E4:
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_08007248: .4byte sub_8007300
|
||||
_0800724C: .4byte gUnknown_081E6CE4
|
||||
_0800724C: .4byte gWindowConfig_81E6CE4
|
||||
_08007250: .4byte 0x03002b74
|
||||
_08007254: .4byte 0x00001111
|
||||
_08007258: .4byte 0x03001770
|
||||
@ -1077,7 +1077,7 @@ _08007908:
|
||||
adds r0, r2, r1
|
||||
adds r1, r2
|
||||
ldrb r1, [r1, 0x12]
|
||||
bl StopMusicWhileStringIsPrinted
|
||||
bl SetStringCharset
|
||||
b _0800798A
|
||||
.align 2, 0
|
||||
_0800791C: .4byte 0x03002978
|
||||
@ -2420,7 +2420,7 @@ _0800828A:
|
||||
mov r1, r8
|
||||
adds r0, r2, r1
|
||||
adds r1, r2, r7
|
||||
bl CompareStringWithoutExtendedControlCodes
|
||||
bl StringCompareWithoutExtCtrlCodes
|
||||
cmp r0, 0
|
||||
beq _080082BE
|
||||
_080082AE:
|
||||
@ -2849,7 +2849,7 @@ sub_80085BC: @ 80085BC
|
||||
bl SetVBlankCallback
|
||||
ldr r4, _0800863C
|
||||
adds r0, r4, 0
|
||||
bl sub_8002A34
|
||||
bl SetUpWindowConfig
|
||||
adds r0, r4, 0
|
||||
bl sub_8071C4C
|
||||
bl sub_8071EF4
|
||||
@ -2883,7 +2883,7 @@ sub_80085BC: @ 80085BC
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_08008638: .4byte sub_8007300
|
||||
_0800863C: .4byte gUnknown_081E7198
|
||||
_0800863C: .4byte gWindowConfig_81E7198
|
||||
_08008640: .4byte 0x04000052
|
||||
_08008644: .4byte 0x03001bb4
|
||||
_08008648: .4byte sub_8007080
|
||||
|
214
asm/rom3.s
@ -112,7 +112,7 @@ sub_8009708: @ 8009708
|
||||
bl ResetSpriteData
|
||||
bl FreeAllSpritePalettes
|
||||
ldr r0, _080097D4
|
||||
bl sub_8002A34
|
||||
bl SetUpWindowConfig
|
||||
ldr r0, _080097D8
|
||||
bl sub_8071C4C
|
||||
cmp r4, 0
|
||||
@ -132,8 +132,8 @@ _080097C4: .4byte 0x85000100
|
||||
_080097C8: .4byte 0x05000002
|
||||
_080097CC: .4byte 0x810001ff
|
||||
_080097D0: .4byte gUnknown_081E797C
|
||||
_080097D4: .4byte gUnknown_081E6C3C
|
||||
_080097D8: .4byte gUnknown_081E6CE4
|
||||
_080097D4: .4byte gWindowConfig_81E6C3C
|
||||
_080097D8: .4byte gWindowConfig_81E6CE4
|
||||
_080097DC:
|
||||
movs r0, 0x1
|
||||
negs r0, r0
|
||||
@ -1398,7 +1398,7 @@ task_new_game_prof_birch_speech_1: @ 800A1F4
|
||||
lsls r4, 24
|
||||
lsrs r4, 24
|
||||
ldr r0, _0800A2B0
|
||||
bl sub_8002A34
|
||||
bl SetUpWindowConfig
|
||||
ldr r0, _0800A2B4
|
||||
bl sub_8071C4C
|
||||
ldr r0, _0800A2B8
|
||||
@ -1474,8 +1474,8 @@ task_new_game_prof_birch_speech_1: @ 800A1F4
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_0800A2B0: .4byte gUnknown_081E6C3C
|
||||
_0800A2B4: .4byte gUnknown_081E6CE4
|
||||
_0800A2B0: .4byte gWindowConfig_81E6C3C
|
||||
_0800A2B4: .4byte gWindowConfig_81E6CE4
|
||||
_0800A2B8: .4byte 0x04000040
|
||||
_0800A2BC: .4byte gUnknown_081E768C
|
||||
_0800A2C0: .4byte gUnknown_081E7834
|
||||
@ -3312,7 +3312,7 @@ new_game_prof_birch_speech_part2_start: @ 800B060
|
||||
adds r0, r5, 0
|
||||
bl AddBirchSpeechObjects
|
||||
ldr r0, _0800B168
|
||||
bl sub_8002A34
|
||||
bl SetUpWindowConfig
|
||||
ldr r0, _0800B16C
|
||||
bl sub_8071C4C
|
||||
ldr r0, _0800B170
|
||||
@ -3335,8 +3335,8 @@ _0800B158: .4byte gUnknown_081E764C
|
||||
_0800B15C: .4byte sub_800AAEC
|
||||
_0800B160: .4byte 0x03004b20
|
||||
_0800B164: .4byte 0x0000ffc4
|
||||
_0800B168: .4byte gUnknown_081E6C3C
|
||||
_0800B16C: .4byte gUnknown_081E6CE4
|
||||
_0800B168: .4byte gWindowConfig_81E6C3C
|
||||
_0800B16C: .4byte gWindowConfig_81E6CE4
|
||||
_0800B170: .4byte 0x02024ea4
|
||||
_0800B174:
|
||||
strh r0, [r4, 0x14]
|
||||
@ -8967,7 +8967,7 @@ _0800DC9C:
|
||||
adds r0, r4, 0
|
||||
movs r2, 0xA0
|
||||
movs r3, 0x15
|
||||
bl CreateTextRenderer
|
||||
bl InitWindow
|
||||
adds r0, r4, 0
|
||||
bl sub_8002F44
|
||||
ldr r1, _0800DCC8
|
||||
@ -9018,7 +9018,7 @@ _0800DD08:
|
||||
adds r0, r4, 0
|
||||
movs r2, 0xA0
|
||||
movs r3, 0x15
|
||||
bl CreateTextRenderer
|
||||
bl InitWindow
|
||||
adds r0, r4, 0
|
||||
bl sub_8002F44
|
||||
ldr r1, _0800DD34
|
||||
@ -9053,7 +9053,7 @@ _0800DD38:
|
||||
adds r0, r4, 0
|
||||
movs r2, 0xA0
|
||||
movs r3, 0x15
|
||||
bl CreateTextRenderer
|
||||
bl InitWindow
|
||||
adds r0, r4, 0
|
||||
bl sub_8002F44
|
||||
ldr r1, _0800DD8C
|
||||
@ -9090,7 +9090,7 @@ _0800DDA8:
|
||||
adds r0, r4, 0
|
||||
movs r2, 0xA0
|
||||
movs r3, 0x6
|
||||
bl CreateTextRenderer
|
||||
bl InitWindow
|
||||
adds r0, r4, 0
|
||||
bl sub_8002F44
|
||||
ldr r1, _0800DDEC
|
||||
@ -9099,7 +9099,7 @@ _0800DDA8:
|
||||
movs r2, 0xA8
|
||||
movs r3, 0x15
|
||||
_0800DDCA:
|
||||
bl CreateTextRenderer
|
||||
bl InitWindow
|
||||
adds r0, r4, 0
|
||||
bl sub_8002F44
|
||||
b _0800DE1C
|
||||
@ -9118,7 +9118,7 @@ _0800DDF0:
|
||||
adds r0, r4, 0
|
||||
movs r2, 0xA0
|
||||
movs r3, 0x15
|
||||
bl CreateTextRenderer
|
||||
bl InitWindow
|
||||
adds r0, r4, 0
|
||||
bl sub_8002F44
|
||||
ldr r1, _0800DE2C
|
||||
@ -9126,7 +9126,7 @@ _0800DDF0:
|
||||
adds r0, r4, 0
|
||||
movs r2, 0xA8
|
||||
movs r3, 0x6
|
||||
bl CreateTextRenderer
|
||||
bl InitWindow
|
||||
adds r0, r4, 0
|
||||
bl sub_8002F44
|
||||
_0800DE1C:
|
||||
@ -10383,7 +10383,7 @@ _0800E868:
|
||||
bl sub_80895F8
|
||||
ldr r4, _0800E92C
|
||||
adds r0, r4, 0
|
||||
bl sub_8002A34
|
||||
bl SetUpWindowConfig
|
||||
bl sub_8073B94
|
||||
ldr r0, _0800E930
|
||||
movs r1, 0
|
||||
@ -10407,13 +10407,13 @@ _0800E868:
|
||||
strb r0, [r1]
|
||||
ldr r0, _0800E954
|
||||
adds r1, r4, 0
|
||||
bl sub_8002D54
|
||||
bl InitWindowFromConfig
|
||||
ldr r0, _0800E958
|
||||
ldr r1, _0800E95C
|
||||
bl sub_8002D54
|
||||
bl InitWindowFromConfig
|
||||
ldr r0, _0800E960
|
||||
ldr r1, _0800E964
|
||||
bl sub_8002D54
|
||||
bl InitWindowFromConfig
|
||||
bl sub_800D6D4
|
||||
bl sub_800DAB8
|
||||
bl ResetSpriteData
|
||||
@ -10444,7 +10444,7 @@ _0800E91C: .4byte 0x03004240
|
||||
_0800E920: .4byte 0x03004de0
|
||||
_0800E924: .4byte gUnknown_081F9674
|
||||
_0800E928: .4byte 0x0000ff10
|
||||
_0800E92C: .4byte gUnknown_081E6C58
|
||||
_0800E92C: .4byte gWindowConfig_81E6C58
|
||||
_0800E930: .4byte 0x030042a4
|
||||
_0800E934: .4byte 0x030042a0
|
||||
_0800E938: .4byte 0x030042c0
|
||||
@ -10456,9 +10456,9 @@ _0800E94C: .4byte 0x030041b8
|
||||
_0800E950: .4byte 0x0300428c
|
||||
_0800E954: .4byte 0x03004210
|
||||
_0800E958: .4byte 0x030041d0
|
||||
_0800E95C: .4byte gUnknown_081E71D0
|
||||
_0800E95C: .4byte gWindowConfig_81E71D0
|
||||
_0800E960: .4byte 0x03004250
|
||||
_0800E964: .4byte gUnknown_081E71EC
|
||||
_0800E964: .4byte gWindowConfig_81E71EC
|
||||
_0800E968: .4byte 0x030028f8
|
||||
_0800E96C: .4byte sub_800FCFC
|
||||
_0800E970: .4byte 0x020239f8
|
||||
@ -10848,7 +10848,7 @@ shedinja_something: @ 800EC44
|
||||
bl PokemonGetField
|
||||
ldr r1, _0800EC98
|
||||
mov r0, sp
|
||||
bl CompareStringWithoutExtendedControlCodes
|
||||
bl StringCompareWithoutExtCtrlCodes
|
||||
cmp r0, 0
|
||||
bne _0800EC8C
|
||||
adds r0, r4, 0
|
||||
@ -11341,7 +11341,7 @@ _0800F03E:
|
||||
bl pokemon_get_gender
|
||||
strb r0, [r5, 0x1C]
|
||||
adds r0, r7, 0
|
||||
bl StripExtendedControlCodes
|
||||
bl SkipExtCtrlCodes
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x3
|
||||
bl PokemonGetField
|
||||
@ -13369,7 +13369,7 @@ _08010084:
|
||||
cmp r1, 0x9F
|
||||
ble _08010084
|
||||
adds r0, r5, 0
|
||||
bl sub_8002A34
|
||||
bl SetUpWindowConfig
|
||||
bl sub_8073B94
|
||||
ldr r0, _08010164
|
||||
movs r4, 0
|
||||
@ -13390,13 +13390,13 @@ _08010084:
|
||||
strh r4, [r0]
|
||||
ldr r0, _08010184
|
||||
adds r1, r5, 0
|
||||
bl sub_8002D54
|
||||
bl InitWindowFromConfig
|
||||
ldr r0, _08010188
|
||||
ldr r1, _0801018C
|
||||
bl sub_8002D54
|
||||
bl InitWindowFromConfig
|
||||
ldr r0, _08010190
|
||||
ldr r1, _08010194
|
||||
bl sub_8002D54
|
||||
bl InitWindowFromConfig
|
||||
bl sub_800D6D4
|
||||
ldr r0, _08010198
|
||||
movs r1, 0
|
||||
@ -13448,7 +13448,7 @@ _0801014C: .4byte 0x00005051
|
||||
_08010150: .4byte 0x030042c4
|
||||
_08010154: .4byte 0x03004240
|
||||
_08010158: .4byte 0x03004de0
|
||||
_0801015C: .4byte gUnknown_081E6C58
|
||||
_0801015C: .4byte gWindowConfig_81E6C58
|
||||
_08010160: .4byte 0x0000ff10
|
||||
_08010164: .4byte 0x030042a4
|
||||
_08010168: .4byte 0x030042a0
|
||||
@ -13460,9 +13460,9 @@ _0801017C: .4byte 0x030041b0
|
||||
_08010180: .4byte 0x030041b8
|
||||
_08010184: .4byte 0x03004210
|
||||
_08010188: .4byte 0x030041d0
|
||||
_0801018C: .4byte gUnknown_081E71D0
|
||||
_0801018C: .4byte gWindowConfig_81E71D0
|
||||
_08010190: .4byte 0x03004250
|
||||
_08010194: .4byte gUnknown_081E71EC
|
||||
_08010194: .4byte gWindowConfig_81E71EC
|
||||
_08010198: .4byte gUnknown_08D004E0
|
||||
_0801019C: .4byte 0x0400004a
|
||||
_080101A0: .4byte 0x030028f8
|
||||
@ -51793,7 +51793,7 @@ sub_8023A80: @ 8023A80
|
||||
str r0, [sp]
|
||||
adds r0, r4, 0
|
||||
movs r3, 0x19
|
||||
bl CreateTextRenderer
|
||||
bl InitWindow
|
||||
adds r0, r4, 0
|
||||
bl sub_8002F44
|
||||
ldr r1, _08023AD0
|
||||
@ -53784,7 +53784,7 @@ _08024AC4:
|
||||
str r0, [sp]
|
||||
adds r0, r4, 0
|
||||
movs r3, 0xC
|
||||
bl CreateTextRenderer
|
||||
bl InitWindow
|
||||
adds r0, r4, 0
|
||||
bl sub_8002F44
|
||||
ldr r1, _08024AEC
|
||||
@ -53905,7 +53905,7 @@ _08024BC0:
|
||||
str r0, [sp]
|
||||
adds r0, r4, 0
|
||||
movs r3, 0xC
|
||||
bl CreateTextRenderer
|
||||
bl InitWindow
|
||||
adds r0, r4, 0
|
||||
bl sub_8002F44
|
||||
ldr r1, _08024BFC
|
||||
@ -69759,7 +69759,7 @@ _0802C9F4:
|
||||
adds r0, r4, 0
|
||||
movs r2, 0x17
|
||||
movs r3, 0x37
|
||||
bl sub_8004758
|
||||
bl FillWindowRect
|
||||
ldr r1, _0802CA50
|
||||
movs r2, 0xA4
|
||||
lsls r2, 2
|
||||
@ -69767,7 +69767,7 @@ _0802C9F4:
|
||||
str r0, [sp]
|
||||
adds r0, r4, 0
|
||||
movs r3, 0x17
|
||||
bl CreateTextRenderer
|
||||
bl InitWindow
|
||||
adds r0, r4, 0
|
||||
bl sub_8002F44
|
||||
ldr r1, _0802CA54
|
||||
@ -70297,7 +70297,7 @@ _0802CE1C:
|
||||
adds r0, r4, 0
|
||||
movs r2, 0x17
|
||||
movs r3, 0x37
|
||||
bl sub_8004758
|
||||
bl FillWindowRect
|
||||
ldr r1, _0802CF40
|
||||
movs r2, 0xA4
|
||||
lsls r2, 2
|
||||
@ -70305,7 +70305,7 @@ _0802CE1C:
|
||||
str r0, [sp]
|
||||
adds r0, r4, 0
|
||||
movs r3, 0x17
|
||||
bl CreateTextRenderer
|
||||
bl InitWindow
|
||||
adds r0, r4, 0
|
||||
bl sub_8002F44
|
||||
bl sub_802E220
|
||||
@ -70349,7 +70349,7 @@ _0802CE78:
|
||||
adds r0, r4, 0
|
||||
movs r2, 0x17
|
||||
movs r3, 0x37
|
||||
bl sub_8004758
|
||||
bl FillWindowRect
|
||||
ldr r1, _0802CF40
|
||||
movs r2, 0xA4
|
||||
lsls r2, 2
|
||||
@ -70357,7 +70357,7 @@ _0802CE78:
|
||||
str r0, [sp]
|
||||
adds r0, r4, 0
|
||||
movs r3, 0x17
|
||||
bl CreateTextRenderer
|
||||
bl InitWindow
|
||||
adds r0, r4, 0
|
||||
bl sub_8002F44
|
||||
bl sub_802E220
|
||||
@ -72631,7 +72631,7 @@ _0802E194:
|
||||
_0802E196:
|
||||
str r0, [sp]
|
||||
adds r0, r4, 0
|
||||
bl CreateTextRenderer
|
||||
bl InitWindow
|
||||
ldr r0, _0802E1AC
|
||||
bl sub_8002F44
|
||||
add sp, 0x4
|
||||
@ -72662,7 +72662,7 @@ sub_802E1B0: @ 802E1B0
|
||||
str r2, [sp, 0x4]
|
||||
movs r2, 0x1
|
||||
movs r3, 0x37
|
||||
bl sub_8004758
|
||||
bl FillWindowRect
|
||||
movs r6, 0
|
||||
_0802E1DA:
|
||||
lsls r0, r6, 24
|
||||
@ -72761,7 +72761,7 @@ sub_802E220: @ 802E220
|
||||
str r0, [sp]
|
||||
adds r0, r4, 0
|
||||
movs r3, 0x19
|
||||
bl CreateTextRenderer
|
||||
bl InitWindow
|
||||
adds r0, r4, 0
|
||||
bl sub_8002F44
|
||||
_0802E2B0:
|
||||
@ -72801,7 +72801,7 @@ sub_802E2D4: @ 802E2D4
|
||||
adds r0, r4, 0
|
||||
movs r2, 0x17
|
||||
movs r3, 0x37
|
||||
bl sub_8004758
|
||||
bl FillWindowRect
|
||||
ldr r1, _0802E324
|
||||
movs r2, 0xA4
|
||||
lsls r2, 2
|
||||
@ -72809,7 +72809,7 @@ sub_802E2D4: @ 802E2D4
|
||||
str r0, [sp]
|
||||
adds r0, r4, 0
|
||||
movs r3, 0x13
|
||||
bl CreateTextRenderer
|
||||
bl InitWindow
|
||||
b _0802E388
|
||||
.align 2, 0
|
||||
_0802E314: .4byte 0x02023a60
|
||||
@ -72853,7 +72853,7 @@ _0802E328:
|
||||
adds r0, r4, 0
|
||||
movs r2, 0x17
|
||||
movs r3, 0x39
|
||||
bl sub_8004758
|
||||
bl FillWindowRect
|
||||
ldr r1, _0802E398
|
||||
movs r2, 0xB0
|
||||
lsls r2, 2
|
||||
@ -72861,7 +72861,7 @@ _0802E328:
|
||||
str r0, [sp]
|
||||
adds r0, r4, 0
|
||||
movs r3, 0x17
|
||||
bl CreateTextRenderer
|
||||
bl InitWindow
|
||||
_0802E388:
|
||||
ldr r0, _0802E3AC
|
||||
bl sub_8002F44
|
||||
@ -76725,7 +76725,7 @@ sub_803037C: @ 803037C
|
||||
movs r1, 0xA
|
||||
movs r2, 0x2
|
||||
movs r3, 0xF
|
||||
bl sub_8004758
|
||||
bl FillWindowRect
|
||||
movs r0, 0x10
|
||||
str r0, [sp]
|
||||
movs r0, 0x26
|
||||
@ -76734,7 +76734,7 @@ sub_803037C: @ 803037C
|
||||
movs r1, 0xA
|
||||
movs r2, 0x2
|
||||
movs r3, 0x23
|
||||
bl sub_8004758
|
||||
bl FillWindowRect
|
||||
ldr r1, _08030440
|
||||
ldr r0, _08030444
|
||||
ldrb r0, [r0]
|
||||
@ -76749,7 +76749,7 @@ sub_803037C: @ 803037C
|
||||
str r0, [sp]
|
||||
adds r0, r4, 0
|
||||
movs r3, 0x12
|
||||
bl CreateTextRenderer
|
||||
bl InitWindow
|
||||
adds r0, r4, 0
|
||||
bl sub_8002F44
|
||||
ldr r1, _08030450
|
||||
@ -76783,7 +76783,7 @@ _080303EC:
|
||||
str r0, [sp]
|
||||
adds r0, r4, 0
|
||||
movs r3, 0x2
|
||||
bl CreateTextRenderer
|
||||
bl InitWindow
|
||||
adds r0, r4, 0
|
||||
bl sub_8002F44
|
||||
add sp, 0x8
|
||||
@ -76878,7 +76878,7 @@ sub_80304A8: @ 80304A8
|
||||
str r0, [sp]
|
||||
adds r0, r4, 0
|
||||
movs r3, 0x17
|
||||
bl CreateTextRenderer
|
||||
bl InitWindow
|
||||
adds r0, r4, 0
|
||||
bl sub_8002F44
|
||||
_08030500:
|
||||
@ -97793,7 +97793,7 @@ _0803AE68:
|
||||
mov r2, r9
|
||||
bl pokemon_setattr
|
||||
add r0, sp, 0x10
|
||||
bl StripExtendedControlCodes
|
||||
bl SkipExtCtrlCodes
|
||||
adds r0, r7, 0
|
||||
movs r1, 0x2
|
||||
add r2, sp, 0x10
|
||||
@ -101911,10 +101911,10 @@ _0803CE42:
|
||||
strb r0, [r1]
|
||||
adds r0, r7, 0
|
||||
adds r1, r3, 0
|
||||
bl StopMusicWhileStringIsPrinted
|
||||
bl SetStringCharset
|
||||
_0803CE50:
|
||||
adds r0, r7, 0
|
||||
bl StringGetLength
|
||||
bl StringLength
|
||||
lsls r0, 16
|
||||
lsrs r4, r0, 16
|
||||
b _0803D1DC
|
||||
@ -107791,7 +107791,7 @@ sub_803FB68: @ 803FB68
|
||||
ldr r4, _0803FBB8
|
||||
adds r0, r4
|
||||
adds r1, r5, 0
|
||||
bl CompareStringWithoutExtendedControlCodes
|
||||
bl StringCompareWithoutExtCtrlCodes
|
||||
cmp r0, 0
|
||||
bne _0803FBA8
|
||||
mov r2, r8
|
||||
@ -110162,7 +110162,7 @@ _08040D68:
|
||||
subs r1, 0xB
|
||||
_08040D70:
|
||||
adds r0, r4, 0
|
||||
bl CompareStringWithoutExtendedControlCodes
|
||||
bl StringCompareWithoutExtCtrlCodes
|
||||
movs r3, 0
|
||||
cmp r0, 0
|
||||
bne _08040D7E
|
||||
@ -113036,7 +113036,7 @@ sub_80422C4: @ 80422C4
|
||||
bl PokemonGetEncryptedField
|
||||
adds r0, r5, 0
|
||||
adds r1, r4, 0
|
||||
bl StopMusicWhileStringIsPrinted
|
||||
bl SetStringCharset
|
||||
_080422FC:
|
||||
adds r4, r6, 0
|
||||
adds r4, 0x50
|
||||
@ -114069,13 +114069,13 @@ sub_8042ABC: @ 8042ABC
|
||||
adds r6, 0x2C
|
||||
mov r0, sp
|
||||
adds r1, r6, 0
|
||||
bl CompareStringWithoutExtendedControlCodes
|
||||
bl StringCompareWithoutExtCtrlCodes
|
||||
cmp r0, 0
|
||||
bne _08042B08
|
||||
ldr r0, _08042B30
|
||||
adds r1, r5, 0
|
||||
adds r1, 0x24
|
||||
bl CompareStringWithoutExtendedControlCodes
|
||||
bl StringCompareWithoutExtCtrlCodes
|
||||
cmp r0, 0
|
||||
beq _08042B40
|
||||
_08042B08:
|
||||
@ -114380,12 +114380,12 @@ _08042D8C: .4byte 0x0202e8ce
|
||||
_08042D90:
|
||||
ldr r5, _08042DBC
|
||||
adds r0, r5, 0
|
||||
bl sub_8002A34
|
||||
bl SetUpWindowConfig
|
||||
ldr r4, _08042DC0
|
||||
ldr r0, [r4]
|
||||
adds r0, 0x8
|
||||
adds r1, r5, 0
|
||||
bl sub_8002D54
|
||||
bl InitWindowFromConfig
|
||||
movs r0, 0x14
|
||||
bl sub_8064EF4
|
||||
ldr r1, [r4]
|
||||
@ -114396,7 +114396,7 @@ _08042D90:
|
||||
bl sub_8064F08
|
||||
b _08042F04
|
||||
.align 2, 0
|
||||
_08042DBC: .4byte gUnknown_081E6F84
|
||||
_08042DBC: .4byte gWindowConfig_81E6F84
|
||||
_08042DC0: .4byte 0x0300481c
|
||||
_08042DC4:
|
||||
ldr r0, _08042DFC
|
||||
@ -124544,7 +124544,7 @@ sub_8047CE8: @ 8047CE8
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_08047D44: .4byte gUnknown_081E725C
|
||||
_08047D44: .4byte gWindowConfig_81E725C
|
||||
_08047D48: .4byte 0x020296cc
|
||||
_08047D4C: .4byte 0x02024ea4
|
||||
_08047D50: .4byte 0x03002978
|
||||
@ -124558,7 +124558,7 @@ sub_8047D58: @ 8047D58
|
||||
push {r7}
|
||||
sub sp, 0x18
|
||||
ldr r0, _08047E30
|
||||
bl StringGetLength
|
||||
bl StringLength
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
movs r1, 0
|
||||
@ -124609,7 +124609,7 @@ _08047D86:
|
||||
lsls r0, 2
|
||||
ldr r1, _08047E3C
|
||||
adds r0, r1
|
||||
bl StringGetLength
|
||||
bl StringLength
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
movs r1, 0
|
||||
@ -124798,11 +124798,11 @@ _08047F48:
|
||||
bl sub_8071C4C
|
||||
ldr r4, _0804802C
|
||||
adds r0, r4, 0
|
||||
bl sub_8002A34
|
||||
bl SetUpWindowConfig
|
||||
ldr r0, [r5]
|
||||
adds r0, 0x4
|
||||
adds r1, r4, 0
|
||||
bl sub_8002D54
|
||||
bl InitWindowFromConfig
|
||||
movs r0, 0x14
|
||||
bl sub_8064EF4
|
||||
ldr r1, [r5]
|
||||
@ -124875,8 +124875,8 @@ _08048018: .4byte 0x03004824
|
||||
_0804801C: .4byte 0x02017000
|
||||
_08048020: .4byte 0x06002800
|
||||
_08048024: .4byte sub_80489F4
|
||||
_08048028: .4byte gUnknown_081E6CE4
|
||||
_0804802C: .4byte gUnknown_081E6F84
|
||||
_08048028: .4byte gWindowConfig_81E6CE4
|
||||
_0804802C: .4byte gWindowConfig_81E6F84
|
||||
_08048030: .4byte 0x03000508
|
||||
_08048034: .4byte 0x03001770
|
||||
_08048038: .4byte 0x0000043c
|
||||
@ -125035,7 +125035,7 @@ _08048172:
|
||||
movs r1, 0
|
||||
movs r2, 0
|
||||
movs r3, 0
|
||||
bl sub_80047C8
|
||||
bl FillWindowRect_DefaultPalette
|
||||
movs r1, 0x80
|
||||
lsls r1, 19
|
||||
movs r0, 0
|
||||
@ -125493,11 +125493,11 @@ _0804857C:
|
||||
bl sub_8071C4C
|
||||
ldr r4, _08048644
|
||||
adds r0, r4, 0
|
||||
bl sub_8002A34
|
||||
bl SetUpWindowConfig
|
||||
ldr r0, [r5]
|
||||
adds r0, 0x4
|
||||
adds r1, r4, 0
|
||||
bl sub_8002D54
|
||||
bl InitWindowFromConfig
|
||||
movs r0, 0x14
|
||||
bl sub_8064EF4
|
||||
ldr r1, [r5]
|
||||
@ -125560,8 +125560,8 @@ _08048630: .4byte 0x03004824
|
||||
_08048634: .4byte 0x02017000
|
||||
_08048638: .4byte 0x06002800
|
||||
_0804863C: .4byte sub_80489F4
|
||||
_08048640: .4byte gUnknown_081E6CE4
|
||||
_08048644: .4byte gUnknown_081E6F84
|
||||
_08048640: .4byte gWindowConfig_81E6CE4
|
||||
_08048644: .4byte gWindowConfig_81E6F84
|
||||
_08048648: .4byte 0x03000508
|
||||
_0804864C: .4byte 0x03001770
|
||||
_08048650: .4byte 0x0000043c
|
||||
@ -126766,7 +126766,7 @@ _0804901E:
|
||||
bl PokemonGetField
|
||||
mov r0, sp
|
||||
ldr r1, _08049074
|
||||
bl CompareStringWithoutExtendedControlCodes
|
||||
bl StringCompareWithoutExtCtrlCodes
|
||||
cmp r0, 0
|
||||
bne _0804905E
|
||||
adds r0, r4, 0
|
||||
@ -128816,7 +128816,7 @@ _08049F8E:
|
||||
str r1, [sp, 0x4]
|
||||
movs r1, 0
|
||||
movs r3, 0
|
||||
bl sub_80047C8
|
||||
bl FillWindowRect_DefaultPalette
|
||||
ldr r1, _0804A09C
|
||||
ldr r0, [r1]
|
||||
adds r0, 0xC8
|
||||
@ -129148,7 +129148,7 @@ _0804A2F4:
|
||||
_0804A31E:
|
||||
ldr r0, _0804A338
|
||||
adds r1, r5, 0
|
||||
bl GetStringWidthGivenTextRendererTemplate
|
||||
bl GetStringWidthGivenWindowConfig
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
add sp, 0xC
|
||||
@ -129157,7 +129157,7 @@ _0804A31E:
|
||||
bx r1
|
||||
.align 2, 0
|
||||
_0804A334: .4byte 0x030045c0
|
||||
_0804A338: .4byte gUnknown_081E7294
|
||||
_0804A338: .4byte gWindowConfig_81E7294
|
||||
thumb_func_end sub_804A2B4
|
||||
|
||||
thumb_func_start sub_804A33C
|
||||
@ -129339,7 +129339,7 @@ _0804A484:
|
||||
mov r1, sp
|
||||
adds r1, 0x22
|
||||
ldr r0, _0804A518
|
||||
bl GetStringWidthGivenTextRendererTemplate
|
||||
bl GetStringWidthGivenWindowConfig
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
movs r1, 0x32
|
||||
@ -129395,7 +129395,7 @@ _0804A504:
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_0804A514: .4byte 0x030045c0
|
||||
_0804A518: .4byte gUnknown_081E7294
|
||||
_0804A518: .4byte gWindowConfig_81E7294
|
||||
thumb_func_end sub_804A41C
|
||||
|
||||
thumb_func_start sub_804A51C
|
||||
@ -129791,7 +129791,7 @@ sub_804A80C: @ 804A80C
|
||||
str r1, [sp, 0x4]
|
||||
movs r1, 0
|
||||
movs r3, 0
|
||||
bl sub_80047C8
|
||||
bl FillWindowRect_DefaultPalette
|
||||
movs r0, 0x1
|
||||
bl sub_804A41C
|
||||
add sp, 0x8
|
||||
@ -129821,7 +129821,7 @@ sub_804A840: @ 804A840
|
||||
str r1, [sp, 0x4]
|
||||
movs r1, 0
|
||||
movs r3, 0
|
||||
bl sub_80047C8
|
||||
bl FillWindowRect_DefaultPalette
|
||||
ldr r0, [r4]
|
||||
adds r0, 0xC8
|
||||
ldr r3, _0804A8A4
|
||||
@ -129860,7 +129860,7 @@ _0804A8A8:
|
||||
str r1, [sp, 0x4]
|
||||
movs r1, 0
|
||||
movs r3, 0
|
||||
bl sub_80047C8
|
||||
bl FillWindowRect_DefaultPalette
|
||||
ldr r0, [r4]
|
||||
adds r0, 0xC8
|
||||
ldr r3, _0804A92C
|
||||
@ -130408,7 +130408,7 @@ sub_804ACD8: @ 804ACD8
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_0804ACF0: .4byte gUnknown_081E725C
|
||||
_0804ACF0: .4byte gWindowConfig_81E725C
|
||||
thumb_func_end sub_804ACD8
|
||||
|
||||
thumb_func_start sub_804ACF4
|
||||
@ -131419,11 +131419,11 @@ _0804B47C:
|
||||
bl sub_804B228
|
||||
ldr r4, _0804B57C
|
||||
adds r0, r4, 0
|
||||
bl sub_8002A34
|
||||
bl SetUpWindowConfig
|
||||
ldr r0, [r6]
|
||||
adds r0, 0x4
|
||||
adds r1, r4, 0
|
||||
bl sub_8002D54
|
||||
bl InitWindowFromConfig
|
||||
movs r0, 0x2
|
||||
bl sub_8064EF4
|
||||
ldr r1, [r6]
|
||||
@ -131514,7 +131514,7 @@ _0804B47C:
|
||||
_0804B570: .4byte 0x03004828
|
||||
_0804B574: .4byte 0x0201f000
|
||||
_0804B578: .4byte sub_804B210
|
||||
_0804B57C: .4byte gUnknown_081E6F84
|
||||
_0804B57C: .4byte gWindowConfig_81E6F84
|
||||
_0804B580: .4byte 0x03002b74
|
||||
_0804B584: .4byte 0x00001144
|
||||
_0804B588: .4byte 0x03001770
|
||||
@ -131821,11 +131821,11 @@ _0804B7F4:
|
||||
bl sub_804B228
|
||||
ldr r4, _0804B900
|
||||
adds r0, r4, 0
|
||||
bl sub_8002A34
|
||||
bl SetUpWindowConfig
|
||||
ldr r0, [r5]
|
||||
adds r0, 0x4
|
||||
adds r1, r4, 0
|
||||
bl sub_8002D54
|
||||
bl InitWindowFromConfig
|
||||
movs r0, 0x2
|
||||
bl sub_8064EF4
|
||||
ldr r1, [r5]
|
||||
@ -131899,7 +131899,7 @@ _0804B8F0: .4byte 0x030045c0
|
||||
_0804B8F4: .4byte 0x03004828
|
||||
_0804B8F8: .4byte 0x0201f000
|
||||
_0804B8FC: .4byte sub_804B210
|
||||
_0804B900: .4byte gUnknown_081E717C
|
||||
_0804B900: .4byte gWindowConfig_81E717C
|
||||
_0804B904: .4byte 0x03002b74
|
||||
_0804B908: .4byte 0x00001144
|
||||
_0804B90C: .4byte 0x03001770
|
||||
@ -133424,7 +133424,7 @@ _0804C718:
|
||||
movs r1, 0
|
||||
movs r2, 0
|
||||
movs r3, 0x1D
|
||||
bl sub_80047FC
|
||||
bl ZeroFillWindowRect
|
||||
ldr r4, _0804C794
|
||||
ldr r1, _0804C798
|
||||
adds r0, r4, 0
|
||||
@ -134934,7 +134934,7 @@ _0804D3C4:
|
||||
movs r1, 0
|
||||
movs r2, 0
|
||||
movs r3, 0x1D
|
||||
bl sub_80047FC
|
||||
bl ZeroFillWindowRect
|
||||
ldr r4, _0804D414
|
||||
ldr r1, _0804D418
|
||||
adds r0, r4, 0
|
||||
@ -134994,7 +134994,7 @@ _0804D43E:
|
||||
movs r1, 0
|
||||
movs r2, 0
|
||||
movs r3, 0x1D
|
||||
bl sub_80047FC
|
||||
bl ZeroFillWindowRect
|
||||
ldr r4, _0804D484
|
||||
ldr r1, _0804D488
|
||||
adds r0, r4, 0
|
||||
@ -136142,7 +136142,7 @@ _0804DE4C:
|
||||
movs r1, 0
|
||||
movs r2, 0
|
||||
movs r3, 0x1D
|
||||
bl sub_80047FC
|
||||
bl ZeroFillWindowRect
|
||||
ldr r4, _0804DE94
|
||||
ldr r1, _0804DE98
|
||||
adds r0, r4, 0
|
||||
@ -136233,7 +136233,7 @@ _0804DF14:
|
||||
movs r1, 0
|
||||
movs r2, 0
|
||||
movs r3, 0x1D
|
||||
bl sub_80047FC
|
||||
bl ZeroFillWindowRect
|
||||
ldr r2, [r4]
|
||||
adds r0, r2, 0x4
|
||||
ldr r1, _0804DF50
|
||||
@ -137006,7 +137006,7 @@ _0804E5AC:
|
||||
bl SetVBlankCallback
|
||||
ldr r4, _0804E60C
|
||||
adds r0, r4, 0
|
||||
bl sub_8002A34
|
||||
bl SetUpWindowConfig
|
||||
adds r0, r4, 0
|
||||
bl sub_8071C4C
|
||||
ldr r3, _0804E610
|
||||
@ -137039,7 +137039,7 @@ _0804E5AC:
|
||||
bl sub_8051474
|
||||
b _0804E71A
|
||||
.align 2, 0
|
||||
_0804E60C: .4byte gUnknown_081E6F68
|
||||
_0804E60C: .4byte gWindowConfig_81E6F68
|
||||
_0804E610: .4byte 0x03004854
|
||||
_0804E614:
|
||||
bl sub_804E2EC
|
||||
@ -137665,7 +137665,7 @@ _0804EBBC:
|
||||
bl SetVBlankCallback
|
||||
ldr r4, _0804EC64
|
||||
adds r0, r4, 0
|
||||
bl sub_8002A34
|
||||
bl SetUpWindowConfig
|
||||
adds r0, r4, 0
|
||||
bl sub_8071C4C
|
||||
ldr r1, _0804EC68
|
||||
@ -137737,7 +137737,7 @@ _0804EC2A:
|
||||
b _0804F0CE
|
||||
.align 2, 0
|
||||
_0804EC60: .4byte sub_804E2BC
|
||||
_0804EC64: .4byte gUnknown_081E6F68
|
||||
_0804EC64: .4byte gWindowConfig_81E6F68
|
||||
_0804EC68: .4byte 0x03002b74
|
||||
_0804EC6C: .4byte 0x00004422
|
||||
_0804EC70: .4byte 0x03004854
|
||||
@ -138314,7 +138314,7 @@ sub_804F0F4: @ 804F0F4
|
||||
bl SetVBlankCallback
|
||||
ldr r4, _0804F15C
|
||||
adds r0, r4, 0
|
||||
bl sub_8002A34
|
||||
bl SetUpWindowConfig
|
||||
adds r0, r4, 0
|
||||
bl sub_8071C4C
|
||||
ldr r1, _0804F160
|
||||
@ -138348,7 +138348,7 @@ sub_804F0F4: @ 804F0F4
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_0804F158: .4byte sub_804E2BC
|
||||
_0804F15C: .4byte gUnknown_081E6F68
|
||||
_0804F15C: .4byte gWindowConfig_81E6F68
|
||||
_0804F160: .4byte 0x03002b74
|
||||
_0804F164: .4byte 0x00004422
|
||||
_0804F168: .4byte 0x03004854
|
||||
@ -143180,7 +143180,7 @@ _08051730:
|
||||
movs r1, 0
|
||||
movs r2, 0
|
||||
movs r3, 0x10
|
||||
bl sub_80047FC
|
||||
bl ZeroFillWindowRect
|
||||
movs r0, 0x4
|
||||
movs r1, 0x4
|
||||
movs r2, 0xA
|
||||
@ -144021,7 +144021,7 @@ _08051D56:
|
||||
adds r0, r4, r1
|
||||
ldrb r1, [r0, 0x1A]
|
||||
adds r0, r7, 0
|
||||
bl StopMusicWhileStringIsPrinted
|
||||
bl SetStringCharset
|
||||
adds r0, r7, 0
|
||||
ldr r1, _08051F20
|
||||
bl StringAppend
|
||||
@ -144906,7 +144906,7 @@ sub_80524BC: @ 80524BC
|
||||
bl SetVBlankCallback
|
||||
ldr r4, _08052520
|
||||
adds r0, r4, 0
|
||||
bl sub_8002A34
|
||||
bl SetUpWindowConfig
|
||||
adds r0, r4, 0
|
||||
bl sub_8071C4C
|
||||
ldr r0, _08052524
|
||||
@ -144936,7 +144936,7 @@ sub_80524BC: @ 80524BC
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_0805251C: .4byte sub_804E2D8
|
||||
_08052520: .4byte gUnknown_081E6CE4
|
||||
_08052520: .4byte gWindowConfig_81E6CE4
|
||||
_08052524: .4byte 0x03001770
|
||||
_08052528: .4byte 0x03000560
|
||||
_0805252C: .4byte sub_8052AF8
|
||||
|
142
asm/rom4.s
@ -3627,13 +3627,13 @@ _080548C4:
|
||||
bl sub_8054814
|
||||
bl sub_8054C54
|
||||
ldr r0, _080548DC
|
||||
bl sub_8002A34
|
||||
bl SetUpWindowConfig
|
||||
ldr r0, _080548E0
|
||||
bl sub_8071C4C
|
||||
b _08054928
|
||||
.align 2, 0
|
||||
_080548DC: .4byte gUnknown_081E6C3C
|
||||
_080548E0: .4byte gUnknown_081E6CE4
|
||||
_080548DC: .4byte gWindowConfig_81E6C3C
|
||||
_080548E0: .4byte gWindowConfig_81E6CE4
|
||||
_080548E4:
|
||||
bl move_tilemap_camera_to_upper_left_corner
|
||||
b _08054928
|
||||
@ -3735,13 +3735,13 @@ _080549B4:
|
||||
bl sub_8054814
|
||||
bl sub_8054C54
|
||||
ldr r0, _080549CC
|
||||
bl sub_8002A34
|
||||
bl SetUpWindowConfig
|
||||
ldr r0, _080549D0
|
||||
bl sub_8071C4C
|
||||
b _08054A38
|
||||
.align 2, 0
|
||||
_080549CC: .4byte gUnknown_081E6C3C
|
||||
_080549D0: .4byte gUnknown_081E6CE4
|
||||
_080549CC: .4byte gWindowConfig_81E6C3C
|
||||
_080549D0: .4byte gWindowConfig_81E6CE4
|
||||
_080549D4:
|
||||
bl move_tilemap_camera_to_upper_left_corner
|
||||
b _08054A38
|
||||
@ -3897,13 +3897,13 @@ _08054B0C:
|
||||
bl sub_8054814
|
||||
bl sub_8054C54
|
||||
ldr r0, _08054B24
|
||||
bl sub_8002A34
|
||||
bl SetUpWindowConfig
|
||||
ldr r0, _08054B28
|
||||
bl sub_8071C4C
|
||||
b _08054B70
|
||||
.align 2, 0
|
||||
_08054B24: .4byte gUnknown_081E6C3C
|
||||
_08054B28: .4byte gUnknown_081E6CE4
|
||||
_08054B24: .4byte gWindowConfig_81E6C3C
|
||||
_08054B28: .4byte gWindowConfig_81E6CE4
|
||||
_08054B2C:
|
||||
bl move_tilemap_camera_to_upper_left_corner
|
||||
b _08054B70
|
||||
@ -4042,15 +4042,15 @@ sub_8054C2C: @ 8054C2C
|
||||
bl sub_8054814
|
||||
bl sub_8054C54
|
||||
ldr r0, _08054C4C
|
||||
bl sub_8002A34
|
||||
bl SetUpWindowConfig
|
||||
ldr r0, _08054C50
|
||||
bl sub_8071C4C
|
||||
bl mapdata_load_assets_to_gpu_and_full_redraw
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_08054C4C: .4byte gUnknown_081E6C3C
|
||||
_08054C50: .4byte gUnknown_081E6CE4
|
||||
_08054C4C: .4byte gWindowConfig_81E6C3C
|
||||
_08054C50: .4byte gWindowConfig_81E6CE4
|
||||
thumb_func_end sub_8054C2C
|
||||
|
||||
thumb_func_start sub_8054C54
|
||||
@ -4155,9 +4155,9 @@ _08054D20: .4byte 0x04000050
|
||||
_08054D24: .4byte gUnknown_081E29E0
|
||||
_08054D28: .4byte 0x04000052
|
||||
_08054D2C: .4byte 0x0000070d
|
||||
_08054D30: .4byte gUnknown_081E29B8
|
||||
_08054D34: .4byte gUnknown_081E29C8
|
||||
_08054D38: .4byte gUnknown_081E29A8
|
||||
_08054D30: .4byte gBGHorizontalOffsetRegs
|
||||
_08054D34: .4byte gBGVerticalOffsetRegs
|
||||
_08054D38: .4byte gBGControlRegs
|
||||
_08054D3C: .4byte 0x00001d41
|
||||
_08054D40: .4byte 0x00001e43
|
||||
_08054D44: .4byte gUnknown_081E29D8
|
||||
@ -11124,10 +11124,10 @@ _08057AE0:
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_08057AE8: .4byte gUnknown_081E29B8
|
||||
_08057AE8: .4byte gBGHorizontalOffsetRegs
|
||||
_08057AEC: .4byte 0x03000590
|
||||
_08057AF0: .4byte 0x03000598
|
||||
_08057AF4: .4byte gUnknown_081E29C8
|
||||
_08057AF4: .4byte gBGVerticalOffsetRegs
|
||||
_08057AF8: .4byte 0x0300059a
|
||||
_08057AFC: .4byte 0x040000d4
|
||||
_08057B00: .4byte 0x020219cc
|
||||
@ -39974,14 +39974,14 @@ sub_8064A74: @ 8064A74
|
||||
bl sub_80651C8
|
||||
ldr r0, _08064A98
|
||||
ldr r1, _08064A9C
|
||||
bl sub_8002D54
|
||||
bl InitWindowFromConfig
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_08064A90: .4byte 0x030005a8
|
||||
_08064A94: .4byte 0x0202e9d2
|
||||
_08064A98: .4byte 0x0202e87c
|
||||
_08064A9C: .4byte gUnknown_081E6CE4
|
||||
_08064A9C: .4byte gWindowConfig_81E6CE4
|
||||
thumb_func_end sub_8064A74
|
||||
|
||||
thumb_func_start sub_8064AA0
|
||||
@ -40017,7 +40017,7 @@ _08064ACE:
|
||||
_08064AD8: .4byte 0x0202e87c
|
||||
_08064ADC:
|
||||
ldr r0, _08064AEC
|
||||
bl sub_8065330
|
||||
bl draw_win
|
||||
_08064AE2:
|
||||
ldrh r0, [r4, 0x8]
|
||||
adds r0, 0x1
|
||||
@ -40271,7 +40271,7 @@ sub_8064CA0: @ 8064CA0
|
||||
push {lr}
|
||||
bl task_del_textbox
|
||||
ldr r0, _08064CB8
|
||||
bl sub_8065330
|
||||
bl draw_win
|
||||
ldr r1, _08064CBC
|
||||
movs r0, 0
|
||||
strb r0, [r1]
|
||||
@ -41009,14 +41009,14 @@ copy_textbox_border_tile_patterns_to_vram: @ 8065200
|
||||
adds r4, r0, 0
|
||||
bl sub_8065348
|
||||
adds r0, r4, 0
|
||||
bl sub_8065330
|
||||
bl draw_win
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end copy_textbox_border_tile_patterns_to_vram
|
||||
|
||||
thumb_func_start sub_8065214
|
||||
sub_8065214: @ 8065214
|
||||
thumb_func_start draw_win_3
|
||||
draw_win_3: @ 8065214
|
||||
push {r4-r6,lr}
|
||||
ldr r4, [sp, 0x10]
|
||||
lsls r0, 16
|
||||
@ -41076,10 +41076,10 @@ _0806526E:
|
||||
bx r1
|
||||
.align 2, 0
|
||||
_0806527C: .4byte gUnknown_08376290
|
||||
thumb_func_end sub_8065214
|
||||
thumb_func_end draw_win_3
|
||||
|
||||
thumb_func_start sub_8065280
|
||||
sub_8065280: @ 8065280
|
||||
thumb_func_start draw_win_2
|
||||
draw_win_2: @ 8065280
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
@ -41137,7 +41137,7 @@ _080652E2:
|
||||
adds r1, r4, 0
|
||||
adds r2, r5, 0
|
||||
ldr r3, [sp, 0x10]
|
||||
bl sub_8065214
|
||||
bl draw_win_3
|
||||
ldr r1, [sp, 0x8]
|
||||
adds r2, r1, r4
|
||||
adds r2, r6, r2
|
||||
@ -41171,10 +41171,10 @@ _0806531C:
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_0806532C: .4byte 0x030005ae
|
||||
thumb_func_end sub_8065280
|
||||
thumb_func_end draw_win_2
|
||||
|
||||
thumb_func_start sub_8065330
|
||||
sub_8065330: @ 8065330
|
||||
thumb_func_start draw_win
|
||||
draw_win: @ 8065330
|
||||
push {lr}
|
||||
sub sp, 0x4
|
||||
movs r1, 0x4
|
||||
@ -41182,11 +41182,11 @@ sub_8065330: @ 8065330
|
||||
movs r1, 0
|
||||
movs r2, 0xE
|
||||
movs r3, 0x1A
|
||||
bl sub_8065280
|
||||
bl draw_win_2
|
||||
add sp, 0x4
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_8065330
|
||||
thumb_func_end draw_win
|
||||
|
||||
thumb_func_start sub_8065348
|
||||
sub_8065348: @ 8065348
|
||||
@ -45546,7 +45546,7 @@ sub_806730C: @ 806730C
|
||||
ldr r4, _08067360
|
||||
adds r1, 0x6
|
||||
adds r0, r4, 0
|
||||
bl UnknownStringFunc
|
||||
bl StringBraille
|
||||
adds r0, r5, 0
|
||||
adds r1, r6, 0
|
||||
mov r2, r8
|
||||
@ -52984,7 +52984,7 @@ _0806AB16:
|
||||
bl sub_8073B94
|
||||
ldr r4, _0806ABA0
|
||||
adds r0, r4, 0
|
||||
bl sub_8002A34
|
||||
bl SetUpWindowConfig
|
||||
adds r0, r4, 0
|
||||
bl sub_8071C4C
|
||||
movs r1, 0x80
|
||||
@ -53008,7 +53008,7 @@ _0806AB16:
|
||||
_0806AB94: .4byte 0x040000d4
|
||||
_0806AB98: .4byte 0x81000200
|
||||
_0806AB9C: .4byte 0x81000800
|
||||
_0806ABA0: .4byte gUnknown_081E6CE4
|
||||
_0806ABA0: .4byte gWindowConfig_81E6CE4
|
||||
_0806ABA4: .4byte sub_806ABC8
|
||||
_0806ABA8: .4byte sub_806ABB0
|
||||
_0806ABAC: .4byte sub_806ACCC
|
||||
@ -53879,34 +53879,34 @@ _0806B2B2:
|
||||
_0806B2CC: .4byte 0x0201b000
|
||||
_0806B2D0:
|
||||
ldr r0, _0806B2E0
|
||||
bl sub_8002A34
|
||||
bl SetUpWindowConfig
|
||||
ldr r1, _0806B2E4
|
||||
ldr r0, _0806B2E8
|
||||
adds r1, r0
|
||||
b _0806B42C
|
||||
.align 2, 0
|
||||
_0806B2E0: .4byte gUnknown_081E6C90
|
||||
_0806B2E0: .4byte gWindowConfig_81E6C90
|
||||
_0806B2E4: .4byte 0x03001770
|
||||
_0806B2E8: .4byte 0x0000043c
|
||||
_0806B2EC:
|
||||
ldr r4, _0806B308
|
||||
ldr r1, _0806B30C
|
||||
adds r0, r4, 0
|
||||
bl sub_8002D54
|
||||
bl InitWindowFromConfig
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x1
|
||||
bl sub_8002BFC
|
||||
bl MultistepInitWindowTileData
|
||||
ldr r1, _0806B310
|
||||
ldr r2, _0806B314
|
||||
adds r1, r2
|
||||
b _0806B42C
|
||||
.align 2, 0
|
||||
_0806B308: .4byte 0x03004210
|
||||
_0806B30C: .4byte gUnknown_081E6C90
|
||||
_0806B30C: .4byte gWindowConfig_81E6C90
|
||||
_0806B310: .4byte 0x03001770
|
||||
_0806B314: .4byte 0x0000043c
|
||||
_0806B318:
|
||||
bl sub_8002C54
|
||||
bl MultistepLoadFont
|
||||
cmp r0, 0
|
||||
bne _0806B322
|
||||
b _0806B450
|
||||
@ -53986,7 +53986,7 @@ _0806B3C0:
|
||||
bl sub_8071C58
|
||||
b _0806B426
|
||||
.align 2, 0
|
||||
_0806B3C8: .4byte gUnknown_081E6CC8
|
||||
_0806B3C8: .4byte gWindowConfig_81E6CC8
|
||||
_0806B3CC:
|
||||
bl sub_8071C94
|
||||
cmp r0, 0
|
||||
@ -58465,7 +58465,7 @@ sub_806D5B8: @ 806D5B8
|
||||
mov r1, r10
|
||||
mov r2, r9
|
||||
mov r3, r8
|
||||
bl sub_80047FC
|
||||
bl ZeroFillWindowRect
|
||||
movs r0, 0
|
||||
str r0, [sp, 0x4]
|
||||
lsls r5, 10
|
||||
@ -58547,7 +58547,7 @@ sub_806D668: @ 806D668
|
||||
mov r1, r10
|
||||
mov r2, r9
|
||||
mov r3, r8
|
||||
bl sub_80047FC
|
||||
bl ZeroFillWindowRect
|
||||
movs r0, 0
|
||||
str r0, [sp, 0x4]
|
||||
lsls r5, 10
|
||||
@ -58672,7 +58672,7 @@ _0806D7C8: .4byte gUnknown_08E71354
|
||||
_0806D7CC: .4byte gUnknown_08E71788
|
||||
_0806D7D0: .4byte 0x06003800
|
||||
_0806D7D4: .4byte gUnknown_08E716A0
|
||||
_0806D7D8: .4byte gUnknown_081E66B2
|
||||
_0806D7D8: .4byte gFontDefaultPalette
|
||||
_0806D7DC: .4byte gUnknown_08E71894
|
||||
_0806D7E0: .4byte 0x06006000
|
||||
_0806D7E4: .4byte gUnknown_08E71934
|
||||
@ -59776,7 +59776,7 @@ box_print: @ 806E000
|
||||
.align 2, 0
|
||||
_0806E040: .4byte 0x02039360
|
||||
_0806E044: .4byte 0x01000100
|
||||
_0806E048: .4byte gUnknown_081E6CAC
|
||||
_0806E048: .4byte gWindowConfig_81E6CAC
|
||||
_0806E04C: .4byte 0x06014000
|
||||
thumb_func_end box_print
|
||||
|
||||
@ -60073,7 +60073,7 @@ _0806E278: .4byte gUnknown_08376738
|
||||
_0806E27C: .4byte 0x020231cc
|
||||
_0806E280: .4byte 0x02039460
|
||||
_0806E284: .4byte 0x01000020
|
||||
_0806E288: .4byte gUnknown_081E6CAC
|
||||
_0806E288: .4byte gWindowConfig_81E6CAC
|
||||
_0806E28C: .4byte 0xffffff00
|
||||
_0806E290: .4byte 0x06014200
|
||||
thumb_func_end sub_806E1F4
|
||||
@ -60339,7 +60339,7 @@ sub_806E420: @ 806E420
|
||||
_0806E48C: .4byte 0x020231cc
|
||||
_0806E490: .4byte 0x02039460
|
||||
_0806E494: .4byte 0x01000040
|
||||
_0806E498: .4byte gUnknown_081E6CAC
|
||||
_0806E498: .4byte gWindowConfig_81E6CAC
|
||||
_0806E49C: .4byte 0xffffff00
|
||||
_0806E4A0: .4byte 0x06014300
|
||||
thumb_func_end sub_806E420
|
||||
@ -65966,7 +65966,7 @@ sub_8071284: @ 8071284
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_080712AC: .4byte gUnknown_081E6CE4
|
||||
_080712AC: .4byte gWindowConfig_81E6CE4
|
||||
_080712B0: .4byte task50_startmenu
|
||||
thumb_func_end sub_8071284
|
||||
|
||||
@ -67054,7 +67054,7 @@ _08071AA4:
|
||||
_08071AB6:
|
||||
ldr r4, _08071AD4
|
||||
adds r0, r4, 0
|
||||
bl sub_8002A34
|
||||
bl SetUpWindowConfig
|
||||
adds r0, r4, 0
|
||||
bl sub_8071C4C
|
||||
movs r1, 0x80
|
||||
@ -67065,7 +67065,7 @@ _08071AB6:
|
||||
strh r0, [r1]
|
||||
b _08071B10
|
||||
.align 2, 0
|
||||
_08071AD4: .4byte gUnknown_081E6CE4
|
||||
_08071AD4: .4byte gWindowConfig_81E6CE4
|
||||
_08071AD8:
|
||||
movs r0, 0x1
|
||||
negs r0, r0
|
||||
@ -67284,7 +67284,7 @@ sub_8071C64: @ 8071C64
|
||||
ldr r0, _08071C90
|
||||
str r0, [r1]
|
||||
adds r1, r3, 0
|
||||
bl sub_8002D54
|
||||
bl InitWindowFromConfig
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
@ -67328,7 +67328,7 @@ _08071CD0:
|
||||
ldr r0, [r0]
|
||||
ldr r1, _08071CEC
|
||||
ldrh r1, [r1]
|
||||
bl sub_8002BFC
|
||||
bl MultistepInitWindowTileData
|
||||
strh r0, [r4]
|
||||
b _08071D06
|
||||
.align 2, 0
|
||||
@ -67336,7 +67336,7 @@ _08071CE4: .4byte 0x0202e9d0
|
||||
_08071CE8: .4byte 0x0202e9c8
|
||||
_08071CEC: .4byte 0x0202e9ce
|
||||
_08071CF0:
|
||||
bl sub_8002C54
|
||||
bl MultistepLoadFont
|
||||
cmp r0, 0
|
||||
beq _08071D40
|
||||
b _08071D06
|
||||
@ -67389,12 +67389,12 @@ sub_8071D48: @ 8071D48
|
||||
ldr r0, _08071D90
|
||||
str r0, [r5]
|
||||
adds r1, r2, 0
|
||||
bl sub_8002D54
|
||||
bl InitWindowFromConfig
|
||||
ldr r1, _08071D94
|
||||
strh r4, [r1]
|
||||
ldr r0, [r5]
|
||||
ldrh r1, [r1]
|
||||
bl sub_8002A50
|
||||
bl InitWindowTileData
|
||||
ldr r1, _08071D98
|
||||
strh r0, [r1]
|
||||
ldrh r0, [r1]
|
||||
@ -67429,7 +67429,7 @@ sub_8071DA4: @ 8071DA4
|
||||
ldr r0, _08071DEC
|
||||
str r0, [r5]
|
||||
adds r1, r2, 0
|
||||
bl sub_8002D54
|
||||
bl InitWindowFromConfig
|
||||
ldr r0, _08071DF0
|
||||
strh r4, [r0]
|
||||
ldrh r0, [r0]
|
||||
@ -67444,7 +67444,7 @@ sub_8071DA4: @ 8071DA4
|
||||
strh r0, [r1]
|
||||
ldr r0, [r5]
|
||||
ldrh r1, [r1]
|
||||
bl sub_8002A50
|
||||
bl InitWindowTileData
|
||||
ldr r1, _08071DFC
|
||||
strh r0, [r1]
|
||||
pop {r4,r5}
|
||||
@ -67492,7 +67492,7 @@ sub_8071E2C: @ 8071E2C
|
||||
adds r1, r0, 0
|
||||
ldr r4, _08071E48
|
||||
ldr r0, [r4]
|
||||
bl sub_8002D54
|
||||
bl InitWindowFromConfig
|
||||
ldr r1, [r4]
|
||||
ldr r0, _08071E4C
|
||||
ldrh r0, [r0]
|
||||
@ -67553,7 +67553,7 @@ Reset: @ 8071E84
|
||||
adds r1, r4, 0
|
||||
adds r2, r5, 0
|
||||
adds r3, r6, 0
|
||||
bl sub_80047FC
|
||||
bl ZeroFillWindowRect
|
||||
add sp, 0x4
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
@ -67583,7 +67583,7 @@ sub_8071EBC: @ 8071EBC
|
||||
adds r1, r4, 0
|
||||
adds r2, r5, 0
|
||||
adds r3, r6, 0
|
||||
bl sub_800482C
|
||||
bl FillWindowRectWithBlankTile
|
||||
add sp, 0x4
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
@ -67693,7 +67693,7 @@ sub_8071F98: @ 8071F98
|
||||
ldr r0, _08071FB8
|
||||
ldr r0, [r0]
|
||||
adds r1, r3, 0
|
||||
bl sub_800467C
|
||||
bl GetWindowTilemapEntry
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
pop {r1}
|
||||
@ -67727,7 +67727,7 @@ sub_8071FBC: @ 8071FBC
|
||||
adds r1, r4, 0
|
||||
adds r2, r5, 0
|
||||
adds r3, r6, 0
|
||||
bl sub_8004690
|
||||
bl DrawWindowRect
|
||||
add sp, 0x8
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
@ -67842,7 +67842,7 @@ sub_80720B0: @ 80720B0
|
||||
push {lr}
|
||||
ldr r0, _080720C0
|
||||
ldr r0, [r0]
|
||||
bl sub_8004318
|
||||
bl ClearWindowTextLines
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
@ -69099,7 +69099,7 @@ sub_80729D8: @ 80729D8
|
||||
adds r1, r6, 0
|
||||
adds r2, r5, 0
|
||||
adds r3, r4, 0
|
||||
bl AddTextPrinterParametrized2
|
||||
bl sub_8004D04
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
add sp, 0x8
|
||||
@ -69320,7 +69320,7 @@ sub_8072B80: @ 8072B80
|
||||
str r1, [sp]
|
||||
add r1, sp, 0x4
|
||||
mov r2, r8
|
||||
bl sub_8004B24
|
||||
bl AlignString
|
||||
ldr r0, [r4]
|
||||
ldr r1, _08072BD4
|
||||
ldrh r2, [r1]
|
||||
@ -69387,7 +69387,7 @@ sub_8072C14: @ 8072C14
|
||||
adds r1, r5, 0
|
||||
adds r2, r6, 0
|
||||
adds r3, r4, 0
|
||||
bl sub_8004988
|
||||
bl AlignInt1
|
||||
add sp, 0x4
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
@ -69413,7 +69413,7 @@ sub_8072C44: @ 8072C44
|
||||
adds r1, r5, 0
|
||||
adds r2, r6, 0
|
||||
adds r3, r4, 0
|
||||
bl sub_8004A48
|
||||
bl AlignInt2
|
||||
add sp, 0x4
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
@ -69439,7 +69439,7 @@ sub_8072C74: @ 8072C74
|
||||
adds r1, r5, 0
|
||||
adds r2, r6, 0
|
||||
adds r3, r4, 0
|
||||
bl sub_8004B24
|
||||
bl AlignString
|
||||
add sp, 0x4
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
@ -69503,7 +69503,7 @@ sub_8072CF4: @ 8072CF4
|
||||
lsrs r1, 24
|
||||
ldr r0, _08072D08
|
||||
ldr r0, [r0]
|
||||
bl IsTextPrinterActive
|
||||
bl sub_80037C8
|
||||
pop {r1}
|
||||
bx r1
|
||||
.align 2, 0
|
||||
|
622
asm/rom5.s
@ -82,6 +82,7 @@
|
||||
'x' = EC
|
||||
'y' = ED
|
||||
'z' = EE
|
||||
'▶' = EF
|
||||
':' = F0
|
||||
'$' = FF
|
||||
|
||||
|
339
data/data2.s
@ -5,345 +5,6 @@
|
||||
|
||||
.section .rodata
|
||||
|
||||
.global gUnknown_081E29A8
|
||||
gUnknown_081E29A8: @ 81E29A8
|
||||
.incbin "baserom.gba", 0x001e29a8, 0x10
|
||||
|
||||
.global gUnknown_081E29B8
|
||||
gUnknown_081E29B8: @ 81E29B8
|
||||
.incbin "baserom.gba", 0x001e29b8, 0x10
|
||||
|
||||
.global gUnknown_081E29C8
|
||||
gUnknown_081E29C8: @ 81E29C8
|
||||
.incbin "baserom.gba", 0x001e29c8, 0x10
|
||||
|
||||
.global gUnknown_081E29D8
|
||||
gUnknown_081E29D8: @ 81E29D8
|
||||
.incbin "baserom.gba", 0x001e29d8, 0x8
|
||||
|
||||
.global gUnknown_081E29E0
|
||||
gUnknown_081E29E0: @ 81E29E0
|
||||
.incbin "baserom.gba", 0x001e29e0, 0x8
|
||||
|
||||
.global gUnknown_081E29E8
|
||||
gUnknown_081E29E8: @ 81E29E8
|
||||
.incbin "baserom.gba", 0x001e29e8, 0x1008
|
||||
|
||||
.global gUnknown_081E39F0
|
||||
gUnknown_081E39F0: @ 81E39F0
|
||||
.incbin "baserom.gba", 0x001e39f0, 0x370
|
||||
|
||||
.global gUnknown_081E3D60
|
||||
gUnknown_081E3D60: @ 81E3D60
|
||||
.incbin "baserom.gba", 0x001e3d60, 0x1b90
|
||||
|
||||
.global gUnknown_081E58F0
|
||||
gUnknown_081E58F0: @ 81E58F0
|
||||
.incbin "baserom.gba", 0x001e58f0, 0x600
|
||||
|
||||
.global gUnknown_081E5EF0
|
||||
gUnknown_081E5EF0: @ 81E5EF0
|
||||
.incbin "baserom.gba", 0x001e5ef0, 0x100
|
||||
|
||||
.global gUnknown_081E5FF0
|
||||
gUnknown_081E5FF0: @ 81E5FF0
|
||||
.incbin "baserom.gba", 0x001e5ff0, 0x1ee
|
||||
|
||||
.global gUnknown_081E61DE
|
||||
gUnknown_081E61DE: @ 81E61DE
|
||||
.incbin "baserom.gba", 0x001e61de, 0x100
|
||||
|
||||
.global gUnknown_081E62DE
|
||||
gUnknown_081E62DE: @ 81E62DE
|
||||
.incbin "baserom.gba", 0x001e62de, 0xdc
|
||||
|
||||
.global gUnknown_081E63BA
|
||||
gUnknown_081E63BA: @ 81E63BA
|
||||
.incbin "baserom.gba", 0x001e63ba, 0xdc
|
||||
|
||||
.global gUnknown_081E6496
|
||||
gUnknown_081E6496: @ 81E6496
|
||||
.incbin "baserom.gba", 0x001e6496, 0xfe
|
||||
|
||||
.global gUnknown_081E6594
|
||||
gUnknown_081E6594: @ 81E6594
|
||||
.incbin "baserom.gba", 0x001e6594, 0xfe
|
||||
|
||||
.global gUnknown_081E6692
|
||||
gUnknown_081E6692: @ 81E6692
|
||||
.incbin "baserom.gba", 0x001e6692, 0x2
|
||||
|
||||
.global gUnknown_081E6694
|
||||
gUnknown_081E6694: @ 81E6694
|
||||
.incbin "baserom.gba", 0x001e6694, 0x1a
|
||||
|
||||
.global gUnknown_081E66AE
|
||||
gUnknown_081E66AE: @ 81E66AE
|
||||
.incbin "baserom.gba", 0x001e66ae, 0x4
|
||||
|
||||
.global gUnknown_081E66B2
|
||||
gUnknown_081E66B2: @ 81E66B2
|
||||
.incbin "baserom.gba", 0x001e66b2, 0x20
|
||||
|
||||
.global gUnknown_081E66D2
|
||||
gUnknown_081E66D2: @ 81E66D2
|
||||
.incbin "baserom.gba", 0x001e66d2, 0xa
|
||||
|
||||
.global gUnknown_081E66DC
|
||||
gUnknown_081E66DC: @ 81E66DC
|
||||
.incbin "baserom.gba", 0x001e66dc, 0x300
|
||||
|
||||
.global gUnknown_081E69DC
|
||||
gUnknown_081E69DC: @ 81E69DC
|
||||
.incbin "baserom.gba", 0x001e69dc, 0x60
|
||||
|
||||
.global gUnknown_081E6A3C
|
||||
gUnknown_081E6A3C: @ 81E6A3C
|
||||
.incbin "baserom.gba", 0x001e6a3c, 0x40
|
||||
|
||||
.global gUnknown_081E6A7C
|
||||
gUnknown_081E6A7C: @ 81E6A7C
|
||||
.incbin "baserom.gba", 0x001e6a7c, 0xc
|
||||
|
||||
.global gUnknown_081E6A88
|
||||
gUnknown_081E6A88: @ 81E6A88
|
||||
.incbin "baserom.gba", 0x001e6a88, 0x1c
|
||||
|
||||
.global gUnknown_081E6AA4
|
||||
gUnknown_081E6AA4: @ 81E6AA4
|
||||
.incbin "baserom.gba", 0x001e6aa4, 0x30
|
||||
|
||||
.global gUnknown_081E6AD4
|
||||
gUnknown_081E6AD4: @ 81E6AD4
|
||||
.incbin "baserom.gba", 0x001e6ad4, 0x5c
|
||||
|
||||
.global gUnknown_081E6B30
|
||||
gUnknown_081E6B30: @ 81E6B30
|
||||
.incbin "baserom.gba", 0x001e6b30, 0xa8
|
||||
|
||||
.global gUnknown_081E6BD8
|
||||
gUnknown_081E6BD8: @ 81E6BD8
|
||||
.incbin "baserom.gba", 0x001e6bd8, 0x3
|
||||
|
||||
.global gUnknown_081E6BDB
|
||||
gUnknown_081E6BDB: @ 81E6BDB
|
||||
.incbin "baserom.gba", 0x001e6bdb, 0x19
|
||||
|
||||
.global gUnknown_081E6BF4
|
||||
gUnknown_081E6BF4: @ 81E6BF4
|
||||
.incbin "baserom.gba", 0x001e6bf4, 0x24
|
||||
|
||||
.global gUnknown_081E6C18
|
||||
gUnknown_081E6C18: @ 81E6C18
|
||||
.incbin "baserom.gba", 0x001e6c18, 0x24
|
||||
|
||||
.global gUnknown_081E6C3C
|
||||
gUnknown_081E6C3C: @ 81E6C3C
|
||||
.incbin "baserom.gba", 0x001e6c3c, 0x1c
|
||||
|
||||
.global gUnknown_081E6C58
|
||||
gUnknown_081E6C58: @ 81E6C58
|
||||
.incbin "baserom.gba", 0x001e6c58, 0x1c
|
||||
|
||||
.global gUnknown_081E6C74
|
||||
gUnknown_081E6C74: @ 81E6C74
|
||||
.incbin "baserom.gba", 0x001e6c74, 0x1c
|
||||
|
||||
.global gUnknown_081E6C90
|
||||
gUnknown_081E6C90: @ 81E6C90
|
||||
.incbin "baserom.gba", 0x001e6c90, 0x1c
|
||||
|
||||
.global gUnknown_081E6CAC
|
||||
gUnknown_081E6CAC: @ 81E6CAC
|
||||
.incbin "baserom.gba", 0x001e6cac, 0x1c
|
||||
|
||||
.global gUnknown_081E6CC8
|
||||
gUnknown_081E6CC8: @ 81E6CC8
|
||||
.incbin "baserom.gba", 0x001e6cc8, 0x1c
|
||||
|
||||
.global gUnknown_081E6CE4
|
||||
gUnknown_081E6CE4: @ 81E6CE4
|
||||
.incbin "baserom.gba", 0x001e6ce4, 0x1c
|
||||
|
||||
.global gUnknown_081E6D00
|
||||
gUnknown_081E6D00: @ 81E6D00
|
||||
.incbin "baserom.gba", 0x001e6d00, 0x38
|
||||
|
||||
.global gUnknown_081E6D38
|
||||
gUnknown_081E6D38: @ 81E6D38
|
||||
.incbin "baserom.gba", 0x001e6d38, 0x1c
|
||||
|
||||
.global gUnknown_081E6D54
|
||||
gUnknown_081E6D54: @ 81E6D54
|
||||
.incbin "baserom.gba", 0x001e6d54, 0x1c
|
||||
|
||||
.global gUnknown_081E6D70
|
||||
gUnknown_081E6D70: @ 81E6D70
|
||||
.incbin "baserom.gba", 0x001e6d70, 0x1c
|
||||
|
||||
.global gUnknown_081E6D8C
|
||||
gUnknown_081E6D8C: @ 81E6D8C
|
||||
.incbin "baserom.gba", 0x001e6d8c, 0x1c
|
||||
|
||||
.global gUnknown_081E6DA8
|
||||
gUnknown_081E6DA8: @ 81E6DA8
|
||||
.incbin "baserom.gba", 0x001e6da8, 0x1c
|
||||
|
||||
.global gUnknown_081E6DC4
|
||||
gUnknown_081E6DC4: @ 81E6DC4
|
||||
.incbin "baserom.gba", 0x001e6dc4, 0x1c
|
||||
|
||||
.global gUnknown_081E6DE0
|
||||
gUnknown_081E6DE0: @ 81E6DE0
|
||||
.incbin "baserom.gba", 0x001e6de0, 0x1c
|
||||
|
||||
.global gUnknown_081E6DFC
|
||||
gUnknown_081E6DFC: @ 81E6DFC
|
||||
.incbin "baserom.gba", 0x001e6dfc, 0x1c
|
||||
|
||||
.global gUnknown_081E6E18
|
||||
gUnknown_081E6E18: @ 81E6E18
|
||||
.incbin "baserom.gba", 0x001e6e18, 0x1c
|
||||
|
||||
.global gUnknown_081E6E34
|
||||
gUnknown_081E6E34: @ 81E6E34
|
||||
.incbin "baserom.gba", 0x001e6e34, 0x1c
|
||||
|
||||
.global gUnknown_081E6E50
|
||||
gUnknown_081E6E50: @ 81E6E50
|
||||
.incbin "baserom.gba", 0x001e6e50, 0x1c
|
||||
|
||||
.global gUnknown_081E6E6C
|
||||
gUnknown_081E6E6C: @ 81E6E6C
|
||||
.incbin "baserom.gba", 0x001e6e6c, 0x1c
|
||||
|
||||
.global gUnknown_081E6E88
|
||||
gUnknown_081E6E88: @ 81E6E88
|
||||
.incbin "baserom.gba", 0x001e6e88, 0xc4
|
||||
|
||||
.global gUnknown_081E6F4C
|
||||
gUnknown_081E6F4C: @ 81E6F4C
|
||||
.incbin "baserom.gba", 0x001e6f4c, 0x1c
|
||||
|
||||
.global gUnknown_081E6F68
|
||||
gUnknown_081E6F68: @ 81E6F68
|
||||
.incbin "baserom.gba", 0x001e6f68, 0x1c
|
||||
|
||||
.global gUnknown_081E6F84
|
||||
gUnknown_081E6F84: @ 81E6F84
|
||||
.incbin "baserom.gba", 0x001e6f84, 0x1c
|
||||
|
||||
.global gUnknown_081E6FA0
|
||||
gUnknown_081E6FA0: @ 81E6FA0
|
||||
.incbin "baserom.gba", 0x001e6fa0, 0x38
|
||||
|
||||
.global gUnknown_081E6FD8
|
||||
gUnknown_081E6FD8: @ 81E6FD8
|
||||
.incbin "baserom.gba", 0x001e6fd8, 0x1c
|
||||
|
||||
.global gUnknown_081E6FF4
|
||||
gUnknown_081E6FF4: @ 81E6FF4
|
||||
.incbin "baserom.gba", 0x001e6ff4, 0x38
|
||||
|
||||
.global gUnknown_081E702C
|
||||
gUnknown_081E702C: @ 81E702C
|
||||
.incbin "baserom.gba", 0x001e702c, 0x1c
|
||||
|
||||
.global gUnknown_081E7048
|
||||
gUnknown_081E7048: @ 81E7048
|
||||
.incbin "baserom.gba", 0x001e7048, 0x1c
|
||||
|
||||
.global gUnknown_081E7064
|
||||
gUnknown_081E7064: @ 81E7064
|
||||
.incbin "baserom.gba", 0x001e7064, 0x1c
|
||||
|
||||
.global gUnknown_081E7080
|
||||
gUnknown_081E7080: @ 81E7080
|
||||
.incbin "baserom.gba", 0x001e7080, 0x1c
|
||||
|
||||
.global gUnknown_081E709C
|
||||
gUnknown_081E709C: @ 81E709C
|
||||
.incbin "baserom.gba", 0x001e709c, 0x1c
|
||||
|
||||
.global gUnknown_081E70B8
|
||||
gUnknown_081E70B8: @ 81E70B8
|
||||
.incbin "baserom.gba", 0x001e70b8, 0x1c
|
||||
|
||||
.global gUnknown_081E70D4
|
||||
gUnknown_081E70D4: @ 81E70D4
|
||||
.incbin "baserom.gba", 0x001e70d4, 0x1c
|
||||
|
||||
.global gUnknown_081E70F0
|
||||
gUnknown_081E70F0: @ 81E70F0
|
||||
.incbin "baserom.gba", 0x001e70f0, 0x1c
|
||||
|
||||
.global gUnknown_081E710C
|
||||
gUnknown_081E710C: @ 81E710C
|
||||
.incbin "baserom.gba", 0x001e710c, 0x1c
|
||||
|
||||
.global gUnknown_081E7128
|
||||
gUnknown_081E7128: @ 81E7128
|
||||
.incbin "baserom.gba", 0x001e7128, 0x1c
|
||||
|
||||
.global gUnknown_081E7144
|
||||
gUnknown_081E7144: @ 81E7144
|
||||
.incbin "baserom.gba", 0x001e7144, 0x1c
|
||||
|
||||
.global gUnknown_081E7160
|
||||
gUnknown_081E7160: @ 81E7160
|
||||
.incbin "baserom.gba", 0x001e7160, 0x1c
|
||||
|
||||
.global gUnknown_081E717C
|
||||
gUnknown_081E717C: @ 81E717C
|
||||
.incbin "baserom.gba", 0x001e717c, 0x1c
|
||||
|
||||
.global gUnknown_081E7198
|
||||
gUnknown_081E7198: @ 81E7198
|
||||
.incbin "baserom.gba", 0x001e7198, 0x1c
|
||||
|
||||
.global gUnknown_081E71B4
|
||||
gUnknown_081E71B4: @ 81E71B4
|
||||
.incbin "baserom.gba", 0x001e71b4, 0x1c
|
||||
|
||||
.global gUnknown_081E71D0
|
||||
gUnknown_081E71D0: @ 81E71D0
|
||||
.incbin "baserom.gba", 0x001e71d0, 0x1c
|
||||
|
||||
.global gUnknown_081E71EC
|
||||
gUnknown_081E71EC: @ 81E71EC
|
||||
.incbin "baserom.gba", 0x001e71ec, 0x1c
|
||||
|
||||
.global gUnknown_081E7208
|
||||
gUnknown_081E7208: @ 81E7208
|
||||
.incbin "baserom.gba", 0x001e7208, 0x1c
|
||||
|
||||
.global gUnknown_081E7224
|
||||
gUnknown_081E7224: @ 81E7224
|
||||
.incbin "baserom.gba", 0x001e7224, 0x1c
|
||||
|
||||
.global gUnknown_081E7240
|
||||
gUnknown_081E7240: @ 81E7240
|
||||
.incbin "baserom.gba", 0x001e7240, 0x1c
|
||||
|
||||
.global gUnknown_081E725C
|
||||
gUnknown_081E725C: @ 81E725C
|
||||
.incbin "baserom.gba", 0x001e725c, 0x1c
|
||||
|
||||
.global gUnknown_081E7278
|
||||
gUnknown_081E7278: @ 81E7278
|
||||
.incbin "baserom.gba", 0x001e7278, 0x1c
|
||||
|
||||
.global gUnknown_081E7294
|
||||
gUnknown_081E7294: @ 81E7294
|
||||
.incbin "baserom.gba", 0x001e7294, 0x1c
|
||||
|
||||
.global gUnknown_081E72B0
|
||||
gUnknown_081E72B0: @ 81E72B0
|
||||
.incbin "baserom.gba", 0x001e72b0, 0x3
|
||||
|
||||
@ 81E72B3
|
||||
.include "data/string_util.s"
|
||||
|
||||
.global gUnknown_081E7330
|
||||
gUnknown_081E7330: @ 81E7330
|
||||
.incbin "baserom.gba", 0x001e7330, 0x20
|
||||
|
@ -1053,10 +1053,18 @@ gUnknown_08EA260C: @ 8EA260C
|
||||
gUnknown_08EA2A44: @ 8EA2A44
|
||||
.incbin "baserom.gba", 0x00ea2a44, 0x200
|
||||
|
||||
.global gUnknown_08EA2C44
|
||||
gUnknown_08EA2C44: @ 8EA2C44
|
||||
.incbin "baserom.gba", 0x00ea2c44, 0x3f80
|
||||
.global gFont3LatinGlyphs
|
||||
gFont3LatinGlyphs: @ 8EA2C44
|
||||
.incbin "graphics/fonts/font3_lat.4bpp"
|
||||
|
||||
.global gUnknown_08EA6BC4
|
||||
gUnknown_08EA6BC4: @ 8EA6BC4
|
||||
.incbin "baserom.gba", 0x00ea6bc4
|
||||
.global gFont4LatinGlyphs
|
||||
gFont4LatinGlyphs: @ 8EA6BC4
|
||||
.incbin "graphics/fonts/font4_lat.4bpp"
|
||||
|
||||
.global gFont3JapaneseGlyphs
|
||||
gFont3JapaneseGlyphs: @ 8EA8744
|
||||
.incbin "graphics/fonts/font3_jpn.4bpp"
|
||||
|
||||
.global gFont4JapaneseGlyphs
|
||||
gFont4JapaneseGlyphs: @ 8EAC6C4
|
||||
.incbin "graphics/fonts/font4_jpn.4bpp"
|
||||
|
@ -1,5 +1,7 @@
|
||||
gStringVar1 = 0x20231CC;
|
||||
gStringVar2 = 0x20232CC;
|
||||
gStringVar3 = 0x20233CC;
|
||||
gUnknown_020239F8 = 0x20239F8;
|
||||
|
||||
gUnknown_0203869A = 0x203869A;
|
||||
|
||||
gTileBuffer = 0x2039360;
|
||||
|
||||
gSaveBlock2 = 0x2024EA4;
|
||||
|
28
fonts.mk
Normal file
@ -0,0 +1,28 @@
|
||||
RSFONT := tools/rsfont/rsfont
|
||||
|
||||
graphics/fonts/font0_jpn.1bpp: graphics/fonts/font0_jpn.png
|
||||
$(RSFONT) $< $@ 240 1
|
||||
|
||||
graphics/fonts/font1_jpn.1bpp: graphics/fonts/font1_jpn.png
|
||||
$(RSFONT) $< $@ 256 0
|
||||
|
||||
graphics/fonts/font3_jpn.4bpp: graphics/fonts/font3_jpn.png
|
||||
$(RSFONT) $< $@ 252 2
|
||||
|
||||
graphics/fonts/font4_jpn.4bpp: graphics/fonts/font4_jpn.png
|
||||
$(RSFONT) $< $@ 220 0
|
||||
|
||||
graphics/fonts/font0_lat.1bpp: graphics/fonts/font0_lat.png
|
||||
$(RSFONT) $< $@ 256 1
|
||||
|
||||
graphics/fonts/font1_lat.1bpp: graphics/fonts/font1_lat.png
|
||||
$(RSFONT) $< $@ 256 0
|
||||
|
||||
graphics/fonts/font3_lat.4bpp: graphics/fonts/font3_lat.png
|
||||
$(RSFONT) $< $@ 254 1
|
||||
|
||||
graphics/fonts/font4_lat.4bpp: graphics/fonts/font4_lat.png
|
||||
$(RSFONT) $< $@ 220 0
|
||||
|
||||
graphics/fonts/font6_braille.1bpp: graphics/fonts/font6_braille.png
|
||||
$(RSFONT) $< $@ 192 0
|
37
generated.mk
Normal file
@ -0,0 +1,37 @@
|
||||
BIN2C := tools/bin2c/bin2c
|
||||
|
||||
GEN_FONT_HEADERS := \
|
||||
include/fonts/font0_lat_glyphs.h \
|
||||
include/fonts/font1_lat_glyphs.h \
|
||||
include/fonts/font0_jpn_glyphs.h \
|
||||
include/fonts/font1_jpn_glyphs.h \
|
||||
include/fonts/braille_glyphs.h \
|
||||
include/fonts/down_arrow_tiles.h \
|
||||
include/fonts/unknown_palette_81E6692.h \
|
||||
include/fonts/default_palette.h
|
||||
|
||||
generated: $(GEN_FONT_HEADERS)
|
||||
|
||||
include/fonts/font0_lat_glyphs.h: graphics/fonts/font0_lat.1bpp
|
||||
$(BIN2C) $< sFont0LatinGlyphs >$@ -static -col 8 -pad 4
|
||||
|
||||
include/fonts/font1_lat_glyphs.h: graphics/fonts/font1_lat.1bpp
|
||||
$(BIN2C) $< sFont1LatinGlyphs >$@ -static -col 8 -pad 4
|
||||
|
||||
include/fonts/font0_jpn_glyphs.h: graphics/fonts/font0_jpn.1bpp
|
||||
$(BIN2C) $< sFont0JapaneseGlyphs >$@ -static -col 8 -pad 4
|
||||
|
||||
include/fonts/font1_jpn_glyphs.h: graphics/fonts/font1_jpn.1bpp
|
||||
$(BIN2C) $< sFont1JapaneseGlyphs >$@ -static -col 8 -pad 4
|
||||
|
||||
include/fonts/braille_glyphs.h: graphics/fonts/font6_braille.1bpp
|
||||
$(BIN2C) $< sBrailleGlyphs >$@ -static -col 8 -pad 4
|
||||
|
||||
include/fonts/down_arrow_tiles.h: graphics/fonts/down_arrow.4bpp
|
||||
$(BIN2C) $< sDownArrowTiles >$@ -static -size 4 -pad 10
|
||||
|
||||
include/fonts/unknown_palette_81E6692.h: graphics/fonts/unknown_81E6692.gbapal
|
||||
$(BIN2C) $< gUnknownPalette_81E6692 >$@ -size 2 -pad 6
|
||||
|
||||
include/fonts/default_palette.h: graphics/fonts/default.gbapal
|
||||
$(BIN2C) $< gFontDefaultPalette >$@ -size 2 -pad 6
|
19
graphics/fonts/default.pal
Normal file
@ -0,0 +1,19 @@
|
||||
JASC-PAL
|
||||
0100
|
||||
16
|
||||
0 0 0
|
||||
74 74 74
|
||||
255 0 0
|
||||
0 255 0
|
||||
0 0 255
|
||||
255 255 0
|
||||
0 255 255
|
||||
255 0 255
|
||||
213 213 205
|
||||
0 0 0
|
||||
0 0 0
|
||||
230 230 238
|
||||
255 255 255
|
||||
156 205 255
|
||||
123 189 230
|
||||
255 255 255
|
BIN
graphics/fonts/down_arrow.png
Normal file
After Width: | Height: | Size: 167 B |
BIN
graphics/fonts/font0_jpn.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
graphics/fonts/font0_lat.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
graphics/fonts/font1_jpn.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
graphics/fonts/font1_lat.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
graphics/fonts/font3_jpn.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
graphics/fonts/font3_lat.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
graphics/fonts/font4_jpn.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
graphics/fonts/font4_lat.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
graphics/fonts/font6_braille.png
Normal file
After Width: | Height: | Size: 208 B |
19
graphics/fonts/unknown_81E6692.pal
Normal file
@ -0,0 +1,19 @@
|
||||
JASC-PAL
|
||||
0100
|
||||
16
|
||||
0 0 0
|
||||
0 0 0
|
||||
255 255 255
|
||||
115 123 131
|
||||
255 0 0
|
||||
213 213 205
|
||||
65 205 255
|
||||
0 139 189
|
||||
255 156 148
|
||||
189 90 82
|
||||
255 189 180
|
||||
213 115 106
|
||||
98 238 255
|
||||
24 164 213
|
||||
238 238 172
|
||||
164 164 98
|
8
include/fonts/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
font0_lat_glyphs.h
|
||||
font1_lat_glyphs.h
|
||||
font0_jpn_glyphs.h
|
||||
font1_jpn_glyphs.h
|
||||
braille_glyphs.h
|
||||
down_arrow_tiles.h
|
||||
unknown_palette_81E6692.h
|
||||
default_palette.h
|
19
include/fonts/font0_widths.h
Normal file
@ -0,0 +1,19 @@
|
||||
static const u8 sFont0Widths[] =
|
||||
{
|
||||
3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 6, 6, 6, 6, 6,
|
||||
6, 6, 6, 6, 6, 6, 6, 6, 8, 6, 6, 6, 6, 6, 5, 8,
|
||||
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8,
|
||||
7, 7, 7, 8, 8, 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
7, 6, 3, 8, 8, 8, 7, 8, 8, 4, 6, 6, 4, 4, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 8, 7, 7, 8, 8, 6,
|
||||
7, 8, 8, 8, 8, 8, 7, 8, 7, 7, 7, 7, 7, 7, 8, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 8, 6, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 3, 6, 3, 5, 3,
|
||||
6, 6, 6, 3, 3, 6, 6, 6, 3, 6, 6, 6, 6, 6, 6, 6,
|
||||
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 5, 6,
|
||||
3, 6, 6, 6, 6, 6, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7,
|
||||
3, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 1, 1,
|
||||
};
|
17
include/fonts/font1_widths.h
Normal file
@ -0,0 +1,17 @@
|
||||
static const u8 sFont1Widths[] =
|
||||
{
|
||||
5, 3, 8, 8, 8, 8, 8, 8, 8, 4, 5, 4, 4, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 5, 8, 8, 8, 8, 8, 4, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 6, 6, 6, 5,
|
||||
6, 5, 5, 5, 5, 5, 5, 5, 5, 4, 8, 4, 4, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 8, 4, 5, 5, 5, 5, 4, 8,
|
||||
4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6,
|
||||
8, 7, 6, 5, 3, 3, 5, 4, 3, 6, 6, 6, 7, 7, 8, 5,
|
||||
5, 5, 3, 5, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 4, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 4, 5, 5, 5, 5, 4, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 4, 4, 5, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 6, 6, 7, 7, 7, 7, 6, 7, 6, 6, 7, 6,
|
||||
7, 7, 7, 6, 7, 6, 7, 6, 7, 6, 6, 7, 6, 6, 3, 3,
|
||||
5, 5, 5, 5, 3, 3, 5, 5, 5, 5, 5, 5,
|
||||
};
|
19
include/fonts/font3_widths.h
Normal file
@ -0,0 +1,19 @@
|
||||
static const u8 sFont3Widths[] =
|
||||
{
|
||||
3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 6, 6, 6, 6, 6,
|
||||
6, 6, 6, 6, 6, 6, 6, 6, 8, 6, 6, 6, 6, 6, 4, 8,
|
||||
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
7, 6, 4, 8, 8, 8, 7, 8, 8, 4, 6, 6, 4, 4, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 6, 7, 8, 7, 7, 8, 8, 4,
|
||||
7, 8, 8, 8, 8, 8, 7, 8, 7, 7, 7, 7, 7, 7, 8, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 3, 6, 3, 5, 3,
|
||||
6, 6, 6, 3, 3, 6, 6, 6, 3, 6, 6, 6, 6, 6, 6, 6,
|
||||
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 5, 6,
|
||||
3, 6, 6, 6, 6, 6, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7,
|
||||
3, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 1, 1,
|
||||
};
|
17
include/fonts/font4_widths.h
Normal file
@ -0,0 +1,17 @@
|
||||
static const u8 sFont4Widths[] =
|
||||
{
|
||||
5, 3, 8, 8, 8, 8, 8, 8, 8, 4, 5, 4, 4, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 5, 8, 8, 8, 8, 8, 4, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 6, 6, 6, 5,
|
||||
6, 5, 5, 5, 5, 5, 5, 5, 5, 4, 8, 4, 4, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 8, 4, 5, 5, 5, 5, 4, 8,
|
||||
4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6,
|
||||
8, 7, 6, 5, 3, 3, 5, 4, 3, 6, 6, 6, 7, 7, 8, 5,
|
||||
5, 5, 3, 5, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 4, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 4, 5, 5, 5, 5, 4, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 4, 4, 5, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 6, 6, 7, 7, 7, 7, 6, 7, 6, 6, 7, 6,
|
||||
7, 7, 7, 6, 7, 6, 7, 6, 7, 6, 6, 7, 6, 6, 3, 3,
|
||||
5, 5, 5, 5, 3, 3, 5, 5, 5, 5, 5, 5,
|
||||
};
|
250
include/fonts/type1_map.h
Normal file
@ -0,0 +1,250 @@
|
||||
static const u8 sFontType1Map[] =
|
||||
{
|
||||
0xD4, 0xD4,
|
||||
0xD4, 0x31,
|
||||
0xD4, 0x32,
|
||||
0xD4, 0x33,
|
||||
0xD4, 0x34,
|
||||
0xD4, 0x35,
|
||||
0xD4, 0x36,
|
||||
0xD4, 0x37,
|
||||
0xD4, 0x38,
|
||||
0xD4, 0x39,
|
||||
0xD4, 0x3A,
|
||||
0xD4, 0x3B,
|
||||
0xD4, 0x3C,
|
||||
0xD4, 0x3D,
|
||||
0xD4, 0x3E,
|
||||
0xD4, 0x3F,
|
||||
0xD4, 0x40,
|
||||
0xD4, 0x41,
|
||||
0xD4, 0x42,
|
||||
0xD4, 0x43,
|
||||
0xD4, 0x44,
|
||||
0xD4, 0x45,
|
||||
0xD4, 0x46,
|
||||
0xD4, 0x47,
|
||||
0xD4, 0x48,
|
||||
0xD4, 0x49,
|
||||
0xD4, 0x4A,
|
||||
0xD4, 0x4B,
|
||||
0xD4, 0x4C,
|
||||
0xD4, 0x4D,
|
||||
0xD4, 0x4E,
|
||||
0xD4, 0x4F,
|
||||
0xD4, 0x50,
|
||||
0xD4, 0x51,
|
||||
0xD4, 0x52,
|
||||
0xD4, 0x53,
|
||||
0xD4, 0x54,
|
||||
0xD4, 0x55,
|
||||
0xD4, 0x56,
|
||||
0xD4, 0x57,
|
||||
0xD4, 0x58,
|
||||
0xD4, 0x59,
|
||||
0xD4, 0x5A,
|
||||
0xD4, 0x5B,
|
||||
0xD4, 0x5C,
|
||||
0xD4, 0x5D,
|
||||
0xD4, 0x5E,
|
||||
0xD4, 0x31,
|
||||
0xD4, 0x32,
|
||||
0xD4, 0x33,
|
||||
0xD4, 0x34,
|
||||
0xD4, 0x35,
|
||||
0xD4, 0x60,
|
||||
0xD4, 0x61,
|
||||
0xD4, 0x62,
|
||||
0x65, 0x36,
|
||||
0x65, 0x37,
|
||||
0x65, 0x38,
|
||||
0x65, 0x39,
|
||||
0x65, 0x3A,
|
||||
0x65, 0x3B,
|
||||
0x65, 0x3C,
|
||||
0x65, 0x3D,
|
||||
0x65, 0x3E,
|
||||
0x65, 0x3F,
|
||||
0x65, 0x40,
|
||||
0x65, 0x41,
|
||||
0x65, 0x42,
|
||||
0x65, 0x43,
|
||||
0x65, 0x44,
|
||||
0x65, 0x4A,
|
||||
0x65, 0x4B,
|
||||
0x65, 0x4C,
|
||||
0x65, 0x4D,
|
||||
0x65, 0x4E,
|
||||
0x64, 0x4A,
|
||||
0x64, 0x4B,
|
||||
0x64, 0x4C,
|
||||
0x64, 0x4D,
|
||||
0x64, 0x4E,
|
||||
0xD4, 0x5F,
|
||||
0xD4, 0x00,
|
||||
0xD4, 0x01,
|
||||
0xD4, 0x02,
|
||||
0xD4, 0x03,
|
||||
0xD4, 0x04,
|
||||
0xD4, 0x05,
|
||||
0xD4, 0x06,
|
||||
0xD4, 0x07,
|
||||
0xD4, 0x08,
|
||||
0xD4, 0x09,
|
||||
0xD4, 0x0A,
|
||||
0xD4, 0x0B,
|
||||
0xD4, 0x0C,
|
||||
0xD4, 0x0D,
|
||||
0xD4, 0x0E,
|
||||
0xD4, 0x0F,
|
||||
0xD4, 0x10,
|
||||
0xD4, 0x11,
|
||||
0xD4, 0x12,
|
||||
0xD4, 0x13,
|
||||
0xD4, 0x14,
|
||||
0xD4, 0x15,
|
||||
0xD4, 0x16,
|
||||
0xD4, 0x17,
|
||||
0xD4, 0x18,
|
||||
0xD4, 0x19,
|
||||
0xD4, 0x1A,
|
||||
0xD4, 0x1B,
|
||||
0xD4, 0x4D,
|
||||
0xD4, 0x1C,
|
||||
0xD4, 0x1D,
|
||||
0xD4, 0x1E,
|
||||
0xD4, 0x1F,
|
||||
0xD4, 0x20,
|
||||
0xD4, 0x21,
|
||||
0xD4, 0x22,
|
||||
0xD4, 0x23,
|
||||
0xD4, 0x24,
|
||||
0xD4, 0x25,
|
||||
0xD4, 0x58,
|
||||
0xD4, 0x26,
|
||||
0xD4, 0x27,
|
||||
0xD4, 0x28,
|
||||
0xD4, 0x29,
|
||||
0xD4, 0x2A,
|
||||
0xD4, 0x2B,
|
||||
0xD4, 0x69,
|
||||
0xD4, 0x30,
|
||||
0xD4, 0x6A,
|
||||
0xD4, 0x6B,
|
||||
0xD4, 0x74,
|
||||
0xD4, 0x2D,
|
||||
0xD4, 0x2E,
|
||||
0xD4, 0x2F,
|
||||
0x65, 0x05,
|
||||
0x65, 0x06,
|
||||
0x65, 0x07,
|
||||
0x65, 0x08,
|
||||
0x65, 0x09,
|
||||
0x65, 0x0A,
|
||||
0x65, 0x0B,
|
||||
0x65, 0x0C,
|
||||
0x65, 0x0D,
|
||||
0x65, 0x0E,
|
||||
0x65, 0x0F,
|
||||
0x65, 0x10,
|
||||
0x65, 0x11,
|
||||
0x65, 0x12,
|
||||
0x65, 0x13,
|
||||
0x65, 0x19,
|
||||
0x65, 0x1A,
|
||||
0x65, 0x1B,
|
||||
0x65, 0x4D,
|
||||
0x65, 0x1C,
|
||||
0x64, 0x19,
|
||||
0x64, 0x1A,
|
||||
0x64, 0x1B,
|
||||
0x64, 0x4D,
|
||||
0x64, 0x1C,
|
||||
0xD4, 0x2C,
|
||||
0xD4, 0x76,
|
||||
0xD4, 0x77,
|
||||
0xD4, 0x78,
|
||||
0xD4, 0x79,
|
||||
0xD4, 0x7A,
|
||||
0xD4, 0x7B,
|
||||
0xD4, 0x7C,
|
||||
0xD4, 0x7D,
|
||||
0xD4, 0x7E,
|
||||
0xD4, 0x7F,
|
||||
0xD4, 0x67,
|
||||
0xD4, 0x66,
|
||||
0xD4, 0x68,
|
||||
0xD4, 0x63,
|
||||
0xD4, 0xD2,
|
||||
0xD4, 0xD3,
|
||||
0xD4, 0xD0,
|
||||
0xD4, 0xD1,
|
||||
0xD4, 0xCE,
|
||||
0xD4, 0xCF,
|
||||
0xD4, 0x6F,
|
||||
0xD4, 0x75,
|
||||
0xD4, 0x70,
|
||||
0xD4, 0x72,
|
||||
0xD4, 0x71,
|
||||
0xD4, 0x73,
|
||||
0xD4, 0x80,
|
||||
0xD4, 0x81,
|
||||
0xD4, 0x82,
|
||||
0xD4, 0x83,
|
||||
0xD4, 0x84,
|
||||
0xD4, 0x85,
|
||||
0xD4, 0x86,
|
||||
0xD4, 0x87,
|
||||
0xD4, 0x88,
|
||||
0xD4, 0x89,
|
||||
0xD4, 0x8A,
|
||||
0xD4, 0x8B,
|
||||
0xD4, 0x8C,
|
||||
0xD4, 0x8D,
|
||||
0xD4, 0x8E,
|
||||
0xD4, 0x8F,
|
||||
0xD4, 0x90,
|
||||
0xD4, 0x91,
|
||||
0xD4, 0x92,
|
||||
0xD4, 0x93,
|
||||
0xD4, 0x94,
|
||||
0xD4, 0x95,
|
||||
0xD4, 0x96,
|
||||
0xD4, 0x97,
|
||||
0xD4, 0x98,
|
||||
0xD4, 0x99,
|
||||
0xD4, 0x9A,
|
||||
0xD4, 0x9B,
|
||||
0xD4, 0x9C,
|
||||
0xD4, 0x9D,
|
||||
0xD4, 0x9E,
|
||||
0xD4, 0x9F,
|
||||
0xD4, 0xA0,
|
||||
0xD4, 0xA1,
|
||||
0xD4, 0xA2,
|
||||
0xD4, 0xA3,
|
||||
0xD4, 0xA4,
|
||||
0xD4, 0xA5,
|
||||
0xD4, 0xA6,
|
||||
0xD4, 0xA7,
|
||||
0xD4, 0xA8,
|
||||
0xD4, 0xA9,
|
||||
0xD4, 0xAA,
|
||||
0xD4, 0xAB,
|
||||
0xD4, 0xAC,
|
||||
0xD4, 0xAD,
|
||||
0xD4, 0xAE,
|
||||
0xD4, 0xAF,
|
||||
0xD4, 0xB0,
|
||||
0xD4, 0xB1,
|
||||
0xD4, 0xB2,
|
||||
0xD4, 0xB3,
|
||||
0xD4, 0x6D,
|
||||
0xD4, 0xD5,
|
||||
0xD4, 0xD6,
|
||||
0xD4, 0xD7,
|
||||
0xD4, 0xD8,
|
||||
0xD4, 0xD9,
|
||||
0xD4, 0xDA,
|
||||
0xD4, 0xDB,
|
||||
};
|
131
include/fonts/type3_map.h
Normal file
@ -0,0 +1,131 @@
|
||||
static const u8 sFontType3Map[] =
|
||||
{
|
||||
0x00, 0x10,
|
||||
0x01, 0x10,
|
||||
0x02, 0x10,
|
||||
0x03, 0x10,
|
||||
0x04, 0x11,
|
||||
0x05, 0x11,
|
||||
0x06, 0x11,
|
||||
0x07, 0x11,
|
||||
0x08, 0x12,
|
||||
0x09, 0x12,
|
||||
0x0A, 0x12,
|
||||
0x0B, 0x12,
|
||||
0x0C, 0x13,
|
||||
0x0D, 0x13,
|
||||
0x0E, 0x13,
|
||||
0x0F, 0x13,
|
||||
0x00, 0x14,
|
||||
0x01, 0x14,
|
||||
0x02, 0x14,
|
||||
0x03, 0x14,
|
||||
0x04, 0x15,
|
||||
0x05, 0x15,
|
||||
0x06, 0x15,
|
||||
0x07, 0x15,
|
||||
0x08, 0x16,
|
||||
0x09, 0x16,
|
||||
0x0A, 0x16,
|
||||
0x0B, 0x16,
|
||||
0x0C, 0x17,
|
||||
0x0D, 0x17,
|
||||
0x0E, 0x17,
|
||||
0x0F, 0x17,
|
||||
0x00, 0x18,
|
||||
0x01, 0x18,
|
||||
0x02, 0x18,
|
||||
0x03, 0x18,
|
||||
0x04, 0x19,
|
||||
0x05, 0x19,
|
||||
0x06, 0x19,
|
||||
0x07, 0x19,
|
||||
0x08, 0x1A,
|
||||
0x09, 0x1A,
|
||||
0x0A, 0x1A,
|
||||
0x0B, 0x1A,
|
||||
0x0C, 0x1B,
|
||||
0x0D, 0x1B,
|
||||
0x0E, 0x1B,
|
||||
0x0F, 0x1B,
|
||||
0x00, 0x1C,
|
||||
0x01, 0x1C,
|
||||
0x02, 0x1C,
|
||||
0x03, 0x1C,
|
||||
0x04, 0x1D,
|
||||
0x05, 0x1D,
|
||||
0x06, 0x1D,
|
||||
0x07, 0x1D,
|
||||
0x08, 0x1E,
|
||||
0x09, 0x1E,
|
||||
0x0A, 0x1E,
|
||||
0x0B, 0x1E,
|
||||
0x0C, 0x1F,
|
||||
0x0D, 0x1F,
|
||||
0x0E, 0x1F,
|
||||
0x0F, 0x1F,
|
||||
0x20, 0x24,
|
||||
0x20, 0x24,
|
||||
0x21, 0x24,
|
||||
0x21, 0x24,
|
||||
0x20, 0x24,
|
||||
0x20, 0x24,
|
||||
0x21, 0x24,
|
||||
0x21, 0x24,
|
||||
0x22, 0x25,
|
||||
0x22, 0x25,
|
||||
0x23, 0x25,
|
||||
0x23, 0x25,
|
||||
0x22, 0x25,
|
||||
0x22, 0x25,
|
||||
0x23, 0x25,
|
||||
0x23, 0x25,
|
||||
0x20, 0x24,
|
||||
0x20, 0x24,
|
||||
0x21, 0x24,
|
||||
0x21, 0x24,
|
||||
0x20, 0x24,
|
||||
0x20, 0x24,
|
||||
0x21, 0x24,
|
||||
0x21, 0x24,
|
||||
0x22, 0x25,
|
||||
0x22, 0x25,
|
||||
0x23, 0x25,
|
||||
0x23, 0x25,
|
||||
0x22, 0x25,
|
||||
0x22, 0x25,
|
||||
0x23, 0x25,
|
||||
0x23, 0x25,
|
||||
0x20, 0x26,
|
||||
0x20, 0x26,
|
||||
0x21, 0x26,
|
||||
0x21, 0x26,
|
||||
0x20, 0x26,
|
||||
0x20, 0x26,
|
||||
0x21, 0x26,
|
||||
0x21, 0x26,
|
||||
0x22, 0x27,
|
||||
0x22, 0x27,
|
||||
0x23, 0x27,
|
||||
0x23, 0x27,
|
||||
0x22, 0x27,
|
||||
0x22, 0x27,
|
||||
0x23, 0x27,
|
||||
0x23, 0x27,
|
||||
0x20, 0x26,
|
||||
0x20, 0x26,
|
||||
0x21, 0x26,
|
||||
0x21, 0x26,
|
||||
0x20, 0x26,
|
||||
0x20, 0x26,
|
||||
0x21, 0x26,
|
||||
0x21, 0x26,
|
||||
0x22, 0x27,
|
||||
0x22, 0x27,
|
||||
0x23, 0x27,
|
||||
0x23, 0x27,
|
||||
0x22, 0x27,
|
||||
0x22, 0x27,
|
||||
0x23, 0x27,
|
||||
0x23, 0x27,
|
||||
};
|
@ -34,6 +34,11 @@
|
||||
#define INTR_CHECK (*(u16 *)0x3007FF8)
|
||||
#define INTR_VECTOR (*(void **)0x3007FFC)
|
||||
|
||||
#define BG_VRAM 0x6000000
|
||||
|
||||
#define BG_CHAR_ADDR(n) (BG_VRAM + (0x4000 * (n)))
|
||||
#define BG_SCREEN_ADDR(n) (BG_VRAM + (0x800 * (n)))
|
||||
|
||||
#define OBJ_VRAM0 0x6010000 // when BG is in tiled mode
|
||||
#define OBJ_VRAM1 0x6014000 // when BG is in bitmap mode
|
||||
|
||||
|
@ -338,6 +338,18 @@
|
||||
#define REG_DISPCNT (*(vu32 *)REG_ADDR_DISPCNT)
|
||||
#define REG_DISPSTAT (*(vu16 *)REG_ADDR_DISPSTAT)
|
||||
#define REG_VCOUNT (*(vu16 *)REG_ADDR_VCOUNT)
|
||||
#define REG_BG0CNT (*(vu16 *)REG_ADDR_BG0CNT)
|
||||
#define REG_BG1CNT (*(vu16 *)REG_ADDR_BG1CNT)
|
||||
#define REG_BG2CNT (*(vu16 *)REG_ADDR_BG2CNT)
|
||||
#define REG_BG3CNT (*(vu16 *)REG_ADDR_BG3CNT)
|
||||
#define REG_BG0HOFS (*(vu16 *)REG_ADDR_BG0HOFS)
|
||||
#define REG_BG0VOFS (*(vu16 *)REG_ADDR_BG0VOFS)
|
||||
#define REG_BG1HOFS (*(vu16 *)REG_ADDR_BG1HOFS)
|
||||
#define REG_BG1VOFS (*(vu16 *)REG_ADDR_BG1VOFS)
|
||||
#define REG_BG2HOFS (*(vu16 *)REG_ADDR_BG2HOFS)
|
||||
#define REG_BG2VOFS (*(vu16 *)REG_ADDR_BG2VOFS)
|
||||
#define REG_BG3HOFS (*(vu16 *)REG_ADDR_BG3HOFS)
|
||||
#define REG_BG3VOFS (*(vu16 *)REG_ADDR_BG3VOFS)
|
||||
|
||||
#define REG_SOUND1CNT_L (*(vu16 *)REG_ADDR_SOUND1CNT_L)
|
||||
#define REG_NR10 (*(vu8 *)REG_ADDR_NR10)
|
||||
|
@ -7,6 +7,9 @@
|
||||
#define REVISION 0
|
||||
#endif
|
||||
|
||||
// Prevent cross-jump optimization.
|
||||
#define BLOCK_CROSS_JUMP asm("");
|
||||
|
||||
extern u8 gStringVar1[];
|
||||
extern u8 gStringVar2[];
|
||||
extern u8 gStringVar3[];
|
||||
@ -42,7 +45,9 @@ struct SaveBlock2
|
||||
u8 playTimeSeconds;
|
||||
u8 playTimeVBlanks;
|
||||
u8 optionsButtonMode;
|
||||
u8 filler[0x84];
|
||||
u8 optionsTextSpeed:3;
|
||||
u8 optionsUnk:5;
|
||||
u8 filler[0x83];
|
||||
struct Time localTimeOffset;
|
||||
};
|
||||
|
||||
|
@ -42,4 +42,6 @@ struct Main
|
||||
u8 oamLoadDisabled:1;
|
||||
};
|
||||
|
||||
extern struct Main gMain;
|
||||
|
||||
#endif // GUARD_MAIN_H
|
||||
|
@ -16,7 +16,7 @@ struct SpriteFrameImage
|
||||
|
||||
struct SpritePalette
|
||||
{
|
||||
u8 *data;
|
||||
u16 *data;
|
||||
u16 tag;
|
||||
};
|
||||
|
||||
|
@ -3,14 +3,6 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define CHAR_SPACE 0x00
|
||||
#define CHAR_QUESTION_MARK 0xAC
|
||||
#define CHAR_HYPHEN 0xAE
|
||||
#define CHAR_COLON 0xF0
|
||||
#define EXT_CTRL_CODE_BEGIN 0xFC // extended control code
|
||||
#define PLACEHOLDER_BEGIN 0xFD // string placeholder
|
||||
#define EOS 0xFF // end of string
|
||||
|
||||
enum StringConvertMode
|
||||
{
|
||||
STR_CONV_MODE_LEFT_ALIGN,
|
||||
@ -25,15 +17,16 @@ u8 *StringCopy(u8 *dest, u8 *src);
|
||||
u8 *StringAppend(u8 *dest, u8 *src);
|
||||
u8 *StringCopyN(u8 *dest, u8 *src, u8 n);
|
||||
u8 *StringAppendN(u8 *dest, u8 *src, u8 n);
|
||||
u16 StringGetLength(u8 *str);
|
||||
u16 StringLength(u8 *str);
|
||||
s32 StringCompare(u8 *str1, u8 *str2);
|
||||
s32 StringCompareN(u8 *str1, u8 *str2, u32 n);
|
||||
u8 *ConvertIntToDecimalStringN(u8 *dest, s32 value, enum StringConvertMode mode, u8 n);
|
||||
u8 *ConvertIntToDecimalStringN_UnknownExtCtrlCode(u8 *dest, s32 value, enum StringConvertMode mode, u8 n);
|
||||
u8 *ConvertIntToDecimalStringN_DigitWidth6(u8 *dest, s32 value, enum StringConvertMode mode, u8 n);
|
||||
u8 *ConvertIntToHexStringN(u8 *dest, s32 value, enum StringConvertMode mode, u8 n);
|
||||
u8 *ConvertIntToDecimalString(u8 *dest, s32 value);
|
||||
u8 *StringExpandPlaceholders(u8 *dest, u8 *src);
|
||||
u8 *UnknownStringFunc(u8 *dest, u8 *src);
|
||||
u8 *StringBraille(u8 *dest, u8 *src);
|
||||
u8 *GetExpandedPlaceholder(u32 id);
|
||||
u8 *StringFill(u8 *dest, u8 c, u16 n);
|
||||
u8 *StringCopyPadded(u8 *dest, u8 *src, u8 c, u16 n);
|
||||
u8 *StringFillWithTerminator(u8 *dest, u16 n);
|
||||
|
16
include/text.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef GUARD_TEXT_H
|
||||
#define GUARD_TEXT_H
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define CHAR_SPACE 0x00
|
||||
#define CHAR_QUESTION_MARK 0xAC
|
||||
#define CHAR_HYPHEN 0xAE
|
||||
#define CHAR_COLON 0xF0
|
||||
#define EXT_CTRL_CODE_BEGIN 0xFC // extended control code
|
||||
#define PLACEHOLDER_BEGIN 0xFD // string placeholder
|
||||
#define EOS 0xFF // end of string
|
||||
|
||||
u8 GetExtCtrlCodeLength(u8 code);
|
||||
|
||||
#endif // GUARD_TEXT_H
|
@ -11,6 +11,7 @@ SECTIONS {
|
||||
{
|
||||
src/main.o(ewram_data);
|
||||
src/sprite.o(ewram_data);
|
||||
src/text.o(ewram_data);
|
||||
}
|
||||
|
||||
. = 0x3000000;
|
||||
@ -19,6 +20,7 @@ SECTIONS {
|
||||
ALIGN(4)
|
||||
{
|
||||
src/sprite.o(.bss);
|
||||
src/text.o(.bss);
|
||||
. = 0xF28;
|
||||
src/agb_flash.o(.bss);
|
||||
. = 0xF36;
|
||||
@ -28,6 +30,7 @@ SECTIONS {
|
||||
src/m4a_2.o(.bss.code);
|
||||
src/main.o(iwram_data);
|
||||
src/sprite.o(iwram_data);
|
||||
src/text.o(iwram_data);
|
||||
. = 0x5FD0;
|
||||
src/m4a_2.o(iwram_data);
|
||||
}
|
||||
@ -40,7 +43,7 @@ SECTIONS {
|
||||
asm/crt0.o(.text);
|
||||
src/main.o(.text);
|
||||
src/sprite.o(.text);
|
||||
asm/rom1.o(.text);
|
||||
src/text.o(.text);
|
||||
src/string_util.o(.text);
|
||||
asm/rom2.o(.text);
|
||||
src/rtc.o(.text);
|
||||
@ -93,6 +96,8 @@ SECTIONS {
|
||||
src/main.o(.rodata);
|
||||
src/sprite.o(.rodata);
|
||||
. += 0x8; /* Why the gap? */
|
||||
src/text.o(.rodata);
|
||||
src/string_util.o(.rodata);
|
||||
data/data2.o(.rodata);
|
||||
src/m4a_tables.o(.rodata);
|
||||
data/sound_data.o(.rodata);
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "siirtc.h"
|
||||
#include "rtc.h"
|
||||
#include "string_util.h"
|
||||
#include "text.h"
|
||||
|
||||
extern const struct SiiRtcInfo gRtcDummy;
|
||||
extern const s32 gNumDaysInMonths[];
|
||||
|
10
src/sprite.c
@ -39,7 +39,7 @@ struct OamDimensions
|
||||
s8 height;
|
||||
};
|
||||
|
||||
void gpu_pal_apply(u8 *, u16, u32);
|
||||
void gpu_pal_apply(u16 *, u16, u32);
|
||||
void sub_814A590(void);
|
||||
|
||||
static void UpdateOamCoords(void);
|
||||
@ -92,7 +92,7 @@ static void ApplyAffineAnimFrame(u8 matrixNum, struct AffineAnimFrameCmd *frameC
|
||||
static void ResetAffineAnimData(void);
|
||||
static u8 IndexOfSpriteTileTag(u16 tag);
|
||||
static void AllocSpriteTileRange(u16 tag, u16 start, u16 count);
|
||||
static void ApplySpritePalette(u8 *src, u16 paletteOffset);
|
||||
static void DoLoadSpritePalette(u16 *src, u16 paletteOffset);
|
||||
|
||||
typedef void (*AnimFunc)(struct Sprite *);
|
||||
typedef void (*AnimCmdFunc)(struct Sprite *);
|
||||
@ -292,8 +292,6 @@ static const struct OamDimensions sOamDimensions[3][4] =
|
||||
},
|
||||
};
|
||||
|
||||
extern struct Main gMain;
|
||||
|
||||
static u16 sSpriteTileRangeTags[MAX_SPRITES];
|
||||
static u16 sSpriteTileRanges[MAX_SPRITES * 2];
|
||||
static struct AffineAnimState sAffineAnimStates[OAM_MATRIX_COUNT];
|
||||
@ -1638,7 +1636,7 @@ u8 LoadSpritePalette(struct SpritePalette *palette)
|
||||
else
|
||||
{
|
||||
sSpritePaletteTags[index] = palette->tag;
|
||||
ApplySpritePalette(palette->data, index * 16);
|
||||
DoLoadSpritePalette(palette->data, index * 16);
|
||||
return index;
|
||||
}
|
||||
}
|
||||
@ -1651,7 +1649,7 @@ void LoadSpritePalettes(struct SpritePalette *palettes)
|
||||
break;
|
||||
}
|
||||
|
||||
static void ApplySpritePalette(u8 *src, u16 paletteOffset)
|
||||
static void DoLoadSpritePalette(u16 *src, u16 paletteOffset)
|
||||
{
|
||||
gpu_pal_apply(src, paletteOffset + 0x100, 32);
|
||||
}
|
||||
|
@ -1,15 +1,64 @@
|
||||
#include "global.h"
|
||||
#include "string_util.h"
|
||||
#include "text.h"
|
||||
|
||||
#define MAX_PLACEHOLDER_ID 0xD
|
||||
|
||||
typedef u8 *(*ExpandPlaceholderFunc)();
|
||||
static u8 *ExpandPlaceholder_UnknownStringVar(void);
|
||||
static u8 *ExpandPlaceholder_PlayerName(void);
|
||||
static u8 *ExpandPlaceholder_StringVar1(void);
|
||||
static u8 *ExpandPlaceholder_StringVar2(void);
|
||||
static u8 *ExpandPlaceholder_StringVar3(void);
|
||||
static u8 *ExpandPlaceholder_UnknownString(void);
|
||||
static u8 *ExpandPlaceholder_RivalName(void);
|
||||
static u8 *ExpandPlaceholder_Version(void);
|
||||
static u8 *ExpandPlaceholder_EvilTeam(void);
|
||||
static u8 *ExpandPlaceholder_GoodTeam(void);
|
||||
static u8 *ExpandPlaceholder_EvilLeader(void);
|
||||
static u8 *ExpandPlaceholder_GoodLeader(void);
|
||||
static u8 *ExpandPlaceholder_EvilLegendary(void);
|
||||
static u8 *ExpandPlaceholder_GoodLegendary(void);
|
||||
|
||||
extern u8 gDigits[];
|
||||
extern s32 gPowersOfTen[];
|
||||
extern u8 gUnknown_081E72EC[];
|
||||
extern u8 gUnknown_081E72F0[];
|
||||
extern ExpandPlaceholderFunc gExpandPlaceholderFuncTable[];
|
||||
const u8 gEmptyString_81E72B0[] = _"";
|
||||
const u8 gRightPointingTriangleString[] = _"▶";
|
||||
const u8 sDigits[] = @"0123456789ABCDEF";
|
||||
|
||||
const s32 sPowersOfTen[] =
|
||||
{
|
||||
1,
|
||||
10,
|
||||
100,
|
||||
1000,
|
||||
10000,
|
||||
100000,
|
||||
1000000,
|
||||
10000000,
|
||||
100000000,
|
||||
1000000000,
|
||||
};
|
||||
|
||||
const u8 sSetBrailleFont[] = { 0xFC, 0x06, 0x06, 0xFF };
|
||||
const u8 sGotoLine2[] = { 0xFE, 0xFC, 0x0E, 0x02, 0xFF };
|
||||
|
||||
typedef u8 *(*ExpandPlaceholderFunc)(void);
|
||||
|
||||
const ExpandPlaceholderFunc sExpandPlaceholderFuncs[] =
|
||||
{
|
||||
ExpandPlaceholder_UnknownStringVar,
|
||||
ExpandPlaceholder_PlayerName,
|
||||
ExpandPlaceholder_StringVar1,
|
||||
ExpandPlaceholder_StringVar2,
|
||||
ExpandPlaceholder_StringVar3,
|
||||
ExpandPlaceholder_UnknownString,
|
||||
ExpandPlaceholder_RivalName,
|
||||
ExpandPlaceholder_Version,
|
||||
ExpandPlaceholder_EvilTeam,
|
||||
ExpandPlaceholder_GoodTeam,
|
||||
ExpandPlaceholder_EvilLeader,
|
||||
ExpandPlaceholder_GoodLeader,
|
||||
ExpandPlaceholder_EvilLegendary,
|
||||
ExpandPlaceholder_GoodLegendary,
|
||||
};
|
||||
|
||||
extern u8 gExpandedPlaceholder_Empty[];
|
||||
extern u8 gExpandedPlaceholder_MaleEmpty[];
|
||||
@ -27,10 +76,6 @@ extern u8 gExpandedPlaceholder_May[];
|
||||
|
||||
extern u8 gUnknownStringVar[];
|
||||
|
||||
extern u8 GetExtCtrlCodeLength(u8 code);
|
||||
|
||||
u8 *GetExpandedPlaceholder(u32 id);
|
||||
|
||||
u8 *StringCopy10(u8 *dest, u8 *src)
|
||||
{
|
||||
u8 i;
|
||||
@ -116,7 +161,7 @@ u8 *StringAppendN(u8 *dest, u8 *src, u8 n)
|
||||
return StringCopyN(dest, src, n);
|
||||
}
|
||||
|
||||
u16 StringGetLength(u8 *str)
|
||||
u16 StringLength(u8 *str)
|
||||
{
|
||||
u16 length = 0;
|
||||
|
||||
@ -163,7 +208,7 @@ u8 *ConvertIntToDecimalStringN(u8 *dest, s32 value, enum StringConvertMode mode,
|
||||
{
|
||||
enum { WAITING_FOR_NONZERO_DIGIT, WRITING_DIGITS, WRITING_SPACES } state;
|
||||
s32 powerOfTen;
|
||||
s32 largestPowerOfTen = gPowersOfTen[n - 1];
|
||||
s32 largestPowerOfTen = sPowersOfTen[n - 1];
|
||||
|
||||
state = WAITING_FOR_NONZERO_DIGIT;
|
||||
|
||||
@ -185,7 +230,7 @@ u8 *ConvertIntToDecimalStringN(u8 *dest, s32 value, enum StringConvertMode mode,
|
||||
out = dest++;
|
||||
|
||||
if (digit <= 9)
|
||||
c = gDigits[digit];
|
||||
c = sDigits[digit];
|
||||
else
|
||||
c = CHAR_QUESTION_MARK;
|
||||
|
||||
@ -197,7 +242,7 @@ u8 *ConvertIntToDecimalStringN(u8 *dest, s32 value, enum StringConvertMode mode,
|
||||
out = dest++;
|
||||
|
||||
if (digit <= 9)
|
||||
c = gDigits[digit];
|
||||
c = sDigits[digit];
|
||||
else
|
||||
c = CHAR_QUESTION_MARK;
|
||||
|
||||
@ -215,15 +260,15 @@ u8 *ConvertIntToDecimalStringN(u8 *dest, s32 value, enum StringConvertMode mode,
|
||||
return dest;
|
||||
}
|
||||
|
||||
u8 *ConvertIntToDecimalStringN_UnknownExtCtrlCode(u8 *dest, s32 value, enum StringConvertMode mode, u8 n)
|
||||
u8 *ConvertIntToDecimalStringN_DigitWidth6(u8 *dest, s32 value, enum StringConvertMode mode, u8 n)
|
||||
{
|
||||
enum { WAITING_FOR_NONZERO_DIGIT, WRITING_DIGITS, WRITING_SPACES } state;
|
||||
s32 powerOfTen;
|
||||
s32 largestPowerOfTen = gPowersOfTen[n - 1];
|
||||
s32 largestPowerOfTen = sPowersOfTen[n - 1];
|
||||
|
||||
*dest++ = EXT_CTRL_CODE_BEGIN;
|
||||
*dest++ = 0x14;
|
||||
*dest++ = 0x06;
|
||||
*dest++ = 6;
|
||||
|
||||
state = WAITING_FOR_NONZERO_DIGIT;
|
||||
|
||||
@ -245,7 +290,7 @@ u8 *ConvertIntToDecimalStringN_UnknownExtCtrlCode(u8 *dest, s32 value, enum Stri
|
||||
out = dest++;
|
||||
|
||||
if (digit <= 9)
|
||||
c = gDigits[digit];
|
||||
c = sDigits[digit];
|
||||
else
|
||||
c = CHAR_QUESTION_MARK;
|
||||
|
||||
@ -257,7 +302,7 @@ u8 *ConvertIntToDecimalStringN_UnknownExtCtrlCode(u8 *dest, s32 value, enum Stri
|
||||
out = dest++;
|
||||
|
||||
if (digit <= 9)
|
||||
c = gDigits[digit];
|
||||
c = sDigits[digit];
|
||||
else
|
||||
c = CHAR_QUESTION_MARK;
|
||||
|
||||
@ -309,7 +354,7 @@ u8 *ConvertIntToHexStringN(u8 *dest, s32 value, enum StringConvertMode mode, u8
|
||||
out = dest++;
|
||||
|
||||
if (digit <= 0xF)
|
||||
c = gDigits[digit];
|
||||
c = sDigits[digit];
|
||||
else
|
||||
c = CHAR_QUESTION_MARK;
|
||||
|
||||
@ -321,7 +366,7 @@ u8 *ConvertIntToHexStringN(u8 *dest, s32 value, enum StringConvertMode mode, u8
|
||||
out = dest++;
|
||||
|
||||
if (digit <= 0xF)
|
||||
c = gDigits[digit];
|
||||
c = sDigits[digit];
|
||||
else
|
||||
c = CHAR_QUESTION_MARK;
|
||||
|
||||
@ -346,7 +391,7 @@ u8 *ConvertIntToDecimalString(u8 *dest, s32 value)
|
||||
|
||||
do
|
||||
{
|
||||
temp[length++] = gDigits[value % 10];
|
||||
temp[length++] = sDigits[value % 10];
|
||||
value /= 10;
|
||||
} while (value != 0);
|
||||
|
||||
@ -397,15 +442,15 @@ u8 *StringExpandPlaceholders(u8 *dest, u8 *src)
|
||||
}
|
||||
}
|
||||
|
||||
u8 *UnknownStringFunc(u8 *dest, u8 *src)
|
||||
u8 *StringBraille(u8 *dest, u8 *src)
|
||||
{
|
||||
u8 array1[4];
|
||||
u8 array2[5];
|
||||
u8 setBrailleFont[4];
|
||||
u8 gotoLine2[5];
|
||||
|
||||
memcpy(array1, gUnknown_081E72EC, 4);
|
||||
memcpy(array2, gUnknown_081E72F0, 5);
|
||||
memcpy(setBrailleFont, sSetBrailleFont, 4);
|
||||
memcpy(gotoLine2, sGotoLine2, 5);
|
||||
|
||||
dest = StringCopy(dest, array1);
|
||||
dest = StringCopy(dest, setBrailleFont);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
@ -417,7 +462,7 @@ u8 *UnknownStringFunc(u8 *dest, u8 *src)
|
||||
*dest = c;
|
||||
return dest;
|
||||
case 0xFE:
|
||||
dest = StringCopy(dest, array2);
|
||||
dest = StringCopy(dest, gotoLine2);
|
||||
break;
|
||||
default:
|
||||
*dest++ = c;
|
||||
@ -427,32 +472,32 @@ u8 *UnknownStringFunc(u8 *dest, u8 *src)
|
||||
}
|
||||
}
|
||||
|
||||
u8 *ExpandPlaceholder_UnknownStringVar()
|
||||
u8 *ExpandPlaceholder_UnknownStringVar(void)
|
||||
{
|
||||
return gUnknownStringVar;
|
||||
}
|
||||
|
||||
u8 *ExpandPlaceholder_PlayerName()
|
||||
u8 *ExpandPlaceholder_PlayerName(void)
|
||||
{
|
||||
return gSaveBlock2.playerName;
|
||||
}
|
||||
|
||||
u8 *ExpandPlaceholder_StringVar1()
|
||||
u8 *ExpandPlaceholder_StringVar1(void)
|
||||
{
|
||||
return gStringVar1;
|
||||
}
|
||||
|
||||
u8 *ExpandPlaceholder_StringVar2()
|
||||
u8 *ExpandPlaceholder_StringVar2(void)
|
||||
{
|
||||
return gStringVar2;
|
||||
}
|
||||
|
||||
u8 *ExpandPlaceholder_StringVar3()
|
||||
u8 *ExpandPlaceholder_StringVar3(void)
|
||||
{
|
||||
return gStringVar3;
|
||||
}
|
||||
|
||||
u8 *ExpandPlaceholder_UnknownString()
|
||||
u8 *ExpandPlaceholder_UnknownString(void)
|
||||
{
|
||||
if (gSaveBlock2.playerGender == MALE)
|
||||
return gExpandedPlaceholder_MaleEmpty;
|
||||
@ -460,7 +505,7 @@ u8 *ExpandPlaceholder_UnknownString()
|
||||
return gExpandedPlaceholder_FemaleEmpty;
|
||||
}
|
||||
|
||||
u8 *ExpandPlaceholder_RivalName()
|
||||
u8 *ExpandPlaceholder_RivalName(void)
|
||||
{
|
||||
if (gSaveBlock2.playerGender == MALE)
|
||||
return gExpandedPlaceholder_May;
|
||||
@ -479,11 +524,11 @@ u8 *ExpandPlaceholder_RivalName()
|
||||
|
||||
#ifdef SAPPHIRE
|
||||
#define X(ph, r, s) \
|
||||
u8 *ExpandPlaceholder_##ph() { return gExpandedPlaceholder_##s; }
|
||||
static u8 *ExpandPlaceholder_##ph(void) { return gExpandedPlaceholder_##s; }
|
||||
VERSION_DEPENDENT_PLACEHOLDER_LIST
|
||||
#else
|
||||
#define X(ph, r, s) \
|
||||
u8 *ExpandPlaceholder_##ph() { return gExpandedPlaceholder_##r; }
|
||||
static u8 *ExpandPlaceholder_##ph(void) { return gExpandedPlaceholder_##r; }
|
||||
VERSION_DEPENDENT_PLACEHOLDER_LIST
|
||||
#endif
|
||||
|
||||
@ -494,7 +539,7 @@ u8 *GetExpandedPlaceholder(u32 id)
|
||||
if (id > MAX_PLACEHOLDER_ID)
|
||||
return gExpandedPlaceholder_Empty;
|
||||
else
|
||||
return gExpandPlaceholderFuncTable[id]();
|
||||
return sExpandPlaceholderFuncs[id]();
|
||||
}
|
||||
|
||||
u8 *StringFill(u8 *dest, u8 c, u16 n)
|
||||
|
4385
src/text.c
Normal file
1
tools/bin2c/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
bin2c
|
19
tools/bin2c/LICENSE
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2016 YamaArashi
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
13
tools/bin2c/Makefile
Normal file
@ -0,0 +1,13 @@
|
||||
CC = gcc
|
||||
|
||||
CFLAGS = -Wall -Wextra -std=c11 -O2
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
SRCS = bin2c.c
|
||||
|
||||
bin2c: $(SRCS)
|
||||
$(CC) $(CFLAGS) $(SRCS) -o $@
|
||||
|
||||
clean:
|
||||
$(RM) bin2c bin2c.exe
|
201
tools/bin2c/bin2c.c
Normal file
@ -0,0 +1,201 @@
|
||||
// Copyright(c) 2015-2016 YamaArashi
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#define FATAL_ERROR(format, ...) \
|
||||
do \
|
||||
{ \
|
||||
fprintf(stderr, format, __VA_ARGS__); \
|
||||
exit(1); \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
|
||||
#define FATAL_ERROR(format, ...) \
|
||||
do \
|
||||
{ \
|
||||
fprintf(stderr, format, ##__VA_ARGS__); \
|
||||
exit(1); \
|
||||
} while (0)
|
||||
|
||||
#endif // _MSC_VER
|
||||
|
||||
unsigned char *ReadWholeFile(char *path, int *size)
|
||||
{
|
||||
FILE *fp = fopen(path, "rb");
|
||||
|
||||
if (fp == NULL)
|
||||
FATAL_ERROR("Failed to open \"%s\" for reading.\n", path);
|
||||
|
||||
fseek(fp, 0, SEEK_END);
|
||||
|
||||
*size = ftell(fp);
|
||||
|
||||
unsigned char *buffer = malloc(*size);
|
||||
|
||||
if (buffer == NULL)
|
||||
FATAL_ERROR("Failed to allocate memory for reading \"%s\".\n", path);
|
||||
|
||||
rewind(fp);
|
||||
|
||||
if (fread(buffer, *size, 1, fp) != 1)
|
||||
FATAL_ERROR("Failed to read \"%s\".\n", path);
|
||||
|
||||
fclose(fp);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
int ExtractData(unsigned char *buffer, int offset, int size)
|
||||
{
|
||||
switch (size)
|
||||
{
|
||||
case 1:
|
||||
return buffer[offset];
|
||||
case 2:
|
||||
return (buffer[offset + 1] << 8)
|
||||
| buffer[offset];
|
||||
case 4:
|
||||
return (buffer[offset + 3] << 24)
|
||||
| (buffer[offset + 2] << 16)
|
||||
| (buffer[offset + 1] << 8)
|
||||
| buffer[offset];
|
||||
default:
|
||||
FATAL_ERROR("Invalid size passed to ExtractData.\n");
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if (argc < 3)
|
||||
FATAL_ERROR("Usage: bin2c INPUT_FILE VAR_NAME [OPTIONS...]\n");
|
||||
|
||||
int fileSize;
|
||||
unsigned char *buffer = ReadWholeFile(argv[1], &fileSize);
|
||||
char *var_name = argv[2];
|
||||
int col = 1;
|
||||
int pad = 0;
|
||||
int size = 1;
|
||||
bool isSigned = false;
|
||||
bool isStatic = false;
|
||||
bool isDecimal = false;
|
||||
|
||||
for (int i = 3; i < argc; i++)
|
||||
{
|
||||
if (!strcmp(argv[i], "-col"))
|
||||
{
|
||||
i++;
|
||||
|
||||
if (i >= argc)
|
||||
FATAL_ERROR("Missing argument after '-col'.\n");
|
||||
|
||||
col = atoi(argv[i]);
|
||||
}
|
||||
else if (!strcmp(argv[i], "-pad"))
|
||||
{
|
||||
i++;
|
||||
|
||||
if (i >= argc)
|
||||
FATAL_ERROR("Missing argument after '-pad'.\n");
|
||||
|
||||
pad = atoi(argv[i]);
|
||||
}
|
||||
else if (!strcmp(argv[i], "-size"))
|
||||
{
|
||||
i++;
|
||||
|
||||
if (i >= argc)
|
||||
FATAL_ERROR("Missing argument after '-size'.\n");
|
||||
|
||||
size = atoi(argv[i]);
|
||||
|
||||
if (size != 1 && size != 2 && size != 4)
|
||||
FATAL_ERROR("Size must be 1, 2, or 4.\n");
|
||||
}
|
||||
else if (!strcmp(argv[i], "-signed"))
|
||||
{
|
||||
isSigned = true;
|
||||
isDecimal = true;
|
||||
}
|
||||
else if (!strcmp(argv[i], "-static"))
|
||||
{
|
||||
isStatic = true;
|
||||
}
|
||||
else if (!strcmp(argv[i], "-decimal"))
|
||||
{
|
||||
isDecimal = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
FATAL_ERROR("Unrecognized option '%s'.\n", argv[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if ((fileSize & (size - 1)) != 0)
|
||||
FATAL_ERROR("Size %d doesn't evenly divide file size %d.\n", size, fileSize);
|
||||
|
||||
printf("// Generated file. Do not edit.\n\n");
|
||||
|
||||
if (isStatic)
|
||||
printf("static ");
|
||||
|
||||
printf("const ");
|
||||
|
||||
if (isSigned)
|
||||
printf("s%d ", 8 * size);
|
||||
else
|
||||
printf("u%d ", 8 * size);
|
||||
|
||||
printf("%s[] =\n{", var_name);
|
||||
|
||||
int count = fileSize / size;
|
||||
int offset = 0;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (i % col == 0)
|
||||
printf("\n ");
|
||||
|
||||
int data = ExtractData(buffer, offset, size);
|
||||
offset += size;
|
||||
|
||||
if (isDecimal)
|
||||
{
|
||||
if (isSigned)
|
||||
printf("%*d, ", pad, data);
|
||||
else
|
||||
printf("%*uu, ", pad, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("%#*xu, ", pad, data);
|
||||
}
|
||||
}
|
||||
|
||||
printf("\n};\n");
|
||||
|
||||
return 0;
|
||||
}
|
@ -73,6 +73,7 @@ CFile::~CFile()
|
||||
void CFile::Preproc()
|
||||
{
|
||||
bool inConcatMode = false;
|
||||
bool noTerminator = false;
|
||||
char stringChar = 0;
|
||||
|
||||
while (m_pos < m_size)
|
||||
@ -100,10 +101,13 @@ void CFile::Preproc()
|
||||
else
|
||||
{
|
||||
if (inConcatMode ? m_buffer[m_pos] == '"'
|
||||
: m_buffer[m_pos] == '_' && m_buffer[m_pos + 1] == '"')
|
||||
: (m_buffer[m_pos] == '_' || m_buffer[m_pos] == '@') && m_buffer[m_pos + 1] == '"')
|
||||
{
|
||||
if (!inConcatMode)
|
||||
m_pos++; // skip past underscore
|
||||
{
|
||||
noTerminator = (m_buffer[m_pos] == '@');
|
||||
m_pos++; // skip past underscore or at-sign
|
||||
}
|
||||
|
||||
unsigned char s[kMaxStringLength];
|
||||
int length;
|
||||
@ -144,7 +148,11 @@ void CFile::Preproc()
|
||||
|
||||
if ((c != ' ' && c != '\t' && c != '\n') && inConcatMode)
|
||||
{
|
||||
std::printf("0xFF }");
|
||||
if (noTerminator)
|
||||
std::printf(" }");
|
||||
else
|
||||
std::printf("0xFF }");
|
||||
|
||||
inConcatMode = false;
|
||||
}
|
||||
|
||||
|
1
tools/rsfont/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
rsfont
|
19
tools/rsfont/LICENSE
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2015-2016 YamaArashi
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
15
tools/rsfont/Makefile
Normal file
@ -0,0 +1,15 @@
|
||||
CC = gcc
|
||||
|
||||
CFLAGS = -Wall -Wextra -std=c11 -O2
|
||||
|
||||
LIBS = -lz -lpng
|
||||
|
||||
SRCS = main.c convert_png.c util.c font.c
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
rsfont: $(SRCS) convert_png.h gfx.h global.h util.h font.h
|
||||
$(CC) $(CFLAGS) $(SRCS) -o $@ $(LIBS)
|
||||
|
||||
clean:
|
||||
$(RM) rsfont rsfont.exe
|
169
tools/rsfont/convert_png.c
Normal file
@ -0,0 +1,169 @@
|
||||
// Copyright (c) 2015 YamaArashi
|
||||
|
||||
#include <stdio.h>
|
||||
#include <setjmp.h>
|
||||
#include <png.h>
|
||||
#include "global.h"
|
||||
#include "convert_png.h"
|
||||
#include "gfx.h"
|
||||
|
||||
void ReadPng(char *path, struct Image *image)
|
||||
{
|
||||
FILE *fp = fopen(path, "rb");
|
||||
|
||||
if (fp == NULL)
|
||||
FATAL_ERROR("Failed to open \"%s\" for reading.\n", path);
|
||||
|
||||
unsigned char sig[8];
|
||||
|
||||
if (fread(sig, 8, 1, fp) != 1)
|
||||
FATAL_ERROR("Failed to read PNG signature from \"%s\".\n", path);
|
||||
|
||||
if (png_sig_cmp(sig, 0, 8))
|
||||
FATAL_ERROR("\"%s\" does not have a valid PNG signature.\n", path);
|
||||
|
||||
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
|
||||
if (!png_ptr)
|
||||
FATAL_ERROR("Failed to create PNG read struct.\n");
|
||||
|
||||
png_infop info_ptr = png_create_info_struct(png_ptr);
|
||||
|
||||
if (!info_ptr)
|
||||
FATAL_ERROR("Failed to create PNG info struct.\n");
|
||||
|
||||
if (setjmp(png_jmpbuf(png_ptr)))
|
||||
FATAL_ERROR("Failed to init I/O for reading \"%s\".\n", path);
|
||||
|
||||
png_init_io(png_ptr, fp);
|
||||
png_set_sig_bytes(png_ptr, 8);
|
||||
png_read_info(png_ptr, info_ptr);
|
||||
|
||||
int bit_depth = png_get_bit_depth(png_ptr, info_ptr);
|
||||
|
||||
if (bit_depth != image->bitDepth)
|
||||
FATAL_ERROR("\"%s\" has a bit depth of %d, but the expected bit depth is %d.\n", path, bit_depth, image->bitDepth);
|
||||
|
||||
int color_type = png_get_color_type(png_ptr, info_ptr);
|
||||
|
||||
if (color_type != PNG_COLOR_TYPE_GRAY && color_type != PNG_COLOR_TYPE_PALETTE)
|
||||
FATAL_ERROR("\"%s\" has an unsupported color type.\n", path);
|
||||
|
||||
// Check if the image has a palette so that we can tell if the colors need to be inverted later.
|
||||
// Don't read the palette because it's not needed for now.
|
||||
image->hasPalette = (color_type == PNG_COLOR_TYPE_PALETTE);
|
||||
|
||||
image->width = png_get_image_width(png_ptr, info_ptr);
|
||||
image->height = png_get_image_height(png_ptr, info_ptr);
|
||||
|
||||
int rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
|
||||
image->pixels = malloc(image->height * rowbytes);
|
||||
|
||||
if (image->pixels == NULL)
|
||||
FATAL_ERROR("Failed to allocate pixel buffer.\n");
|
||||
|
||||
png_bytepp row_pointers = malloc(image->height * sizeof(png_bytep));
|
||||
|
||||
if (row_pointers == NULL)
|
||||
FATAL_ERROR("Failed to allocate row pointers.\n");
|
||||
|
||||
for (int i = 0; i < image->height; i++)
|
||||
row_pointers[i] = (png_bytep)(image->pixels + (i * rowbytes));
|
||||
|
||||
if (setjmp(png_jmpbuf(png_ptr)))
|
||||
FATAL_ERROR("Error reading from \"%s\".\n", path);
|
||||
|
||||
png_read_image(png_ptr, row_pointers);
|
||||
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||
|
||||
free(row_pointers);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
void SetPngPalette(png_structp png_ptr, png_infop info_ptr, struct Palette *palette)
|
||||
{
|
||||
png_colorp colors = malloc(palette->numColors * sizeof(png_color));
|
||||
|
||||
if (colors == NULL)
|
||||
FATAL_ERROR("Failed to allocate PNG palette.\n");
|
||||
|
||||
for (int i = 0; i < palette->numColors; i++) {
|
||||
colors[i].red = palette->colors[i].red;
|
||||
colors[i].green = palette->colors[i].green;
|
||||
colors[i].blue = palette->colors[i].blue;
|
||||
}
|
||||
|
||||
png_set_PLTE(png_ptr, info_ptr, colors, palette->numColors);
|
||||
|
||||
free(colors);
|
||||
}
|
||||
|
||||
void WritePng(char *path, struct Image *image)
|
||||
{
|
||||
FILE *fp = fopen(path, "wb");
|
||||
|
||||
if (fp == NULL)
|
||||
FATAL_ERROR("Failed to open \"%s\" for writing.\n", path);
|
||||
|
||||
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
|
||||
if (!png_ptr)
|
||||
FATAL_ERROR("Failed to create PNG write struct.\n");
|
||||
|
||||
png_infop info_ptr = png_create_info_struct(png_ptr);
|
||||
|
||||
if (!info_ptr)
|
||||
FATAL_ERROR("Failed to create PNG info struct.\n");
|
||||
|
||||
if (setjmp(png_jmpbuf(png_ptr)))
|
||||
FATAL_ERROR("Failed to init I/O for writing \"%s\".\n", path);
|
||||
|
||||
png_init_io(png_ptr, fp);
|
||||
|
||||
if (setjmp(png_jmpbuf(png_ptr)))
|
||||
FATAL_ERROR("Error writing header for \"%s\".\n", path);
|
||||
|
||||
int color_type = image->hasPalette ? PNG_COLOR_TYPE_PALETTE : PNG_COLOR_TYPE_GRAY;
|
||||
|
||||
png_set_IHDR(png_ptr, info_ptr, image->width, image->height,
|
||||
image->bitDepth, color_type, PNG_INTERLACE_NONE,
|
||||
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||
|
||||
if (image->hasPalette) {
|
||||
SetPngPalette(png_ptr, info_ptr, &image->palette);
|
||||
|
||||
if (image->hasTransparency) {
|
||||
png_byte trans = 0;
|
||||
png_set_tRNS(png_ptr, info_ptr, &trans, 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
png_write_info(png_ptr, info_ptr);
|
||||
|
||||
png_bytepp row_pointers = malloc(image->height * sizeof(png_bytep));
|
||||
|
||||
if (row_pointers == NULL)
|
||||
FATAL_ERROR("Failed to allocate row pointers.\n");
|
||||
|
||||
int rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
|
||||
for (int i = 0; i < image->height; i++)
|
||||
row_pointers[i] = (png_bytep)(image->pixels + (i * rowbytes));
|
||||
|
||||
if (setjmp(png_jmpbuf(png_ptr)))
|
||||
FATAL_ERROR("Error writing \"%s\".\n", path);
|
||||
|
||||
png_write_image(png_ptr, row_pointers);
|
||||
|
||||
if (setjmp(png_jmpbuf(png_ptr)))
|
||||
FATAL_ERROR("Error ending write of \"%s\".\n", path);
|
||||
|
||||
png_write_end(png_ptr, NULL);
|
||||
|
||||
fclose(fp);
|
||||
|
||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
free(row_pointers);
|
||||
}
|
11
tools/rsfont/convert_png.h
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright (c) 2015 YamaArashi
|
||||
|
||||
#ifndef CONVERT_PNG_H
|
||||
#define CONVERT_PNG_H
|
||||
|
||||
#include "gfx.h"
|
||||
|
||||
void ReadPng(char *path, struct Image *image);
|
||||
void WritePng(char *path, struct Image *image);
|
||||
|
||||
#endif // CONVERT_PNG_H
|
457
tools/rsfont/font.c
Normal file
@ -0,0 +1,457 @@
|
||||
// Copyright(c) 2015-2016 YamaArashi
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "global.h"
|
||||
#include "font.h"
|
||||
#include "gfx.h"
|
||||
#include "util.h"
|
||||
|
||||
unsigned char gFontPalette[][3] =
|
||||
{
|
||||
{0xFF, 0xFF, 0xFF}, // bg (white)
|
||||
{0x38, 0x38, 0x38}, // fg (dark grey)
|
||||
{0xD8, 0xD8, 0xD8}, // shadow (light grey)
|
||||
};
|
||||
|
||||
void ConvertFromTiles1Bpp(unsigned char *src, unsigned char *dest, int numGlyphs, int layout)
|
||||
{
|
||||
for (int glyph = 0; glyph < numGlyphs; glyph++)
|
||||
{
|
||||
if (layout == 0)
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
unsigned char srcRow = src[(glyph * 8) + i];
|
||||
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
int x = ((glyph % 16) * 8) + j;
|
||||
int y = ((glyph / 16) * 8) + i;
|
||||
dest[(y * 128) + x] = (srcRow >> (7 - j)) & 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// layout type 1
|
||||
|
||||
int tile1Offset = glyph * 16;
|
||||
int tile2Offset = tile1Offset + 8;
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
unsigned char srcRow = src[tile1Offset + i];
|
||||
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
int x = ((glyph % 16) * 8) + j;
|
||||
int y = ((glyph / 16) * 16) + i;
|
||||
dest[(y * 128) + x] = (srcRow >> (7 - j)) & 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
unsigned char srcRow = src[tile2Offset + i];
|
||||
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
int x = ((glyph % 16) * 8) + j;
|
||||
int y = ((glyph / 16) * 16) + 8 + i;
|
||||
dest[(y * 128) + x] = (srcRow >> (7 - j)) & 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ConvertToTiles1Bpp(unsigned char *src, unsigned char *dest, int numGlyphs, int layout)
|
||||
{
|
||||
for (int glyph = 0; glyph < numGlyphs; glyph++)
|
||||
{
|
||||
if (layout == 0)
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
unsigned char destRow = 0;
|
||||
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
int x = ((glyph % 16) * 8) + j;
|
||||
int y = ((glyph / 16) * 8) + i;
|
||||
unsigned char color = src[(y * 128) + x];
|
||||
|
||||
if (color > 1)
|
||||
FATAL_ERROR("More than 2 colors in 1 BPP font.\n");
|
||||
|
||||
destRow <<= 1;
|
||||
destRow |= color;
|
||||
}
|
||||
|
||||
dest[(glyph * 8) + i] = destRow;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// layout type 1
|
||||
|
||||
int tile1Offset = glyph * 16;
|
||||
int tile2Offset = tile1Offset + 8;
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
unsigned char destRow = 0;
|
||||
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
int x = ((glyph % 16) * 8) + j;
|
||||
int y = ((glyph / 16) * 16) + i;
|
||||
unsigned char color = src[(y * 128) + x];
|
||||
|
||||
if (color > 1)
|
||||
FATAL_ERROR("More than 2 colors in 1 BPP font.\n");
|
||||
|
||||
destRow <<= 1;
|
||||
destRow |= color;
|
||||
}
|
||||
|
||||
dest[tile1Offset + i] = destRow;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
unsigned char destRow = 0;
|
||||
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
int x = ((glyph % 16) * 8) + j;
|
||||
int y = ((glyph / 16) * 16) + 8 + i;
|
||||
unsigned char color = src[(y * 128) + x];
|
||||
|
||||
if (color > 1)
|
||||
FATAL_ERROR("More than 2 colors in 1 BPP font.\n");
|
||||
|
||||
destRow <<= 1;
|
||||
destRow |= color;
|
||||
}
|
||||
|
||||
dest[tile2Offset + i] = destRow;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ConvertFromTiles4Bpp(unsigned char *src, unsigned char *dest, int numGlyphs, int layout)
|
||||
{
|
||||
static unsigned char table[16] =
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1,
|
||||
};
|
||||
|
||||
for (int glyph = 0; glyph < numGlyphs; glyph++)
|
||||
{
|
||||
if (layout == 0)
|
||||
{
|
||||
int offset = glyph * 32;
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
unsigned long srcRow = (src[offset + 3] << 24)
|
||||
| (src[offset + 2] << 16)
|
||||
| (src[offset + 1] << 8)
|
||||
| src[offset];
|
||||
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
int x = ((glyph % 16) * 8) + j;
|
||||
int y = ((glyph / 16) * 8) + i;
|
||||
dest[(y * 128) + x] = table[srcRow & 0xF];
|
||||
srcRow >>= 4;
|
||||
}
|
||||
|
||||
offset += 4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int tile1Offset;
|
||||
int tile2Offset;
|
||||
|
||||
if (layout == 1)
|
||||
{
|
||||
tile1Offset = glyph * 64;
|
||||
tile2Offset = tile1Offset + 32;
|
||||
}
|
||||
else
|
||||
{
|
||||
tile1Offset = ((glyph / 16) * 1024) + ((glyph % 16) * 32);
|
||||
tile2Offset = tile1Offset + 512;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
unsigned long srcRow = (src[tile1Offset + 3] << 24)
|
||||
| (src[tile1Offset + 2] << 16)
|
||||
| (src[tile1Offset + 1] << 8)
|
||||
| src[tile1Offset];
|
||||
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
int x = ((glyph % 16) * 8) + j;
|
||||
int y = ((glyph / 16) * 16) + i;
|
||||
dest[(y * 128) + x] = table[srcRow & 0xF];
|
||||
srcRow >>= 4;
|
||||
}
|
||||
|
||||
tile1Offset += 4;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
unsigned long srcRow = (src[tile2Offset + 3] << 24)
|
||||
| (src[tile2Offset + 2] << 16)
|
||||
| (src[tile2Offset + 1] << 8)
|
||||
| src[tile2Offset];
|
||||
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
int x = ((glyph % 16) * 8) + j;
|
||||
int y = ((glyph / 16) * 16) + 8 + i;
|
||||
dest[(y * 128) + x] = table[srcRow & 0xF];
|
||||
srcRow >>= 4;
|
||||
}
|
||||
|
||||
tile2Offset += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ConvertToTiles4Bpp(unsigned char *src, unsigned char *dest, int numGlyphs, int layout)
|
||||
{
|
||||
static unsigned char table[3] =
|
||||
{
|
||||
0, 15, 14,
|
||||
};
|
||||
|
||||
for (int glyph = 0; glyph < numGlyphs; glyph++)
|
||||
{
|
||||
if (layout == 0)
|
||||
{
|
||||
int offset = glyph * 32;
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
unsigned long destRow = 0;
|
||||
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
int x = ((glyph % 16) * 8) + j;
|
||||
int y = ((glyph / 16) * 8) + i;
|
||||
unsigned char color = src[(y * 128) + x];
|
||||
|
||||
if (color > 2)
|
||||
FATAL_ERROR("More than 3 colors in 4 BPP font.\n");
|
||||
|
||||
destRow >>= 4;
|
||||
destRow |= (table[color] << 28);
|
||||
}
|
||||
|
||||
dest[offset] = destRow & 0xFF;
|
||||
dest[offset + 1] = (destRow >> 8) & 0xFF;
|
||||
dest[offset + 2] = (destRow >> 16) & 0xFF;
|
||||
dest[offset + 3] = (destRow >> 24) & 0xFF;
|
||||
|
||||
offset += 4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int tile1Offset;
|
||||
int tile2Offset;
|
||||
|
||||
if (layout == 1)
|
||||
{
|
||||
tile1Offset = glyph * 64;
|
||||
tile2Offset = tile1Offset + 32;
|
||||
}
|
||||
else
|
||||
{
|
||||
tile1Offset = ((glyph / 16) * 1024) + ((glyph % 16) * 32);
|
||||
tile2Offset = tile1Offset + 512;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
unsigned long destRow = 0;
|
||||
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
int x = ((glyph % 16) * 8) + j;
|
||||
int y = ((glyph / 16) * 16) + i;
|
||||
unsigned char color = src[(y * 128) + x];
|
||||
|
||||
if (color > 2)
|
||||
FATAL_ERROR("More than 3 colors in 4 BPP font.\n");
|
||||
|
||||
destRow >>= 4;
|
||||
destRow |= (table[color] << 28);
|
||||
}
|
||||
|
||||
dest[tile1Offset] = destRow & 0xFF;
|
||||
dest[tile1Offset + 1] = (destRow >> 8) & 0xFF;
|
||||
dest[tile1Offset + 2] = (destRow >> 16) & 0xFF;
|
||||
dest[tile1Offset + 3] = (destRow >> 24) & 0xFF;
|
||||
|
||||
tile1Offset += 4;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
unsigned long destRow = 0;
|
||||
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
int x = ((glyph % 16) * 8) + j;
|
||||
int y = ((glyph / 16) * 16) + 8 + i;
|
||||
unsigned char color = src[(y * 128) + x];
|
||||
|
||||
if (color > 2)
|
||||
FATAL_ERROR("More than 3 colors in 4 BPP font.\n");
|
||||
|
||||
destRow >>= 4;
|
||||
destRow |= (table[color] << 28);
|
||||
}
|
||||
|
||||
dest[tile2Offset] = destRow & 0xFF;
|
||||
dest[tile2Offset + 1] = (destRow >> 8) & 0xFF;
|
||||
dest[tile2Offset + 2] = (destRow >> 16) & 0xFF;
|
||||
dest[tile2Offset + 3] = (destRow >> 24) & 0xFF;
|
||||
|
||||
tile2Offset += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void SetFontPalette(struct Image *image)
|
||||
{
|
||||
image->hasPalette = true;
|
||||
|
||||
image->palette.numColors = 3;
|
||||
|
||||
for (int i = 0; i < image->palette.numColors; i++)
|
||||
{
|
||||
image->palette.colors[i].red = gFontPalette[i][0];
|
||||
image->palette.colors[i].green = gFontPalette[i][1];
|
||||
image->palette.colors[i].blue = gFontPalette[i][2];
|
||||
}
|
||||
|
||||
image->hasTransparency = false;
|
||||
}
|
||||
|
||||
int CalcFileSize(int numGlyphs, int bpp, int layout)
|
||||
{
|
||||
if (layout == 2)
|
||||
{
|
||||
// assume 4 BPP
|
||||
int numFullRows = numGlyphs / 16;
|
||||
int remainder = numGlyphs % 16;
|
||||
int fullRowsSize = numFullRows * 1024;
|
||||
int remainderSize = 0;
|
||||
|
||||
if (remainder != 0)
|
||||
remainderSize = 1024 - (16 - remainder) * 32;
|
||||
|
||||
return fullRowsSize + remainderSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
int tilesPerGlyph = layout > 0 ? 2 : 1;
|
||||
int bytesPerTile = 8 * bpp;
|
||||
return numGlyphs * tilesPerGlyph * bytesPerTile;
|
||||
}
|
||||
}
|
||||
|
||||
void ReadFont(char *path, struct Image *image, int numGlyphs, int bpp, int layout)
|
||||
{
|
||||
int fileSize;
|
||||
unsigned char *buffer = ReadWholeFile(path, &fileSize);
|
||||
|
||||
int tilesPerGlyph = layout > 0 ? 2 : 1;
|
||||
|
||||
int expectedFileSize = CalcFileSize(numGlyphs, bpp, layout);
|
||||
|
||||
if (fileSize != expectedFileSize)
|
||||
FATAL_ERROR("The file size is %d but should be %d.\n", fileSize, expectedFileSize);
|
||||
|
||||
int numRows = (numGlyphs + 15) / 16;
|
||||
int rowHeight = layout > 0 ? 16 : 8;
|
||||
|
||||
image->width = 128;
|
||||
image->height = numRows * rowHeight;
|
||||
image->bitDepth = 8;
|
||||
image->pixels = calloc(image->width * image->height, 1);
|
||||
|
||||
if (image->pixels == NULL)
|
||||
FATAL_ERROR("Failed to allocate memory for font.\n");
|
||||
|
||||
if (bpp == 1)
|
||||
ConvertFromTiles1Bpp(buffer, image->pixels, numGlyphs, layout);
|
||||
else
|
||||
ConvertFromTiles4Bpp(buffer, image->pixels, numGlyphs, layout);
|
||||
|
||||
free(buffer);
|
||||
|
||||
SetFontPalette(image);
|
||||
}
|
||||
|
||||
void WriteFont(char *path, struct Image *image, int numGlyphs, int bpp, int layout)
|
||||
{
|
||||
if (image->width != 128)
|
||||
FATAL_ERROR("The width of the font image (%d) is not 128.\n", image->width);
|
||||
|
||||
int numRows = (numGlyphs + 15) / 16;
|
||||
int rowHeight = layout > 0 ? 16 : 8;
|
||||
int expectedHeight = numRows * rowHeight;
|
||||
|
||||
if (image->height < expectedHeight)
|
||||
FATAL_ERROR("The height of the font image (%d) is less than %d.\n", image->height, expectedHeight);
|
||||
|
||||
int fileSize = CalcFileSize(numGlyphs, bpp, layout);
|
||||
|
||||
unsigned char *buffer = calloc(fileSize, 1);
|
||||
|
||||
if (buffer == NULL)
|
||||
FATAL_ERROR("Failed to allocate memory for font.\n");
|
||||
|
||||
if (bpp == 1)
|
||||
ConvertToTiles1Bpp(image->pixels, buffer, numGlyphs, layout);
|
||||
else
|
||||
ConvertToTiles4Bpp(image->pixels, buffer, numGlyphs, layout);
|
||||
|
||||
WriteWholeFile(path, buffer, fileSize);
|
||||
|
||||
free(buffer);
|
||||
}
|
30
tools/rsfont/font.h
Normal file
@ -0,0 +1,30 @@
|
||||
// Copyright(c) 2015-2016 YamaArashi
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#ifndef FONT_H
|
||||
#define FONT_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "gfx.h"
|
||||
|
||||
void ReadFont(char *path, struct Image *image, int numGlyphs, int bpp, int layout);
|
||||
void WriteFont(char *path, struct Image *image, int numGlyphs, int bpp, int layout);
|
||||
|
||||
#endif // FONT_H
|
50
tools/rsfont/gfx.h
Normal file
@ -0,0 +1,50 @@
|
||||
// Copyright(c) 2015-2016 YamaArashi
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#ifndef GFX_H
|
||||
#define GFX_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
struct Color
|
||||
{
|
||||
unsigned char red;
|
||||
unsigned char green;
|
||||
unsigned char blue;
|
||||
};
|
||||
|
||||
struct Palette
|
||||
{
|
||||
struct Color colors[256];
|
||||
int numColors;
|
||||
};
|
||||
|
||||
struct Image {
|
||||
int width;
|
||||
int height;
|
||||
int bitDepth;
|
||||
unsigned char *pixels;
|
||||
bool hasPalette;
|
||||
struct Palette palette;
|
||||
bool hasTransparency;
|
||||
};
|
||||
|
||||
#endif // GFX_H
|
31
tools/rsfont/global.h
Normal file
@ -0,0 +1,31 @@
|
||||
// Copyright (c) 2015 YamaArashi
|
||||
|
||||
#ifndef GLOBAL_H
|
||||
#define GLOBAL_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#define FATAL_ERROR(format, ...) \
|
||||
do { \
|
||||
fprintf(stderr, format, __VA_ARGS__); \
|
||||
exit(1); \
|
||||
} while (0)
|
||||
|
||||
#define UNUSED
|
||||
|
||||
#else
|
||||
|
||||
#define FATAL_ERROR(format, ...) \
|
||||
do { \
|
||||
fprintf(stderr, format, ##__VA_ARGS__); \
|
||||
exit(1); \
|
||||
} while (0)
|
||||
|
||||
#define UNUSED __attribute__((__unused__))
|
||||
|
||||
#endif // _MSC_VER
|
||||
|
||||
#endif // GLOBAL_H
|
93
tools/rsfont/main.c
Normal file
@ -0,0 +1,93 @@
|
||||
// Copyright(c) 2015-2016 YamaArashi
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include "global.h"
|
||||
#include "util.h"
|
||||
#include "gfx.h"
|
||||
#include "convert_png.h"
|
||||
#include "font.h"
|
||||
|
||||
int ExtensionToBpp(const char *extension)
|
||||
{
|
||||
if (!strcmp(extension, "1bpp"))
|
||||
return 1;
|
||||
else if (!strcmp(extension, "4bpp"))
|
||||
return 4;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if (argc < 5)
|
||||
FATAL_ERROR("Usage: rsfont INPUT_FILE OUTPUT_FILE NUM_GLYPHS LAYOUT_TYPE\n");
|
||||
|
||||
char *inputPath = argv[1];
|
||||
char *outputPath = argv[2];
|
||||
char *inputFileExtension = GetFileExtension(inputPath);
|
||||
char *outputFileExtension = GetFileExtension(outputPath);
|
||||
|
||||
if (inputFileExtension == NULL)
|
||||
FATAL_ERROR("Input file \"%s\" has no extension.\n", inputPath);
|
||||
|
||||
if (outputFileExtension == NULL)
|
||||
FATAL_ERROR("Output file \"%s\" has no extension.\n", outputPath);
|
||||
|
||||
int numGlyphs;
|
||||
int bpp;
|
||||
int layout;
|
||||
|
||||
if (!ParseNumber(argv[3], NULL, 10, &numGlyphs))
|
||||
FATAL_ERROR("Failed to parse number of glyphs.\n");
|
||||
|
||||
if (!ParseNumber(argv[4], NULL, 10, &layout))
|
||||
FATAL_ERROR("Failed to parse layout type.\n");
|
||||
|
||||
if (layout < 0 || layout > 2)
|
||||
FATAL_ERROR("Layout type %d is invalid. Layout type must be 0, 1, or 2.\n", layout);
|
||||
|
||||
bool toPng;
|
||||
|
||||
if (!strcmp(inputFileExtension, "png") && (bpp = ExtensionToBpp(outputFileExtension)) != 0)
|
||||
toPng = false;
|
||||
else if ((bpp = ExtensionToBpp(inputFileExtension)) != 0 && !strcmp(outputFileExtension, "png"))
|
||||
toPng = true;
|
||||
else
|
||||
FATAL_ERROR("Don't know how to convert \"%s\" to \"%s\".\n", inputPath, outputPath);
|
||||
|
||||
if (bpp == 1 && layout == 2)
|
||||
FATAL_ERROR("Layout type 2 is not supported with 1 BPP fonts.\n");
|
||||
|
||||
struct Image image;
|
||||
|
||||
if (toPng)
|
||||
{
|
||||
ReadFont(inputPath, &image, numGlyphs, bpp, layout);
|
||||
WritePng(outputPath, &image);
|
||||
}
|
||||
else
|
||||
{
|
||||
image.bitDepth = 8;
|
||||
ReadPng(inputPath, &image);
|
||||
WriteFont(outputPath, &image, numGlyphs, bpp, layout);
|
||||
}
|
||||
}
|
124
tools/rsfont/util.c
Normal file
@ -0,0 +1,124 @@
|
||||
// Copyright (c) 2015 YamaArashi
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include "global.h"
|
||||
#include "util.h"
|
||||
|
||||
bool ParseNumber(char *s, char **end, int radix, int *intValue)
|
||||
{
|
||||
char *localEnd;
|
||||
|
||||
if (end == NULL)
|
||||
end = &localEnd;
|
||||
|
||||
errno = 0;
|
||||
|
||||
const long longValue = strtol(s, end, radix);
|
||||
|
||||
if (*end == s)
|
||||
return false; // not a number
|
||||
|
||||
if ((longValue == LONG_MIN || longValue == LONG_MAX) && errno == ERANGE)
|
||||
return false;
|
||||
|
||||
if (longValue > INT_MAX)
|
||||
return false;
|
||||
|
||||
if (longValue < INT_MIN)
|
||||
return false;
|
||||
|
||||
*intValue = (int)longValue;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
char *GetFileExtension(char *path)
|
||||
{
|
||||
char *extension = path;
|
||||
|
||||
while (*extension != 0)
|
||||
extension++;
|
||||
|
||||
while (extension > path && *extension != '.')
|
||||
extension--;
|
||||
|
||||
if (extension == path)
|
||||
return NULL;
|
||||
|
||||
extension++;
|
||||
|
||||
if (*extension == 0)
|
||||
return NULL;
|
||||
|
||||
return extension;
|
||||
}
|
||||
|
||||
unsigned char *ReadWholeFile(char *path, int *size)
|
||||
{
|
||||
FILE *fp = fopen(path, "rb");
|
||||
|
||||
if (fp == NULL)
|
||||
FATAL_ERROR("Failed to open \"%s\" for reading.\n", path);
|
||||
|
||||
fseek(fp, 0, SEEK_END);
|
||||
|
||||
*size = ftell(fp);
|
||||
|
||||
unsigned char *buffer = malloc(*size);
|
||||
|
||||
if (buffer == NULL)
|
||||
FATAL_ERROR("Failed to allocate memory for reading \"%s\".\n", path);
|
||||
|
||||
rewind(fp);
|
||||
|
||||
if (fread(buffer, *size, 1, fp) != 1)
|
||||
FATAL_ERROR("Failed to read \"%s\".\n", path);
|
||||
|
||||
fclose(fp);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
unsigned char *ReadWholeFileZeroPadded(char *path, int *size, int padAmount)
|
||||
{
|
||||
FILE *fp = fopen(path, "rb");
|
||||
|
||||
if (fp == NULL)
|
||||
FATAL_ERROR("Failed to open \"%s\" for reading.\n", path);
|
||||
|
||||
fseek(fp, 0, SEEK_END);
|
||||
|
||||
*size = ftell(fp);
|
||||
|
||||
unsigned char *buffer = calloc(*size + padAmount, 1);
|
||||
|
||||
if (buffer == NULL)
|
||||
FATAL_ERROR("Failed to allocate memory for reading \"%s\".\n", path);
|
||||
|
||||
rewind(fp);
|
||||
|
||||
if (fread(buffer, *size, 1, fp) != 1)
|
||||
FATAL_ERROR("Failed to read \"%s\".\n", path);
|
||||
|
||||
fclose(fp);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void WriteWholeFile(char *path, void *buffer, int bufferSize)
|
||||
{
|
||||
FILE *fp = fopen(path, "wb");
|
||||
|
||||
if (fp == NULL)
|
||||
FATAL_ERROR("Failed to open \"%s\" for writing.\n", path);
|
||||
|
||||
if (fwrite(buffer, bufferSize, 1, fp) != 1)
|
||||
FATAL_ERROR("Failed to write to \"%s\".\n", path);
|
||||
|
||||
fclose(fp);
|
||||
}
|
14
tools/rsfont/util.h
Normal file
@ -0,0 +1,14 @@
|
||||
// Copyright (c) 2015 YamaArashi
|
||||
|
||||
#ifndef UTIL_H
|
||||
#define UTIL_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
bool ParseNumber(char *s, char **end, int radix, int *intValue);
|
||||
char *GetFileExtension(char *path);
|
||||
unsigned char *ReadWholeFile(char *path, int *size);
|
||||
unsigned char *ReadWholeFileZeroPadded(char *path, int *size, int padAmount);
|
||||
void WriteWholeFile(char *path, void *buffer, int bufferSize);
|
||||
|
||||
#endif // UTIL_H
|