mirror of
https://github.com/artegoser/pimi-launcher-core.git
synced 2025-02-23 20:51:30 +03:00
Small changes, non breaking this time
Removed getPid in favor of returning the child process instead. Added OS detection as well!
This commit is contained in:
parent
62d02dccba
commit
e5e1d68883
4 changed files with 24 additions and 22 deletions
|
@ -171,7 +171,7 @@ class Handler {
|
|||
|
||||
await Promise.all(this.version.libraries.map(async (lib) => {
|
||||
if (!lib.downloads.classifiers) return;
|
||||
const type = `natives-${this.options.os}`;
|
||||
const type = `natives-${this.getOS()}`;
|
||||
const native = lib.downloads.classifiers[type];
|
||||
|
||||
if (native) {
|
||||
|
@ -354,15 +354,24 @@ class Handler {
|
|||
}
|
||||
|
||||
async getJVM() {
|
||||
switch(this.options.os) {
|
||||
case "windows": {
|
||||
return "-XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump"
|
||||
}
|
||||
case "osx": {
|
||||
return "-XstartOnFirstThread"
|
||||
}
|
||||
case "linux": {
|
||||
return "-Xss1M"
|
||||
const opts = {
|
||||
"windows": "-XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump",
|
||||
"osx": "-XstartOnFirstThread",
|
||||
"linux": "-Xss1M"
|
||||
};
|
||||
return opts[this.getOS()]
|
||||
}
|
||||
|
||||
getOS() {
|
||||
if(this.options.os) {
|
||||
return this.options.os;
|
||||
} else {
|
||||
switch(process.platform) {
|
||||
case "win32": return "windows";
|
||||
case "darwin": return "osx";
|
||||
case "freebsd": return "linux";
|
||||
case "sunos": return "linux";
|
||||
default: throw Error("[MCLC Error] Couldn't set OS specific JVM argument!")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,8 +8,6 @@ const EventEmitter = require('events').EventEmitter;
|
|||
class MCLCore extends EventEmitter {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.pid = null;
|
||||
}
|
||||
|
||||
async launch(options) {
|
||||
|
@ -69,7 +67,7 @@ class MCLCore extends EventEmitter {
|
|||
|
||||
const classes = await this.handler.getClasses();
|
||||
let classPaths = ['-cp'];
|
||||
const separator = this.options.os === "windows" ? ";" : ":";
|
||||
const separator = this.handler.getOS() === "windows" ? ";" : ":";
|
||||
this.emit('debug', `[MCLC]: Using ${separator} to separate class paths`);
|
||||
if(forge) {
|
||||
this.emit('debug', '[MCLC]: Setting Forge class paths');
|
||||
|
@ -99,11 +97,7 @@ class MCLCore extends EventEmitter {
|
|||
minecraft.stderr.on('data', (data) => this.emit('error', data));
|
||||
minecraft.on('close', (code) => this.emit('close', code));
|
||||
|
||||
this.pid = minecraft.pid;
|
||||
}
|
||||
|
||||
getPid() {
|
||||
return this.pid;
|
||||
return minecraft;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue