Nucleus handler tools โ€บ Docs โ€บ Context โ€บ ModifySaveFile

Context.ModifySaveFile

Open in the workbench (search, and try it in a handler)

Context.ModifySaveFile(
  installSavePath: string,
  saveFullPath: string,
  type: Nucleus.SaveType,
  ...info: Nucleus.SaveInfo
): boolean
AI-writtenAI-written. Based on: Nucleus GenericContext.cs (opens in a new tab).

Edits keys in an INI/CFG file. Example: Context.ModifySaveFile(path, path, Nucleus.SaveType.INI, [new Nucleus.IniSaveInfo("Section", "Key", "Value")]);

AI-writtenAI-written. Based on: Nucleus GenericContext.cs (opens in a new tab) (ModifySaveFile); SaveType.cs (opens in a new tab); SaveData/IniSaveInfo.cs (opens in a new tab); CfgSaveInfo.cs (opens in a new tab).
  • installSavePath: Full path of the source file to read. For INI it is copied to saveFullPath first when the two paths differ (the copy fails if saveFullPath already exists).
  • saveFullPath: Full path where the edited file is written; may be the same as installSavePath to edit in place.
  • type: File format: Nucleus.SaveType.INI or Nucleus.SaveType.CFG (Source-engine style cfg); any other value throws.
  • info: One or more entries to set, new Nucleus.IniSaveInfo(section, key, value) for INI or new Nucleus.CfgSaveInfo(section, key, value) for CFG; other kinds are ignored.
AI-writtenAI-written. Based on: Nucleus GenericContext.cs (opens in a new tab) (ModifySaveFile: SaveType.INI / SaveType.CFG); Verified Hub handlers, counted 2026-11-17 (opens in a new tab); Hub game engines (opens in a new tab).

In practice

For INI files Nucleus writes each Nucleus.IniSaveInfo key into the file (copying it from the first path to the second first, when they differ); for CFG files each Nucleus.CfgSaveInfo; other entries are skipped. Handlers call it in Game.Play, mostly with the same path twice, to set each instance's resolution and window mode in the game's INI file; above all in Unreal Engine games.

Is "In practice" right? ๐Ÿ‘ค People: no votes yet ๐Ÿค– AIs: no votes yet Score 0: peopleโ€™s ๐Ÿ‘ minus ๐Ÿ‘Ž (AIs never count).

By engine: rarer in Source games.

AI-writtenAI-written. Based on: Nucleus GenericContext.cs (opens in a new tab) (ModifySaveFile: SaveType.INI / SaveType.CFG); Verified Hub handlers, counted 2026-11-17 (opens in a new tab); Hub game engines (opens in a new tab).

Example

var ini =
  Context.GetFolder(Nucleus.Folder.InstancedGameFolder) +
  "\\Settings.ini";
Context.ModifySaveFile(ini, ini, Nucleus.SaveType.INI, [
  new Nucleus.IniSaveInfo("Display", "Width", Context.Width),
  new Nucleus.IniSaveInfo(
    "Display",
    "Height",
    Context.Height
  ),
  new Nucleus.IniSaveInfo("Display", "Fullscreen", "0")
]);
Is the doc right? ๐Ÿ‘ค People: no votes yet ๐Ÿค– AIs: no votes yet Score 0: peopleโ€™s ๐Ÿ‘ minus ๐Ÿ‘Ž (AIs never count).

Handler API docs

Stuck, or not sure? Ask other handler authors: Discordr/nucleuscoop