Jump to content

Patching items from the override folder


Guest Guest

Recommended Posts

What's the best way to copy, for instance, all the .itm files which are in the override folder but not in the original game (i.e. those added by other mods), so they can be patched?

 

I know that I can achieve this simply with COPY but then I will get all the override files not just the .itm ones. So I thought there may be some better way to do it; some kind of equivalent of COPY_EXISTING_REGEXP which will find things that only exist in the override folder...

 

Thanks for any help!

Link to comment

COPY ~override~ ~override~
PATCH_IF SOURCE_EXT EXACT_MATCH "itm" BEGIN
 patches
END
BUT_ONLY_IF_IT_CHANGES

 

Should be right, but knowing me, I have made a fatal but painfully obvious error somewhere.

 

EDIT: A Better version, I think;

COPY_EXISTING_REGEXP ~override/.*.itm~ ~override~
PATCH_IF SOURCE_SIZE > 0x71 BEGIN //Protects against invalid fixes
 <patches>
END
BUT_ONLY_IF_IT_CHANGES

 

Icen

Link to comment
What's the best way to copy, for instance, all the .itm files which are in the override folder but not in the original game (i.e. those added by other mods), so they can be patched?

 

I know that I can achieve this simply with COPY but then I will get all the override files not just the .itm ones. So I thought there may be some better way to do it; some kind of equivalent of COPY_EXISTING_REGEXP which will find things that only exist in the override folder...

You could try the above, but COPY_EXISTING will read from the biff as well as the override. The added REGEXP only lets you use wildcards to grab various files. The mention of the override directory may work, but it would still get every itm file even those modified by mods not just added.

 

This should work, (I've not tested it) and you might not like it.

Code follows description...

1) Make a directory, copy the override as a backup.

2) Make a directory, copy the ITM files and delete them from override

3) Run a copy comparison of the BIFFs against the ITM files in new directory

4) Delete any files found in BIFFs and in new directory

5) Restore override so patches will work on mod added items only

6) Run a copy comparison of the BIFFs and override against remaining ITM files in new directory

7) Patch override copy if matching copy found in new directory

8) Remove backup directory and new ITM directory

9) We are done!

NOTE: I put prints in there to display info as it goes (might help in debugging)

 

BEGIN ~find out what ITM files are added by mods and then patch~
// makes dir and backs up override
MKDIR ~overbak~
COPY ~override~ ~overbak~
PRINT ~Made directory overbak and copied the override files. This is a temporary backup~
// copy item files for comparison 
//using windows/dos syntax change as needed
MKDIR ~over2~
AT_INTERACTIVE_NOW ~copy override/*.itm over2/*.itm~
//remove itm files from override
AT_INTERACTIVE_NOW ~del override/*.itm~
PRINT ~Made directory over2, copied ITM files from override into over2 and deleted ITM files from override~
//Compare files from BIFFs against new directory
COPY_EXISTING_REGEXP ~.*\.itm~ ~override~
SPRINT filename ~%SOURCE_RES%~
PRINT ~Looking at %filename%.itm~
INNER_ACTION BEGIN
ACTION_IF (FILE_EXISTS ~over2/%filename%.itm~) THEN BEGIN
//this is for dos/windows change it as needed for mac or linux
AT_INTERACTIVE_NOW ~del over2/%filename%.itm~
PRINT ~%filename%.itm was in over2 and in the BIFFs. Deleted from over2~
END
END
BUT_ONLY_IF_IT_CHANGES
//put override back...
COPY ~overbak~ ~override~
PRINT ~Restored override files from overbak~
//start patch process
//restored override contains same files as in new dir so no need to bring over and patch
COPY_EXISTING_REGEXP ~.*\.itm~ ~override~
SPRINT filename ~%SOURCE_RES%~
PATCH_IF (FILE_EXISTS ~over2/%filename%.itm~) BEGIN
PATCH_PRINT ~%filename%.itm is in over2 and is ready for patching~
/*do your patch */
END
BUT_ONLY_IF_IT_CHANGES
//wrap things up and get rid of excess stuff
//using windows/dos commands change as needed
AT_INTERACTIVE_NOW ~deltree over2~
AT_INTERACTIVE_NOW ~deltree overbak~

 

I wouldn't necessarily recommend the above to actually be used in a published mod, because of the various dos commands I've included but it should get the job done specifically as you asked.

 

Your other choice is to use COPY_EXISTING_REGEXP and do a search list based on mod prefixies. You might get lucky... This would be the more preferred method, if you can figure out what exact prefixes you would need to use....

Link to comment

Thanks a lot for the replies.

 

If instead I did not mind getting the files from the BIFFs (in other words, I wanted all files) then I suppose using

 

COPY_EXISTING_REGEXP GLOB ~.*\.itm~ ~override~

would be easiest, but is using

 

COPY_EXISTING_REGEXP ~override/.*.itm~ ~override~
PATCH_IF SOURCE_SIZE > 0x71 BEGIN //Protects against invalid fixes
 <patches>
END
BUT_ONLY_IF_IT_CHANGES

like Icendoan suggested a better solution? I noticed in the WeiDU documentation it mentions that it was best not to use globbing unless it couldn't be helped.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...