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.

[Solved] Need help writing a script

Featured Replies

  • Author
  • Localization

bugmenot, posted Sun Oct 09, 2016 7:35 pm (17918)


I have a bunch of .png files that start with 16bytes of ID string that should be removed from the result followed by 16 bytes of xored data and the rest of the file in plain format.
I managed to find the xor string but now I need help in writing the bms script to do the decryption that i plan to run using a .bat file.
Code:
for %%i in (*.ext) DO quickbms.exe -o script.bms "%%i" "%CD%\out"


Can anyone tell me what I'm missing? I prefer to learn how to do this myself than have someone give me the script but so far reading the quickbms.txt or other people scripts isn't helping.

Code:
idstring "\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**"
set KEY "0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x**"
get FSIZE asize
GoTo 16
GetDString FHEADER 16
Math FHEADER ^= KEY
get BNAME basename
string BNAME = ".png"
Math FSIZE -= 16
log BNAME 16 FSIZE
  • Author
  • Localization

aluigi, posted Sun Oct 09, 2016 9:33 pm (17919)


Try this:
Code:
# create the name
get BNAME basename
string BNAME = ".png"

# magic
idstring "\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**"

# xor 16 bytes
savepos OFFSET
filexor "0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x**" OFFSET
log BNAME OFFSET 16
filexor ""

# append the rest
savepos OFFSET
math FSIZE - OFFSET
append
log BNAME OFFSET FSIZE
append
  • Author
  • Localization

bugmenot, posted Mon Oct 10, 2016 7:24 pm (17943)


aluigi wrote:
Try this:

Thanks, and feel free to post the script on you're page - after all you're the one who did the heavy lifting ;p

P.S. Is there a way to optimize the script or make it work faster?

mv.zip

  • Author
  • Localization

aluigi, posted Mon Oct 10, 2016 8:22 pm (17944)


There are no other ways to speed up the script, there are only few instructions without loops so it's fine.
I guess the slowness you have experienced is related to the calling of quickbms on every single file.

Try to use:
quickbmsexe -o -F "{}.rpgmv{}" RPGMakerMV.bms INPUT_FOLDER OUTPUT_FOLDER
  • Author
  • Localization

bugmenot, posted Sat Oct 29, 2016 8:29 pm (18458)


Unfortunately this will not keep the files sub-directory structure.
  • Author
  • Localization

aluigi, posted Sat Oct 29, 2016 8:45 pm (18459)


In that case you can try one of the following two command-line options:
Code:
-d     automatically create an additional output folder with the name of the
       input folder and file processed, eg. models/mychar/mychar.arc/FILES,
       -d works also if input and output folders are the same (rename folder)

-D     similar to -d but will not create the folder with the filename
I added them some years ago just to maintain the original directory tree and they are two separate options for meeting the different needs of the users.
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.