Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - asdfghgghjdhg

#1
SC2 Tools / Re: StarCraft II Launcher
March 07, 2010, 05:04:54 PM
here is example to start sc2 w/o any launchers:


procedure TForm1.Button1Click(Sender: TObject);
var
SInfo: STARTUPINFO;
  PInfo: PROCESS_INFORMATION;
  hFile: THandle;
  Base: Pointer;
  cur: Pointer;
  PID: DWORD;
  Started: boolean;
begin
ZeroMemory(@SInfo, SizeOf(SInfo));
  SInfo.cb := SizeOf(SInfo);
  ZeroMemory(@PInfo, SizeOf(PInfo));
if CreateProcess(PChar(exe), nil, nil, nil, false, CREATE_SUSPENDED, nil, PChar(Dir), SInfo, PInfo) then
   begin
     hFile := CreateFileMapping(INVALID_HANDLE_VALUE, nil, PAGE_EXECUTE_READWRITE, 0, $10000, 'StarCraft II IPC Mem');
   if hFile <> INVALID_HANDLE_VALUE then
       begin
         Base := MapViewOfFile(hFile, FILE_MAP_ALL_ACCESS, 0, 0, $10000);
     if Base <> nil then
           begin
             cur := Base;
       ZeroMemory(cur, $10000);
              inc(PByte(cur), $20);
              PByte(cur)^ := $04;
              PID := GetCurrentProcessId;
              inc(PByte(cur), 8);
              PDWord(cur)^ := PID;
              inc(PByte(cur), 4);
       PDWord(cur)^ := $00000001;
              inc(PDWord(cur), 7);
              PDWord(cur)^ := $00000002;
              inc(PDWord(cur));
       PDWord(cur)^ := $FFFFFFFF;
       inc(PDWord(cur), 2);
              PDWord(cur)^ := $FFFFFFFF;
              inc(PDWord(cur), 2);
              StrPCopy(PAnsiChar(cur), AnsiString(Map));
              ResumeThread(Pinfo.hThread);
              Started := false;
       repeat
               cur := Base;
               inc(PByte(cur), $20);
               if PByte(cur)^ = $05 then
                begin
                  inc(PByte(cur), 4);
                 if PByte(cur)^ = $01 then
                   begin
                   PByte(cur)^ := 0;
                      Started := true;
                 end;
                 end;
              until Started;
            end;
        end;

      CloseHandle(hFile);
    end;
  CloseHandle(Pinfo.hThread);
  CloseHandle(PInfo.hProcess);
end;
#2
AI Development / Re: Map Disassembling
March 05, 2010, 06:28:09 AM
i think this is right:

struct  MapInfo
{
  DWORD   magic;  // 'MapI'
  u32     unknown1;   //  0x15
  u32     width;
  u32     height;
  u32     unknown2;   // version?? depth??
  u32     unknown3;   // subversion??
  char    tileset[];
  char    title[];
  u32     boundryLeft;
  u32     boundryBottom;
  u32     boundryRight;
  u32     boundryTop;
  u32     unknown4;
  u32     unknown5;
  char    loaderImagePath[];
  u32     loaderImageFormat;  // enum names are made-up
          {
            stretch_none       = 0x00,
            stretch_fullscreen = 0x01,
            stretch_widescreen = 0x02
          }
  u32     unknown6; // (-1)
  u32     unknown7;
  u32     unknown8;
  u32     unknownWidth;
  u32     unknownHeight;
  u32     unknown9;
  u32     unknown10;
  u32      playerCount;
  struct playerStruct
  {
    u8      index;
    u8      owner;
            {
              c_playerTypeNone      = 0,
              c_playerTypeUser      = 1,
              c_playerTypeComputer  = 2,
              c_playerTypeNeutral   = 3,
              c_playerTypeHostile   = 4,
              c_playerTypeReferee   = 5,
              c_playerTypeSpectator = 6
            }
    u8      pUnk3;
    u8      pUnk4;
    u8      pUnk5;
    u32    color
               {
                  c_Red = 1
                  c_Blue = 2
                  ... and so on as in war3
               }
    char    playerName[] with finishing zero; mb other struct
    u8      pUnk6;
    u8      pUnk7;
    u8      pUnk8;
    u8      pUnk9;
    u8      pUnk10;
    u8      pUnk11;
    u8      pUnk12;
    u8      pUnk13;
    u32      pUnk14; some kind of player race, value grater 0 makes computer play terran, dont work for player
     u8       finishing zero (for what?)
  } [playerCount];
 
  // unknown
}
#3
SC2 Tools / Re: StarCraft II Launcher
March 05, 2010, 05:24:55 AM
i check MapInfo and here is what i found:

i think that player info struct have 23 bytes at least as follows

[byte] - player number. 0x00 - neutral (observer), 0x01..0x0F - player
[byte] - controlled by. 0x00 - not controlled (disabled), 0x01 - player control, 0x02 - computer control, 0x03 - neutral
[byte] - unknown for me
[byte] - unknown for me
[byte] - unknown for me
[dword][4 bytes] - color. 0x00000001..0x0000000C colors as they are in war3, 0xFFFFFFFF - random color
[... bytes] - some kind of string or struct. unknown for me
[byte] - finishing zero for some kind of string or struct. must be 0x00
[8 bytes] - unknown for me
[dword][4 bytes] - i'm not really sure, but 0x00000000 gives random race, other values (cannot check all) give terran but only for computer cotrolled player
[byte] - finishing zero (for player struct?). must be 0x00.

mb that will be useful

update: before player structs here is DWORD value of players count.