• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
September 25, 2020, 08:50:23 pm

News:

Use of ePSXe before 2.0 is highly discouraged. Mednafen/RetroArch is recommended for playing/testing, pSX is recommended for debugging.


FFT Patcher .478 Source Code

Started by formerdeathcorps, May 14, 2011, 03:57:55 am

Glain

May 14, 2011, 03:57:55 am Last Edit: August 26, 2020, 10:53:04 am by Glain

Latest in-progress version (.493 Beta v4) here. (Direct download | Patch notes)
Latest full release (.492) here. (Direct download)




Original post from fdc:

I know everyone's been waiting forever for this, so here it is.

This is the original from Melonhead for .478, errors and all.

NEWEST VERSION HERE:
http://ffhacktics.com/smf/index.php?topic=7163.msg212754#msg212754

-Elric
  • Modding version: Other/Unknown

Pride

What are some errors in .478? I heard that the propositions don't work but is there anything else?
  • Modding version: PSX
Check out my ASM thread. Who doesn't like hax?

despa



formerdeathcorps

May 16, 2011, 07:42:42 pm #4 Last Edit: May 16, 2011, 07:43:17 pm by formerdeathcorps
Quote from: Pride on May 14, 2011, 04:30:57 am
What are some errors in .478? I heard that the propositions don't work but is there anything else?


Let's see:
1) orgASM is reputed to fail (as in create bugged files).
2) TacText is reputed to fail (as in create glitched text).
3) My compilation of FFTPatcher doesn't load at all.
4) ShiShi's EVTCHR editor is half-done.
The destruction of the will is the rape of the mind.
The dogmas of every era are nothing but the fantasies of those in power; their dreams are our waking nightmares.

Pickle Girl Fanboy

Did you do this manually, or with Subversion?  Can we download specific builds with Subversion?

formerdeathcorps

Quote from: Pickle Girl Fanboy on May 16, 2011, 07:44:20 pm
Did you do this manually, or with Subversion?  Can we download specific builds with Subversion?


I have no clue what Subversion is.  All I did last April was take melonhead's .478 files from his online source folder, opened it up in my C# compiler, fixed enough runtime bugs so the thing would compile right (this took 2 nights of work), and then released it.
The destruction of the will is the rape of the mind.
The dogmas of every era are nothing but the fantasies of those in power; their dreams are our waking nightmares.

Pickle Girl Fanboy

I just figured out what subversion is a week ago.  It automatically downloads source files from a specified location, and it can do other things too.  Hopefully, it can download specific versions.  Look into it, I'll be gone for another week, car still isn't fixed.

Glain

September 10, 2011, 09:51:47 am #8 Last Edit: September 10, 2011, 11:49:00 am by Glain
So, I did a Subversion checkout of the FFTPatcher, etc code at the Google Code page for it. To clarify, Subversion is source control (like SourceSafe or TFS or what have you). It lets you check in files, check out files, all that sort of jazz, but we don't really need it for anything other than just doing an initial download of what's there.

I grabbed the top download here (requires registration, which is annoying): http://www.open.collab.net/downloads/subversion/
Then was able to open a command prompt and use the command shown on the "Checkout" part of the Google Code page, namely:
svn checkout http://lioneditor.googlecode.com/svn/trunk/ lioneditor-read-only (It'll create its own subdirectory for the code in the directory you ran the prompt in)

What's interesting about this is that there were only three compile-time errors, all relating to a certain parameter (Something to do with PSP info) not being passed in to various methods. I added those in and am getting running versions of everything (Patcher, ASM, TacText, SSE). Navigate to (Project)/(x86, if necessary)/bin/Debug to find the appropriate executables. Patcher's missing two tabs (Propositions and Animations); not sure why. SSE also appears to have been reworked to have its own change files (like .fftpatch?) that you just apply to ISOs?

I'll check it out, though the problem is that the current descriptions of problems (patching incorrectly, etc) are really vague and may be hard to track down.
  • Modding version: Other/Unknown

Cheetah

Continuing work on FFTPatcher would be incredible. Do you need a more organized effort of testing out this latest version and finding all the errors?
Current Projects:

Glain

September 10, 2011, 01:01:36 pm #10 Last Edit: September 10, 2011, 02:37:54 pm by Glain
Hm. I actually suspect I've downloaded an old version; Patcher is showing v0.388. That would explain the missing forms, etc. I guess I need to find a new version. Not sure why I would have gotten an old version that way.

The problem is... I don't know where fdc got his files, and his zip seems to be missing some key components, or else I'm doing something terribly wrong. The build process is trying to find files that don't exist; I can't even get to the point where I could even try to build the code with those files.

If we could find a version to get started on, having some testing would, of course, be nice. That sort of thing never hurts. I'm basically just trying to get my bearings on this at this point though.

I suppose I'm going to try pasting the missing stuff from fdc's zip from the downloaded code into fdc's files and see where that gets me. Those files didn't seem like the type to really change ever (or were just text files), so hopefully they'll be the same, regardless of the Patcher version.

EDIT: I did get it to compile! I had to mess with a batch file, which hopefully didn't mess anything up! Patcher loads up okay, but calls itself v0.457. The current patcher is v0.478. Augh, is this another old version?

EDIT 2: Okay, melonhead's newest changes are in branches/imageEditorv2/ and not trunk/ which, I believe, is why I got the old version. I'll have to see what I can do with this.

EDIT 3: This seems to compile fine. Patcher=v0.457
  • Modding version: Other/Unknown

Cheetah

Excellent to hear that you at least have the newest version now. I would definitely throw a lot of resources towards improving FFTPatcher. You can count me in as a tester.
Current Projects:

RavenOfRazgriz

Quote from: Cheetah on September 11, 2011, 12:19:13 pm
Excellent to hear that you at least have the newest version now. I would definitely throw a lot of resources towards improving FFTPatcher. You can count me in as a tester.


Most of the missing resources exist in my spreadsheets already, honestly.  Propositions, Shop Edits, etc. etc. etc.  It'd really just be translating all those into FFTPatcher.  It'd be nice to have everything in one place, sure, but it'd also put me out of a yob.  You really wanna put me out of a yob?

Pickle Girl Fanboy

Quote from: RavenOfRazgriz on September 11, 2011, 12:44:42 pm
Most of the missing resources exist in my spreadsheets already, honestly.  Propositions, Shop Edits, etc. etc. etc.  It'd really just be translating all those into FFTPatcher.  It'd be nice to have everything in one place, sure, but it'd also put me out of a yob.  You really wanna put me out of a yob?

MAKE WAY FOR PROGRESS.  And besides, won't this leave you more time to work on, say, your patches, your non-spreadsheet editing tools, and your reverse-engineering projects?

Glain

September 15, 2011, 09:59:21 pm #14 Last Edit: March 25, 2012, 05:10:39 pm by Glain
Well... okay, I haven't done too much with this yet. I am starting to get a feel for the code here and there. I'm sorta interested in the current state of the stuff I have, though. (i.e. how it works, if things really fail). There's some weird discrepancies between what I've found and what FDC was saying, so I find that a bit odd. (I didn't have any compile-time errors to fix, FFTPatcher loads fine for me, etc). I don't have all the greatest test cases or what have you, so I figured I'd upload my compile in case anyone wants to test it and see what's working and what isn't.

Hopefully I've included everything needed. I took the Debug/ directories of each application's subdirectory; let me know if there are any more files needed to get these EXEs to run.

EDIT - The latest version is attached further down in the thread. Removing from this post.
  • Modding version: Other/Unknown

formerdeathcorps

Looking at this, all the tools work as they should, though I haven't yet tested orgASM.  If this version of orgASM works without bugs, we should have exactly one version of FFTP on the main site available for download which will include:

1) R999's 478 ShiShi
2) This version of FFTP with a modified Resources.zip (Melonhead actually removed the titles on a lot of names of flags that we already know about)
3) This version of orgASM, if it works.  Otherwise, it should include 457/466 orgASM.
4) This version of TacText, if it works.  Otherwise, it should include 457/466 TacText.
The destruction of the will is the rape of the mind.
The dogmas of every era are nothing but the fantasies of those in power; their dreams are our waking nightmares.

formerdeathcorps

If I'm not mistaken, if we just fix the offset Patcher writes store inventory changes to, it should then work.

FILE: StoreInventory.cs
CHANGE:
               return Codes.GenerateCodes( Context.US_PSX, PatcherLib.PSXResources.Binaries.StoreInventories, this.ToByteArray(), 0x18D840, Codes.CodeEnabledOnlyWhen.World );
TO:
               return Codes.GenerateCodes( Context.US_PSX, PatcherLib.PSXResources.Binaries.StoreInventories, this.ToByteArray(), 0xAD844, Codes.CodeEnabledOnlyWhen.World );

The error melonhead made is obvious; he forgot to get the ROM address from WORLD.BIN RAM.
The destruction of the will is the rape of the mind.
The dogmas of every era are nothing but the fantasies of those in power; their dreams are our waking nightmares.

Glain

fdc, I believe that method, GenerateCodes(), is actually for generating the Gameshark codes, so the RAM address, and not the WORLD.BIN file address, would be correct. Not sure why it's off by 4, though.

melonhead seems to refer to gameshark codes as "Codes" throughout the FFTPatcher source, and actually writing to the game files as "patches", so we'd need to look at the analogous method for "Patches", which seems to be GetPatches() (StoreInventory.cs:213), where we see:

result.Add(PatcherLib.Iso.PsxIso.StoreInventories.GetPatchedByteArray(bytes));
(StoreInventory.cs:223)

PsxIso.StoreInventory is of type KnownPosition, which is made up of sector, start location, and length (the constructor for this type of object takes arguments in that order), and defined like this:

StoreInventories = new KnownPosition( Sectors.WORLD_WORLD_BIN, 0xAD844, 0x200 );
(PsxIso.cs:100)

So it looks like it's already looking at 0xAD844 in WORLD.BIN for patching.
  • Modding version: Other/Unknown

formerdeathcorps

December 30, 2011, 03:44:38 am #18 Last Edit: December 30, 2011, 05:04:23 am by formerdeathcorps
Are you sure this routine actually works though?  Because this feature has existed since v.457 and no one seems to be able to get it to work.  Furthermore, this is doing exactly what RAven's spreadsheet is.  And yet, that has no problems.  Thus, the problem must lie with FFTP.

1) Is there any checking mechanism between what is being patched and the GS Code?
2) Somewhere along the line, could he have mistakenly called "StoreInventories" as "StoreInventory"?  I see he has both defined in his code.

EDIT: Testing shows that it's not getting written to WORLD.BIN.
3) Is there something wrong with the write to ISO routine?
The destruction of the will is the rape of the mind.
The dogmas of every era are nothing but the fantasies of those in power; their dreams are our waking nightmares.

Glain

One of my first thoughts was that the Sectors.WORLD_WORLD_BIN constant could be set to the wrong number (It's set to 84261; I have no clue if that would be right or not, or exactly what it even means)... however, that same constant seems to be used for TacText and I'm pretty sure that patches WORLD.BIN properly.

So I'm not really sure what the problem is, but finding out that WORLD.BIN isnt getting patched should be really useful. I'll try running my copy of his code through my local debugger and see what I can come up with.
  • Modding version: Other/Unknown