.rfcmp CLI tooling

Discussion in 'Component and Mod Packaging' started by BigBl4ckW0lf, Oct 9, 2020.

  1. gagipro

    gagipro Registered

    Joined:
    Feb 26, 2013
    Messages:
    473
    Likes Received:
    7

    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.
     
  2. Felipe Granado

    Felipe Granado Registered

    Joined:
    Aug 29, 2013
    Messages:
    52
    Likes Received:
    8
    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!
     
  3. DanRZ

    DanRZ Registered

    Joined:
    Aug 22, 2021
    Messages:
    741
    Likes Received:
    229
    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.
     
  4. svictor

    svictor Registered

    Joined:
    Jan 20, 2019
    Messages:
    938
    Likes Received:
    6,387
    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"
     
    DanRZ likes this.
  5. DanRZ

    DanRZ Registered

    Joined:
    Aug 22, 2021
    Messages:
    741
    Likes Received:
    229
    Thank you very much, now it works ...

    The help/manual is badly written.
    should be
    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 ... ;)
     
    philrob likes this.

Share This Page