From dcad3cdb86a363793a99c3720d86d252b005ed99 Mon Sep 17 00:00:00 2001
From: LinuxMint4Ever <>
Date: Sun, 6 Oct 2019 19:05:47 +0200
Subject: [PATCH] Starting all over again.
---
.gitignore | 2 -
devtools/rmpyc | 4 +
earlyLauncher/config.txt | 9 -
earlyLauncher/earlylauncher.py | 140 -----------
main.ui | 444 ---------------------------------
ui.py | 172 -------------
6 files changed, 4 insertions(+), 767 deletions(-)
create mode 100644 devtools/rmpyc
delete mode 100644 earlyLauncher/config.txt
delete mode 100644 earlyLauncher/earlylauncher.py
delete mode 100644 main.ui
delete mode 100644 ui.py
diff --git a/.gitignore b/.gitignore
index ad317f6..8fab217 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,4 @@ res/objects/
res/skins/
res/log_configs/
lib/*
-earlyLauncher/offline.txt
-earlyLauncher/logs/
**/*.pyc
diff --git a/devtools/rmpyc b/devtools/rmpyc
new file mode 100644
index 0000000..e189bd8
--- /dev/null
+++ b/devtools/rmpyc
@@ -0,0 +1,4 @@
+#!/bin/bash
+shopt -s globstar
+rm -v ./**/*.pyc
+
diff --git a/earlyLauncher/config.txt b/earlyLauncher/config.txt
deleted file mode 100644
index 85589c7..0000000
--- a/earlyLauncher/config.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-ram=8
-#The multipiler for RAM amount (nothing, k, M or G)
-alignTo=G
-#Files
-assets=../res/
-gameDir=../run/
-libs=../lib/
-java_executable=/usr/lib/jvm/java-8-openjdk-amd64/bin/java
-
diff --git a/earlyLauncher/earlylauncher.py b/earlyLauncher/earlylauncher.py
deleted file mode 100644
index eaf377f..0000000
--- a/earlyLauncher/earlylauncher.py
+++ /dev/null
@@ -1,140 +0,0 @@
-#!/usr/bin/python2
-
-#why does the bang not work?
-import urllib2, json, os, sys
-print "LinuxMint4Ever's EarlyLauncher version BETA 2.6"
-
-#globally used variables
-config = []
-offlineData = []
-main = (__name__ == "__main__")
-
-#When run directly, make sure that we are in the correct directory.
-if main:
- if os.path.isfile(os.path.join(os.getcwd(), "earlylauncher.py")):
- pass
- else:
- print "Error: Not running from the EarlyLauncher Directory"
- sys.exit(1)
-
-def readFile(fileName):
- fileReader = open(fileName, "r")
- fileContents = fileReader.read()
- fileReader.close()
- return fileContents
-
-def loadConfig(configFile = "config.txt"):
- global config
- #read the config file and if run directly, do error handling as well
- if main:
- try:
- configRaw=readFile(configFile).split("\n")
- except:
- print "Error: Could not read config file."
- sys.exit(1)
- else:
- configRaw=readFile(configFile).split("\n")
- #TODO: Raise an exception in case of an error
- #put config options and values in a two dimensional list
- for i in range(len(configRaw)):
- #ignore empty lines and comments
- if configRaw[i] == "":
- pass
- elif configRaw[i][0] == '#':
- pass
- else:
- config = config + [configRaw[i].split("=")]
-
-def loadOfflineData(offlineDataFile = "offline.txt"):
- global offlineData
- #read the config file and if run directly, do error handling as well
- if main:
- try:
- dataRaw=readFile(offlineDataFile).split("\n")
- except:
- print "Error: Could not read offline data file."
- sys.exit(1)
- else:
- #TODO: Raise an exception in case of an error
- dataRaw=readFile(offlineDataFile).split("\n")
- #put config options and values in a two dimensional list
- for i in range(len(dataRaw)):
- #ignore empty lines and comments
- if dataRaw[i] == "":
- pass
- elif dataRaw[i][0] == '#':
- pass
- else:
- offlineData = offlineData + [dataRaw[i].split("=")]
-
-def getDataOff2DArray(key, array):
- for i in range(len(array)):
- if array[i][0]==key:
- return array[i][1]
-
-def getToken(username, password):
- data = {
- "agent": {
- "name": "Minecraft",
- "version": 1
- },
- "username": username,
- "password": password
- }
- try:
- request = urllib2.Request(url='https://authserver.mojang.com/authenticate', data=json.dumps(data).encode(), headers={"Content-Type": "application/json"})
- answer = json.loads(urllib2.urlopen(request).read().decode())
- except urllib2.HTTPError:
- if main:
- print "Invalid user information! (or something went wrong)"
- sys.exit(1)
- else:
- #TODO: raise an exception
- return False, False, False
- except urllib2.URLError:
- if main:
- print "Authentication server not reachable. Re-launching last user session."
- loadOfflineData()
- return getDataOff2DArray("access_token", offlineData), getDataOff2DArray("profile_id", offlineData), getDataOff2DArray("username", offlineData)
- else:
- #TODO: raise an exception
- return False, False, False
-
- username = answer['selectedProfile']['name']
- access_token = answer['accessToken']
- profile_id = answer['selectedProfile']['id']
-
-
- return access_token, profile_id, username
-
-def deRelative(cwd, path):
- return os.path.join(cwd, path)
-
-def run(java_executable, ram, alignTo, libs, username, gameDir, assets, uuid, accessToken, width=1366, height=768):
- cwd = os.getcwd()
- os.chdir(gameDir)
- exitCode = os.system(deRelative(cwd, java_executable)+" -Xmx"+ram+alignTo+" -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M -Djava.library.path="+os.path.join(deRelative(cwd, libs), "natives")+" -cp "+os.path.join(deRelative(cwd, libs),"jar")+os.sep+(":"+os.path.join(deRelative(cwd,libs),"jar")+os.sep).join(os.listdir(os.path.join(deRelative(cwd, libs),"jar")))+" net.minecraft.launchwrapper.Launch --username "+username+" --version 1.7.10-Forge10.13.4.1614-1.7.10 --gameDir "+deRelative(cwd,gameDir)+" --assetsDir "+deRelative(cwd, assets)+" --assetIndex 1.7.10 --uuid "+str(uuid)+" --accessToken "+accessToken+" --userProperties {} --userType mojang --width "+str(width)+" --height "+str(height)+" --tweakClass cpw.mods.fml.common.launcher.FMLTweaker")
- os.chdir(cwd)
- return exitCode
-
-if main:
- loadConfig()
- ram = getDataOff2DArray("ram", config)
- alignTo = getDataOff2DArray("alignTo", config)
- assets = getDataOff2DArray("assets", config)
- gameDir = getDataOff2DArray("gameDir", config)
- libs = getDataOff2DArray("libs", config)
- java_executable = getDataOff2DArray("java_executable", config)
- #TODO: allow the use of sys.argv to override config
-
- login=raw_input("eMail or username: ")
- pw=raw_input("Password: ")
- accessToken, uuid, username = getToken(str(login), str(pw))
- try:
- offlineDataFile = open("offline.txt", "w")
- offlineDataFile.write("username="+username+"\naccess_token="+accessToken+"\nprofile_id="+uuid)
- offlineDataFile.close()
- except:
- print "Error creating offline login data. Proceeding with launch anyways."
- sys.exit(run(java_executable, ram, alignTo, libs, username, gameDir, assets, uuid, accessToken))
-
diff --git a/main.ui b/main.ui
deleted file mode 100644
index 5484145..0000000
--- a/main.ui
+++ /dev/null
@@ -1,444 +0,0 @@
-
-
- Launcher
-
-
-
- 0
- 0
- 401
- 302
-
-
-
-
- 0
- 0
-
-
-
-
- 401
- 302
-
-
-
-
- 401
- 302
-
-
-
- Jan’s Minecraft Mod Pack Launcher
-
-
-
-
- 0
- 0
- 401
- 251
-
-
-
- QTabWidget::Rounded
-
-
- 3
-
-
-
- News && Updates
-
-
-
-
- 0
- 0
- 401
- 221
-
-
-
-
- about:blank
-
-
-
-
-
-
- Mod Infos && Credits
-
-
-
-
- -1
- -1
- 401
- 221
-
-
-
-
- about:blank
-
-
-
-
-
-
- Server Info
-
-
-
-
- -1
- 0
- 401
- 221
-
-
-
-
- about:blank
-
-
-
-
-
-
- Preferences
-
-
-
-
- 10
- 0
- 381
- 101
-
-
-
- Login Information
-
-
-
-
- 0
- 20
- 381
- 29
-
-
-
- <previously entered>
-
-
- e-Mail or username
-
-
-
-
-
- 0
- 50
- 381
- 29
-
-
-
- You fool!
-
-
- QLineEdit::Password
-
-
- false
-
-
- Password
-
-
-
-
-
- 0
- 80
- 71
- 21
-
-
-
- Save!
-
-
-
-
-
- 70
- 80
- 71
- 21
-
-
-
- Logout :(
-
-
-
-
-
-
- 10
- 110
- 381
- 71
-
-
-
- Performance Settings
-
-
-
-
- 0
- 20
- 111
- 25
-
-
- -
-
- <Type of CPU>
-
-
- -
-
- Daddy's old laptop
-
-
- -
-
- Modern Laptop
-
-
- -
-
- Generic Single Core
-
-
- -
-
- Modern Single Core (Seriously!? Why?)
-
-
- -
-
- Generic Dual Core
-
-
- -
-
- Modern Dual Core or Threaded
-
-
- -
-
- Generic Multi Core
-
-
- -
-
- Modern Multi Core
-
-
- -
-
- Extremely too many cores
-
-
- -
-
- NO LIMITS!
-
-
-
-
-
-
- 110
- 20
- 111
- 25
-
-
- -
-
- <Type of GPU>
-
-
- -
-
- Daddy's old laptop
-
-
- -
-
- Generic laptop dedicated
-
-
- -
-
- Modern laptop integrated
-
-
- -
-
- Modern Laptop dedicated
-
-
- -
-
- Generic Integrated (or low-power office PC graphics card)
-
-
- -
-
- Modern Integrated (or modern office PC ... 1030? I am looking at you.)
-
-
- -
-
- Generic Dedicated
-
-
- -
-
- Modern Dedicated
-
-
- -
-
- GAMING!!!
-
-
- -
-
- When will RayTracing be available?
-
-
-
-
-
-
- 220
- 20
- 111
- 25
-
-
- -
-
- <Ram available>
-
-
-
-
-
-
- 0
- 50
- 71
- 21
-
-
-
- Save!
-
-
-
-
-
- 70
- 50
- 101
- 21
-
-
-
- Try auto-detect
-
-
-
-
-
-
-
-
- 310
- 260
- 81
- 16
-
-
-
- Server: Offline
-
-
-
-
-
- 300
- 280
- 101
- 21
-
-
-
- Request Startup
-
-
- false
-
-
-
-
-
- 0
- 250
- 101
- 51
-
-
-
- 24
-
-
- Updating...
-
-
-
-
-
- 100
- 250
- 201
- 51
-
-
-
- PLAY! :)
-
-
-
-
-
- QWebView
- QWidget
-
-
-
-
-
-
diff --git a/ui.py b/ui.py
deleted file mode 100644
index 45ec43c..0000000
--- a/ui.py
+++ /dev/null
@@ -1,172 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Form implementation generated from reading ui file 'main.ui'
-#
-# Created by: PyQt5 UI code generator 5.10.1
-#
-# WARNING! All changes made in this file will be lost!
-
-from PyQt5 import QtCore, QtGui, QtWidgets
-
-class Ui_Launcher(object):
- def setupUi(self, Launcher):
- Launcher.setObjectName("Launcher")
- Launcher.resize(401, 302)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(Launcher.sizePolicy().hasHeightForWidth())
- Launcher.setSizePolicy(sizePolicy)
- Launcher.setMinimumSize(QtCore.QSize(401, 302))
- Launcher.setMaximumSize(QtCore.QSize(401, 302))
- self.tabWidget = QtWidgets.QTabWidget(Launcher)
- self.tabWidget.setGeometry(QtCore.QRect(0, 0, 401, 251))
- self.tabWidget.setTabShape(QtWidgets.QTabWidget.Rounded)
- self.tabWidget.setObjectName("tabWidget")
- self.tabUpdates = QtWidgets.QWidget()
- self.tabUpdates.setObjectName("tabUpdates")
- self.webUpdates = QtWebKitWidgets.QWebView(self.tabUpdates)
- self.webUpdates.setGeometry(QtCore.QRect(0, 0, 401, 221))
- self.webUpdates.setUrl(QtCore.QUrl("about:blank"))
- self.webUpdates.setObjectName("webUpdates")
- self.tabWidget.addTab(self.tabUpdates, "")
- self.tabMods = QtWidgets.QWidget()
- self.tabMods.setObjectName("tabMods")
- self.webMods = QtWebKitWidgets.QWebView(self.tabMods)
- self.webMods.setGeometry(QtCore.QRect(-1, -1, 401, 221))
- self.webMods.setUrl(QtCore.QUrl("about:blank"))
- self.webMods.setObjectName("webMods")
- self.tabWidget.addTab(self.tabMods, "")
- self.tabServer = QtWidgets.QWidget()
- self.tabServer.setObjectName("tabServer")
- self.webServerInfo = QtWebKitWidgets.QWebView(self.tabServer)
- self.webServerInfo.setGeometry(QtCore.QRect(-1, 0, 401, 221))
- self.webServerInfo.setUrl(QtCore.QUrl("about:blank"))
- self.webServerInfo.setObjectName("webServerInfo")
- self.tabWidget.addTab(self.tabServer, "")
- self.tabPreferences = QtWidgets.QWidget()
- self.tabPreferences.setObjectName("tabPreferences")
- self.groupLogin = QtWidgets.QGroupBox(self.tabPreferences)
- self.groupLogin.setGeometry(QtCore.QRect(10, 0, 381, 101))
- self.groupLogin.setObjectName("groupLogin")
- self.lineUsername = QtWidgets.QLineEdit(self.groupLogin)
- self.lineUsername.setGeometry(QtCore.QRect(0, 20, 381, 29))
- self.lineUsername.setObjectName("lineUsername")
- self.linePassword = QtWidgets.QLineEdit(self.groupLogin)
- self.linePassword.setGeometry(QtCore.QRect(0, 50, 381, 29))
- self.linePassword.setEchoMode(QtWidgets.QLineEdit.Password)
- self.linePassword.setReadOnly(False)
- self.linePassword.setObjectName("linePassword")
- self.buttonSaveUser = QtWidgets.QPushButton(self.groupLogin)
- self.buttonSaveUser.setGeometry(QtCore.QRect(0, 80, 71, 21))
- self.buttonSaveUser.setObjectName("buttonSaveUser")
- self.buttonLogout = QtWidgets.QPushButton(self.groupLogin)
- self.buttonLogout.setGeometry(QtCore.QRect(70, 80, 71, 21))
- self.buttonLogout.setObjectName("buttonLogout")
- self.groupPerformance = QtWidgets.QGroupBox(self.tabPreferences)
- self.groupPerformance.setGeometry(QtCore.QRect(10, 110, 381, 71))
- self.groupPerformance.setObjectName("groupPerformance")
- self.dropdownCPU = QtWidgets.QComboBox(self.groupPerformance)
- self.dropdownCPU.setGeometry(QtCore.QRect(0, 20, 111, 25))
- self.dropdownCPU.setObjectName("dropdownCPU")
- self.dropdownCPU.addItem("")
- self.dropdownCPU.addItem("")
- self.dropdownCPU.addItem("")
- self.dropdownCPU.addItem("")
- self.dropdownCPU.addItem("")
- self.dropdownCPU.addItem("")
- self.dropdownCPU.addItem("")
- self.dropdownCPU.addItem("")
- self.dropdownCPU.addItem("")
- self.dropdownCPU.addItem("")
- self.dropdownCPU.addItem("")
- self.dropdownGPU = QtWidgets.QComboBox(self.groupPerformance)
- self.dropdownGPU.setGeometry(QtCore.QRect(110, 20, 111, 25))
- self.dropdownGPU.setObjectName("dropdownGPU")
- self.dropdownGPU.addItem("")
- self.dropdownGPU.addItem("")
- self.dropdownGPU.addItem("")
- self.dropdownGPU.addItem("")
- self.dropdownGPU.addItem("")
- self.dropdownGPU.addItem("")
- self.dropdownGPU.addItem("")
- self.dropdownGPU.addItem("")
- self.dropdownGPU.addItem("")
- self.dropdownGPU.addItem("")
- self.dropdownGPU.addItem("")
- self.dropdownRAM = QtWidgets.QComboBox(self.groupPerformance)
- self.dropdownRAM.setGeometry(QtCore.QRect(220, 20, 111, 25))
- self.dropdownRAM.setObjectName("dropdownRAM")
- self.dropdownRAM.addItem("")
- self.buttonSavePerformance = QtWidgets.QPushButton(self.groupPerformance)
- self.buttonSavePerformance.setGeometry(QtCore.QRect(0, 50, 71, 21))
- self.buttonSavePerformance.setObjectName("buttonSavePerformance")
- self.buttonAutoDetectPerformance = QtWidgets.QPushButton(self.groupPerformance)
- self.buttonAutoDetectPerformance.setGeometry(QtCore.QRect(70, 50, 101, 21))
- self.buttonAutoDetectPerformance.setObjectName("buttonAutoDetectPerformance")
- self.tabWidget.addTab(self.tabPreferences, "")
- self.labelServerStatus = QtWidgets.QLabel(Launcher)
- self.labelServerStatus.setGeometry(QtCore.QRect(310, 260, 81, 16))
- self.labelServerStatus.setObjectName("labelServerStatus")
- self.buttonServerStartup = QtWidgets.QPushButton(Launcher)
- self.buttonServerStartup.setGeometry(QtCore.QRect(300, 280, 101, 21))
- self.buttonServerStartup.setCheckable(False)
- self.buttonServerStartup.setObjectName("buttonServerStartup")
- self.progressUpdate = QtWidgets.QProgressBar(Launcher)
- self.progressUpdate.setGeometry(QtCore.QRect(0, 250, 101, 51))
- self.progressUpdate.setProperty("value", 24)
- self.progressUpdate.setObjectName("progressUpdate")
- self.buttonPlay = QtWidgets.QPushButton(Launcher)
- self.buttonPlay.setGeometry(QtCore.QRect(100, 250, 201, 51))
- self.buttonPlay.setObjectName("buttonPlay")
-
- self.retranslateUi(Launcher)
- self.tabWidget.setCurrentIndex(3)
- QtCore.QMetaObject.connectSlotsByName(Launcher)
-
- def retranslateUi(self, Launcher):
- _translate = QtCore.QCoreApplication.translate
- Launcher.setWindowTitle(_translate("Launcher", "Jan’s Minecraft Mod Pack Launcher"))
- self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabUpdates), _translate("Launcher", "News && Updates"))
- self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabMods), _translate("Launcher", "Mod Infos && Credits"))
- self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabServer), _translate("Launcher", "Server Info"))
- self.groupLogin.setTitle(_translate("Launcher", "Login Information"))
- self.lineUsername.setText(_translate("Launcher", ""))
- self.lineUsername.setPlaceholderText(_translate("Launcher", "e-Mail or username"))
- self.linePassword.setText(_translate("Launcher", "You fool!"))
- self.linePassword.setPlaceholderText(_translate("Launcher", "Password"))
- self.buttonSaveUser.setText(_translate("Launcher", "Save!"))
- self.buttonLogout.setText(_translate("Launcher", "Logout :("))
- self.groupPerformance.setTitle(_translate("Launcher", "Performance Settings"))
- self.dropdownCPU.setItemText(0, _translate("Launcher", ""))
- self.dropdownCPU.setItemText(1, _translate("Launcher", "Daddy\'s old laptop"))
- self.dropdownCPU.setItemText(2, _translate("Launcher", "Modern Laptop"))
- self.dropdownCPU.setItemText(3, _translate("Launcher", "Generic Single Core"))
- self.dropdownCPU.setItemText(4, _translate("Launcher", "Modern Single Core (Seriously!? Why?)"))
- self.dropdownCPU.setItemText(5, _translate("Launcher", "Generic Dual Core"))
- self.dropdownCPU.setItemText(6, _translate("Launcher", "Modern Dual Core or Threaded"))
- self.dropdownCPU.setItemText(7, _translate("Launcher", "Generic Multi Core"))
- self.dropdownCPU.setItemText(8, _translate("Launcher", "Modern Multi Core"))
- self.dropdownCPU.setItemText(9, _translate("Launcher", "Extremely too many cores"))
- self.dropdownCPU.setItemText(10, _translate("Launcher", "NO LIMITS!"))
- self.dropdownGPU.setItemText(0, _translate("Launcher", ""))
- self.dropdownGPU.setItemText(1, _translate("Launcher", "Daddy\'s old laptop"))
- self.dropdownGPU.setItemText(2, _translate("Launcher", "Generic laptop dedicated"))
- self.dropdownGPU.setItemText(3, _translate("Launcher", "Modern laptop integrated"))
- self.dropdownGPU.setItemText(4, _translate("Launcher", "Modern Laptop dedicated"))
- self.dropdownGPU.setItemText(5, _translate("Launcher", "Generic Integrated (or low-power office PC graphics card)"))
- self.dropdownGPU.setItemText(6, _translate("Launcher", "Modern Integrated (or modern office PC ... 1030? I am looking at you.)"))
- self.dropdownGPU.setItemText(7, _translate("Launcher", "Generic Dedicated"))
- self.dropdownGPU.setItemText(8, _translate("Launcher", "Modern Dedicated"))
- self.dropdownGPU.setItemText(9, _translate("Launcher", "GAMING!!!"))
- self.dropdownGPU.setItemText(10, _translate("Launcher", "When will RayTracing be available?"))
- self.dropdownRAM.setItemText(0, _translate("Launcher", ""))
- self.buttonSavePerformance.setText(_translate("Launcher", "Save!"))
- self.buttonAutoDetectPerformance.setText(_translate("Launcher", "Try auto-detect"))
- self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabPreferences), _translate("Launcher", "Preferences"))
- self.labelServerStatus.setText(_translate("Launcher", "Server: Offline"))
- self.buttonServerStartup.setText(_translate("Launcher", "Request Startup"))
- self.progressUpdate.setFormat(_translate("Launcher", "Updating..."))
- self.buttonPlay.setText(_translate("Launcher", "PLAY! :)"))
-
-from PyQt5 import QtWebKitWidgets