Gundam Ghiren's Greed Translation

Discussion in 'PSP - Hacking & Homebrew' started by Rex0009, Oct 2, 2016.

  1. Rex0009
    OP

    Rex0009 Member

    Newcomer
    31
    10
    Sep 27, 2016
    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;
     


  2. flame1234

    flame1234 GBAtemp Advanced Fan

    Member
    720
    407
    May 17, 2009
    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...
     
  3. LittleOneOu

    LittleOneOu Newbie

    Newcomer
    1
    0
    Oct 12, 2016
    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.
     
  4. Rex0009
    OP

    Rex0009 Member

    Newcomer
    31
    10
    Sep 27, 2016
    United States
    cool,

    The sprites are a great idea, and I'll take your advice and set up a proper project page.
     
  5. Rex0009
    OP

    Rex0009 Member

    Newcomer
    31
    10
    Sep 27, 2016
    United States
    [​IMG]

    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
    [​IMG] [​IMG]

    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, Oct 15, 2016
  6. BetaXenon

    BetaXenon Advanced Member

    Newcomer
    79
    16
    Jan 21, 2015
    Russia
    Samara, Russia
    Maybe it's filenames and extensions?
     
    Last edited by BetaXenon, Oct 16, 2016
  7. flame1234

    flame1234 GBAtemp Advanced Fan

    Member
    720
    407
    May 17, 2009
    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 ?
     
  8. Rex0009
    OP

    Rex0009 Member

    Newcomer
    31
    10
    Sep 27, 2016
    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.
     

    Attached Files:

  9. Rex0009
    OP

    Rex0009 Member

    Newcomer
    31
    10
    Sep 27, 2016
    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!

    [​IMG]
     
    BetaXenon likes this.
  10. Rex0009
    OP

    Rex0009 Member

    Newcomer
    31
    10
    Sep 27, 2016
    United States
    attached is a link to the quickbms script http://aluigi.altervista.org/bms/gundam_gihren.bms

    It's great for decompressing the SD0 files, but there is no function to re-compress.

    I've got the palette's and the image formats figured out. I just don't have any practical way to re-compress

    does anyone want to hop on the project?
     
  11. BetaXenon

    BetaXenon Advanced Member

    Newcomer
    79
    16
    Jan 21, 2015
    Russia
    Samara, Russia
    I wanna, though i can't help much. I can make transcription to Hiragana and Katakana but my knowledge of Kanji is pretty limited. And i really only have experience of English to Russian translation.
     
  12. Rex0009
    OP

    Rex0009 Member

    Newcomer
    31
    10
    Sep 27, 2016
    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)
    [​IMG]
     
  13. Echidna

    Echidna Newbie

    Newcomer
    4
    0
    Oct 25, 2016
    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.
     
  14. Rex0009
    OP

    Rex0009 Member

    Newcomer
    31
    10
    Sep 27, 2016
    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!
     
  15. Rex0009
    OP

    Rex0009 Member

    Newcomer
    31
    10
    Sep 27, 2016
    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!
     
  16. Rex0009
    OP

    Rex0009 Member

    Newcomer
    31
    10
    Sep 27, 2016
    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
     

    Attached Files:

  17. JDAthenrye

    JDAthenrye Newbie

    Newcomer
    3
    0
    Nov 9, 2016
    United States
    7
    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.
     
  18. Rex0009
    OP

    Rex0009 Member

    Newcomer
    31
    10
    Sep 27, 2016
    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
     

    Attached Files:

  19. Rex0009
    OP

    Rex0009 Member

    Newcomer
    31
    10
    Sep 27, 2016
    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!
     

    Attached Files:

    BetaXenon likes this.
  20. Rex0009
    OP

    Rex0009 Member

    Newcomer
    31
    10
    Sep 27, 2016
    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?
     
    JDAthenrye and BetaXenon like this.