Open xavaran-0ad opened 1 month ago
Found file: source/ps/scripting/JSInterface_VFS.cpp
Declaration of the function:
JS::HandleValue val1)
{
ScriptRequest rq(scriptInterface);
if (!PathRestrictionMet<restriction>(rq, filePath))
return;
// TODO: This is a workaround because we need to pass a MutableHandle to StringifyJSON.
JS::RootedValue val(rq.cx, val1);
std::string str(Script::StringifyJSON(rq, &val, false));
VfsPath path(filePath);
WriteBuffer buf;
buf.Append(str.c_str(), str.length());
if (g_VFS->CreateFile(path, buf.Data(), buf.Size()) == INFO::OK)
{
OsPath realPath;
g_VFS->GetRealPath(path, realPath, false);
debug_printf("FILES| JSON data written to '%s'\n", realPath.string8().c_str());
}
else
debug_printf("FILES| Failed to write JSON data to '%s'\n", path.string8().c_str());
}```
An example use case is found here: binaries/data/mods/public/gui/gamesetup/Persistence/PersistentMatchSettings.js
saveFile(settings) { Engine.ProfileStart("savePersistMatchSettingsFile"); Engine.WriteJSONFile(this.filename, { "attributes": this.enabled ? settings : {}, "engine_info": this.engineInfo }); Engine.ProfileStop(); }
`
Stan has revealed: print("" + "\n")
Now we want to be able to log the player IP, the instantaneous GUID, the usernames and assemble them into a database of usernames against IPs. If two different usernames share the same IP, then it's likely to be a smurf or a family.
WriteJSONFile
find the parameters and mechanism of this engine method