News:

11 March 2016 - Forum Rules

Main Menu

[PSP] Last Ranker Main Story Translation

Started by kkdecara, August 28, 2016, 08:41:14 PM

Previous topic - Next topic

kkdecara

Hello, i don't know if this was the right forum to post this, or if it should be in General Discussion.
But i beieve it was here. Anyways, thing is i found a download of the game translated 50%, that is, all the main story translated, but not any sidequests or NPC dialogue.
This is in nicoblog, and i was going to submit that translation since i see the site doesn't have it, but when i was filling the information i noticed several problems:
1-The game isn't even there
2-None of the two authors are even there
And so on.

This is the link so you can see what i'm talking about
==MOD EDIT==
Link removed for containing illegal material.


Maybe someone can fix that, or, how can i add new authors and games so it can appear on the list?

BlackDog61

Hey,
First, you need to remove this link, because there's unwanted contents on the other side of it. The authors haven't released this in a patch format, have they?
Which means you would probably want to generate a patch. Xdelta is highly recommended for PSP games for this. (Check on this site its download; it suggests the right options to obtain a smaller size patch. http://www.romhacking.net/utilities/928/ )

I know you can add games (it's explained in the submission flow on this site).
I don't know about authors, though, but I've seen people mentioned in the credits without their having a forum account, so I assume it should be done the same way?
EDIT: According to the guidelines:
"Double check that the game title and author name are not already in the database (or under an alternate name) before writing them in manually!"
... I'd assume they'll get auto-created when you submit.
Source: http://www.romhacking.net/translations/addentrypage/

NoOneee

#2
Link to the actual patches:
http://www.heroesoflegend.org/forums/viewtopic.php?f=12&t=268

Edit: It seems you need to download both the "v2" and "v2.3 from v2" patches and apply them in order.

Faz rank 4

I know how to hack other characters in last ranker (tested it only on jp version). But if anybody interested, ask me (you will need to mod game & use cwcheat).
Games that do not give me desired characters playable, or that have single playable character are not worth my time.

flame

#4
I am the author of this. I don't care if you submit it to the database, but it is too big for the file to be hosted here. The max is 25MB and the actual patch is 50MB.
I discovered a better method of making xdelta patches, from this site no less, recently. Here is the link: http://www.romhacking.net/utilities/928/ and just read the description to get the proper patch making method. I will try that to see if there's any change in patch size.

Edit: No, that's didn't help at all and the combined patch is 60MB.
You could just make a diff of the original to v2.3 and host that yourself.

NoOneee

#5
Quote from: flame on August 31, 2016, 12:04:51 PM
I am the author of this. I don't care if you submit it to the database, but it is too big for the file to be hosted here. The max is 25MB and the actual patch is 50MB.
I discovered a better method of making xdelta patches, from this site no less, recently. Here is the link: http://www.romhacking.net/utilities/928/ and just read the description to get the proper patch making method. I will try that to see if there's any change in patch size.

Edit: No, that's didn't help at all and the combined patch is 60MB.
You could just make a diff of the original to v2.3 and host that yourself.

Yeah, the smallest xdelta I could make combining your patches was 57.7MB (aligning the files in the ISO and not including the decrypted EBOOT.BIN and making the user decrypt it).
I don't really like the idea of including the decrypted EBOOT... We need a better way to make PSP patches. A command line utility to decrypt would be nice.

flame

If you're doing it that way, you need to extract EBOOT.BIN from v2.3 and make an xdelta patch between that and the original decrypted EBOOT.BIN and distribute it together with the other one.
Including a batch file to run the patch and xdelta might be a good idea too. This patch will be very small, probably < 1 kB. It's important. Your game will boot and run without crashing even with the original EBOOT, but stuff won't look right.

That's an extremely hard problem.
There is no command-line tool that builds "UMD" ISOs.
If there was, then we could do something like that.
I can code stuff, but there's a lot of stuff to code for such a hypothetical tool. Also I'm not sure the exact format - the proprietary parts. The basic format is the same as ISO 9660 but there are a lot of exceptions like capitalized filenames aren't required.
For people that make custom patchers I'm not sure how they do it.


The way to make a small patch would be:
1) extract and decompress files (bog standard gzip and zlib are used for this game)
2) patch each file (these patches will be small)
3) re-compress and rebuild each file
4) rebuild the "UMD" ISO

While you are at it, instead of step 2 you could rebuild from source, making any text customization, additions or changes you want (this is a text-only patch)

Step 4 I don't know how to actually do. I used UMDgen; I don't know how to do it programmatically.
Step 1 I'm not sure how to do either, but you can just use offset and size to extract them. Putting back is more difficult as file size in the directory table must be updated.
I don't know of a tool that decrypts EBOOTs either. PPSSPP will decrypt the EBOOT for this game; I'd have to examine the source to see how it does it. PPSSPP is open source, so it's possible to do. But I don't know C language very well. JCPSP will do it too. I don't know of a stand-alone tool that does this.

Another thing I could try is standard-level compression instead of maximum. I used zlib compression level "9" (maximum) when I built the game. I think Capcom used compression level "6" (standard) when they built it.

NoOneee

The UMD_REPLACE utility can replace the files just fine I think: http://www.romhacking.net/utilities/891/
You would just need to make a batch to replace everything needed.
The only inconvenience is the fact that we don't have any command line EBOOT decryption utility  :(
I think we can ask the user to decrypt it and put in the same folder as "EBOOT.BIN", and the batch file would patch that and replace the original file with UMD_REPLACE.

BlackDog61

Quote from: NoOneee on September 01, 2016, 08:53:42 AM
Yeah, the smallest xdelta I could make combining your patches was 57.7MB (aligning the files in the ISO and not including the decrypted EBOOT.BIN and making the user decrypt it).
I don't really like the idea of including the decrypted EBOOT... We need a better way to make PSP patches. A command line utility to decrypt would be nice.
Could you confirm that was with the special option mentioned in the link that Flame posted? (http://www.romhacking.net/utilities/928/)
'Cause without it, xdelta isn't really that efficient.

flame

Yep, confirmed.
Besides, he used aligned data, so that option wasn't really necessary.
The increased size comes from compression.

NoOneee

#10
I think I've managed to port the PPSSPP decryption to a simple command line application. I just need to polish it a little and I'll release it here.

September 02, 2016, 11:12:04 AM - (Auto Merged - Double Posts are not allowed before 7 days.)

Done:
File: deceboot_0_2.zip (234491 bytes)
SHA-256: 1254a6fad9805372c835f2025b5e39bec57c7fbd3e772b23a315108facc9d1c4
Link: https://mega.nz/#!qYVF0YbZ!mGFbUO2w45Jqsp0H-DpdXwsgGaSp6Oj7WEZGwpyEQck

I've also submitted it to this site as an utility. Only a Win32 binary is included, but it should compile and work fine on Windows/Linux 32bit and 64bit.

Edit: Does anyone know any small, free utility that can be bundled with patches to extract specific files from an ISO? Is 7zip the best thing for the job?

Edit2:
Here's my general idea for a PSP hack batch file:
1. Extract EBOOT.BIN from ISO (using 7zip?)
2. Decrypt EBOOT.BIN (using the utility linked above)
3. Replace the ISO's EBOOT.BIN (using UMD_REPLACE)
4. Apply xdelta patch to the ISO (using Xdelta  :))

For this specific translation patch this will unfortunately still create a ~58MB xdelta, but at least this way we can avoid including the copyrighted decrypted EBOOT. You can of course extract more files using 7zip, patch them using a more specific method (compressing and decompressing in this case) and replace them with UMD_REPLACE. You might not need Xdelta at all, except maybe for patching the decrypted EBOOT.

Edit3: Updated link with the latest version of the Deceboot utility (fixed compilation on Linux).

flame

#11
The patch is big because I can't do a compression roundtrip.

Here, I wrote this simple program in Python 3. It uses all standard library functions, you don't need anything extra. Extract game and run from \GAMEDATA\FLD\MAP folder, feel free to set any filename you want. To see the problem, you have to be using original game files. The modified files were compressed using the Python 3 toolkit so they will match up if you run this tool using them.
import gzip
from binascii import hexlify
filename = 'MAP_I_GAN_09'
with gzip.open(filename + '.bin') as f:
    with open(filename + '.unc', 'wb') as g:
        g.write(f.read())
with open(filename + '.bin', 'rb') as f:
    f.seek(0xA)
    s1 = hexlify(f.read(0x10))
    print('Match this:', s1)
with open(filename + '.unc', 'rb') as f:
    for n in range(1, 10):              #Try each compression level
        f.seek(0)
        s2 = hexlify(gzip.compress(f.read(), n)[0xA:0x1A])
        print(n, s1 == s2, s2)


So the idea then is to work around this by:
1) Decompress
2) Apply patches (will be small)
3) Compress again

This will reduce the size of the patch to ~5MB, I think. It will certainly be under the 25MB limit. That's where most of the patch size comes from: lack of understanding of compression algos.
---------------------------
CUE's tool is slow and I have to call it 163 times. I would like to try writing my own.

I have the ISO file extractor program written. It does the pseudocode above but adding "extract files" as the first step. The EBOOT pseudocode is:
1) extract EBOOT
2) decrypt EBOOT
3) patch EBOOT
4) insert EBOOT
-----------------------------
http://www.mediafire.com/download/e0g989zfu8n8eii/LR_v2_3_mod.7z
Okay, finally got it.
Not sure how to release a patch like this, but there you go.
60MB patch -> about 1.5MB which is small enough for RHDN.
There are no differences from the current version, available elsewhere.

NoOneee

Nice work flame, somehow I missed your update. :)
So, is anyone going to submit the translation here? Where is OP now? :laugh:
Do you want me to do it?

flame

I need someone to beta test it to make sure it will install to "base" copies of the ISO.

If you feel like you need to use the ISO_extract tool in any of your projects, feel free to. It's able to read path tables and it has a replace function that can put another file overtop of an existing file if there's enough space for it. I am not a programmer (err... I don't get paid to program computers), so I'm not sure about whether the tool is programmed correctly or about making proper docs so someone else can use it effectively.

You're not allowed to double post. Or should I just go ahead and double post when I have an update?

Also, I've learned more about making batch files since publishing this. You need to use "py" (Python Launcher) command rather than the python command itself, because this will work if the user has not added Python to their system path (which is optional during install). Syntax goes:
py -3 script.py args


I have zero submissions so far, so I'd appreciate it if you'd let me have this one.
This goes in "unfinished" category because it's a 50% patch, and I have no plans of proceeding further with this project. I guess that means I need to include even more than just this patcher.
I undertook the project because someone had already translated all the text you see in this patch, and I thought it would be a shame to let their good work go to waste.

Anyway, I need someone to beta test this to make sure it will install to their base copy.

Thanks for your help BTW. I used the program deceboot three other times already besides this project because ISO_Extract plus deceboot means they only need the ISO. ISO_Extract can extract and insert it, deceboot can decrypt it, and a custom program (will be different for each project) can modify it.

It's just insane to me we can now publish patches directly on some forums because they're so tiny: Link


NoOneee

#15
I've tested the patch and the game seems to working fine  ;)
I have both Python2 and Python3 instaled, but only Python2 is in the PATH.
If I use just "py" it opens python2 in my case. The solution is to use py -3 to force the use of version 3.X of Python (I saw that here https://docs.python.org/3/using/windows.html).

py -3 patch.py %1

works fine for me.

Suggestion: put everything (besides the patch.bat) in a separated folder, it's less confusing that way.

It seems that every time I run the patcher I get a slightly different ISO (the hash is different). Do you know why this happens?

Edit:I've figured it out why the resulting ISOs are different every time. The gzip header contains a timestamp. I think you should force some value in those bytes to keep all patched ISOs the same. Perhaps keep the original file timestamp?

flame

#16
It does run-time compression by GZIP algorithm. It is putting the current time into those GZIP headers, as required by the GZIP spec.
If it is really important, I could put a fixed time by passing in mtime argument. Please advise. Should I put mtime = 0, should I copy mtime from the original files, or should I just use the current system time?
End users won't care about this, I'm pretty sure.
-------------------
OK, thanks for the suggestion, I'll incorporate them.
-------------------
OK, submitted. We'll see what the decision on this one is.

NoOneee

It seems it got accepted, congrats :)
http://www.romhacking.net/translations/2747/

In the description you seem to have listed "Most of the main story (scripts)" in both "Done" and "Not done" sections... probably a 'copy paste error'.
I think you should be more clear that the user needs to install Python 3.5+ in order to patch the game. I assume most people don't have that installed or even know what that is.
Something like:
"The script used in this patch requires Python 3.5+. If you don't have it installed, you can download it at https://www.python.org/downloads/"

SysopGrace

Hi,
I'm looking for some clarity on the version numbering here. The romhacking.net entry is here: http://www.romhacking.net/translations/2747/ is showing v1 (called 1.7 in the patch's .zip file itself though) but I came across the thread over at http://www.heroesoflegend.org/forums/viewtopic.php?f=12&t=268 which goes on up to v2.3

now this thread here at RH.net is a lot more recent than the other one and is not simply an .xdelta patch file like the older one. what version number should the one on RH.net be given?

flame

The RHDN one is smaller by a lot, it's about 5% of the size of the old patches.
It's tougher to install, and has tools included that you can use to modify the text content, like add extra translations or change the ones I provided for you.

v1 is OK. The finished game you get from installing this is the same as v2.3 of the old patches. This one works differently so I'll give it a v1.