Make 1 : 1 Copies of UT 2003

I find this and is very good.
Thnks to Khaine

---------------------------------------------------------------------------------------
If you have a legit copy of UT2K3, then could you try and make a copy using this code.

I cannot take any credit for this, it was all CD Freaks Expert blackcheck, from the cdfreaks board.




code:--------------------------------------------------------------------------------
/* twinpeak.cpp */


#include <windows.h>
#include <stdio.h>



HANDLE hImgFile = INVALID_HANDLE_VALUE, hSubFile = INVALID_HANDLE_VALUE;

DWORD dwImgFileSize, dwSubFileSize;
DWORD dwSectorCount;

DWORD* dwSectorTable = NULL;



void Exit()
{
// clean up stuff
if(hImgFile != INVALID_HANDLE_VALUE) CloseHandle(hImgFile);
if(hSubFile != INVALID_HANDLE_VALUE) CloseHandle(hSubFile);
if (dwSectorTable != NULL) delete dwSectorTable;
ExitProcess(0);
}

bool OpenImageFile(char * szFileName)
{
char szName[256];

// construct file name
lstrcpy(szName, szFileName);
lstrcat(szName,".img");

// open the file
hImgFile= CreateFile(szName, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);

if(hImgFile==INVALID_HANDLE_VALUE) {
printf("cannot open input file: \n");
return false;
}

// get the filesize;
dwImgFileSize = GetFileSize(hImgFile,0);

return true;
}

bool OpenSubFile(char * szFileName)
{
char szName[256];

// construct file name
lstrcpy(szName, szFileName);
lstrcat(szName,".sub");

// open the file
hSubFile= CreateFile(szName, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);

if(hSubFile==INVALID_HANDLE_VALUE) {
printf("cannot open subchannel file: \n");
return false;
}

// get the filesize;
dwSubFileSize = GetFileSize(hSubFile,0);

return true;
}

void CreateTwinSectorList()
{
dwSectorTable = new DWORD[dwSectorCount];
if(dwSectorTable == NULL) Exit();

for(DWORD dwCount=0; dwCount < dwSectorCount; dwCount++) {
dwSectorTable[dwCount]=1;
}
}

void InsertTwinSectors(int nRangeStart, int nRangeEnd, int nTwinCount, int nStep)
{
int nRangeLength = nRangeEnd - nRangeStart;

for(int nCount=nRangeStart; nCount < nRangeStart+nRangeLength; nCount+= nStep) {
dwSectorTable[nCount] += nTwinCount;
}
}

void ShowInfo()
{
DWORD dwNewSectors = 0;

// get new sector count
for(DWORD dwCount=0; dwCount < dwSectorCount; dwCount++) {
dwNewSectors += dwSectorTable[dwCount];
}

printf("Original sector count: %d",dwSectorCount);
printf(" (%d) mb\n",dwSectorCount/512);

printf("New sector count: %d",dwNewSectors);
printf(" (%d) mb\n",dwNewSectors/512);
}

void WriteNewImgFile()
{
HANDLE hFile;
DWORD dwSize = 2352;
BYTE aData[3000];

DWORD dwStarCounter = 0;

printf("\nNow writing image file:");

// try to open the file
hFile= CreateFile("patched.img",GENERIC_READ | GENERIC_WRITE,0,NULL,CREATE_ALWAYS,0,NULL);
if(hFile==INVALID_HANDLE_VALUE) {
printf("\nerror: cannot write new image file");
Exit();
}

// write the new file with twin sectors
for(DWORD dwCount = 0;dwCount<dwSectorCount;dwCount++) {
if( ReadFile(hImgFile, aData, dwSize, &dwSize, 0) == 0 ) {
printf("\nerror: cannot read image file");
Exit();
}

for(DWORD dwRepeat = 0; dwRepeat < dwSectorTable[dwCount] ;dwRepeat++) {
if( WriteFile(hFile, aData, dwSize, &dwSize, 0) == 0) {
printf("\nerror: cannot write image file");
Exit();
}
}

// update funky stars
dwStarCounter++;
if(dwStarCounter == dwSectorCount/10) {
printf("*");
dwStarCounter=0;
}
}


CloseHandle(hFile);
}

void WriteNewSubFile()
{
HANDLE hFile;
DWORD dwSize = 96;
BYTE aData[3000];

DWORD dwStarCounter = 0;

printf("\nNow writing subchannel file: ");

// try to open the file
hFile= CreateFile("patched.sub",GENERIC_READ | GENERIC_WRITE,0,NULL,CREATE_ALWAYS,0,NULL);
if(hFile==INVALID_HANDLE_VALUE) {
printf("\nerror: cannot write new subchannel file");
Exit();
}

// write the new file with twin sectors
for(DWORD dwCount = 0;dwCount<dwSectorCount;dwCount++) {
if( ReadFile(hSubFile, aData, dwSize, &dwSize, 0) == 0 ) {
printf("\nerror: cannot read subchannel file");
Exit();
}
for(DWORD dwRepeat = 0; dwRepeat < dwSectorTable[dwCount] ;dwRepeat++) {
if( WriteFile(hFile, aData, dwSize, &dwSize, 0)== 0 ) {
printf("\nerror: cannot write subchannel file");
Exit();
}
}

// update funky stars
dwStarCounter++;
if(dwStarCounter == dwSectorCount/10) {
printf("*");
dwStarCounter=0;
}
}


CloseHandle(hFile);
}


void main(int nArgs, char *szArgs[])
{
printf("TwinPeak v0.1\n\n");

// check command line
if(nArgs < 2) {
printf("\nusage: twinpeak <ccd image name without ext.>\n");
Exit();
}

// open image file
if(!OpenImageFile(szArgs[1])) {
Exit();
}

// open subchannel file
if(!OpenSubFile(szArgs[1])) {
Exit();
}

// check sector count
dwSectorCount = dwImgFileSize / 2352;
if(dwSectorCount*2352 != dwImgFileSize) {
printf("\nerror: image file size is no multiple of 2352\n");
Exit();
}

// check subchannel size
if(dwSectorCount*96 != dwSubFileSize) {
printf("\nerror: subchannel file does not match image file\n");
Exit();
}

// initialize list
CreateTwinSectorList();

/* check out the mds file
of UT2003 german to see
where to put twin sectors */

InsertTwinSectors( 1700, 2300, 1, 6);
InsertTwinSectors( 3600, 4900, 1, 6);
InsertTwinSectors( 5500, 6600, 1, 6);
InsertTwinSectors( 6900, 7400, 1, 6);
InsertTwinSectors( 8300, 8800, 1, 6);
InsertTwinSectors( 9100, 9600, 1, 6);
InsertTwinSectors( 10100, 10600, 1, 6);
InsertTwinSectors( 10800, 11400, 1, 6);
InsertTwinSectors( 12600, 13100, 1, 6);
InsertTwinSectors( 13400, 14500, 1, 6);
InsertTwinSectors( 15500, 16100, 1, 6);
InsertTwinSectors( 16200, 16800, 1, 6);
InsertTwinSectors( 17500, 18600, 1, 6);
InsertTwinSectors( 19000, 19600, 1, 6);
InsertTwinSectors( 19900, 20400, 1, 6);
InsertTwinSectors( 20600, 21000, 1, 6);
InsertTwinSectors( 21600, 22100, 1, 6);
InsertTwinSectors( 23400, 23900, 1, 6);
InsertTwinSectors( 24400, 25400, 1, 6);
InsertTwinSectors( 26000, 26800, 1, 6);
InsertTwinSectors( 27100, 27600, 1, 6);
InsertTwinSectors( 28200, 29400, 1, 6);
InsertTwinSectors( 29600, 30000, 1, 6);
InsertTwinSectors( 30600, 31200, 1, 6);
InsertTwinSectors( 31800, 33600, 1, 6);
InsertTwinSectors( 33800, 34400, 1, 6);

// show some details
ShowInfo();

// write new files
WriteNewImgFile();
WriteNewSubFile();

printf("\ndone.");
Exit();
}

--------------------------------------------------------------------------------


This means that secureROM 4 is not uncopyable !!!!!
 
Hmmm..yeah looks more complicated than need be.Blindwrite and Alcohol are having success with new Securom versions.;)
 
Twinpeak is already compiled & a recent release has even implemented a gui, serch for this around the net.
 
Top