This commit is contained in:
Anuken
2019-10-30 00:27:17 -04:00
parent 77dbeed890
commit fcbcdfc5d9
2 changed files with 47 additions and 44 deletions

View File

@@ -98,7 +98,7 @@ public class ModsDialog extends FloatingDialog{
void setup(){ void setup(){
cont.clear(); cont.clear();
cont.defaults().width(mobile ? 500 : 520f).pad(4); cont.defaults().width(mobile ? 500 : 560f).pad(4);
cont.add("$mod.reloadrequired").visible(mods::requiresReload).center().get().setAlignment(Align.center); cont.add("$mod.reloadrequired").visible(mods::requiresReload).center().get().setAlignment(Align.center);
cont.row(); cont.row();
if(!(mods.all().isEmpty() && mods.disabled().isEmpty())){ if(!(mods.all().isEmpty() && mods.disabled().isEmpty())){

View File

@@ -39,7 +39,7 @@ import static io.anuke.mindustry.Vars.*;
public class DesktopLauncher extends ClientLauncher{ public class DesktopLauncher extends ClientLauncher{
public final static String discordID = "610508934456934412"; public final static String discordID = "610508934456934412";
boolean useDiscord = OS.is64Bit, showConsole = OS.getPropertyNotNull("user.name").equals("anuke"); boolean useDiscord = OS.is64Bit, loadError = false;
static{ static{
if(!Charset.forName("US-ASCII").newEncoder().canEncode(System.getProperty("user.name", ""))){ if(!Charset.forName("US-ASCII").newEncoder().canEncode(System.getProperty("user.name", ""))){
@@ -91,7 +91,6 @@ public class DesktopLauncher extends ClientLauncher{
} }
} }
if(showConsole){
StringBuilder base = new StringBuilder(); StringBuilder base = new StringBuilder();
Log.setLogger(new LogHandler(){ Log.setLogger(new LogHandler(){
@Override @Override
@@ -109,7 +108,7 @@ public class DesktopLauncher extends ClientLauncher{
t.touchable(Touchable.disabled); t.touchable(Touchable.disabled);
t.top().left(); t.top().left();
t.update(() -> { t.update(() -> {
if(Core.input.keyTap(KeyCode.BACKTICK)){ if(Core.input.keyTap(KeyCode.BACKTICK) && (loadError || System.getProperty("user.name").equals("anuke"))){
visible[0] = !visible[0]; visible[0] = !visible[0];
} }
@@ -136,22 +135,25 @@ public class DesktopLauncher extends ClientLauncher{
} }
}); });
}); });
}
try{ try{
try{ try{
SteamAPI.loadLibraries(); SteamAPI.loadLibraries();
}catch(Throwable t){ }catch(Throwable t){
logSteamError(t); logSteamError(t);
fallbackSteam();
} }
if(!SteamAPI.init()){ if(!SteamAPI.init()){
loadError = true;
Log.err("Steam client not running."); Log.err("Steam client not running.");
}else{ }else{
initSteam(args); initSteam(args);
Vars.steam = true; Vars.steam = true;
} }
if(SteamAPI.restartAppIfNecessary(SVars.steamID)){
System.exit(0);
}
}catch(Throwable e){ }catch(Throwable e){
steam = false; steam = false;
Log.err("Failed to load Steam native libraries."); Log.err("Failed to load Steam native libraries.");
@@ -161,6 +163,7 @@ public class DesktopLauncher extends ClientLauncher{
} }
void logSteamError(Throwable e){ void logSteamError(Throwable e){
loadError = true;
Log.err(e); Log.err(e);
try(OutputStream s = new FileOutputStream(new File("steam-error-log-" + System.nanoTime() + ".txt"))){ try(OutputStream s = new FileOutputStream(new File("steam-error-log-" + System.nanoTime() + ".txt"))){
String log = Strings.parseException(e, true); String log = Strings.parseException(e, true);