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.

help with unknown texture format [eastward]

Featured Replies

  • Author
  • Localization

canboy, posted Mon May 10, 2021 1:02 pm (63871)


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:
  • Author
  • Localization

canboy, posted Fri Sep 17, 2021 12:37 pm (66472)


Update released file of the game :v
Its seem that still use the same index like a demo file
  • Author
  • Localization

LinkOFF, posted Mon Sep 20, 2021 1:30 pm (66564)


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 - ??
  • Author
  • Localization

canboy, posted Mon Sep 20, 2021 3:20 pm (66565)


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?
  • Author
  • Localization

LinkOFF, posted Mon Sep 20, 2021 3:46 pm (66566)


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

Idk what excatly pixel format is it.
  • Author
  • Localization

canboy, posted Tue Sep 21, 2021 4:04 am (66568)


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?
  • Author
  • Localization

canboy, posted Tue Sep 21, 2021 1:48 pm (66576)


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?
  • Author
  • Localization

canboy, posted Tue Sep 21, 2021 2:28 pm (66577)


some another information i'm digging around
  • Author
  • Localization

balbasar, posted Tue Sep 21, 2021 10:27 pm (66582)


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
  • Author
  • Localization

canboy, posted Wed Sep 22, 2021 1:08 am (66584)


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
  • Author
  • Localization

balbasar, posted Wed Sep 22, 2021 2:29 pm (66593)


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.
  • Author
  • Localization

balbasar, posted Thu Sep 23, 2021 1:25 pm (66614)


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.
  • Author
  • Localization

Delutto, posted Fri Sep 24, 2021 3:22 am (66622)


canboy wrote:
found out that game use bmfont
No, the game fonts are in the ttf.g package and are regular font files.
  • Author
  • Localization

canboy, posted Fri Sep 24, 2021 3:37 am (66624)


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
  • Author
  • Localization

Delutto, posted Fri Sep 24, 2021 4:19 am (66625)


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
  • Author
  • Localization

canboy, posted Fri Sep 24, 2021 9:44 am (66627)


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.
  • Author
  • Localization

Allen, posted Sat Sep 25, 2021 4:15 am (66633)


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.

eastward.bms

  • Author
  • Localization

canboy, posted Sat Sep 25, 2021 1:51 pm (66645)


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
  • Author
  • Localization

HydeFromT70s, posted Tue Oct 05, 2021 12:26 pm (66865)


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?
  • Author
  • Localization

cyborg77, posted Tue Oct 05, 2021 7:12 pm (66871)


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
  • Author
  • Localization

cyborg77, posted Wed Oct 06, 2021 7:55 pm (66883)


cyborg77 wrote:
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?

Image


Is there any way to replace this texture?

Image
  • Author
  • Localization

canboy, posted Sat Oct 09, 2021 8:55 am (66933)


cyborg77 wrote:
cyborg77 wrote:
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?

Image


Is there any way to replace this texture?

Image

use Crystaltile2 to view and edit
Image
  • Author
  • Localization

swat, posted Tue Oct 19, 2021 5:05 pm (67087)


which file in font.g is responsible for in-game font
and
how to add additional characters? (sS?IgG)
  • Author
  • Localization

canboy, posted Wed Oct 20, 2021 8:00 am (67095)


swat wrote:
which file in font.g is responsible for in-game font
and
how to add additional characters? (sS?IgG)

usebmfont to create image and fnt file
dialog font is pixel operator
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.