With 169, I added IF ~ITM~ or IF ~CRE~ to my REGEXP patches to exclude zero-byte files
as suggested here. Worked like a charm with 169, however with 171 and 172 I'm getting errors. This is what I'm trying with:
PRINT @1
COPY_EXISTING_REGEXP GLOB ~.*\.itm~ ~override~ // looking for scrolls
READ_SHORT 0x1C "type"
PATCH_IF ("%type%" = 11) BEGIN // scrolls
WRITE_SHORT 0x38 9999
END
IF ~ITM~
BUT_ONLY_IF_IT_CHANGES
It seems IF ~ITM~ is not guarding against 0-byte file copies under 171 or 172. IPLOT01K.itm is a zero-byte item that's included in one of the game biffs; this is the error message when executing the code above:
ERROR: illegal 2-byte read from offset 28 of 0-byte file IPLOT01K.ITM
Stopping installation because of error.
ERROR Installing [Unlimited Potion Stacking], rolling back to previous state
[Tutu_Tweaks/backup/231/UNSETSTR.231] SET_STRING uninstall info not found
[Tutu_Tweaks/backup/231/UNINSTALL.231] loaded, 86 bytes
Will uninstall 4 files for [SETUP-TUTU_TWEAKS.TP2] component 231.
Deleting [override/C!Tutu03.xxx] (to restore original game condition)
Deleting [override/BAZPLO04.ITM] (to restore original game condition)
Restoring backed-up [Tutu_Tweaks/backup/231/BAZPLO07.ITM]
[Tutu_Tweaks/backup/231/BAZPLO07.ITM] loaded, 114 bytes
Restoring backed-up [Tutu_Tweaks/backup/231/BTEST1.ITM]
[Tutu_Tweaks/backup/231/BTEST1.ITM] loaded, 514 bytes
Uninstalled 4 files for [SETUP-TUTU_TWEAKS.TP2] component 231.
I'm not sure if it'll help or not, but items listed under ALLOW_MISSING are fine with the IF ~ITM~ predicate. For example, this works fine even though a number of items listed here are not present but included under ALLOW_MISSING:
COPY_EXISTING ~_CHAN04.ITM~ ~override~
~_CHAN05.ITM~ ~override~
~_ICHAN04.ITM~ ~override~
~BAND01.ITM~ ~override~
~BAND02.ITM~ ~override~
~BAND03.ITM~ ~override~
~BAND04.ITM~ ~override~
~CHAN04.ITM~ ~override~
~CHAN05.ITM~ ~override~
~CHAN18.ITM~ ~override~
~ICHAN04.ITM~ ~override~
~J#SPLI06.ITM~ ~override~
~VISCHAN2.ITM~ ~override~
WRITE_SHORT 0x1C 207
IF ~ITM~
I can re-work these using PATCH_IF FILE_SIZE checks, but I wanted to report this in case this is unintended behavior.