SteamWar/FightSystem
Archiviert
13
1

Revised Techhiderversion 14.04.

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2020-04-14 08:03:12 +02:00
Ursprung 26d8fe4451
Commit 087843f963

Datei anzeigen

@ -125,39 +125,55 @@ public class TechHider_15 {
buffer.writeBytes(data, i, dataArrayLengthLength);
i += dataArrayLengthLength;
ByteBuf chunkData = UnpooledByteBufAllocator.DEFAULT.directBuffer(dataArrayLength * 8);
chunkData.writeBytes(data, i, dataArrayLength * 8);
int arrayEnd = dataArrayLength * 8 + i;
System.out.println("i:" + i + " dataArrayLength: " + dataArrayLength + " arrayEnd:" + arrayEnd + " data.length:" + data.length);
int bitsOver = 0;
int lastBits = 0;
while(i < arrayEnd){
int currentPos = 64 + bitsOver;
long values = (long)data[i] << 56 | (long)data[i+1] << 48 | (long)data[i+2] << 40 | (long)data[i+3] << 32 | data[i+4] << 24 | data[i+5] << 16 | data[i+6] << 8 | data[i+7];
int bitsOver = 0; // Anzahl an Bits, die aus dem letzten Durchlauf noch über sind
int lastBits = 0; // Die letzten Bits aus dem vorigen Durchlauf
while(chunkData.readableBytes() > 0){
int currentPos = 70 - bitsOver; // 14 * 5, Die Größe des Bitshifts, der durchgeführt werden muss, um den ersten Block zu lesen
if(currentPos >= 64)
currentPos -= 14;
long values = chunkData.readLong();
long result = 0;
do{
currentPos -= 14;
System.out.println("currentPos: " + currentPos);
int newLastBits = (int)(values >> currentPos);
while(currentPos >= 0){
int blockId = (int)(values >> currentPos) & 0x3FFF;
if(currentPos > 64-14){
blockId <<= bitsOver;
blockId |= lastBits;
if(currentPos > 50){ //64 - 14, Prüfen auf Ende des Longs
int offset = 14 - (currentPos - 50);
if(arrayEnd <= i+15)
System.out.println("Array Overflow!!!! i: " + i + " currentPos:" + currentPos + " bitsOver:" + bitsOver + " lastBits:" + lastBits);
blockId |= (data[i+14] << (offset + 8) | data[i+15] << offset) & 0x3FFF;
}
if(Config.HiddenBlocks.contains(blockId))
blockId = Config.ObfuscateWith;
result <<= 14;
result |= blockId;
}while(currentPos >= 14);
bitsOver = currentPos;
lastBits = (int)values;
if(currentPos > 0){
values |= data[i+15] << bitsOver | data[i+14] << (bitsOver + 8);
if(Config.HiddenBlocks.contains((int)values & 0x3FFF))
values = Config.ObfuscateWith;
result <<= currentPos;
result |= (values & (65536 >> (16-currentPos)));
currentPos -= 14;
}
if(currentPos > -14){ //Überprüfen der ersten Bits
int blockId = ((int)values << -currentPos | lastBits) & 0x3FFF;
if(Config.HiddenBlocks.contains(blockId))
blockId = Config.ObfuscateWith;
result <<= (14 + currentPos);
result |= blockId >> -currentPos;
}
lastBits = newLastBits;
bitsOver += 8;
if(bitsOver >= 14)
bitsOver -= 14;
buffer.writeLong(result);
i += 8;
}