Temple+ Modding Question

Discussion in 'General Modification' started by _doug_, Feb 21, 2018.

Remove all ads!
  1. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,613
    Likes Received:
    537
    I assumed you were talking about Dispatcher events. D20 signals are basically a category of those.

    S_Spell_Cast is called inside the perform function of D20A_CAST_SPELL (d20.cpp, line 2808). It comes after the spell has been successfully registered and target list compiled, but before the action frame callback and the python begin_spell script. It's sent to caster and spell targets.
     
  2. _doug_

    _doug_ Established Member

    Joined:
    Jul 9, 2009
    Messages:
    290
    Likes Received:
    117
    Cool! I bet I can make that do the trick.

    On another note, could you explain the difference between redirectCall and replaceFunction?

    Thanks!
     
  3. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,613
    Likes Received:
    537
    replaceFunction completely replaces a function. Every call to it is redirected. It is accomplished by writing a jump instruction at the beginning of the function itself.

    redirectCall replaces a single call to a function. It's useful when you don't want to rewrite an entire function for your changes (e.g. if it has a chain of functions that are not of CDECL calling convention).
     
  4. _doug_

    _doug_ Established Member

    Joined:
    Jul 9, 2009
    Messages:
    290
    Likes Received:
    117
    OK cool. That was about what my understanding was.

    Do they work together? For example can I modify a function with redirectCall, then override it with replaceFunction and in my new function call the modified version after or before doing some stuff?
     
  5. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,613
    Likes Received:
    537
    If you're replacing a whole function, why do that? If I understand correctly:

    Void foo (){
    abc...
    bar()
    ...def
    }
    void bar(){
    }

    void bar_hook(){
    }
    void foo_hook(){
    abc...
    bar_hook()
    ...def
    }
    redirectCall(0x..., bar_hook)
    replaceFunction(0x...., foo_hook)
     
  6. _doug_

    _doug_ Established Member

    Joined:
    Jul 9, 2009
    Messages:
    290
    Likes Received:
    117
    What I would like to do is insert some code at the beginning of the TurnUndead method without rewriting the whole thing (it is complex) or messing up the redirectCall() that was already used. I could do that with replaceFunction if doing that won't mess up the redirectCall(). Or is there a better way? Maybe I could stick my code in the redirectCall() function even though it really doesn't belong there...
     
  7. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,613
    Likes Received:
    537
    If you prepend code via calling the original replaced function it won't interefere.

    I.e. orgTurnundead = replaceFunction(..., [](){
    New code...
    orgTurnundead()
    }
    Is fine.
     
  8. _doug_

    _doug_ Established Member

    Joined:
    Jul 9, 2009
    Messages:
    290
    Likes Received:
    117
    That did indeed work great. Now I see a use for redirectCall(). Is there more decompile data you can send me. The C file does not give me the addresses necessary for using redirectCall on the functions I want to replace.

    BTW: Do you know if the metamagic value for feat definitions just add them to the wizard bonus list or does it do something more?
     
  9. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,613
    Likes Received:
    537
    You can use a debugger like Ollydbg, or IDA. I can send you my database.

    I think metamagic is more hardcoded, will have to look for it.
     
  10. _doug_

    _doug_ Established Member

    Joined:
    Jul 9, 2009
    Messages:
    290
    Likes Received:
    117
    I downloaded OllyDbg. Please send me the database when you get a chance.

    Metamagic is definitely mostly hardcoded. I was wondering if the feat flag did anything more than add the feat to the wizard bonus list.
     
  11. _doug_

    _doug_ Established Member

    Joined:
    Jul 9, 2009
    Messages:
    290
    Likes Received:
    117
    Another question quick question: Does D20A_CLASS_ABILITY_SA always refer to wild shape or does something else use it?
     
  12. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,613
    Likes Received:
    537
    I think it's the only one, maybe summon familiar or animal companion too.
     
  13. _doug_

    _doug_ Established Member

    Joined:
    Jul 9, 2009
    Messages:
    290
    Likes Received:
    117
    After pulling the latest, I am getting lots of the following error:

    error C2955: 'gsl::span': use of class template requires template argument list (compiling source file movies.cpp)

    BTW: When you get a chance, please do send me that database file. Thanks!
     
  14. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,613
    Likes Received:
    537
    @DarkStorm made some updates recently, I think to use c++17 features. Maybe the dependencies need to be updated.
     
  15. _doug_

    _doug_ Established Member

    Joined:
    Jul 9, 2009
    Messages:
    290
    Likes Received:
    117
    Doesn't seem like an issue with the dependencies. Maybe something was committed that wasn't suppose to be committed yet.
     
Our Host!