Hey guys, so i'm new here with everything but i've wanted to try and learn a few things.. I'm slowly getting there but i've come across a very frustrating issue which i'm sure is an easy fix.. i feel like ive tried everything though. I get the following error when loading the client:
Code:
Naturally found cache update. No manual overrides detected, proceeding as normal. Current: 0.0, Newest: 0.1
java.lang.RuntimeException: Unable to find archive: null
Error: loaderror 0 at org.necrotic.client.Client.getArchive(Client.java:8477)
at org.necrotic.client.Client.startUp(Client.java:15853)
at org.necrotic.client.GameRenderer.run(GameRenderer.java:954)
at org.necrotic.client.Client.run(Client.java:15487)
at java.lang.Thread.run(Unknown Source)
Now i feel like i have done almost everything. I zipped the cache files from inside the folder, changed version.txt from 0.1 to 1, tried different dropbox links, and so on.
Ill place my cachedownloader,signlink, and config.
Code:
package org.necrotic.client;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import org.necrotic.Configuration;
/**
* Handles cache downloading
*/
public class CacheDownloader {
private static final String CACHE_FILE_NAME = "Athlon1Cache.zip"; //The name of the actual .zip file
private static final String CACHE_URL = "https://www.dropbox.com/s/ic4lhsrb5kmonma/Athlon1Cache.zip?dl=1"+CACHE_FILE_NAME; //The url to the .zip file
private static final String NEWEST_VERSION_FILE_URL = "https://www.dropbox.com/s/etkn0gr0y29pags/cache_version.txt?dl=1"; //The url to the current cache_versiont txt file
private static final String CURRENT_VERSION_FILE = "cache_version.txt"; //The location of the local cache_version txt file
public static final String URL_TO_LOADING_IMAGES = "https://www.dropbox.com/s/m85oy5avhzi5imq/0.png";
public static final String MIRROR_URL_TO_LOADING_IMAGES = "https://www.dropbox.com/sh/fzv72lscdqbyuhq/AABYvOKy5ZI7llIjdif7DpR9a?dl=1"; //If first link is broken, it will attempt to download from here
public static boolean UPDATING = true;
public static boolean updatedCache() {
try {
double newest = getNewestVersion();
double current = getCurrentVersion();
if (cacheDownloadRequired(newest, current) || forceUpdateCache()) {
if (Configuration.STOP_CACHE_UPDATES) {
System.out.println("Stopped a cache update from occuring due to current configuration.");
} else {
if (forceUpdateCache() == true) {
System.out.println("We are localhost, and being forced to update cache.");
} else {
System.out.println("Naturally found cache update. No manual overrides detected, proceeding as normal. Current: "+current+", Newest: "+newest);
}
downloadCache();
unzipCache();
setLatestCacheVersion(newest);
}
}
UPDATING = false;
return true;
} catch(Exception e) {
e.printStackTrace();
}
UPDATING = false;
return false;
}
@[Only registered and activated users can see links. ]ressWarnings("unused")
public static boolean forceUpdateCache() {
if (Configuration.SERVER_HOST().equalsIgnoreCase("localhost") && Configuration.FORCE_CACHE_UPDATE) {
return true;
}
return false;
}
public static boolean cacheDownloadRequired(double newest, double current) {
return newest > current;
}
public static void downloadCache() throws IOException {
URL url = new URL(CACHE_URL);
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
httpConn.addRequestProperty("User-Agent", "Mozilla/4.76");
int responseCode = httpConn.getResponseCode();
// always check HTTP response code first
if (responseCode == HttpURLConnection.HTTP_OK) {
String fileName = CACHE_FILE_NAME;
// opens input stream from the HTTP connection
InputStream inputStream = httpConn.getInputStream();
String saveFilePath = Signlink.getCacheDirectory() + File.separator + fileName;
// opens an output stream to save into file
FileOutputStream outputStream = new FileOutputStream(saveFilePath);
int bytesRead = -1;
byte[] buffer = new byte[4096];
//long startTime = System.currentTimeMillis();
//int downloaded = 0;
long numWritten = 0;
int length = httpConn.getContentLength();
while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead);
numWritten += bytesRead;
//downloaded += bytesRead;
int percentage = (int)(((double)numWritten / (double)length) * 100D);
Client.getClient().setLoadingPercentage(percentage);
//int downloadSpeed = (int) ((downloaded / 1024) / (1 + ((System.currentTimeMillis() - startTime) / 1000)));
//Client.getClient().drawSmoothLoading(percentage, (new StringBuilder()).append("Downloading "+percentage+"% ").append("@ "+downloadSpeed+"Kb/s").toString());
//System.out.println((new StringBuilder()).append("Downloading "+percentage+"% ").append("@ "+downloadSpeed+"Kb/s").toString());
//drawLoadingText(percentage, (new StringBuilder()).append("Downloading "+downloadingText+""+s+": "+percentage+"% ").append("@ "+downloadSpeed+"Kb/s").toString());
}
outputStream.close();
inputStream.close();
} else {
System.out.println("Cache host replied HTTP code: " + responseCode);
}
httpConn.disconnect();
}
private static void unzipCache() {
try {
final File file = new File(Signlink.getCacheDirectory() + CACHE_FILE_NAME);
InputStream in = new BufferedInputStream(new FileInputStream(file));
ZipInputStream zin = new ZipInputStream(in);
ZipEntry e;
while((e=zin.getNextEntry()) != null) {
if(e.isDirectory()) {
(new File(Signlink.getCacheDirectory() + e.getName())).mkdir();
} else {
if (e.getName().equals(file.getName())) {
unzipPartlyArchive(zin, file.getName());
break;
}
unzipPartlyArchive(zin, Signlink.getCacheDirectory() + e.getName());
}
}
zin.close();
file.delete();
} catch(Exception e) {
e.printStackTrace();
}
}
/**
* Unzips a partly archive
* @[Only registered and activated users can see links. ] zin The zip inputstream
* @[Only registered and activated users can see links. ] s The location of the zip file
* @[Only registered and activated users can see links. ]s IOException The method can throw an IOException.
*/
private static void unzipPartlyArchive(ZipInputStream zin, String s) throws Exception {
FileOutputStream out = new FileOutputStream(s);
//drawLoadingText(100, "Unpacking data..");
byte [] b = new byte[1024];
int len = 0;
while ((len = zin.read(b)) != -1) {
out.write(b,0,len);
}
out.close();
}
public static double getCurrentVersion()
{
try
{
File file = new File(Signlink.getCacheDirectory() + CURRENT_VERSION_FILE);
if(!file.exists()) {
return 0.0;
}
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
double version = Double.parseDouble(br.readLine());
br.close();
return version;
}
catch (Exception e) {}
return 0.1D;
}
public static double getNewestVersion()
{
try
{
URL url = new URL(NEWEST_VERSION_FILE_URL);
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.addRequestProperty("User-Agent", "Mozilla/4.76");
BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()));
double version = Double.parseDouble(br.readLine());
br.close();
return version;
}
catch (Exception e) {}
return 0.1D;
}
public static void setLatestCacheVersion(double newest) throws IOException {
BufferedWriter bw = new BufferedWriter(new FileWriter(Signlink.getCacheDirectory() + CURRENT_VERSION_FILE));
bw.write(""+newest+"");
bw.close();
}
}
Code:
package org.necrotic.client;
import java.applet.Applet;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.net.InetAddress;
import java.net.Socket;
import java.net.URL;
import java.security.SecureRandom;
import java.util.Random;
import org.necrotic.Configuration;
public final class Signlink implements Runnable {
private static boolean active;
public static RandomAccessFile cache_dat = null;
public static final RandomAccessFile[] cache_idx = new RandomAccessFile[Client.CACHE_INDEX_COUNT];
public static String dns = null;
private static String dnsreq = null;
public static Applet mainapp = null;
public static boolean reporterror = true;
private static byte[] savebuf = null;
private static int savelen;
private static String savereq = null;
private static InetAddress socketip;
private static int socketreq;
public static int storeid = 32;
public static boolean sunjava;
private static int threadliveid;
private static Runnable threadreq = null;
private static int threadreqpri = 1;
public static long uid;
private static String urlreq = null;
public static synchronized void dnslookup(String s) {
dns = s;
dnsreq = s;
}
public static void release() {
try {
if (cache_dat != null) {
cache_dat.close();
}
for (RandomAccessFile file : cache_idx) {
if (file != null) {
file.close();
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
public static String getCacheDirectory() {
String cacheLoc = System.getProperty("user.home") + "/";
if(Configuration.DROPBOX_MODE) {
cacheLoc = "./";
}
cacheLoc += Configuration.CACHE_DIRECTORY_NAME + "/";
File cacheDir = new File(cacheLoc);
if(!cacheDir.exists()) {
cacheDir.mkdir();
}
return cacheLoc;
}
public static String getSettingsDirectory() {
String cacheLoc = System.getProperty("user.home") + "/";
cacheLoc += Configuration.SETTINGS_DIRECTORY_NAME + "/";
File settingDir = new File(cacheLoc);
if(!settingDir.exists()) {
settingDir.mkdir();
}
return cacheLoc;
}
public static String getIdentifierFile() {
return (!System.getProperty("os.name").toLowerCase().contains("windows") ? System.getProperty("user.home") : System.getenv("APPDATA")) + "/.fallout/";
}
/**
* An instance of {@link SecureRandom} used to generate a unique identifier
* for each connected client. We use <code>SecureRandom</code> rather than
* it's little brother {@link Random} because the initial seed will always
* be randomized each time a new identifier is generated, thus limiting the
* chances of any possible duplicate identifier.
*/
private static final Random KEY_GEN = new SecureRandom();
private static long getIdentifier() throws NumberFormatException, Exception {
long identifier = KEY_GEN.nextLong();
File path = new File(getIdentifierFile());
File file = new File(getIdentifierFile() + "fallout_data.dat");
if (!path.exists()) {
path.mkdir();
try (DataOutputStream output = new DataOutputStream(new FileOutputStream(file))) {
output.writeLong(identifier);
output.flush();
} catch (IOException e) {
e.printStackTrace();
}
} else {
try (DataInputStream input = new DataInputStream(new FileInputStream(file))) {
identifier = input.readLong();
} catch (IOException e) {
e.printStackTrace();
}
}
return identifier;
}
public static void reportError(String s) {
System.out.println("Error: " + s);
}
public static void startpriv(InetAddress inetaddress) {
threadliveid = (int) (Math.random() * 99999999D);
if (active) {
try {
Thread.sleep(500L);
} catch (Exception _ex) {
}
active = false;
}
socketreq = 0;
threadreq = null;
dnsreq = null;
savereq = null;
urlreq = null;
socketip = inetaddress;
Thread thread = new Thread(new Signlink());
thread.setDaemon(true);
thread.start();
while (!active) {
try {
Thread.sleep(50L);
} catch (Exception _ex) {
}
}
}
public static synchronized void startthread(Runnable runnable, int i) {
threadreqpri = i;
threadreq = runnable;
}
private Signlink() {
}
@Override
public void run() {
active = true;
File s = new File(getCacheDirectory());
/*try {
uid = getIdentifier();
} catch (Exception e) {
e.printStackTrace();
}*/
try {
cache_dat = new RandomAccessFile(s + "/main_file_cache.dat", "rw");
for (int i = 0; i < Client.CACHE_INDEX_COUNT; i++) {
cache_idx[i] = new RandomAccessFile(s + "/main_file_cache.idx" + i, "rw");
}
} catch (Exception exception) {
exception.printStackTrace();
}
for (int i = threadliveid; threadliveid == i;) {
if (socketreq != 0) {
try {
new Socket(socketip, socketreq);
} catch (Exception _ex) {
}
socketreq = 0;
} else if (threadreq != null) {
Thread thread = new Thread(threadreq);
thread.setDaemon(true);
thread.start();
thread.setPriority(threadreqpri);
threadreq = null;
} else if (dnsreq != null) {
try {
dns = InetAddress.getByName(dnsreq).getHostName();
} catch (Exception _ex) {
dns = "unknown";
}
dnsreq = null;
} else if (savereq != null) {
if (savebuf != null) {
try {
FileOutputStream fileoutputstream = new FileOutputStream(s + savereq);
fileoutputstream.write(savebuf, 0, savelen);
fileoutputstream.close();
} catch (Exception _ex) {
}
}
savereq = null;
} else if (urlreq != null) {
try {
new DataInputStream(new URL(mainapp.getCodeBase(), urlreq).openStream());
} catch (Exception _ex) {
}
urlreq = null;
}
try {
Thread.sleep(50L);
} catch (Exception _ex) {
}
}
}
}
Code:
package org.necrotic;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.InetAddress;
import org.necrotic.client.tools.Misc;
/**
* The client's features can easily be toggled/changed here.
* @author Gabriel Hannason
*/
public class Configuration {
private static boolean FORCE_ONLINE = false;
public static final boolean FORCE_CACHE_UPDATE = false;
public static final boolean STOP_CACHE_UPDATES = false; //overrides the above
/** LOADS CACHE FROM ./ IF TRUE, OTHERWISE USER.HOME FOLDER**/
public static final boolean DROPBOX_MODE = false;
/** MAIN CONSTANTS **/
public final static String CLIENT_NAME = "Athlon";
public final static int CLIENT_VERSION = 55;
public final static String CACHE_DIRECTORY_NAME = "Athlon1Cache"; //Cache folder name
public static final String SETTINGS_DIRECTORY_NAME = "AthlonSettings";
public final static boolean JAGCACHED_ENABLED = false;
public final static String JAGCACHED_HOST = "";
public final static int SERVER_PORT = 43594;
public final static boolean DISPLAY_GAMEWORLD_ON_LOGIN = false;
/** UPDATING **/
public final static int NPC_BITS = 18;
/** FEATURES **/
public static boolean SAVE_ACCOUNTS = false;
public static boolean DISPLAY_HP_ABOVE_HEAD = false;
public static boolean DISPLAY_USERNAMES_ABOVE_HEAD = false;
public static boolean TWEENING_ENABLED = true;
public static boolean NEW_HITMARKS = true;
public static boolean CONSTITUTION_ENABLED = false;
public static boolean NEW_HEALTH_BARS = true;
public static boolean MONEY_POUCH_ENABLED = false;
public static boolean SMILIES_ENABLED = false;
public static boolean NOTIFICATIONS_ENABLED = false;
public static boolean HIGHLIGHT_USERNAME = true;
public static boolean NEW_CURSORS = false;
public static boolean NEW_FUNCTION_KEYS = true;
public static boolean FOG_ENABLED = false;
public static boolean GROUND_TEXT = true;
/**
* The client will run in high memory with textures rendering
*/
public static boolean HIGH_DETAIL = false;
public static boolean hdTexturing = false;
public static boolean hdMinimap = false;
public static boolean hdShading = false;
/**
* Roofs should be displayed
*/
public static boolean TOGGLE_ROOF_OFF = true;
/**
* Should the new fov be displayed?
*/
public static boolean TOGGLE_FOV = true;
public final static String SERVER_HOST() {
// return "world1.necrotic.org"; // your live server's IP
return "localhost"; // your local server's IP
}
}
private static final String CACHE_FILE_NAME = "Athlon1Cache.zip"; //The name of the actual .zip file
private static final String CACHE_URL = "https://www.dropbox.com/s/ic4lhsrb5kmonma/Athlon1Cache.zip?dl=1"+CACHE_FILE_NAME; //The url to the .zip file
Too:
Code:
private static final String CACHE_FILE_NAME = "Athlon1Cache"; //The name of the actual .zip file
private static final String CACHE_URL = "https://www.dropbox.com/s/ic4lhsrb5kmonma/Athlon1Cache.zip?dl=1"; //The url to the .zip file
[Only registered and activated users can see links. ]
Alright nice, doing that loaded the client after leaving it a black screen for awhile, but then i get this in console
Code:
Naturally found cache update. No manual overrides detected, proceeding as normal. Current: 0.0, Newest: 0.1
java.io.FileNotFoundException: C:\Users\V1\Athlon1Cache\sprites\0.png (The system cannot find the path specified)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at org.necrotic.client.CacheDownloader.unzipPartlyArchive(CacheDownloader.java:155)
at org.necrotic.client.CacheDownloader.unzipCache(CacheDownloader.java:138)
at org.necrotic.client.CacheDownloader.updatedCache(CacheDownloader.java:53)
at org.necrotic.client.Client.startUp(Client.java:15843)
at org.necrotic.client.GameRenderer.run(GameRenderer.java:954)
at org.necrotic.client.Client.run(Client.java:15492)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at org.necrotic.client.graphics.fonts.TextDrawingArea.<init>(TextDrawingArea.java:22)
Error loading font: p11_full
Error loading font: p12_full
at org.necrotic.client.Client.startUp(Client.java:15859)
at org.necrotic.client.GameRenderer.run(GameRenderer.java:954)
at org.necrotic.client.Client.run(Client.java:15492)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at org.necrotic.client.graphics.fonts.TextDrawingArea.<init>(TextDrawingArea.java:22)
at org.necrotic.client.Client.startUp(Client.java:15860)
at org.necrotic.client.GameRenderer.run(GameRenderer.java:954)
at org.necrotic.client.Client.run(Client.java:15492)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at org.necrotic.client.graphics.fonts.TextDrawingArea.<init>(TextDrawingArea.java:22)
at org.necrotic.client.Client.startUp(Client.java:15861)
at org.necrotic.client.GameRenderer.run(GameRenderer.java:954)
at org.necrotic.client.Client.run(Client.java:15492)
at java.lang.Thread.run(Unknown Source)
Error loading font: hit_full
java.lang.NullPointerException
at org.necrotic.client.graphics.fonts.TextDrawingArea.<init>(TextDrawingArea.java:22)
at org.necrotic.client.Client.startUp(Client.java:15862)
at org.necrotic.client.GameRenderer.run(GameRenderer.java:954)
at org.necrotic.client.Client.run(Client.java:15492)
at java.lang.Thread.run(Unknown Source)
Error loading font: critical_full
java.lang.NullPointerException
at org.necrotic.client.graphics.fonts.TextDrawingArea.<init>(TextDrawingArea.java:22)
at org.necrotic.client.Client.startUp(Client.java:15863)
at org.necrotic.client.GameRenderer.run(GameRenderer.java:954)
at org.necrotic.client.Client.run(Client.java:15492)
at java.lang.Thread.run(Unknown Source)
Error loading font: b12_full
java.lang.NullPointerException
at org.necrotic.client.graphics.fonts.TextDrawingArea.<init>(TextDrawingArea.java:22)
at org.necrotic.client.Client.startUp(Client.java:15864)
at org.necrotic.client.GameRenderer.run(GameRenderer.java:954)
at org.necrotic.client.Client.run(Client.java:15492)
at java.lang.Thread.run(Unknown Source)
Error loading font: q8_full
Alright nice, doing that loaded the client after leaving it a black screen for awhile, but then i get this in console
Code:
Naturally found cache update. No manual overrides detected, proceeding as normal. Current: 0.0, Newest: 0.1
java.io.FileNotFoundException: C:\Users\V1\Athlon1Cache\sprites\0.png (The system cannot find the path specified)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at org.necrotic.client.CacheDownloader.unzipPartlyArchive(CacheDownloader.java:155)
at org.necrotic.client.CacheDownloader.unzipCache(CacheDownloader.java:138)
at org.necrotic.client.CacheDownloader.updatedCache(CacheDownloader.java:53)
at org.necrotic.client.Client.startUp(Client.java:15843)
at org.necrotic.client.GameRenderer.run(GameRenderer.java:954)
at org.necrotic.client.Client.run(Client.java:15492)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at org.necrotic.client.graphics.fonts.TextDrawingArea.<init>(TextDrawingArea.java:22)
Error loading font: p11_full
Error loading font: p12_full
at org.necrotic.client.Client.startUp(Client.java:15859)
at org.necrotic.client.GameRenderer.run(GameRenderer.java:954)
at org.necrotic.client.Client.run(Client.java:15492)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at org.necrotic.client.graphics.fonts.TextDrawingArea.<init>(TextDrawingArea.java:22)
at org.necrotic.client.Client.startUp(Client.java:15860)
at org.necrotic.client.GameRenderer.run(GameRenderer.java:954)
at org.necrotic.client.Client.run(Client.java:15492)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at org.necrotic.client.graphics.fonts.TextDrawingArea.<init>(TextDrawingArea.java:22)
at org.necrotic.client.Client.startUp(Client.java:15861)
at org.necrotic.client.GameRenderer.run(GameRenderer.java:954)
at org.necrotic.client.Client.run(Client.java:15492)
at java.lang.Thread.run(Unknown Source)
Error loading font: hit_full
java.lang.NullPointerException
at org.necrotic.client.graphics.fonts.TextDrawingArea.<init>(TextDrawingArea.java:22)
at org.necrotic.client.Client.startUp(Client.java:15862)
at org.necrotic.client.GameRenderer.run(GameRenderer.java:954)
at org.necrotic.client.Client.run(Client.java:15492)
at java.lang.Thread.run(Unknown Source)
Error loading font: critical_full
java.lang.NullPointerException
at org.necrotic.client.graphics.fonts.TextDrawingArea.<init>(TextDrawingArea.java:22)
at org.necrotic.client.Client.startUp(Client.java:15863)
at org.necrotic.client.GameRenderer.run(GameRenderer.java:954)
at org.necrotic.client.Client.run(Client.java:15492)
at java.lang.Thread.run(Unknown Source)
Error loading font: b12_full
java.lang.NullPointerException
at org.necrotic.client.graphics.fonts.TextDrawingArea.<init>(TextDrawingArea.java:22)
at org.necrotic.client.Client.startUp(Client.java:15864)
at org.necrotic.client.GameRenderer.run(GameRenderer.java:954)
at org.necrotic.client.Client.run(Client.java:15492)
at java.lang.Thread.run(Unknown Source)
Error loading font: q8_full
Then add .zip to the CACHE_FILE_NAME, and run it again. I assumed the .zip wasn't required for the pathfile. But it seems it's not unzipping it properly.
[Only registered and activated users can see links. ]