Post: [Full In-Depth] Modding the Patch_mp.ff (MW2 Xbox 360-Jtag)
03-31-2010, 02:48 AM #1
titonx
Banned
(adsbygoogle = window.adsbygoogle || []).push({}); Im tired of being asked how to code patch_mp files so here it is. I take no claim in writing this i just merely put it on this site for all to see. All credit goes to IMonarchy.

Introduction:




Reading this tutorial:
- Important Information is in Bold and Quotes.
- This tutorials is in "community proof-read" mode.


I've noticed a large amount of people using patch_mp's that don't know how to make them themselves. Although there are many people here that are willing to make them for them, the small, simple requests are annoying. Modding Patch's isn't that difficult.

Somethings To Know:

-Patch's are coded in a C++ like language. (NOT C++, but alike)
-Patch's cannot be ANY larger than 177 kb.

How patch_mp.ff works: (Concept)

When loading code, the xex will load the patch, and then the everything else. The code found in the patch will overwrite everything else. -- Correct me please?

SO I guess it's time to start. You can download everything you need in this tutorial Here:

You must login or register to view this content.

You must login or register to view this content.

You must login or register to view this content.

You must login or register to view this content.

Get the new patched TU5 default_mp.xex from within ffViewer just download it.
You must login or register to view this content.

You must login or register to view this content.


Hobo's Editor - Opening / Using:




You must login or register to view this content.

1) Navigate to it, and double click. NOTE: It can take some time.

You must login or register to view this content.

Originally posted by another user
Tool-Tip said:


- To download fresh new patch's, or a default_mp.xex we can go to "Download".

- To Open a patch File, go to File > Open.

- Patch files MUST be named "patch_mp.ff" NO exceptions.

2) Now let's open up our new, clean patch.

Originally posted by another user
How-To! said:


File > Open.

Navigate to your Clean Patch folder.

Double click patch_mp.ff.

You must login or register to view this content.

Originally posted by another user
Tool-Tip! said:


Here you can see the layout of the program's editor.

- On the left side (Black) , you can see the .gsc files the patch contains. Click one to open it in a tab.

- On top (Red) you will see the four tabs where you can open up to four gsc's at once.

- The larger (Green) portion of the screen is where you can view and edit the gsc you have selected.

Originally posted by another user
FAQ said:


Q: What are GSC's?

A: These are the files that MW2 stores code in. A patch contains certain GSC's that have been modified from the originals found on the game disc. (See "How Patches Work" Above) An example of the most popular GSC is _missions.


Into The Patch - Opening




1) Click _missions.gsc located in the GSC viwer (left panel)

Originally posted by another user
Tool-Tip! said:
You will notice the code popup inside the code viewer.

You must login or register to view this content.

Originally posted by another user
Description said:
Now, anyone who has an extensive knowledge of C++ will recognize the code that appears. This is because the code is based on C++. Most of the things you see and use will be similar, so If you ever need help, C++ is your closest reference, besides the game code itself, of course. On this note, The easiest way to learn how to read and write this code is to study it. Read pieces and try to determine what they do to the game.


The Code - Format / Adding Code




Originally posted by another user
Format said:


First, you will can see the code is split into sections. These sections are started with a label. [Shown Here as Example()] They can be called upon at any time (I believe it has to be before the section?) using "thread" or "self thread" meaning "execute".

    Example()
{
//Example
}


Next thing you will notice in the code is the "tier" system, as I like to refer to it. This system makes the code very easy to read, and separates functions.

How it works:

- "{" depicts that the line after will be ONE more tab in.

- "}" depicts the code before will be ONE more tab in.

    Example()
{
If (self.name == "monarchy")
{
// Code Here
}
else
{
// Code Here
}
}


That above is a completed section.

1) Let's scroll down in _missions.gsc until we find the section labeled "OnPlayerSpawned" (Red)

You must login or register to view this content.

Originally posted by another user
How-To said:


This is the section we will be dealing with the MOST. Some times we will use other sections, or even other GSC's. If so, the coder will tell you.

Let's get some code going. We are going to start with something very simple, and just add a DVAR for all the players to have.

To find code to use, let's go to the "Managed Code List"

We're going to add the DVAR to earn XP in System Link and Private Matches: onlinegame "1"

To do this, lets get the add dvar code:

    setDvar( "dvar", value );


And fill it with our own values:

    setDvar( "onlinegame", 1 );


Then we will add it JUST after

    self thread monitorSprintDistance();


Note: This photo also explains the default onPlayerSpawned function.

You must login or register to view this content.

Originally posted by another user
How-To! said:


Easy enough, right?

Now let's add some harder code. Let's make it so when we press a button, we become invisible.

To do this, we are going to add a new section. Lets add this just below the last "}" under out onPlayerSpawned section.

    goInvisible()
{
// code
}


There is the base for our section. Now let's make it so the section is executed on player spawned.

add

    self thread goInvisible();


After

    setDVAR( "onlinegame", 1 );


So it looks like:

You must login or register to view this content.

Originally posted by another user
Following me Still?


Now we need to add the button pressing. This is simple, and very easy to remember. The hardest part is assigning the button. In our case we are going to use "Dpad_up".

Our code should look like:

    goInvisible()
{
self notifyOnPlayerCommand("dpad_up", "+actionslot 1");
for(;Winky Winky
{
self waittill("dpad_up");
}
}
}


Now, we can add Hide function "self hide();"

We want you to hide after you hit the dpad, so let's make sure we add it after "self waittill("dpad_up");.

    goInvisible()
{
self notifyOnPlayerCommand("dpad_up", "+actionslot 1");
for(;Winky Winky
{
self waittill("dpad_up");
self hide();
}
}
}


Now that our section is done, our code will look like this:

You must login or register to view this content.


Using ffViewer to edit TU5 Patch_mp.ff



1) First download ffViewer

2) Let's open it!

You must login or register to view this content.

3) You'll notice the layout of the program as follows:

You must login or register to view this content.

4) Now we can Download our TU5 Patch!

- Go to File > Get File > patch_mp.ff TU5

You must login or register to view this content.

Originally posted by another user
The "TU" in "TU5" Stands for "Title Update"


5) Now Select a location, and hit save.

You must login or register to view this content.

5b) You should get this message.

You must login or register to view this content.

6) Now we can open our .ff file, lets hit "Open .FF" In the "File Options" menu.

You must login or register to view this content.

6b) Find and open your patch_mp.ff.

You must login or register to view this content.

7) Your screen SHOULD change to look like this:

You must login or register to view this content.

Cool Man (aka Tustin) Now to open your GSC to read, you'll need to click on the "[+] All Files" in the FileViewer.

You must login or register to view this content.

9) A BUNCH of things should pop-up. These are the GSC's that the patch file contains.

You must login or register to view this content.

10) Click on the _missions.gsc file to open it.

You must login or register to view this content.

Originally posted by another user
Now, anyone who has an extensive knowledge of C++ will recognize the code that appears. This is because the code is based on C++. Most of the things you see and use will be similar, so If you ever need help, C++ is your closest reference, besides the game code itself, of course. On this note, The easiest way to learn how to read and write this code is to study it. Read pieces and try to determine what they do to the game.


NOTE: The rest of this tutorial was taken from my tutorial for Hobo's editor. I will modify the information and photos to match this program.

First, you will can see the code is split into sections. These sections are actually called "threads" and are started with a label. [Shown Here as Example()] They can be called upon at any time using "self thread (LABEL);" meaning "self execute thread".

    Example()
{
//Example
}


Next thing you will notice in the code is the "tier" system, as I like to refer to it. This system makes the code very easy to read, and separates functions.

How it works:

- "{" depicts that the line after will be ONE more tab in.

- "}" depicts the code before will be ONE more tab in.

    Example()
{
If (self.name == "monarchy")
{
// Code Here
}
else
{
// Code Here
}
}


That above is a completed section.


1) Let's scroll down in _missions.gsc until we find the section labeled "OnPlayerSpawned"

(Or we can use the "Find" Tool! CTRL + F, Then F3 To FIND NEXT)

You must login or register to view this content.

This is the section we will be dealing with the MOST. Some times we will use other sections, or even other GSC's. If so, the coder will tell you.

Let's get some code going. We are going to start with something very simple, and just add a DVAR for all the players to have.

To find code to use, let's go to the Managed Code List

We're going to add the DVAR to earn XP in System Link and Private Matches: onlinegame "1"

To do this, lets get the add dvar code:

    setDvar( "dvar", value );


And fill it with our own values:

    setDvar( "onlinegame", 1 );


Then we will add it JUST after

    self thread monitorSprintDistance();


You must login or register to view this content.

Easy enough, right?

Now let's add some harder code. Let's make it so when we press a button, we become invisible.

To do this, we are going to add a new section. Lets add this just below the last "}" under out onPlayerSpawned section.

    goInvisible()
{
// code
}


You must login or register to view this content.

There is the base for our section. Now let's make it so the section is executed on player spawned.

add

    self thread goInvisible();


After

    setDVAR( "onlinegame", 1 );


So it looks like:

You must login or register to view this content.

Now we need to add the button pressing. This is simple, and very easy to remember. The hardest part is assigning the button. In our case we are going to use "Dpad_up".

We need to add this to our thread, but it needs to be infront of our code.

    
self notifyOnPlayerCommand("dpad_up", "+actionslot 1");
for(;Winky Winky
{
self waittill("dpad_up");
}
}


Our code should look like:

    goInvisible()
{
self notifyOnPlayerCommand("dpad_up", "+actionslot 1");
for(;Winky Winky
{
self waittill("dpad_up");
}
}
}


You must login or register to view this content.

Now, we can add Hide function "self hide();"

We want you to hide after you hit the dpad, so let's make sure we add it after "self waittill("dpad_up");.

    goInvisible()
{
self notifyOnPlayerCommand("dpad_up", "+actionslot 1");
for(;Winky Winky
{
self waittill("dpad_up");
self hide();
}
}
}


Now that our section is done, our code will look like this:

You must login or register to view this content.

If we wanted, we could make it so that our "Hide" Function is toggled. To do this would be easy.

We would just have to add another;

    self waittill("dpad_up");


under

    self hide();


Like:

    goInvisible()
{
self notifyOnPlayerCommand("dpad_up", "+actionslot 1");
for(;Winky Winky
{
self waittill("dpad_up");
self hide();
self waittill("dpad_up");
}
}
}


Then we can add

    self show();


(ASSUMING THIS IS THE RIGHT FUNCTION, NOT SURE)

under that.

It should look like:

    goInvisible()
{
self notifyOnPlayerCommand("dpad_up", "+actionslot 1");
for(;Winky Winky
{
self waittill("dpad_up");
self hide();
self waittill("dpad_up");
self show();
}
}
}


You must login or register to view this content.

Now we can save our patch!

To do this, just hit the save button!

You must login or register to view this content.

BUT! If you get this error message, then you know that the file size is too large. You need to remove comments!

You must login or register to view this content.

In this version (1.15) The comment removal is very buggy, and usually crashes, So I would do it manually. To know when you've reached the amount, you can compare the "New Comp Size" to the "Original Comp Size" while deleting.

You must login or register to view this content.

Once the "New Comp Size" is Smaller than the "Orig Comp Size", you can hit save again!

You must login or register to view this content.

Saved!

You must login or register to view this content.


~Monarchy
(adsbygoogle = window.adsbygoogle || []).push({});

The following 8 users say thank you to titonx for this useful post:

bertieboy7, Fionn, MW2, SolidSnake77, Spartan Gunney, TMAN242, Zinzi
04-11-2010, 04:47 PM #29
any help with that titonx?
04-11-2010, 10:49 PM #30
titonx
Banned
Originally posted by Sykodeadman View Post
any help with that titonx?


You will have to wait for the public release to come out. I can't leak what im using sorry.
04-11-2010, 11:59 PM #31
little_legz
SleepinIsCheatin
Beast, will sure use this and follow as a referance when i get a jtag, + 28 rep
04-12-2010, 01:43 AM #32
No worries just asking titonx

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo