mirror of
https://github.com/dscalzi/HeliosLauncher.git
synced 2024-12-22 11:42:14 -08:00
Added more dynamic values for game launch, hotfix for electron installation bug.
This commit is contained in:
parent
d4caf1ad22
commit
c41f74f478
@ -8,13 +8,14 @@ const unzip = require('unzip')
|
|||||||
const mkpath = require('mkdirp');
|
const mkpath = require('mkdirp');
|
||||||
|
|
||||||
exports.launchMinecraft = function(versionData, basePath){
|
exports.launchMinecraft = function(versionData, basePath){
|
||||||
const authPromise = mojang.auth('EMAIL', 'PASS', uuidV4(), {
|
const authPromise = mojang.auth('nytrocraft@live.com', 'applesrgood123', uuidV4(), {
|
||||||
name: 'Minecraft',
|
name: 'Minecraft',
|
||||||
version: 1
|
version: 1
|
||||||
})
|
})
|
||||||
authPromise.then(function(data){
|
authPromise.then(function(data){
|
||||||
const hardcodedargs = ''
|
const hardcodedargs = ''
|
||||||
const args = finalizeArguments(versionData, data, basePath)
|
const args = finalizeArguments(versionData, data, basePath)
|
||||||
|
//console.log(data)
|
||||||
//console.log(args)
|
//console.log(args)
|
||||||
//TODO make this dynamic
|
//TODO make this dynamic
|
||||||
const child = child_process.spawn('C:\\Program Files\\Java\\jre1.8.0_131\\bin\\javaw.exe', args)
|
const child = child_process.spawn('C:\\Program Files\\Java\\jre1.8.0_131\\bin\\javaw.exe', args)
|
||||||
@ -23,6 +24,8 @@ exports.launchMinecraft = function(versionData, basePath){
|
|||||||
|
|
||||||
finalizeArguments = function(versionData, authData, basePath){
|
finalizeArguments = function(versionData, authData, basePath){
|
||||||
const mcArgs = versionData['minecraftArguments']
|
const mcArgs = versionData['minecraftArguments']
|
||||||
|
console.log(authData)
|
||||||
|
const gameProfile = authData['selectedProfile']
|
||||||
const regex = new RegExp('\\${*(.*)}')
|
const regex = new RegExp('\\${*(.*)}')
|
||||||
const argArr = mcArgs.split(' ')
|
const argArr = mcArgs.split(' ')
|
||||||
argArr.unshift('net.minecraft.client.main.Main')
|
argArr.unshift('net.minecraft.client.main.Main')
|
||||||
@ -37,12 +40,10 @@ finalizeArguments = function(versionData, authData, basePath){
|
|||||||
for(let i=0; i<argArr.length; i++){
|
for(let i=0; i<argArr.length; i++){
|
||||||
if(regex.test(argArr[i])){
|
if(regex.test(argArr[i])){
|
||||||
const identifier = argArr[i].match(regex)[1]
|
const identifier = argArr[i].match(regex)[1]
|
||||||
//console.log(argArr[i].match(regex)[1])
|
|
||||||
let newVal = argArr[i]
|
let newVal = argArr[i]
|
||||||
switch(identifier){
|
switch(identifier){
|
||||||
case 'auth_player_name':
|
case 'auth_player_name':
|
||||||
//TODO make this DYNAMIC
|
newVal = gameProfile['name']
|
||||||
newVal = 'iPepsiHD'
|
|
||||||
break
|
break
|
||||||
case 'version_name':
|
case 'version_name':
|
||||||
newVal = versionData['id']
|
newVal = versionData['id']
|
||||||
@ -57,14 +58,12 @@ finalizeArguments = function(versionData, authData, basePath){
|
|||||||
newVal = versionData['assets']
|
newVal = versionData['assets']
|
||||||
break
|
break
|
||||||
case 'auth_uuid':
|
case 'auth_uuid':
|
||||||
//TODO make this DYNAMIC
|
newVal = gameProfile['id']
|
||||||
newVal = '48f0a3d02ae14ca4aa0011bb8bc4f39e'
|
|
||||||
break
|
break
|
||||||
case 'auth_access_token':
|
case 'auth_access_token':
|
||||||
newVal = authData['accessToken']
|
newVal = authData['accessToken']
|
||||||
break
|
break
|
||||||
case 'user_type':
|
case 'user_type':
|
||||||
//TODO make this DYNAMIC
|
|
||||||
newVal = 'MOJANG'
|
newVal = 'MOJANG'
|
||||||
break
|
break
|
||||||
case 'version_type':
|
case 'version_type':
|
||||||
@ -82,8 +81,8 @@ classpathArg = function(versionData, basePath){
|
|||||||
const libArr = versionData['libraries']
|
const libArr = versionData['libraries']
|
||||||
const libPath = path.join(basePath, 'libraries')
|
const libPath = path.join(basePath, 'libraries')
|
||||||
const nativePath = path.join(basePath, 'natives')
|
const nativePath = path.join(basePath, 'natives')
|
||||||
//TODO make this dynamic
|
const version = versionData['id']
|
||||||
const cpArgs = ['C:\\Users\\Asus\\Desktop\\LauncherElectron\\mcfiles\\versions\\1.11.2\\1.11.2.jar']
|
const cpArgs = [path.join(basePath, 'versions', version, version + '.jar')]
|
||||||
libArr.forEach(function(lib){
|
libArr.forEach(function(lib){
|
||||||
if(library.validateRules(lib['rules'])){
|
if(library.validateRules(lib['rules'])){
|
||||||
if(lib['natives'] == null){
|
if(lib['natives'] == null){
|
||||||
|
@ -19,7 +19,8 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"async": "^2.3.0",
|
"async": "^2.3.0",
|
||||||
"electron": "^1.6.5",
|
"electron": "^1.6.5",
|
||||||
"mojang": "^0.4.0",
|
"extract-zip": "=1.6.0",
|
||||||
|
"mojang": "^0.4.1",
|
||||||
"promise": "^7.1.1",
|
"promise": "^7.1.1",
|
||||||
"unzip": "^0.1.11",
|
"unzip": "^0.1.11",
|
||||||
"uuid": "^3.0.1"
|
"uuid": "^3.0.1"
|
||||||
|
Loading…
Reference in New Issue
Block a user