Launcher · Leitura e atualização
Temas com tela de configurações usam estas funções para carregar os valores atuais e salvar o que o jogador mudar.
Registro do Windows
GetRegEdit(chaves)Lê valores do registro (as configs do jogo).
// Lê configs do jogo no registro
const cfg = await GetRegEdit(['Resolution', 'SoundOnOff']);UpdateRegEdit(tipo, nome, valor)Grava um valor no registro.
// Grava quando o jogador muda uma opção
UpdateRegEdit('REG_DWORD', 'WindowMode', '1');Ler INI, XML e JSON
GetIni · GetXmlList · GetJsonawait GetIni('config.ini', [{ section:'Video', key:'Width' }]);
await GetXmlList('ResolutionsInfo.xml', 'Resolution');
await GetJson('GCLauncher/dados.json');Gravar INI, XML e JSON
Para salvar o que o jogador mudou, cada formato tem sua função de escrita.
UpdateIni(arquivo, mudancas)Grava um ou vários pares seção/chave no INI.
// Salva a resolução escolhida
UpdateIni('config.ini', [
{ section:'Video', key:'Width', value:'1920' },
{ section:'Video', key:'Height', value:'1080' }
]);SetXmlAttr(arquivo, ...)Altera um atributo de um elemento no XML.
SetXmlAttr('Options.xml', 'Sound', 'volume', '80');WriteJson(arquivo, dados)Grava um JSON inteiro (substitui o conteúdo).
WriteJson('GCLauncher/dados.json', { tema:'escuro', vol:80 });UpdateJson(arquivo, mudancas)Muda só alguns campos do JSON, preservando o resto.
// Só troca o volume, mantém o resto
UpdateJson('GCLauncher/dados.json', { vol:50 });Arquivos com chaves (nome:valor)
Alguns arquivos de config do cliente guardam uma chave por linha, no formato nome:valor. Para esses, há um par de funções próprio.
# exemplo de arquivo
Resolution:1920x1080
Sound:1
Window:0
GetFileValue(arquivo)Lê o arquivo nome:valor e devolve como objeto.
const cfg = await GetFileValue('game.if');
// cfg.Resolution === '1920x1080'UpdateLine(arquivo, mudancas)Atualiza só as chaves informadas, mantendo as linhas restantes.
UpdateLine('game.if', [
{ nome:'Sound', valor:'0' }
]);Todas retornam Promises — use await. Tema sem configurações pode ignorar esta página.
Launcher · Read & write
Themes with a settings screen use these functions to load current values and save what the player changes.
Windows registry
GetRegEdit(keys)Reads registry values (the game settings).
// Read game settings from the registry
const cfg = await GetRegEdit(['Resolution', 'SoundOnOff']);UpdateRegEdit(type, name, value)Writes a value to the registry.
// Save when the player changes an option
UpdateRegEdit('REG_DWORD', 'WindowMode', '1');Read INI, XML and JSON
GetIni · GetXmlList · GetJsonawait GetIni('config.ini', [{ section:'Video', key:'Width' }]);
await GetXmlList('ResolutionsInfo.xml', 'Resolution');
await GetJson('GCLauncher/data.json');Write INI, XML and JSON
To save what the player changed, each format has its write function.
UpdateIni(file, changes)Writes one or more section/key pairs to the INI.
// Save the chosen resolution
UpdateIni('config.ini', [
{ section:'Video', key:'Width', value:'1920' },
{ section:'Video', key:'Height', value:'1080' }
]);SetXmlAttr(file, ...)Changes an attribute of an element in the XML.
SetXmlAttr('Options.xml', 'Sound', 'volume', '80');WriteJson(file, data)Writes an entire JSON (replaces the content).
WriteJson('GCLauncher/data.json', { theme:'dark', vol:80 });UpdateJson(file, changes)Changes only some fields of the JSON, keeping the rest.
// Only changes the volume, keeps the rest
UpdateJson('GCLauncher/data.json', { vol:50 });Key files (name:value)
Some client config files store one key per line, in the name:value format. For those, there is a dedicated pair of functions.
# example file
Resolution:1920x1080
Sound:1
Window:0
GetFileValue(file)Reads the name:value file and returns it as an object.
const cfg = await GetFileValue('game.if');
// cfg.Resolution === '1920x1080'UpdateLine(file, changes)Updates only the given keys, keeping the remaining lines.
UpdateLine('game.if', [
{ nome:'Sound', valor:'0' }
]);All return Promises — use await. A theme without settings can skip this page.
Launcher · Lectura y escritura
Los temas con pantalla de configuración usan estas funciones para cargar los valores actuales y guardar lo que el jugador cambie.
Registro de Windows
GetRegEdit(claves)Lee valores del registro (la config del juego).
// Lee config del juego en el registro
const cfg = await GetRegEdit(['Resolution', 'SoundOnOff']);UpdateRegEdit(tipo, nombre, valor)Escribe un valor en el registro.
// Guarda cuando el jugador cambia una opción
UpdateRegEdit('REG_DWORD', 'WindowMode', '1');Leer INI, XML y JSON
GetIni · GetXmlList · GetJsonawait GetIni('config.ini', [{ section:'Video', key:'Width' }]);
await GetXmlList('ResolutionsInfo.xml', 'Resolution');
await GetJson('GCLauncher/datos.json');Escribir INI, XML y JSON
Para guardar lo que el jugador cambió, cada formato tiene su función de escritura.
UpdateIni(archivo, cambios)Escribe uno o varios pares sección/clave en el INI.
// Guarda la resolución elegida
UpdateIni('config.ini', [
{ section:'Video', key:'Width', value:'1920' },
{ section:'Video', key:'Height', value:'1080' }
]);SetXmlAttr(archivo, ...)Cambia un atributo de un elemento en el XML.
SetXmlAttr('Options.xml', 'Sound', 'volume', '80');WriteJson(archivo, datos)Escribe un JSON entero (reemplaza el contenido).
WriteJson('GCLauncher/datos.json', { tema:'oscuro', vol:80 });UpdateJson(archivo, cambios)Cambia solo algunos campos del JSON, preservando el resto.
// Solo cambia el volumen, mantiene el resto
UpdateJson('GCLauncher/datos.json', { vol:50 });Archivos con claves (nombre:valor)
Algunos archivos de config del cliente guardan una clave por línea, en el formato nombre:valor. Para esos, hay un par de funciones propio.
# archivo de ejemplo
Resolution:1920x1080
Sound:1
Window:0
GetFileValue(archivo)Lee el archivo nombre:valor y lo devuelve como objeto.
const cfg = await GetFileValue('game.if');
// cfg.Resolution === '1920x1080'UpdateLine(archivo, cambios)Actualiza solo las claves indicadas, manteniendo las demás líneas.
UpdateLine('game.if', [
{ nome:'Sound', valor:'0' }
]);Todas retornan Promises — usa await. Un tema sin configuración puede ignorar esta página.