ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Tue Oct 26, 2021 5:10 am

All times are UTC




Post new topic  Reply to topic  [ 25 posts ]  Go to page 1 2 Next
Author Message
PostPosted: Mon May 10, 2021 1:02 pm 

Joined: Fri Jun 26, 2020 3:24 pm
Posts: 34
i'm digging around the demo version of eastward, and found out that game use bmfont, but the texture have been encrypt to sth don't have extension, not png like be mention.
so i post here for someone plz help decrypt it.
tks u so much

edit:I think all of the png for this game use the same encrypt way, with pgf header, at $4-$7 is size of the file, at $C-$F is the offset of long size - 1D... But i dunno how to write a scrypt for bms :lol:


Attachments:
File comment: here is the texture
4f3ea2df12fa08a5a2bd19fd029d328e.rar [59.11 KiB]
Downloaded 176 times


Last edited by canboy on Fri Sep 17, 2021 12:38 pm, edited 1 time in total.
Top
   
PostPosted: Fri Sep 17, 2021 12:37 pm 

Joined: Fri Jun 26, 2020 3:24 pm
Posts: 34
Update released file of the game :v
Its seem that still use the same index like a demo file


Attachments:
File comment: Example file
4f3ea2df12fa08a5a2bd19fd029d328e.rar [59.31 KiB]
Downloaded 132 times
Top
   
PostPosted: Mon Sep 20, 2021 1:30 pm 
User avatar

Joined: Thu Aug 11, 2016 6:52 pm
Posts: 39
My suggestion:
Code:
0x00-0x02 (string) — magic “PGF”
0x03 (byte) — number of color channels? values from 1 to 4
0x04-0x07 (uint_32) — full pgf lenght

if(0x03 == 4)
    0x08 — 0x0B — ??

0x0C — 0x0F (uint_32) — data lenght
0x10-0x13 (uint_32) — width?
0x14 — 0x17 (uint_32) — height?
0x18 (byte) — bit depth?
0x19 — 0x1F — ??


Top
   
PostPosted: Mon Sep 20, 2021 3:20 pm 

Joined: Fri Jun 26, 2020 3:24 pm
Posts: 34
LinkOFF wrote:
My suggestion:
Code:
0x00-0x02 (string) — magic “PGF”
0x03 (byte) — number of color channels? values from 1 to 4
0x04-0x07 (uint_32) — full pgf lenght

if(0x03 == 4)
    0x08 — 0x0B — ??

0x0C — 0x0F (uint_32) — data lenght
0x10-0x13 (uint_32) — width?
0x14 — 0x17 (uint_32) — height?
0x18 (byte) — bit depth?
0x19 — 0x1F — ??

So...
Is there anyway to view and edit that texture?


Top
   
PostPosted: Mon Sep 20, 2021 3:46 pm 
User avatar

Joined: Thu Aug 11, 2016 6:52 pm
Posts: 39
canboy wrote:
So...
Is there anyway to view and edit that texture?

Idk what excatly pixel format is it.


Top
   
PostPosted: Tue Sep 21, 2021 4:04 am 

Joined: Fri Jun 26, 2020 3:24 pm
Posts: 34
LinkOFF wrote:
canboy wrote:
So...
Is there anyway to view and edit that texture?

Idk what excatly pixel format is it.

Could there anyway to Guess that format?


Top
   
PostPosted: Tue Sep 21, 2021 1:48 pm 

Joined: Fri Jun 26, 2020 3:24 pm
Posts: 34
LinkOFF wrote:
canboy wrote:
So...
Is there anyway to view and edit that texture?

Idk what excatly pixel format is it.

i found in library something like
Code:
<$0C>setRGBA<$08>

is it helpful?


Attachments:
File comment: the file contain that thing
TextureHelper_.rar [985 Bytes]
Downloaded 71 times
Top
   
PostPosted: Tue Sep 21, 2021 2:28 pm 

Joined: Fri Jun 26, 2020 3:24 pm
Posts: 34
some another information i'm digging around


Attachments:
asset.rar [120.09 KiB]
Downloaded 64 times
Top
   
PostPosted: Tue Sep 21, 2021 10:27 pm 

Joined: Tue Sep 21, 2021 10:24 pm
Posts: 3
So those files look like compiled LuaJIT. I was able to run them through an appropriate decompiler to get legible code. Nothing that really elucidated anything about the "PGF" format. Where did you pull the files from the assets file from? I wasn't able to find those going through the g archives but I don't believe I looked very closely


Top
   
PostPosted: Wed Sep 22, 2021 1:08 am 

Joined: Fri Jun 26, 2020 3:24 pm
Posts: 34
balbasar wrote:
So those files look like compiled LuaJIT. I was able to run them through an appropriate decompiler to get legible code. Nothing that really elucidated anything about the "PGF" format. Where did you pull the files from the assets file from? I wasn't able to find those going through the g archives but I don't believe I looked very closely

it's inside the lib.g actually
mock/gfx/asset


Top
   
PostPosted: Wed Sep 22, 2021 2:29 pm 

Joined: Tue Sep 21, 2021 10:24 pm
Posts: 3
Ah I see, I found it. I wasn't using quickbms to extract the .g files and was only pulling 2 levels of files out. Now I can peruse them. I see mentions of loading the decks and atlas textures but I'll have to pore through it to try to see if there are any good hints for interpreting the data.


Top
   
PostPosted: Thu Sep 23, 2021 1:25 pm 

Joined: Tue Sep 21, 2021 10:24 pm
Posts: 3
Small update:
Looking more into the files the offsets appear inconsistent therefore leading me to believe either there is some serialization/deflating that is occurring. Additionally some files have less bytes than the resolution marked in the accompanying json file (so definitely some compression or deflation).

The lua files themselves don't really go into the file parsing, rather they make use of lua-cpp bindings provided by the MOAI Framework. This framework is open source and compiled into the game binary. The author of this game forked their own version and added a MOAIImageFormatHmg class to interpret hmg (and I assume the atlas files as well since they share the starting magic bytes even though they are not .hmg terminated). I poked around a bit with ghidra but I'm no where near competent with it. I may be able to make a bit more headway with debugger so I can plod my way to where these files are loaded and how.

There may be an easier way of doing this but I have yet to find it.


Top
   
PostPosted: Fri Sep 24, 2021 3:22 am 
User avatar

Joined: Tue Oct 13, 2015 1:26 pm
Posts: 552
canboy wrote:
found out that game use bmfont
No, the game fonts are in the ttf.g package and are regular font files.

_________________
Tribo Gamer Brasil


Last edited by Delutto on Fri Sep 24, 2021 3:52 am, edited 1 time in total.

Top
   
PostPosted: Fri Sep 24, 2021 3:37 am 

Joined: Fri Jun 26, 2020 3:24 pm
Posts: 34
Delutto wrote:
canboy wrote:
found out that game use bmfont
No, the game fonts are in the ttf.g package and are regular font files. Both smallest files are TTF fonts and the others are OTF.

not at all
the dialog font are bitmap,store in font.g, but can switch to ttf normally
i'm just curios about how to view that font image


Top
   
PostPosted: Fri Sep 24, 2021 4:19 am 
User avatar

Joined: Tue Oct 13, 2015 1:26 pm
Posts: 552
canboy wrote:
not at all
the dialog font are bitmap,store in font.g, but can switch to ttf normally
i'm just curios about how to view that font image
Well, so the devs left some junk fonts behind, because there are many ttf and otf fonts files...

ttf.g
Image

font.g
Image

_________________
Tribo Gamer Brasil


Top
   
PostPosted: Fri Sep 24, 2021 9:44 am 

Joined: Fri Jun 26, 2020 3:24 pm
Posts: 34
Delutto wrote:
canboy wrote:
not at all
the dialog font are bitmap,store in font.g, but can switch to ttf normally
i'm just curios about how to view that font image
Well, so the devs left some junk fonts behind, because there are many ttf and otf fonts files...

ttf.g
Image

font.g
Image

Well we can use that ttf to translate instead of bitmap font but that font in game have some weird problem so i still prefer use the bitmap font instead
Somehow right now i could only use the ttf one.


Top
   
PostPosted: Sat Sep 25, 2021 4:15 am 

Joined: Tue Sep 01, 2015 9:44 am
Posts: 94
The data is compressed, and I scanned it with quickbms to show that it uses the "LZ77EA_970" compression algorithm.

Format:
Code:
char    magic[3];//PGF
byte    unkLen;
DWORD   fileSize;
byte    unkData[unkLen];
DWORD   dataSize;
DWORD   width;
DWORD   height;
byte    bpp;
byte    unk2;
byte    unkLen2;
byte    unk3;
byte    unkData2[unkLen2];
byte    datas[dataSize];

Image


If change comtype to LZ4, it Also Worked.
It should be used LZ4 compression algorithm, but they have the same algorithm for decompressing data.


Attachments:
eastward.bms [460 Bytes]
Downloaded 61 times
font.png [89.11 KiB]
Not downloaded yet
Top
   
PostPosted: Sat Sep 25, 2021 1:51 pm 

Joined: Fri Jun 26, 2020 3:24 pm
Posts: 34
Allen wrote:
The data is compressed, and I scanned it with quickbms to show that it uses the "LZ77EA_970" compression algorithm.

Format:
Code:
char    magic[3];//PGF
byte    unkLen;
DWORD   fileSize;
byte    unkData[unkLen];
DWORD   dataSize;
DWORD   width;
DWORD   height;
byte    bpp;
byte    unk2;
byte    unkLen2;
byte    unk3;
byte    unkData2[unkLen2];
byte    datas[dataSize];

Image


If change comtype to LZ4, it Also Worked.
It should be used LZ4 compression algorithm, but they have the same algorithm for decompressing data.

It's kinda work.
Tks bro


Top
   
PostPosted: Tue Oct 05, 2021 12:26 pm 

Joined: Mon Nov 02, 2020 1:14 pm
Posts: 4
Guys, do you know exactly which file in font.g or ttf.g is responsible for in-game font and how can I edit it to add some additional characters?


Top
   
PostPosted: Tue Oct 05, 2021 7:12 pm 

Joined: Tue Oct 05, 2021 7:07 pm
Posts: 2
HydeFromT70s wrote:
Guys, do you know exactly which file in font.g or ttf.g is responsible for in-game font and how can I edit it to add some additional characters?


...

font: CyborgSister.fnt
font/7b7429240ecf3b09c2bbf45524914d80

pixmap: CyborgSister.png
font/44543f1de71bbc95b2cc75c356c00bd5

Code:
./quickbms -o -d eastward.bms font.g_extract/44543f1de71bbc95b2cc75c356c00bd5


Image


https://www.dafont.com/cyborgsister.font


Attachments:
cyborgsister.png [28.86 KiB]
Not downloaded yet
Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 25 posts ]  Go to page 1 2 Next

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited