Understanding a CSM mod
Date: October 04, 2018 04:14PM
Posted by: petrus
Understanding a CSM Mod

To get some inside knowledge of CSM only one way does exist: examine as many existing CSM mods as possible and learn from them. As no complete CSM tutorial or even a help file exists, it may not be easy for a interested beginner, to get into this. This little tutorial will help to make the first steps easier by giving a general overview and touching some aspects of CSM.

The "2017 mod V2" bei MSchumi24 and the "2018 F1 mod v0.81" by kedy89 are used as examples. Please download and install them into CSM.

Content

First Steps
General
- What CSM does
- Mod structure
Examples
- Changing the CSM menu entries
- Adding a new driver
- Installing a new track

Tips
The CSM mods selection context menu
- Adding context menu items
- Delete wadcache
- Custom profil



First Steps

What CSM does

CSM is an extension for GP4 that supports mods with new carsets. With CSM running a season using more than 17 tracks or including trackspecific data like driver replaces are possible, that are not supported by the original GP4.
If you install a mod (usually as .cuh file) in CSM, the files will be extracted into a subfolder of CSMs working directory, which is by default "Grand Prix 4\GPSAVES\Carsets". This subfolder can be chosen by the user.
If you start an installed mod from the CSM menu, the program temporarily updates/swaps files and/or folders of the mod into the "Grand Prix 4" directory, then starts GP4 using GpxPatch. After finishing the GP4 program, CSM restores the files from a backup folder, supposed "autorestore" is set in [File], [Options].

Mod structure

The general structure of a mod is shown in a new carset template. In CSM select [File] and "Install new carset template". You can see the folder structure and the basic ini files but without any data there is not much to learn from.
Lets look into a mods folder, e.g. "2018 F1". It contains the two subfolders "data" and "Settings" and the main file "2018.csm". It is possible to have different csm files here that would be selectable using the drop-down list below the mod selection. Open "2018.csm" with a text editor. You will see a list of definitions, pointing to files or folders to be used. In section [General] a specification "Name" sets the name of the mod used in the CSM menu "Load and restore mods". This may be different from the mods folder name. You can edit it here.
Name            =F1 2018 0.81
The "data" folder holds all the stuff needed as cars, helmets, teamart etc., anything except tracks.
In the "Settings" folder you will find several ini files besides a MergeINI.lst. This is the controlling center of the mod and we will examine some of the files a bit deeper.
In the CSM.ini the line "F1graphics" in section [Misc] is interesting:
F1graphics      =1,%hres%,%vres%,,,,,,,,,,,,,,, . . .
It sets parameters in the graphics configuration file "f1graphics.cfg", e.g. the display resolution using %hres% and %vres%, which are variables defined in the Globalvars.ini.

The "Globalvars.ini" and the "Swap.ini" are most interesting. We will use them to examine and even patch a mod. All setting possibilities of the Globalvars.ini are discussed in "CSM stuff (brain goes boom)" by ZaZ.

Changing the CSM menu entries

Look into the Globalvars.ini. Go to the [trackname] label.
...
[trackname]
Allowchange             =1
Name                    =Grand Prix of ...
Name Icon               =Files\Icons\gp2.ico
VarCount                =21
Var1                    =Melbourne
...
VarName1                =Australia - Melbourne
...
VarName1 Icon   =Files\Icons\au.ico
...
VarPreview1             =Files\Preview\Tracks\Melbourne.jpg
...
Here the names (Var1,...Var21) of the tracks used by the mod are defined. They will be used with the variable %trackname% in other ini or text files.
You see "Allowchange" set to 1. This creates the track drop-down selection list in the CSM menu.

The menu uses the values of "Name" and "Name Icon" for the selection entry in the CSM menu "The mod's configurables" while "VarName1" ... "Varname21" define the track names in the drop-down list at the bottom. You may change them here, for example you could add the tracks number changing "Australia - Melbourne" to "01 Australia - Melbourne". The "Varname1 Icon" sets the path and name of the icon file. The icon is then displayed in front of the VarName. The VarPreview entries add pictures of the tracks.

If you have chosen a track, then in the menu "Load and restore mods" under the mods picture a picture showing which track is currently selected is displayed. This is set in the "2018.csm" in the mods main folder:
...
Preview Back    =Data\Files\Preview\Tracks\2018-%trackname%.jpg
Info            =Data\Files\Preview\Misc\2018.rtf 
...

The text "The 2018 mod ..." of the rtf file is merged with the %trackname% picture.

You may configure more sophisicated menu displays using font settings. For example in the 1991 mod "The mod's configurables" menu has entries with changing background between white and black. This is done by adding the following to the variable settings in the Globalvars.ini.
...
[gpname]
...
Name FontName           =Verdana
Name FontSize           =8
Name FontBold           =1
Name BackColor          =255,255,255
Name TextColor          =0,0,0
...
[driver]
Name FontName           =Verdana
Name FontSize           =8
Name FontBold           =1
Name BackColor          =0,0,0
Name TextColor          =255,255,255
...

and so on with changing Backcolor and Textcolor every time.

Adding a new driver

As an example I will take the 2017 F1 mods driver replace "button" for "alonso" in race 6, Monaco. You have to work on the following, where point 1 is most important:
1. The performance files
2. Helmet
3. Globalvars.ini driver settings
4. Teamart driver picture (and ev. helmet picture)
5. Driver and team gpaedia

1) Performance files are used by the GpxPatch program. They are text files that define the team and driver names and numbers for the ingame driver selection menu and set the qualifying and racing performance values. You find detailed information about the structure of a performance file in the grandprixgames.org threads "GP4 performance files" and "Performance files".
In the 2017 mod the performance text files are all in the GpXpatch subfolder of the data folder. Most mods use a subfolder "Performance" instead, like the 2018 mod does. Alonso as the default first driver of the McLaren Honda team is found in the default performance text file as well as in any other trackspecific performance file except the one for the Monaco Grand Prix, where he has to be replaced by Button.

Default "performance.txt":
...
[Team #05]
Name=McLaren,Honda
Performance=855,855,8193
First Driver=14,Fernando Alonso,15313,236,15175,265,ES,ALO
Second Driver=2,Stoffel Vandoorne,15178,262,15019,380,BE,VAN
...

Monaco "performance_monaco.txt":
...
[Team #05]
Name=McLaren,Honda
Performance=855,855,2926
First Driver=22,Jenson Button,15172,128,15539,128,GB,BUT
Second Driver=2,Stoffel Vandoorne,15694,251,15488,371,BE,VAN
...
You will now have "Button" as first McLaren driver when choosing the Monaco track. He will appear in the ingame driver selection list as well as in racing.

2) Helmet
But he has the wrong helmet; we still see the standard helmet of the original GP4. A helmet texture, a .tex file that you can open with Slimtex, has to be made and put into the data\Helmets\button folder. To make the helmet appear ingame additional changes are necessary.

3) Globalvars.ini driver setting
Look into the data\Helmets\helmets.ini. You see that driver 11 is represented by the variable %driver11%, which is by default "alonso". To get "button" for track 6, we have to add a driver change into the Globalvars.ini:
[driver11]
allowchange	=0
name			=
varcount		=20
var1			=alonso
var2			=alonso
var3			=alonso
var4			=alonso
var5			=alonso
var6			=button
var7			=alonso
var8			=alonso
var9			=alonso
var10			=alonso
var11			=alonso
var12			=alonso
var13			=alonso
var14			=alonso
var15			=alonso
var16			=alonso
var17			=alonso
var18			=alonso
var19			=alonso
var20			=alonso

Now with the modify setting in the trackname definition
[trackname]
...
Modify     	=tracknum,racenum,tracklist,...,driver11,...
we get a trackspecific %driver11% that is "button" only for track number 6.

4) Teamart driver picture
The [driver11] setting should also point to the correct files in the data\Teamart folders "Drivers" and "Helmets", where you find the gpi graphic files for the ingame driver pictures and the driver gpaedia background helmets. You can display gpi files using the ZAZ GP4 tool Slimtex.

In the 2017 mod the teamart helmets are disabled. In the TeamArt\Drivers folder there should be a file "button.gpi" but you will not find it. This picture has yet to be created. If you want to do this, you have to make a 256x256 tga file and convert it to gpi with Slimtex (Batch to gpi). In the game the standard image (Barrichello) is shown instead of a Button image.

5) Driver and team gpaedia
The last and probably least important update has to be made with the gpaedia.
The gpaedia files are found in the data\GPaedia folder in the subfolders belonging to the tracklist 2018a.
The two tracklists 2018a and 2018b have been defined in the Globalvars.ini file. This is necessary for a season with more than 17 tracks.
The 5 files "GP2017_English-6.gps" ... "GP2017_italiano-6.gps" have got the trackspecific data for the Monaco GP. They are made using the tool GPaediaMaker and the GPaedia 2017 files.
Now, when you select the Monaco GP and look at the drivers gpaedia, Jenson Button should be shown as driver 11. But he doesn't! You see Alonso. What is wrong?
If you look into "GP2017_English-6.gps" with a text editor you will see that Button is there. The gps files are okay. How are the gps files included into the game? This is made by swapping them due to the settings in the Swap.ini file. This looks like
[Main]
Format=

[Vars]
gpaedianum1	=1
gpaedianum2	=1
gpaedianum11	=11
gpaedianum15	=15
gpaedianum16	=15
gpaedianum17	=17
gpaedianum18	=1
gpaedianum19	=1
gpaedianum20	=1

[Swapfiles]
File1	=GPaedia\%tracklist%\GP2017_English.gps,MenuData\PC\GP2001\GP2001_English.gps
File2	=GPaedia\%tracklist%\GP2017_Deutsch.gps,MenuData\PC\GP2001\GP2001_Deutsch.gps
File3	=GPaedia\%tracklist%\GP2017_español.gps,MenuData\PC\GP2001\GP2001_español.gps
File4	=GPaedia\%tracklist%\GP2017_Français.gps,MenuData\PC\GP2001\GP2001_Français.gps
File5	=GPaedia\%tracklist%\GP2017_italiano.gps,MenuData\PC\GP2001\GP2001_italiano.gps
File6	=GPaedia\%tracklist%\GP2017_English-(gpaedianum%tracknum%).gps,MenuData\PC\GP2001\GP2001_English.gps
File7	=GPaedia\%tracklist%\GP2017_Deutsch-(gpaedianum%tracknum%).gps,MenuData\PC\GP2001\GP2001_Deutsch.gps
File8	=GPaedia\%tracklist%\GP2017_español-(gpaedianum%tracknum%).gps,MenuData\PC\GP2001\GP2001_español.gps
File9	=GPaedia\%tracklist%\GP2017_Français-(gpaedianum%tracknum%).gps,MenuData\PC\GP2001\GP2001_Français.gps
File10	=Gpaedia\%tracklist%\GP2017_italiano-(gpaedianum%tracknum%).gps,MenuData\PC\GP2001\GP2001_italiano.gps
...
For track 6 %tracknum% has the value 6 and gpaedianum6 should have the value 6. But this setting has been forgotten in the [Vars] section and here we have the cause for the wrong gpaedia. Fixing it is easily done.
Just add the line
gpaedianum6	=6
into the [Vars] section above the track 11 specification. Start the mod with CSM again, and you will see the correct gpaedia now.

Installing a new track

Tracks are not part of a CSM mod. Though the TSM is included into the CSM GUI it is in fact an independent program. For some seasons trackpacks are made and together with the mod you will have a complete GP4 set. If this is not the case, you have to gather available tracks fitting the season and install them yourself.

To install a trackpack you have to use the TSM. Select "Manage tracks", "Tasks", "Install tracks".
Single tracks are often just archive files and I prefer to install them manually.
Tracks are stored into the subfolder "Tracks" of the "Grand Prix 4" folder. Here you have ini files (one or two for a season) to define which tracks belong to the season. In TSM they are called "Profiles". The 2018 season needs two files: 2018a.ini and 2018b.ini that look like this on my computer:

2018a.ini:
[Tracks]
Track1=Melbourne\2016\settings.ini
Track2=Sakhir\2016\settings.ini
Track3=Shanghai\2016\settings.ini
Track4=Baku\2017\settings.ini
Track5=Barcelona\2016\settings.ini
Track6=Monaco\2014\settings.ini
Track7=Montreal\2016\settings.ini
Track8=Paul Ricard\2018\settings.ini
Track9=A1Ring\2016\settings.ini
Track10=Silverstone\2016\settings.ini
Track11=Hockenheim\2012\settings.ini
Track12=Hungaroring\2016\settings.ini
Track13=SpaFrancorchamps\2016\settings.ini
Track14=Monza\2018\settings.ini
Track15=singapore\2016\settings.ini
Track16=Sochi\2016\settings.ini
Track17=suzuka\2016\settings.ini

2018b.ini:
[Tracks]
Track1=Austin\2016\settings.ini
Track2=Mexico City\2017\settings.ini
Track3=Interlagos\2016\settings.ini
Track4=abu_dhabi\2016\settings.ini
Track5=none
Track6=none
Track7=none
Track8=none
Track9=none
Track10=none
Track11=none
Track12=none
Track13=none
Track14=none
Track15=none
Track16=none
Track17=none

As you see I prefer a track folder structure like
- Tracks
  - A1Ring
    - 1976
    - 1979
    ...
    - 2016
    - PLUS
  - abu_dhabi
    - 2009
    - 2011
    - 2012
    - 2016
  ...

To install the new "Paul Ricard 2018" track, it's file location has to be written into the 2018a.ini file.
Then all files from the downloaded archive are extracted into the tracks folder, for me it is "Paul Ricard\2018".
Finally a "settings.ini" file has to be created in this folder, that has a content like:
[Settings]
Name=Paul Ricard
Year=2018
Country=France
Author=gezere
Adjective=French
Event=Grand Prix de France
Wad=suzuka2001.wad
Dat=s1ct17.dat
Gpi=
Important are the Name, Country, Wad and Dat settings.
Name and Country are displayed in the ingame circuit select menu.

The adjective will be displayed in the racing result menu, if in the GPxPatch tab [GPxTrack] the "Catch menu strings" option is checked. You have to be aware of the fact that the national adjective may also be set by the mods menu str files. In this case it is advisable to uncheck the "Catch menu strings" option. This is true for both the 2017 and 2018 mod. Look into the mods Settings\Swap.ini to see if menu str files are swapped.

If you set the gpi value and include the gpi file in the tracks folder, this will be displayed as trackmap in the game. It will override a trackmap set by the mods data and swapped.

Using a track profile with CSM

A mod can point to a track profile with a setting in the main csm file, e.g. for 2017 or 2018:
FixedTrackProfile	=%tracklist%.ini 
TrackProfile		=%tracklist%.ini

This will automatically select the tracklist that belongs to the selected track. CSM does display this in the drop-down list "List" of "The mod's configurables" menu. You have to click on "Load and restore mods" and then back on the configurables button to refresh the display value of "List", but the tracklist is set correctly already.
CSM will now "talk to TSM" and load the specified tracks.


petrus' gpaedia files



Edited 4 time(s). Last edit at 09/20/2019 08:57PM by petrus.
Re: Understanding a CSM mod
Date: October 04, 2018 05:26PM
Posted by: quickslick
great explanation from you :). Would be great to add how to build a tup file from different season tracks for TSM
Re: Understanding a CSM mod
Date: October 04, 2018 05:34PM
Posted by: kedy89
How to build a .tup file:
- create a profile containing the tracks you want for your trackpack
- in the loading/Restoring menu on the left, select the profile
- right-click on the profile and choose Export profile



Some mods
::: F1 1996 ::: F1 2002 ::: F1 2007 ::: F1 2011 ::: F1 2013 ::: F1 2015 ::: F1 2018 :::

Some other stuff ::: Some more other stuff
Re: Understanding a CSM mod
Date: October 04, 2018 05:36PM
Posted by: Meteoro405
Thanks!

Mods & Tracks for GP4 - [www.mediafire.com]


Keeping alive the GP4
Re: Understanding a CSM mod
Date: October 04, 2018 06:15PM
Posted by: Turbo Lover
Make it sticky!



My Grand Prix 4 Files

I'm a total dick. How many people can say that?
Re: Understanding a CSM mod
Date: October 04, 2018 07:00PM
Posted by: quickslick
danke Tobi :)(Y)
Re: Understanding a CSM mod
Date: October 06, 2018 06:16PM
Posted by: petrus
Tips

The CSM mods selection context menu
- Adding context menu items
- Delete wadcache
- Custom profile


The CSM mod selection context menu

If you right click inside the mod selection list of the CSM menu "Load and restore mod" a context menu pops up that is connected to the selected mod. The 2017 mod shows the standard items:

* Delete wadcache
* Export carset
* Change average performance levels
* Enable custom profile

The 2018 mod has got an addtional part below a separation line with the items
* Credits
* Help

Adding context menu items

Look into the main csm file "2018.csm" of the 2018 mod. In the [Genaral] section you will see
...
AddSpacer		=1
AddToMenu1		=Files\Credits.txt
AddToMenuName1		=Credits
AddToMenuIcon1		=Data\Files\Icons\credit.ico
AddToMenu2		=Files\Readme.txt
AddToMenuName2		=Help
AddToMenuIcon2		=Data\Files\Icons\help.ico

The "AddSpacer" creates the separation line. The text of the items is given with "AddToMenuName" while the leading icon is added using "AddToMenuIcon". Finally these items point to text files whose names are given with the "AddToMenu" specification. The path is inside the data folder.

This kind of menu can be extended to different menu levels. As an example I choose the 1980 mod by Pedro.
It has the two additional menu items with submenus:
* Documentation . . . . . . . . . . . . . . . . . .►
* Customize the mod - advanced users ►

In the main csm file "F1 Season 1980.csm" we find at the end of the section [General]:
AddSpacer 			=1
...
AddToMenuName1	=Documentation
AddToMenuName2	=Documentation|Read the Help file
AddToMenuName10	=Documentation|Credits
AddToMenuName3	=Customise the mod - advanced users
AddToMenuName4	=Customise the mod - advanced users|GP4Tweaker Settings|Helmet Positions
AddToMenuName5	=Customise the mod - advanced users|GP4Tweaker Settings|Arm Positions
AddToMenuName6	=Customise the mod - advanced users|GP4Tweaker Settings|Arm Colours
AddToMenuName7	=Customise the mod - advanced users|GP4Tweaker Settings|Key binds
AddToMenuName8	=Customise the mod - advanced users|GP4Tweaker Settings|Slipstream Effect
AddToMenuName9	=Customise the mod - advanced users|GP4Tweaker Settings|More GP4Tweaker Settings
AddToMenuName13	=Customise the mod - advanced users|Damage settings
AddToMenu1	=|
AddToMenu2	=|Files\Documentation\help.txt
AddToMenu10	=|Files\Documentation\credits.txt
AddToMenu3	=||
AddToMenu4	=||Tweaker\gp4tweak_data\helmetpos.ini
AddToMenu5	=||Tweaker\gp4tweak_data\armspos.ini
AddToMenu6	=||Tweaker\gp4tweak_data\armscolors.ini
AddToMenu7	=||Tweaker\gp4tweak_data\keybind.ini
AddToMenu8	=||Tweaker\gp4tweak_data\slipstream.ini
AddToMenu9	=||Tweaker
AddToMenu13	=|..\Settings\2006damage.ini
AddToMenuIcon1	=%iconpath%\info.ico|
AddToMenuIcon2	=|%iconpath%\gb.ico
AddToMenuIcon10	=|%iconpath%\gb.ico
AddToMenuIcon3	=%iconpath%\spanner.ico
AddToMenuIcon4	=|%iconpath%\tweaker.ico|%iconpath%\tweaker.ico
AddToMenuIcon5	=||%iconpath%\tweaker.ico
AddToMenuIcon6	=||%iconpath%\tweaker.ico
AddToMenuIcon7	=||%iconpath%\tweaker.ico
AddToMenuIcon8	=||%iconpath%\tweaker.ico
AddToMenuIcon9	=||%iconpath%\tweaker.ico
AddToMenuIcon13	=|%iconpath%\spanner.ico

This creates an additional context menu section looking like ( * means an icon):
_______________________
* Documentation			      ►
* Customize the mod - advanced users  | * GP4Tweaker Setting  | * Helmet Positions
								* Arm Positions
								* Arm Colors  
								* Key binds
								* Slipstream Effect
								* More GP4Tweaker Settings

If you have got the mod you can compare these specifications with the actions in the CSM context menu and understand how to configure the items.

Delete wadcache

If you have checked "Wadcache" in the CSM "File|Options" menu and started a mod at least one time you will find a subfolder "Wadcache" in the data folder. It contains a "wadcache.ini" and wad files, most often the "anim.wad" and the "cars.wad". These files were created once and then used again to shorten the mods loading time.
You normally don't want to delete them unless something went wrong and you need fresh created wad files.
See also the thread CSM Question for more information about this.

Custom profile

This feature has already been discussed in the thread "csm mods? playing with my own name and helmet?" including a step by step help by Shaddix.

If you check the context menu item "Enable custom profiles" a new item "Profiles" does appear. With this you can add your custom profile. If you have created one (or more) already, you can select it here from a submenu dropdown list "Custom profiles".
Custom profiles are created by using CSM "Extra Stuff", "Profiles". If you click on "Add new" and then select your new profile, it can be edited. You can add a driver picture gpi file and two helmet texture files. The settings are saved into the ini file "Profile.ini". This ini file together with the gpi and texture files is saved in "ZAZ GP4 tools\Profiles" in a subfolder with the name of your profile.
An example:
[Profile]
Profile Name=Profile01
Name=Hans Husch
Skill=15771,128,16597,128
Picture=noda.gpi
HelmetTex=Frentzen_1.tex,Frentzen_2.tex
DriverNr=22

The "Skill" line is automatically added by CSM.
If you have chosen the custom profile for a mod, it will replace the name of the driver chosen in the CSM "The mod configurables" menu. Because the picture and the helmet belong to the driver with "DriverNr" you should always choose this driver.
There seems to be a limitation concerning the helmet textures. I have got the textures sized as those of the original GP4 working, but other textures do not.


petrus' gpaedia files



Edited 11 time(s). Last edit at 09/20/2019 08:43PM by petrus.
Re: Understanding a CSM mod
Date: May 08, 2019 05:12PM
Posted by: quickslick
i think i have to come back to my question about the tup file. I don't have the load/restore window in TSM and so i want to ask here, if it's possible to reinstall TSM without deleting CSM, or do i have to uninstall CSM and reinstall it again? and the other question is, what happens with all the installed carsets and tracks, do i have to unistall them aswell? or is it possible to install CSM/TSM over the existing version?
Re: Understanding a CSM mod
Date: May 14, 2019 05:30PM
Posted by: petrus
quickslick: ... I don't have the load/restore window in TSM ...

Nothing is wrong. This part is just not shown if you start TSM from inside CSM.
Go to your ZAZ GP4 Tools folder and run the TSM.exe from there.


petrus' gpaedia files
Re: Understanding a CSM mod
Date: May 14, 2019 08:45PM
Posted by: quickslick
thank you very much for the explanation Peter :)
Sorry, only registered users may post in this forum.

Click here to login

Maintainer: mortal, stephan | Design: stephan, Lo2k | Moderatoren: mortal, Vader, stephan | Downloads: Lo2k | Supported by: Atlassian Experts Berlin | Forum Rules | Policy