[HELP] Unpack/Repack OFS3 Header Sword Art Online Hollow Realization

How to translate the files of a game
makc_ar
Posts: 1193
Joined: Sun Aug 17, 2014 7:27 pm

Re: [HELP] Unpack/Repack OFS3 Header Sword Art Online Hollow Realization

Post by makc_ar »

haku0011
Posts: 29
Joined: Thu Sep 10, 2015 8:22 am

Re: [HELP] Unpack/Repack OFS3 Header Sword Art Online Hollow Realization

Post by haku0011 »

Image

Somehow it works, but it's still has an encrypt.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: [HELP] Unpack/Repack OFS3 Header Sword Art Online Hollow Realization

Post by aluigi »

Alternatively you can use this script for generating a txt file to use for translation (with size limits obviously):

Code: Select all

get NAME basename
string NAME + ".txt"
idstring "OFS3"
get BASE_OFF long
get DUMMY long
get DATA_SIZE long
get STRINGS long
for i = 0 < STRINGS
    get OFFSET long
    get DUMMY long
    math OFFSET + BASE_OFF
    slog NAME OFFSET -1
next i
haku0011
Posts: 29
Joined: Thu Sep 10, 2015 8:22 am

Re: [HELP] Unpack/Repack OFS3 Header Sword Art Online Hollow Realization

Post by haku0011 »

it works, tks aluigi!!!!
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: [HELP] Unpack/Repack OFS3 Header Sword Art Online Hollow Realization

Post by aluigi »

If you want to reimport the edited txt back in the original file you must use the reimport feature of quickbms, read section 3 of http://aluigi.org/papers/quickbms.txt for info.
Just remember that your strings must have the same length or shorter than the original ones.
Wind_Blade
Posts: 1
Joined: Tue Nov 07, 2017 12:08 pm

Re: [HELP] Unpack/Repack OFS3 Header Sword Art Online Hollow Realization

Post by Wind_Blade »

It is possible to extract the images from the game? to see to change them? I try to extract all the resources but they are encrypt and the images in .file that are not recognized
makc_ar
Posts: 1193
Joined: Sun Aug 17, 2014 7:27 pm

Re: [HELP] Unpack/Repack OFS3 Header Sword Art Online Hollow Realization

Post by makc_ar »

How to edit this files?

Image
Nameless32
Posts: 35
Joined: Sun Dec 21, 2014 7:43 pm

Re: [HELP] Unpack/Repack OFS3 Header Sword Art Online Hollow Realization

Post by Nameless32 »

makc_ar wrote:How to edit this files?

Image


U can Edit it manually

with this info.


offset where the text start.
Image


Go to offset.
Image


Copy or edit the text.
Image


Exemple:
Image


this " NUL " value is the end of the phrase " 0x00 ".
the lenght off all text must be " mod 4 = 0 ".
makc_ar
Posts: 1193
Joined: Sun Aug 17, 2014 7:27 pm

Re: [HELP] Unpack/Repack OFS3 Header Sword Art Online Hollow Realization

Post by makc_ar »

@Nameless32
Thanks a lot! You can write a tool export\import for these files?
Nameless32
Posts: 35
Joined: Sun Dec 21, 2014 7:43 pm

Re: [HELP] Unpack/Repack OFS3 Header Sword Art Online Hollow Realization

Post by Nameless32 »

Here.

Thanks to swuforce and yours sources, i've learned how to make my own tools.
makc_ar
Posts: 1193
Joined: Sun Aug 17, 2014 7:27 pm

Re: [HELP] Unpack/Repack OFS3 Header Sword Art Online Hollow Realization

Post by makc_ar »

@Nameless32
Thanks a lot! How about unpacking all files in folder?
Example:

Code: Select all

$Dir = FileSelectFolder("Select the folder...", "", "", @ScriptDir)
Rewinged
Posts: 4
Joined: Mon Sep 09, 2019 2:39 pm

Re: [HELP] Unpack/Repack OFS3 Header Sword Art Online Hollow Realization

Post by Rewinged »

I know this is a bit of a necro, but thought it'd be best ot post here than start a new thread.

I was wondering if anyone found a good workflow for changing text in the end? I'm probably messing up something simple. Here's the steps I'm following:

I unpack usa.cpk
I delete all folders except msg (contains the text I want to edit)
I either edit localize_msg.dat in notepad++ directly or I unpack the file using the script above to make a neat loc file for editing.
I edit even just a single word (overwriting the word with another of the same length ie 'hello' with 'heya')
I try to repack the file but it says the file size is different now (compressed file size that is, uncompressed is the same since it's the same amount of characters)

No matter how small the edit I find it odd that the file always ends up a few bytes larger. I've managed to get it to work on a few occasions by editing text elsewhere in the file by replacing it all with spaces which reduces the file size. Most the time the game will load with no text present anywhere, but occasionally it'll load correctly with the edited text.

I'm a 3D artist so a lot of the terminoligy here goes over my head but I'd love to learn, there's quite a lot of dialoge I'd like to change to be less repetitive and more engaging. I'm guessing some letters are larger than others? Maybe notepad++ is doing something weird to increase file size slightly? I'll have to try with changing just a single letter next time to see if it still happens.

Any help would be appreciated!

Here's a screenshot if it helps in any way... I simply changed the word 'Slay' into 'Prod' in this example
Image
Rewinged
Posts: 4
Joined: Mon Sep 09, 2019 2:39 pm

Re: [HELP] Unpack/Repack OFS3 Header Sword Art Online Hollow Realization

Post by Rewinged »

After spending several more hours trying to work it out, still running into the problem of the text simply not appearing in-game 90% of the time. If I make small edits like just changing a single word it works, but only after replacing other text somewhere with a bunch of spaces or whatever. If I change a whole sentence it works occasionally. If I change several sentences it never works. There's a post above explaining how to edit it mentioning offsets and such but the images don't work. They also linked a tool they made but unfortunately it does nothing for me except create a blank text file when using it on the localisation or any other file.

Just to be clear I'm definitely only replacing the text, I'm not erasing, deleting or adding characters, just changing them. The results are the same if I edit in notepad++, if I extract the text files using the above script and edit that way, or if I edit directly in a hex editor. It's why I'm so lost as to why changing a couple of letters would make the file a few bytes larger and thus unable to repack, or why no text at all appears in game if I edit more than a few words. Any help would be appreciated!

On a good note I've been making progress on changing out images in Hollow Fragment and Hollow Realization. The colours aren't quite right, seems like some channels are correct while others have the hue offset by a bunch, but I'll keep working on it. If I get too stuck I'll make another post in the the relevant channel for that :)
Delutto
Posts: 561
Joined: Tue Oct 13, 2015 1:26 pm

Re: [HELP] Unpack/Repack OFS3 Header Sword Art Online Hollow Realization

Post by Delutto »

Rewinged wrote:I try to repack the file but it says the file size is different now (compressed file size that is, uncompressed is the same since it's the same amount of characters)
Don't use the BMS script to repack cpk files, use some proper tool like YACpkTool.
Rewinged
Posts: 4
Joined: Mon Sep 09, 2019 2:39 pm

Re: [HELP] Unpack/Repack OFS3 Header Sword Art Online Hollow Realization

Post by Rewinged »

Delutto wrote:
Rewinged wrote:I try to repack the file but it says the file size is different now (compressed file size that is, uncompressed is the same since it's the same amount of characters)
Don't use the BMS script to repack cpk files, use some proper tool like YACpkTool.


Ahh thanks, I'll check that out as soon as possible for sure. I figured it was something simple like that. Hopefully that'll fix this problem for me cheers
Rewinged
Posts: 4
Joined: Mon Sep 09, 2019 2:39 pm

Re: [HELP] Unpack/Repack OFS3 Header Sword Art Online Hollow Realization

Post by Rewinged »

That did the trick, thanks so much Delutto! Even works for custom images too, they were showing up black before. Just as a heads up in case anyone happens to have this problem in the future, here's how I did the images.

Use rawtex to convert the file to .dds with these settings - offset to 9df , width and height to 1920 x 1080 , image type to r8g8b8a8_unom
Notice the DDS will be flipped upside-down but colors are correct.
Flip the image vertically and do your normal edits.
Before saving it out, swap the red and blue channels (no need to flip the image back vertically)
Save as .tga 32bit with alphas
Open the image as well as the original archived version in a hex editor
Replace blocks 0-11 of the TGA with blocks 0-9DE of the original file (the Phyre header stuff)
Image
Delete the last 20 blocks from the TGA (Truevision-xfile stuff)
Image
Save and it's done. Rename the TGA and replace the original archived version, then repack the .cpk with YACpkTool

It's super basic stuff and I'm just a beginner to this but hopefully it helps someone... There's probably much cleaner/easier ways of doing this but it's pretty fast and it works.
I don't get why the red and blue channels need to be flipped though to be honest. It's weird that in rawtex the images appear upside down with correct colours... If you reimport an image the right way up with normal colours it will show up right way up with red and blue channels swapped. It's only if you save right way up with red and blue swapped that suddenly the image will flip upside down and be correct in game. I'm sure others will the know the answer to this of course haha.

Transparency works fine too, here's a super quick test, replacing a tutorial message with a random monkey image
Image
haku0011
Posts: 29
Joined: Thu Sep 10, 2015 8:22 am

Re: [HELP] Unpack/Repack OFS3 Header Sword Art Online Hollow Realization

Post by haku0011 »