Hacking Gundam Ghiren's Greed Translation

Rex0009

Active Member
OP
Newcomer
Joined
Sep 27, 2016
Messages
31
Trophies
0
Age
42
XP
93
Country
United States
Hey,

I translated an explanation of the compression from a korean site,

does this look familiar to anyone


The Compression used in the game Axis No KYoui is a Pre-compression method, a type of the LZ77 compression scheme.
A description of the header information is purposely omitted.
The compressed data will be in the pattern of 1 bite that is gathered by 8 flag bit and 8 chunks.
Ex) [Flag][chunk0][chunk 1][chunk2][chunk3][chunk4][chunk5][chunk6][chunk7][flag][chunk0][chunk1]....

Each bit of the flag indicates whether the chunk was compressed or not.1 means compressed chunk, 0 will be the chunk has not been compressed and has a size of 1 bite.
#0bite represents # 0 chunk, while #7bit represents #7 bit.


There are 4 types of compressed chunk.

If the first bite of the chunk’s lower nibble has a value of 0, thats mean it is a long compression.1 means RLE, 2means Copy, the rest means compressed.
Long compressed chunks are formed with 3 bites.

If the 3bite comes in the order of [H0:L0][H1:L1][H2:L2] ,( H is upper nibble,4 bit), L is lower nibble. They are enclosed by bite. L0 is 0.

The enclosed 12 bit which is the order of H1 L1 H0, helps you to understand how much backwards you have to refer in advance starting from current cursor.

Add 0x10 to 8bit which is enclosed by H2 L2, that tells you how much bite you have to bring.

If it is 30 12 24 , after seeing L0 which is 0, you know it is a long compressed chunk . 0x123 tells you how much you have to refer backward from previous.
and (0x24 + 0x10)is how much bite you have to bring from there.

RLE chunks are formed by 2 bite.
L0 has to follow 1. Add3 to H0 tells you how many times you have to repeat.[H1:L1]tells repeating bite.
If it 21 78, that means 0x78 words was repeated 2+3 times.

Copy chunks are formed by 2+nbite.
In case L0 is 2, add0x12 to H1 L1 H0, you will know how much bite you have to copy. You just have to copy the data shows after that.

Compressed chunk is formed by 2bite.
The value of L0 same as previously brought data’s bite. H1 L1 H0 tells you how much you have to go backward from the current cursor.

There are 3 points in total.
1. The point that indicates from previous to present .
2. The point that indicates the present of compressed input file.
3. After decompressing and saving, the point that is used for output.


It reads one bite from the input point. Input point will move automatically.
After seeing the bite, it will make an assumption that it is a copy chunk.

After reading another bite, it will calculate the length of n. input point will move automatically.
for(i = 0; i < n; i++) {
c = fgetc(input point);
fputc(c, output point);
Previous [previous point ] = c; previous point++;
}

Previous size was 4kb. Since the range of previous point was 0~4095, after4095, instead of 4096, it will move back to 0.
Previous point= (previous point+ 1) % 4096;
 

flame1234

Well-Known Member
Member
Joined
May 17, 2009
Messages
734
Trophies
0
XP
957
Country
United States
Looks pretty standard.
At least someone figured it out for you. Now all you need is to make decompressor yourself, then you can make compressor yourself.
Seems like a lot of work. Up to you if you wanna do it...

2 (copy) and X (compress) codes seem unclear. Some experimentation required...
 

LittleOneOu

New Member
Newbie
Joined
Oct 12, 2016
Messages
1
Trophies
0
Age
42
XP
51
Country
United States
Hey,
I'm really interested in your project and would like to do some graphics hacking and replacement, the sprites representing units are really drab and
look like chess pieces, I think it would be fun to design a new more appealing set. Before we start though, I'd like to make a few suggestions.
I've lurked on GBA Temp for a long time, and the initial way you presented your project is probably why you haven't recieved allot of
assitance/attention. I love Giren No Yabou allot, its really a fun game but it really is a niche oriented game. The obscurity and the
requirement for knowing a fair amount of kanji, turns allot of people off.

if you want to move forward with this I would suggest a proper thread that lets the members see the unique aspects of the game.
I would describe the awesome variety of units, the effects of politics and decision making on how the game plays, and the really challenging strategy
involved.

Also I'm almost positive your the guy responsible for the ongoing Kancolle Kai translation for vita. Why didn't you make a thread here???
The members would be really interested in it, and it would show that you have some skill and history in rom hacking. I tried the pre alpha build
that you guys released on your discord channel, and I'll give you a thumbs up for the speed and accuracy of allot of the early translations.
These boards are really programmer centric, but I think if people were aware that your a somewhat talented translator with some rom hacking experience they would be more on people on board to help you design a decompression/compression program.

There are a ton of posts on this board of ' I would like to translate X ' and the person has no programming or language
skills...so you have to understand that's why people are bit hesitant.

So yah this was a wall of text, but I hope you take some of my suggestions, and take me up on my offer for graphics hacking/translation.
I think if you rectify your presentation a bit and make a proper project thread, you would find a programmer in no time.
 

Rex0009

Active Member
OP
Newcomer
Joined
Sep 27, 2016
Messages
31
Trophies
0
Age
42
XP
93
Country
United States
Filetype.png


So I've started using the Image extraction program as sort of a debugging program, so I can identify with trial and error which part of the header does what.

So to start
1. We have a 4byte SD0 Header that identify's the container
2. The 2nd 4Bytes is The Size of The SD0 in Little endian

3. 4 Unknown Bytes, I'm not sure,when I subtract -1 for either AC D5, this happens to the image
vosj12.jpg
vosj12.jpg


It only draws it partially, so is that pair a pointer of some sort...I try adding the number to the address, but 54700 is nowhere in the file?

any ideas?
 
Last edited by Rex0009,

flame1234

Well-Known Member
Member
Joined
May 17, 2009
Messages
734
Trophies
0
XP
957
Country
United States
You need to use asm to help yourself out.
Try setting a breakpoint on texture data in RAM.
You find the texture data by GE Debugger in PPSSPP. It's "texture address" - that's where texture data is located.
Set a breakpoint on the texture data and you should be able to locate the decompression routine.

Also you need to get the decompressed version of this using the different PPSSPP tools to help yourself out. It will enable you to check your guesses.

This is just a pure guess but:
0x4: Compressed size
0x8: Decompressed size(?)
0x11: Compressed size(?)
0x15: Decompressed size(?)

That compression starts after where it says PSET and the first flag byte is 0x25 + 0x1C ?
 

Rex0009

Active Member
OP
Newcomer
Joined
Sep 27, 2016
Messages
31
Trophies
0
Age
42
XP
93
Country
United States
Update,

I have the compression scheme mapped out and the SD0 files, unpacked....Right now I'm left with the sub file, "MRG" which appears to be an archive that isn't compressed. The textures in any archive are labeled as CMP0 with "TX" identify for the texture. The textures don't seem to resemble anything I've seen in other games.

I've went into the crystal tile 2 and haven't been able to find any graphics, I'm going to have to think of a different approach

I'm attaching the bms file, and an unpacked SD0/MRG.
 

Attachments

  • WorkFolder.rar
    66.3 KB · Views: 209

Rex0009

Active Member
OP
Newcomer
Joined
Sep 27, 2016
Messages
31
Trophies
0
Age
42
XP
93
Country
United States
Finally Found the textures!!!

Big step!, So Eboot.bin is modifiable, Textures Found,
I'll have to start over from scratch translating because I have no idea how I would integrate my images into this, But I'm happy I've Slain this beast....

on to next!

20i73mv.jpg
 
  • Like
Reactions: BetaXenon

Rex0009

Active Member
OP
Newcomer
Joined
Sep 27, 2016
Messages
31
Trophies
0
Age
42
XP
93
Country
United States
Beta, Sure once I get all the image text dumped into spread sheets I'd love the help

also I'm attaching the compressed and uncompressed headers of the MRG files...(This is the same file)
2133uag.png
 

Echidna

Member
Newcomer
Joined
Oct 25, 2016
Messages
5
Trophies
0
Age
43
XP
703
Country
Poland
Sadly I have no skills that could be of use in the translation process, but godspeed Rex0009. Best of luck to you, I would love to play this game in english even if it's just a UI\gameplay patch and I'm sure there are others.
 

Rex0009

Active Member
OP
Newcomer
Joined
Sep 27, 2016
Messages
31
Trophies
0
Age
42
XP
93
Country
United States
Thanks man, I have a great deal of the game translated...I'm at about 50% of the Zeon(Ghiren Zeon) path. But my Knowledge of ASM and Compression are low...so it's going to be a slow slog...Hopefully, I'll be able to figure out the recompression Algo, but it may not happen. Even if I give up on inserting it myself. I'll upload the uncompressed MRG files, so someone in the future can finish the project (hopefully they like the font!)

but thank you for your support!
 

Rex0009

Active Member
OP
Newcomer
Joined
Sep 27, 2016
Messages
31
Trophies
0
Age
42
XP
93
Country
United States
I'm going to have to back off this project for awhile, I can't figure out how to re-compress the images.
I'm going to make notes and post everything I've figured out to this point including how the uncompressed images are stored, palette etc.
Also, After I clean the language up I'll post all the translations I've done to this point (I'm going to finish the 1st Zeon route)

Thank's allot for all the help you guys have given me!
 

Rex0009

Active Member
OP
Newcomer
Joined
Sep 27, 2016
Messages
31
Trophies
0
Age
42
XP
93
Country
United States
Update:

I took the x86 binary and matched it to the image extraction program, with a debugger..... here is the decompression routine in ASM, for anyone that is interested
 

Attachments

  • decompression routine.txt
    3.4 KB · Views: 430

JDAthenrye

New Member
Newbie
Joined
Nov 9, 2016
Messages
3
Trophies
0
Age
35
Location
7
XP
60
Country
United States
Hey. Well if you ever figure it out and pick up the project again. I wouldn't mind helping with the translations. I was talking with some people about modding the PS2 version of the game, but nothing ever came of it. I don't know much programming besides Java, so I doubt I could help on that end.
 

Rex0009

Active Member
OP
Newcomer
Joined
Sep 27, 2016
Messages
31
Trophies
0
Age
42
XP
93
Country
United States
Hey,

The compression is the same between the games....

I'm attaching a C program, to decompress single files, not full MKD archives but one SD0 archive within.

and if I ever figure out re-compression, I'd love your help
 

Attachments

  • decompress.rar
    1.1 KB · Views: 230

Rex0009

Active Member
OP
Newcomer
Joined
Sep 27, 2016
Messages
31
Trophies
0
Age
42
XP
93
Country
United States
So I've got a semi complete compression program the file size is bigger than the original :-(

I haven't figured out how to crack the final type of compression which appears on top of the lz and the rle: it avoids using markers for repeated literals.

so blah....it's coming along slowly

but....one day this game will be translated!
 

Attachments

  • compressed.rar
    39.8 KB · Views: 213
  • Like
Reactions: BetaXenon

Rex0009

Active Member
OP
Newcomer
Joined
Sep 27, 2016
Messages
31
Trophies
0
Age
42
XP
93
Country
United States
Big update!

I've figured out the compression and can now replicate the exact scheme of the original!

So at this point I'm trying to figure out the best way to deal with the graphics. Can anyone recommend the best tile viewer to use, and link me to a short tutorial?
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • BigOnYa @ BigOnYa:
    True, everything almost double nowadays
  • K3Nv2 @ K3Nv2:
    But I could go to Aldis and get a cookie pie for like $4
  • BigOnYa @ BigOnYa:
    Or use your new cooking pan and make some, don't mind the Old leftover foods mixed in.
  • K3Nv2 @ K3Nv2:
    Just eat plain flour around cops
  • BigOnYa @ BigOnYa:
    thats Gluten abuse, they would shoot you
  • K3Nv2 @ K3Nv2:
    Depends on the color chart
  • K3Nv2 @ K3Nv2:
    Wheat flour has a lower chance at survival
  • Veho @ Veho:
    Isn't wheat flour the whitest of the white?
  • Veho @ Veho:
    Rye would get shot at sight.
    +1
  • K3Nv2 @ K3Nv2:
    Depends
    img_5941-1.jpeg
    everyone mixing their flour now days
  • Veho @ Veho:
    That's whole wheat, right? Because all purpose flour is also made from wheat.
  • K3Nv2 @ K3Nv2:
    I'm not a flour expert I just snort it
  • BigOnYa @ BigOnYa:
    There also is black rice flour, and its really black colored
  • Veho @ Veho:
    Bruh that's gray.
  • K3Nv2 @ K3Nv2:
    That's ancientboi color
    +1
  • Veho @ Veho:
    You need to add some activated charcoal.
    +1
  • BigOnYa @ BigOnYa:
    I've seen some that are dark dark, my wifey uses it sometimes in her bs recipes
  • Veho @ Veho:
    Cool.
  • SylverReZ @ SylverReZ:
    @BigOnYa, Seems like your wifey likes hers black. :creep:
  • Veho @ Veho:
    "BS" stands for "Bowel Scraping" because that's what whole grain does.
    +1
  • K3Nv2 @ K3Nv2:
    I've been eating honey wheat bread scrumptious
  • K3Nv2 @ K3Nv2:
    https://a.co/d/9xDkOHc lol living on the edge
    K3Nv2 @ K3Nv2: https://a.co/d/9xDkOHc lol living on the edge