.rfcmp CLI tooling

I already got your intention I think :)

If we refer to e.g. skins of cars it is a real good proposal to just pack the skins as an update to the cars mas files itself in order to save some download bandwidth or just to keep the update rather small.




Sad but true. I think it is not documented clearly enough, missing examples and the overall documentation seems to be somewhat outdated ...

Just an impression, but I have the feeling I am right.

I am not sure about the mft file and if we can create it on our in advance (I don't think so). We could - I would say - if we know how to create signatures (not sure if there is an option to modmgr for it).

Just a simple approach: do we need to say it is an update? E.g. if we keep the name and we are just increasing version won't it be stored in the same directory? (while writing this it comes to mind that base versions are not kept if there is a newer one ... compare it to car upgrades)

I was working on a rF2 Server Manager (powershell based) and it is hard to implement a certain logic, especially how to handle content and how to set up e.g. mod files (pkginfo.dat ones) for creating mods.

So I stopped ...


you know what...
I tried again this evening just for fun.

the issue seems directly linked to the fact that modmgr doesn't add BaseSignature=value in the mft before packing the .mas. When you create the 2 rfcmp and install them, just adding the basesignature in the 2nd directory mft does the trick and modmgr show it as a unique updated mod, removing the line shows it as separated mod, ever we don't know the syntax or the tool doesn't take this into account. Seems strange if MAS does it but not modmgr.

So I will try to hook it in some ways.

I'll let you know if I make any progress.
 
Hello!

It's great this topic is still ongoing with several attempts at really cool solutions!

I finished phase 1 of my automation project via CLI (the user provides the content IDs and the Script downloads, installs and, if the user wants, removes the RFCMP files and also the empty folders in Workshop\365960\)

My question about the DAT file is: Were you able to automate the list of cars and tracks when creating the PKG?

Just in GT3 there are 14 lines of cars with various strings (it's crazy haha)

I'm trying to use the -l (L) command to list the files, but it says I'm not authorized...

I would really appreciate the help!
 
Hello, i'm trying to automate some tasks with PowerShell. Anybody has already done that ?

I already wrote some code to get/push rfcmp to steam. Now i'm trying to automate "mas to files", from file.mas extracting all in folder file and then do "files to mas".

Then i will try "mas to rfcmp" ...

I use some loops to identify files and try to make them a bit generic.

I'm struglling with calling ModMgr.exe -cfile.mas -boutput in PowerShell.

Maybe there are some examples on GitHub.
 
You need to specify which files to extract from MAS file.
For example if you want to extract everything, add *.* just after modmgr like:

modmgr *.* -x"SOMEMOD.mas" -c"D:\MODS" -o"D:\MODS\TEMP"
 
Thank you very much, now it works ...

The help/manual is badly written.
-x[MasFile] [fileName ...] = extract specified files from MasFile
should be
[fileNamePattern ...] -x[MasFile] = extract specified files pattern from MasFile

And a question : Is it good/bad to use the z option at 9 ? And compress files in mas ?

For people interested in PowerShell, here is the script to extract all any_name.mas in folder to any_name/* :

Code:
$root_path="C:\Games"
$mas_files = Get-ChildItem -Path . -Filter *.mas
ForEach ($file in $mas_files) {
    $output_dir=$file.Basename
    Write-Host "Processing file $($file.Name) in $output_dir"
    New-Item -ItemType Directory -Force -Path $output_dir | Out-Null
    Write-Host "Deleting files in $output_dir"
    Get-ChildItem -Path $output_dir -Include *.* -File -Recurse | foreach { $_.Delete()}
    $modmgr = $root_path + "\rfactor2-dedicated\Bin64\ModMgr.exe"
    $working_dir = "."
    $argument_list = "*.*" + " -x" + $file.Name + " -o" + $file.Basename
    $processOptions = @{
        FilePath = $modmgr
        WorkingDirectory = $working_dir
        ArgumentList = $argument_list
    }
    Write-Host "Extracting files from $($file.Name) in $output_dir"
    Start-Process @processOptions -NoNewWindow -Wait
}
Read-Host -Prompt "Press any key to continue... "

I just need to manage better the root_path ...

Copy this code in mas2files.ps1 in any folder where you have .mas files, and it will extract all content in a directory named like the file.

In the same way i wrote a file2mas.ps1 :
Code:
$root_path="C:\Games"
$mas_dir = Get-ChildItem -Path . -Directory
ForEach ($dir in $mas_dir) {
    $output_file=$dir.Basename + ".mas"
    Write-Host "Processing dir $($dir) in $output_dir"
    Write-Host "Deleting file $output_file"
    if (Test-Path $output_file) {
        Remove-Item $output_file -verbose
    }
    $modmgr = $root_path + "\rfactor2-dedicated\Bin64\ModMgr.exe"
    $working_dir = "."
    $argument_list = "$dir\*.*" + " -m" +  $output_file
    $processOptions = @{
        FilePath = $modmgr
        WorkingDirectory = $working_dir
        ArgumentList = $argument_list
    }
    Write-Host "Creating $output_file from $dir"
    Start-Process @processOptions -NoNewWindow -Wait
}
Read-Host -Prompt "Press any key to continue... "

Ps1 files are run by right click and "Run with Powershell".

Now working on the mas2rfcmp.ps1 ... ;)
 
Hello, now i'm trying to make a rfcmp from a few mas files with a command.

I use the command :
Code:
<rf2_dedicated_path>\Bin64\ModMgr.exe -b"<other_path>\BMW_330_2020\cmpinfo.dat" 0
And i get an error.

Code:
Getting mod inventory ...
Reading package config file <other_path>\bmw_330_2020\cmpinfo.dat
Creating package BMW_330_2020
Error creating package file.

Do i need another option ? I launch this command from a path outside the dedicated.

Maybe my cmpinfo.dat is wrong.
I copied it from the Roaming folder after i did it with the GUI.

Do i need to edit some more data ?

Here it is :
Code:
[Component]
Name=BMW_330_2020
Type=2
Version=1.65XX
BaseVersion=1.64
MinVersion=
Author=
Date=0
ID=
URL=
Desc=
Category=0
Origin=0
Flags=1
CurLocation=0
NumLocations=1
Location=<other_path>\BMW_330_2020\workshop\content\BMW_330_2020_v1.65XX.rfcmp
NumMASFiles=8
MASFile=<other_path>\BMW_330_2020\1.65XX\2023_02_bmw.mas
MASFile=<other_path>\BMW_330_2020\1.65XX\2023_04_bmw.mas
MASFile=<other_path>\BMW_330_2020\1.65XX\2023_15_oliph.mas
MASFile=<other_path>\BMW_330_2020\1.65XX\2023_22_titus.mas
MASFile=<other_path>\BMW_330_2020\1.65XX\2023_24_lasertools.mas
MASFile=<other_path>\BMW_330_2020\1.65XX\2023_42_ciceley.mas
MASFile=<other_path>\BMW_330_2020\1.65XX\2023_50_teambmw.mas
MASFile=<other_path>\BMW_330_2020\1.65XX\car-upgrades.mas
rFmFile=
IconFile=
SmallIconFile=
CurComponent=0

Thanks for any help.
 
The solution was actually here in this post.

If you use data outside rfactor 2 install path,
before calling ModMgr.exe you need to call pushd on the rfactor 2 path.

In Powershell uou need to use start command options with WorkingDirectory set to the dedicated root path.

Here is the code :
Code:
$modmgr = "C:\Games\rfactor2-dedicated\Bin64\ModMgr.exe"

$working_dir = "C:\Games\rfactor2-dedicated"

$argument_list = "-b" + $current_dir + "\cmpinfo.dat 0"

$processOptions = @{
    FilePath = $modmgr
    WorkingDirectory = $working_dir
    ArgumentList = $argument_list
}

Start-Process @processOptions -NoNewWindow -Wait

And it works.
 
Back
Top