Bartis1313 / csgo

Free and open source CSGO hack
MIT License
180 stars 27 forks source link

needless motion blur code #43

Closed cristeigabriel closed 2 years ago

cristeigabriel commented 2 years ago

https://github.com/Bartis1313/csgo/blob/0829938ee99a869bc448dc476cd07b9e55c56dac/cheats/features/sources/visuals/misc/motionblur.cpp#L210-L222

you can just modify the values of the material proxy itself. beware there's only one xref to it and that's in the material proxy. you can xref it by old csgo version, or, 68 ? ? ? ? FF 50 34 8B 4E 08 5E 85 C9 74 0C

Bartis1313 commented 2 years ago

Thanks, unfortunately I have to admit I copied whole old leaked code without any further understanding (as the game originally had this working)

Update will be a bit delayed due to ex-exams on uni. Thanks once again!

cristeigabriel commented 2 years ago

Good luck with your exams 😀

Bartis1313 commented 2 years ago

I looked up today into this function, it seems to be exact as code above but uses array data as argument for me. I called this function, line of pseudo code:

(*(int (__stdcall **)(void *, signed int))(*(_DWORD *)firstMaterial + 52))(&firstArrData, 4);

And this didn't result in anything, I even tried to wrap whole function in asm and nothing. I can't really reproduce that to work. Also, why did you named it useless? Without editing the material there won't be any change visible., you prob meant bad way.

Thanks in advance.

cristeigabriel commented 2 years ago

You don't have to call the function. That was not intended. You can take the vector once and modify it by hand. float *motion_blur_values = *(float**)((uintptr_t)(address) + 1) The point is to avoid the virtual function calls.

Bartis1313 commented 2 years ago

Sorry for late answer, I misunderstood the main point of what you found. I am quite sure this also needs to somehow to force the game to run motion blur originally, otherwise this float array field from CMotionBlurMaterialProxy won't affect in any way current code. Also what's wrong in calling virtual functions for that? This shouldn't affect the performance, since it does very easy task and is not repeated in big loop.

cristeigabriel commented 2 years ago

You're right that you still need to display the motion blur, point is, doing what I mentioned earlier just seems simpler, removes the intermediate variable(s) and inherently shortens the code.

Bartis1313 commented 2 years ago

The outcome will be the same, because this is what they have written years ago, and yes I agree that your way looks more clean in such memory-game based projects. I will try to implement it after few problems will be resolved and things I took to focus on in projects tab. And rewriting that will be probably last thing in this project. Before that, I also need to somehow fix the issue with variant in config throwing very sometimes weird errors.

cristeigabriel commented 2 years ago

Good luck, I never intended to say that there'll be a different outcome - frankly that would be an issue, it was just a tidy proposal as I tried to show with the lines selection in the issue

Bartis1313 commented 2 years ago

Thank you, and good luck to you for your scaleform project. Take care