PDA

View Full Version : Tutorial: New League Replacement Guide



Aula
04-03-12, 09:33 PM
New league replacement guide,should be easier than the previous one.
In this guide I will replace the Danish league with the Israeli league as example,but the principles are the same for any league replacement.

Tools needed:
Club Swap (http://www.champman0102.co.uk/downloads.php?do=file&id=23)
Mass Swap (http://www.champman0102.co.uk/downloads.php?do=file&id=153)
Names Editor V2 (http://www.champman0102.co.uk/downloads.php?do=file&id=15)
Olly debugger (http://www.ollydbg.de/odbg110.zip)
Official Editor

Before starting:
It is recommended to backup the database files after each step in case you will make a mistake.
You need to backup the following files:
All the *.dat files in the data folder - 20 files
euro.cfg (located in the data folder)
player_setup.cfg (located in the data folder)
weather.cfg (located in the data folder)
cm0102.exe (located in the main folder)

I recommend you to add them to new ZIP or RAR archive.

Step 1 - Deciding which league to replace
First of all you need to decide which playable league has the closest structure to the league you want to insert.
The league you replace should be from the same continent because of the clubs competitions.
For example,if you will replace the Danish league with the Chinese league then the Chinese club will take part in the Champions League,UEFA Cup and the Intertoto Cup.
You don't need to consider the following:
player restrictions
number of subs
number of fixtures/rounds/promotion/relegation.
You do need to consider the following:
number of teams in each division - you can't add teams but you can drop teams
whether the division is split to sections or not - you can't merge or split divisions.


The 3 top Israeli divisions aren't split to sections and contains 12 teams each,from the 4th division and on the division is split to 2 or more sections.
Therefore,considering all parameters I decided to replace the Israeli league with the Danish league and not with the Croatian league,for example,because the Danish league has 3 divisions with no sections split while the Croatian Second Division is split to 2 sections.

Step 2 - Check we have enough clubs
1.Open Olly debugger.
2.Select cm0102.exe
3.Wait until it finishes analyzing it.
4.Click somewhere in the bottom box

http://img40.imagefra.me/img/img40/2/4/9/zozoa/f_1m_2889f5e.jpg

5.Press ctrl+b and a search box will be opened
6.Type "code\comp\cups\" and press Enter
7.check what comes after "code\comp\cups\",it needs to be the national cup name.
For example,the line for the Danish Cup will be:"code\comp\cups\den_cup.cpp"
For the French Cup it will be:"code\comp\cups\fra_cup.cpp"
7.Use ctrl+L to go over all findings until you will find the requested line.
8.Scroll up a bit until you find the start of the line,the start should be:"E:\dev\cm3\"

http://img38.imagefra.me/img/img38/2/4/9/zozoa/f_2am_773d988.jpg

9.Click on the "E" letter
10.Press ctrl+R
11.A new windows will be opened with list of references.
12.Double click on the 5th reference line.
13.Scroll up a bit until you see the line:"MOV WORD PTR DS:[ESI+3E],5C",5C is an hexadecimal value(equal to 92) that represents the number of team requested by the cup in order to take place,therefore if you will have less than 92 Israeli teams then the Cup won't take place.

http://img37.imagefra.me/img/img37/2/4/9/zozoa/f_256m_ab7a7df.jpg

14.Close Olly.
15.Open the official editor
16.Filter the clubs list by nation(Israel in this case) and check you have at least 92 Israeli clubs,if not then add more Israeli clubs.
17.Close the editor (no need to save).
Note: Sometimes the this line won't be in the 5th reference but in other one,in this case just go over all the references and look for this kind of line:"MOV WORD PTR DS:[ESI+3E],number of teams"

Step 3 - Swap players,non-players,cities,referees nationalities
Download the Mass Swap tool and put it in the data folder(otherwise it won't run)
Run it and when it says "Enter first nation ID" insert -1 and press Enter.

http://img107.imageshack.us/img107/5792/massswap1sz5.jpg

Now you will have a file called nation.txt in the data folder.
The file contains list of the nations in the database and their IDs.
Search for the 2 requested nations,in this case Denmark and Israel.
Denmark ID is 53 and Israel ID is 94.

http://img37.imagefra.me/img/img37/2/4/9/zozoa/f_35m_cb9fa89.jpg

Now run it again and insert the nations IDs.

http://img40.imagefra.me/img/img40/2/4/9/zozoa/f_36m_7b1caa6.jpg

Now open the official editor and validate the database.

http://img38.imagefra.me/img/img38/2/4/9/zozoa/f_37m_0706b35.jpg

Save and close the editor.


If needed - Adding clubs to fill gaps in divisions
Explanation: If you will need to lower the number of team in some division then you will have to put in the division some lower league clubs in order to ensure the cup will take place.
For example,for the Israeli leagues I need to lower the number of teams in the Danish Second & Third divisions from 16 to 12,therefore I need to insert 4 lower league Israeli clubs in each division.

1.Open the official editor.
2.Create the requested clubs.
3.Validate the database.
4.Save the database.
5.Close the editor.
Important:don't add anymore clubs after this step otherwise the "fill gaps" clubs could appear in the division.

Step 4 - Swapping clubs
1.Open the official editor.
2.Swap the Israeli clubs with the Danish ones in the Danish divisions by using the swap button in the club competition screen
Swap also the "fill gaps" teams if needed.

http://img40.imagefra.me/img/img40/2/4/9/zozoa/f_46m_ad5e26e.jpg

Don't forget to swap the teams in the nation's lower division if it exists,not all the playable nations have their own lower division (Denmark,for example,doesn't have,but France do - "French Lower Division").

3.Validate the database.
4.Save the database.
5.Close the editor.

Step 5 - Swap clubs nationalities
1.Open club swap
2.Select the 2 requested nations

http://img37.imagefra.me/img/img37/2/4/9/zozoa/f_57m_d78bf36.jpg

3.Press the "Swap!" button
4.Close it.
5.Open the official editor
6.Validate the database
7.Save and close.

If you want - Tapanify the database
If you want you can tapanify the database by running cmdbtapanify which you can find in any tapanified update file we have in the download section

Step 6 - Change leagues,cups and awards names
Use the Names Editor V2 in order to do it easily.

Step 7 - Swap Nations
1.Open the official editor
2.Save a picture of each of the 4 sections(details,stats,coefficients,preferences) of the 2 requested nations.

http://img37.imagefra.me/img/img37/2/4/9/zozoa/f_79m_a605d29.jpg

3.now swap the info from the 4 sections between the nations manually.
4.Save the database and exit.
5.Use the Names Editor V2 to swap the nations names.
Only if the nations are European:
6.Go to the data folder.
7.Open euro.cfg
8.Search for the nations names and change it manually in order to make sure the right teams will take part in the european competitions.

http://img40.imagefra.me/img/img40/2/4/9/zozoa/f_7fm_c4e2835.jpg


We are done!
The leagues have been replaced!

The following steps are not necessary and make this only more realistic, but they are hard to perform because it is not the same in all leagues.

Attention:The following steps difficulty is higher and you might get lost.

8.Change number of teams
1.Open Olly debugger.
2.Select cm0102.exe
3.Wait until it finishes analyzing it.
4.Click somewhere in the bottom box
5.Press ctrl+b and a search box will be opened
6.Type "code\comp\leagues\" and press Enter
7.check what comes after "code\comp\leagues\",it needs to be the division name.
For example,the line for the Danish Premier Division will be:"code\comp\leagues\den_prm.cpp"
For the Danish First Division it will be:"code\comp\leagues\den_fir.cpp"
For the French First Division it will be:"code\comp\leagues\fra_fir.cpp"
7.Use ctrl+L to go over all findings until you will find the requested line.
8.Scroll up a bit until you find the start of the line,the start should be:"E:\dev\cm3\"

http://img38.imagefra.me/img/img38/2/4/9/zozoa/f_8gm_11d3242.jpg

9.Click on the "E" letter
10.Press ctrl+R
11.A new windows will be opened with list of references.

http://img38.imagefra.me/img/img38/2/4/9/zozoa/f_8ham_4cb1aa0.jpg

12.Double click on the 7th reference line.
13.Scroll up a bit until you will see the line:"MOV WORD PTR DS:[ESI+3E],0C",it is the line which determines how many teams will be in the league.
The number is represented by an hexadecimal value.
0C equal 12,in the Danish First & Second Divisions the value will be 10(equal to 16),and we will change it to 0C(12),because we need only 12 teams in each division.

http://img38.imagefra.me/img/img38/2/4/9/zozoa/f_8hcm_d5a460f.jpg


14.Change the value
15.2 lines above there is a command PUSH 2C4,2C4=708, divide it by 12 (number of teams) = 59. If we change the number of teams we need also to change this value to new number of teams * 59, in hexadecimal value of course.
16.Do the same for the other divisions.
17.After you finish doing it for all divisions right click on some line you have changed->copy to executable->all modifications->copy all->right click on some line in the new opened window->save file->select the cm0102.exe and overwrite it.
18.Close olly.
Note: Sometimes the this line won't be in the 7th reference but in other one,in this case just go over all the references and look for this kind of line:"MOV WORD PTR DS:[ESI+3E],number of teams"

9.Change number of fixtures
1.Go again to the references list
2.Double click on the 6th reference line.
3.The fixtures reference will be followed by a lot of "Push 0\1\2\some number" commands under it.

http://img38.imagefra.me/img/img38/2/4/9/zozoa/f_9cm_b0e9688.jpg

4.Scroll up a bit until you will see the line:"MOV WORD PTR DS:[EAX],1E",it is the line which determines how many fixtures will be.
5.Change the value
6.Do the same for the other divisions.
7.After you finish doing it for all divisions right click on some line you have changed->copy to executable->all modifications->copy all->right click on some line in the new opened window->save file->select the cm0102.exe and overwrite it.
8.Close olly.
Note: Sometimes the this line won't be in the 6th reference but in other one,in this case just go over all the references and look for this kind of line:"MOV WORD PTR DS:[EAX],number of fixtures"

10.Increase number of fixtures
If you want to increase the number of fixtures you will have to use other league fixtures,a league that has at least the number of fixtures you need for your league.
For example,I need to increase the fixtures in the Danish First Division from 1E(30) to 21(33),therefore I will use the Danish Premier League fixtures(has 33 fixtures),but I can also use the English Premier League fixtures(has 38) for instance.
1.Go to the other league fixtures reference (in our case we will go to the Danish Premier League fixture reference)
2.Look for the closest JNZ command above the reference line
3.Copy this line to somewhere
4.Look for the "Push value" command above the "MOV WORD PTR DS:[EAX],value" line
5.Copy this line also

http://img38.imagefra.me/img/img38/2/4/9/zozoa/f_126m_4b13621.jpg

6.Go to the fixture reference line of the league we want to increase its fixtures.
7.Replace the "Push value" command above the "MOV WORD PTR DS:[EAX],value" line with the one you have copied before.
8.Change of course the "MOV WORD PTR DS:[EAX],value" line,if you haven't done it already
9.Click once on the "JNZ" command above the reference line
10.Press Enter
11.It will move the grey line a bit down.

http://img37.imagefra.me/img/img37/2/4/9/zozoa/f_1343m_3fce607.jpg

12.Replace the grey line with JNZ command you have copied before,but change the JNZ to JMP and remove the SHORT.
For example,if the line you have copied was:"JNZ SHORT 00551A6B",change it to:"JMP 00551A6B"
13.Change the next command to RETN 8.
14.Save the changes
15.Close Olly

11.Change number of rounds
The original Danish First&Second Divisions format is 16 teams with 30 fixtures which means 2 rounds.
But we want it to be 12 teams with 33 fixtures which means 3 rounds.
We have already changed the number of teams and fixtures,now we will have to change the number of rounds.
1.Go to the number of teams reference block
2.Scroll down a bit until you will see this kind of commands block.

http://img40.imagefra.me/img/img40/2/4/9/zozoa/f_134m_96ce563.jpg

3.The line that determines the number of rounds is the grey one:"MOV WORD PTR DS:[ESI+3C],CX"
CX is a variant that contain some value(in this case it contains the value 2)
We can't edit this line and put 3 instead of CX because it will overwrite the next line and we aren't allowed to do it.
We can't either change the value CX gets above("MOV ECX,2") because it may affect other things like number of subs or number of points for winning a game
Therefore we will have move all the following lines 1 step down.
4.Mark all this block in grey using Shift+key down
5.Right-click somewhere on the grey block->copy->to file
6.Now change the "MOV WORD PTR DS:[ESI+3C],CX" to "MOV WORD PTR DS:[ESI+3C],3"
7.Copy the the following lines as they are in the file you have created

Note: When copying the lines it may give the message:"unknown identifier",in this case you just need to add 0 before the variant name.
For example,if the line you want to copy is:"MOV WORD PTR DS:[ESI+AB],AX",write it as "MOV WORD PTR DS:[ESI+0AB],AX"

8.Save the changes
9.Close olly

12.Change number of subs in leagues:
1.Go again to the number of rounds block
2.Search the line:"MOV BYTE PTR DS:[ESI+49],value" - this line determines how many players you can register as subs
3.Change it as you like

Attention: If the line doesn't have numeric value but use a variant like in the rounds line,than you will have to do the same trick again and move all the following lines one step down.
But make sure you don't overwrite the next block.

4.Search the line:"MOV BYTE PTR DS:[ESI+4A],value" - this line determines how many players you can actually sub during the game(most of the times it is 3).
5.Change it as you like

*Same attention applies here*

6.Save the changes
7.Close olly

13.Change number of subs in cup:
1.Go to the 1st reference line in the cup references list
2.Scroll up a bit until you see the block start (should start with:"Push -1")
2.Look down for the same lines as the league subs lines
3.Change it as you like
4.Save the changes
5.Close olly

Note: Sometimes these lines won't appear.


14.Change number of promotions and relegations:
1.Go again to the number of rounds block
2.Search for the line:"MOV BYTE PTR DS:[ESI+BE],value" - this line determines how many promotions will be from this league
3.Change it as you like
Same attention as in the subs applies here
4.Search for the line:MOV BYTE PTR DS:[ESI+C1],value" - this line determines how many relegations will be from this league
Same attention as in the subs applies here
5.Save changes
6.Close olly

Note: Remember that you have to set the same value for relegation from league A to league B and for promotions from league B to league A.

15.Change player restrictions:

Follow the tutorial (http://31.222.136.27/showthread.php?303-Video-Tutorial-Changing-Player-Restrictions)

By Rainham End Regular