StrongArmand Posted February 24, 2012 Share Posted February 24, 2012 I would like to uncheck an item's flag by tp2 but i've found structur in iesdp a litlle strange. Flags is in extended header yes but in the same adress (0x0026) several values are possible. How can I edit just one value without erase other value ? Have I missed something ? Link to comment
plainab Posted February 25, 2012 Share Posted February 25, 2012 you need the bitwise stuff from weidu. I'll give ya psuedo code for the example lets say the flag has 3 known entries at bits 0, 1, & 2 and bits 0 and 2 are already set to 'on' or 1 and you want to turn bit 1 on without turning bits 0 & 2 off you would do something like this: copy file override read offset flags write offset (%flags% BOR 0b010) but_only Link to comment
StrongArmand Posted February 25, 2012 Author Share Posted February 25, 2012 I've tried this : COPY_EXISTING ~misc5u.itm~ ~override/#VThief.itm~ SAY NAME1 @10000451 SAY NAME2 @10000451 SAY DESC @10000452 READ_SHORT 0x26 "Flags" WRITE_SHORT 0x26 (%Flags% BOR 0b00200) BUT_ONLY But weidu send me an error. This item has 5 known entries at bits 0, 2,3 and 5. Is it an error with BOR command ? Link to comment
Wisp Posted February 25, 2012 Share Posted February 25, 2012 This is binary. There is no such thing as 2. Assuming you want to set bit 2 on the item, you can use WRITE_SHORT 0x26 THIS BOR BIT2 //BIT2 is 0b100 Link to comment
StrongArmand Posted February 25, 2012 Author Share Posted February 25, 2012 What is BIT2 ? A key word from weidu read me ? Assuming you want to set bit 2 on the item, you can use Not exactly. I try to erase bit 2 in fact... Any idea ? Link to comment
Wisp Posted February 25, 2012 Share Posted February 25, 2012 What is BIT2 ? A key word from weidu read me ? BIT2 is a predefined WeiDU constant with the value 0b100 (more info). Not exactly. I try to erase bit 2 in fact... Any idea ? WRITE_SHORT 0x26 THIS BAND 0b11111011 will unset bit 2 but leave everything else as it was. Link to comment
plainab Posted February 25, 2012 Share Posted February 25, 2012 remember the value you wish to edit is in the extended header. meaning it doesn't have a fixed point in the file. it could fluctuate from file to file. IESDP only lists its offset into the extended header section. You'll need to look up the offset of the extended header in the main header, as well as the number of extended headers (there is 1 per ability). Use that information to pinpoint the specific extended header you wish to edit. so that in the end you'll have something like (in psuedo code) copy file override read_long 0x64 ext_head_off read_short 0x68 ext_head_num for (idx = 0; idx < %ext_head_num%; idx += 1 ) begin //assuming 1st extended header patch if (%idx% = 0) begin read_short (%ext_head_off% + (%idx% * 0x38) + 0x26 ) flags write_short (%ext_head_off% + (%idx% * 0x38) + 0x26 ) (whatever bitwise method you discover works) end end but_only didn't list it like this before cause you stated you knew it was in the extended header, which meant to me that you knew how to get there... Link to comment
StrongArmand Posted March 19, 2012 Author Share Posted March 19, 2012 Ok with several test, i've finally understand this command. Sorry for my bad explanation but I thought to know the right way since I've edit cre files effect with tp2 with some INSERT_BYTE command. However I need more training an more reading. ¨¨ I've read the weidu read me by the bigg more carefuly. Hoping that allow me to learn lesson this time.... Link to comment
Miloch Posted March 20, 2012 Share Posted March 20, 2012 Bitwise code can be a bit confusing (to me anyway, but I'm just a half-orc). But basicallly, a byte is 8 bits. When you use 0x## you are writing an entire byte. (two bytes if writing 0x#### etc.). When writing the individual bits within a byte, 0b######## is a single byte, but lets you address the individual bits within that byte. Difference being in the initial "0x" which indicates hexadecimal and "0b" which indicates binary. Not sure if that clarifies things or makes them more confusing. When I code bitwise stuff, I tend to just copy and paste it from existing code I know works. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.