forked from NG-SD-Plugins/PowerTools
Only convert game ID to number in a language that doesn't have horrible number types
This commit is contained in:
parent
1d57edfd80
commit
c374212b13
7 changed files with 9 additions and 9 deletions
2
backend/Cargo.lock
generated
2
backend/Cargo.lock
generated
|
@ -1095,7 +1095,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "powertools"
|
name = "powertools"
|
||||||
version = "1.3.0-beta2"
|
version = "1.3.0-beta3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"libryzenadj",
|
"libryzenadj",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "powertools"
|
name = "powertools"
|
||||||
version = "1.3.0-beta2"
|
version = "1.3.0-beta3"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["NGnius (Graham) <ngniusness@gmail.com>"]
|
authors = ["NGnius (Graham) <ngniusness@gmail.com>"]
|
||||||
description = "Backend (superuser) functionality for PowerTools"
|
description = "Backend (superuser) functionality for PowerTools"
|
||||||
|
|
|
@ -55,7 +55,7 @@ pub fn load_settings(
|
||||||
sender: Sender<ApiMessage>,
|
sender: Sender<ApiMessage>,
|
||||||
) -> impl Fn(super::ApiParameterType) -> super::ApiParameterType {
|
) -> impl Fn(super::ApiParameterType) -> super::ApiParameterType {
|
||||||
let sender = Mutex::new(sender); // Sender is not Sync; this is required for safety
|
let sender = Mutex::new(sender); // Sender is not Sync; this is required for safety
|
||||||
let setter = move |path: i64, name: String| {
|
let setter = move |path: u64, name: String| {
|
||||||
sender
|
sender
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -63,9 +63,9 @@ pub fn load_settings(
|
||||||
.expect("load_settings send failed")
|
.expect("load_settings send failed")
|
||||||
};
|
};
|
||||||
move |params_in: super::ApiParameterType| {
|
move |params_in: super::ApiParameterType| {
|
||||||
if let Some(Primitive::F64(id)) = params_in.get(0) {
|
if let Some(Primitive::String(id)) = params_in.get(0) {
|
||||||
if let Some(Primitive::String(name)) = params_in.get(1) {
|
if let Some(Primitive::String(name)) = params_in.get(1) {
|
||||||
setter(*id as i64, name.to_owned());
|
setter(id.parse().unwrap_or_default(), name.to_owned());
|
||||||
vec![true.into()]
|
vec![true.into()]
|
||||||
} else {
|
} else {
|
||||||
log::warn!("load_settings missing name parameter");
|
log::warn!("load_settings missing name parameter");
|
||||||
|
|
|
@ -23,7 +23,7 @@ pub enum ApiMessage {
|
||||||
OnChargeChange(f64), // battery fill amount: 0 = empty, 1 = full
|
OnChargeChange(f64), // battery fill amount: 0 = empty, 1 = full
|
||||||
PowerVibeCheck,
|
PowerVibeCheck,
|
||||||
WaitForEmptyQueue(Callback<()>),
|
WaitForEmptyQueue(Callback<()>),
|
||||||
LoadSettings(i64, String), // (path, name)
|
LoadSettings(u64, String), // (path, name)
|
||||||
LoadMainSettings,
|
LoadMainSettings,
|
||||||
LoadSystemSettings,
|
LoadSystemSettings,
|
||||||
GetLimits(Callback<super::SettingsLimits>),
|
GetLimits(Callback<super::SettingsLimits>),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "PowerTools",
|
"name": "PowerTools",
|
||||||
"version": "1.3.0-beta2",
|
"version": "1.3.0-beta3",
|
||||||
"description": "Power tweaks for power users",
|
"description": "Power tweaks for power users",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "shx rm -rf dist && rollup -c",
|
"build": "shx rm -rf dist && rollup -c",
|
||||||
|
|
|
@ -243,7 +243,7 @@ export async function getGeneralPersistent(): Promise<boolean> {
|
||||||
return (await call_backend("GENERAL_get_persistent", []))[0];
|
return (await call_backend("GENERAL_get_persistent", []))[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function loadGeneralSettings(id: number, name: string): Promise<boolean> {
|
export async function loadGeneralSettings(id: string, name: string): Promise<boolean> {
|
||||||
return (await call_backend("GENERAL_load_settings", [id, name]))[0];
|
return (await call_backend("GENERAL_load_settings", [id, name]))[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,7 @@ const reload = function() {
|
||||||
backend.log(backend.LogLevel.Info, "RegisterForGameActionStart callback(" + actionType + ", " + id + ")");
|
backend.log(backend.LogLevel.Info, "RegisterForGameActionStart callback(" + actionType + ", " + id + ")");
|
||||||
// don't use gameInfo.appid, haha
|
// don't use gameInfo.appid, haha
|
||||||
backend.resolve(
|
backend.resolve(
|
||||||
backend.loadGeneralSettings(Number(id), gameInfo.display_name),
|
backend.loadGeneralSettings(id.toString(), gameInfo.display_name),
|
||||||
(ok: boolean) => {backend.log(backend.LogLevel.Debug, "Loading settings ok? " + ok)}
|
(ok: boolean) => {backend.log(backend.LogLevel.Debug, "Loading settings ok? " + ok)}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue