99from retro_data_structures .crc import crc32
1010from retro_data_structures .formats .mlvl import Mlvl
1111from retro_data_structures .formats .mrea import Area
12+ from retro_data_structures .formats .ntwk import Ntwk
1213from retro_data_structures .formats .strg import Strg
1314from retro_data_structures .game_check import Game
1415
@@ -31,15 +32,18 @@ def _seek_and_write(self, seek: int, data: bytes):
3132
3233class PatcherEditor (AssetManager ):
3334 memory_files : dict [NameOrAssetId , BaseResource ]
35+ dol : MemoryDol | None = None
36+ tweaks : Ntwk | None = None
3437
3538 def __init__ (self , provider : FileProvider , game : Game ):
3639 super ().__init__ (provider , game )
3740 self .memory_files = {}
3841
3942 if game in [Game .PRIME , Game .ECHOES ]:
4043 self .dol = MemoryDol (provider .get_dol ())
41- else :
42- self .dol = None
44+ if game == Game .ECHOES :
45+ with provider .open_binary ("Standard.ntwk" ) as f :
46+ self .tweaks = Ntwk .parse (f .read (), game )
4347
4448 def get_file (self , path : NameOrAssetId , type_hint : type [T ] = BaseResource ) -> T :
4549 if path not in self .memory_files :
@@ -79,6 +83,9 @@ def save_modifications(self, output_path: Path):
7983 target_dol .parent .mkdir (exist_ok = True , parents = True )
8084 target_dol .write_bytes (self .dol .dol_file .getvalue ())
8185
86+ if self .tweaks is not None :
87+ output_path .joinpath ("files/Standard.ntwk" ).write_bytes (self .tweaks .build ())
88+
8289 def add_or_replace_custom_asset (self , name : str , new_data : Resource ) -> AssetId :
8390 if self .does_asset_exists (name ):
8491 asset_id = self .replace_asset (name , new_data )
0 commit comments