Everything stops rendering when resizing or changing resolution menu

User Tag List

Results 1 to 8 of 8
  1. #1
    Jadd's Avatar 🐸 Premium Seller
    Reputation
    1515
    Join Date
    May 2008
    Posts
    2,433
    Thanks G/R
    81/336
    Trade Feedback
    1 (100%)
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Everything stops rendering when resizing or changing resolution

    So, I can render everything just fine, but whenever I resize the window, or change the resolution, everything just stops rendering. For example (using CS:S in this example because it's already open but I've always had the same issue with WoW):

    1360x768:


    |
    v

    1280x720


    I've tried setting an event handler to things like Device.DeviceReset and Device.DeviceResizing but neither seem to even get called. I've also tried some hackish ways of getting around it, like
    Code:
    if (internalViewport.Width != Globals.Device.Viewport.Width ||
        internalViewport.Height != Globals.Device.Viewport.Height)
    {
        internalViewport = Globals.Device.Viewport;
    }
    else
    {
        EndScene.Pulse(); //Render everything
    }
    But unfortunately the viewport gets changed after the resizing is done (seems weird to me, but apparently that's the way it works), so it still tries to render everything. I'm pretty sure that this is what's breaking everything. I'm wondering if there are any ways to get around this problem. Any hackish solutions would also be appreciated.

    Thanks.
    Last edited by Jadd; 07-01-2012 at 06:08 PM.

    Everything stops rendering when resizing or changing resolution
  2. #2
    wraithZX's Avatar Active Member
    Reputation
    43
    Join Date
    May 2007
    Posts
    122
    Thanks G/R
    0/1
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The supposed "normal" way of things (not hooked) with respect to resizing is to release all your acquired resources at that point, call the Reset() function on the device, then recreate when needed afterwards.
    Calls to SetCooperativeLevel and whatnot should also be used to determine when and where - the documentation on MSDN is sufficient for figuring out when to handle Reset and the like.

    Hooking Reset() and doing the same procedure in a hack should be fine - I use that procedure with my code and it works a treat.

  3. #3
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1358
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yup. Hook IDirect3DDevice9::Reset for profit.

  4. #4
    Jadd's Avatar 🐸 Premium Seller
    Reputation
    1515
    Join Date
    May 2008
    Posts
    2,433
    Thanks G/R
    81/336
    Trade Feedback
    1 (100%)
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    But shouldn't the EventHandler "Device.DeviceReset" do that all for me? For example:
    Code:
    public static int EndSceneHook(IntPtr instance)
    {
        Globals.Device = new Device(instance);
        Globals.Device.DeviceReset += DeviceReset;
    
        return (int) Globals.Magic.Detours["EndScene"].CallOriginal(instance);
    }
    
    static void DeviceReset(object sender, EventArgs e)
    {
        MessageBox.Show("0");
    }
    ... I don't understand why this doesn't work

  5. #5
    Bananenbrot's Avatar Contributor
    Reputation
    153
    Join Date
    Nov 2009
    Posts
    384
    Thanks G/R
    1/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Assuming DeviceReset belongs to a managed wrapper of DirectX and is no intrinsic (unmanaged) functionality, it will only be fired if you call Reset through the managed layer.
    If you insist on using that event, you can hook IDirect3DDevice9::Reset and call the Reset of your managed wrapper from there (firing the DeviceReset event). Don't forget to remove the hook before calling Reset though.

  6. #6
    Jadd's Avatar 🐸 Premium Seller
    Reputation
    1515
    Join Date
    May 2008
    Posts
    2,433
    Thanks G/R
    81/336
    Trade Feedback
    1 (100%)
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Bananenbrot View Post
    Assuming DeviceReset belongs to a managed wrapper of DirectX and is no intrinsic (unmanaged) functionality, it will only be fired if you call Reset through the managed layer.
    If you insist on using that event, you can hook IDirect3DDevice9::Reset and call the Reset of your managed wrapper from there (firing the DeviceReset event). Don't forget to remove the hook before calling Reset though.
    Thanks, this actually made a lot of sense. +Rep to all of you

  7. #7
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1358
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Bananenbrot View Post
    Assuming DeviceReset belongs to a managed wrapper of DirectX and is no intrinsic (unmanaged) functionality, it will only be fired if you call Reset through the managed layer.
    If you insist on using that event, you can hook IDirect3DDevice9::Reset and call the Reset of your managed wrapper from there (firing the DeviceReset event). Don't forget to remove the hook before calling Reset though.
    Wouldn't recommend this as it isn't thread-safe in the case of multiple devices. Better to just call back into your code directly from the hook, then call the original using a trampoline as normal.

  8. #8
    Bananenbrot's Avatar Contributor
    Reputation
    153
    Join Date
    Nov 2009
    Posts
    384
    Thanks G/R
    1/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Cypher View Post
    Wouldn't recommend this as it isn't thread-safe in the case of multiple devices. Better to just call back into your code directly from the hook, then call the original using a trampoline as normal.
    That reptile sounds reasonable.

Similar Threads

  1. Control FP / No-clip through everything exploit 4.3.4 (Survive change of map IDs)
    By FuryExploiting in forum World of Warcraft Exploits
    Replies: 19
    Last Post: 06-24-2012, 02:45 AM
  2. Noggit stops responding when I start it up
    By Stany8 in forum WoW ME Questions and Requests
    Replies: 3
    Last Post: 12-05-2010, 08:44 AM
  3. Stop turining when rotation is correct?
    By ashleyww in forum WoW Memory Editing
    Replies: 15
    Last Post: 06-07-2009, 08:39 PM
  4. getting error when trying to change size
    By kanezfan in forum WoW ME Questions and Requests
    Replies: 3
    Last Post: 07-31-2007, 08:57 PM
All times are GMT -5. The time now is 06:26 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search