SRL Archive - Java Help and Tutorials

Tvs Runescape Loader


Tv-XxX

2009-02-23 14:50:08

INTRODUCTION

Tired of them adds at the top of client???
want to play full screen windowed in HD???
don't want to load a webbrowser to play runescape??
well here's my client loader, only loads the main client applet.
supports HD and SD

enjoy.

VERSION INFORMATION

v0.1 - Only supported unsigned SD runescape (via runescape.jar)
v0.2 - Only supported signed SD runescape (via loader.jar)
v0.3 - Supported SD and HD runescape (via loader_gl.jar)
v0.4 - Supports SD/HD now prases params from runescape.com.

PICTURES





UPDATED 10-10-09

Yours Tv

jakeyboy29

2009-02-23 15:29:19

you finaly did it, well done.

Quickmarch

2009-02-23 15:52:21

Very nice, well done. :)

Tv-XxX

2009-02-23 15:59:15

Yer jakeyboy29 :P

thank you to everyone whom helped :)

thanking about adding abit of reflection next :P just to past the time :)

Yours Tv.

MasterKill

2009-02-23 16:35:34

WOW, just WOW :D

very nice! thanks for this! srsly!

may I see the java code to? I would love to see it :)

E:

Play rs like fullscreen, and still be able to msn/xfire/steam…

ILOVEIT ILOVEIT ILOVEIT

noidea

2009-02-23 16:43:03

Took two times to get it to get off of Connecting to update server.
Its very, Very nice. It doesnt like like when its in a browser! Thanks! Repped

Smartzkid

2009-02-23 16:45:02

Nice! So how did you manage to get HD mode working?

Tv-XxX

2009-02-23 16:56:45

It was really really easy actually once i worked out how to do it…

originally i was loading from the runescape.jar, but that was slow and wouldnt allow HD :( so i changed to the loader.jar, and updated my classes ect… it now loaded really quick, but still no HD :(

so to google i went, and i found out that HD uses loader_gl.jar, updated that, and removed using save mode in my params, and it worked :)

so here's my java code, nothing special, and a little ugly lol, but who cares :)
its mainly based on banks tutorial from mopharisthebest, just with HD capabillities :)

import java.applet.Applet;
import java.applet.AppletContext;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.HashMap;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;

public class RunescapeApp extends javax.swing.JFrame implements
java.applet.AppletStub {

private static final HashMap<String, String> parameters = new HashMap<String, String>();

public RunescapeApp() {
try {

setSize(768, 534);
setResizable(true);
this.setExtendedState(this.getExtendedState() | RunescapeApp.MAXIMIZED_BOTH);

Toolkit toolkit = Toolkit.getDefaultToolkit();
Dimension screenSize = toolkit.getScreenSize();
int x = (screenSize.width - this.getWidth()) / 2;
int y = (screenSize.height - this.getHeight()) / 2;
setLocation(x, y);

setTitle("Tvs Runescape Loader");
parameters.put("height", "762");
parameters.put("width", "503");
parameters.put("worldid", "81");
parameters.put("modewhat", "0");
parameters.put("modewhere", "0");

ClassLoader clientClassLoader = new URLClassLoader(
new URL[] { new URL(
"http://world81.runescape.com/loader_gl.jar") });
Class<?> clientClass = clientClassLoader.loadClass("loader");
Applet loader = (Applet) clientClass.newInstance();

loader.setStub(this);
loader.init();
loader.start();

JPopupMenu.setDefaultLightWeightPopupEnabled(false);
JPanel theGame = new JPanel(new BorderLayout());
theGame.setPreferredSize(new Dimension(769, 510));
setPreferredSize(new Dimension(769, 510));
theGame.add(loader);
getContentPane().add(loader, BorderLayout.CENTER);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}

public void appletResize(int width, int height) {
// TODO Auto-generated method stub

}

public final URL getCodeBase() {
try {
return new URL("http://world81.runescape.com/");
} catch (Exception e) {
return null;
}
}

public final URL getDocumentBase() {
try {
return new URL("http://world81.runescape.com/");
} catch (Exception e) {
return null;
}
}

public final String getParameter(String name) {
return parameters.get(name);
}

public final AppletContext getAppletContext() {
return null;
}

public static void main(String[] args) {
new RunescapeApp().setVisible(true);
}
}

Yours
Tv.

Yakman

2009-02-23 17:23:18

fairly typical loader, but its good :)

Tv-XxX

2009-02-23 17:59:12

Cheers Yakman :)
Just been looking into reflection… I got a headache now :P ill read again tomorrow XD

Yours
Tv.

Method

2009-02-23 21:49:46

Looks fine. The height of the applet is 765 x 503, though, not 762 x 503. I doubt it makes much of a difference, if any, but it's best to make sure your parameters are correct. You could even parse them directly from the game page if you wanted to. :)

n3ss3s

2009-02-24 10:00:57

What I learned when I tried reading some of the good old tuts at MITB was that parsing is safer than the way people usually do in their first loaders? So you could try that :)

Tv-XxX

2009-02-24 12:43:06

I've now Parsed the client params… I think :P well it loads, and i think my codes right…

have a read :)

import java.applet.Applet;
import java.applet.AppletContext;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.io.DataInputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.HashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;

public class RunescapeApp extends javax.swing.JFrame implements
java.applet.AppletStub {

private static final HashMap<String, String> parameters = new HashMap<String, String>();

public RunescapeApp() {
String HTMLsource = "";
try {

setSize(768, 534);
setResizable(true);
this.setExtendedState(this.getExtendedState() | RunescapeApp.MAXIMIZED_BOTH);

Toolkit toolkit = Toolkit.getDefaultToolkit();
Dimension screenSize = toolkit.getScreenSize();
int x = (screenSize.width - this.getWidth()) / 2;
int y = (screenSize.height - this.getHeight()) / 2;
setLocation(x, y);

setTitle("Tvs Runescape Loader");

try {
String thisLine;
URL u = new URL("http://world81.runescape.com/a2,m0,j0,o0");
DataInputStream theHTML = new DataInputStream(u.openStream());
while ((thisLine = theHTML.readLine()) != null) {
HTMLsource = HTMLsource + thisLine;
}
}
catch (MalformedURLException e) {
System.err.println(e);
}

try {
Pattern regex = Pattern.compile("<param name=([^\\s]+)\\s+value=([^>]*)>", Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);
Matcher regexMatcher = regex.matcher(HTMLsource);
while (regexMatcher.find())
if (!parameters.containsKey(regexMatcher.group(1)))
parameters.put(regexMatcher.group(1), regexMatcher.group(2));
} catch (PatternSyntaxException ex) {
ex.printStackTrace();
}

ClassLoader clientClassLoader = new URLClassLoader(
new URL[] { new URL(
"http://world81.runescape.com/loader_gl.jar") });
Class<?> clientClass = clientClassLoader.loadClass("loader");
Applet loader = (Applet) clientClass.newInstance();
System.out.println("I <3 Nic");
loader.setStub(this);
loader.init();
loader.start();

JPopupMenu.setDefaultLightWeightPopupEnabled(false);
JPanel theGame = new JPanel(new BorderLayout());
theGame.setPreferredSize(new Dimension(769, 510));
setPreferredSize(new Dimension(769, 510));
theGame.add(loader);
getContentPane().add(loader, BorderLayout.CENTER);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}

public void appletResize(int width, int height) {
// TODO Auto-generated method stub

}

public final URL getCodeBase() {
try {
return new URL("http://world81.runescape.com/");
} catch (Exception e) {
return null;
}
}

public final URL getDocumentBase() {
try {
return new URL("http://world81.runescape.com/");
} catch (Exception e) {
return null;
}
}

public final String getParameter(String name) {
return parameters.get(name);
}

public final AppletContext getAppletContext() {
return null;
}

public static void main(String[] args) {
new RunescapeApp().setVisible(true);
}
}

and I've attached the new client :)

Yours
Tv.

Nava2

2009-03-05 07:46:50

This client is awesome. I suggest using this when scripting as well. I say this because it loses focus a lot less than say FF or IE. :)

kitchenrange

2009-03-05 09:09:14

Ive been using this since you released it and havent shown any thanks. The client is awesome and I couldnt tell you how to do any better. Thanks alot for the time. :)

Yakman

2009-03-05 14:47:05

since some people have said they will be using this, i feel it is my duty to suggest improvements because now its being used in the 'real world'.


String thisLine;
URL u = new URL("http://world81.runescape.com/a2,m0,j0,o0");
DataInputStream theHTML = new DataInputStream(u.openStream());
while ((thisLine = theHTML.readLine()) != null) {
HTMLsource = HTMLsource + thisLine;

this is a horrible way of doing it,

java strings are immutable, when you add them like that, you dont modify them but make a whole new string.
with the way you're doing it now, you will use 10x more memory then you should and take much longer (even though speed isnt the biggest issue)

also, HTMLSource should be called htmlSource or something that follows the java naming convention


also, readLine() doesnt return the line break itself, so you've lost one or two characters per line
iv seen some people try to compensate with something like this

while ((thisLine = theHTML.readLine()) != null) {
HTMLsource = HTMLsource + thisLine + '\n';

this isnt ideal either, because you dont know if readLine() found a "\n" char, or "\r" or even "\r\n"


also, you dont close 'theHTML' stream

i would suggest doing it this way

URL u = new URL("http://world81.runescape.com/a2,m0,j0,o0");
URLConnection urlcon = u.openConnection();
DataInputStream theHTML = new DataInputStream(urlcon.getInputStream());
byte[] buffer = new byte[urlcon.getContentLength()];
theHTML.readFully(buffer);
theHTML.close();

String htmlSource = new String(buffer);



dont feel bad though, a very similar technique is found in smart too


private String downloadHTML(String address) {
try {
URL url = new URL(address);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuilder builder = new StringBuilder();
String inputLine;
while((inputLine = in.readLine()) != null)
builder.append(inputLine).append("\n");
in.close();
return builder.toString();
}
catch(Exception e) {
e.printStackTrace();
}
return null;
}

</potshot@ben>




public final URL getDocumentBase() {
try {
return new URL("http://world81.runescape.com/");
} catch (Exception e) {
return null;
}
}

this is wrong, not what a normal browser returns

you should change it to this
new URL("http://world81.runescape.com/a2,m0,j0,o0");

you'll be pleased to know that your getCodeBase() is correct though



public final AppletContext getAppletContext() {
return null;
}

you really should write your own implementation of AppletContext, no real browser returns null on this method.
you dont have to actually do anything in those methods, since the applet has no way of knowing if you really opened a web page or whatever.
just make them return sane values

weequ

2009-03-05 14:48:09

Cool i downloaded the zip and the client was awsome :D
But if I would like to make the file from the text should i compile it or something or just save to .jar?

Grippy

2009-03-05 17:02:34

I usually play using the exe client that JagEx provides, which seems to be happy to run full screen HD on P2P and F2P, except that it puts a banner ad at the top for F2P. Other than the ad for F2P, do these do the same thing?

Cool stuff BTW, I was curious to see how that was done.

Freddy1990

2009-03-07 05:48:46

From: Grippy
I usually play using the exe client that JagEx provides, which seems to be happy to run full screen HD on P2P and F2P, except that it puts a banner ad at the top for F2P. Other than the ad for F2P, do these do the same thing?

Cool stuff BTW, I was curious to see how that was done.


This is completely different… This loads the java client directly, it doesn't use a browser… If you wanna learn how to mess with the client I'd suggest visiting the tutorial section at my community: http://rs-hacking.com/index.php/board,14.0.html

Richard

2009-03-08 06:10:47

Thats a pretty nice piece of work, how long did it take you?

And I'm being slow with my Java learning so it'll be ages before I do something useful :s

Grippy

2009-03-10 12:08:34

From: Freddy1990
This is completely different… This loads the java client directly, it doesn't use a browser


So presumably the Jagex Exe simply hosts an IE client which then loads the RS client?

Smartzkid

2009-03-10 18:56:51

Exactly.

noidea

2009-03-10 20:49:36

When I tried to use this on a laggy compute with SCAR, it often cashed, and put java errors in the file destination.

Smartzkid

2009-04-10 01:04:43

Yakman, could you give an example of a 'sane' AppletContext? One would need to write a whole class for it, correct?

import java.applet.Applet;
import java.applet.AppletContext;
import java.applet.AudioClip;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.Image;
import java.io.InputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLClassLoader;
import java.util.HashMap;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;


public class RSLoader extends javax.swing.JFrame implements java.applet.AppletStub {

private static final HashMap<String, String> parameters = new HashMap<String, String>();

public RSLoader() {
String htmlSource = "";
try {

setSize(768, 534);
setResizable(true);
this.setExtendedState(this.getExtendedState() | RSLoader.MAXIMIZED_BOTH);

Toolkit toolkit = Toolkit.getDefaultToolkit();
Dimension screenSize = toolkit.getScreenSize();
int x = (screenSize.width - this.getWidth()) / 2;
int y = (screenSize.height - this.getHeight()) / 2;
setLocation(x, y);

setTitle("Light Runescape Loader");

try {
URL u = new URL("http://world81.runescape.com/a2,m0,j0,o0");
URLConnection urlcon = u.openConnection();
DataInputStream theHTML = new DataInputStream(urlcon.getInputStream());
byte[] buffer = new byte[urlcon.getContentLength()];
theHTML.readFully(buffer);
theHTML.close();

htmlSource = new String(buffer);
}
catch (MalformedURLException e) {
System.err.println(e);
}

try {
Pattern regex = Pattern.compile("<param name=([^\\s]+)\\s+value=([^>]*)>", Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);
Matcher regexMatcher = regex.matcher(htmlSource);
while (regexMatcher.find())
if (!parameters.containsKey(regexMatcher.group(1)))
parameters.put(regexMatcher.group(1), regexMatcher.group(2));
} catch (PatternSyntaxException ex) {
ex.printStackTrace();
}

ClassLoader clientClassLoader = new URLClassLoader(
new URL[] { new URL(
"http://world81.runescape.com/loader_gl.jar") });
Class<?> clientClass = clientClassLoader.loadClass("loader");
Applet loader = (Applet) clientClass.newInstance();
loader.setStub(this);
loader.init();
loader.start();

JPopupMenu.setDefaultLightWeightPopupEnabled(false);
JPanel theGame = new JPanel(new BorderLayout());
theGame.setPreferredSize(new Dimension(769, 510));
setPreferredSize(new Dimension(769, 510));
theGame.add(loader);
getContentPane().add(loader, BorderLayout.CENTER);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}

public void appletResize(int width, int height) {
// TODO Auto-generated method stub

}

public final URL getCodeBase() {
try {
return new URL("http://world81.runescape.com/");
} catch (Exception e) {
return null;
}
}

public final URL getDocumentBase() {
try {
return new URL("http://world81.runescape.com/a2,m0,j0,o0");
} catch (Exception e) {
return null;
}
}

public final String getParameter(String name) {
return parameters.get(name);
}

public final AppletContext getAppletContext() {
return new aContext();
}

public static void main(String[] args) {
new RSLoader().setVisible(true);
}
}


class aContext implements AppletContext {

public AudioClip getAudioClip(URL url) {
return getAudioClip(url);
}

public Image getImage(URL url) {
return null;
}

public Applet getApplet(String name) {
return null;
}

public Enumeration getApplets() {
return null;
}

public void showDocument(URL url) {
return; //Is this 'proper', or should this method just be left blank?
}

public void showDocument(URL url, String frame) {
return;
}

public void showStatus(String message) {
return;
}

public void setStream(String key, InputStream stream) throws IOException {
return;
}

public InputStream getStream(String key) {
return null;
}

public Iterator<String> getStreamKeys() {
return null;
}
}

Yakman

2009-04-10 07:46:56

you need to store aContext in a field, you cant make a new instance of it every time getAppletContext() is invoked



public AudioClip getAudioClip(URL url) {
return getAudioClip(url);
}

infinate recursion much?

you need to write and AudioClip class too (it doesnt need to play sound remember)



for getImage() you can pass the URL to Toolkit.getImage()


you'll need to implement the getStream(), possibly just use a hashmap

pointer

2009-07-30 01:31:53

It is very nice, one problem though: the bigger I make it, the more of my CPU it eats, anyway to fix this easy?

ZaSz

2009-07-30 01:38:05

Im sure that would happen with the regular client??? Try using full screen on reg client.

pointer

2009-08-18 00:41:20

yeah… it seems to happen too, anyway nice st00f :D

Darkcorn

2009-08-27 01:24:22

wow dude,, wow . My computer is so slow but this will be even better for it. thank you man. now I wont have to wait like half a hour for runescape to come up. thank you dude. ive been using it and it helps. now it only takes me 5 mins to get to runescape. thank you so much!!!!!!!!!!!

robien

2009-08-27 01:30:36

runs well, thanks i like it alot

MasterKill

2009-10-03 20:24:48

Can some one remake this please? or post a working version? Thanks.

Tv-XxX

2009-10-08 13:48:02

IM BACK :)

Hopefully for good, sorry I've been away I got sucked into c++ and Direct3D programming… Its a nice place :) but here is nice aswel :) i love this community :)

anyways…

a working version is attached to this post, but the params are hard coded for now, so I'll release a better version ASAP :)

Yours
Tv.

MasterKill

2009-10-09 16:52:46

Thank you very much! I missed this!

<3

Tv-XxX

2009-10-10 16:02:51

No problem MasterKill

This version has the params so they arn't hard coded :) so its less likely that runescape will know your not using a webbrowser :)

I'll also update the download in the first post :)

Next job is putting a little reflection I think, but thats only if I get bored :P

Yours
Tv.

arash

2009-10-16 19:58:40

This is very nice, good work :)

AwesomeSRL

2009-10-17 18:12:28

From: Tv-XxX
No problem MasterKill

This version has the params so they arn't hard coded :) so its less likely that runescape will know your not using a webbrowser :)

I'll also update the download in the first post :)

Next job is putting a little reflection I think, but thats only if I get bored :P

Yours
Tv.


Could I see the source code plox? =]

MasterKill

2010-07-07 14:36:52

This is still working (yes I kinda started playing rs on my noob account again lol).

Just bumping to letting others who might be interested know.

mormonman

2010-07-07 16:28:55

From: MasterKill
This is still working (yes I kinda started playing rs on my noob account again lol).

Just bumping to letting others who might be interested know.


I wouldn't advise using it because Jagex has probably added more traps to the client and this hasn't been updated for a while.