feat: rudimentary config
This commit is contained in:
BIN
rust/icons/slow.ico
Normal file
BIN
rust/icons/slow.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 103 KiB |
@ -5,7 +5,7 @@ use crate::pkg_store::PackageStore;
|
|||||||
|
|
||||||
pub struct AppData {
|
pub struct AppData {
|
||||||
pub profile: Option<Profile>,
|
pub profile: Option<Profile>,
|
||||||
pub pkgs: PackageStore,
|
pub pkgs: PackageStore
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AppData {
|
impl AppData {
|
||||||
|
@ -134,3 +134,19 @@ pub async fn init_profile(
|
|||||||
|
|
||||||
Ok(new_profile)
|
Ok(new_profile)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
pub async fn set_cfg(
|
||||||
|
state: State<'_, Mutex<AppData>>,
|
||||||
|
key: String,
|
||||||
|
value: String
|
||||||
|
) -> Result<(), ()> {
|
||||||
|
log::debug!("invoke: sync_cfg({}, {})", key, value);
|
||||||
|
|
||||||
|
let mut appd = state.lock().await;
|
||||||
|
if let Some(p) = &mut appd.profile {
|
||||||
|
p.cfg.insert(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
@ -116,7 +116,8 @@ pub async fn run(_args: Vec<String>) {
|
|||||||
cmd::get_current_profile,
|
cmd::get_current_profile,
|
||||||
cmd::init_profile,
|
cmd::init_profile,
|
||||||
cmd::save_profile,
|
cmd::save_profile,
|
||||||
cmd::startline
|
cmd::startline,
|
||||||
|
cmd::set_cfg
|
||||||
])
|
])
|
||||||
.run(tauri::generate_context!())
|
.run(tauri::generate_context!())
|
||||||
.expect("error while running tauri application");
|
.expect("error while running tauri application");
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use std::{collections::HashSet, path::PathBuf};
|
use std::{collections::{HashMap, HashSet}, path::PathBuf};
|
||||||
|
|
||||||
use crate::{model::misc, pkg::PkgKey, util};
|
use crate::{model::misc, pkg::PkgKey, util};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use tokio::fs;
|
use tokio::fs;
|
||||||
@ -15,6 +14,7 @@ pub struct Profile {
|
|||||||
pub mods: HashSet<PkgKey>,
|
pub mods: HashSet<PkgKey>,
|
||||||
pub wine_runtime: Option<PathBuf>,
|
pub wine_runtime: Option<PathBuf>,
|
||||||
pub wine_prefix: Option<PathBuf>,
|
pub wine_prefix: Option<PathBuf>,
|
||||||
|
pub cfg: HashMap<String, String>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Profile {
|
impl Profile {
|
||||||
@ -39,6 +39,7 @@ impl Profile {
|
|||||||
),
|
),
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
wine_prefix: None,
|
wine_prefix: None,
|
||||||
|
cfg: HashMap::new()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,27 +32,37 @@ pub fn start(p: &Profile, app: AppHandle) -> Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
pub fn start(p: &Profile) -> Result<()> {
|
pub fn start(p: &Profile, app: AppHandle) -> Result<()> {
|
||||||
use std::process::Stdio;
|
use std::process::Stdio;
|
||||||
use tokio::task::JoinSet;
|
use tokio::task::JoinSet;
|
||||||
|
|
||||||
|
let create_no_window = 0x08000000;
|
||||||
|
|
||||||
let ini_path = util::profile_dir(&p).join("segatools.ini");
|
let ini_path = util::profile_dir(&p).join("segatools.ini");
|
||||||
|
|
||||||
log::debug!("With path {}", ini_path.to_string_lossy());
|
log::debug!("With path {}", ini_path.to_string_lossy());
|
||||||
log::info!("Launching amdaemon");
|
log::info!("Launching amdaemon");
|
||||||
let mut amd = Command::new("cmd.exe")
|
|
||||||
.env(
|
let mut amd_builder = Command::new("cmd.exe");
|
||||||
|
amd_builder.env(
|
||||||
"SEGATOOLS_CONFIG_PATH",
|
"SEGATOOLS_CONFIG_PATH",
|
||||||
&ini_path,
|
&ini_path,
|
||||||
)
|
)
|
||||||
.env("OPENSSL_ia32cap", ":~0x20000000")
|
.creation_flags(create_no_window)
|
||||||
.current_dir(&p.exe_dir)
|
.current_dir(&p.exe_dir)
|
||||||
.args(["/C", &util::path_to_str(p.exe_dir.join( "inject.exe"))?, "-d", "-k", "mu3hook.dll", "amdaemon.exe", "-f", "-c", "config_common.json", "config_server.json", "config_client.json"])
|
.args(["/C", &util::path_to_str(p.exe_dir.join( "inject.exe"))?, "-d", "-k", "mu3hook.dll", "amdaemon.exe", "-f", "-c", "config_common.json", "config_server.json", "config_client.json"])
|
||||||
// Obviously this is a meme
|
// Obviously this is a meme
|
||||||
// Output will be handled properly at a later time
|
// Output will be handled properly at a later time
|
||||||
.stdout(Stdio::null())
|
.stdout(Stdio::null())
|
||||||
.stderr(Stdio::null())
|
.stderr(Stdio::null());
|
||||||
.spawn()?;
|
|
||||||
|
if let Some(v) = p.cfg.get("intel") {
|
||||||
|
if v == "true" {
|
||||||
|
amd_builder.env("OPENSSL_ia32cap", ":~0x20000000");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut amd = amd_builder.spawn()?;
|
||||||
|
|
||||||
log::info!("Launching mu3");
|
log::info!("Launching mu3");
|
||||||
let mut game = Command::new(p.exe_dir.join( "inject.exe"))
|
let mut game = Command::new(p.exe_dir.join( "inject.exe"))
|
||||||
@ -60,6 +70,7 @@ pub fn start(p: &Profile) -> Result<()> {
|
|||||||
"SEGATOOLS_CONFIG_PATH",
|
"SEGATOOLS_CONFIG_PATH",
|
||||||
ini_path,
|
ini_path,
|
||||||
)
|
)
|
||||||
|
.creation_flags(create_no_window)
|
||||||
.current_dir(&p.exe_dir)
|
.current_dir(&p.exe_dir)
|
||||||
.args(["-d", "-k", "mu3hook.dll", "mu3.exe", "-monitor 1", "-screen-fullscreen", "0", "-popupwindow", "-screen-width", "1080", "-screen-height", "1920"])
|
.args(["-d", "-k", "mu3hook.dll", "mu3.exe", "-monitor 1", "-screen-fullscreen", "0", "-popupwindow", "-screen-width", "1080", "-screen-height", "1920"])
|
||||||
.stdout(Stdio::null())
|
.stdout(Stdio::null())
|
||||||
@ -87,7 +98,7 @@ pub fn start(p: &Profile) -> Result<()> {
|
|||||||
|
|
||||||
log::debug!("Fin");
|
log::debug!("Fin");
|
||||||
|
|
||||||
app.emit("launch-end", "");
|
_ = app.emit("launch-end", "");
|
||||||
});
|
});
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -42,6 +42,6 @@
|
|||||||
"bundle": {
|
"bundle": {
|
||||||
"active": true,
|
"active": true,
|
||||||
"targets": "all",
|
"targets": "all",
|
||||||
"icon": ["icons/slow.png"]
|
"icon": ["icons/slow.png", "icons/slow.ico"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ const store = usePkgStore();
|
|||||||
store.setupListeners();
|
store.setupListeners();
|
||||||
|
|
||||||
const currentTab = ref('3');
|
const currentTab = ref('3');
|
||||||
const startEnabled = ref(true);
|
const startEnabled = ref(false);
|
||||||
|
|
||||||
const loadProfile = async () => {
|
const loadProfile = async () => {
|
||||||
await store.reloadProfile();
|
await store.reloadProfile();
|
||||||
@ -42,6 +42,7 @@ const loadProfile = async () => {
|
|||||||
}
|
}
|
||||||
if (store.profile !== null) {
|
if (store.profile !== null) {
|
||||||
changePrimaryColor(store.profile.game);
|
changePrimaryColor(store.profile.game);
|
||||||
|
startEnabled.value = true;
|
||||||
currentTab.value = '0';
|
currentTab.value = '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,19 +1,25 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { usePkgStore } from '../stores';
|
||||||
import Fieldset from 'primevue/fieldset';
|
import Fieldset from 'primevue/fieldset';
|
||||||
import Toggle from 'primevue/toggleswitch';
|
import Toggle from 'primevue/toggleswitch';
|
||||||
|
|
||||||
|
const store = usePkgStore();
|
||||||
|
|
||||||
|
const setValue = async (value: boolean) => {
|
||||||
|
await store.set_cfg('intel', value);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Fieldset>
|
<Fieldset>
|
||||||
<div class="flex w-full flex-col">
|
<div class="flex w-full flex-col">
|
||||||
<label for="switch" class="flex flex-row w-full p-2">
|
<label for="switch" class="flex flex-row w-full p-2">
|
||||||
<div class="grow">Aime emulation</div>
|
<div class="grow">OpenSSL crash workaround for Intel ≥10th gen</div>
|
||||||
<Toggle disabled inputId="switch" />
|
<Toggle
|
||||||
|
inputId="switch"
|
||||||
|
:modelValue="store.cfg('intel') === 'true'"
|
||||||
|
v-on:value-change="setValue" />
|
||||||
</label>
|
</label>
|
||||||
<div class="flex flex-row w-full p-2">
|
|
||||||
<div class="grow">Enable console</div>
|
|
||||||
<Toggle disabled />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</Fieldset>
|
</Fieldset>
|
||||||
</template>
|
</template>
|
||||||
|
@ -25,6 +25,7 @@ export const usePkgStore = defineStore('pkg', {
|
|||||||
profile: (state) => state.prf,
|
profile: (state) => state.prf,
|
||||||
isEnabled: (state) => (pkg: Package | undefined) =>
|
isEnabled: (state) => (pkg: Package | undefined) =>
|
||||||
pkg !== undefined && state.prf?.mods.includes(pkgKey(pkg)),
|
pkg !== undefined && state.prf?.mods.includes(pkgKey(pkg)),
|
||||||
|
cfg: (state) => (key: string) => state.prf?.cfg[key]
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
setupListeners() {
|
setupListeners() {
|
||||||
@ -99,5 +100,11 @@ export const usePkgStore = defineStore('pkg', {
|
|||||||
await this.reloadProfile();
|
await this.reloadProfile();
|
||||||
await this.saveProfile();
|
await this.saveProfile();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async set_cfg(key: string, value: string | boolean | number) {
|
||||||
|
await invoke('set_cfg', { key, value: `${value}` });
|
||||||
|
await this.reloadProfile();
|
||||||
|
await this.saveProfile();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
@ -23,6 +23,7 @@ export interface Profile {
|
|||||||
name: string;
|
name: string;
|
||||||
game: 'Ongeki' | 'Chunithm';
|
game: 'Ongeki' | 'Chunithm';
|
||||||
mods: string[];
|
mods: string[];
|
||||||
|
cfg: {[key: string]: string | boolean}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type PackageC = Map<string, Package>;
|
export type PackageC = Map<string, Package>;
|
||||||
|
Reference in New Issue
Block a user