I did a search on my comp. Found this. I think its made by xbox7887. Not sure.
Code: Select all
#include <fstream>
#include <iostream>
#include <iomanip>
#include <io.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <windows.h>
#include <malloc.h>
#include <stdio.h>
using namespace std;
// tune these to your specific processor for optimal performance
#define FILE_BUFFER_SIZE (1024 * 128) // must be a multiple of 128
#define CACHE_LINE_SIZE 64 // your processors cache line size, must be a multiple of 16
void main(unsigned int argc, char* argv[])
{
if (argc == 2)
{
// initialize local variables
int mapHandle, hashSize, oldHash, readCount, hashCount, hashRemainder, finalSig = 0;
// allocate file buffer
void* fileBuffer = _aligned_malloc(FILE_BUFFER_SIZE, CACHE_LINE_SIZE);
unsigned int before = GetTickCount();
_asm
{
// define some static registers
mov esi, fileBuffer
// open up map
push _S_IREAD
push _O_BINARY + _O_RDWR // _O_SEQUENTIAL flag actually makes this a shit ton slower for some insane reason :X
mov eax, argv
push [eax + 4]
call dword ptr [_open]
mov mapHandle, eax
// get some information from the header
push 2048
push fileBuffer
push mapHandle
call dword ptr [_read]
add esp, 0Ch
// calculate hash range size
mov ecx, [esi + 8]
sub ecx, 2048
mov hashSize, ecx
// save old hash
mov ecx, [esi + 720]
mov oldHash, ecx
// calculate iteration info
//readCount = hashSize / FILE_BUFFER_SIZE;
mov eax, hashSize
cdq
and edx,1FFFFh
add eax,edx
sar eax,11h
mov readCount, eax
//hashRemainder = hashSize % FILE_BUFFER_SIZE;
mov eax, hashSize
add esp,8
and eax,8001FFFFh
jns Done
dec eax
or eax,0FFFE0000h
inc eax
Done:
mov hashRemainder,eax
// initialize registers
xorpd xmm0, xmm0
xorpd xmm1, xmm1
xorpd xmm2, xmm2
xorpd xmm3, xmm3
xorpd xmm4, xmm4
xorpd xmm5, xmm5
xorpd xmm6, xmm6
xorpd xmm7, xmm7
// initialize main loop info
mov ebx, readCount
xor edi, edi // i counter
MainReadLoop:
cmp edi, ebx
jge MainReadLoopExit
//
pushad
push FILE_BUFFER_SIZE
push fileBuffer
push mapHandle
call dword ptr [_read]
add esp, 0Ch
popad
xor edx, edx // j counter
MainCalcLoop:
cmp edx, FILE_BUFFER_SIZE
jge MainCalcLoopExit
xorpd xmm0, [esi + edx]
xorpd xmm1, [esi + edx + 16]
xorpd xmm2, [esi + edx + 32]
xorpd xmm3, [esi + edx + 48]
xorpd xmm4, [esi + edx + 64]
xorpd xmm5, [esi + edx + 80]
xorpd xmm6, [esi + edx + 96]
xorpd xmm7, [esi + edx + 112]
add edx, 128
jmp MainCalcLoop
MainCalcLoopExit:
add edi, 1
jmp MainReadLoop
MainReadLoopExit:
// skip if there is no remainder
mov ebx, hashRemainder
test ebx, ebx
jz RemainderCalcLoopExit
//_read(mapHandle, fileBuffer, FILE_BUFFER_SIZE)
pushad
push ebx
push fileBuffer
push mapHandle
call dword ptr [_read]
add esp, 0Ch
popad
// initialize main loop info
xor edx, edx // i counter
RemainderCalcLoop:
cmp edx, ebx
jge RemainderCalcLoopExit
xorpd xmm0, [esi + edx]
xorpd xmm1, [esi + edx + 16]
xorpd xmm2, [esi + edx + 32]
xorpd xmm3, [esi + edx + 48]
xorpd xmm4, [esi + edx + 64]
xorpd xmm5, [esi + edx + 80]
xorpd xmm6, [esi + edx + 96]
xorpd xmm7, [esi + edx + 112]
add edx, 128
jmp RemainderCalcLoop
RemainderCalcLoopExit:
// save registers to memory
movdqa [esi], xmm0
movdqa [esi + 16], xmm1
movdqa [esi + 32], xmm2
movdqa [esi + 48], xmm3
movdqa [esi + 64], xmm4
movdqa [esi + 80], xmm5
movdqa [esi + 96], xmm6
movdqa [esi + 112], xmm7
// calculate final signature
xor eax, eax
xor ebx, ebx
FinalCalcLoop:
cmp ebx, 128
jge FinalCalcLoopExit
xor eax, [esi + ebx]
xor eax, [esi + ebx + 4]
xor eax, [esi + ebx + 8]
xor eax, [esi + ebx + 12]
xor eax, [esi + ebx + 16]
xor eax, [esi + ebx + 20]
xor eax, [esi + ebx + 24]
xor eax, [esi + ebx + 28]
add ebx, 32
jmp FinalCalcLoop
FinalCalcLoopExit:
mov finalSig, eax
}
unsigned int elapse = GetTickCount() - before;
// only update the signature if it changed
if (finalSig != oldHash)
{
lseek(mapHandle, 720, 0);
_write(mapHandle, &finalSig, 4);
cout << "The maps signature has now been updated." << endl;
}
else cout << "The old signature is already current. " << endl;
// close the map
_close(mapHandle);
// specify its usage
cout << "Elapsed time of " << elapse << " milliseconds."<< endl;
system("pause");
}
else
{
// specify its usage
cout << "To use you must drag and drop your map into\nthis executable or input the following command\ninto your command prompt window...\n\nLightningSigner.exe [Map Path]\n";
system("pause");
}
}