#!/usr/bin/env python3

import os, struct, sys

ROM_FILE_NAME = 'baserom_uncompressed.z64'
FILE_TABLE_OFFSET = 0x1A500 # 0x1C110 for JP1.0, 0x1C050 for JP1.1, 0x24F60 for debug

FILE_NAMES = [
    'makerom',
    'boot',
    'dmadata',
    'Audiobank',
    'Audioseq',
    'Audiotable',
    'kanji',
    'link_animetion',
    'icon_item_static_old',
    'icon_item_24_static_old',
    'icon_item_field_static',
    'icon_item_dungeon_static',
    'icon_item_gameover_static',
    'icon_item_jpn_static',
    'icon_item_vtx_static',
    'map_i_static',
    'map_grand_static',
    'item_name_static',
    'map_name_static',
    'icon_item_static_test',
    'icon_item_24_static_test',
    'schedule_dma_static_old',
    'schedule_dma_static_test',
    'schedule_static',
    'story_static',
    'do_action_static',
    'message_static',
    'message_texture_static',
    'nes_font_static',
    'message_data_static',
    'staff_message_data_static',
    'code',
    'ovl_title',
    'ovl_select',
    'ovl_opening',
    'ovl_file_choose',
    'ovl_daytelop',
    'ovl_kaleido_scope',
    'ovl_Player_Actor',
    'ovl_En_Test',
    'ovl_En_GirlA',
    'ovl_En_Part',
    'ovl_En_Light',
    'ovl_En_Door',
    'ovl_En_Box',
    'ovl_En_Pametfrog',
    'ovl_En_Okuta',
    'ovl_En_Bom',
    'ovl_En_Wallmas',
    'ovl_En_Dodongo',
    'ovl_En_Firefly',
    'ovl_En_Horse',
    'ovl_En_Arrow',
    'ovl_En_Elf',
    'ovl_En_Niw',
    'ovl_En_Tite',
    'ovl_En_Peehat',
    'ovl_En_Holl',
    'ovl_En_Dinofos',
    'ovl_En_Hata',
    'ovl_En_Zl1',
    'ovl_En_Viewer',
    'ovl_En_Bubble',
    'ovl_Door_Shutter',
    'ovl_En_Boom',
    'ovl_En_Torch2',
    'ovl_En_Minifrog',
    'ovl_En_St',
    'ovl_Obj_Wturn',
    'ovl_En_River_Sound',
    'ovl_En_Ossan',
    'ovl_En_Famos',
    'ovl_En_Bombf',
    'ovl_En_Am',
    'ovl_En_Dekubaba',
    'ovl_En_M_Fire1',
    'ovl_En_M_Thunder',
    'ovl_Bg_Breakwall',
    'ovl_Door_Warp1',
    'ovl_Obj_Syokudai',
    'ovl_Item_B_Heart',
    'ovl_En_Dekunuts',
    'ovl_En_Bbfall',
    'ovl_Arms_Hook',
    'ovl_En_Bb',
    'ovl_Bg_Keikoku_Spr',
    'ovl_En_Wood02',
    'ovl_En_Death',
    'ovl_En_Minideath',
    'ovl_En_Vm',
    'ovl_Demo_Effect',
    'ovl_Demo_Kankyo',
    'ovl_En_Floormas',
    'ovl_En_Rd',
    'ovl_Bg_F40_Flift',
    'ovl_Obj_Mure',
    'ovl_En_Sw',
    'ovl_Object_Kankyo',
    'ovl_En_Horse_Link_Child',
    'ovl_Door_Ana',
    'ovl_En_Encount1',
    'ovl_Demo_Tre_Lgt',
    'ovl_En_Encount2',
    'ovl_En_Fire_Rock',
    'ovl_Bg_Ctower_Rot',
    'ovl_Mir_Ray',
    'ovl_En_Sb',
    'ovl_En_Bigslime',
    'ovl_En_Karebaba',
    'ovl_En_In',
    'ovl_En_Bom_Chu',
    'ovl_En_Horse_Game_Check',
    'ovl_En_Rr',
    'ovl_En_Fr',
    'ovl_En_Fishing',
    'ovl_Obj_Oshihiki',
    'ovl_Eff_Dust',
    'ovl_Bg_Umajump',
    'ovl_En_Insect',
    'ovl_En_Butte',
    'ovl_En_Fish',
    'ovl_Item_Etcetera',
    'ovl_Arrow_Fire',
    'ovl_Arrow_Ice',
    'ovl_Arrow_Light',
    'ovl_Obj_Kibako',
    'ovl_Obj_Tsubo',
    'ovl_En_Ik',
    'ovl_Demo_Shd',
    'ovl_En_Dns',
    'ovl_Elf_Msg',
    'ovl_En_Honotrap',
    'ovl_En_Tubo_Trap',
    'ovl_Obj_Ice_Poly',
    'ovl_En_Fz',
    'ovl_En_Kusa',
    'ovl_Obj_Bean',
    'ovl_Obj_Bombiwa',
    'ovl_Obj_Switch',
    'ovl_Obj_Lift',
    'ovl_Obj_Hsblock',
    'ovl_En_Okarina_Tag',
    'ovl_En_Goroiwa',
    'ovl_En_Daiku',
    'ovl_En_Nwc',
    'ovl_Item_Inbox',
    'ovl_En_Ge1',
    'ovl_Obj_Blockstop',
    'ovl_En_Sda',
    'ovl_En_Clear_Tag',
    'ovl_En_Gm',
    'ovl_En_Ms',
    'ovl_En_Hs',
    'ovl_Bg_Ingate',
    'ovl_En_Kanban',
    'ovl_En_Attack_Niw',
    'ovl_En_Mk',
    'ovl_En_Owl',
    'ovl_En_Ishi',
    'ovl_Obj_Hana',
    'ovl_Obj_Lightswitch',
    'ovl_Obj_Mure2',
    'ovl_En_Fu',
    'ovl_En_Stream',
    'ovl_En_Mm',
    'ovl_En_Weather_Tag',
    'ovl_En_Ani',
    'ovl_En_Js',
    'ovl_En_Okarina_Effect',
    'ovl_En_Mag',
    'ovl_Elf_Msg2',
    'ovl_Bg_F40_Swlift',
    'ovl_En_Kakasi',
    'ovl_Obj_Makeoshihiki',
    'ovl_Oceff_Spot',
    'ovl_En_Torch',
    'ovl_Shot_Sun',
    'ovl_Obj_Roomtimer',
    'ovl_En_Ssh',
    'ovl_Oceff_Wipe',
    'ovl_Effect_Ss_Dust',
    'ovl_Effect_Ss_Kirakira',
    'ovl_Effect_Ss_Bomb2',
    'ovl_Effect_Ss_Blast',
    'ovl_Effect_Ss_G_Spk',
    'ovl_Effect_Ss_D_Fire',
    'ovl_Effect_Ss_Bubble',
    'ovl_Effect_Ss_G_Ripple',
    'ovl_Effect_Ss_G_Splash',
    'ovl_Effect_Ss_G_Fire',
    'ovl_Effect_Ss_Lightning',
    'ovl_Effect_Ss_Dt_Bubble',
    'ovl_Effect_Ss_Hahen',
    'ovl_Effect_Ss_Stick',
    'ovl_Effect_Ss_Sibuki',
    'ovl_Effect_Ss_Stone1',
    'ovl_Effect_Ss_Hitmark',
    'ovl_Effect_Ss_Fhg_Flash',
    'ovl_Effect_Ss_K_Fire',
    'ovl_Effect_Ss_Solder_Srch_Ball',
    'ovl_Effect_Ss_Kakera',
    'ovl_Effect_Ss_Ice_Piece',
    'ovl_Effect_Ss_En_Ice',
    'ovl_Effect_Ss_Fire_Tail',
    'ovl_Effect_Ss_En_Fire',
    'ovl_Effect_Ss_Extra',
    'ovl_Effect_Ss_Dead_Db',
    'ovl_Effect_Ss_Dead_Dd',
    'ovl_Effect_Ss_Dead_Ds',
    'ovl_Oceff_Storm',
    'ovl_Obj_Demo',
    'ovl_En_Minislime',
    'ovl_En_Nutsball',
    'ovl_Oceff_Wipe2',
    'ovl_Oceff_Wipe3',
    'ovl_En_Dg',
    'ovl_En_Si',
    'ovl_Obj_Comb',
    'ovl_Obj_Kibako2',
    'ovl_En_Hs2',
    'ovl_Obj_Mure3',
    'ovl_En_Tg',
    'ovl_En_Wf',
    'ovl_En_Skb',
    'ovl_En_Gs',
    'ovl_Obj_Sound',
    'ovl_En_Crow',
    'ovl_En_Cow',
    'ovl_Oceff_Wipe4',
    'ovl_En_Zo',
    'ovl_Effect_Ss_Ice_Smoke',
    'ovl_Obj_Makekinsuta',
    'ovl_En_Ge3',
    'ovl_Obj_Hamishi',
    'ovl_En_Zl4',
    'ovl_En_Mm2',
    'ovl_Door_Spiral',
    'ovl_Obj_Pzlblock',
    'ovl_Obj_Toge',
    'ovl_Obj_Armos',
    'ovl_Obj_Boyo',
    'ovl_En_Grasshopper',
    'ovl_Obj_Grass',
    'ovl_Obj_Grass_Carry',
    'ovl_Obj_Grass_Unit',
    'ovl_Bg_Fire_Wall',
    'ovl_En_Bu',
    'ovl_En_Encount3',
    'ovl_En_Jso',
    'ovl_Obj_Chikuwa',
    'ovl_En_Knight',
    'ovl_En_Warp_tag',
    'ovl_En_Aob_01',
    'ovl_En_Boj_01',
    'ovl_En_Boj_02',
    'ovl_En_Boj_03',
    'ovl_En_Encount4',
    'ovl_En_Bom_Bowl_Man',
    'ovl_En_Syateki_Man',
    'ovl_Bg_Icicle',
    'ovl_En_Syateki_Crow',
    'ovl_En_Boj_04',
    'ovl_En_Cne_01',
    'ovl_En_Bba_01',
    'ovl_En_Bji_01',
    'ovl_Bg_Spdweb',
    'ovl_En_Mt_tag',
    'ovl_Boss_01',
    'ovl_Boss_02',
    'ovl_Boss_03',
    'ovl_Boss_04',
    'ovl_Boss_05',
    'ovl_Boss_06',
    'ovl_Boss_07',
    'ovl_Bg_Dy_Yoseizo',
    'ovl_En_Boj_05',
    'ovl_En_Sob1',
    'ovl_En_Go',
    'ovl_En_Raf',
    'ovl_Obj_Funen',
    'ovl_Obj_Raillift',
    'ovl_Bg_Numa_Hana',
    'ovl_Obj_Flowerpot',
    'ovl_Obj_Spinyroll',
    'ovl_Dm_Hina',
    'ovl_En_Syateki_Wf',
    'ovl_Obj_Skateblock',
    'ovl_Effect_En_Ice_Block',
    'ovl_Obj_Iceblock',
    'ovl_En_Bigpamet',
    'ovl_Bg_Dblue_Movebg',
    'ovl_En_Syateki_Dekunuts',
    'ovl_Elf_Msg3',
    'ovl_En_Fg',
    'ovl_Dm_Ravine',
    'ovl_Dm_Sa',
    'ovl_En_Slime',
    'ovl_En_Pr',
    'ovl_Obj_Toudai',
    'ovl_Obj_Entotu',
    'ovl_Obj_Bell',
    'ovl_En_Syateki_Okuta',
    'ovl_Obj_Shutter',
    'ovl_Dm_Zl',
    'ovl_En_Ru',
    'ovl_En_Elfgrp',
    'ovl_Dm_Tsg',
    'ovl_En_Baguo',
    'ovl_Obj_Vspinyroll',
    'ovl_Obj_Smork',
    'ovl_En_Test2',
    'ovl_En_Test3',
    'ovl_En_Test4',
    'ovl_En_Bat',
    'ovl_En_Sekihi',
    'ovl_En_Wiz',
    'ovl_En_Wiz_Brock',
    'ovl_En_Wiz_Fire',
    'ovl_Eff_Change',
    'ovl_Dm_Statue',
    'ovl_Obj_Fireshield',
    'ovl_Bg_Ladder',
    'ovl_En_Mkk',
    'ovl_Demo_Getitem',
    'ovl_En_Dnb',
    'ovl_En_Dnh',
    'ovl_En_Dnk',
    'ovl_En_Dnq',
    'ovl_Bg_Keikoku_Saku',
    'ovl_Obj_Hugebombiwa',
    'ovl_En_Firefly2',
    'ovl_En_Rat',
    'ovl_En_Water_Effect',
    'ovl_En_Kusa2',
    'ovl_Bg_Spout_Fire',
    'ovl_En_Dy_Extra',
    'ovl_En_Bal',
    'ovl_En_Ginko_Man',
    'ovl_En_Warp_Uzu',
    'ovl_Obj_Driftice',
    'ovl_En_Look_Nuts',
    'ovl_En_Mushi2',
    'ovl_En_Fall',
    'ovl_En_Mm3',
    'ovl_Bg_Crace_Movebg',
    'ovl_En_Dno',
    'ovl_En_Pr2',
    'ovl_En_Prz',
    'ovl_En_Jso2',
    'ovl_Obj_Etcetera',
    'ovl_En_Egol',
    'ovl_Obj_Mine',
    'ovl_Obj_Purify',
    'ovl_En_Tru',
    'ovl_En_Trt',
    'ovl_En_Test5',
    'ovl_En_Test6',
    'ovl_En_Az',
    'ovl_En_Estone',
    'ovl_Bg_Hakugin_Post',
    'ovl_Dm_Opstage',
    'ovl_Dm_Stk',
    'ovl_Dm_Char00',
    'ovl_Dm_Char01',
    'ovl_Dm_Char02',
    'ovl_Dm_Char03',
    'ovl_Dm_Char04',
    'ovl_Dm_Char05',
    'ovl_Dm_Char06',
    'ovl_Dm_Char07',
    'ovl_Dm_Char08',
    'ovl_Dm_Char09',
    'ovl_Obj_Tokeidai',
    'ovl_En_Mnk',
    'ovl_En_Egblock',
    'ovl_En_Guard_Nuts',
    'ovl_Bg_Hakugin_Bombwall',
    'ovl_Obj_Tokei_Tobira',
    'ovl_Bg_Hakugin_Elvpole',
    'ovl_En_Ma4',
    'ovl_En_Twig',
    'ovl_En_Po_Fusen',
    'ovl_En_Door_Etc',
    'ovl_En_Bigokuta',
    'ovl_Bg_Icefloe',
    'ovl_fbdemo_triforce',
    'ovl_fbdemo_wipe1',
    'ovl_fbdemo_wipe3',
    'ovl_fbdemo_wipe4',
    'ovl_fbdemo_wipe5',
    'ovl_Effect_Ss_Sbn',
    'ovl_Obj_Ocarinalift',
    'ovl_En_Time_Tag',
    'ovl_Bg_Open_Shutter',
    'ovl_Bg_Open_Spot',
    'ovl_Bg_Fu_Kaiten',
    'ovl_Obj_Aqua',
    'ovl_En_Elforg',
    'ovl_En_Elfbub',
    'ovl_En_Fu_Mato',
    'ovl_En_Fu_Kago',
    'ovl_En_Osn',
    'ovl_Bg_Ctower_Gear',
    'ovl_En_Trt2',
    'ovl_Obj_Tokei_Step',
    'ovl_Bg_Lotus',
    'ovl_En_Kame',
    'ovl_Obj_Takaraya_Wall',
    'ovl_Bg_Fu_Mizu',
    'ovl_En_Sellnuts',
    'ovl_Bg_Dkjail_Ivy',
    'ovl_Obj_Visiblock',
    'ovl_En_Takaraya',
    'ovl_En_Tsn',
    'ovl_En_Ds2n',
    'ovl_En_Fsn',
    'ovl_En_Shn',
    'ovl_En_Stop_heishi',
    'ovl_Obj_Bigicicle',
    'ovl_En_Lift_Nuts',
    'ovl_En_Tk',
    'ovl_Bg_Market_Step',
    'ovl_Obj_Lupygamelift',
    'ovl_En_Test7',
    'ovl_Obj_Lightblock',
    'ovl_Mir_Ray2',
    'ovl_En_Wdhand',
    'ovl_En_Gamelupy',
    'ovl_Bg_Danpei_Movebg',
    'ovl_En_Snowwd',
    'ovl_En_Pm',
    'ovl_En_Gakufu',
    'ovl_Elf_Msg4',
    'ovl_Elf_Msg5',
    'ovl_En_Col_Man',
    'ovl_En_Talk_Gibud',
    'ovl_En_Giant',
    'ovl_Obj_Snowball',
    'ovl_Boss_Hakugin',
    'ovl_En_Gb2',
    'ovl_En_Onpuman',
    'ovl_Bg_Tobira01',
    'ovl_En_Tag_Obj',
    'ovl_Obj_Dhouse',
    'ovl_Obj_Hakaisi',
    'ovl_Bg_Hakugin_Switch',
    'ovl_En_Snowman',
    'ovl_TG_Sw',
    'ovl_En_Po_Sisters',
    'ovl_En_Pp',
    'ovl_En_Hakurock',
    'ovl_En_Hanabi',
    'ovl_Obj_Dowsing',
    'ovl_Obj_Wind',
    'ovl_En_Racedog',
    'ovl_En_Kendo_Js',
    'ovl_Bg_Botihasira',
    'ovl_En_Fish2',
    'ovl_En_Pst',
    'ovl_En_Poh',
    'ovl_Obj_Spidertent',
    'ovl_En_Zoraegg',
    'ovl_En_Kbt',
    'ovl_En_Gg',
    'ovl_En_Maruta',
    'ovl_Obj_Snowball2',
    'ovl_En_Gg2',
    'ovl_Obj_Ghaka',
    'ovl_En_Dnp',
    'ovl_En_Dai',
    'ovl_Bg_Goron_Oyu',
    'ovl_En_Kgy',
    'ovl_En_Invadepoh',
    'ovl_En_Gk',
    'ovl_En_An',
    'ovl_En_Bee',
    'ovl_En_Ot',
    'ovl_En_Dragon',
    'ovl_Obj_Dora',
    'ovl_En_Bigpo',
    'ovl_Obj_Kendo_Kanban',
    'ovl_Obj_Hariko',
    'ovl_En_Sth',
    'ovl_Bg_Sinkai_Kabe',
    'ovl_Bg_Haka_Curtain',
    'ovl_Bg_Kin2_Bombwall',
    'ovl_Bg_Kin2_Fence',
    'ovl_Bg_Kin2_Picture',
    'ovl_Bg_Kin2_Shelf',
    'ovl_En_Rail_Skb',
    'ovl_En_Jg',
    'ovl_En_Tru_Mt',
    'ovl_Obj_Um',
    'ovl_En_Neo_Reeba',
    'ovl_Bg_Mbar_Chair',
    'ovl_Bg_Ikana_Block',
    'ovl_Bg_Ikana_Mirror',
    'ovl_Bg_Ikana_Rotaryroom',
    'ovl_Bg_Dblue_Balance',
    'ovl_Bg_Dblue_Waterfall',
    'ovl_En_Kaizoku',
    'ovl_En_Ge2',
    'ovl_En_Ma_Yts',
    'ovl_En_Ma_Yto',
    'ovl_Obj_Tokei_Turret',
    'ovl_Bg_Dblue_Elevator',
    'ovl_Obj_Warpstone',
    'ovl_En_Zog',
    'ovl_Obj_Rotlift',
    'ovl_Obj_Jg_Gakki',
    'ovl_Bg_Inibs_Movebg',
    'ovl_En_Zot',
    'ovl_Obj_Tree',
    'ovl_Obj_Y2lift',
    'ovl_Obj_Y2shutter',
    'ovl_Obj_Boat',
    'ovl_Obj_Taru',
    'ovl_Obj_Hunsui',
    'ovl_En_Jc_Mato',
    'ovl_Mir_Ray3',
    'ovl_En_Zob',
    'ovl_Elf_Msg6',
    'ovl_Obj_Nozoki',
    'ovl_En_Toto',
    'ovl_En_Railgibud',
    'ovl_En_Baba',
    'ovl_En_Suttari',
    'ovl_En_Zod',
    'ovl_En_Kujiya',
    'ovl_En_Geg',
    'ovl_Obj_Kinoko',
    'ovl_Obj_Yasi',
    'ovl_En_Tanron1',
    'ovl_En_Tanron2',
    'ovl_En_Tanron3',
    'ovl_Obj_Chan',
    'ovl_En_Zos',
    'ovl_En_S_Goro',
    'ovl_En_Nb',
    'ovl_En_Ja',
    'ovl_Bg_F40_Block',
    'ovl_Bg_F40_Switch',
    'ovl_En_Po_Composer',
    'ovl_En_Guruguru',
    'ovl_Oceff_Wipe5',
    'ovl_En_Stone_heishi',
    'ovl_Oceff_Wipe6',
    'ovl_En_Scopenuts',
    'ovl_En_Scopecrow',
    'ovl_Oceff_Wipe7',
    'ovl_Eff_Kamejima_Wave',
    'ovl_En_Hg',
    'ovl_En_Hgo',
    'ovl_En_Zov',
    'ovl_En_Ah',
    'ovl_Obj_Hgdoor',
    'ovl_Bg_Ikana_Bombwall',
    'ovl_Bg_Ikana_Ray',
    'ovl_Bg_Ikana_Shutter',
    'ovl_Bg_Haka_Bombwall',
    'ovl_Bg_Haka_Tomb',
    'ovl_En_Sc_Ruppe',
    'ovl_Bg_Iknv_Doukutu',
    'ovl_Bg_Iknv_Obj',
    'ovl_En_Pamera',
    'ovl_Obj_HsStump',
    'ovl_En_Hidden_Nuts',
    'ovl_En_Zow',
    'ovl_En_Talk',
    'ovl_En_Al',
    'ovl_En_Tab',
    'ovl_En_Nimotsu',
    'ovl_En_Hit_Tag',
    'ovl_En_Ruppecrow',
    'ovl_En_Tanron4',
    'ovl_En_Tanron5',
    'ovl_En_Tanron6',
    'ovl_En_Daiku2',
    'ovl_En_Muto',
    'ovl_En_Baisen',
    'ovl_En_Heishi',
    'ovl_En_Demo_heishi',
    'ovl_En_Dt',
    'ovl_En_Cha',
    'ovl_Obj_Dinner',
    'ovl_Eff_Lastday',
    'ovl_Bg_Ikana_Dharma',
    'ovl_En_Akindonuts',
    'ovl_Eff_Stk',
    'ovl_En_Ig',
    'ovl_En_Rg',
    'ovl_En_Osk',
    'ovl_En_Sth2',
    'ovl_En_Yb',
    'ovl_En_Rz',
    'ovl_En_Scopecoin',
    'ovl_En_Bjt',
    'ovl_En_Bomjima',
    'ovl_En_Bomjimb',
    'ovl_En_Bombers',
    'ovl_En_Bombers2',
    'ovl_En_Bombal',
    'ovl_Obj_Moon_Stone',
    'ovl_Obj_Mu_Pict',
    'ovl_Bg_Ikninside',
    'ovl_Eff_Zoraband',
    'ovl_Obj_Kepn_Koya',
    'ovl_Obj_Usiyane',
    'ovl_En_Nnh',
    'ovl_Obj_Kzsaku',
    'ovl_Obj_Milk_Bin',
    'ovl_En_Kitan',
    'ovl_Bg_Astr_Bombwall',
    'ovl_Bg_Iknin_Susceil',
    'ovl_En_Bsb',
    'ovl_En_Recepgirl',
    'ovl_En_Thiefbird',
    'ovl_En_Jgame_Tsn',
    'ovl_Obj_Jgame_Light',
    'ovl_Obj_Yado',
    'ovl_Demo_Syoten',
    'ovl_Demo_Moonend',
    'ovl_Bg_Lbfshot',
    'ovl_Bg_Last_Bwall',
    'ovl_En_And',
    'ovl_En_Invadepoh_Demo',
    'ovl_Obj_Danpeilift',
    'ovl_En_Fall2',
    'ovl_Dm_Al',
    'ovl_Dm_An',
    'ovl_Dm_Ah',
    'ovl_Dm_Nb',
    'ovl_En_Drs',
    'ovl_En_Ending_Hero',
    'ovl_Dm_Bal',
    'ovl_En_Paper',
    'ovl_En_Hint_Skb',
    'ovl_Dm_Tag',
    'ovl_En_Bh',
    'ovl_En_Ending_Hero2',
    'ovl_En_Ending_Hero3',
    'ovl_En_Ending_Hero4',
    'ovl_En_Ending_Hero5',
    'ovl_En_Ending_Hero6',
    'ovl_Dm_Gm',
    'ovl_Obj_Swprize',
    'ovl_En_Invisible_Ruppe',
    'ovl_Obj_Ending',
    'ovl_En_Rsn',
    'gameplay_keep',
    'gameplay_field_keep',
    'gameplay_dangeon_keep',
    'gameplay_object_exchange_static',
    'object_link_boy',
    'object_link_child',
    'object_link_goron',
    'object_link_zora',
    'object_link_nuts',
    'object_mask_ki_tan',
    'object_mask_rabit',
    'object_mask_skj',
    'object_mask_truth',
    'object_mask_gibudo',
    'object_mask_json',
    'object_mask_kerfay',
    'object_mask_bigelf',
    'object_mask_kyojin',
    'object_mask_romerny',
    'object_mask_posthat',
    'object_mask_zacho',
    'object_mask_stone',
    'object_mask_bree',
    'object_mask_gero',
    'object_mask_yofukasi',
    'object_mask_meoto',
    'object_mask_dancer',
    'object_mask_bakuretu',
    'object_mask_bu_san',
    'object_mask_goron',
    'object_mask_zora',
    'object_mask_nuts',
    'object_mask_boy',
    'object_box',
    'object_okuta',
    'object_wallmaster',
    'object_dy_obj',
    'object_firefly',
    'object_dodongo',
    'object_niw',
    'object_tite',
    'object_ph',
    'object_dinofos',
    'object_zl1',
    'object_bubble',
    'object_test3',
    'object_famos',
    'object_st',
    'object_thiefbird',
    'object_bombf',
    'object_am',
    'object_dekubaba',
    'object_warp1',
    'object_b_heart',
    'object_dekunuts',
    'object_bb',
    'object_death',
    'object_hata',
    'object_wood02',
    'object_trap',
    'object_vm',
    'object_efc_star_field',
    'object_rd',
    'object_yukimura_obj',
    # skip object_heavy_object (in JP)
    'object_horse_link_child',
    'object_syokudai',
    'object_efc_tw',
    'object_gi_key',
    'object_mir_ray',
    'object_ctower_rot',
    'object_bdoor',
    'object_sb',
    'object_gi_melody',
    'object_gi_heart',
    'object_gi_compass',
    'object_gi_bosskey',
    'object_gi_nuts',
    'object_gi_hearts',
    'object_gi_arrowcase',
    'object_gi_bombpouch',
    'object_in',
    'object_os_anime',
    'object_gi_bottle',
    'object_gi_stick',
    'object_gi_map',
    'object_oF1d_map',
    'object_ru2',
    'object_gi_magicpot',
    'object_gi_bomb_1',
    'object_ma2',
    'object_gi_purse',
    'object_rr',
    'object_gi_arrow',
    'object_gi_bomb_2',
    'object_gi_shield_2',
    'object_gi_hookshot',
    'object_gi_ocarina',
    'object_gi_milk',
    'object_ma1',
    'object_ny',
    'object_fr',
    'object_gi_bow',
    'object_gi_glasses',
    'object_gi_liquid',
    'object_ani',
    'object_gi_shield_3',
    'object_gi_bean',
    'object_gi_fish',
    'object_gi_longsword',
    'object_zo',
    'object_umajump',
    'object_mastergolon',
    'object_masterzoora',
    'object_aob',
    'object_ik',
    'object_ahg',
    'object_cne',
    'object_bji',
    'object_bba',
    'object_an1',
    'object_boj',
    'object_fz',
    'object_bob',
    'object_ge1',
    'object_yabusame_point',
    'object_d_hsblock',
    'object_d_lift',
    'object_mamenoki',
    'object_goroiwa',
    'object_toryo',
    'object_daiku',
    'object_nwc',
    'object_gm',
    'object_ms',
    'object_hs',
    'object_lightswitch',
    'object_kusa',
    'object_tsubo',
    'object_kanban',
    'object_owl',
    'object_mk',
    'object_fu',
    'object_gi_ki_tan_mask',
    'object_gi_mask18',
    'object_gi_rabit_mask',
    'object_gi_truth_mask',
    'object_stream',
    'object_mm',
    'object_js',
    'object_cs',
    'object_gi_soldout',
    'object_mag',
    'object_gi_golonmask',
    'object_gi_zoramask',
    'object_ka',
    'object_zg',
    'object_gi_m_arrow',
    'object_ds2',
    'object_fish',
    'object_gi_sutaru',
    'object_ssh',
    'object_bigslime',
    'object_bg',
    'object_bombiwa',
    'object_hintnuts',
    'object_rs',
    'object_gla',
    'object_geldb',
    'object_dog',
    'object_kibako2',
    'object_dns',
    'object_dnk',
    'object_gi_insect',
    'object_gi_ghost',
    'object_gi_soul',
    'object_f40_obj',
    'object_gi_rupy',
    'object_po_composer',
    'object_mu',
    'object_wf',
    'object_skb',
    'object_gs',
    'object_ps',
    'object_omoya_obj',
    'object_crow',
    'object_cow',
    'object_gi_sword_1',
    'object_zl4',
    'object_grasshopper',
    'object_boyo',
    'object_fwall',
    'object_jso',
    'object_knight',
    'object_icicle',
    'object_spdweb',
    'object_boss01',
    'object_boss02',
    'object_boss03',
    'object_boss04',
    'object_boss05',
    'object_boss07',
    'object_raf',
    'object_funen',
    'object_raillift',
    'object_numa_obj',
    'object_flowerpot',
    'object_spinyroll',
    'object_ice_block',
    'object_keikoku_demo',
    'object_slime',
    'object_pr',
    'object_f52_obj',
    'object_f53_obj',
    'object_kibako',
    'object_sek',
    'object_gmo',
    'object_bat',
    'object_sekihil',
    'object_sekihig',
    'object_sekihin',
    'object_sekihiz',
    'object_wiz',
    'object_ladder',
    'object_mkk',
    'object_keikoku_obj',
    'object_sichitai_obj',
    'object_dekucity_ana_obj',
    'object_rat',
    'object_water_effect',
    'object_dblue_object',
    'object_bal',
    'object_warp_uzu',
    'object_driftice',
    'object_fall',
    'object_hanareyama_obj',
    'object_crace_object',
    'object_dnq',
    'object_obj_tokeidai',
    'object_eg',
    'object_tru',
    'object_trt',
    'object_hakugin_obj',
    'object_horse_game_check',
    'object_stk',
    'object_mnk',
    'object_gi_bottle_red',
    'object_tokei_tobira',
    'object_az',
    'object_twig',
    'object_dekucity_obj',
    'object_po_fusen',
    'object_racetsubo',
    'object_ha',
    'object_bigokuta',
    'object_open_obj',
    'object_fu_kaiten',
    'object_fu_mato',
    'object_mtoride',
    'object_osn',
    'object_tokei_step',
    'object_lotus',
    'object_tl',
    'object_dkjail_obj',
    'object_visiblock',
    'object_tsn',
    'object_ds2n',
    'object_fsn',
    'object_shn',
    'object_bigicicle',
    'object_gi_bottle_15',
    'object_tk',
    'object_market_obj',
    'object_gi_reserve00',
    'object_gi_reserve01',
    'object_lightblock',
    'object_takaraya_objects',
    'object_wdhand',
    'object_sdn',
    'object_snowwd',
    'object_giant',
    'object_comb',
    'object_hana',
    'object_boss_hakugin',
    'object_meganeana_obj',
    'object_gi_nutsmask',
    'object_stk2',
    'object_spot11_obj',
    'object_danpei_object',
    'object_dhouse',
    'object_hakaisi',
    'object_po',
    'object_snowman',
    'object_po_sisters',
    'object_pp',
    'object_goronswitch',
    'object_delf',
    'object_botihasira',
    'object_gi_bigbomb',
    'object_pst',
    'object_bsmask',
    'object_spidertent',
    'object_zoraegg',
    'object_kbt',
    'object_gg',
    'object_maruta',
    'object_ghaka',
    'object_oyu',
    'object_dnp',
    'object_dai',
    'object_kgy',
    'object_fb',
    'object_taisou',
    'object_gk',
    'object_haka_obj',
    'object_dnt',
    'object_yukiyama',
    'object_icefloe',
    'object_gi_gold_dust',
    'object_gi_bottle_16',
    'object_gi_bottle_22',
    'object_bee',
    'object_ot',
    'object_utubo',
    'object_dora',
    'object_gi_loach',
    'object_gi_seahorse',
    'object_bigpo',
    'object_hariko',
    'object_dno',
    'object_sinkai_kabe',
    'object_kin2_obj',
    'object_ishi',
    'object_hakugin_demo',
    'object_jg',
    'object_gi_sword_2',
    'object_gi_sword_3',
    'object_gi_sword_4',
    'object_um',
    'object_rb',
    'object_mbar_obj',
    'object_ikana_obj',
    'object_kz',
    'object_tokei_turret',
    'object_zog',
    'object_rotlift',
    'object_posthouse_obj',
    'object_gi_mask09',
    'object_gi_mask14',
    'object_gi_mask15',
    'object_inibs_object',
    'object_tree',
    'object_kaizoku_obj',
    'object_gi_reserve_b_00',
    'object_gi_reserve_c_00',
    'object_zob',
    'object_milkbar',
    'object_dmask',
    'object_gi_reserve_c_01',
    'object_zod',
    'object_kumo30',
    'object_obj_yasi',
    'object_tanron1',
    'object_tanron2',
    'object_tanron3',
    'object_gi_magicmushroom',
    'object_obj_chan',
    'object_gi_mask10',
    'object_zos',
    'object_an2',
    'object_an3',
    'object_f40_switch',
    'object_lodmoon',
    'object_tro',
    'object_gi_mask12',
    'object_gi_mask23',
    'object_gi_bottle_21',
    'object_gi_camera',
    'object_kamejima',
    'object_nb',
    'object_harfgibud',
    'object_zov',
    'object_ah',
    'object_hgdoor',
    'object_dor01',
    'object_dor02',
    'object_dor03',
    'object_dor04',
    'object_last_obj',
    'object_redead_obj',
    'object_ikninside_obj',
    'object_iknv_obj',
    'object_pamera',
    'object_hsstump',
    'object_zm',
    'object_al',
    'object_tab',
    'object_secom_obj',
    'object_dt',
    'object_gi_mask03',
    'object_cha',
    'object_obj_dinner',
    'object_gi_reserve_b_01',
    'object_lastday',
    'object_bai',
    'object_ikn_demo',
    'object_gi_fieldmap',
    'object_big_fwall',
    'object_hunsui',
    'object_uch',
    'object_tanron4',
    'object_tanron5',
    'object_in2',
    'object_yb',
    'object_rz',
    'object_bjt',
    'object_taru',
    'object_moonston',
    'object_gi_schedule',
    'object_gi_stonemask',
    'object_zoraband',
    'object_kepn_koya',
    'object_obj_usiyane',
    'object_gi_mask05',
    'object_gi_mask11',
    'object_gi_mask20',
    'object_nnh',
    'object_kzsaku',
    'object_obj_milk_bin',
    'object_random_obj',
    'object_kujiya',
    'object_kitan',
    'object_gi_mask06',
    'object_gi_mask16',
    'object_astr_obj',
    'object_bsb',
    'object_fall2',
    'object_sth',
    'object_gi_mssa',
    'object_smtower',
    'object_gi_mask21',
    'object_yado_obj',
    'object_syoten',
    'object_moonend',
    'object_ob',
    'object_gi_bottle_04',
    'object_and',
    'object_obj_danpeilift',
    'object_drs',
    'object_msmo',
    'object_an4',
    'object_wdor01',
    'object_wdor02',
    'object_wdor03',
    'object_wdor04',
    'object_wdor05',
    'object_stk3',
    'object_kinsta1_obj',
    'object_kinsta2_obj',
    'object_bh',
    'object_gi_mask17',
    'object_gi_mask22',
    'object_lbfshot',
    'object_fusen',
    'object_ending_obj',
    'object_gi_mask13',
    'scene_texture_01', # Map Textures - Building Interiors I
    'scene_texture_02', # Map Textures - Building Interiors II
    'scene_texture_03', # Map Textures - Lost Woods
    'scene_texture_04', # Map Textures - Mountains
    'scene_texture_05', # Map Textures - Ocean
    'scene_texture_06', # Map Textures - Swamp
    'scene_texture_07',
    'scene_texture_08', # Map Textures - Field
    'nintendo_rogo_static',
    'title_static',
    'memerrmsg',
    'locerrmsg',
    'parameter_static',
    'week_static',
    'daytelop_static',
    'ger_daytelop_static',
    'fra_daytelop_static',
    'esp_daytelop_static',
    'd2_fine_static',
    'd2_cloud_static',
    'd2_fine_pal_static',
    'elf_message_field',
    'elf_message_ydan',
    'Z2_20SICHITAI2',
    'Z2_20SICHITAI2_room_00',
    'Z2_20SICHITAI2_room_01',
    'Z2_20SICHITAI2_room_02',
    'Z2_WITCH_SHOP',
    'Z2_WITCH_SHOP_room_00',
    'Z2_LAST_BS',
    'Z2_LAST_BS_room_00',
    'Z2_HAKASHITA',
    'Z2_HAKASHITA_room_00',
    'Z2_HAKASHITA_room_01',
    'Z2_HAKASHITA_room_02',
    'Z2_HAKASHITA_room_03',
    'Z2_HAKASHITA_room_04',
    'Z2_AYASHIISHOP',
    'Z2_AYASHIISHOP_room_00',
    'Z2_AYASHIISHOP_room_01',
    'Z2_OMOYA',
    'Z2_OMOYA_room_00',
    'Z2_OMOYA_room_01',
    'Z2_OMOYA_room_02',
    'Z2_BOWLING',
    'Z2_BOWLING_room_00',
    'Z2_SONCHONOIE',
    'Z2_SONCHONOIE_room_00',
    'Z2_SONCHONOIE_room_01',
    'Z2_SONCHONOIE_room_02',
    'Z2_SONCHONOIE_room_03',
    'Z2_IKANA',
    'Z2_IKANA_room_00',
    'Z2_IKANA_room_01',
    'Z2_IKANA_room_02',
    'Z2_IKANA_room_03',
    'Z2_IKANA_room_04',
    'Z2_KAIZOKU',
    'Z2_KAIZOKU_room_00',
    'Z2_MILK_BAR',
    'Z2_MILK_BAR_room_00',
    'Z2_INISIE_N',
    'Z2_INISIE_N_room_00',
    'Z2_INISIE_N_room_01',
    'Z2_INISIE_N_room_02',
    'Z2_INISIE_N_room_03',
    'Z2_INISIE_N_room_04',
    'Z2_INISIE_N_room_05',
    'Z2_INISIE_N_room_06',
    'Z2_INISIE_N_room_07',
    'Z2_INISIE_N_room_08',
    'Z2_INISIE_N_room_09',
    'Z2_INISIE_N_room_10',
    'Z2_INISIE_N_room_11',
    'Z2_TAKARAYA',
    'Z2_TAKARAYA_room_00',
    'Z2_INISIE_R',
    'Z2_INISIE_R_room_00',
    'Z2_INISIE_R_room_01',
    'Z2_INISIE_R_room_02',
    'Z2_INISIE_R_room_03',
    'Z2_INISIE_R_room_04',
    'Z2_INISIE_R_room_05',
    'Z2_INISIE_R_room_06',
    'Z2_INISIE_R_room_07',
    'Z2_INISIE_R_room_08',
    'Z2_INISIE_R_room_09',
    'Z2_INISIE_R_room_10',
    'Z2_INISIE_R_room_11',
    'Z2_OKUJOU',
    'Z2_OKUJOU_room_00',
    'Z2_OPENINGDAN',
    'Z2_OPENINGDAN_room_00',
    'Z2_OPENINGDAN_room_01',
    'Z2_MITURIN',
    'Z2_MITURIN_room_00',
    'Z2_MITURIN_room_01',
    'Z2_MITURIN_room_02',
    'Z2_MITURIN_room_03',
    'Z2_MITURIN_room_04',
    'Z2_MITURIN_room_05',
    'Z2_MITURIN_room_06',
    'Z2_MITURIN_room_07',
    'Z2_MITURIN_room_08',
    'Z2_MITURIN_room_09',
    'Z2_MITURIN_room_10',
    'Z2_MITURIN_room_11',
    'Z2_MITURIN_room_12',
    'Z2_13HUBUKINOMITI',
    'Z2_13HUBUKINOMITI_room_00',
    'Z2_CASTLE',
    'Z2_CASTLE_room_00',
    'Z2_CASTLE_room_01',
    'Z2_CASTLE_room_02',
    'Z2_CASTLE_room_03',
    'Z2_CASTLE_room_04',
    'Z2_CASTLE_room_05',
    'Z2_CASTLE_room_06',
    'Z2_CASTLE_room_07',
    'Z2_CASTLE_room_08',
    'Z2_CASTLE_room_09',
    'Z2_DEKUTES',
    'Z2_DEKUTES_room_00',
    'Z2_MITURIN_BS',
    'Z2_MITURIN_BS_room_00',
    'Z2_SYATEKI_MIZU',
    'Z2_SYATEKI_MIZU_room_00',
    'Z2_HAKUGIN',
    'Z2_HAKUGIN_room_00',
    'Z2_HAKUGIN_room_01',
    'Z2_HAKUGIN_room_02',
    'Z2_HAKUGIN_room_03',
    'Z2_HAKUGIN_room_04',
    'Z2_HAKUGIN_room_05',
    'Z2_HAKUGIN_room_06',
    'Z2_HAKUGIN_room_07',
    'Z2_HAKUGIN_room_08',
    'Z2_HAKUGIN_room_09',
    'Z2_HAKUGIN_room_10',
    'Z2_HAKUGIN_room_11',
    'Z2_HAKUGIN_room_12',
    'Z2_HAKUGIN_room_13',
    'Z2_ROMANYMAE',
    'Z2_ROMANYMAE_room_00',
    'Z2_PIRATE',
    'Z2_PIRATE_room_00',
    'Z2_PIRATE_room_01',
    'Z2_PIRATE_room_02',
    'Z2_PIRATE_room_03',
    'Z2_PIRATE_room_04',
    'Z2_PIRATE_room_05',
    'Z2_PIRATE_room_06',
    'Z2_PIRATE_room_07',
    'Z2_PIRATE_room_08',
    'Z2_PIRATE_room_09',
    'Z2_PIRATE_room_10',
    'Z2_PIRATE_room_11',
    'Z2_PIRATE_room_12',
    'Z2_PIRATE_room_13',
    'Z2_PIRATE_room_14',
    'Z2_SYATEKI_MORI',
    'Z2_SYATEKI_MORI_room_00',
    'Z2_SINKAI',
    'Z2_SINKAI_room_00',
    'Z2_YOUSEI_IZUMI',
    'Z2_YOUSEI_IZUMI_room_00',
    'Z2_YOUSEI_IZUMI_room_01',
    'Z2_YOUSEI_IZUMI_room_02',
    'Z2_YOUSEI_IZUMI_room_03',
    'Z2_YOUSEI_IZUMI_room_04',
    'Z2_KINSTA1',
    'Z2_KINSTA1_room_00',
    'Z2_KINSTA1_room_01',
    'Z2_KINSTA1_room_02',
    'Z2_KINSTA1_room_03',
    'Z2_KINSTA1_room_04',
    'Z2_KINSTA1_room_05',
    'Z2_KINDAN2',
    'Z2_KINDAN2_room_00',
    'Z2_KINDAN2_room_01',
    'Z2_KINDAN2_room_02',
    'Z2_KINDAN2_room_03',
    'Z2_KINDAN2_room_04',
    'Z2_KINDAN2_room_05',
    'Z2_TENMON_DAI',
    'Z2_TENMON_DAI_room_00',
    'Z2_TENMON_DAI_room_01',
    'Z2_LAST_DEKU',
    'Z2_LAST_DEKU_room_00',
    'Z2_LAST_DEKU_room_01',
    'Z2_22DEKUCITY',
    'Z2_22DEKUCITY_room_00',
    'Z2_22DEKUCITY_room_01',
    'Z2_22DEKUCITY_room_02',
    'Z2_KAJIYA',
    'Z2_KAJIYA_room_00',
    'Z2_00KEIKOKU',
    'Z2_00KEIKOKU_room_00',
    'Z2_POSTHOUSE',
    'Z2_POSTHOUSE_room_00',
    'Z2_LABO',
    'Z2_LABO_room_00',
    'Z2_DANPEI2TEST',
    'Z2_DANPEI2TEST_room_00',
    'Z2_DANPEI2TEST_room_01',
    'Z2_16GORON_HOUSE',
    'Z2_16GORON_HOUSE_room_00',
    'Z2_16GORON_HOUSE_room_01',
    'Z2_33ZORACITY',
    'Z2_33ZORACITY_room_00',
    'Z2_8ITEMSHOP',
    'Z2_8ITEMSHOP_room_00',
    'Z2_F01',
    'Z2_F01_room_00',
    'Z2_INISIE_BS',
    'Z2_INISIE_BS_room_00',
    'Z2_30GYOSON',
    'Z2_30GYOSON_room_00',
    'Z2_31MISAKI',
    'Z2_31MISAKI_room_00',
    'Z2_TAKARAKUJI',
    'Z2_TAKARAKUJI_room_00',
    'Z2_TORIDE',
    'Z2_TORIDE_room_00',
    'Z2_FISHERMAN',
    'Z2_FISHERMAN_room_00',
    'Z2_GORONSHOP',
    'Z2_GORONSHOP_room_00',
    'Z2_DEKU_KING',
    'Z2_DEKU_KING_room_00',
    'Z2_LAST_GORON',
    'Z2_LAST_GORON_room_00',
    'Z2_LAST_GORON_room_01',
    'Z2_24KEMONOMITI',
    'Z2_24KEMONOMITI_room_00',
    'Z2_F01_B',
    'Z2_F01_B_room_00',
    'Z2_F01C',
    'Z2_F01C_room_00',
    'Z2_BOTI',
    'Z2_BOTI_room_00',
    'Z2_BOTI_room_01',
    'Z2_HAKUGIN_BS',
    'Z2_HAKUGIN_BS_room_00',
    'Z2_20SICHITAI',
    'Z2_20SICHITAI_room_00',
    'Z2_20SICHITAI_room_01',
    'Z2_20SICHITAI_room_02',
    'Z2_21MITURINMAE',
    'Z2_21MITURINMAE_room_00',
    'Z2_LAST_ZORA',
    'Z2_LAST_ZORA_room_00',
    'Z2_11GORONNOSATO2',
    'Z2_11GORONNOSATO2_room_00',
    'Z2_11GORONNOSATO2_room_01',
    'Z2_SEA',
    'Z2_SEA_room_00',
    'Z2_SEA_room_01',
    'Z2_SEA_room_02',
    'Z2_SEA_room_03',
    'Z2_SEA_room_04',
    'Z2_SEA_room_05',
    'Z2_SEA_room_06',
    'Z2_SEA_room_07',
    'Z2_SEA_room_08',
    'Z2_SEA_room_09',
    'Z2_SEA_room_10',
    'Z2_SEA_room_11',
    'Z2_SEA_room_12',
    'Z2_SEA_room_13',
    'Z2_SEA_room_14',
    'Z2_SEA_room_15',
    'Z2_35TAKI',
    'Z2_35TAKI_room_00',
    'Z2_REDEAD',
    'Z2_REDEAD_room_00',
    'Z2_REDEAD_room_01',
    'Z2_REDEAD_room_02',
    'Z2_REDEAD_room_03',
    'Z2_REDEAD_room_04',
    'Z2_REDEAD_room_05',
    'Z2_REDEAD_room_06',
    'Z2_REDEAD_room_07',
    'Z2_REDEAD_room_08',
    'Z2_REDEAD_room_09',
    'Z2_REDEAD_room_10',
    'Z2_REDEAD_room_11',
    'Z2_REDEAD_room_12',
    'Z2_REDEAD_room_13',
    'Z2_BANDROOM',
    'Z2_BANDROOM_room_00',
    'Z2_BANDROOM_room_01',
    'Z2_BANDROOM_room_02',
    'Z2_BANDROOM_room_03',
    'Z2_BANDROOM_room_04',
    'Z2_11GORONNOSATO',
    'Z2_11GORONNOSATO_room_00',
    'Z2_11GORONNOSATO_room_01',
    'Z2_GORON_HAKA',
    'Z2_GORON_HAKA_room_00',
    'Z2_SECOM',
    'Z2_SECOM_room_00',
    'Z2_SECOM_room_01',
    'Z2_10YUKIYAMANOMURA',
    'Z2_10YUKIYAMANOMURA_room_00',
    'Z2_TOUGITES',
    'Z2_TOUGITES_room_00',
    'Z2_DANPEI',
    'Z2_DANPEI_room_00',
    'Z2_DANPEI_room_01',
    'Z2_DANPEI_room_02',
    'Z2_DANPEI_room_03',
    'Z2_DANPEI_room_04',
    'Z2_DANPEI_room_05',
    'Z2_DANPEI_room_06',
    'Z2_DANPEI_room_07',
    'Z2_DANPEI_room_08',
    'Z2_IKANAMAE',
    'Z2_IKANAMAE_room_00',
    'Z2_DOUJOU',
    'Z2_DOUJOU_room_00',
    'Z2_MUSICHOUSE',
    'Z2_MUSICHOUSE_room_00',
    'Z2_IKNINSIDE',
    'Z2_IKNINSIDE_room_00',
    'Z2_IKNINSIDE_room_01',
    'Z2_MAP_SHOP',
    'Z2_MAP_SHOP_room_00',
    'Z2_F40',
    'Z2_F40_room_00',
    'Z2_F41',
    'Z2_F41_room_00',
    'Z2_10YUKIYAMANOMURA2',
    'Z2_10YUKIYAMANOMURA2_room_00',
    'Z2_10YUKIYAMANOMURA2_room_01',
    'Z2_14YUKIDAMANOMITI',
    'Z2_14YUKIDAMANOMITI_room_00',
    'Z2_12HAKUGINMAE',
    'Z2_12HAKUGINMAE_room_00',
    'Z2_17SETUGEN',
    'Z2_17SETUGEN_room_00',
    'Z2_17SETUGEN2',
    'Z2_17SETUGEN2_room_00',
    'Z2_SEA_BS',
    'Z2_SEA_BS_room_00',
    'Z2_RANDOM',
    'Z2_RANDOM_room_00',
    'Z2_RANDOM_room_01',
    'Z2_RANDOM_room_02',
    'Z2_RANDOM_room_03',
    'Z2_RANDOM_room_04',
    'Z2_RANDOM_room_05',
    'Z2_YADOYA',
    'Z2_YADOYA_room_00',
    'Z2_YADOYA_room_01',
    'Z2_YADOYA_room_02',
    'Z2_YADOYA_room_03',
    'Z2_YADOYA_room_04',
    'Z2_KONPEKI_ENT',
    'Z2_KONPEKI_ENT_room_00',
    'Z2_INSIDETOWER',
    'Z2_INSIDETOWER_room_00',
    'Z2_INSIDETOWER_room_01',
    'Z2_26SARUNOMORI',
    'Z2_26SARUNOMORI_room_00',
    'Z2_26SARUNOMORI_room_01',
    'Z2_26SARUNOMORI_room_02',
    'Z2_26SARUNOMORI_room_03',
    'Z2_26SARUNOMORI_room_04',
    'Z2_26SARUNOMORI_room_05',
    'Z2_26SARUNOMORI_room_06',
    'Z2_26SARUNOMORI_room_07',
    'Z2_26SARUNOMORI_room_08',
    'Z2_LOST_WOODS',
    'Z2_LOST_WOODS_room_00',
    'Z2_LOST_WOODS_room_01',
    'Z2_LOST_WOODS_room_02',
    'Z2_LAST_LINK',
    'Z2_LAST_LINK_room_00',
    'Z2_LAST_LINK_room_01',
    'Z2_LAST_LINK_room_02',
    'Z2_LAST_LINK_room_03',
    'Z2_LAST_LINK_room_04',
    'Z2_LAST_LINK_room_05',
    'Z2_LAST_LINK_room_06',
    'Z2_LAST_LINK_room_07',
    'Z2_SOUGEN',
    'Z2_SOUGEN_room_00',
    'Z2_BOMYA',
    'Z2_BOMYA_room_00',
    'Z2_KYOJINNOMA',
    'Z2_KYOJINNOMA_room_00',
    'Z2_KOEPONARACE',
    'Z2_KOEPONARACE_room_00',
    'Z2_GORONRACE',
    'Z2_GORONRACE_room_00',
    'Z2_TOWN',
    'Z2_TOWN_room_00',
    'Z2_ICHIBA',
    'Z2_ICHIBA_room_00',
    'Z2_BACKTOWN',
    'Z2_BACKTOWN_room_00',
    'Z2_CLOCKTOWER',
    'Z2_CLOCKTOWER_room_00',
    'Z2_ALLEY',
    'Z2_ALLEY_room_00',
    'SPOT00',
    'SPOT00_room_00',
    'KAKUSIANA',
    'KAKUSIANA_room_00',
    'KAKUSIANA_room_01',
    'KAKUSIANA_room_02',
    'KAKUSIANA_room_03',
    'KAKUSIANA_room_04',
    'KAKUSIANA_room_05',
    'KAKUSIANA_room_06',
    'KAKUSIANA_room_07',
    'KAKUSIANA_room_08',
    'KAKUSIANA_room_09',
    'KAKUSIANA_room_10',
    'KAKUSIANA_room_11',
    'KAKUSIANA_room_12',
    'KAKUSIANA_room_13',
    'KAKUSIANA_room_14',
    'bump_texture_static',
    'anime_model_1_static',
    'anime_model_2_static',
    'anime_model_3_static',
    'anime_model_4_static',
    'anime_model_5_static',
    'anime_model_6_static',
    'anime_texture_1_static',
    'anime_texture_2_static',
    'anime_texture_3_static',
    'anime_texture_4_static',
    'anime_texture_5_static',
    'anime_texture_6_static',
    'softsprite_matrix_static',
]

def read_uint32_be(offset):
    return struct.unpack('>I', romData[offset:offset+4])[0]

def write_output_file(name, offset, size):
    try:
        with open(name, 'wb') as f:
            f.write(romData[offset:offset+size])
    except IOError:
        print('failed to write file ' + name)

try:
    os.mkdir('baserom')
except:
    pass

# read baserom data
try:
    with open(ROM_FILE_NAME, 'rb') as f:
        romData = f.read()
except IOError:
    print('failed to read file' + ROM_FILE_NAME)
    sys.exit(1)

# extract files
for i in range(0, len(FILE_NAMES)):
    filename = 'baserom/' + FILE_NAMES[i]
    entryOffset = FILE_TABLE_OFFSET + 16 * i

    virtStart = read_uint32_be(entryOffset + 0)
    virtEnd   = read_uint32_be(entryOffset + 4)
    physStart = read_uint32_be(entryOffset + 8)
    physEnd   = read_uint32_be(entryOffset + 12)

    if physStart == 0xFFFFFFFF and physEnd == 0xFFFFFFFF: # file deleted
        if (virtEnd - virtStart) == 0:
            continue
        physStart = virtStart
        physEnd = 0
        compressed = False
        size = virtEnd - virtStart
    if physEnd == 0: # uncompressed
        compressed = False
        size = virtEnd - virtStart
    else: # compressed
        compressed = True
        size = physEnd - physStart

    # print(f"    0x{virtStart:08X}:(\"_{filename.split('/')[-1]}SegmentRomStart\",\"UNK_TYPE\",\"\",0x4),")
    # print(f"    0x{virtEnd:08X}:(\"_{filename.split('/')[-1]}SegmentRomEnd\",\"UNK_TYPE\",\"\",0x4),")

    #print(f"_{FILE_NAMES[i]}SegmentRomStart = {hex(virtStart)}\n_{FILE_NAMES[i]}SegmentRomEnd = {hex(virtEnd)}")
    # print('extracting ' + filename + " (0x%08X, 0x%08X)" % (virtStart, virtEnd))
    write_output_file(filename, physStart, size)
    if compressed:
        os.system('tools/buildtools/yaz0 -d ' + filename + ' ' + filename)
