[Test Theory] EndScene hook without Native Code (Kinda) menu

Shout-Out

User Tag List

Results 1 to 8 of 8
  1. #1
    Apoc's Avatar Angry Penguin
    Reputation
    1387
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/12
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Test Theory] EndScene hook without Native Code (Kinda)

    Well... I was looking through the WoW Widget API (Widget API - WoWWiki - Your guide to the World of Warcraft) trying to find out if frames have an event/function that is called when the frame is removed (forcefully or otherwise). And I came across a nice bit of info.

    Basically; it requires 2 things. A working Lua class, and a single registered Lua callback. (I'll use HandleOnUpdate for this post)

    Anyhow, here's the link in question; UIHANDLER OnUpdate - WoWWiki - Your guide to the World of Warcraft

    As per the info provided, myFrame:OnUpdate will be called BEFORE the game is actually rendered, and any UI stuff is painted. (Effectively in WoW's own Render function) This is basically an EndScene hook... but earlier. (Meaning; you can do any nifty UI magic you want... I think)

    A little background info:

    I did some research (thanks to kynox for the original Render function address), and I figured out that WoW does all of it's logic, BEFORE calling the frame:OnUpdate functions (or any other render specific stuff). In laymans terms, it's safe to use this as an EndScene hook, and do all the stuff you need. (At least, I hope so, I haven't tested it yet)

    Anyhow, lets get on with the methods...

    I posted a Lua class, which I'll use the API from for this setup. Feel free to use whatever you want, so long as it is able to register a callback, which you can hook into.

    Register a Lua callback. (We'll use OnUpdateHandler for brevity)

    Call FrameScript::Execute (Lua_DoString) with the following code;

    Code:
    Lua.DoString("local f = CreateFrame(\"Frame\"); f:RegisterAllEvents(); f:SetScript(\"OnUpdate\", OnUpdateHandler);");
    Now, OnUpdateHandler will be called each time f:OnUpdate is called. (Each frame, before EndScene is actually called) This is called in the main thread context, so it is safe to do whatever you want with WoW at this point.

    There you go, a working (detour-less) EndScene-esque hook.

    Keep in mind; I haven't tested this, and I don't plan to in the near future. I figured it would help those of you with out of process bots who are smart enough to figure out how to register callbacks that work.

    Enjoy folks.

    P.S; don't get pissy if it doesn't work. It just popped in my head.

    [Test Theory] EndScene hook without Native Code (Kinda)
  2. #2
    flo8464's Avatar Active Member
    Reputation
    30
    Join Date
    Apr 2009
    Posts
    434
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sounds very nice, gonna test it tomorrow, thanks.

  3. #3
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1356
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just a heads up, this won't help if you want to draw a D3D GUI in-game because you also need to hook Reset to do that.

    P.S. Apoc has cooties.

  4. #4
    LegacyAX's Avatar Active Member
    Reputation
    21
    Join Date
    Apr 2009
    Posts
    193
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ha thanks for the creative idea planning ^_^ +Rep

  5. #5
    Apoc's Avatar Angry Penguin
    Reputation
    1387
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/12
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Cypher View Post
    Just a heads up, this won't help if you want to draw a D3D GUI in-game because you also need to hook Reset to do that.

    P.S. Apoc has cooties.
    Fairly obvious isn't it? If you're doing D3D GUI rendering, you already have the DX device hooked, so why not just hook 1 more vfunc? You'd be stupid to do this over a higher performance alternative.

    P.S. NUH-UH!

  6. #6
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1356
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Apoc View Post
    Fairly obvious isn't it? If you're doing D3D GUI rendering, you already have the DX device hooked, so why not just hook 1 more vfunc? You'd be stupid to do this over a higher performance alternative.

    P.S. NUH-UH!
    Well, given that a higher performance alternative is available, and also generic (and hence portable to any game without code changes), I can fix your post for you:
    "You'd be stupid to do this over a higher performance alternative."
    now becomes
    "You'd be stupid to do this."

    This thread is fail, that is all.

    Kekeke

  7. #7
    suicidity's Avatar Contributor
    Reputation
    207
    Join Date
    Oct 2006
    Posts
    1,439
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Cypher View Post
    Well, given that a higher performance alternative is available, and also generic (and hence portable to any game without code changes), I can fix your post for you:
    "You'd be stupid to do this over a higher performance alternative."
    now becomes
    "You'd be stupid to do this."

    This thread is fail, that is all.

    Kekeke
    cool story bro.


  8. #8
    amadmonk's Avatar Active Member
    Reputation
    124
    Join Date
    Apr 2008
    Posts
    772
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    *laugh*

    Although Cypher is mean (as usual), he's also right (as usual) -- it's not a bad idea, Apoc, but I think that a registered handler is "riskier" than a detour in d3d.dll (whatever it's called), which I'm fairly certain WoW will never check, and which works in any game and any patch of WoW (as long as d3d.dll doesn't change).

    Of course, a DR0 hook off of the parent of the framescript.onevent handler is the stealthiest of all (if you don't care about portability or performance).

    That, and hypervisors.
    Don't believe everything you think.

Similar Threads

  1. [Sample Code] EndScene Hook with ASM and blackmagic
    By RivaLfr in forum WoW Memory Editing
    Replies: 89
    Last Post: 05-13-2021, 03:26 PM
  2. Replies: 11
    Last Post: 12-23-2010, 09:30 PM
  3. EndScene Hook not changing anything
    By lanman92 in forum WoW Memory Editing
    Replies: 32
    Last Post: 06-01-2009, 11:46 PM
  4. Unlock Protected LUA with a Patch? (Without Injecting code?)
    By Zeroi9 in forum WoW Memory Editing
    Replies: 15
    Last Post: 03-30-2009, 05:58 PM
  5. Test a private Server without creating an Account
    By Lordy in forum World of Warcraft Emulator Servers
    Replies: 5
    Last Post: 04-06-2008, 02:18 PM
All times are GMT -5. The time now is 10:51 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search