Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

Twelvesky2 script invalid for reimporting

Featured Replies

  • Author
  • Localization

silvershadow, posted Tue Jan 11, 2022 3:20 pm (69004)


Hi,
I was using your script to extract some *.dds files from GIMAGE2D files of the twelvesky2 and it worked fine. But when I try to reimport the file using reimporter I'm getting this error.
Image
Even if I don't change the file at all just try to reimport the same dds file it gives me the same error.
I tried adding -. to the reimporter and this time it didn't give any error but it also didn't import anything to the file.
Image
How can I fix this problem?
Thanks for your time.
  • Author
  • Localization

aluigi, posted Tue Jan 11, 2022 9:55 pm (69015)


For that format the decompressed data contains a DDS at offset 0x24, therefore the script decompresses the data in memory and then dumps the dds from that offset.
That's the reason why reimport can't work.

There are a couple of work-arounds but they require some manual work which is obviously impossible if you have many edited dds.
Additionally I don't know/remember what's the content of those 0x24 bytes and if the edited dds may work or something must be edited in that small header too.
  • Author
  • Localization

silvershadow, posted Tue Jan 11, 2022 10:16 pm (69016)


I have uploaded some IMG files as examples in case you would like to take a look.
I have also uploaded some DDS Header file examples too.
I am completely fine with leaving the header as-is since unless you change the dimensions or file save format of the dds (like DXT3), the header file remains the same.
I just couldn't figure out how to reimport the changed file after the header offset. How can I tinker with the script to repack the new dds file and write it after the offset?
Thanks for your help.
  • Author
  • Localization

aluigi, posted Fri Jan 21, 2022 9:22 am (69246)


Ok so the following script should do the two jobs:
Code:
get MYSIZE asize
get NAME basename
get EXT extension

if EXT == "IMG"

    get SIZE long
    get ZSIZE long
    if ZSIZE > MYSIZE
        # skip
    else
        savepos OFFSET
        string NAME ".IMG2"
        clog NAME OFFSET ZSIZE SIZE
    endif

else if EXT == "IMG2"

    math OFFSET = 0x24
    math MYSIZE - OFFSET
    string NAME ".dds"
    log NAME OFFSET MYSIZE

endif

001_00676.IMG -> 001_00676.IMG2 (a temporary extension I assigned)
001_00676.IMG2 -> 001_00676.dds

It works also in reimport* mode as I just tested:
reimport: 001_00676.dds -> 001_00676.IMG2
reimport2: 001_00676.IMG2 -> 001_00676.IMG

Yeah, the only requirement is using reimport.bat for dds->img2 and reimport2 for img2->img because reimport2 refuses to corrupt the data in the first step.

Note: both reimport.bat and reimpor3 work in the first step, the difference is that reimport3 puts the new data in place of the old one shrinking/enlarging the original content, but this is not the case since the dds is at the end of img2 so there is no data at the end to preserve.
  • Author
  • Localization

silvershadow, posted Mon Jan 24, 2022 7:28 am (69325)


Hi,
I have tested the modifications you provided and they worked like a magic. I was confused as to why the script refuses to reimport but now it all makes sense.

Thank you very much and have a nice day. :)
Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.