Add non-elevated game option

This commit is contained in:
Thoronium 2023-04-14 23:22:34 -06:00
parent 5de80f1655
commit 7bfa5e8e11
18 changed files with 78 additions and 14 deletions

View File

@ -29,7 +29,8 @@
"use_proxy": "使用内置代理",
"wipe_login": "清除登录缓存",
"horny_mode": "Horny 模式",
"auto_mongodb": "自动启动 MongoDB"
"auto_mongodb": "自动启动 MongoDB",
"un_elevated": "非提升运行游戏(无管理员)"
},
"downloads": {
"grasscutter_fullbuild": "下载 Grasscutter 一体化",

View File

@ -29,7 +29,8 @@
"use_proxy": "使用內建代理伺服器",
"wipe_login": "擦除登錄緩存",
"horny_mode": "Horny模式",
"auto_mongodb": "自動啟動 MongoDB"
"auto_mongodb": "自動啟動 MongoDB",
"un_elevated": "在不升高的情况下运行游戏(没有管理员)。"
},
"downloads": {
"grasscutter_fullbuild": "下載Grasscutter多合一下載",

View File

@ -28,7 +28,8 @@
"use_proxy": "Gebruik interne proxy",
"wipe_login": "Wis de inlogcache",
"horny_mode": "Geile modus",
"auto_mongodb": "Start automatisch MongoDB"
"auto_mongodb": "Start automatisch MongoDB",
"un_elevated": "Führen Sie das Spiel nicht erhöht aus (kein Admin)"
},
"downloads": {
"grasscutter_fullbuild": "Alles in Einem Grasscutter Daten herunterladen",

View File

@ -29,7 +29,8 @@
"use_proxy": "Use Internal Proxy",
"wipe_login": "Wipe Login Cache",
"horny_mode": "Horny Mode",
"auto_mongodb": "Automatically Start MongoDB"
"auto_mongodb": "Automatically Start MongoDB",
"un_elevated": "Run the game non-elevated (no admin)"
},
"downloads": {
"grasscutter_fullbuild": "Download Grasscutter All-in-One",

View File

@ -29,7 +29,8 @@
"use_proxy": "Usar proxy interno",
"wipe_login": "Borrar caché de inicio de sesión",
"horny_mode": "Modo cachondo",
"auto_mongodb": "Iniciar automáticamente MongoDB"
"auto_mongodb": "Iniciar automáticamente MongoDB",
"un_elevated": "Ejecutar el juego no elevado (no admin)"
},
"downloads": {
"grasscutter_fullbuild": "Descargar Datos todo en uno de Grasscutter",

View File

@ -29,7 +29,8 @@
"use_proxy": "Utiliser un proxy interne",
"wipe_login": "Effacer le cache de connexion",
"horny_mode": "Mode excitation",
"auto_mongodb": "Démarrer automatiquement MongoDB"
"auto_mongodb": "Démarrer automatiquement MongoDB",
"un_elevated": "Exécuter le jeu sans élévation (pas d'administrateur)"
},
"downloads": {
"grasscutter_fullbuild": "Telecharger Grasscutter tout-en-un",

View File

@ -28,7 +28,8 @@
"use_proxy": "Gunakan Proxy Internal",
"wipe_login": "Menghapus Cache Login",
"horny_mode": "Mode Terangsang",
"auto_mongodb": "Mulai MongoDB secara otomatis"
"auto_mongodb": "Mulai MongoDB secara otomatis",
"un_elevated": "Jalankan game yang tidak ditinggikan (tanpa admin)"
},
"downloads": {
"grasscutter_fullbuild": "Sedang Mendownload Grasscutter Semua Dalam Satu",

View File

@ -29,7 +29,8 @@
"use_proxy": "내부 프록시 사용",
"wipe_login": "로그인 캐시 지우기",
"horny_mode": "Horny 모드",
"auto_mongodb": "MongoDB 자동 시작"
"auto_mongodb": "MongoDB 자동 시작",
"un_elevated": "게임 비상승 실행(관리자 없음)"
},
"downloads": {
"grasscutter_fullbuild": "올인원 Grasscutter 다운로드",

View File

@ -27,7 +27,8 @@
"use_proxy": "Izmantot iekšējo starpniekserveri",
"wipe_login": "Noslaucīt pieteikšanās kešatmiņu",
"horny_mode": "Uzbudināts režīms",
"auto_mongodb": "Automātiski startējiet MongoDB"
"auto_mongodb": "Automātiski startējiet MongoDB",
"un_elevated": "Palaist spēli bez paaugstinājuma (bez administratora)"
},
"downloads": {
"grasscutter_fullbuild": "Lejupielādējiet Grasscutter viss vienā",

View File

@ -28,7 +28,8 @@
"use_proxy": "Gebruik Interne Proxy",
"wipe_login": "Login cache wissen",
"horny_mode": "Geile modus",
"auto_mongodb": "Start automatisch MongoDB"
"auto_mongodb": "Start automatisch MongoDB",
"un_elevated": "Voer het spel uit zonder hoogtevrees (geen admin)"
},
"downloads": {
"grasscutter_fullbuild": "Grasscutter Alles-in-één Downloaden",

View File

@ -29,7 +29,8 @@
"use_proxy": "Usar Proxy Interno",
"wipe_login": "Limpar Cache de Login",
"horny_mode": "Modo com tesão",
"auto_mongodb": "Iniciar MongoDB Automaticamente"
"auto_mongodb": "Iniciar MongoDB Automaticamente",
"un_elevated": "Executar o jogo não-elevated (sem admin)"
},
"downloads": {
"grasscutter_fullbuild": "Baixar o Grasscutter Tudo-em-Um",

View File

@ -28,7 +28,8 @@
"use_proxy": "Использовать встроенный Прокси",
"wipe_login": "Очистить кэш входа в систему",
"horny_mode": "роговой режим",
"auto_mongodb": "Автоматически запускать MongoDB"
"auto_mongodb": "Автоматически запускать MongoDB",
"un_elevated": "Запустите игру в неэлегантном режиме (без администратора)"
},
"downloads": {
"grasscutter_fullbuild": "Скачать все в одном Grasscutter",

View File

@ -29,7 +29,8 @@
"use_proxy": "Sử dụng proxy nội bộ",
"wipe_login": "Tẩy sạch cache đăng nhập",
"horny_mode": "Chế độ hứng tình",
"auto_mongodb": "Tự động khởi động MongoDB"
"auto_mongodb": "Tự động khởi động MongoDB",
"un_elevated": "Chạy trò chơi không nâng cao (không có quản trị viên)"
},
"downloads": {
"grasscutter_fullbuild": "Tải Grasscutter tất cả trong một",

View File

@ -105,6 +105,7 @@ fn main() {
system_helpers::set_migoto_delay,
system_helpers::wipe_registry,
system_helpers::get_platform,
system_helpers::run_un_elevated,
proxy::set_proxy_addr,
proxy::generate_ca_files,
unzip::unzip,

View File

@ -77,6 +77,18 @@ pub fn run_jar(path: String, execute_in: String, java_path: String) {
};
}
#[tauri::command]
pub fn run_un_elevated(path: String) {
// Open the program non-elevated.
match open::with(
format!("cmd /min /C \"set __COMPAT_LAYER=RUNASINVOKER && start \"\" \"{}\"\"", path),
"C:\\Windows\\System32\\cmd.exe",
) {
Ok(_) => (),
Err(e) => println!("Failed to open program ({}): {}", &path, e),
};
}
#[tauri::command]
pub fn open_in_browser(url: String) {
// Open the URL in the default browser.

View File

@ -39,6 +39,8 @@ interface IState {
swag: boolean
akebiSet: boolean
migotoSet: boolean
unElevated: boolean
}
export default class ServerLaunchSection extends React.Component<IProps, IState> {
@ -62,6 +64,7 @@ export default class ServerLaunchSection extends React.Component<IProps, IState>
swag: false,
akebiSet: false,
migotoSet: false,
unElevated: false,
}
this.toggleGrasscutter = this.toggleGrasscutter.bind(this)
@ -93,6 +96,7 @@ export default class ServerLaunchSection extends React.Component<IProps, IState>
swag: config.swag_mode || false,
akebiSet: config.akebi_path !== '',
migotoSet: config.migoto_path !== '',
unElevated: config.un_elevated || false,
})
}
@ -188,7 +192,14 @@ export default class ServerLaunchSection extends React.Component<IProps, IState>
path: exe || config.game_install_path,
})
if (gameExists) await invoke('run_program_relative', { path: exe || config.game_install_path })
if (gameExists)
if (config.un_elevated) {
await invoke('run_un_elevated', {
path: config.game_install_path,
})
} else {
await invoke('run_program_relative', { path: exe || config.game_install_path })
}
else alert('Game not found! At: ' + (exe || config.game_install_path))
}

View File

@ -41,6 +41,7 @@ interface IState {
auto_mongodb: boolean
swag: boolean
platform: string
un_elevated: boolean
// Swag stuff
akebi_path: string
@ -70,6 +71,7 @@ export default class Options extends React.Component<IProps, IState> {
swag: false,
auto_mongodb: false,
platform: '',
un_elevated: false,
// Swag stuff
akebi_path: '',
@ -87,6 +89,7 @@ export default class Options extends React.Component<IProps, IState> {
this.toggleEncryption = this.toggleEncryption.bind(this)
this.removeRSA = this.removeRSA.bind(this)
this.addMigotoDelay = this.addMigotoDelay.bind(this)
this.toggleUnElevatedGame = this.toggleUnElevatedGame.bind(this)
}
async componentDidMount() {
@ -119,6 +122,7 @@ export default class Options extends React.Component<IProps, IState> {
swag: config.swag_mode || false,
auto_mongodb: config.auto_mongodb || false,
platform,
un_elevated: config.un_elevated || false,
// Swag stuff
akebi_path: config.akebi_path || '',
@ -274,6 +278,15 @@ export default class Options extends React.Component<IProps, IState> {
}
}
async toggleUnElevatedGame() {
const changedVal = !(await getConfigOption('un_elevated'))
setConfigOption('un_elevated', changedVal)
this.setState({
un_elevated: changedVal,
})
}
async removeRSA() {
await meta.unpatchGame()
}
@ -455,6 +468,18 @@ export default class Options extends React.Component<IProps, IState> {
/>
</div>
</div>
<div className="OptionSection" id="menuOptionsContainerUEGame">
<div className="OptionLabel" id="menuOptionsLabelUEGame">
<Tr text="options.un_elevated" />
</div>
<div className="OptionValue" id="menuOptionsCheckboxUEGame">
<Checkbox
onChange={() => this.toggleOption('un_elevated')}
checked={this.state?.un_elevated}
id="unElevatedGame"
/>
</div>
</div>
{this.state.swag ? (
<div className="OptionSection" id="menuOptionsContainerHorny">
<div className="OptionLabel" id="menuOptionsLabelHorny">

View File

@ -25,6 +25,7 @@ let defaultConfig: Configuration
wipe_login: false,
horny_mode: false,
auto_mongodb: false,
un_elevated: false,
}
})()
@ -53,6 +54,7 @@ export interface Configuration {
horny_mode: boolean
swag_mode?: boolean
auto_mongodb: boolean
un_elevated: boolean
// Swag stuff
akebi_path?: string