Jump to content


Photo

LolFixer Thread


  • Please log in to reply
355 replies to this topic

#21 Lollorian

Lollorian

    smiley addict

  • Member
  • 4150 posts

Posted 09 November 2011 - 06:17 PM

I've been trying to implement a sort of offset-fixer thing for all 4 filetypes and... :unsure:

The ARE fileformat has confused me bonkets :o

The IESDP says the main block ends at 0x10a
Some older mods (BG1UB, Munchmod) check for SOURCE_SIZE > 0x11c (the G3Debugger uses this to start its offset run as well :o)
Some newer mods (Aurora, Daulmakan's ItemPack) check for SOURCE_SIZE > 0x28f

Do the secondary blocks start at 0x11c? If yes, what are the 18-bytes between the main header (ends at 0x10a) and the secondary header (if it starts at 0x11c)? :unsure:

Attached Files


Edited by Lollorian, 28 November 2011 - 06:19 AM.

"I am the smiley addict, yellow and round, this is my grin :D when I'm usually around :P.
When there's trouble brewing, see me post, cuz it's usually a wall o' yellow and your eyes are toast!!!"

BWP GUIDE - BWP FIXES - impFAQ - NPC LIST - KIT LIST - AREA LIST

GitHub Links : BWP Fixpack | Lolfixer | BWP Trimpack | RezMod


#22 i30817

i30817
  • Member
  • 611 posts

Posted 09 November 2011 - 07:10 PM

nvm

Edited by i30817, 09 November 2011 - 07:13 PM.


#23 Wisp

Wisp
  • Modder
  • 1353 posts

Posted 10 November 2011 - 02:57 AM

Do the secondary blocks start at 0x11c? If yes, what are the 18-bytes between the main header (ends at 0x10a) and the secondary header (if it starts at 0x11c)? :unsure:

The IESDP is mistaken. The length of the trailing section is 0x38, but the author entered it as simply 38.

#24 Lollorian

Lollorian

    smiley addict

  • Member
  • 4150 posts

Posted 10 November 2011 - 04:29 AM

Many thanks! :coolthumb: All 4 offset checkers up on git now :D

Area Offset Fixer
BEGIN ~Area Stuff - Offset Checker (fixes incorrect offsets)~
  GROUP ~Area Stuff~

COPY_EXISTING_REGEXP GLOB ~^.+\.are$~ ~override~
  PATCH_IF (SOURCE_SIZE > 0x28f) THEN BEGIN
    READ_LONG  0x54 "actor_off"
    READ_SHORT 0x58 "actor_num"
    READ_SHORT 0x5a "info_num"
    READ_LONG  0x5c "info_off"
    READ_LONG  0x60 "spawn_off"
    READ_LONG  0x64 "spawn_num"
    READ_LONG  0x68 "ent_off"
    READ_LONG  0x6c "ent_num"
    READ_LONG  0x70 "cont_off"
    READ_SHORT 0x74 "cont_num"
    READ_SHORT 0x76 "item_num"
    READ_LONG  0x78 "item_off"
    READ_LONG  0x7c "vert_off"
    READ_SHORT 0x80 "vert_num"
    READ_SHORT 0x82 "amb_num"
    READ_LONG  0x84 "amb_off"
    READ_LONG  0x88 "var_off"
    READ_LONG  0x8c "var_num"
    READ_ASCII 0x94 "script"
    READ_LONG  0x9c "bmp_size"
    READ_LONG  0xa0 "bmp_off"
    READ_LONG  0xa4 "door_num"
    READ_LONG  0xa8 "door_off"
    READ_LONG  0xac "anim_num"
    READ_LONG  0xb0 "anim_off"
    READ_LONG  0xb4 "tiled_num"
    READ_LONG  0xb8 "tiled_off"
    READ_LONG  0xbc "song_off"
    READ_LONG  0xc0 "rest_off"
    READ_LONG  0xc4 "note_off"
    READ_LONG  0xc8 "note_num"
    SET "running_offset" = 0x11c

    // check actors
    PATCH_IF ("%running_offset%" != "%actor_off%") BEGIN
      PATCH_PRINT "%SOURCE_FILE% error: Actor offset is incorrect! Correcting..."
      WRITE_LONG  0x54 "running_offset"
    END

    SET "running_offset" = ("%running_offset%" + ("%actor_num%" * 0x110))
    // check info points
    PATCH_IF ("%running_offset%" != "%info_off%") BEGIN
      PATCH_PRINT "%SOURCE_FILE% error: Info Point offset is incorrect! Correcting..."
      WRITE_LONG  0x5c "running_offset"
    END

    SET "running_offset" = ("%running_offset%" + ("%info_num%" * 0xc4))
    // check spawn points
    PATCH_IF ("%running_offset%" != "%spawn_off%") BEGIN
      PATCH_PRINT "%SOURCE_FILE% error: Spawn Point offset is incorrect! Correcting..."
      WRITE_LONG  0x60 "running_offset"
    END

    SET "running_offset" = ("%running_offset%" + ("%spawn_num%" * 0xc8))
    // check entrance points
    PATCH_IF ("%running_offset%" != "%ent_off%") BEGIN
      PATCH_PRINT "%SOURCE_FILE% error: Entrances offset is incorrect! Correcting..."
      WRITE_LONG  0x68 "running_offset"
    END

    SET "running_offset" = ("%running_offset%" + ("%ent_num%" * 0x68))
    // check containers
    PATCH_IF ("%running_offset%" != "%cont_off%") BEGIN
      PATCH_PRINT "%SOURCE_FILE% error: Containers offset is incorrect! Correcting..."
      WRITE_LONG  0x70 "running_offset"
    END

    SET "running_offset" = ("%running_offset%" + ("%cont_num%" * 0xc0))
    // check items
    PATCH_IF ("%running_offset%" != "%item_off%") BEGIN
      PATCH_PRINT "%SOURCE_FILE% error: Items offset is incorrect! Correcting..."
      WRITE_LONG  0x78 "running_offset"
    END

    SET "running_offset" = ("%running_offset%" + ("%item_num%" * 0x14))
    // check ambients
    PATCH_IF ("%running_offset%" != "%amb_off%") BEGIN
      PATCH_PRINT "%SOURCE_FILE% error: Ambients offset is incorrect! Correcting..."
      WRITE_LONG  0x84 "running_offset"
    END

    SET "running_offset" = ("%running_offset%" + ("%amb_num%" * 0xd4))
    // check variables
    PATCH_IF ("%running_offset%" != "%var_off%") BEGIN
      PATCH_PRINT "%SOURCE_FILE% error: Variables offset is incorrect! Correcting..."
      WRITE_LONG  0x88 "running_offset"
    END

    SET "running_offset" = ("%running_offset%" + ("%var_num%" * 0x54))
    // check doors
    PATCH_IF ("%running_offset%" != "%door_off%") BEGIN
      PATCH_PRINT "%SOURCE_FILE% error: Door offset is incorrect! Correcting..."
      WRITE_LONG  0xa8 "running_offset"
    END

    SET "running_offset" = ("%running_offset%" + ("%door_num%" * 0xc8))
    // check tiled objects
    PATCH_IF ("%running_offset%" != "%tiled_off%") BEGIN
      PATCH_PRINT "%SOURCE_FILE% error: Tiled Objects offset is incorrect! Correcting..."
      WRITE_LONG  0xb8 "running_offset"
    END

    SET "running_offset" = ("%running_offset%" + ("%tiled_num%" * 0x6c))
    // check vertices
    PATCH_IF ("%running_offset%" != "%vert_off%") BEGIN
      PATCH_PRINT "%SOURCE_FILE% error: Vertices offset is incorrect! Correcting..."
      WRITE_LONG  0x7c "running_offset"
    END

    SET "running_offset" = ("%running_offset%" + ("%vert_num%" * 0x04))
    // check animations
    PATCH_IF ("%running_offset%" != "%anim_off%") BEGIN
      PATCH_PRINT "%SOURCE_FILE% error: Animations offset is incorrect! Correcting..."
      WRITE_LONG  0xb0 "running_offset"
    END

    SET "running_offset" = ("%running_offset%" + ("%anim_num%" * 0x4c))
    // check bitmap
    PATCH_IF ("%running_offset%" != "%bmp_off%") BEGIN
      PATCH_PRINT "%SOURCE_FILE% error: Bitmap offset is incorrect! Correcting..."
      WRITE_LONG  0xa0 "running_offset"
    END

    SET "running_offset" = ("%running_offset%" + "%bmp_size%")
    // check songs block
    PATCH_IF ("%running_offset%" != "%song_off%") BEGIN
      PATCH_PRINT "%SOURCE_FILE% error: Songs offset is incorrect! Correcting..."
      WRITE_LONG  0xbc "running_offset"
    END

    SET "running_offset" = ("%running_offset%" + 0x90)
    // check rest spawn block
    PATCH_IF ("%running_offset%" != "%rest_off%") BEGIN
      PATCH_PRINT "%SOURCE_FILE% error: Rest Spawn offset is incorrect! Correcting..."
      WRITE_LONG  0xc0 "running_offset"
    END

    SET "running_offset" = ("%running_offset%" + 0xe4)
    // check map notes
    PATCH_IF ("%running_offset%" != "%note_off%") BEGIN
      PATCH_PRINT "%SOURCE_FILE% error: Map Notes offset is incorrect! Correcting..."
      WRITE_LONG  0xc4 "running_offset"
    END
  END
BUT_ONLY_IF_IT_CHANGES

Creature Offset Fixer
BEGIN ~Creature Stuff - Offset Checker (fixes incorrect offsets)~
  GROUP ~Creature Stuff~

COPY_EXISTING_REGEXP GLOB ~^.+\.cre$~ ~override~
  PATCH_IF (SOURCE_SIZE > 0x2d4) THEN BEGIN
    READ_BYTE  0x33  "fx_type"
    READ_LONG  0x2a0 "known_off"
    READ_LONG  0x2a4 "known_num"
    READ_LONG  0x2a8 "meminfo_off"
    READ_LONG  0x2ac "meminfo_num"
    READ_LONG  0x2b0 "mem_off"
    READ_LONG  0x2b4 "mem_num"
    READ_LONG  0x2b8 "slot_off"
    READ_LONG  0x2bc "item_off"
    READ_LONG  0x2c0 "item_num"
    READ_LONG  0x2c4 "fx_off"
    READ_LONG  0x2c8 "fx_num"
    SET "running_offset" = 0x2d4
    SET "running_spl_idx" = 0

    // check known spells
    PATCH_IF ("%known_off%" != "%running_offset%") BEGIN
      PATCH_PRINT "%SOURCE_FILE% error: Known Spells offset is incorrect! Correcting..."
      WRITE_LONG  0x2a0 "running_offset"
    END

    SET "running_offset" = ("%running_offset%" + ("%known_num%" * 0x0c))
    // check spell memorization info
    PATCH_IF ("%meminfo_off%" != "%running_offset%") BEGIN
      PATCH_PRINT "%SOURCE_FILE% error: Memorization Info offset is incorrect! Correcting..."
      WRITE_LONG  0x2a8 "running_offset"
    END

    SET "running_offset" = ("%running_offset%" + ("%meminfo_num%" * 0x10))
    // check memorized spells
    PATCH_IF ("%mem_off%" != "%running_offset%") BEGIN
      PATCH_PRINT "%SOURCE_FILE% error: Memorized Spells offset is incorrect! Correcting..."
      WRITE_LONG  0x2b0 "running_offset"
    END

    SET "running_offset" = ("%running_offset%" + ("%mem_num%" * 0x0c))
    // check effects
    PATCH_IF ("%fx_off%" != "%running_offset%") BEGIN
      PATCH_PRINT "%SOURCE_FILE% error: Effects offset is incorrect! Correcting..."
      WRITE_LONG  0x2c4 "running_offset"
    END

    SET "running_offset" = ("%running_offset%" + ("%fx_num%" * (0x30 + ("%fx_type%" * 0xd8))))
    // check items
    PATCH_IF ("%item_off%" != "%running_offset%") BEGIN
      PATCH_PRINT "%SOURCE_FILE% error: Item offset is incorrect! Correcting..."
      WRITE_LONG  0x2bc "running_offset"
    END

    SET "running_offset" = ("%running_offset%" + ("%item_num%" * 0x14))
    // check slot offset
    PATCH_IF ("%slot_off%" != "%running_offset%") BEGIN
      PATCH_PRINT "%SOURCE_FILE% error: Item Slot offset is incorrect! Correcting..."
      WRITE_LONG  0x2b8 "running_offset"
    END
  END
BUT_ONLY_IF_IT_CHANGES

Item Offset Fixer
BEGIN ~Item Stuff - Offset Checker (fixes incorrect offsets)~
  GROUP ~Item Stuff~

COPY_EXISTING_REGEXP GLOB ~^.+\.itm$~ ~override~
  PATCH_IF (SOURCE_SIZE > 0x72) BEGIN
    READ_LONG  0x64 "abil_off"
    READ_SHORT 0x68 "abil_num"
    READ_LONG  0x6a "fx_off"
    READ_SHORT 0x70 "fx_num"
    SET "running_offset" = 0x72

    // check abilities/extended header
    PATCH_IF ("%abil_off%" != "%running_offset%") BEGIN
      PATCH_PRINT "%SOURCE_FILE% error: Abilities offset is incorrect! Correcting..."
      WRITE_LONG  0x64 "running_offset"
    END

    SET "running_offset" = ("%running_offset%" + ("%abil_num%" * 0x38))
    // check features/equipped effects
    PATCH_IF ("%fx_off%" != "%running_offset%") BEGIN
      PATCH_PRINT "%SOURCE_FILE% error: Equipped Effect offset is incorrect! Correcting..."
      WRITE_LONG  0x6a "running_offset"
    END
  END
BUT_ONLY_IF_IT_CHANGES

Spell Offset Fixer
BEGIN ~Spell Stuff - Offset Checker (fixes incorrect offsets)~
  GROUP ~Spell Stuff~

COPY_EXISTING_REGEXP GLOB ~^.+\.spl$~ ~override~
  PATCH_IF (SOURCE_SIZE > 0x72) BEGIN
    READ_LONG  0x64 "abil_off"
    READ_SHORT 0x68 "abil_num"
    READ_LONG  0x6a "fx_off"
    READ_SHORT 0x70 "fx_num"
    SET "running_offset" = 0x72

    // check abilities/extended header
    PATCH_IF ("%abil_off%" != "%running_offset%") BEGIN
      PATCH_PRINT "%SOURCE_FILE% error: Abilities offset is incorrect! Correcting..."
      WRITE_LONG  0x64 "running_offset"
    END

    SET "running_offset" = ("%running_offset%" + ("%abil_num%" * 0x28))
    // check features/equipped effects
    PATCH_IF ("%fx_off%" != "%running_offset%") BEGIN
      PATCH_PRINT "%SOURCE_FILE% error: Casting Effect offset is incorrect! Correcting..."
      WRITE_LONG  0x6a "running_offset"
    END
  END
BUT_ONLY_IF_IT_CHANGES

Starting to take shape now aye? :cheers:

"I am the smiley addict, yellow and round, this is my grin :D when I'm usually around :P.
When there's trouble brewing, see me post, cuz it's usually a wall o' yellow and your eyes are toast!!!"

BWP GUIDE - BWP FIXES - impFAQ - NPC LIST - KIT LIST - AREA LIST

GitHub Links : BWP Fixpack | Lolfixer | BWP Trimpack | RezMod


#25 i30817

i30817
  • Member
  • 611 posts

Posted 10 November 2011 - 06:25 AM

I'm confused myself.

So you're saying that if i have a :

"COPY_EXISTING_REGEXP GLOB ~^%ie_file%.*\.are$~ ~override~"

I should use:
PATCH_IF (SOURCE_SIZE > 0x28f) THEN BEGIN //is bigger than header size

Instead of:
PATCH_IF (SOURCE_SIZE > 0x11b) THEN BEGIN //is bigger than header size

?

#26 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 10 November 2011 - 06:57 AM

I'm confused myself.

So you're saying that if i have a :

"COPY_EXISTING_REGEXP GLOB ~^%ie_file%.*\.are$~ ~override~"

I should use:
PATCH_IF (SOURCE_SIZE > 0x28f) THEN BEGIN //is bigger than header size

Instead of:
PATCH_IF (SOURCE_SIZE > 0x11b) THEN BEGIN //is bigger than header size

?

Yes it can be confusing...

apparently someone didn't put in 0x in front of 38 when showing how many unknown bytes were trailing the header section in area files. This causes confusion when someone takes the offset of the unknowns 0xe4 and adds 38 to get to the end of the header section. 0xe4 + 38 = 0x10a but when you add the 0x in front of 38 it suddenly changes the value so that 0xe4 + 0x38 = 0x11c

you'd want to use
PATCH_IF (SOURCE_SIZE > 0x11b) THEN BEGIN //is bigger than header size
or
PATCH_IF (SOURCE_SIZE >= 0x11c) THEN BEGIN //is bigger than or equal to header size

the 0x28f mentioned earlier could have been a copy/paste from another file type and was not adjusted for the ARE file type

Tho now seeing that this is screwed up in the IESDP I'm gonna have to check my mods and see if any of them need properly corrected... -.-

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm


#27 Lollorian

Lollorian

    smiley addict

  • Member
  • 4150 posts

Posted 10 November 2011 - 07:03 AM

PATCH_IF (SOURCE_SIZE > 0x11b) THEN BEGIN //is bigger than header size

Now that I think about this... the correct format would indeed be

PATCH_IF (SOURCE_SIZE > (HEADER_SIZE-1)) THEN BEGIN :o

I've currently been using PATCH_IF (SOURCE_SIZE > HEADER_SIZE) THEN BEGIN for the validity check! (and lots of mods do it too :unsure:)

"I am the smiley addict, yellow and round, this is my grin :D when I'm usually around :P.
When there's trouble brewing, see me post, cuz it's usually a wall o' yellow and your eyes are toast!!!"

BWP GUIDE - BWP FIXES - impFAQ - NPC LIST - KIT LIST - AREA LIST

GitHub Links : BWP Fixpack | Lolfixer | BWP Trimpack | RezMod


#28 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 10 November 2011 - 11:29 AM

~LOLFIXER.TP2~ #0 #4 // Area Stuff - Door Unpicker (makes doors that need keys but were pickable - unpickable): v0.0000000001a
~LOLFIXER.TP2~ #0 #5 // Area Stuff - Door Locker (locks doors that need keys but were unlocked): v0.0000000001a

Can you vouch there are no doors intended to be pickable with both a key and a very high skill?
Similar, doors can be left open to be script-locked later.

Edited by GeN1e, 10 November 2011 - 11:33 AM.

Retired from modding.


#29 Lollorian

Lollorian

    smiley addict

  • Member
  • 4150 posts

Posted 10 November 2011 - 06:13 PM

Can you vouch there are no doors intended to be pickable with both a key and a very high skill?
Similar, doors can be left open to be script-locked later.

While I admit that I'd not thought about those specific cases :lol: Some other cases have come through in my mind :D And it resulted in the entire mod being modular! :coolthumb:... actually, could a REGEXP search of the scripts for the unlock code or something be used for your 2nd doubt? But what if the door is locked via dialogues? :ROFL: I dunno whether variables can be used in REGEXP searches though :unsure: Something like

BELOW CODE WAS CREATED IN A HALF-ASLEEP STUPOR AND WILL FRY YOUR PC! DO NOT TRY! :ROFL:
Spoiler


I'll separate each of the 4 groups into 2 subgroups - Recommended & <insert generic adjective> (Other? Tweak? :unsure:)

At the moment IMHO, the components are:
~LOLFIXER.TP2~ #0 #0 // Area Stuff - Offset Checker (fixes incorrect offsets): 0.1A
~LOLFIXER.TP2~ #0 #1 // Area Stuff - Script Assigner (assigns missing/unassigned scripts to areas): 0.1A
~LOLFIXER.TP2~ #0 #2 // Area Stuff - Missing Ambient Remover (removes ambients that don't have their WAV present): 0.1A
~LOLFIXER.TP2~ #0 #3 // Area Stuff - Missing Actor Remover (removes actors that don't have their CRE present): 0.1A
~LOLFIXER.TP2~ #0 #4 // Area Stuff - Missing Rest Spawn Remover (nulls rest spawn entries that don't have their CRE present): 0.1A
~LOLFIXER.TP2~ #0 #5 // Area Stuff - Missing Spawn Remover (nulls spawn entries that don't have their CRE present): 0.1A
~LOLFIXER.TP2~ #0 #6 // Area Stuff - Trap Unflagger (remove trap flag if trap is undetectable, undisarmable and has no script): 0.1A
~LOLFIXER.TP2~ #0 #7 // Area Stuff - Door Unpicker (makes doors that need keys but were pickable - unpickable): 0.1A
~LOLFIXER.TP2~ #0 #8 // Area Stuff - Door Locker (locks doors that need keys but were unlocked): 0.1A
~LOLFIXER.TP2~ #0 #9 // Creature Stuff - Creature Resource Fixer (res_fixer for ALL CREATURES): 0.1A
~LOLFIXER.TP2~ #0 #10 // Creature Stuff - Offset Checker (fixes incorrect offsets): 0.1A
~LOLFIXER.TP2~ #0 #11 // Creature Stuff - Inventory Unborker (removes spurious references to the item table): 0.1A
~LOLFIXER.TP2~ #0 #12 // Creature Stuff - Inventory Cleaner (removes items that don't exist): 0.1A
~LOLFIXER.TP2~ #0 #13 // Creature Stuff - Inventory Overhauler (moves invalid equippable items to inventory and equips anything in the inventory to a free slot): 0.1A
~LOLFIXER.TP2~ #0 #14 // Item Stuff - Item Resource Fixer (res_fixer for ALL ITEMS): 0.1A
~LOLFIXER.TP2~ #0 #15 // Item Stuff - Offset Checker (fixes incorrect offsets): 0.1A
~LOLFIXER.TP2~ #0 #16 // Item Stuff - Permanent Effect Duration Nuller (sets duration for permanent effects to 0): 0.1A
~LOLFIXER.TP2~ #0 #17 // Item Stuff - Equipped Effect Targetter (makes any items that don't target self on equip, target self): 0.1A
~LOLFIXER.TP2~ #0 #18 // Item Stuff - Equipped Effect Activator (makes any equipped effects that didn't activate on equip now activate): 0.1A
~LOLFIXER.TP2~ #0 #19 // Item Stuff - Equipped Effect Undispeller (makes any dispellable equipped effects undispellable): 0.1A
~LOLFIXER.TP2~ #0 #20 // Item Stuff - Equipped Item 100% Probability Check (makes equipped effects that don't have a 100% probability of happening always activate): 0.1A
~LOLFIXER.TP2~ #0 #21 // Spell Stuff - Spell Resource Fixer (res_fixer for ALL THE SPELLS): 0.1A
~LOLFIXER.TP2~ #0 #22 // Spell Stuff - Offset Checker (fixes incorrect offsets): 0.1A
~LOLFIXER.TP2~ #0 #23 // Spell Stuff - Permanent Effect Duration Nuller (sets duration for permanent effects to 0): 0.1A
~LOLFIXER.TP2~ #0 #24 // Spell Stuff - Innate Fixer (makes Innate spells level 1): 0.1A
0 2 3 4 5 9 10 11 12 14 15 21 22 24 -> could go inside Recommended? :P
1 -> needs to be installed early (possibly right after BG2Fixpack) to have any noticeable effect if the Haiass mod isn't installed :lol:
the rest qualify as i-dunno-whats :lol:

Edited by Lollorian, 11 November 2011 - 06:46 AM.

"I am the smiley addict, yellow and round, this is my grin :D when I'm usually around :P.
When there's trouble brewing, see me post, cuz it's usually a wall o' yellow and your eyes are toast!!!"

BWP GUIDE - BWP FIXES - impFAQ - NPC LIST - KIT LIST - AREA LIST

GitHub Links : BWP Fixpack | Lolfixer | BWP Trimpack | RezMod


#30 i30817

i30817
  • Member
  • 611 posts

Posted 10 November 2011 - 08:35 PM

I think it's more appropriate to look at individual cases in such a restricted condition - for the keys thing. Maybe keep the code as a warning for the BGTfixpack when you're packaging it to check any new possible positive (or false).

Edited by i30817, 11 November 2011 - 06:35 AM.


#31 Lollorian

Lollorian

    smiley addict

  • Member
  • 4150 posts

Posted 11 November 2011 - 06:41 AM

I think it's more appropriate to look at individual cases in such a restricted condition - for the keys thing. Maybe keep the code as a warning for the BGTfixpack when you're packaging it to check any new possible positive (or false).

Indeed :D I couldn't get how to search for a specific regex in a BAF/D so... :crying: (the idiotic code I posted in the last post was well... omgwtfpwnz0rsuXX :ROFL:)

Anyway, I discovered an awesome looking Tutu-to-BGT item convertor in BG1NPC that would be good to apply to all creatures :D so without further ado (code in spoilers cause of massiveness :lol:

Tutu-to-BGT Convertor
Spoiler

Many props to the BG1NPC guys for this component :cheers:

"I am the smiley addict, yellow and round, this is my grin :D when I'm usually around :P.
When there's trouble brewing, see me post, cuz it's usually a wall o' yellow and your eyes are toast!!!"

BWP GUIDE - BWP FIXES - impFAQ - NPC LIST - KIT LIST - AREA LIST

GitHub Links : BWP Fixpack | Lolfixer | BWP Trimpack | RezMod


#32 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 11 November 2011 - 07:22 AM

Indeed I couldn't get how to search for a specific regex in a BAF/D so... (the idiotic code I posted in the last post was well... omgwtfpwnz0rsuXX )

this is just theory you'd have to play around with it...

copy area file
sprint text_variable = source_res
read door variable name
do inner action
copy scripts
use COUNT_REGEXP_INSTANCES optcase optexact regexp variable
if variable is GT 0
door is used in current script therefore
set evaluate_buffer %text_variable% = 1
print ~script: %source_res% uses door: %door variable name%~
get out of if
end copy scripts
copy dialogs
use COUNT_REGEXP_INSTANCES optcase optexact regexp variable
if variable is GT 0
door is used in current dialog therefore
set evaluate_buffer %text_variable% = 1
print ~dialog: %source_res% uses door: %door variable name%~
get out of if
end copy dialogs
get out of inner action
end area copy

then look at your debug file for the print statements determine how you should modify those doors that are used in scripts & dialogs if at all.

then re copy areas and match %source_res% = 1 and do any special changes or lack of changes that you need.

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm


#33 Lollorian

Lollorian

    smiley addict

  • Member
  • 4150 posts

Posted 11 November 2011 - 09:14 AM

Awesome thanks mate! :D I tried implementing your code segment like this:
COPY_EXISTING_REGEXP GLOB ~^.+\.are$~ ~override~
  PATCH_IF (SOURCE_SIZE > 0x11b) THEN BEGIN
    READ_LONG  0xa4 "door_num" ELSE 0
    READ_LONG  0xa8 "door_off" ELSE 0

    FOR (index = 0 ; index < door_num ; index = index + 1) BEGIN
      READ_ASCII ("%door_off%" +        ("%index%" * 0xc8)) "door_name" (32)
      READ_ASCII ("%door_off%" + 0x78 + ("%index%" * 0xc8)) "resref"
      PATCH_IF NOT (("%resref%" STRING_EQUAL_CASE "") OR ("%resref%" STRING_EQUAL_CASE "none")) BEGIN // legit key entry
        READ_BYTE ("%door_off%" + 0x28 + ("%index%" * 0xc8)) "flags"
        PATCH_IF ((("%flags%" BAND 0b00000010) != 0b00000010) AND (FILE_EXISTS_IN_GAME ~%resref%.itm~)) BEGIN
          PATCH_PRINT "%SOURCE_FILE% error: Door #%index% has key (%resref%.itm) but was not locked! Checking..."

          INNER_ACTION BEGIN
            COPY_EXISTING_REGEXP GLOB ~^.+\.bcs$~ ~override~
              DECOMPILE_BCS_TO_BAF
                COUNT_REGEXP_INSTANCES CASE_INSENSITIVE EVALUATE_REGEXP ~[L]ock\(\"%door_name%\"\)~ n
              COMPILE_BAF_TO_BCS
              BUT_ONLY_IF_IT_CHANGES
              ACTION_IF (%n% > 0) THEN BEGIN
                PRINT ~SCRIPT: %SOURCE_FILE% uses Door: %door_name%~
              END
            COPY_EXISTING_REGEXP GLOB ~^.+\.dlg$~ ~override~
              DECOMPILE_DLG_TO_D
                COUNT_REGEXP_INSTANCES CASE_INSENSITIVE EVALUATE_REGEXP ~[L]ock\(\"%door_name%\"\)~ n
              COMPILE_D_TO_DLG
              BUT_ONLY_IF_IT_CHANGES
              ACTION_IF (%n% > 0) THEN BEGIN
                PRINT ~DIALOG: %SOURCE_FILE% uses Door: %door_name%~
              END
          END

//        WRITE_BYTE ("%door_off%" + 0x28 + ("%index%" * 0xc8)) ("%flags%" BOR 0b00000010)
        END
      END
    END
  END
BUT_ONLY_IF_IT_CHANGES
But it doesn't seem to actually count anything :unsure: For example, AR1037.ARE has "Door01" that uses KEY10.ITM but is still unlocked... Now AR1513.BCS contains a Lock("Door1")

There's also the thing that I only wanna search for Lock() functions (and not Unlock()) which would mean turning CASE_SENSITIVE on... but I believe that would bork if the door names themselves are CASE_INSENSITIVE :unsure:

Shouldn't the above code say that SCRIPT: AR1513.BCS uses Door: Door1? :ermm: Thanks for taking time out to look at this btw :P

"I am the smiley addict, yellow and round, this is my grin :D when I'm usually around :P.
When there's trouble brewing, see me post, cuz it's usually a wall o' yellow and your eyes are toast!!!"

BWP GUIDE - BWP FIXES - impFAQ - NPC LIST - KIT LIST - AREA LIST

GitHub Links : BWP Fixpack | Lolfixer | BWP Trimpack | RezMod


#34 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 11 November 2011 - 11:33 AM

it was just theory i can't even get it to work myself... might need to ask the bigg how to properly use this OR if there is a better way

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm


#35 Wisp

Wisp
  • Modder
  • 1353 posts

Posted 11 November 2011 - 12:09 PM

I do not know if it is the cause of your problem but this
READ_ASCII ("%door_off%" +        ("%index%" * 0xc8)) "door_name" (32)
needs a NULL.

#36 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 11 November 2011 - 12:52 PM

I do not know if it is the cause of your problem but this

READ_ASCII ("%door_off%" +        ("%index%" * 0xc8)) "door_name" (32)
needs a NULL.

*facepalm* of all the other things I had to tweak and adjust totally didn't see that one... adding that to everything else it works

this is the code i got to work, originally checked for just ("%door_name%") but then added in the different actions to verify which were which. After that worked commented out the checks on all but the Lock("%door_name%") adjust as you see fit. Note that for this I used my 'test' mod setup so adjust directory file as needed for the append output. Also this does no work, just lists any file that uses the specified action. you'll have to look at them on a case by case basis to determine if the script/dialog coincides with the given door/area file.
Spoiler


output on an unmodified BG2
Spoiler


also the regexp check you had wasn't returning anything, doing a specific typed out check did however.

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm


#37 Lollorian

Lollorian

    smiley addict

  • Member
  • 4150 posts

Posted 12 November 2011 - 12:03 AM

:doh: indeed :D

Many thanks to both of you! I'll implement that and have a run soon :P Currently getting a test install with most megamods and some tweaks up. Should be fun... :unsure:

also the regexp check you had wasn't returning anything, doing a specific typed out check did however.

I noticed that your REGEXP returned Unlock("Door01") etc references too :unsure:

AR1307.ARE error: Door #0 (Door01) has key (KEY10.itm) but was not locked! Checking...
SCRIPT: 03POOL3.BCS uses Lock("Door01")
SCRIPT: AR0808.BCS uses Lock("Door01")
SCRIPT: AR1515.BCS uses Lock("Door01")
SCRIPT: AR2201.BCS uses Lock("Door01")
SCRIPT: AR5500.BCS uses Lock("Door01")
SCRIPT: AR6001.BCS uses Lock("Door01")
SCRIPT: AR6105.BCS uses Lock("Door01")
SCRIPT: CUT231A.BCS uses Lock("Door01")
SCRIPT: CUT238B.BCS uses Lock("Door01")
SCRIPT: CUT241B.BCS uses Lock("Door01")
SCRIPT: CUT41G.BCS uses Lock("Door01")
SCRIPT: CUT50C.BCS uses Lock("Door01")
SCRIPT: DUMFUE.BCS uses Lock("Door01")
SCRIPT: GASTRP.BCS uses Lock("Door01")
SCRIPT: PPWORKER.BCS uses Lock("Door01")
SCRIPT: UDMASTER.BCS uses Lock("Door01")
SCRIPT: GORCH.DLG uses Lock("Door01")
SCRIPT: PPIRENI2.DLG uses Lock("Door01")
SCRIPT: UDARDUL.DLG uses Lock("Door01")
SCRIPT: UDPHAE01.DLG uses Lock("Door01")
SCRIPT: UDSVIR06.DLG uses Lock("Door01")
in the game, only 3 of those scripts have a Lock("Door01") :P

Any idea how I could force the REGEX to search for ONLY capital-L's while being CASE_INSENSITIVE for the rest of the string? :lol:

EDIT: Found out that the offset checker components could break things pretty bad in a megamoded game :D Not recommended no more...

Edited by Lollorian, 12 November 2011 - 01:53 AM.

"I am the smiley addict, yellow and round, this is my grin :D when I'm usually around :P.
When there's trouble brewing, see me post, cuz it's usually a wall o' yellow and your eyes are toast!!!"

BWP GUIDE - BWP FIXES - impFAQ - NPC LIST - KIT LIST - AREA LIST

GitHub Links : BWP Fixpack | Lolfixer | BWP Trimpack | RezMod


#38 Lollorian

Lollorian

    smiley addict

  • Member
  • 4150 posts

Posted 12 November 2011 - 03:49 AM

Finished my install and found one particular area... :lol:

F_6666.ARE from DrizztSaga actually crashes the lolfixer when it tries to remove the Missing Actors from the area. Looking at it in NI and DLTCEP shows that there's something extremely funky with its container section :unsure:

Actor remover code:
Spoiler


Attached the offending ARE and accompanying files (WED/BMP etc) for easy previewing in NI :D This needs to be fixed by hand but I don't know how to go about it :( So would be awesome if someone could... :P

Also, the inventory cleaner loops infinitely on SENDRO03.cre :unsure: Attached it too...

Inventory cleaner code:
Spoiler

I've had to create exceptions for those in the code :crying:

Attached Files


Edited by Lollorian, 12 November 2011 - 04:39 AM.

"I am the smiley addict, yellow and round, this is my grin :D when I'm usually around :P.
When there's trouble brewing, see me post, cuz it's usually a wall o' yellow and your eyes are toast!!!"

BWP GUIDE - BWP FIXES - impFAQ - NPC LIST - KIT LIST - AREA LIST

GitHub Links : BWP Fixpack | Lolfixer | BWP Trimpack | RezMod


#39 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 12 November 2011 - 05:34 AM

Any idea how I could force the REGEX to search for ONLY capital-L's while being CASE_INSENSITIVE for the rest of the string?

try using CASE_SENSITIVE since the variable is replaced prior to any regexp I'd hazard to guess that case sensitive will work fine. at least it wouldn't hurt to try it out...

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm


#40 Lollorian

Lollorian

    smiley addict

  • Member
  • 4150 posts

Posted 13 November 2011 - 05:48 AM

I gave a run of Sasha's code in this install :D
Spoiler

... and apparently, it was too uch for WeiDU to handle :lol:

SCRIPT: DUMFUE.BCS uses Lock("Door01")
Appending to files ...
[lolfixer/check.txt] loaded, 1870 bytes
Appended text to [lolfixer/check.txt]
ERROR: [FW36001.BCS] -> [override/FW36001.BCS] Patching Failed (COPY) (Out of memory)
Stopping installation because of error.
ERROR: [AR1307.ARE] -> [override/AR1307.ARE] Patching Failed (COPY) (Out of memory)
Stopping installation because of error.

ERROR Installing [Area Stuff - Door Locker (locks doors that need keys but were unlocked)], rolling back to previous state
Unable to Unlink [lolfixer/backup/8/OTHER.8]: Unix.Unix_error(1, "unlink", "lolfixer/backup/8/OTHER.8")
[lolfixer/backup/8/UNSETSTR.8] SET_STRING uninstall info not found
Will uninstall 2510 files for [LOLFIXER.TP2] component 8.
  Restoring backed-up [lolfixer/backup/8/check.txt]
lolfixer/backup/8/check.txt copied to lolfixer/check.txt, 0 bytes
First time I got that in 3 years of installing stuff using WeiDU :D (maybe it's my system? 4GB too small? :unsure: But I did note that memory wasn't being fully used... usage went to a max of 69% before it stalled. Maybe WeiDU caps the memory that it could use?)

Anyway, I guess the Door Locker would have to be kept a debugging tool at best (like all the components that aren't recommended :lol:)

"I am the smiley addict, yellow and round, this is my grin :D when I'm usually around :P.
When there's trouble brewing, see me post, cuz it's usually a wall o' yellow and your eyes are toast!!!"

BWP GUIDE - BWP FIXES - impFAQ - NPC LIST - KIT LIST - AREA LIST

GitHub Links : BWP Fixpack | Lolfixer | BWP Trimpack | RezMod