mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-15 08:34:43 +01:00
always unpatch game on close
This commit is contained in:
@@ -101,6 +101,7 @@ fn enable_process_watcher(window: tauri::Window,process: String) {
|
|||||||
*WATCH_GAME_PROCESS.lock().unwrap() = "".to_string();
|
*WATCH_GAME_PROCESS.lock().unwrap() = "".to_string();
|
||||||
disconnect();
|
disconnect();
|
||||||
|
|
||||||
|
window.emit("game_closed", &()).unwrap();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import { dataDir } from '@tauri-apps/api/path'
|
|||||||
import { appWindow } from '@tauri-apps/api/window'
|
import { appWindow } from '@tauri-apps/api/window'
|
||||||
import { convertFileSrc } from '@tauri-apps/api/tauri'
|
import { convertFileSrc } from '@tauri-apps/api/tauri'
|
||||||
import { getTheme, loadTheme } from '../utils/themes'
|
import { getTheme, loadTheme } from '../utils/themes'
|
||||||
|
import { unpatchGame } from '../utils/metadata'
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
[key: string]: never;
|
[key: string]: never;
|
||||||
@@ -60,6 +61,15 @@ class App extends React.Component<IProps, IState> {
|
|||||||
setConfigOption('grasscutter_path', payload)
|
setConfigOption('grasscutter_path', payload)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Emitted for metadata replacing-purposes
|
||||||
|
listen('game_closed', async () => {
|
||||||
|
const unpatched = await unpatchGame()
|
||||||
|
|
||||||
|
if (!unpatched) {
|
||||||
|
alert(`Could not unpatch game! (You should be able to find your metadata backup in ${await dataDir()}\\cultivation\\)`)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
let min = false
|
let min = false
|
||||||
|
|
||||||
// periodically check if we need to min/max based on whether the game is open
|
// periodically check if we need to min/max based on whether the game is open
|
||||||
|
|||||||
Reference in New Issue
Block a user