Results 1 to 6 of 6

Thread: Unmatched functions between CoD

  1. #1
    Private
    Join Date
    Jun 2015
    Posts
    13
    Thanks
    5
    Thanked 3 Times in 3 Posts

    Unmatched functions between CoD

    Hi, I am trying to port to libcod to CoDUO. I am in this situation where in CoD 2, the subroutine (marked as 1 in the screenshot) is a seperate function while it is a set of instructions (marked as 2) in CoDUO.

    Click image for larger version. 

Name:	Capture.PNG 
Views:	18 
Size:	427.2 KB 
ID:	1639

    Is there a way to "extract" the subroutine?

  2. The Following User Says Thank You to ebusiangamers For This Useful Post:

    kung foo man (31st August 2020)

  3. #2
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    426
    Thanks
    78
    Thanked 102 Times in 86 Posts
    There is not much code, you can describe it as your own function (translate pseudocode in C/C++)

    You can analyze the function in which this section is located, it is possible to call the upper function with certain parameters, which guarantees that this piece of code is called and only it is called

    Here is a translation example, simple and straightforward:
    https://github.com/damage99/libcod/b...layer.cpp#L830


    If you need to replace only a piece of code, but leave the main function unchanged, then the simplest options are to analyze the conditions and, if they match (this subroutine is called in the original) - replace it with a function call that you translated from pseudocode; if the conditions are different, just call the original function
    *like this:
    https://github.com/damage99/libcod/b...ibcod.cpp#L139
    : only you need to analyze the input arguments of this function, when you understand that the required subroutine should be called, then call reworked_func(), if not, then call original_func()
    Last edited by maxdamage99; 1st September 2020 at 06:09.
    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

  4. The Following User Says Thank You to maxdamage99 For This Useful Post:

    kung foo man (2nd September 2020)

  5. #3
    Private
    Join Date
    Jun 2015
    Posts
    13
    Thanks
    5
    Thanked 3 Times in 3 Posts
    How about equivalent offset? Is there an efficient way to recover them?

  6. #4
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    426
    Thanks
    78
    Thanked 102 Times in 86 Posts
    Quote Originally Posted by ebusiangamers View Post
    How about equivalent offset? Is there an efficient way to recover them?

    What do you mean? Will give an example of what you need
    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

  7. #5
    Private
    Join Date
    Jun 2015
    Posts
    13
    Thanks
    5
    Thanked 3 Times in 3 Posts

  8. The Following User Says Thank You to ebusiangamers For This Useful Post:

    kung foo man (8th September 2020)

  9. #6
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    631
    Thanks
    196
    Thanked 429 Times in 289 Posts
    Quote Originally Posted by ebusiangamers View Post
    How about equivalent offset? Is there an efficient way to recover them?
    In CoD2, I look for a text close to a function that uses the player client address and then find the same text in other versions.
    This might work depending on much difference between 2 and UO.

    Edit: you might be able to find some of the addresses if you find and decode one of the player GSC functions like GetStance() or getEntityNumber and the kick function too.
    Last edited by Mitch; 6th September 2020 at 15:28.

  10. The Following User Says Thank You to Mitch For This Useful Post:

    kung foo man (8th September 2020)

Posting Permissions

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