Skip to content

Commit

Permalink
Merge pull request #271 from lhearachel/pl-font-decomp
Browse files Browse the repository at this point in the history
Decompile pl_font.narc and rebuild from sources
  • Loading branch information
lhearachel authored Oct 27, 2024
2 parents 4994206 + 042f88d commit e35487c
Show file tree
Hide file tree
Showing 30 changed files with 699 additions and 186 deletions.
425 changes: 330 additions & 95 deletions include/constants/charcode.h

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions include/palette.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

#include "constants/heap.h"

#define SLOTS_PER_PALETTE 16
#define PALETTE_SIZE (SLOTS_PER_PALETTE)
#define PALETTE_SIZE_EXT (SLOTS_PER_PALETTE * 16)
#define PALETTE_SIZE_BYTES (PALETTE_SIZE * sizeof(u16))

enum PaletteBufferID {
PLTTBUF_MAIN_BG = 0,
PLTTBUF_SUB_BG,
Expand Down
2 changes: 1 addition & 1 deletion platinum.us/filesys.sha1
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ e7266bd8b7095861b6e1fdaf4f13cb648a9c325d *res/prebuilt/graphic/footprint_board.n
e22f0296444ce01e0b7619f73a8cf2016b2307b4 *res/prebuilt/graphic/oekaki.narc
917f25f4e5bb3f5e1837471d2a90225e9e95363d *res/prebuilt/graphic/opening.narc
dd0663e46347230d1d1b9eb8b583cee9acc10f31 *res/prebuilt/graphic/pl_bag_gra.narc
0929061d78710595aa53796ecffe3545f8406d82 *res/prebuilt/graphic/pl_font.narc
0929061d78710595aa53796ecffe3545f8406d82 *res/fonts/pl_font.narc
d397dbd087737151aa8bea242016c626afb55fa5 *res/prebuilt/graphic/pl_plist_gra.narc
883e6afb310f0ab02c26f2026cba1c76210bb3ac *res/prebuilt/graphic/pl_pst_gra.narc
c16faeeeee494830c720d1f795a141cacfe49121 *res/prebuilt/graphic/pl_wifinote.narc
Expand Down
8 changes: 7 additions & 1 deletion platinum.us/rom.rsf
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,13 @@ RomSpec
File graphic/oekaki.narc
File graphic/opening.narc
File graphic/pl_bag_gra.narc
File graphic/pl_font.narc

Root /graphic
HostRoot res/fonts
File pl_font.narc

Root /
HostRoot res/prebuilt
File graphic/pl_plist_gra.narc
File graphic/pl_pst_gra.narc
File graphic/pl_wifinote.narc
Expand Down
38 changes: 38 additions & 0 deletions res/fonts/font_message.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"maxGlyphWidth": 16,
"maxGlyphHeight": 16,
"glyphWidths": [
7, 10, 10, 10, 10, 9, 10, 9, 10, 10, 10, 11, 11, 9, 11, 9,
11, 10, 11, 9, 11, 10, 11, 9, 10, 11, 11, 10, 11, 10, 11, 11,
11, 10, 11, 10, 10, 11, 10, 11, 9, 11, 10, 9, 10, 10, 10, 10,
11, 11, 10, 11, 11, 10, 11, 11, 11, 11, 11, 10, 11, 11, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 9, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 10, 11, 9,
11, 10, 11, 9, 11, 10, 11, 10, 11, 10, 11, 10, 11, 9, 11, 9,
11, 10, 11, 10, 10, 11, 10, 11, 9, 10, 10, 10, 10, 9, 9, 10,
11, 11, 9, 10, 10, 10, 11, 11, 10, 11, 11, 10, 11, 11, 10, 9,
10, 10, 10, 10, 10, 10, 10, 9, 10, 10, 9, 10, 9, 10, 10, 10,
10, 7, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 8, 7, 7, 7, 7, 7, 7, 6, 7, 7, 3, 6, 7,
4, 7, 7, 7, 7, 7, 6, 7, 6, 7, 7, 7, 7, 6, 7, 0,
6, 10, 5, 6, 9, 5, 8, 7, 7, 8, 8, 6, 6, 8, 8, 8,
8, 8, 8, 8, 8, 5, 5, 5, 5, 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, 11, 12, 11, 11, 11, 11, 11, 12, 7, 6, 6, 7, 6, 9,
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, 6, 6, 6, 6, 6, 5, 6, 6, 3, 5, 6, 4,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 10, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 10, 6, 6, 6, 6, 6, 4, 4, 4, 4, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 10, 10,
6, 6, 6, 6, 8, 8, 5, 7, 4, 6, 6, 6, 5, 5, 6, 6,
6, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 5, 5, 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, 12,
12, 6, 1, 2, 4, 8, 16, 5, 6, 8, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
]
}
Binary file added res/fonts/font_message.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/fonts/font_special_chars.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions res/fonts/font_subscreen.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"maxGlyphWidth": 16,
"maxGlyphHeight": 16,
"glyphWidths": [
7, 11, 13, 12, 12, 10, 11, 10, 13, 12, 13, 13, 14, 12, 14, 10,
14, 13, 14, 13, 13, 12, 14, 12, 12, 13, 14, 13, 14, 13, 13, 13,
13, 13, 13, 11, 12, 13, 12, 13, 12, 13, 13, 13, 13, 13, 13, 13,
14, 13, 13, 13, 13, 13, 14, 13, 13, 13, 13, 13, 14, 14, 12, 13,
13, 13, 13, 11, 13, 11, 13, 10, 12, 12, 12, 13, 13, 13, 13, 13,
13, 10, 12, 10, 13, 11, 13, 11, 12, 10, 13, 13, 14, 13, 13, 12,
14, 13, 14, 11, 13, 13, 14, 13, 14, 13, 13, 13, 14, 13, 14, 12,
14, 13, 14, 11, 13, 14, 13, 14, 11, 12, 13, 13, 12, 13, 11, 13,
14, 13, 12, 13, 12, 12, 13, 13, 13, 13, 13, 13, 14, 13, 13, 12,
13, 13, 13, 11, 13, 11, 12, 10, 11, 13, 12, 13, 11, 12, 12, 12,
12, 11, 8, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10,
9, 11, 11, 8, 11, 11, 10, 11, 11, 12, 11, 13, 11, 11, 10, 11,
11, 12, 11, 11, 10, 10, 10, 10, 10, 10, 9, 10, 10, 6, 7, 9,
6, 11, 10, 10, 10, 10, 10, 10, 9, 10, 10, 11, 10, 10, 10, 0,
10, 11, 8, 10, 11, 8, 8, 10, 10, 10, 10, 8, 8, 9, 9, 12,
11, 11, 11, 11, 11, 7, 7, 8, 8, 12, 12, 13, 13, 13, 13, 13,
12, 13, 13, 13, 12, 13, 13, 12, 13, 10, 12, 12, 12, 12, 12, 12,
13, 11, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 0, 11,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 7, 7, 4, 6, 7, 5,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 11, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 11, 7, 7, 7, 7, 7, 5, 5, 5, 5, 7, 7,
7, 7, 7, 7, 7, 8, 7, 7, 7, 7, 7, 7, 7, 7, 11, 11,
7, 7, 7, 7, 10, 10, 7, 7, 5, 7, 7, 7, 6, 6, 7, 7,
7, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 6, 7, 7, 7, 7, 7, 7, 5, 7, 14,
14, 7, 1, 2, 4, 8, 16, 5, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
]
}
Binary file added res/fonts/font_subscreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions res/fonts/font_system.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"maxGlyphWidth": 16,
"maxGlyphHeight": 16,
"glyphWidths": [
7, 10, 10, 10, 10, 9, 10, 9, 10, 10, 10, 11, 11, 9, 11, 9,
11, 10, 11, 9, 11, 10, 11, 9, 10, 11, 11, 10, 11, 10, 11, 11,
11, 10, 11, 10, 10, 11, 10, 11, 9, 11, 10, 9, 10, 10, 10, 10,
11, 11, 10, 11, 11, 10, 11, 11, 11, 11, 11, 10, 11, 11, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 9, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 10, 11, 9,
11, 10, 11, 9, 11, 10, 11, 10, 11, 10, 11, 10, 11, 9, 11, 9,
11, 10, 11, 10, 10, 11, 10, 11, 9, 10, 10, 10, 10, 9, 9, 10,
11, 11, 9, 10, 10, 10, 11, 11, 10, 11, 11, 10, 11, 11, 10, 9,
10, 10, 10, 10, 10, 10, 10, 9, 10, 10, 9, 10, 9, 10, 10, 10,
10, 7, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 8, 7, 7, 7, 7, 7, 7, 6, 7, 7, 3, 6, 7,
4, 7, 7, 7, 7, 7, 6, 7, 6, 7, 7, 7, 7, 6, 7, 0,
6, 10, 5, 6, 9, 5, 8, 7, 7, 8, 8, 6, 6, 8, 8, 8,
8, 8, 8, 8, 8, 5, 5, 5, 5, 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, 11, 12, 11, 11, 11, 11, 11, 12, 7, 6, 6, 7, 6, 9,
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, 6, 6, 6, 6, 6, 5, 6, 6, 3, 5, 6, 4,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 10, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 10, 6, 6, 6, 6, 6, 4, 4, 4, 4, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 10, 10,
6, 6, 6, 6, 8, 8, 5, 7, 4, 6, 6, 6, 5, 5, 6, 6,
6, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 5, 5, 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, 12,
12, 6, 1, 2, 4, 8, 16, 5, 6, 8, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
]
}
Binary file added res/fonts/font_system.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions res/fonts/font_unown.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"maxGlyphWidth": 12,
"maxGlyphHeight": 16,
"glyphWidths": [
7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 11, 12, 11, 11,
12, 11, 12, 10, 10, 12, 11, 12, 12, 12, 9, 11, 9, 12, 10, 12,
11, 11, 12, 11, 12, 8, 11, 12, 11, 11, 12, 11, 12, 10, 10, 12,
11, 12, 12, 12, 9, 11, 9, 12, 10, 12, 11, 11, 12, 11, 12, 0,
10, 10, 0, 0, 0, 0, 0, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 11, 12, 11, 11, 12,
11, 12, 10, 10, 12, 11, 12, 12, 12, 9, 11, 9, 12, 10, 12, 11,
11, 12, 11, 12, 8, 11, 12, 11, 11, 12, 11, 12, 10, 10, 12, 11,
12, 12, 12, 9, 11, 9, 12, 10, 12, 11, 11, 12, 11, 12, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
]
}
Binary file added res/fonts/font_unown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
75 changes: 75 additions & 0 deletions res/fonts/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
fonts = {
'font_system.NFGR': files('font_system.png', 'font_system.json'),
'font_message.NFGR': files('font_message.png', 'font_message.json'),
'font_subscreen.NFGR': files('font_subscreen.png', 'font_subscreen.json'),
'font_unown.NFGR': files('font_unown.png', 'font_unown.json'),
}

nfgr_gen = generator(nitrogfx_exe,
arguments: [ '@INPUT@', '@OUTPUT@', '@EXTRA_ARGS@', ],
output: '@[email protected]',
)

pl_font_nfgrs = []
foreach target, inputs: fonts
nfgr = custom_target(target,
output: target,
input: inputs,
command: [
nitrogfx_exe,
'@INPUT0@',
'@OUTPUT@',
'-metadata', '@INPUT1@',
]
)
pl_font_nfgrs += mv_gen.process(nfgr)
# pl_font_nfgrs += nfgr_gen.process(inputs[0],
# extra_args: [ '-metadata', inputs[1], ],
# )
endforeach

font_special_chars_png = files('font_special_chars.png')
font_special_chars_ncgr = ncgr_gen.process(font_special_chars_png,
extra_args: [ '-sopc', '-version101', ],
)
font_special_chars_ncgr_lz = lz_gen.process(font_special_chars_ncgr)
font_special_chars_nclr = nclr_gen.process(font_special_chars_png,
extra_args: [ '-bitdepth', '4', '-nopad', '-pcmp', ],
)

screen_indicators_png = files('screen_indicators.png')
screen_indicators_ncgr = ncgr_gen.process(screen_indicators_png,
extra_args: [ '-sopc', '-version101', ],
)
screen_indicators_nclr = nclr_gen.process(screen_indicators_png,
extra_args: [ '-bitdepth', '4', ],
)

pl_font_order = files('pl_font.order')
pl_font_ignore = files('pl_font.ignore')
pl_font_narc = custom_target('pl_font.narc',
output: [
'pl_font.narc',
'pl_font.naix',
],
input: [
pl_font_nfgrs,
font_special_chars_ncgr_lz,
font_special_chars_nclr,
screen_indicators_ncgr,
screen_indicators_nclr,
pl_font_order,
pl_font_ignore,
],
command: [
knarc_exe,
'-d', '@PRIVATE_DIR@',
'-p', '@OUTPUT0@',
'--order', pl_font_order,
'--ignore', pl_font_ignore,
'--naix',
],
)

nitrofs_files += pl_font_narc[0]
naix_headers += pl_font_narc[1]
1 change: 1 addition & 0 deletions res/fonts/pl_font.ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
font_special_chars.NCGR
8 changes: 8 additions & 0 deletions res/fonts/pl_font.order
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
font_system.NFGR
font_message.NFGR
font_subscreen.NFGR
font_unown.NFGR
font_special_chars.NCGR.lz
screen_indicators.NCGR
font_special_chars.NCLR
screen_indicators.NCLR
Binary file added res/fonts/screen_indicators.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions res/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,29 @@ s_to_bin_gen = generator(make_script_bin_sh,
output: '@BASENAME@'
)

mv_gen = generator(find_program('mv'),
arguments: [ '@INPUT@', '@OUTPUT@', ],
output: '@PLAINNAME@',
)

ncgr_gen = generator(nitrogfx_exe,
arguments: [ '@INPUT@', '@OUTPUT@', '@EXTRA_ARGS@', ],
output: '@[email protected]',
)

nclr_gen = generator(nitrogfx_exe,
arguments: [ '@INPUT@', '@OUTPUT@', '@EXTRA_ARGS@', ],
output: '@[email protected]',
)

lz_gen = generator(nitrogfx_exe,
arguments: [ '@INPUT@', '@OUTPUT@', '@EXTRA_ARGS@', ],
output: '@[email protected]',
)

subdir('battle')
subdir('field')
subdir('fonts')
subdir('items')
subdir('pokemon')
subdir('sound')
Expand Down
1 change: 0 additions & 1 deletion res/prebuilt/graphic/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ prebuilt_files = [
'oekaki.narc',
'opening.narc',
'pl_bag_gra.narc',
'pl_font.narc',
'pl_plist_gra.narc',
'pl_pst_gra.narc',
'pl_wifinote.narc',
Expand Down
Binary file removed res/prebuilt/graphic/pl_font.narc
Binary file not shown.
2 changes: 1 addition & 1 deletion src/ascii_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@ void Ascii_SetResourceName(NNSG3dResName *resource, const char *src)

BOOL IsFullWidthChar(charcode_t character)
{
return character < CHAR_EN_0;
return character < CHAR_0;
}
38 changes: 19 additions & 19 deletions src/charcode_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@
#include "charcode.h"

static const charcode_t sHexadecimalDigits[] = {
CHAR_JP_0,
CHAR_JP_1,
CHAR_JP_2,
CHAR_JP_3,
CHAR_JP_4,
CHAR_JP_5,
CHAR_JP_6,
CHAR_JP_7,
CHAR_JP_8,
CHAR_JP_9,
CHAR_JP_A,
CHAR_JP_B,
CHAR_JP_C,
CHAR_JP_D,
CHAR_JP_E,
CHAR_JP_F,
CHAR_WIDE_0,
CHAR_WIDE_1,
CHAR_WIDE_2,
CHAR_WIDE_3,
CHAR_WIDE_4,
CHAR_WIDE_5,
CHAR_WIDE_6,
CHAR_WIDE_7,
CHAR_WIDE_8,
CHAR_WIDE_9,
CHAR_WIDE_A,
CHAR_WIDE_B,
CHAR_WIDE_C,
CHAR_WIDE_D,
CHAR_WIDE_E,
CHAR_WIDE_F,
};

static const int sPowersOfTen[] = {
Expand Down Expand Up @@ -129,14 +129,14 @@ charcode_t *CharCode_FromInt(charcode_t *str, s32 i, enum PaddingMode paddingMod
diff = i - (j * digit);

if (paddingMode == PADDING_MODE_ZEROES) {
*str = digit >= 10 ? CHAR_JP_QUESTION : sHexadecimalDigits[digit];
*str = digit >= 10 ? CHAR_WIDE_QUESTION : sHexadecimalDigits[digit];
str++;
} else if (digit != 0 || j == 1) {
paddingMode = PADDING_MODE_ZEROES;
*str = digit >= 10 ? CHAR_JP_QUESTION : sHexadecimalDigits[digit];
*str = digit >= 10 ? CHAR_WIDE_QUESTION : sHexadecimalDigits[digit];
str++;
} else if (paddingMode == PADDING_MODE_SPACES) {
*str = CHAR_JP_SPACE;
*str = CHAR_WIDE_SPACE;
str++;
}

Expand Down
2 changes: 1 addition & 1 deletion src/colored_arrow.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
ColoredArrow *ColoredArrow_New(u32 heapID)
{
static const charcode_t chars[] = {
CHAR_MENU_ARROW,
CHAR_ARROW_MENU,
CHAR_EOS,
};
ColoredArrow *arrow = Heap_AllocFromHeap(heapID, sizeof(ColoredArrow));
Expand Down
Loading

0 comments on commit e35487c

Please sign in to comment.