Skip to content

Commit

Permalink
Launch arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
heipiao233 committed Aug 8, 2023
1 parent ea46fd9 commit dc6aa37
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 12 deletions.
11 changes: 10 additions & 1 deletion locales/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,16 @@
"version": {
"loader_not_found": "Loader not found: ",
"version_not_found": "Version not found: ",
"install_datapack": "Automatic installation of datapacks is not supported!"
"install_datapack": "Automatic installation of datapacks is not supported!",
"progress": {
"run": "Launching game...",
"account_login": "Logging in...",
"account_prepare": "Preparing account...",
"complete": "Completing files...",
"extract_native": "Extracting native files...",
"argument": "Generating launching arguments...",
"done": "Done!"
}
},

"loaders": {
Expand Down
2 changes: 1 addition & 1 deletion locales/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.1.0-beta.1
4.1.0-beta.2
1 change: 1 addition & 0 deletions locales/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"install_datapack": "不支持自动安装数据包!",
"progress": {
"run": "启动游戏中...",
"account_login": "登录账户中...",
"account_prepare": "准备账户中...",
"complete": "补齐文件中...",
"extract_native": "解压动态链接库中...",
Expand Down
11 changes: 10 additions & 1 deletion locales/zh_tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,16 @@
"version": {
"loader_not_found": "找不到加載器:",
"version_not_found": "找不到版本:",
"install_datapack": "不支持自動安裝數據包!"
"install_datapack": "不支持自動安裝數據包!",
"progress": {
"run": "啓動遊戲中...",
"account_login": "登錄賬戶中...",
"account_prepare": "準備賬戶中...",
"complete": "補齊文件中...",
"extract_native": "解壓動態鏈接庫中...",
"argument": "生成運行參數中...",
"done": "完成!"
}
},

"loaders": {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dmclc",
"version": "4.1.0-beta.1",
"version": "4.1.0-beta.2",
"description": "Dolphin Minecraft Launcher Core",
"typings": "./lib/index.d.ts",
"module": "./lib/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class Launcher {
specialNatives: Record<string, Library>;
};
private realRootPath = "";
static readonly version = "4.1.0-beta.1";
static readonly version = "4.1.0-beta.2";
/**
* Create a new Launcher object.
* @throws {@link FormattedError}
Expand Down
21 changes: 16 additions & 5 deletions src/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export interface DMCLCExtraVersionInfo {
version: string;
loaders: LoaderInfo[];
enableIndependentGameDir: boolean;
beforeCommand?: string;
usingJava?: string;
moreGameArguments?: string[];
moreJavaArguments?: string[];
}

/**
Expand Down Expand Up @@ -130,20 +134,27 @@ export class MinecraftVersion {
* @returns The Minecraft process. Both stdout and stderr uses UTF-8.
*/
async run(account: Account<never>): Promise<ChildProcess> {
const progress = this.launcher.createProgress(4, "version.progress.run", "version.progress.account_prepare");
const progress = this.launcher.createProgress(5, "version.progress.run", "version.progress.account_login");
try {
if (!account.check()) {
account.login();
}
progress.update("version.progress.account_prepare");
await account.prepareLaunch(this.versionLaunchWorkDir);
progress.update("version.progress.complete");
await this.completeVersionInstall();
progress.update("version.progress.extract_native");
await this.extractNative(this.versionObject, this.name);
progress.update("version.progress.argument");
const args = await this.getArguments(this.versionObject, account);
const allArguments = ["-Dsun.stdout.encoding=utf-8", "-Dsun.stderr.encoding=utf-8"].concat(await account.getLaunchJVMArgs(this)).concat(args).concat();
const allArguments = ["-Dsun.stdout.encoding=utf-8", "-Dsun.stderr.encoding=utf-8"]
.concat(await account.getLaunchJVMArgs(this))
.concat(this.extras.moreJavaArguments ?? [])
.concat(args)
.concat(this.extras.moreGameArguments ?? []);
progress.update("version.progress.done");
return cp.execFile(this.launcher.usingJava, allArguments, {
cwd: this.versionLaunchWorkDir,
encoding: "utf-8"
return cp.execFile(this.extras.usingJava ?? this.launcher.usingJava, allArguments, {
cwd: this.versionLaunchWorkDir
});
} finally {
progress.close();
Expand Down

0 comments on commit dc6aa37

Please sign in to comment.