DnAngel Newbie
Posts : 27 ZPoints : 43 Reputation : 0 Join date : 2011-10-03
| Subject: Make Client work for macs Mon Oct 03, 2011 11:39 pm | |
| This tutorial is for making the client work with macs, and people who do not have C: drive but something else instead.
Alright so first in singlink.java find this - Code:
-
public static String findcachedir() { should look like this - Code:
-
public static String findcachedir() { String as[] = {"C:/"}; if(storeid < 32 || storeid > 34) storeid = 32; String s = "Rune-X-scape"; for(int i = 0; i < as.length; i++) try { String s1 = as[i]; if(s1.length() > 0) { File file = new File(s1); if(!file.exists()) continue; } File file1 = new File(s1 + s); if(file1.exists() || file1.mkdir()) return s1 + s + "/"; } catch(Exception _ex) { } return null; } replace it with this - Code:
-
public static final String findcachedir() { String s = (new StringBuilder()).append(System.getProperty("user.home")).append("/Rune-X-scape/").toString(); String s1 = ""; File file = new File((new StringBuilder()).append(s1).append(s).toString()); if(file.exists() || file.mkdir()) return (new StringBuilder()).append(s1).append(s).append("/").toString(); else return null; } Now close and save. Next open up client.java and search for this - Code:
-
public void preloadModels() { should look something like this - Code:
-
public void preloadModels() { File file = new File("c:/Rune-X-scape/Raw/"); File[] fileArray = file.listFiles(); for(int y = 0; y < fileArray.length; y++) { String s = fileArray[y].getName(); byte[] buffer = ReadFile("c:/Rune-X-scape/Raw/"+s); Model.method460(buffer,Integer.parseInt(getFileNameWithoutExtension(s))); } } change it to this - Code:
-
public void preloadModels() { File file = new File((new StringBuilder()).append(System.getProperty("user.home")).append("/Rune-X-scape/Raw/").toString()); File[] fileArray = file.listFiles(); for(int y = 0; y < fileArray.length; y++) { String s = fileArray[y].getName(); byte abyte0[] = ReadFile((new StringBuilder()).append(System.getProperty("user.home")).append("/Rune-X-scape/Raw/").append(s).toString()); Model.method460(abyte0, Integer.parseInt(getFileNameWithoutExtension(s))); } } Now close and save it and open up. sprite.java and find this - Code:
-
public Sprite(byte abyte0[], Component component) replace - Code:
-
public String location = "c:/Rune-X-scape/Sprites/";
public Sprite(byte abyte0[], Component component) { try { //Image image = Toolkit.getDefaultToolkit().getImage(location+"mopar.jpg"); Image image = Toolkit.getDefaultToolkit().createImage(abyte0); MediaTracker mediatracker = new MediaTracker(component); mediatracker.addImage(image, 0); mediatracker.waitForAll(); myWidth = image.getWidth(component); myHeight = image.getHeight(component); anInt1444 = myWidth; anInt1445 = myHeight; anInt1442 = 0; anInt1443 = 0; myPixels = new int[myWidth * myHeight]; PixelGrabber pixelgrabber = new PixelGrabber(image, 0, 0, myWidth, myHeight, myPixels, 0, myWidth); pixelgrabber.grabPixels(); } catch(Exception _ex) { System.out.println("Error converting jpg"); } } with this - Code:
-
public Sprite(byte abyte0[], Component component) { location = (new StringBuilder()).append(System.getProperty("user.home")).append("/Rune-X-scape/Sprites/").toString(); try { //Image image = Toolkit.getDefaultToolkit().getImage(location+"mopar.jpg"); Image image = Toolkit.getDefaultToolkit().createImage(abyte0); MediaTracker mediatracker = new MediaTracker(component); mediatracker.addImage(image, 0); mediatracker.waitForAll(); myWidth = image.getWidth(component); myHeight = image.getHeight(component); anInt1444 = myWidth; anInt1445 = myHeight; anInt1442 = 0; anInt1443 = 0; myPixels = new int[myWidth * myHeight]; PixelGrabber pixelgrabber = new PixelGrabber(image, 0, 0, myWidth, myHeight, myPixels, 0, myWidth); pixelgrabber.grabPixels(); } catch(Exception _ex) { System.out.println("Error converting jpg"); } } Than search for this - Code:
-
public Sprite(String img, int width, int height) { should look like this - Code:
-
public Sprite(String img, int width, int height) { try { Image image = Toolkit.getDefaultToolkit().createImage(FileOperations.ReadFile(img)); myWidth = width; myHeight = height; anInt1444 = myWidth; anInt1445 = myHeight; anInt1442 = 0; anInt1443 = 0; myPixels = new int[myWidth * myHeight]; PixelGrabber pixelgrabber = new PixelGrabber(image, 0, 0, myWidth, myHeight, myPixels, 0, myWidth); pixelgrabber.grabPixels(); image = null; } catch(Exception _ex) { System.out.println(_ex); } } replace it with this - Code:
-
public Sprite(String img, int width, int height) { location = (new StringBuilder()).append(System.getProperty("user.home")).append("/Rune-X-scape/Sprites/").toString(); try { Image image = Toolkit.getDefaultToolkit().createImage(FileOperations.ReadFile(img)); myWidth = width; myHeight = height; anInt1444 = myWidth; anInt1445 = myHeight; anInt1442 = 0; anInt1443 = 0; myPixels = new int[myWidth * myHeight]; PixelGrabber pixelgrabber = new PixelGrabber(image, 0, 0, myWidth, myHeight, myPixels, 0, myWidth); pixelgrabber.grabPixels(); image = null; } catch(Exception _ex) { System.out.println(_ex); } } Than find this - Code:
-
public Sprite(String img) { Entire thing looks like this - Code:
-
public Sprite(String img) { try { Image image = Toolkit.getDefaultToolkit().getImage(location + img + ".png"); ImageIcon sprite = new ImageIcon(image); myWidth = sprite.getIconWidth(); myHeight = sprite.getIconHeight(); anInt1444 = myWidth; anInt1445 = myHeight; anInt1442 = 0; anInt1443 = 0; myPixels = new int[myWidth * myHeight]; PixelGrabber pixelgrabber = new PixelGrabber(image, 0, 0, myWidth, myHeight, myPixels, 0, myWidth); pixelgrabber.grabPixels(); image = null; setTransparency(255, 0, 255); } catch(Exception _ex) { System.out.println(_ex); } } change it to this - Code:
-
public Sprite(String s) { location = (new StringBuilder()).append(System.getProperty("user.home")).append("/Rune-X-scape/Sprites/").toString(); try { Image image = Toolkit.getDefaultToolkit().getImage((new StringBuilder()).append(location).append(s).append(".png").toString()); ImageIcon imageicon = new ImageIcon(image); myWidth = imageicon.getIconWidth(); myHeight = imageicon.getIconHeight(); anInt1444 = myWidth; anInt1445 = myHeight; anInt1442 = 0; anInt1443 = 0; myPixels = new int[myWidth * myHeight]; PixelGrabber pixelgrabber = new PixelGrabber(image, 0, 0, myWidth, myHeight, myPixels, 0, myWidth); pixelgrabber.grabPixels(); image = null; setTransparency(255, 0, 255); } catch(Exception exception) { System.out.println(exception); } } Now search for this - Code:
-
public Sprite(StreamLoader streamLoader, String s, int i) entire thing looks like this - Code:
-
public Sprite(StreamLoader streamLoader, String s, int i) { Stream stream = new Stream(streamLoader.getDataForName(s + ".dat")); Stream stream_1 = new Stream(streamLoader.getDataForName("index.dat")); stream_1.currentOffset = stream.readUnsignedWord(); anInt1444 = stream_1.readUnsignedWord(); anInt1445 = stream_1.readUnsignedWord(); int j = stream_1.readUnsignedByte(); int ai[] = new int[j]; for(int k = 0; k < j - 1; k++) { ai[k + 1] = stream_1.read3Bytes(); if(ai[k + 1] == 0) ai[k + 1] = 1; }
for(int l = 0; l < i; l++) { stream_1.currentOffset += 2; stream.currentOffset += stream_1.readUnsignedWord() * stream_1.readUnsignedWord(); stream_1.currentOffset++; }
anInt1442 = stream_1.readUnsignedByte(); anInt1443 = stream_1.readUnsignedByte(); myWidth = stream_1.readUnsignedWord(); myHeight = stream_1.readUnsignedWord(); int i1 = stream_1.readUnsignedByte(); int j1 = myWidth * myHeight; myPixels = new int[j1]; if(i1 == 0) { for(int k1 = 0; k1 < j1; k1++) myPixels[k1] = ai[stream.readUnsignedByte()]; setTransparency(255,0,255); return; } if(i1 == 1) { for(int l1 = 0; l1 < myWidth; l1++) { for(int i2 = 0; i2 < myHeight; i2++) myPixels[l1 + i2 * myWidth] = ai[stream.readUnsignedByte()]; }
} setTransparency(255,0,255); }
Change it to this - Code:
-
public Sprite(StreamLoader streamloader, String s, int i) { location = (new StringBuilder()).append(System.getProperty("user.home")).append("/Rune-X-scape/Sprites/").toString(); Stream stream = new Stream(streamloader.getDataForName((new StringBuilder()).append(s).append(".dat").toString())); Stream stream1 = new Stream(streamloader.getDataForName("index.dat")); stream1.currentOffset = stream.readUnsignedWord(); anInt1444 = stream1.readUnsignedWord(); anInt1445 = stream1.readUnsignedWord(); int j = stream1.readUnsignedByte(); int ai[] = new int[j]; for(int k = 0; k < j - 1; k++) { ai[k + 1] = stream1.read3Bytes(); if(ai[k + 1] == 0) ai[k + 1] = 1; }
for(int l = 0; l < i; l++) { stream1.currentOffset += 2; stream.currentOffset += stream1.readUnsignedWord() * stream1.readUnsignedWord(); stream1.currentOffset++; }
anInt1442 = stream1.readUnsignedByte(); anInt1443 = stream1.readUnsignedByte(); myWidth = stream1.readUnsignedWord(); myHeight = stream1.readUnsignedWord(); int i1 = stream1.readUnsignedByte(); int j1 = myWidth * myHeight; myPixels = new int[j1]; if(i1 == 0) { for(int k1 = 0; k1 < j1; k1++) myPixels[k1] = ai[stream.readUnsignedByte()];
setTransparency(255, 0, 255); return; } if(i1 == 1) { for(int l1 = 0; l1 < myWidth; l1++) { for(int i2 = 0; i2 < myHeight; i2++) myPixels[l1 + i2 * myWidth] = ai[stream.readUnsignedByte()];
}
} setTransparency(255, 0, 255); }
Than find this - Code:
-
public int myPixels[]; above it add this - Code:
-
public String location; Now close this and save it and open up clas36.java and find this. - Code:
-
abyte0 = FileOperations.ReadFile("c:/Rune-X-scape/data/" + file + ".dat"); Now replace both of this lines - Code:
-
byte abyte0[]; abyte0 = FileOperations.ReadFile("c:/Rune-X-scape/data/" + file + ".dat"); with this - Code:
-
byte abyte0[] = FileOperations.ReadFile((new StringBuilder()).append(System.getProperty("user.home")).append("/Rune-X-scape/data/").append(file).append(".dat").toString()); close and save it and open up modeldecompressor.java and find this - Code:
-
DataInputStream indexFile = new DataInputStream(new FileInputStream("./cache/models.idx")); DataInputStream dataFile = new DataInputStream(new FileInputStream("./cache/models.dat")); replace it with this - Code:
-
DataInputStream indexFile = new DataInputStream(new FileInputStream((new StringBuilder()).append(System.getProperty("user.home")).append("/Rune-X-scape/models.idx").toString())); DataInputStream dataFile = new DataInputStream(new FileInputStream((new StringBuilder()).append(System.getProperty("user.home")).append("/Rune-X-scape/models.dat").toString())); Now close and save, compile and enjoy working client on mac + windows.
Last edited by DnAngel on Tue Oct 04, 2011 11:21 am; edited 2 times in total (Reason for editing : Forgot add some things.) | |
|
Z Owner
Posts : 36 ZPoints : 71 Reputation : 0 Join date : 2011-10-02 Age : 29 Location : Florida, USA
| Subject: Re: Make Client work for macs Mon Oct 03, 2011 11:51 pm | |
| Nice guide, gave it some glue. | |
|
DnAngel Newbie
Posts : 27 ZPoints : 43 Reputation : 0 Join date : 2011-10-03
| Subject: Re: Make Client work for macs Tue Oct 04, 2011 1:51 am | |
| thank you, tell me if you have problems adding it. | |
|
Sponsored content
| Subject: Re: Make Client work for macs | |
| |
|