View Full Version : {great way to start from a blank source}!!crash patched servers!!{+tut}
Fenway`
June 24th, 2010, 05:22
i thought this was very necessary to be posted on here so i did since nobody else has.
pre-patched servers by blakeman
IF YOUR SERVER IS NOT ALREADY PATCHED IT STRONGLY ADVISED THAT YOU DO THAT USING THE TUTORIAL BELOW
this thread will be updated alot
Crash-Patched Servers
BlakeScape (Winterlove) - Only the registered members can see the link.
CheezScape 80 - Only the registered members can see the link.
Devolution X - Only the registered members can see the link.
Emulous 1.7 - Only the registered members can see the link.
WhiteScape - Only the registered members can see the link.
Contents of the patch
Patching servers is simple - we first replace the Cryption class with a better performing, and legal (the current one is ripped from a deob) implementation of ISAAC Cipher Generation. This new Cryption class will not throw an ArrayIndexOutOfBounds exception on construction due to the cipher seed being too large, which was the fault of the old one. Finally, we add exception handling (three try/catch statements) to the main PlayerHandler process method - one for each loop, and the patch is complete.
I will no longer be patching servers for people personally, as that just supports closed-source development. If you want a crash-patched server, you'll have to use one of these "vanilla" server bases, or apply the crash patch yourself. Sorry for the inconvenience.
Fenway`
June 24th, 2010, 05:22
Crash-Patch Your Server
creds to johnny and blakeman
Purpose: Following this tutorial will result in the fix for winterLove's 'random' crashing, aswell as improving your cryption and stopping alot of the crashing issues in your server. These fixes were discovered by blakeman8192, with help by Graham i believe? blakeman8192 offered a service to do this to your server for free; but was not used now you can all do it yourselves.
I HIGHLY RECOMMEND DOING THIS TO YOUR SERVER IF IT IS NOT ALREADY DONE
Difficulty: 1 / 10 (Copy and Paste)
For Delta / WinterLove / BattleScape:
Step 1:
Open your "Cryption.java"
Step 2:
Replace your Cryption.java with this..
/**
*
* @author Bob Jenkins
**/
public class Cryption {
private static final int SIZEL = 8; // Log of size of rsl[] and mem[]
private static final int SIZE = 1 << SIZEL; // Size of rsl[] and mem[]
private static final int MASK = (SIZE - 1) << 2; // For pseudorandom lookup
private int count; // Count through the results in rsl[]
private int[] rsl; // The results given to the user
private int[] mem; // The internal state
private int a; // Accumulator
private int b; // The last result
private int c; // Counter, guarantees cycle is at least 2^40
/**
* This constructor creates and initializes an new instance without using a
* seed.<br>
* Equivalent to <code>randinit(ctx,FALSE)</code> in the C implementation.
*/
public Cryption() {
mem = new int[SIZE];
rsl = new int[SIZE];
init(false);
}
/**
* This constructor creates and initializes an new instance using a
* user-provided seed.<br>
* Equivalent to <code>randinit(ctx, TRUE)</code> after putting seed in
* <code>randctx</code> in the C implementation.
*
* @param seed
* The seed.
*/
public Cryption(int[] seed) {
mem = new int[SIZE];
rsl = new int[SIZE];
// This is slow and throws an ArrayIndexOutOfBoundsException if
// seed.length > rsl.length ...
/*
* for (int i = 0; i < seed.length; ++i) rsl[i] = seed[i];
*/
// ... this is faster and safe:
System.arraycopy(seed, 0, rsl, 0,
(seed.length <= rsl.length) ? seed.length : rsl.length);
init(true);
}
/**
* Get a random integer value.
*/
public final int getNextKey() {
if (0 == count--) {
isaac();
count = SIZE - 1;
}
return (rsl[count]);
}
/**
* Initialize or reinitialize this instance.
*
* @param flag
* If <code>true</code> then use the seed (which the constructor
* placed in <code>rsl[]</code>) for initialization.
*/
private final void init(boolean flag) {
int i;
int a, b, c, d, e, f, g, h;
a = b = c = d = e = f = g = h = 0x9e3779b9; // The golden ratio
for (i = 0; i < 4; ++i) {
a ^= b << 11;
d += a;
b += c;
b ^= c >>> 2;
e += b;
c += d;
c ^= d << 8;
f += c;
d += e;
d ^= e >>> 16;
g += d;
e += f;
e ^= f << 10;
h += e;
f += g;
f ^= g >>> 4;
a += f;
g += h;
g ^= h << 8;
b += g;
h += a;
h ^= a >>> 9;
c += h;
a += b;
}
for (i = 0; i < SIZE; i += 8) { // Fill in mem[] with messy stuff
if (flag) {
a += rsl[i];
b += rsl[i + 1];
c += rsl[i + 2];
d += rsl[i + 3];
e += rsl[i + 4];
f += rsl[i + 5];
g += rsl[i + 6];
h += rsl[i + 7];
}
a ^= b << 11;
d += a;
b += c;
b ^= c >>> 2;
e += b;
c += d;
c ^= d << 8;
f += c;
d += e;
d ^= e >>> 16;
g += d;
e += f;
e ^= f << 10;
h += e;
f += g;
f ^= g >>> 4;
a += f;
g += h;
g ^= h << 8;
b += g;
h += a;
h ^= a >>> 9;
c += h;
a += b;
mem[i] = a;
mem[i + 1] = b;
mem[i + 2] = c;
mem[i + 3] = d;
mem[i + 4] = e;
mem[i + 5] = f;
mem[i + 6] = g;
mem[i + 7] = h;
}
if (flag) { // Second pass: makes all of seed affect all of mem[]
for (i = 0; i < SIZE; i += 8) {
a += mem[i];
b += mem[i + 1];
c += mem[i + 2];
d += mem[i + 3];
e += mem[i + 4];
f += mem[i + 5];
g += mem[i + 6];
h += mem[i + 7];
a ^= b << 11;
d += a;
b += c;
b ^= c >>> 2;
e += b;
c += d;
c ^= d << 8;
f += c;
d += e;
d ^= e >>> 16;
g += d;
e += f;
e ^= f << 10;
h += e;
f += g;
f ^= g >>> 4;
a += f;
g += h;
g ^= h << 8;
b += g;
h += a;
h ^= a >>> 9;
c += h;
a += b;
mem[i] = a;
mem[i + 1] = b;
mem[i + 2] = c;
mem[i + 3] = d;
mem[i + 4] = e;
mem[i + 5] = f;
mem[i + 6] = g;
mem[i + 7] = h;
}
}
isaac();
count = SIZE;
}
/**
* Generate 256 results.<br>
* This is a small (not fast) implementation.
*/
private final void isaac() {
int i, x, y;
b += ++c;
for (i = 0; i < SIZE; ++i) {
x = mem[i];
switch (i & 3) {
case 0:
a ^= a << 13;
break;
case 1:
a ^= a >>> 6;
break;
case 2:
a ^= a << 2;
break;
case 3:
a ^= a >>> 16;
break;
}
a += mem[(i + SIZE / 2) & (SIZE - 1)];
mem[i] = y = mem[((x) & MASK) >> 2] + a + b;
rsl[i] = b = mem[((y >> SIZEL) & MASK) >> 2] + x;
}
}
/**
* Reseeds this random object.<br>
* The given seed supplements (using bitwise xor), rather than replaces, the
* existing seed.
*
* @param seed
* An integer array containing the seed.
*/
public final void supplementSeed(int[] seed) {
for (int i = 0; i < seed.length; i++)
mem[i % mem.length] ^= seed[i];
}
}
Step 3:
Inside PlayerHandler.java
find..
for(int i = 0; i < maxPlayers; i++) {
if(players[i] == null || !players[i].isActive) continue;
players[i].actionAmount--;
players[i].preProcessing();
while(players[i].process());
players[i].postProcessing();
players[i].getNextPlayerMovement();
if(players[i].playerName.equalsIgnoreCase(kickNick))
{
players[i].kick();
kickNick="";
}
if(players[i].disconnected) {
if(saveGame(players[i])){ System.out.println("Game saved for player "+players[i].playerName); } else { System.out.println("Could not save for "+players[i].playerName); };
removePlayer(players[i]);
players[i] = null;
}
}
Replace the above with..
for(int i = 0; i < maxPlayers; i++) {
if(players[i] == null || !players[i].isActive) continue;
try {
players[i].actionAmount--;
players[i].preProcessing();
while(players[i].process());
players[i].postProcessing();
players[i].getNextPlayerMovement();
if(players[i].playerName.equalsIgnoreCase(kickNick))
{
players[i].kick();
kickNick="";
}
if(players[i].disconnected) {
if(saveGame(players[i])){ System.out.println("Game saved for player "+players[i].playerName); } else { System.out.println("Could not save for "+players[i].playerName); };
removePlayer(players[i]);
players[i] = null;
}
} catch (Exception ex) {
}
}
Now find...
for(int i = 0; i < maxPlayers; i++) {
if(players[i] == null || !players[i].isActive) continue;
if(players[i].disconnected) {
if(saveGame(players[i])){ System.out.println("Game saved for player "+players[i].playerName); } else { System.out.println("Could not save for "+players[i].playerName); };
removePlayer(players[i]);
players[i] = null;
}
else {
if(!players[i].initialized) {
players[i].initialize();
players[i].initialized = true;
}
else players[i].update();
}
}
And replace that with...
for(int i = 0; i < maxPlayers; i++) {
try {
if(players[i] == null || !players[i].isActive) continue;
if(players[i].disconnected) {
if(saveGame(players[i])){ System.out.println("Game saved for player "+players[i].playerName); } else { System.out.println("Could not save for "+players[i].playerName); };
removePlayer(players[i]);
players[i] = null;
}
else {
if(!players[i].initialized) {
players[i].initialize();
players[i].initialized = true;
}
else players[i].update();
}
} catch (Exception ex) {
}
}
You have now Crash Patched your server completely! Enjoy basic stability!!
Fenway`
June 24th, 2010, 05:23
For Emulous / RiotScape:
Step 1:
Find "ISAACRandomGen.java" - (It's in server/util)
Step 2:
Replace everything in ISAACRandomGen with the following...
package server.util;
public class ISAACRandomGen {
private static final int SIZEL = 8; // Log of size of rsl[] and mem[]
private static final int SIZE = 1 << SIZEL; // Size of rsl[] and mem[]
private static final int MASK = (SIZE - 1) << 2; // For pseudorandom lookup
private int count; // Count through the results in rsl[]
private int[] rsl; // The results given to the user
private int[] mem; // The internal state
private int a; // Accumulator
private int b; // The last result
private int c; // Counter, guarantees cycle is at least 2^40
/**
* This constructor creates and initializes an new instance without using a
* seed.<br>
* Equivalent to <code>randinit(ctx,FALSE)</code> in the C implementation.
*/
public ISAACRandomGen() {
mem = new int[SIZE];
rsl = new int[SIZE];
init(false);
}
/**
* This constructor creates and initializes an new instance using a
* user-provided seed.<br>
* Equivalent to <code>randinit(ctx, TRUE)</code> after putting seed in
* <code>randctx</code> in the C implementation.
*
* @param seed
* The seed.
*/
public ISAACRandomGen(int[] seed) {
mem = new int[SIZE];
rsl = new int[SIZE];
// This is slow and throws an ArrayIndexOutOfBoundsException if
// seed.length > rsl.length ...
/*
* for (int i = 0; i < seed.length; ++i) rsl[i] = seed[i];
*/
// ... this is faster and safe:
System.arraycopy(seed, 0, rsl, 0,
(seed.length <= rsl.length) ? seed.length : rsl.length);
init(true);
}
/**
* Get a random integer value.
*/
public final int getNextKey() {
if (0 == count--) {
isaac();
count = SIZE - 1;
}
return (rsl[count]);
}
/**
* Initialize or reinitialize this instance.
*
* @param flag
* If <code>true</code> then use the seed (which the constructor
* placed in <code>rsl[]</code>) for initialization.
*/
private final void init(boolean flag) {
int i;
int a, b, c, d, e, f, g, h;
a = b = c = d = e = f = g = h = 0x9e3779b9; // The golden ratio
for (i = 0; i < 4; ++i) {
a ^= b << 11;
d += a;
b += c;
b ^= c >>> 2;
e += b;
c += d;
c ^= d << 8;
f += c;
d += e;
d ^= e >>> 16;
g += d;
e += f;
e ^= f << 10;
h += e;
f += g;
f ^= g >>> 4;
a += f;
g += h;
g ^= h << 8;
b += g;
h += a;
h ^= a >>> 9;
c += h;
a += b;
}
for (i = 0; i < SIZE; i += 8) { // Fill in mem[] with messy stuff
if (flag) {
a += rsl[i];
b += rsl[i + 1];
c += rsl[i + 2];
d += rsl[i + 3];
e += rsl[i + 4];
f += rsl[i + 5];
g += rsl[i + 6];
h += rsl[i + 7];
}
a ^= b << 11;
d += a;
b += c;
b ^= c >>> 2;
e += b;
c += d;
c ^= d << 8;
f += c;
d += e;
d ^= e >>> 16;
g += d;
e += f;
e ^= f << 10;
h += e;
f += g;
f ^= g >>> 4;
a += f;
g += h;
g ^= h << 8;
b += g;
h += a;
h ^= a >>> 9;
c += h;
a += b;
mem[i] = a;
mem[i + 1] = b;
mem[i + 2] = c;
mem[i + 3] = d;
mem[i + 4] = e;
mem[i + 5] = f;
mem[i + 6] = g;
mem[i + 7] = h;
}
if (flag) { // Second pass: makes all of seed affect all of mem[]
for (i = 0; i < SIZE; i += 8) {
a += mem[i];
b += mem[i + 1];
c += mem[i + 2];
d += mem[i + 3];
e += mem[i + 4];
f += mem[i + 5];
g += mem[i + 6];
h += mem[i + 7];
a ^= b << 11;
d += a;
b += c;
b ^= c >>> 2;
e += b;
c += d;
c ^= d << 8;
f += c;
d += e;
d ^= e >>> 16;
g += d;
e += f;
e ^= f << 10;
h += e;
f += g;
f ^= g >>> 4;
a += f;
g += h;
g ^= h << 8;
b += g;
h += a;
h ^= a >>> 9;
c += h;
a += b;
mem[i] = a;
mem[i + 1] = b;
mem[i + 2] = c;
mem[i + 3] = d;
mem[i + 4] = e;
mem[i + 5] = f;
mem[i + 6] = g;
mem[i + 7] = h;
}
}
isaac();
count = SIZE;
}
/**
* Generate 256 results.<br>
* This is a small (not fast) implementation.
*/
private final void isaac() {
int i, x, y;
b += ++c;
for (i = 0; i < SIZE; ++i) {
x = mem[i];
switch (i & 3) {
case 0:
a ^= a << 13;
break;
case 1:
a ^= a >>> 6;
break;
case 2:
a ^= a << 2;
break;
case 3:
a ^= a >>> 16;
break;
}
a += mem[(i + SIZE / 2) & (SIZE - 1)];
mem[i] = y = mem[((x) & MASK) >> 2] + a + b;
rsl[i] = b = mem[((y >> SIZEL) & MASK) >> 2] + x;
}
}
/**
* Reseeds this random object.<br>
* The given seed supplements (using bitwise xor), rather than replaces, the
* existing seed.
*
* @param seed
* An integer array containing the seed.
*/
public final void supplementSeed(int[] seed) {
for (int i = 0; i < seed.length; i++)
mem[i % mem.length] ^= seed[i];
}
}
Step 3:
Inside PlayerHandler.java
find..
for(int i = 0; i < maxPlayers; i++) {
if(players[i] == null || !players[i].isActive) continue;
players[i].actionAmount--;
players[i].preProcessing();
while(players[i].process());
players[i].postProcessing();
players[i].getNextPlayerMovement();
if(players[i].playerName.equalsIgnoreCase(kickNick))
{
players[i].kick();
kickNick="";
}
if(players[i].disconnected) {
if(saveGame(players[i])){ System.out.println("Game saved for player "+players[i].playerName); } else { System.out.println("Could not save for "+players[i].playerName); };
removePlayer(players[i]);
players[i] = null;
}
}
Replace the above with..
for(int i = 0; i < maxPlayers; i++) {
if(players[i] == null || !players[i].isActive) continue;
try {
players[i].actionAmount--;
players[i].preProcessing();
while(players[i].process());
players[i].postProcessing();
players[i].getNextPlayerMovement();
if(players[i].playerName.equalsIgnoreCase(kickNick))
{
players[i].kick();
kickNick="";
}
if(players[i].disconnected) {
if(saveGame(players[i])){ System.out.println("Game saved for player "+players[i].playerName); } else { System.out.println("Could not save for "+players[i].playerName); };
removePlayer(players[i]);
players[i] = null;
}
} catch (Exception ex) {
}
}
Now find...
for(int i = 0; i < maxPlayers; i++) {
if(players[i] == null || !players[i].isActive) continue;
if(players[i].disconnected) {
if(saveGame(players[i])){ System.out.println("Game saved for player "+players[i].playerName); } else { System.out.println("Could not save for "+players[i].playerName); };
removePlayer(players[i]);
players[i] = null;
}
else {
if(!players[i].initialized) {
players[i].initialize();
players[i].initialized = true;
}
else players[i].update();
}
}
And replace that with...
for(int i = 0; i < maxPlayers; i++) {
try {
if(players[i] == null || !players[i].isActive) continue;
if(players[i].disconnected) {
if(saveGame(players[i])){ System.out.println("Game saved for player "+players[i].playerName); } else { System.out.println("Could not save for "+players[i].playerName); };
removePlayer(players[i]);
players[i] = null;
}
else {
if(!players[i].initialized) {
players[i].initialize();
players[i].initialized = true;
}
else players[i].update();
}
} catch (Exception ex) {
}
}
You have just increased the stability in your Emulous / RiotScape server!!
Fenway`
June 24th, 2010, 05:51
this server release/tutorial is now finished.
you may now post :D
fr00zen
June 24th, 2010, 06:04
Nice job but i don't think it deserves sticky tbh.
Fenway`
June 30th, 2010, 00:50
whatever you say -.-
xLightning
June 30th, 2010, 14:00
@317: Does the PlayerHandler.java part work on DeltaCleaned?
Canownueasy`
June 30th, 2010, 14:27
You can't ask for sticky's - and it's not even yours.
Ryan
June 30th, 2010, 14:31
Nice job but i don't think it deserves sticky tbh.
You can't ask for sticky's - and it's not even yours.
I agree with both of those. You just put two pieces of other peoples work and put them in the same thread.
Fenway`
July 1st, 2010, 19:29
happy?
lukycrabz
July 8th, 2010, 02:29
i have a question when i run my delta based server i get a ton of nulls in the run.bat cmd that just keep popping up would this fix that or what is my problem?
xaviergmail
July 13th, 2010, 14:49
Nice job but i don't think it deserves sticky tbh.
it does... Go and get urself crashed by ur lil 2 years old brother that uses a walmart 'DoSer' that only needs to ping your server once with 1 byte of data to get crashed
{EDIT} Forgot to thank you, thanks! :D im using devo :) (l)
Fenway`
July 19th, 2010, 17:25
i have a question when i run my delta based server i get a ton of nulls in the run.bat cmd that just keep popping up would this fix that or what is my problem?
use deltaclean not the original delta
Pyro Sauce
August 24th, 2010, 16:41
um ok so this might sound kinda retarded but eh.... is there a characters.txt in emulous 1.7 crash-patched? cos uh..i cant find it O_o
Edit: also how do i add objects to emulous...like stealy things were u can get gp...its objectmanager in PI but i have no fuckin idea what it is in emulous
Cryptic
September 9th, 2010, 13:17
I dont really belive that you done all this?
Bunni
September 18th, 2010, 11:35
I like this. :D
pixelpwn
September 19th, 2010, 01:37
GREAT JOB FENWAy i always luve ur posts
samuraiblood2
September 21st, 2010, 14:39
These fixes were discovered by blakeman8192, with help by Graham i believe?
I was the one who helped Blake with this, not Graham, he had nothing to do with this. I actually had another thread (before the harddrive crash which resulted in these new forums) that had more servers "crash patched". I may be willing to upload them again (assuming I can find them) if anyone wants.
Powered by vBulletin® Version 4.1.9 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.