2023-04-03 13:46:04 -07:00
|
|
|
/**
|
|
|
|
|
* All theseus API calls return serialized values (both return values and errors);
|
|
|
|
|
* So, for example, addDefaultInstance creates a blank Profile object, where the Rust struct is serialized,
|
|
|
|
|
* and deserialized into a usable JS object.
|
|
|
|
|
*/
|
2024-08-27 21:49:36 +02:00
|
|
|
import { invoke } from '@tauri-apps/api/core'
|
2023-04-03 13:46:04 -07:00
|
|
|
|
|
|
|
|
// Settings object
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
Settings {
|
|
|
|
|
"memory": MemorySettings,
|
|
|
|
|
"game_resolution": [int int],
|
|
|
|
|
"custom_java_args": [String ...],
|
|
|
|
|
"custom_env_args" : [(string, string) ... ]>,
|
2023-04-07 13:31:06 -07:00
|
|
|
"java_globals": Hash of (string, Path),
|
2023-04-03 13:46:04 -07:00
|
|
|
"default_user": Uuid string (can be null),
|
|
|
|
|
"hooks": Hooks,
|
|
|
|
|
"max_concurrent_downloads": uint,
|
|
|
|
|
"version": u32,
|
2023-05-05 18:37:23 -04:00
|
|
|
"collapsed_navigation": bool,
|
2023-04-03 13:46:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Memorysettings {
|
|
|
|
|
"min": u32, can be null,
|
|
|
|
|
"max": u32,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// Get full settings object
|
|
|
|
|
export async function get() {
|
2023-06-28 09:58:58 -07:00
|
|
|
return await invoke('plugin:settings|settings_get')
|
2023-04-03 13:46:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set full settings object
|
|
|
|
|
export async function set(settings) {
|
2023-06-28 09:58:58 -07:00
|
|
|
return await invoke('plugin:settings|settings_set', { settings })
|
2023-04-03 13:46:04 -07:00
|
|
|
}
|
2023-07-21 20:16:07 -07:00
|
|
|
|
2024-08-16 23:20:11 -07:00
|
|
|
export async function cancel_directory_change() {
|
|
|
|
|
return await invoke('plugin:settings|cancel_directory_change')
|
2023-11-21 17:37:05 +02:00
|
|
|
}
|