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

View File

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

View File

@@ -28,7 +28,8 @@
"use_proxy": "Gebruik interne proxy", "use_proxy": "Gebruik interne proxy",
"wipe_login": "Wis de inlogcache", "wipe_login": "Wis de inlogcache",
"horny_mode": "Geile modus", "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": { "downloads": {
"grasscutter_fullbuild": "Alles in Einem Grasscutter Daten herunterladen", "grasscutter_fullbuild": "Alles in Einem Grasscutter Daten herunterladen",

View File

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

View File

@@ -29,7 +29,8 @@
"use_proxy": "Usar proxy interno", "use_proxy": "Usar proxy interno",
"wipe_login": "Borrar caché de inicio de sesión", "wipe_login": "Borrar caché de inicio de sesión",
"horny_mode": "Modo cachondo", "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": { "downloads": {
"grasscutter_fullbuild": "Descargar Datos todo en uno de Grasscutter", "grasscutter_fullbuild": "Descargar Datos todo en uno de Grasscutter",

View File

@@ -29,7 +29,8 @@
"use_proxy": "Utiliser un proxy interne", "use_proxy": "Utiliser un proxy interne",
"wipe_login": "Effacer le cache de connexion", "wipe_login": "Effacer le cache de connexion",
"horny_mode": "Mode excitation", "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": { "downloads": {
"grasscutter_fullbuild": "Telecharger Grasscutter tout-en-un", "grasscutter_fullbuild": "Telecharger Grasscutter tout-en-un",

View File

@@ -28,7 +28,8 @@
"use_proxy": "Gunakan Proxy Internal", "use_proxy": "Gunakan Proxy Internal",
"wipe_login": "Menghapus Cache Login", "wipe_login": "Menghapus Cache Login",
"horny_mode": "Mode Terangsang", "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": { "downloads": {
"grasscutter_fullbuild": "Sedang Mendownload Grasscutter Semua Dalam Satu", "grasscutter_fullbuild": "Sedang Mendownload Grasscutter Semua Dalam Satu",

View File

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

View File

@@ -27,7 +27,8 @@
"use_proxy": "Izmantot iekšējo starpniekserveri", "use_proxy": "Izmantot iekšējo starpniekserveri",
"wipe_login": "Noslaucīt pieteikšanās kešatmiņu", "wipe_login": "Noslaucīt pieteikšanās kešatmiņu",
"horny_mode": "Uzbudināts režīms", "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": { "downloads": {
"grasscutter_fullbuild": "Lejupielādējiet Grasscutter viss vienā", "grasscutter_fullbuild": "Lejupielādējiet Grasscutter viss vienā",

View File

@@ -28,7 +28,8 @@
"use_proxy": "Gebruik Interne Proxy", "use_proxy": "Gebruik Interne Proxy",
"wipe_login": "Login cache wissen", "wipe_login": "Login cache wissen",
"horny_mode": "Geile modus", "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": { "downloads": {
"grasscutter_fullbuild": "Grasscutter Alles-in-één Downloaden", "grasscutter_fullbuild": "Grasscutter Alles-in-één Downloaden",

View File

@@ -29,7 +29,8 @@
"use_proxy": "Usar Proxy Interno", "use_proxy": "Usar Proxy Interno",
"wipe_login": "Limpar Cache de Login", "wipe_login": "Limpar Cache de Login",
"horny_mode": "Modo com tesão", "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": { "downloads": {
"grasscutter_fullbuild": "Baixar o Grasscutter Tudo-em-Um", "grasscutter_fullbuild": "Baixar o Grasscutter Tudo-em-Um",

View File

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

View File

@@ -29,7 +29,8 @@
"use_proxy": "Sử dụng proxy nội bộ", "use_proxy": "Sử dụng proxy nội bộ",
"wipe_login": "Tẩy sạch cache đăng nhập", "wipe_login": "Tẩy sạch cache đăng nhập",
"horny_mode": "Chế độ hứng tình", "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": { "downloads": {
"grasscutter_fullbuild": "Tải Grasscutter tất cả trong một", "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::set_migoto_delay,
system_helpers::wipe_registry, system_helpers::wipe_registry,
system_helpers::get_platform, system_helpers::get_platform,
system_helpers::run_un_elevated,
proxy::set_proxy_addr, proxy::set_proxy_addr,
proxy::generate_ca_files, proxy::generate_ca_files,
unzip::unzip, 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] #[tauri::command]
pub fn open_in_browser(url: String) { pub fn open_in_browser(url: String) {
// Open the URL in the default browser. // Open the URL in the default browser.

View File

@@ -39,6 +39,8 @@ interface IState {
swag: boolean swag: boolean
akebiSet: boolean akebiSet: boolean
migotoSet: boolean migotoSet: boolean
unElevated: boolean
} }
export default class ServerLaunchSection extends React.Component<IProps, IState> { export default class ServerLaunchSection extends React.Component<IProps, IState> {
@@ -62,6 +64,7 @@ export default class ServerLaunchSection extends React.Component<IProps, IState>
swag: false, swag: false,
akebiSet: false, akebiSet: false,
migotoSet: false, migotoSet: false,
unElevated: false,
} }
this.toggleGrasscutter = this.toggleGrasscutter.bind(this) this.toggleGrasscutter = this.toggleGrasscutter.bind(this)
@@ -93,6 +96,7 @@ export default class ServerLaunchSection extends React.Component<IProps, IState>
swag: config.swag_mode || false, swag: config.swag_mode || false,
akebiSet: config.akebi_path !== '', akebiSet: config.akebi_path !== '',
migotoSet: config.migoto_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, 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)) else alert('Game not found! At: ' + (exe || config.game_install_path))
} }

View File

@@ -41,6 +41,7 @@ interface IState {
auto_mongodb: boolean auto_mongodb: boolean
swag: boolean swag: boolean
platform: string platform: string
un_elevated: boolean
// Swag stuff // Swag stuff
akebi_path: string akebi_path: string
@@ -70,6 +71,7 @@ export default class Options extends React.Component<IProps, IState> {
swag: false, swag: false,
auto_mongodb: false, auto_mongodb: false,
platform: '', platform: '',
un_elevated: false,
// Swag stuff // Swag stuff
akebi_path: '', akebi_path: '',
@@ -87,6 +89,7 @@ export default class Options extends React.Component<IProps, IState> {
this.toggleEncryption = this.toggleEncryption.bind(this) this.toggleEncryption = this.toggleEncryption.bind(this)
this.removeRSA = this.removeRSA.bind(this) this.removeRSA = this.removeRSA.bind(this)
this.addMigotoDelay = this.addMigotoDelay.bind(this) this.addMigotoDelay = this.addMigotoDelay.bind(this)
this.toggleUnElevatedGame = this.toggleUnElevatedGame.bind(this)
} }
async componentDidMount() { async componentDidMount() {
@@ -119,6 +122,7 @@ export default class Options extends React.Component<IProps, IState> {
swag: config.swag_mode || false, swag: config.swag_mode || false,
auto_mongodb: config.auto_mongodb || false, auto_mongodb: config.auto_mongodb || false,
platform, platform,
un_elevated: config.un_elevated || false,
// Swag stuff // Swag stuff
akebi_path: config.akebi_path || '', 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() { async removeRSA() {
await meta.unpatchGame() await meta.unpatchGame()
} }
@@ -455,6 +468,18 @@ export default class Options extends React.Component<IProps, IState> {
/> />
</div> </div>
</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 ? ( {this.state.swag ? (
<div className="OptionSection" id="menuOptionsContainerHorny"> <div className="OptionSection" id="menuOptionsContainerHorny">
<div className="OptionLabel" id="menuOptionsLabelHorny"> <div className="OptionLabel" id="menuOptionsLabelHorny">

View File

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