MW2.PRJ patching

General Mech2 related Developments go here. Discussions welcome!

Moderator: Skyfaller

Forum rules
If you are writing a guide please do not post it here! Post in the Dev FAQ section please.
User avatar
Skyfaller
Clan 1st MechWarrior
Clan 1st MechWarrior
Posts: 1017
Joined: Sat Apr 12, 2008 2:58 am
Location: Germany
Contact:

Re: Map #Include Automation

Post by Skyfaller »

Rather than creating a scripting language for patching, it might be easier to use the batch processing capabilities offered by cmd.exe (batch files). So, all we need is a PRJ patch processor that understands the following commands, the rest can be done by adding commands to a script file:
  • PRJPP extract <MW2.PRJ> <dir> <file> <output>
    extract <file> from <dir> and produce <output> in <MW2.PRJ>
  • PRJPP diff <file1> <file2> <diff>
    compare <file1>, <file2> and produce <diff>
  • PRJPP patch <diff> <file>
    Apply changes from previously produced <diff> to <file>
  • PRJPP replace <MW2.PRJ> <dir> <oldFile> <newFile>
    Replace <oldFile> in <dir> with <newFile>
  • PRJPP add <MW2.PRJ> <dir> <newFile>
    Add <newFile> to <dir>, maintaining its 8.3 name
Rather than replace a byte somewhere in the PRJ, I would prefer seeing the file containing it extracted, patched, then replace the old version of the file with the new one. This would make any changes more portable.
User avatar
Skyfaller
Clan 1st MechWarrior
Clan 1st MechWarrior
Posts: 1017
Joined: Sat Apr 12, 2008 2:58 am
Location: Germany
Contact:

Re: MW2.PRJ patching

Post by Skyfaller »

OK, typed most of that into the nearest laptop, will begin testing tomorrow. Fixed a bug in replacing with larger files, but the cost ... well, MechVM will no longer skip displaying empty files. Adding files is still missing from MechVM and PRJPP.
User avatar
Skyfaller
Clan 1st MechWarrior
Clan 1st MechWarrior
Posts: 1017
Joined: Sat Apr 12, 2008 2:58 am
Location: Germany
Contact:

Re: MW2.PRJ patching

Post by Skyfaller »

OK, all commands except "add" seem to work. As a demonstration, I have written a patcher that will increase the viewing distance for the first Falcon mission to 8km using the method proposed here. This is done by invoking PRJPP using the batch file patch.bat. Just extract the appended .ZIP in your MW2:31stCC folder and run the batch file.

I hope to see many patches that use this tool. Several evenings went into it.

(Edit: removed the old version, find the current one in a separate thread.)
User avatar
quota4stupid
House Steiner Private First Class
House Steiner Private First Class
Posts: 81
Joined: Mon Dec 29, 2008 7:40 am
Location: Australia

Re: MW2.PRJ patching

Post by quota4stupid »

Nice :-) Have you had a chance to look at the TBL files in the TABL directory yet? I think they need to be updated if you add a file, but I haven't had a chance to test this theory out yet :-P
User avatar
Skyfaller
Clan 1st MechWarrior
Clan 1st MechWarrior
Posts: 1017
Joined: Sat Apr 12, 2008 2:58 am
Location: Germany
Contact:

Re: MW2.PRJ patching

Post by Skyfaller »

quota4stupid wrote:Nice :-)
Thanks.
quota4stupid wrote:Have you had a chance to look at the TBL files in the TABL directory yet? I think they need to be updated if you add a file, but I haven't had a chance to test this theory out yet :-P
ATM, I don't expect to find anything interesting in the TABL directory. Also, Kell seems to have found ways to circumvent the requirement for adding files, and I'd like stop developing that, if it's not needed.

Kell, do you still need the ability to add files to the PRJ, or can you get along without it?
User avatar
Col.Kell
House Steiner Archon
House Steiner Archon
Posts: 868
Joined: Sat Sep 27, 2008 7:44 am
Location: An Isolated Tennessee Valley.

Re: MW2.PRJ patching

Post by Col.Kell »

Skyfaller wrote:Kell, do you still need the ability to add files to the PRJ, or can you get along without it?
I don't exactly need to have it, with some carful planning you can replace files without adding any bytes and still get a good outcome. The ability to add files would be a nice luxury, because you could add/replace whatever without second thought or worries that you might mess something up. ;)
MechWarrior 2: 31stCC
Image
User avatar
Sir MMPD Radick
Clan Nova Captain
Clan Nova Captain
Posts: 1625
Joined: Tue Jan 22, 2008 10:07 am

Re: MW2.PRJ patching

Post by Sir MMPD Radick »

just been wanting to say good job Skyfaller!
I will probably use it myself if i can ever get back to working on a modded map...

(clarification just mean lack of time).
James 3:5-10: My Reminder
And the tongue is a fire, a world of iniquity: so is the tongue among our members, that it defileth the whole body. Out of the same mouth proceedeth blessing and cursing. My brethren, these things ought not so to be.
User avatar
Skyfaller
Clan 1st MechWarrior
Clan 1st MechWarrior
Posts: 1017
Joined: Sat Apr 12, 2008 2:58 am
Location: Germany
Contact:

Re: MW2.PRJ patching

Post by Skyfaller »

Sir MMPD Radick wrote:just been wanting to say good job Skyfaller!
Thanks, nice to hear it.
Post Reply