Changeset 489 for tools


Ignore:
Timestamp:
Sep 8, 2010, 10:10:56 PM (14 years ago)
Author:
george
Message:
  • Opraveno: Podpora pro kontrolu hodních nulových bajtů v čtveřici adres a tím detekce posunu pole za sekvencí.
  • Opraveno: Funkční pro herního klienta 3.3.5a.
Location:
tools/wow_patcher
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tools/wow_patcher/wowpatcher.lpi

    r474 r489  
    22<CONFIG>
    33  <ProjectOptions>
    4     <Version Value="7"/>
     4    <Version Value="9"/>
    55    <General>
    66      <Flags>
    77        <MainUnitHasCreateFormStatements Value="False"/>
    88        <MainUnitHasTitleStatement Value="False"/>
    9         <UseDefaultCompilerOptions Value="True"/>
    109      </Flags>
    11       <MainUnit Value="0"/>
    12       <TargetFileExt Value=""/>
    1310      <Title Value="wowpatcher"/>
    1411      <ResourceType Value="res"/>
    1512      <UseXPManifest Value="True"/>
    1613      <Icon Value="0"/>
    17       <ActiveEditorIndexAtStart Value="0"/>
     14      <ActiveWindowIndexAtStart Value="0"/>
    1815    </General>
    1916    <VersionInfo>
    2017      <Language Value=""/>
    2118      <CharSet Value=""/>
    22       <StringTable Comments="" CompanyName="" FileDescription="" FileVersion="" InternalName="" LegalCopyright="" LegalTrademarks="" OriginalFilename="" ProductName="" ProductVersion=""/>
     19      <StringTable ProductVersion=""/>
    2320    </VersionInfo>
    2421    <PublishOptions>
     
    3431      </local>
    3532    </RunParams>
    36     <Units Count="4">
     33    <Units Count="5">
    3734      <Unit0>
    3835        <Filename Value="wowpatcher.pas"/>
    3936        <IsPartOfProject Value="True"/>
    4037        <UnitName Value="wowpatcher"/>
    41         <CursorPos X="37" Y="168"/>
    42         <TopLine Value="150"/>
     38        <IsVisibleTab Value="True"/>
    4339        <EditorIndex Value="0"/>
    44         <UsageCount Value="49"/>
    45         <Loaded Value="True"/>
     40        <WindowIndex Value="0"/>
     41        <TopLine Value="123"/>
     42        <CursorPos X="21" Y="134"/>
     43        <UsageCount Value="50"/>
     44        <Loaded Value="True"/>
     45        <LoadedDesigner Value="True"/>
    4646      </Unit0>
    4747      <Unit1>
    4848        <Filename Value="/usr/share/fpcsrc/rtl/objpas/sysutils/syspchh.inc"/>
     49        <EditorIndex Value="2"/>
     50        <WindowIndex Value="0"/>
     51        <TopLine Value="11"/>
    4952        <CursorPos X="10" Y="40"/>
    50         <TopLine Value="11"/>
    51         <EditorIndex Value="1"/>
    52         <UsageCount Value="23"/>
     53        <UsageCount Value="24"/>
    5354        <Loaded Value="True"/>
    5455      </Unit1>
    5556      <Unit2>
    5657        <Filename Value="/usr/share/fpcsrc/rtl/inc/stringsi.inc"/>
     58        <EditorIndex Value="3"/>
     59        <WindowIndex Value="0"/>
     60        <TopLine Value="4"/>
    5761        <CursorPos X="23" Y="58"/>
    58         <TopLine Value="4"/>
    59         <EditorIndex Value="2"/>
    60         <UsageCount Value="23"/>
     62        <UsageCount Value="24"/>
    6163        <Loaded Value="True"/>
    6264      </Unit2>
    6365      <Unit3>
    6466        <Filename Value="/usr/share/fpcsrc/rtl/inc/genstr.inc"/>
     67        <TopLine Value="98"/>
    6568        <CursorPos X="15" Y="224"/>
    66         <TopLine Value="98"/>
    6769        <UsageCount Value="7"/>
    6870      </Unit3>
     71      <Unit4>
     72        <Filename Value="/usr/share/fpcsrc/rtl/objpas/objpas.pp"/>
     73        <UnitName Value="objpas"/>
     74        <EditorIndex Value="1"/>
     75        <WindowIndex Value="0"/>
     76        <TopLine Value="9"/>
     77        <CursorPos X="8" Y="28"/>
     78        <UsageCount Value="11"/>
     79        <Loaded Value="True"/>
     80      </Unit4>
    6981    </Units>
    70     <JumpHistory Count="30" HistoryIndex="29">
     82    <JumpHistory Count="30" HistoryIndex="28">
    7183      <Position1>
    7284        <Filename Value="wowpatcher.pas"/>
    73         <Caret Line="96" Column="17" TopLine="78"/>
     85        <Caret Line="95" Column="1" TopLine="76"/>
    7486      </Position1>
    7587      <Position2>
    7688        <Filename Value="wowpatcher.pas"/>
    77         <Caret Line="95" Column="1" TopLine="76"/>
     89        <Caret Line="97" Column="1" TopLine="78"/>
    7890      </Position2>
    7991      <Position3>
    8092        <Filename Value="wowpatcher.pas"/>
    81         <Caret Line="96" Column="1" TopLine="77"/>
     93        <Caret Line="98" Column="1" TopLine="79"/>
    8294      </Position3>
    8395      <Position4>
    8496        <Filename Value="wowpatcher.pas"/>
    85         <Caret Line="95" Column="1" TopLine="76"/>
     97        <Caret Line="99" Column="1" TopLine="80"/>
    8698      </Position4>
    8799      <Position5>
    88100        <Filename Value="wowpatcher.pas"/>
    89         <Caret Line="96" Column="1" TopLine="77"/>
     101        <Caret Line="98" Column="1" TopLine="79"/>
    90102      </Position5>
    91103      <Position6>
    92104        <Filename Value="wowpatcher.pas"/>
    93         <Caret Line="95" Column="1" TopLine="76"/>
     105        <Caret Line="99" Column="1" TopLine="80"/>
    94106      </Position6>
    95107      <Position7>
    96108        <Filename Value="wowpatcher.pas"/>
    97         <Caret Line="97" Column="1" TopLine="78"/>
     109        <Caret Line="100" Column="1" TopLine="81"/>
    98110      </Position7>
    99111      <Position8>
    100112        <Filename Value="wowpatcher.pas"/>
    101         <Caret Line="98" Column="1" TopLine="79"/>
     113        <Caret Line="85" Column="64" TopLine="84"/>
    102114      </Position8>
    103115      <Position9>
    104116        <Filename Value="wowpatcher.pas"/>
    105         <Caret Line="99" Column="1" TopLine="80"/>
     117        <Caret Line="149" Column="1" TopLine="131"/>
    106118      </Position9>
    107119      <Position10>
    108120        <Filename Value="wowpatcher.pas"/>
    109         <Caret Line="98" Column="1" TopLine="79"/>
     121        <Caret Line="117" Column="24" TopLine="98"/>
    110122      </Position10>
    111123      <Position11>
    112124        <Filename Value="wowpatcher.pas"/>
    113         <Caret Line="99" Column="1" TopLine="80"/>
     125        <Caret Line="157" Column="5" TopLine="125"/>
    114126      </Position11>
    115127      <Position12>
    116128        <Filename Value="wowpatcher.pas"/>
    117         <Caret Line="100" Column="1" TopLine="81"/>
     129        <Caret Line="159" Column="65" TopLine="128"/>
    118130      </Position12>
    119131      <Position13>
    120132        <Filename Value="wowpatcher.pas"/>
    121         <Caret Line="85" Column="64" TopLine="84"/>
     133        <Caret Line="157" Column="1" TopLine="130"/>
    122134      </Position13>
    123135      <Position14>
    124136        <Filename Value="wowpatcher.pas"/>
    125         <Caret Line="149" Column="1" TopLine="131"/>
     137        <Caret Line="158" Column="49" TopLine="121"/>
    126138      </Position14>
    127139      <Position15>
    128140        <Filename Value="wowpatcher.pas"/>
    129         <Caret Line="117" Column="24" TopLine="98"/>
     141        <Caret Line="76" Column="60" TopLine="55"/>
    130142      </Position15>
    131143      <Position16>
    132144        <Filename Value="wowpatcher.pas"/>
    133         <Caret Line="157" Column="5" TopLine="125"/>
     145        <Caret Line="148" Column="23" TopLine="125"/>
    134146      </Position16>
    135147      <Position17>
    136148        <Filename Value="wowpatcher.pas"/>
    137         <Caret Line="159" Column="65" TopLine="128"/>
     149        <Caret Line="118" Column="29" TopLine="99"/>
    138150      </Position17>
    139151      <Position18>
    140152        <Filename Value="wowpatcher.pas"/>
    141         <Caret Line="157" Column="1" TopLine="130"/>
     153        <Caret Line="132" Column="42" TopLine="110"/>
    142154      </Position18>
    143155      <Position19>
    144156        <Filename Value="wowpatcher.pas"/>
    145         <Caret Line="158" Column="49" TopLine="121"/>
     157        <Caret Line="129" Column="12" TopLine="110"/>
    146158      </Position19>
    147159      <Position20>
    148160        <Filename Value="wowpatcher.pas"/>
    149         <Caret Line="76" Column="60" TopLine="55"/>
     161        <Caret Line="21" Column="50" TopLine="2"/>
    150162      </Position20>
    151163      <Position21>
    152164        <Filename Value="wowpatcher.pas"/>
    153         <Caret Line="148" Column="23" TopLine="125"/>
     165        <Caret Line="108" Column="40" TopLine="102"/>
    154166      </Position21>
    155167      <Position22>
    156168        <Filename Value="wowpatcher.pas"/>
    157         <Caret Line="118" Column="29" TopLine="99"/>
     169        <Caret Line="133" Column="22" TopLine="114"/>
    158170      </Position22>
    159171      <Position23>
    160172        <Filename Value="wowpatcher.pas"/>
    161         <Caret Line="132" Column="42" TopLine="110"/>
     173        <Caret Line="20" Column="43" TopLine="2"/>
    162174      </Position23>
    163175      <Position24>
    164176        <Filename Value="wowpatcher.pas"/>
    165         <Caret Line="129" Column="12" TopLine="110"/>
     177        <Caret Line="76" Column="55" TopLine="76"/>
    166178      </Position24>
    167179      <Position25>
    168180        <Filename Value="wowpatcher.pas"/>
    169         <Caret Line="21" Column="50" TopLine="2"/>
     181        <Caret Line="138" Column="15" TopLine="119"/>
    170182      </Position25>
    171183      <Position26>
    172184        <Filename Value="wowpatcher.pas"/>
    173         <Caret Line="108" Column="40" TopLine="102"/>
     185        <Caret Line="164" Column="39" TopLine="154"/>
    174186      </Position26>
    175187      <Position27>
    176188        <Filename Value="wowpatcher.pas"/>
    177         <Caret Line="133" Column="22" TopLine="114"/>
     189        <Caret Line="173" Column="54" TopLine="143"/>
    178190      </Position27>
    179191      <Position28>
    180192        <Filename Value="wowpatcher.pas"/>
    181         <Caret Line="20" Column="43" TopLine="2"/>
     193        <Caret Line="168" Column="28" TopLine="132"/>
    182194      </Position28>
    183195      <Position29>
    184196        <Filename Value="wowpatcher.pas"/>
    185         <Caret Line="76" Column="55" TopLine="76"/>
     197        <Caret Line="131" Column="15" TopLine="123"/>
    186198      </Position29>
    187199      <Position30>
    188200        <Filename Value="wowpatcher.pas"/>
    189         <Caret Line="138" Column="15" TopLine="119"/>
     201        <Caret Line="218" Column="1" TopLine="180"/>
    190202      </Position30>
    191203    </JumpHistory>
    192204  </ProjectOptions>
    193205  <CompilerOptions>
    194     <Version Value="8"/>
     206    <Version Value="9"/>
    195207    <Target>
    196208      <Filename Value="wowpatcher"/>
     
    200212      <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
    201213    </SearchPaths>
    202     <Parsing>
    203       <SyntaxOptions>
    204         <UseAnsiStrings Value="True"/>
    205       </SyntaxOptions>
    206     </Parsing>
    207214    <CodeGeneration>
    208215      <Checks>
  • tools/wow_patcher/wowpatcher.pas

    r474 r489  
    99  Classes, SysUtils, CustApp
    1010  { you can add units after this };
     11
     12const
     13  Version = '1.2';
     14  ReleaseDate = '2010-09-08';
    1115
    1216type
     
    3842  ErrorMsg: String;
    3943begin
     44  WriteLn('wowpatcher ' + Version + ' ' + ReleaseDate);
    4045  if HasOption('h', 'help') then begin
    4146    WriteHelp;
     
    126131  Position: Integer;
    127132  I: Integer;
     133  Shift: Integer;
     134  NotValid: Boolean;
    128135const
    129136  StartSequence: array[0..15] of Integer = ($8D, $4D, $E8, $E8, -1, -1, -1, -1, $5B, $8B, $E5, $5D, $C3, $8D, $49, $00);
    130137  StartSequence2: array[0..15] of Integer = ($88, $1D, -1, -1, -1, -1, $E8, -1, -1, -1, -1, $5B, $8B, $E5, $5D, $C3);
    131138begin
    132   OriginalFile := TFileStream.Create(FileName, fmOpenRead);
    133   NewFile := TFileStream.Create(NewFileName, fmCreate);
    134   SetLength(Buffer, OriginalFile.Size);
    135   OriginalFile.Read(Buffer[0], Length(Buffer));
    136   OriginalFile.Destroy;
    137 
    138   WriteLn;
    139   Write('Searching for first sequence ');
    140   WriteHexData(StartSequence, 0, Length(StartSequence));
    141   Write('...');
    142   Position := FindSequence(Buffer, StartSequence, 0);
    143   if Position <> -1 then begin
    144     WriteLn('found at ' + IntToHex(Position, 8));
    145     Inc(Position, Length(StartSequence));
    146     WriteLn('Changing data after sequence');
    147     WriteHexData(Buffer, Position, 16);
    148     for I := 0 to 11 do
    149       Buffer[Position + I] := Buffer[Position + 12 + (I mod 4)];
    150     WriteLn(' => ');
    151     WriteHexData(Buffer, Position, 16);
     139  try
     140    NewFile := TFileStream.Create(NewFileName, fmCreate);
     141    try
     142      OriginalFile := TFileStream.Create(FileName, fmOpenRead);
     143      SetLength(Buffer, OriginalFile.Size);
     144      OriginalFile.Read(Buffer[0], Length(Buffer));
     145    finally
     146      OriginalFile.Free;
     147    end;
     148
    152149    WriteLn;
    153   end else WriteLn('not found');
    154 
    155   WriteLn;
    156   Write('Searching for second sequence ');
    157   WriteHexData(StartSequence2, 0, Length(StartSequence2));
    158   Write('...');
    159   Position := FindSequence(Buffer, StartSequence2);
    160   if Position <> -1 then begin
    161     WriteLn('found at ' + IntToHex(Position, 8));
    162     Inc(Position, Length(StartSequence2));
    163     WriteLn('Changing data after sequence');
    164     WriteHexData(Buffer, Position, 16);
    165     for I := 0 to 11 do
    166       Buffer[Position + I] := Buffer[Position + 12 + (I mod 4)];
    167     WriteLn(' => ');
    168     WriteHexData(Buffer, Position, 16);
     150    Write('Searching for first sequence ');
     151    WriteHexData(StartSequence, 0, Length(StartSequence));
     152    Write('...');
     153    Position := FindSequence(Buffer, StartSequence, 0);
     154    if Position <> -1 then begin
     155      WriteLn('found at ' + IntToHex(Position, 8));
     156      Inc(Position, Length(StartSequence));
     157      if FindSequence(Buffer, StartSequence, Position) <> -1 then
     158        WriteLn('Multiple occurence found - ambiguous')
     159      else begin
     160        Shift := 0;
     161        repeat
     162          NotValid := False;
     163          for I := 0 to 3 do
     164            if Buffer[Position + Shift + 3 + I * 4] <> 0 then NotValid := True;
     165          if NotValid then Inc(Shift);
     166          if Shift > 100 then begin
     167            WriteLn('No valid data found after sequence');
     168            Exit;
     169          end;
     170        until not NotValid;
     171        if Shift > 0 then WriteLn('Data shift after sequence: ' + IntToStr(Shift));
     172        Position := Position + Shift;
     173
     174        WriteLn('Changing data after sequence');
     175        WriteHexData(Buffer, Position, 16);
     176        for I := 0 to 11 do
     177          Buffer[Position + I] := Buffer[Position + 12 + (I mod 4)];
     178        WriteLn(' => ');
     179        WriteHexData(Buffer, Position, 16);
     180      end;
     181      WriteLn;
     182    end else WriteLn('not found');
     183
    169184    WriteLn;
    170   end else WriteLn('not found');
    171 
    172   NewFile.WriteBuffer(Buffer[0], Length(Buffer));
    173   NewFile.Destroy;
     185    Write('Searching for second sequence ');
     186    WriteHexData(StartSequence2, 0, Length(StartSequence2));
     187    Write('...');
     188    Position := FindSequence(Buffer, StartSequence2);
     189    if Position <> -1 then begin
     190      WriteLn('found at ' + IntToHex(Position, 8));
     191      Inc(Position, Length(StartSequence2));
     192      if FindSequence(Buffer, StartSequence2, Position) <> -1 then begin
     193        WriteLn('Multiple occurence found - ambiguous')
     194      end else begin
     195        Shift := 0;
     196        repeat
     197          NotValid := False;
     198          for I := 0 to 3 do
     199            if Buffer[Position + Shift + 3 + I * 4] <> 0 then NotValid := True;
     200          if NotValid then Inc(Shift);
     201          if Shift > 100 then begin
     202            WriteLn('No valid data found after sequence');
     203            Exit;
     204          end;
     205        until not NotValid;
     206        if Shift > 0 then WriteLn('Data shift after sequence: ' + IntToStr(Shift));
     207        Position := Position + Shift;
     208
     209        WriteLn('Changing data after sequence');
     210        WriteHexData(Buffer, Position, 16);
     211        for I := 0 to 11 do
     212          Buffer[Position + I] := Buffer[Position + 12 + (I mod 4)];
     213        WriteLn(' => ');
     214        WriteHexData(Buffer, Position, 16);
     215      end;
     216      WriteLn;
     217    end else WriteLn('not found');
     218
     219    NewFile.WriteBuffer(Buffer[0], Length(Buffer));
     220  finally
     221    NewFile.Free;
     222  end;
    174223end;
    175224
Note: See TracChangeset for help on using the changeset viewer.