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.

cpk file unpack error [Amagami]

Featured Replies

  • Author
  • Localization

aluigi, posted Wed May 10, 2017 2:59 pm (23085)


That's a job for CriPakTools that supports also the encrypted archives:
https://github.com/esperknight/CriPakTo ... kTools.exe

Tested and works, if you have never used it create a new folder, put SCENARIO.CPK and the CriPakTools.exe in it, create a file.bat containing the following and launch it:
CriPakTools.exe SCENARIO.CPK ALL
  • Author
  • Localization

OneCombo, posted Thu May 11, 2017 10:34 am (23111)


thank you for your kind.

as you know, cpk file need a CSV file.

because inside there are many files, but each file has different compression.

how to make CSV file?

there are many files in there.
  • Author
  • Localization

aluigi, posted Thu May 11, 2017 12:10 pm (23112)


I don't know about this csv file, the extraction process is completed and the file there have an SCF\x1a magic that means it's a file format (model?), I don't see compression and in any case the cpk files use the CRILAYLA compression which is handled automatically by the script.
I'm sure that other users know about what you refer, I know only about the extraction :D
  • Author
  • Localization

aluigi, posted Thu May 11, 2017 2:42 pm (23118)


Not sure at 100% but the following is the script that gives the best decompressed result:
Code:
comtype lzss "11 5 2 2 0"
get SIZE long
savepos OFFSET
get ZSIZE asize
math ZSIZE - OFFSET
get NAME basename
clog NAME OFFSET ZSIZE SIZE
  • Author
  • Localization

OneCombo, posted Thu May 11, 2017 7:11 pm (23126)


Thank you very much !! :) :) :)

Is it possible reimport files?

if file size over, reimport it doesn't work. right?
  • Author
  • Localization

aluigi, posted Thu May 11, 2017 7:59 pm (23130)


The "file size" rule is ever valid so new <= old.
Reimporting is perfectly possible but it's necessary to split the script in two parts because the original script does everything on the fly in memory.

So the first part is the decompression of AMAGAMI.IMG:
Code:
comtype lzss "11 5 2 2 0"
get SIZE long
savepos OFFSET
get ZSIZE asize
math ZSIZE - OFFSET
clog "tmp.dat" OFFSET ZSIZE SIZE

While the second part is the extraction from the generated tmp.dat file:
Code:
get SIZE long
get FILES long

for i = 0 < FILES
    get NAME_OFF long
    putarray 1 i NAME_OFF
next i

for i = 0 < FILES
    get OFFSET long
    putarray 0 i OFFSET
next i
    putarray 0 i SIZE

for i = 0 < FILES
    getarray NAME_OFF 1 i
    getarray OFFSET   0 i
    math i 1
    getarray SIZE     0 i
    math SIZE - OFFSET

    goto NAME_OFF
    get NAME string
    string NAME "."

    log NAME OFFSET SIZE
next

Now, you do not need to extract the files again because they are fine, but use the first script on AMAGAMI.IMG for generating tmp.dat

When you want to reimport the files run reimport.bat selecting the second script, tmp.dat and the folder where you previously extracted the files.

Now run reimport.bat with the first script, amagami.img and the folder where is located tmp.dat.
If you have problem with this specific step I can write a new script that doesn't need reimport.bat.

It's really very easy, it's more difficult to explain it than doing it.
  • Author
  • Localization

OneCombo, posted Fri May 12, 2017 4:12 pm (23162)


offset filesize filename
--------------------------------------

Error: file "tmp.dat"
the reimport option acts as a reimporter and so you cannot reinsert a
file if it's bigger than the original otherwise it will overwrite the
rest of the archive or cannot be loaded correctly:

new size: 2144096 uncompressed
old size: 2144092 uncompressed

- do you want to skip this file? (y/N/force)
y will continue with the next file
N (default) will terminate QuickBMS
force will force the reimporting of the file
force

Error: file "tmp.dat"
the reimport option acts as a reimporter and so you cannot reinsert a
file if it's bigger than the original otherwise it will overwrite the
rest of the archive or cannot be loaded correctly:

new size: 888668 (2144096 uncompressed)
old size: 888666 (2144096 uncompressed)

- do you want to skip this file? (y/N/force)
y will continue with the next file
N (default) will terminate QuickBMS
force will force the reimporting of the file
force
< 00000004 888668 tmp.dat

- 1 files reimported in 442 seconds
coverage file 0 0% 4 888672 . offset 00000004

Press ENTER or close the window to quit

-------------------------------------------

it shows like this window.

first, i select a first script.

second, select a amagami.img.

third, select a unpacked folder.

i tried the test. wrote 4 byte more.

and then i tried the second test.

tried uncompress edited amagami.img (wrote a 4 byte file)

offset filesize filename
--------------------------------------
00000000 0 -.dat
00000000 0 00000001.dat
00000000 242 \.dat
000000f2 4294967138 \.dat

- The following output file already exists:
.dat
Do you want to overwrite it?
y = overwrite (you can use also the 'o' key)
n = skip (default, just press ENTER)
a = overwrite all the files without asking
r = automatically rename the files with the same name
s = skip all the existent files without asking

r

Error: impossible to write 0xffffff62 bytes (total 0xffffff62)
Check your disk space

Last script line before the error or that produced the error:
26 log NAME OFFSET SIZE

Press ENTER or close the window to quit

---------------------------

what should i do??

sorry~!

when i localize this game, i'll probably over those file's size.

because it takes longer to translate into Korean.
  • Author
  • Localization

aluigi, posted Sat May 13, 2017 3:58 pm (23192)


Here all the step works BUT I guess there is a problem with the recompression algorithm, that's possible because it's a specific setting that has been never used before.
In short, it will be fixed in the next version of quickbms.

In the meantime I show you how the scripts must be used from command-line since it's more easy to understand the process:

Extract:
quickbms 1.bms AMAGAMI.IMG
quickbms 2.bms tmp.dat new_folder

Edit your files in new_folder

Reimport:
quickbms -r -w 2.bms tmp.dat new_folder
quickbms -r -w 1.bms AMAGAMI.IMG

As already said, the recompression algorithm doesn't work so the edited AMAGAMI.IMG WILL NOT WORK.
  • Author
  • Localization

OneCombo, posted Tue May 16, 2017 4:25 am (23268)


Thank you for your kind answer!

I waiting for QuickBms's update.

Have a great day!

If I have a question, Il'll be back! :)

Thank you!
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.