Kanji complete

This commit is contained in:
Luke Hubmayer-Werner 2017-07-23 18:29:22 +09:30
parent 7c40ca97c1
commit 2d286d48ef
2 changed files with 63 additions and 53 deletions

106
const.py
View File

@ -46,68 +46,68 @@ Glyphs_JP_large[0xC7] = '⋯'
Glyphs_JP_large[0xE0:0xEB] = ['','','+','', '', '', '', '°C', '', '', '']
Glyphs_JP_large[0xFF] = ' '
Glyphs_Kanji1 = ( # TODO: finish this
Glyphs_Kanji = (
'', '', '', '', '', '', '', '', # 0x000
'', '', '', '', '', '', '', '', # 0x008
'', '', '', '', '', '', ' ', '', # 0x010
' ', ' ', ' ', '', '', '', '', ' ', # 0x018
'', '', '', '', '', ' ', '', ' ', # 0x020
' ', '', '', '', '', '使', '', '', # 0x028
'', '', '', '', '', '', ' ', ' ', # 0x030
'', ' ', ' ', ' ', '', ' ', ' ', ' ', # 0x038
'', '', '', '', '', '', '', '', # 0x010
'', '', '', '', '', '', '', '', # 0x018
'', '', '', '', '', '', '', '', # 0x020
'', '', '', '', '', '使', '', '', # 0x028
'', '', '', '', '', '', '', '', # 0x030
'', '', '', '', '', '', '', '', # 0x038
'', '', '', '', '', ' ', ' ', ' ', # 0x040
' ', ' ', ' ', ' ', ' ', '', ' ', ' ', # 0x048
'', '', '', '', ' ', ' ', '', '殿', # 0x050
' ', '', ' ', '', ' ', '', '', '', # 0x058
'', '', '', '', ' ', ' ', '', '', # 0x060
' ', '', ' ', ' ', ' ', ' ', '', '', # 0x068
'', '', '', ' ', ' ', ' ', ' ', '', # 0x070-7
' ', ' ', '', ' ', ' ', '', ' ', ' ', # 0x078-F
'', '', '', '', '', '', '', '', # 0x040
'', '', '', '', '', '', '', '', # 0x048
'', '', '', '', '', '', '', '殿', # 0x050
'', '', '', '', '', '', '', '', # 0x058
'', '', '', '', '', '', '', '', # 0x060
'', '', '', '', '', '', '', '', # 0x068
'', '', '', '', '', '', '', '', # 0x070
'', '', '', '', '', '', '', '', # 0x078
'', '', '', ' ', ' ', '', '', '', # 0x080
' ', ' ', '', ' ', '', ' ', ' ', ' ', # 0x088
'', '', '', ' ', ' ', '', ' ', ' ', # 0x090
' ', '', ' ', ' ', '', ' ', ' ', ' ', # 0x098
'', '', '', '', ' ', ' ', ' ', '', # 0x0A0
'', '', '', '西', ' ', '', '', ' ', # 0x0A8
'', '', '', ' ', ' ', ' ', '', ' ', # 0x0B0
' ', ' ', ' ', '', ' ', '', '', '', # 0x0B8
'', '', '', '', '', '', '', '', # 0x080
'', '', '', '', '', '', '', '姿', # 0x088
'', '', '', '', '', '', '', '', # 0x090
'', '', '', '', '', '', '', '', # 0x098
'', '', '', '', '', '', '', '', # 0x0A0
'', '', '', '西', '', '', '', '', # 0x0A8
'', '', '', '', '', '', '', '', # 0x0B0
'', '', '', '', '', '', '', '', # 0x0B8
'', '', '', '', ' ', ' ', '', '', # 0x0C0
' ', '', ' ', ' ', ' ', '', ' ', '', # 0x0C8
'', '', '', '', '', ' ', ' ', '', # 0x0D0
' ', '', ' ', ' ', ' ', ' ', '', ' ', # 0x0D8
'', '', '', '', ' ', '', ' ', ' ', # 0x0E0
'', '', ' ', ' ', ' ', ' ', ' ', ' ', # 0x0E8
'', '', '', ' ', ' ', ' ', '', ' ', # 0x0F0
' ', ' ', '', '宿', ' ', ' ', '', ' ', # 0x0F8
'', '', '', '', '', '', '', '', # 0x0C0
'', '', '', '', '', '', '', '', # 0x0C8
'', '', '', '', '', '', '', '', # 0x0D0
'', '', '', '', '', '', '', '', # 0x0D8
'', '', '', '', '', '', '', '', # 0x0E0
'', '', '', '', '', '', '', '', # 0x0E8
'', '', '', '', '', '', '', '', # 0x0F0
'', '', '', '宿', '', '', '', '', # 0x0F8
'', '', '', ' ', '', ' ', ' ', ' ', # 0x100
'', ' ', '', '', '', ' ', '', ' ', # 0x108
'', '', '', ' ', ' ', ' ', ' ', ' ', # 0x110
' ', ' ', ' ', ' ', ' ', ' ', ' ', '', # 0x118
'', '', '', ' ', ' ', ' ', ' ', ' ', # 0x120
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', # 0x128
'', '', '', ' ', ' ', ' ', ' ', ' ', # 0x130
'', ' ', ' ', ' ', '', '', ' ', ' ', # 0x138
'', '', '', '', '', '', '', '', # 0x100
'', '', '', '', '', '', '', '', # 0x108
'', '', '', '', '', '', '', '', # 0x110
'', '', '', '', '', '', '', '', # 0x118
'', '', '', '', '', '', '', '', # 0x120
'', '', '', '', '', '', '', '', # 0x128
'', '', '', '', '', '', '', '', # 0x130
'', '', '', '', '', '', '', '', # 0x138
'', '', ' ', ' ', ' ', ' ', ' ', ' ', # 0x140
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', # 0x148
'', '', '', ' ', ' ', ' ', ' ', '', # 0x150
' ', ' ', ' ', ' ', ' ', ' ', '', ' ', # 0x158
'', '', '', ' ', ' ', ' ', ' ', ' ', # 0x160
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', # 0x168
'', '', '', ' ', ' ', ' ', ' ', ' ', # 0x170
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', # 0x178
'', '', '', '', '', '', '', '', # 0x140
'', '', '', '', '', '', '', '', # 0x148
'', '', '', '', '', '', '', '', # 0x150
'', '', '', '', '', '', '', '', # 0x158
'', '', '', '', '', '', '', '', # 0x160
'', '', '', '', '', '', '', '', # 0x168
'', '', '', '', '', '', '', '', # 0x170
'', '', '', '', '', '', '', '', # 0x178
'', '', ' ', ' ', ' ', ' ', ' ', ' ', # 0x180
' ', '', ' ', ' ', ' ', ' ', ' ', '', # 0x188
'', '', '', ' ', ' ', ' ', ' ', ' ', # 0x190
' ', ' ', ' ', ' ', '', ' ', ' ', ' ', # 0x198
'', '', '', ' ', ' ', ' ', ' ', '', # 0x1A0
'', '', '', '', '', '', '', '', # 0x180
'', '', '', '', '', '', '', '', # 0x188
'', '', '', '', '', '', '', '', # 0x190
'', '', '', '', '', '', '', '', # 0x198
'', '', '', '', '', '', '', '', # 0x1A0
'', ' ') # 0x1A8
Glyphs_Kanji = [g if g != ' ' else '<${:03X}>'.format(i) for (i, g) in enumerate(Glyphs_Kanji1)] # This is only until they are fully transcribed
#Glyphs_Kanji = [g if g != ' ' else '<${:03X}>'.format(i) for (i, g) in enumerate(Glyphs_Kanji1)] # This is only until they are fully transcribed
Dialogue_Macros_EN = {
0x02: [0x61, 0x7A, 0x8B, 0x8D, 0x93], # expands to Bartz (or whatever his name is)

View File

@ -287,6 +287,7 @@ class Canvas:
return QPixmap.fromImage(self.image.copy(0, 0, self.max_x*8+8, self.max_y*8+8))
return QPixmap.fromImage(self.image)
def parse_struct(rom, offset, structure):
out = ["0x{:06X}".format(offset)]
j = 0
@ -299,6 +300,7 @@ def parse_struct(rom, offset, structure):
j += z[1]
return out
def make_enemy_sprites(rom):
sprites = []
for e_id in range(0, 0x180*5, 5):
@ -330,6 +332,7 @@ def make_enemy_sprites(rom):
sprites.append(sprite.pixmap(True))
return sprites
def make_character_battle_sprites(rom):
tile_address = 0x120000
palette_address = 0x14A3C0
@ -345,6 +348,7 @@ def make_character_battle_sprites(rom):
battle_strips.append(battle_strip.pixmap())
return battle_strips
def make_character_status_sprites(rom):
tile_address = 0x149400
palette_address = 0x14A660
@ -370,6 +374,7 @@ def make_character_status_sprites(rom):
pixmaps.append(frog_strip.pixmap())
return pixmaps
def make_string_img_small(bytestring, jp=False):
if len(bytestring) < 1:
raise ValueError('Empty bytestring was passed')
@ -396,6 +401,7 @@ def make_string_img_small(bytestring, jp=False):
del painter
return string, QPixmap.fromImage(img)
def make_string_img_large(bytestring, macros=None, jp=False):
'''
This is how we decipher dialogue data, which has multiple lines, macro expansions and kanji.
@ -455,6 +461,7 @@ def make_string_img_large(bytestring, macros=None, jp=False):
xmax = x if x > xmax else xmax
return string, QPixmap.fromImage(img.copy(0, 0, xmax, y+16))
def make_string_img_list(start, length, num, start_jp=None, len_jp=None, start_str=None, start_jp_str=None,
indirect=False, large=False, macros_en=None, macros_jp=None):
start_jp = start if start_jp is None else start_jp
@ -513,6 +520,7 @@ def make_string_img_list(start, length, num, start_jp=None, len_jp=None, start_s
stringlist.append(["0x{:06X}".format(j1), "0x{:0{}X}".format(id, id_digits), str_en, img_en, str_jp, img_jp])
return stringlist
def table_size_to_contents(table):
# Stupid hack to get table to size correctly
table.hide()
@ -523,6 +531,7 @@ def table_size_to_contents(table):
table.viewport().setGeometry(geometry)
table.show()
def make_table(headers, items, sortable=False, row_labels=True, scale=2):
"""
Helper function to tabulate 2d lists
@ -552,6 +561,7 @@ def make_table(headers, items, sortable=False, row_labels=True, scale=2):
table.sortItems(0)
return table
def make_pixmap_table(items, cols=16, scale=4):
rows = divceil(len(items), cols)
rd = hex_length(rows-1)+1