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.

divided by a number

Featured Replies

  • Author
  • Localization

Shokoniraya, posted Thu Nov 22, 2018 6:47 am (40586)


i need a little help with a script


get FILE-SIZE asize
get CRC long
math CRC = 1024
get OFFSET longlong

How can i do that: (If FILE-SIZE not was divided by 16, then do that: math OFFSET = 12)

divided by 16: like 16, 32, 48, 64, 80, 96, 112, 128, 144...
  • Author
  • Localization

aluigi, posted Thu Nov 22, 2018 7:32 am (40588)


math OFFSET x 16

It performs an automatic alignment to 16.
  • Author
  • Localization

Shokoniraya, posted Thu Nov 22, 2018 8:28 am (40595)


in LIS_BNK_Import.bms, Line 53

i need to set alignment all of files as (divided by 16), just like original, or if i dont, then game cant read files, if i do it with hex, game can read files

BNK_FILE.zip

  • Author
  • Localization

aluigi, posted Thu Nov 22, 2018 8:55 am (40599)


That's a bit different than the original simpler question of how to align an offset :)
Basically you should first calculate the aligned offset, then use "append 1" that allows to move on any desired offset of MEMORY_FILE, then fix that OFFLEN... not exactly a one-line fix.

I did some edit on the fly, try it:
Code:
open FDDE header_bnk 0
open FDDE footer_bnk 1
open FDDE bnk 2
get NAME basename
string BNK_NAME p "%s%s.bnk" NAME "_NEW"


get HEADER_SIZE asize 0
get FSB_SIZE asize 1
log MEMORY_FILE 0 HEADER_SIZE 0


get MEM_SIZE asize MEMORY_FILE



goto 0x0 0
findloc DATA binary "\x44\x41\x54\x41" 0
goto DATA 0
get DATA long 0
get CHUNK long #all extracted size 0
math ALL_SIZE = CHUNK 0
savepos SSSSA 0
math E_HEADING = DATA 0
goto 0x0 0
findloc HEADER_TWO_SCOUND binary "\x44\x49\x44\x58" 0
goto HEADER_TWO_SCOUND 0
get DIDX_HEADER long 0
get HEADER_TWO long 0
math HEADER_COUNT = HEADER_TWO 0
math HEADER_TWO /= 12 #12, (CRC, OFFSET, SIZE long) 0

math DUMMY_ADDER = 24 0
math HEADER_HEADING HEADER_ONE 0
math HEADER_HEADING DUMMY_ADDER 0


get MAHPE asize 0
for i = 0
get CRC long 0
savepos OFFSET_OFF 0
get OFFSET long 0
savepos SIZE_OFF 0
get SIZE long 0
math OFFSET == 0 0
math OFFSET HEADER_HEADING 0
string CRC p "%s.wem" CRC 0

open FDSE CRC 4
get WEM_SIZE asize 4
savepos OFFLEN MEMORY_FILE
math OFFLEN x 16
append 1
goto OFFLEN MEMORY_FILE
log MEMORY_FILE 0 WEM_SIZE 4
append




putvarchr MEMORY_FILE OFFSET_OFF OFFLEN long
putvarchr MEMORY_FILE SIZE_OFF WEM_SIZE long



next i





append
log MEMORY_FILE 0 FSB_SIZE 1
append



get MEM_SIZE asize MEMORY_FILE
log BNK_NAME 0 MEM_SIZE MEMORY_FILE
  • Author
  • Localization

Shokoniraya, posted Fri Nov 23, 2018 3:41 am (40640)


Sorry, nut BKHD Header cant add!
alignment is works fine! but when you change (append) to (append 1), then header cant add on top of file!

math OFFLEN x 16
append 1


i upload a better sample

BNK_Sample.zip

  • Author
  • Localization

aluigi, posted Fri Nov 23, 2018 7:03 am (40644)


You can use both, I mean "append 1" for moving to the aligned position, followed by "append" (for closing the previous mode) and another "append" for opening the classical append mode.

Otherwise just go directly to the end of the file in "append 1":
Code:
get TMP asize MEMORY_FILE
goto TMP MEMORY_FILE
log MEMORY_FILE OFFSET SIZE

Many choices :)
  • Author
  • Localization

Shokoniraya, posted Fri Nov 23, 2018 8:14 am (40650)


aluigi wrote:
You can use both, I mean "append 1" for moving to the aligned position, followed by "append" (for closing the previous mode) and another "append" for opening the classical append mode.

Otherwise just go directly to the end of the file in "append 1":
Code:
get TMP asize MEMORY_FILE
goto TMP MEMORY_FILE
log MEMORY_FILE OFFSET SIZE

Many choices :)


infact, i cant understand why cant add header! because i did it before!

can you fix script? to make NEW .bnk Just like original?
  • Author
  • Localization

Shokoniraya, posted Sun Nov 25, 2018 7:55 am (40716)


Shokoniraya wrote:
aluigi wrote:
You can use both, I mean "append 1" for moving to the aligned position, followed by "append" (for closing the previous mode) and another "append" for opening the classical append mode.

Otherwise just go directly to the end of the file in "append 1":
Code:
get TMP asize MEMORY_FILE
goto TMP MEMORY_FILE
log MEMORY_FILE OFFSET SIZE

Many choices :)


infact, i cant understand why cant add header! because i did it before!

can you fix script? to make NEW .bnk Just like original?


aluigi, i dont unrestand why (append 1) will disable header log?
can you fix it yourself for test?
  • Author
  • Localization

aluigi, posted Sun Nov 25, 2018 9:26 am (40722)


Sorry, currently I can't.
  • Author
  • Localization

GHOST DEAD, posted Thu Nov 29, 2018 6:54 am (40829)


aluigi wrote:
Sorry, currently I can't.

hmmm... adding another append not working
do you think QuickBMS need a Update? because i think so
  • Author
  • Localization

aluigi, posted Thu Nov 29, 2018 8:01 am (40831)


No, everything works perfectly.
It's just that I can't spend time understanding what the script is meant to do and then fixing or rewriting it from scratch.
Sorry.
  • Author
  • Localization

GHOST DEAD, posted Tue Dec 11, 2018 5:02 am (41243)


Shoko, your script had some Problem, in this days, im working on audio modding to change music in game
i made a recreated script based on your script

You did something wrong and in this code, when i change (append) to (append 1), header still can be added in template

only problem is:
Code:
append
math WEM_OFFSET x 16
log MEMORY_FILE WEM_OFFSET WEM_SIZE 4
append

not working, me too
and i don't think that just using (x 16) will works
aluigi, which code? can you tell me what can i do? (x 16) not working
for example, can you fix 16-alignment in LIS_BNK.bms? if it's solved, other problem will solve

LIS_BNK.bms

recreated_LIS_BNK_Import.bms

  • Author
  • Localization

GHOST DEAD, posted Thu Dec 20, 2018 4:36 am (41530)


i forgot to say, but x can set a size a special number, not just put in OFFSET, got to use for set a size, not rewrite them!
i really need it, too
  • Author
  • Localization

GHOST DEAD, posted Sat Jan 05, 2019 8:41 pm (41979)


i found problem now
Seems like quickbms can't set offset by 16 in reimport2 and just add file in -0x0. anyway, game can't read files without (math offset x 16) in new offset, a problem or not avable?
  • Author
  • Localization

aluigi, posted Thu Jan 10, 2019 4:17 pm (42104)


The 'x' command is a non-reversible since you can't calculate the old value to store back in the original field, but that should not be a problem.

I will check it anyway.
  • Author
  • Localization

Shokoniraya, posted Sat Jan 19, 2019 10:38 am (42527)


i want to reimport2 a file with x16 offset. but QuickBMS always adding file in end of file. that is right
solution?

For instance
i want to create a script for a simple file. And i can extract it as well with real size and hash and offset
And for reimporting i must use reimport2
But game juat can read offset as x16. Like 16 and 32 or more
Now Tool just can add file in end of archive
And if archive are 37 byte. Then my new offset is 38. But must be 64!
What we need for now: adding file by X16 offset.
  • Author
  • Localization

Shokoniraya, posted Sun Jan 20, 2019 10:50 am (42559)


Sorry. here a edited part

if archive are 37 byte. Then my new offset is 38. But must be 48!
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.