Skip to content

Commit

Permalink
Merge pull request #244 from flaw600/64bit-fix
Browse files Browse the repository at this point in the history
64bit error fix
  • Loading branch information
RyanTheAllmighty committed Feb 3, 2016
2 parents 03c1370 + 92f8ab7 commit 5ad2225
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 56 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Expand Up @@ -3,4 +3,5 @@ Changelog

### 3.2.3.2

- Fix issue with linked/depends mods not cascading their changes to the mods they enable
- Fix issue with linked/depends mods not cascading their changes to the mods they enable
- Fixed issue that gave a bad '32 bit Java on 64 bit Windows' warning when 64 bit Java was installed in the x86 directory
84 changes: 46 additions & 38 deletions src/main/java/com/atlauncher/data/Settings.java
Expand Up @@ -17,37 +17,6 @@
*/
package com.atlauncher.data;

import com.atlauncher.App;
import com.atlauncher.Gsons;
import com.atlauncher.LogManager;
import com.atlauncher.Update;
import com.atlauncher.data.json.LauncherLibrary;
import com.atlauncher.exceptions.InvalidMinecraftVersion;
import com.atlauncher.exceptions.InvalidPack;
import com.atlauncher.gui.LauncherConsole;
import com.atlauncher.gui.components.LauncherBottomBar;
import com.atlauncher.gui.dialogs.ProgressDialog;
import com.atlauncher.gui.tabs.InstancesTab;
import com.atlauncher.gui.tabs.NewsTab;
import com.atlauncher.gui.tabs.PacksTab;
import com.atlauncher.thread.LoggingThread;
import com.atlauncher.utils.ATLauncherAPIUtils;
import com.atlauncher.utils.HTMLUtils;
import com.atlauncher.utils.MojangAPIUtils;
import com.atlauncher.utils.Timestamper;
import com.atlauncher.utils.Utils;
import com.google.gson.JsonIOException;
import com.google.gson.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;

import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import java.awt.Dialog.ModalityType;
import java.awt.FlowLayout;
import java.awt.Window;
Expand Down Expand Up @@ -90,6 +59,39 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;

import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;

import com.atlauncher.App;
import com.atlauncher.Gsons;
import com.atlauncher.LogManager;
import com.atlauncher.Update;
import com.atlauncher.data.json.LauncherLibrary;
import com.atlauncher.exceptions.InvalidMinecraftVersion;
import com.atlauncher.exceptions.InvalidPack;
import com.atlauncher.gui.LauncherConsole;
import com.atlauncher.gui.components.LauncherBottomBar;
import com.atlauncher.gui.dialogs.ProgressDialog;
import com.atlauncher.gui.tabs.InstancesTab;
import com.atlauncher.gui.tabs.NewsTab;
import com.atlauncher.gui.tabs.PacksTab;
import com.atlauncher.thread.LoggingThread;
import com.atlauncher.utils.ATLauncherAPIUtils;
import com.atlauncher.utils.HTMLUtils;
import com.atlauncher.utils.MojangAPIUtils;
import com.atlauncher.utils.Timestamper;
import com.atlauncher.utils.Utils;
import com.google.gson.JsonIOException;
import com.google.gson.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;

/**
* Settings class for storing all data for the Launcher and the settings of the user.
*
Expand Down Expand Up @@ -289,7 +291,7 @@ public void loadEverything() {

loadServerProperty(true); // Get users Server preference

if (Utils.isWindows() && this.javaPath.contains("x86")) {
if (Utils.isWindows() && !Utils.is64Bit() && Utils.isWindows64Bit()) {
LogManager.warn("You're using 32 bit Java on a 64 bit Windows install!");
String[] options = {Language.INSTANCE.localize("common.yes"), Language.INSTANCE.localize("common.no")};
int ret = JOptionPane.showOptionDialog(App.settings.getParent(), HTMLUtils.centerParagraph(Language
Expand Down Expand Up @@ -498,7 +500,8 @@ public void checkResources() {
final ProgressDialog dialog = new ProgressDialog(Language.INSTANCE.localize("settings" + "" +
".rearrangingresources"), 0, Language.INSTANCE.localize("settings.rearrangingresources"), null);
Thread thread = new Thread() {
public void run() {
@Override
public void run() {
File indexesDir = new File(getResourcesDir(), "indexes");
File objectsDir = new File(getResourcesDir(), "objects");
File virtualDir = new File(getResourcesDir(), "virtual");
Expand Down Expand Up @@ -2027,7 +2030,8 @@ public List<Pack> getPacks() {
public List<Pack> getPacksSortedAlphabetically() {
List<Pack> packs = new LinkedList<Pack>(this.packs);
Collections.sort(packs, new Comparator<Pack>() {
public int compare(Pack result1, Pack result2) {
@Override
public int compare(Pack result1, Pack result2) {
return result1.getName().compareTo(result2.getName());
}
});
Expand All @@ -2042,7 +2046,8 @@ public int compare(Pack result1, Pack result2) {
public List<Pack> getPacksSortedPositionally() {
List<Pack> packs = new LinkedList<Pack>(this.packs);
Collections.sort(packs, new Comparator<Pack>() {
public int compare(Pack result1, Pack result2) {
@Override
public int compare(Pack result1, Pack result2) {
return (result1.getPosition() < result2.getPosition()) ? -1 : ((result1.getPosition() == result2
.getPosition()) ? 0 : 1);
}
Expand Down Expand Up @@ -2107,7 +2112,8 @@ public List<Instance> getInstances() {
public ArrayList<Instance> getInstancesSorted() {
ArrayList<Instance> instances = new ArrayList<Instance>(this.instances);
Collections.sort(instances, new Comparator<Instance>() {
public int compare(Instance result1, Instance result2) {
@Override
public int compare(Instance result1, Instance result2) {
return result1.getName().compareTo(result2.getName());
}
});
Expand Down Expand Up @@ -3119,14 +3125,16 @@ public String getUserAgent() {
/**
* @deprecated
*/
public String getLocalizedString(String string) {
@Deprecated
public String getLocalizedString(String string) {
return Language.INSTANCE.localize(string);
}

/**
* @deprecated
*/
public String getLocalizedString(String string, String replace) {
@Deprecated
public String getLocalizedString(String string, String replace) {
return Language.INSTANCE.localize(string).replace("%s", replace);
}

Expand Down
45 changes: 28 additions & 17 deletions src/main/java/com/atlauncher/utils/Utils.java
Expand Up @@ -17,23 +17,6 @@
*/
package com.atlauncher.utils;

import com.atlauncher.App;
import com.atlauncher.Gsons;
import com.atlauncher.LogManager;
import com.atlauncher.data.Constants;
import com.atlauncher.data.mojang.ExtractRule;
import com.atlauncher.data.mojang.OperatingSystem;
import com.atlauncher.data.openmods.OpenEyeReportResponse;
import com.atlauncher.evnt.LogEvent.LogType;
import org.tukaani.xz.XZInputStream;

import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.spec.SecretKeySpec;
import javax.imageio.ImageIO;
import javax.net.ssl.HttpsURLConnection;
import javax.swing.ImageIcon;
import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.Font;
Expand Down Expand Up @@ -97,6 +80,25 @@
import java.util.zip.ZipFile;
import java.util.zip.ZipOutputStream;

import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.spec.SecretKeySpec;
import javax.imageio.ImageIO;
import javax.net.ssl.HttpsURLConnection;
import javax.swing.ImageIcon;

import org.tukaani.xz.XZInputStream;

import com.atlauncher.App;
import com.atlauncher.Gsons;
import com.atlauncher.LogManager;
import com.atlauncher.data.Constants;
import com.atlauncher.data.mojang.ExtractRule;
import com.atlauncher.data.mojang.OperatingSystem;
import com.atlauncher.data.openmods.OpenEyeReportResponse;
import com.atlauncher.evnt.LogEvent.LogType;

public class Utils {
public static String error(Throwable t) {
StringBuilder builder = new StringBuilder();
Expand Down Expand Up @@ -396,6 +398,15 @@ public static boolean isLinux() {
public static boolean is64Bit() {
return System.getProperty("sun.arch.data.model").contains("64");
}

/**
* Checks if Windows is 64 bit
*
* @return true, if it is 64 bit
*/
public static boolean isWindows64Bit(){
return System.getenv("ProgramFiles(x86)") != null;
}

/**
* Gets the arch.
Expand Down

0 comments on commit 5ad2225

Please sign in to comment.