BACKUP ~invalid_opcode_checker/backup~ AUTHOR ~His Majesty~ VERSION ~Over 9000~ BEGIN ~Check for invalid opcodes~ COPY_EXISTING_REGEXP GLOB ~^.+\.cre$~ ~override~ PATCH_IF (SOURCE_SIZE > 0x2cf) BEGIN READ_LONG 0x2c4 "fx_off" READ_LONG 0x2c8 "fx_num" FOR (index = 0; index < fx_num; index = index + 1) BEGIN READ_LONG ("%fx_off%" + 0x8 + (0x108 * "%index%")) "opcode" PATCH_IF ("%opcode%" > 317) BEGIN PATCH_PRINT "%SOURCE_FILE% error: Effect #%index% Invalid Opcode! (%opcode%)" END END END BUT_ONLY_IF_IT_CHANGES COPY_EXISTING_REGEXP GLOB ~^.+\.eff$~ ~override~ READ_LONG 0x10 "opcode" PATCH_IF ("%opcode%" > 317) BEGIN PATCH_PRINT "%SOURCE_FILE% error: Effect #%index% Invalid Opcode! (%opcode%)" END BUT_ONLY_IF_IT_CHANGES COPY_EXISTING_REGEXP GLOB ~^.+\.itm$~ ~override~ PATCH_IF (SOURCE_SIZE > 0x71) BEGIN READ_LONG 0x64 "abil_off" READ_SHORT 0x68 "abil_num" READ_LONG 0x6a "fx_off" READ_SHORT 0x6e "fx_idx" READ_SHORT 0x70 "fx_num" FOR (index = 0; index < abil_num; index = index + 1) BEGIN READ_SHORT ("%abil_off%" + 0x1e + ("%index%" * 0x38)) "abil_fx_num" READ_SHORT ("%abil_off%" + 0x20 + ("%index%" * 0x38)) "abil_fx_idx" FOR (index2 = 0 ; index2 < abil_fx_num ; index2 = index2 + 1) BEGIN READ_SHORT ("%fx_off%" + (0x30 * ("%abil_fx_idx%" + "%index2%"))) "opcode" PATCH_IF ("%opcode%" > 317) BEGIN PATCH_PRINT "%SOURCE_FILE% error: Abil #%index% Effect #%index2% Invalid Opcode! (%opcode%)" END END END FOR (index = 0; index < fx_num; index = index + 1) BEGIN READ_SHORT ("%fx_off%" + (0x30 * ("%fx_idx%" + "%index%"))) "opcode" PATCH_IF ("%opcode%" > 317) BEGIN PATCH_PRINT "%SOURCE_FILE% error: Effect #%index% Invalid Opcode! (%opcode%)" END END END BUT_ONLY_IF_IT_CHANGES COPY_EXISTING_REGEXP GLOB ~^.+\.spl$~ ~override~ PATCH_IF (SOURCE_SIZE > 0x71) BEGIN READ_LONG 0x64 "abil_off" READ_SHORT 0x68 "abil_num" READ_LONG 0x6a "fx_off" READ_SHORT 0x6e "fx_idx" READ_SHORT 0x70 "fx_num" FOR (index = 0; index < abil_num; index = index + 1) BEGIN READ_SHORT ("%abil_off%" + 0x1e + ("%index%" * 0x28)) "abil_fx_num" READ_SHORT ("%abil_off%" + 0x20 + ("%index%" * 0x28)) "abil_fx_idx" FOR (index2 = 0 ; index2 < abil_fx_num ; index2 = index2 + 1) BEGIN READ_SHORT ("%fx_off%" + (0x30 * ("%abil_fx_idx%" + "%index2%"))) "opcode" PATCH_IF ("%opcode%" > 317) BEGIN PATCH_PRINT "%SOURCE_FILE% error: Abil #%index% Effect #%index2% Invalid Opcode! (%opcode%)" END END END FOR (index = 0; index < fx_num; index = index + 1) BEGIN READ_SHORT ("%fx_off%" + (0x30 * ("%fx_idx%" + "%index%"))) "opcode" PATCH_IF ("%opcode%" > 317) BEGIN PATCH_PRINT "%SOURCE_FILE% error: Effect #%index% Invalid Opcode! (%opcode%)" END END END BUT_ONLY_IF_IT_CHANGES