program ccgoldcrack; uses crt, dos; type languageExe = Record idstring:string[25]; offset:integer; end; var f:file; const // Input key codes checkString:array[1..3] of languageExe = ( (idstring: 'you are critically low on'; offset: $DFD9C), (idstring: 'Nicht genug Festplattenpl'; offset: $E0870), (idstring: 'Espace disque insuffisant'; offset: $E0AB0)); procedure cntin; var pause: char; begin writeln; write('Press any key to continue.'); repeat until keypressed; pause:=ReadKey(); end; {cntin} function uppercase(str:string):String; var i:integer; begin for i:=1 to length(str) do if (byte(str[i])>=97) and (byte(str[i])<=122) then str[i]:=char(byte(str[i])-32); uppercase:=str; end; function readStr(address,length:Integer):String; var i:integer; actual:word; buffer:array [1..255] of byte; begin readStr:=''; if filesize(f) >= address then begin seek(f,address); blockread (f,buffer,length,actual); for i:=1 to length do readStr:=readStr+char(buffer[i]); end; end; function CorrectExe(id:integer):boolean; begin CorrectExe:=(readStr(checkString[id].offset,25)=checkString[id].idstring); end; procedure hackdat; var offset, offset2, cdhack :integer; data:array [1..39] of byte; teller,status:integer; actual:word; begin assign(f,ParamStr(1)); {$I-} reset(f,1); status:=IOResult; if status<>0 then begin writeln(); writeln('Error opening "',ParamStr(1),'"'); end else begin offset2:=0; if CorrectExe(1) then begin write('English'); offset:= 91930; offset2:= 124860; cdhack:=811772; data[3] :=101; data[4] :=110; end else if CorrectExe(2) then begin write('German'); offset:= 91930; offset2:= 125028; cdhack:=814348; data[3] :=100; data[4] :=101; end else if CorrectExe(3) then begin write('French'); offset:= 91930; offset2:= 124964; cdhack:=814572; data[3] :=102; data[4] :=114; end; if offset2=0 then begin writeln(); writeln(); writeln('Cannot identify exe file.'); end else begin writeln(' version detected.'); writeln(); write('Patching...'); data[1] :=102; data[2] :=184; data[5] :=102; data[6] :=137; data[7] :=4; data[8] :=36; data[9] :=144; data[10]:=144; for teller:=1 to 10 do Begin seek(f,offset); blockwrite(f,data[teller],1,actual); offset:=offset+1; end; data[11]:=184; data[12]:=1; data[13]:=0; data[14]:=0; data[15]:=0; data[16]:=190; data[17]:=1; data[18]:=0; data[19]:=0; data[20]:=0; data[21]:=195; offset:= offset2; for teller:=11 to 21 do Begin seek(f,offset); blockwrite(f,data[teller],1,actual); offset:=offset+1; end; offset:=offset+573; seek(f,offset); blockwrite(f,235,1,actual); offset:=cdhack; seek(f,offset); blockwrite(f,144,1,actual); seek(f,offset+1); blockwrite(f,144,1,actual); seek(f,offset+61); blockwrite(f,144,1,actual); seek(f,offset+62); blockwrite(f,144,1,actual); close(f); {$I+} writeln(' Done.'); writeln(); writeln(); writeln('The game will no longer ask for a CD, and will expect the CD files to be in'); writeln('the game directory. Additionally, the subdirectory "',uppercase(char(data[3])), uppercase(char(data[4])),'" can also be used to'); writeln('store CD files.') end; end; end; {hackdat} begin writeln('Command & Conquer Gold NoCD Patch Written by Nyerguds'); writeln('---------------------------------'); writeln(); if ParamCount = 0 then writeln('Drop a copy of C&C95.exe onto the icon of this program to patch it.') else hackdat; cntin; end.