Results 1 to 2 of 2

Thread: IDA PRO pseudocode -> C++ (to libcod)

  1. #1
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts

    IDA PRO pseudocode -> C++ (to libcod)

    Guys, i need help for rewrite function of the game to Libcod.
    PHP Code:
    /* ORIGINAL: */
    void __cdecl sub_8077DBA(int a1char *a2int a3)
    {
      
    char *v3// eax@6
      
    int v4// ST14_4@9
      
    int v5// eax@9
      
    char *v6// eax@10

      
    if ( !a2 )
      {
        
    sub_80609A8(a1"<frozen thread>\n");
        return;
      }
      if ( (
    _UNKNOWN *)a2 == &unk_83D4100 )
      {
        
    sub_80609A8(a1"<removed thread>\n");
      }
      else
      {
        if ( 
    byte_839400A )
        {
          if ( 
    dword_8394048 && sub_80757CC((int)a2) )
          {
            
    v4 sub_8077D5A((unsigned int)(a2 1));
            
    v5 sub_807752A((unsigned int)(a2 1), a3);
            
    sub_8077B96(a1, *((_DWORD *)dword_8283ED4 v4 1), *((_BYTE **)dword_8283ED4 v4 2), v5);
            return;
          }
        }
        else if ( 
    sub_80757CC((int)(a2 1)) )
        {
          
    v3 sub_80B59CE("@ %d\n", &a2[-dword_8394048]);
          
    sub_80609A8(a1v3);
          return;
        }
        
    v6 sub_80B59CE("%s\n\n"a2);
        
    sub_80609A8(a1v6);
      }
    }
    // 839400A: using guessed type char byte_839400A;
    // 8394048: using guessed type int dword_8394048; 
    My attempt:
    PHP Code:
    /* SEMI-SHIT */
    void sub_8077DBA(int a1char *a2int a3)
    {
      
    //char *v3; // eax@6
      
    int v4// ST14_4@9
      
    int v5// eax@9
      
    char *v6// eax@10
      
      
    unsigned *unk_83D4100 = (int*)0x83D4100;
      
    char *byte_839400A = (int*)0x839400A;
      
    int *dword_8394048 = (int*)0x8394048;
      
    void *dword_8283ED4 = (int*)0x8283ED4;
      
      
    void (*sub_80609A8)(int a1char *s);
      *(
    int *)&sub_80609A8 0x80609A8;
      
    bool (*sub_80757CC)(int a1);
      *(
    int *)&sub_80757CC 0x80757CC;
      
    int (*sub_8077D5A)(unsigned int a1)$
      *(
    int *)&sub_8077D5A 0x8077D5A;
      
    int (*sub_807752A)(unsigned int a1int a2);
      *(
    int *)&sub_807752A 0x807752A;
      
    void (*sub_8077B96)(int a1int a2int *a3int a4);
      *(
    int *)&sub_8077B96 0x8077B96;
      
    char *(*sub_80B59CE)(char *format, ...);
      *(
    int *)&sub_80B59CE 0x80B59CE;
      
      if ( !
    a2 )
      {
        
    sub_80609A8(a1"<frozen thread>\n");
        return;
      }
      if ( (
    int *)a2 == &unk_83D4100 )
      {
        
    sub_80609A8(a1"<removed thread>\n");
      }
      else
      {
        if ( 
    byte_839400A )
        {
          if ( 
    dword_8394048 && sub_80757CC((int)a2) )
          {
            
    v4 sub_8077D5A((unsigned int)(a2 1));
            
    v5 sub_807752A((unsigned int)(a2 1), a3);
            
    sub_8077B96(a1, *((float *)dword_8283ED4 v4 1), *((int **)dword_8283ED4 v4 2), v5);
            return;
          }
        }
        
    /* THIS NO NEED
        else if ( sub_80757CC((int)(a2 - 1)) )
        {
          v3 = sub_80B59CE("@ %d\n", &a2[-dword_8394048]);
          sub_80609A8(a1, v3);
          return;
        }*///!!!!!!!!!!!!!!!!!!!
        
    v6 sub_80B59CE("%s\n\n"a2);
        
    sub_80609A8(a1v6);
      }

    i rewrited functions, args, addresses
    Last edited by maxdamage99; 29th June 2020 at 11:57.
    PHP Code:
    class CoronaVirus 
    {
       
    CoronaVirus(int m 1): multi(m) { Peoples.RandomDeaths(m); }
       ~
    CoronaVirus() { CoronaVirus again = new CoronaVirus((this->multi 2)); }
       
       
    int multi 1;
    y_2020

  2. #2
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,010
    Thanks
    2,102
    Thanked 1,083 Times in 753 Posts
    You need to fix the hardcoded addresses at least: https://killtube.org/showthread.php?...rking-C-source
    timescale 0.01

  3. The Following User Says Thank You to kung foo man For This Useful Post:

    kubislav23 (29th September 2017)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •