fs_mod_parser::mod_basic

Function parser

Source
pub fn parser<P: AsRef<Path>>(full_path: P) -> ModRecord
Expand description

Test a mod file against known game limitations

Returns a ModRecord

captured information includes version, l10n title and description, key bindings, multiplayer status, if it’s a map, icon, abd some simple piracy detection - see ModRecord for more details

§File Name Checks

  • Filename must start with a letter (not a number)
  • Filename must not contain spaces
  • Filename can only contain A-Z, a-z, 0-9, and underscore.
  • Non-Folders must end with a .zip extension

§Valid file types

vec!["png", "dds", "i3d", "shapes", "lua", "gdm", "cache", "xml", "grle", "pdf", "txt", "gls", "anim", "ogg"];

§Quantity Limits

/// one megabyte
const MB:u64          = 0x0010_0000;
/// max size allowed for I3D Cache files, 10MB
const SIZE_CACHE:u64  = 10 * MB;
/// max size allowed for DDS files, 12MB
const SIZE_DDS: u64   = 12 * MB;
/// max size allowed for GDM files, 18 MB
const SIZE_GDM:u64    = 18 * MB;
/// max size allowed for SHAPES files, 256MB
const SIZE_SHAPES:u64 = 256 * MB;
/// max size allowed for XML files, 256KB / 0.25MB
const SIZE_XML:u64    = MB / 4;

§Size Limits (in bytes)

/// max allowed GRLE files
const MAX_GRLE:u32 = 10;
/// max allowed PDF files
const MAX_PDF:u32  = 1;
/// max allowed PNG files
const MAX_PNG:u32  = 128;
/// max allowed TXT files
const MAX_TXT:u32  = 2;

§Sample Output

{
 "badgeArray": [ "problem" ],
 "canNotUse": false,
 "currentCollection": "",
 "fileDetail": {
   "copyName": null,
   "extraFiles": [],
   "fileDate": "2024-10-17T02:57:15Z",
   "fileSize": 461383317,
   "fullPath": "C:\\...\\FS22_Test.zip",
   "i3dFiles": [],
   "imageDDS": [
     "icon_eldoradoMap.dds",
   ],
   "imageNonDDS": [
     "maps/data/map_dem.png"
   ],
   "isFolder": false,
   "isSaveGame": false,
   "isModPack": false,
   "pngTexture": [
     "maps/data/map_dem.png"
   ],
   "shortName": "FS22_EldoradoMap",
   "spaceFiles": [],
   "tooBigFiles": []
 },
 "issues": [ "PERF_GRLE_TOO_MANY" ],
 "l10n": {
   "title": {
     "en": "Eldorado"
   },
   "description": {
     "en": "The Eldorado map is a Brazilian...",
     "de": "Die Eldorado-Karte ist eine ...",
     "br": "O mapa Eldorado é um mapa ..."
   }
 },
 "md5Sum": null,
 "modDesc": {
   "actions": {},
   "binds": {},
   "author": "Case IH Brasil, Connect Modding",
   "scriptFiles": 0,
   "storeItems": 41,
   "cropInfo": [
     {
       "name": "wheat",
       "growthTime": 8,
       "harvestPeriods": [],
       "plantPeriods": [ 7, 8 ]
     },
   ],
   "cropWeather": {
     "spring": { "max": 32, "min": 16 },
     "autumn": { "min": 14, "max": 30 },
     "winter": { "max": 30, "min": 13 },
     "summer": { "max": 31, "min": 21 }
   },
   "depend": [
     "FS22_Cerca_BR"
   ],
   "descVersion": 79,
   "iconFileName": "icon_eldoradoMap.dds",
   "iconImage": "data:image/webp;base64, ...",
   "mapConfigFile": "xml/map.xml",
   "mapIsSouth": true,
   "multiPlayer": true,
   "version": "1.0.0.0"
 },
 "uuid": "e4d48eaebd40e7f8d160081dad9c8802"
}