Compare commits

..

6 Commits

Author SHA1 Message Date
Thoronium
14173e5b9f Merge branch 'main' of https://github.com/Grasscutters/Cultivation 2025-01-16 20:45:13 -07:00
Thoronium
3669bb334b Bump version 2025-01-16 20:45:07 -07:00
Thoronium
03fed7a69a Support XXMI launching with args 2025-01-16 20:41:17 -07:00
Thoronium
55a90ea531 Add 5.3 patch
Bump version
2025-01-01 13:47:37 -07:00
Thoronium
b28c3881e6 Bump version 2024-12-23 02:36:28 -07:00
Thoronium
4d98cd9468 Fix comparison 2024-10-31 02:11:46 -06:00
14 changed files with 73 additions and 16 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "cultivation", "name": "cultivation",
"version": "1.5.1", "version": "1.5.4",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@tauri-apps/api": "^1.0.0-rc.5", "@tauri-apps/api": "^1.0.0-rc.5",

2
src-tauri/Cargo.lock generated
View File

@@ -959,7 +959,7 @@ checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35"
[[package]] [[package]]
name = "cultivation" name = "cultivation"
version = "1.5.1" version = "1.5.4"
dependencies = [ dependencies = [
"anime-launcher-sdk", "anime-launcher-sdk",
"anyhow", "anyhow",

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "cultivation" name = "cultivation"
version = "1.5.1" version = "1.5.4"
description = "A custom launcher for anime game." description = "A custom launcher for anime game."
authors = ["KingRainbow44", "SpikeHD"] authors = ["KingRainbow44", "SpikeHD"]
license = "" license = ""

Binary file not shown.

Binary file not shown.

View File

@@ -209,6 +209,7 @@ fn main() -> Result<(), ArgsError> {
get_theme_list, get_theme_list,
system_helpers::run_command, system_helpers::run_command,
system_helpers::run_program, system_helpers::run_program,
system_helpers::run_program_args,
system_helpers::run_program_relative, system_helpers::run_program_relative,
system_helpers::start_service, system_helpers::start_service,
system_helpers::service_status, system_helpers::service_status,

View File

@@ -108,6 +108,18 @@ impl SpawnItsFineReally for Command {
} }
} }
#[tauri::command]
pub fn run_program_args(path: String, args: Option<String>) {
match open::with(
format!("{}", args.unwrap_or_else(|| "".into())),
path.clone(),
) {
Ok(_) => (),
Err(e) => println!("Failed to open program ({}): {}", &path, e),
};
return;
}
#[tauri::command] #[tauri::command]
pub fn run_program(path: String, args: Option<String>) { pub fn run_program(path: String, args: Option<String>) {
// Without unwrap_or, this can crash when UAC prompt is denied // Without unwrap_or, this can crash when UAC prompt is denied

View File

@@ -7,7 +7,7 @@
}, },
"package": { "package": {
"productName": "Cultivation", "productName": "Cultivation",
"version": "1.5.1" "version": "1.5.4"
}, },
"tauri": { "tauri": {
"allowlist": { "allowlist": {

View File

@@ -278,6 +278,13 @@ export default class ServerLaunchSection extends React.Component<IProps, IState>
if (config.launch_args.length < 1) { if (config.launch_args.length < 1) {
// Run relative when there are no args // Run relative when there are no args
await invoke('run_program_relative', { path: exe || config.game_install_path }) await invoke('run_program_relative', { path: exe || config.game_install_path })
}
// Handle XXMI
else if (proc_name?.toLowerCase().includes('xxmi')) {
await invoke('run_program_args', {
path: exe,
args: config.launch_args,
})
} else { } else {
// Run directly when there are args // Run directly when there are args
await invoke('run_program', { await invoke('run_program', {

View File

@@ -69,7 +69,10 @@ export class ExtrasMenu extends React.Component<IProps, IState> {
// This injects independent of the game // This injects independent of the game
if (this.state.launch_migoto) { if (this.state.launch_migoto) {
await this.launchMigoto() if (await this.launchMigoto()) {
// Already launched the game (ie. via XXMI)
return
}
} }
// This injects independent of the game // This injects independent of the game
@@ -104,7 +107,17 @@ export class ExtrasMenu extends React.Component<IProps, IState> {
if (!config.migoto_path) return alert('Migoto not installed or set!') if (!config.migoto_path) return alert('Migoto not installed or set!')
if (config.migoto_path?.toLowerCase().includes('xxmi')) {
// Get game exe from game path, so we can watch it
const pathArr = config.migoto_path.replace(/\\/g, '/').split('/')
const gameExec = pathArr[pathArr.length - 1]
this.props.playGame(config.migoto_path, gameExec)
return true
}
await invoke('run_program_relative', { path: config.migoto_path }) await invoke('run_program_relative', { path: config.migoto_path })
return false
} }
async launchReshade() { async launchReshade() {

View File

@@ -143,7 +143,7 @@ export default class NewsSection extends React.Component<IProps, IState> {
<tr> <tr>
<td> <td>
Work in progress area! These numbers may be outdated, so please do not use them as reference. Latest Work in progress area! These numbers may be outdated, so please do not use them as reference. Latest
version: Grasscutter 1.7.4 - Cultivation 1.5.1 version: Grasscutter 1.7.4 - Cultivation 1.5.4
</td> </td>
</tr> </tr>
) )

View File

@@ -109,25 +109,35 @@ export default class DownloadHandler {
downloadingJar() { downloadingJar() {
// Kinda hacky but it works // Kinda hacky but it works
return this.downloads.some((d) => d.path.includes('grasscutter.zip') && d.status != ('finished' || 'error')) return this.downloads.some(
(d) => d.path.includes('grasscutter.zip') && !(d.status.includes('finished') || d.status.includes('error'))
)
} }
downloadingFullBuild() { downloadingFullBuild() {
// Kinda hacky but it works // Kinda hacky but it works
return this.downloads.some((d) => d.path.includes('GrasscutterCulti') && d.status != ('finished' || 'error')) return this.downloads.some(
(d) => d.path.includes('GrasscutterCulti') && !(d.status.includes('finished') || d.status.includes('error'))
)
} }
downloadingResources() { downloadingResources() {
// Kinda hacky but it works // Kinda hacky but it works
return this.downloads.some((d) => d.path.includes('resources') && d.status != ('finished' || 'error')) return this.downloads.some(
(d) => d.path.includes('resources') && !(d.status.includes('finished') || d.status.includes('error'))
)
} }
downloadingRepo() { downloadingRepo() {
return this.downloads.some((d) => d.path.includes('grasscutter_repo.zip') && d.status != ('finished' || 'error')) return this.downloads.some(
(d) => d.path.includes('grasscutter_repo.zip') && !(d.status.includes('finished') || d.status.includes('error'))
)
} }
downloadingMigoto() { downloadingMigoto() {
return this.downloads.some((d) => d.path.includes('3dmigoto') && d.status != ('finished' || 'error')) return this.downloads.some(
(d) => d.path.includes('3dmigoto') && !(d.status.includes('finished') || d.status.includes('error'))
)
} }
addDownload(url: string, path: string, onFinish?: () => void) { addDownload(url: string, path: string, onFinish?: () => void) {

View File

@@ -50,20 +50,34 @@ export async function getGameDataFolder() {
export async function getGameVersion() { export async function getGameVersion() {
const GameData = await getGameDataFolder() const GameData = await getGameDataFolder()
const platform = await invoke('get_platform')
if (!GameData) { if (!GameData) {
return null return null
} }
const hasAsb = await invoke('dir_exists', { let hasAsb = await invoke('dir_exists', {
path: GameData + '\\StreamingAssets\\asb_settings.json', path: GameData + '\\StreamingAssets\\asb_settings.json',
}) })
if (platform != 'windows') {
hasAsb = await invoke('dir_exists', {
path: GameData + '/StreamingAssets/asb_settings.json',
})
}
if (!hasAsb) { if (!hasAsb) {
// For games that cannot determine game version // For games that cannot determine game version
const otherGameVer: string = await invoke('read_file', { let otherGameVer: string = await invoke('read_file', {
path: GameData + '\\StreamingAssets\\BinaryVersion.bytes', path: GameData + '\\StreamingAssets\\BinaryVersion.bytes',
}) })
if (platform != 'windows') {
otherGameVer = await invoke('read_file', {
path: GameData + '/StreamingAssets/BinaryVersion.bytes',
})
}
const versionRaw = otherGameVer.split('.') const versionRaw = otherGameVer.split('.')
const version = { const version = {
major: parseInt(versionRaw[0]), major: parseInt(versionRaw[0]),

View File

@@ -7908,9 +7908,9 @@ rollup-plugin-terser@^7.0.0:
terser "^5.0.0" terser "^5.0.0"
rollup@^2.43.1: rollup@^2.43.1:
version "2.79.2" version "2.77.0"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.79.2.tgz#f150e4a5db4b121a21a747d762f701e5e9f49090" resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.77.0.tgz#749eaa5ac09b6baa52acc076bc46613eddfd53f4"
integrity sha512-fS6iqSPZDs3dr/y7Od6y5nha8dW1YnbgtsyotCVvoFGKbERG++CVRFv1meyGDE1SNItQA8BrnCw7ScdAhRJ3XQ== integrity sha512-vL8xjY4yOQEw79DvyXLijhnhh+R/O9zpF/LEgkCebZFtb6ELeN9H3/2T0r8+mp+fFTBHZ5qGpOpW2ela2zRt3g==
optionalDependencies: optionalDependencies:
fsevents "~2.3.2" fsevents "~2.3.2"