update __main__.py.

1.修正了部分版本无法启动的BUG
2.修复了部分文件无法下载BUG
3.修复了无法启动某些刚刚下载的新游戏文件BUG
This commit is contained in:
Bigsk 2020-08-19 02:07:35 +08:00 committed by Gitee
parent de373cf404
commit b7b9770709

View File

@ -296,7 +296,10 @@ if(parser.type=="download_file"):
count=0
for i in range(0,urljson['number']):
try:
download(urljson['url'][count],pathjson['path'][count])
filepath=pathjson['path'][count]
dirpath=filepath.replace(os.path.basename(filepath),"")
make_dir_exist(dirpath)
download(urljson['url'][count],filepath)
except:
log("error","Some errors happened while downloading files,please check and try again.")
count=count+1
@ -305,6 +308,8 @@ if(parser.type=="download_file"):
deadly_error()
except:
try:
dirpath=parser.download_path.replace(os.path.basename(parser.download_path),"")
make_dir_exist(dirpath)
download(parser.download_url,parser.download_path)
except:
log("error","Some errors happened while downloading files,please check and try again.")
@ -545,13 +550,30 @@ elif(parser.type=="launcher_game"):
for i in range(0,game_config_json.count('"path"')):
try:
make_file_exist(dir_i + '\\libraries\\' + game_config['libraries'][number]['downloads']['artifact']['path'].replace('/','\\'),game_config['libraries'][number]['downloads']['artifact']['url'])
make_file_exist(dir_i + '\\libraries\\' + game_config['libraries'][number]['downloads']['classifiers']['javadoc']['path'].replace('/','\\'),game_config['libraries'][number]['downloads']['classifiers']['javadoc']['url'])
if(platform.system()=='Windows'):
try:
make_file_exist(dir_i + '\\libraries\\' + game_config['libraries'][number]['downloads']['classifiers']['natives-windows']['path'].replace('/','\\'),game_config['libraries'][number]['downloads']['classifiers']['natives-windows']['url'])
except:
try:
make_file_exist(dir_i + '\\libraries\\' + game_config['patches'][0]['libraries'][number]['downloads']['classifiers']['natives-windows']['path'].replace('/','\\'),game_config['patches'][0]['libraries'][number]['downloads']['classifiers']['natives-windows']['url'])
except:
pass
elif(platform.system()=='Linux'):
try:
make_file_exist(dir_i + '\\libraries\\' + game_config['libraries'][number]['downloads']['classifiers']['natives-linux']['path'].replace('/','\\'),game_config['libraries'][number]['downloads']['classifiers']['natives-linux']['url'])
except:
try:
make_file_exist(dir_i + '\\libraries\\' + game_config['patches'][0]['libraries'][number]['downloads']['classifiers']['natives-linux']['path'].replace('/','\\'),game_config['patches'][0]['libraries'][number]['downloads']['classifiers']['natives-linux']['url'])
except:
pass
else:
try:
make_file_exist(dir_i + '\\libraries\\' + game_config['libraries'][number]['downloads']['classifiers']['natives-macos']['path'].replace('/','\\'),game_config['libraries'][number]['downloads']['classifiers']['natives-macos']['url'])
except:
try:
make_file_exist(dir_i + '\\libraries\\' + game_config['patches'][0]['libraries'][number]['downloads']['classifiers']['natives-macos']['path'].replace('/','\\'),game_config['patches'][0]['libraries'][number]['downloads']['classifiers']['natives-macos']['url'])
except:
pass
except:
pass
number=number+1
@ -564,16 +586,25 @@ elif(parser.type=="launcher_game"):
if(platform.system()=='Windows'):
try:
unzip(dir_i + '\\libraries\\' + game_config['libraries'][number]['downloads']['classifiers']['natives-windows']['path'].replace('/','\\'),dir_i + '\\versions\\' + parser.version + '\\natives')
except:
try:
unzip(dir_i + '\\libraries\\' + game_config['patches'][0]['libraries'][number]['downloads']['classifiers']['natives-windows']['path'].replace('/','\\'),dir_i + '\\versions\\' + parser.version + '\\natives')
except:
pass
elif(platform.system()=='Linux'):
try:
unzip(dir_i + '\\libraries\\' + game_config['libraries'][number]['downloads']['classifiers']['natives-linux']['path'].replace('/','\\'),dir_i + '\\versions\\' + parser.version + '\\natives')
except:
try:
unzip(dir_i + '\\libraries\\' + game_config['patches'][0]['libraries'][number]['downloads']['classifiers']['natives-linux']['path'].replace('/','\\'),dir_i + '\\versions\\' + parser.version + '\\natives')
except:
pass
else:
try:
unzip(dir_i + '\\libraries\\' + game_config['libraries'][number]['downloads']['classifiers']['natives-macos']['path'].replace('/','\\'),dir_i + '\\versions\\' + parser.version + '\\natives')
except:
try:
unzip(dir_i + '\\libraries\\' + game_config['patches'][0]['libraries'][number]['downloads']['classifiers']['natives-macos']['path'].replace('/','\\'),dir_i + '\\versions\\' + parser.version + '\\natives')
except:
pass
number=number+1
@ -582,6 +613,9 @@ elif(parser.type=="launcher_game"):
for i in range(0,game_config_json.count('"path"')):
try:
cp=cp + dir_i + '\\libraries\\' + game_config['libraries'][number]['downloads']['artifact']['path'].replace('/','\\') + ';'
except:
try:
cp=cp + dir_i + '\\libraries\\' + game_config['patches'][0]['libraries'][number]['downloads']['artifact']['path'].replace('/','\\') + ';'
except:
pass
number=number+1
@ -606,10 +640,13 @@ elif(parser.type=="launcher_game"):
return_info.close()
else:
memory=parser.memory
try:
asset_index=game_config['assetIndex']['id']
asset_index="1.16"
command='\"' + java.replace('\n','') + '\" -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=16M -XX:-UseAdaptiveSizePolicy -XX:-OmitStackTraceInFastThrow -Xmn128m -Xmx' + memory + ' -Dfml.ignoreInvalidMinecraftCertificates=true -Dfml.ignorePatchDiscrepancies=true -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Djava.library.path=' + dir_i + '\\versions\\' + parser.version + '\\natives -Dminecraft.launcher.brand=' + config['default_launcher_name'] + ' -Dminecraft.launcher.version=' + config['version'] + ' -cp ' + cp + ' net.minecraft.client.main.Main --username ' + parser.id + ' --version "' + config['default_launcher_name'] + ' ' + config['version'] + '" --gameDir ' + dir_i + ' --assetsDir ' + dir_i + '\\assets --assetIndex ' + asset_index + ' --uuid ' + uuid + ' --accessToken ' + uuid + ' --userProperties {} --userType mojang'
except:
asset_index=game_config['patches'][0]['assetIndex']['id']
command='\"' + java.replace('\n','') + '\" -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=16M -XX:-UseAdaptiveSizePolicy -XX:-OmitStackTraceInFastThrow -Xmn128m -Xmx' + memory + ' -Dfml.ignoreInvalidMinecraftCertificates=true -Dfml.ignorePatchDiscrepancies=true -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Djava.library.path=' + dir_i + '\\versions\\' + parser.version + '\\natives -Dminecraft.launcher.brand=' + config['default_launcher_name'] + ' -Dminecraft.launcher.version=' + config['version'] + ' -cp ' + cp + ' net.minecraft.client.main.Main --username ' + parser.id + ' --version "' + config['default_launcher_name'] + ' ' + config['version'] + '" --gameDir ' + dir_i + ' --assetsDir ' + dir_i + '\\assets --assetIndex ' + asset_index + ' --uuid ' + uuid + ' --accessToken ' + uuid + ' --userProperties {} --userType mojang --versionType "' + config['default_launcher_name'] + ' ' + config['version'] + '"'
subprocess.Popen(command, shell=True)
print(command)
else:
return_data('The version you input is not exist!Please check if the parameter you input is correct!')
log('error','The vversion you input is not exist!Please check if the parameter you input is correct!')