[App] - C++.NET Map Resigner (Source)

Utilities designed primarily for the xbox version of Halo 2.
User avatar
DemonicSandwich




Advisor Connoisseur

Posts: 1198
Joined: Sat Sep 30, 2006 6:10 pm
Location:

Re: [App] - C++.NET Map Resigner (Source)

Post by DemonicSandwich »

iBotPeaches wrote:Appears the move from phpbb2 to phpbb3. Messed up this download.

Anyone have it?
It was messed up well before that. :?
AIM wrote:Demonic5andwich (6:10:10 PM): structure of a first person weapon animation:
Demonic5andwich (6:10:43 PM): mess, mess, maybe a node?, another header?! wtf!, more mess, tacos, more shit
Domnio





Posts: 199
Joined: Sun Jul 16, 2006 3:44 pm
Location: Earth
Contact:

Re: [App] - C++.NET Map Resigner (Source)

Post by Domnio »

despite the fact this topic is about 2 years old, I too would like to have a peek at it's source code. Could anyone reupload this please?
RaVNzCRoFT removed my signature because it contained too many lines of text. I'll read the rules next time.
User avatar
Eaton




Enthraller

Posts: 1639
Joined: Thu Jun 14, 2007 4:16 pm
Location: USA

Re: [App] - C++.NET Map Resigner (Source)

Post by Eaton »

Domnio wrote:despite the fact this topic is about 2 years old, I too would like to have a peek at it's source code. Could anyone reupload this please?
Read the posts before you. No one seems to have it. I too would like it, but no one has it. :|
Image
User avatar
grimdoomer




System Engineer

Posts: 1440
Joined: Mon Oct 09, 2006 4:36 pm

Re: [App] - C++.NET Map Resigner (Source)

Post by grimdoomer »

This isen't hard to recreate. All he did was goto 2048, and use assembly to xor every int.
Image
AI Zones in MP | Ambiance | Gravemind Beta v1.1
Aumaan Anubis wrote:Grimdoomer. The first person ever to mod Halo 2 Vista.
User avatar
SpecOp44




Advisor Recreator Snitch! Critic

Posts: 2008
Joined: Tue Jun 06, 2006 12:34 pm
Location: The Canadarm

Re: [App] - C++.NET Map Resigner (Source)

Post by SpecOp44 »

Here.
Attachments
Lightning Resigner Source.rar
(67.23 KiB) Downloaded 30 times
Image
User avatar
Eaton




Enthraller

Posts: 1639
Joined: Thu Jun 14, 2007 4:16 pm
Location: USA

Re: [App] - C++.NET Map Resigner (Source)

Post by Eaton »

SpecOp44 wrote:Here.
Thank you! :shock:
Image
User avatar
JacksonCougAr




Recreator

Posts: 2333
Joined: Fri Jan 12, 2007 1:56 pm
Location: Canada
Contact:

Re: [App] - C++.NET Map Resigner (Source)

Post by JacksonCougAr »

Similar speed as what I already had from xbox7887, so meh.
OwnZ joO




Articulatist 500

Posts: 980
Joined: Thu Nov 10, 2005 4:24 pm

Re: [App] - C++.NET Map Resigner (Source)

Post by OwnZ joO »

Would you like to post that code for all to see? I think I remember you said it involved a buffered read or MemoryStream(can't remember which). I messed with a MemoryStream a while before you had mentioned that, but it didn't produce any faster results for me, I didn't extensively mess with it though because in reality it really doesn't take thaaaat long to resign a file, although faster is better.
User avatar
JacksonCougAr




Recreator

Posts: 2333
Joined: Fri Jan 12, 2007 1:56 pm
Location: Canada
Contact:

Re: [App] - C++.NET Map Resigner (Source)

Post by JacksonCougAr »

Code: Select all

public void Resign()
        {
            int size = (int)Length - 2048;
            int times = size / 4;
            int result = 0;
            int buffersize = 512;
            byte[] buffer;
            Position = 2048;
            for (int i = 0; i < times/buffersize; i++)
            {
                buffer = ReadBytes(buffersize);
                for(int x=0;x<buffersize;x+=4)
                {
                    result ^= BitConverter.ToInt32(buffer, x);
                }
            }
            Header.Checksum = result;
        }
I never really tested it, so the loops might fail, meh.
User avatar
iBotPeaches





Posts: 78
Joined: Tue Aug 08, 2006 9:22 am
Location: Corral
Contact:

Re: [App] - C++.NET Map Resigner (Source)

Post by iBotPeaches »

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");
	}
}
Image
Post Reply