Hachimi-Hachimi / Hachimi

はちみーをなめると〜 Game enhancement and translation mod for Honse Game.
https://hachimi.leadrdrk.com
GNU General Public License v3.0
17 stars 0 forks source link

Story text ruby (pronunciation guides) are not being removed. #24

Closed KevinVG207 closed 2 months ago

KevinVG207 commented 3 months ago

Preferably, the ruby text should not be loaded or removed when the game attempts to load it, when the story text it belongs to has been translated.

image

Here's a snippet of my code from Carotene where I just update the assetbundle directly to remove the ruby data. You might be able to hook some function instead?

# Handle ruby text.
ruby_file_name = file_name.replace("storytimeline", "ast_ruby").replace("hometimeline_", "ast_ruby_hometimeline_")
with util.MetaConnection() as (conn, cursor):
    cursor.execute("SELECT h FROM a WHERE n = ?;", (ruby_file_name,))
    ruby_hash = cursor.fetchone()

if not ruby_hash:
    # No ruby asset for this story.
    return

ruby_path = handle_backup(ruby_hash[0])
ruby_bundle, _ = unity.load_assetbundle(ruby_path, ruby_hash[0])

for obj in ruby_bundle.assets[0].objects.values():
    tree = obj.read_typetree()
    if not tree.get('DataArray'):
        continue
    tree['DataArray'] = []
    obj.save_typetree(tree)
LeadRDRK commented 2 months ago

Note: Feature implemented behind the "remove_ruby" localized data config option.