GTAVisionExport icon indicating copy to clipboard operation
GTAVisionExport copied to clipboard

Empty buffers, "detected target change, someone else is screwing with our functions"

Open dominikandreas opened this issue 7 years ago • 30 comments

Hi,

for some reason I'm not able to get the depth and stencil buffers. I'm not sure if this is connected, but the log often shows the message "detected target change, someone else is screwing with our functions". The returned buffer size by the exported functions is often -1 and if it isn't, the buffer is just filled with 0s (except for the color buffer, that usually works fine).

Could you explain what the error message means and what the reason of this may be?

Thanks!

dominikandreas avatar May 06 '17 08:05 dominikandreas

Did you get any solution? I am planning to use this code for image sequence and depth map sequence extraction. Please let me know.

rmalav15 avatar Jun 05 '17 10:06 rmalav15

It actually seems to work for me now, but I'm not sure what actually caused the problem. Make sure that there's nothing else accessing the DirectX buffers or window information, no steam overlay or borderless gaming, remote desktop or anything alike. I run it in window mode with 800x600 resolution.

It would be nice if the authors could comment on this though. This work could be really helpful for other researchers if one would just know how to use it correctly. I also don't know yet how to display the buffers correctly

dominikandreas avatar Jun 05 '17 10:06 dominikandreas

Thanks for the quick reply :)
I will update you if I am able to do display thing smoothly.

rmalav15 avatar Jun 05 '17 12:06 rmalav15

Thank you @dominikandreas for helping me building this project. So I tried to run it and here is my asiloader.log, ScriptHookV.log and GTANativePlugin.log. In my GTANativePlugin.log and in my case it always outputs detected target change, someone else is screwing with our functions no matter what. Previously, I was using DeepGTA, so I tried removing all components related to it as well but still GTANativePlugin.log outputs the same. I also tried to run the game in windowed mode with 800x600, but it didn't help either. Then I tried look in to the file GTAVisionExport-master/native/src/main.cpp and it seems like there is a function hook_function(...) which is generating this error under the code if(targets<offset, T> != nullptr && targets<offset, T> != *vtbl), I have no clue what this is. Also when I try to hit L key, as OnKeyboardMessage function in main.cpp is handling this, game crashes with just one empty file depth.raw. I would really appreciate if any of you could help me in using this project.

muaz-git avatar Jun 11 '17 17:06 muaz-git

Can anyone please help me in running this repository by answering my above question. Thank you.

muaz-git avatar Jun 22 '17 21:06 muaz-git

Hi @muaz-git,

I wanted to collect RGBD dataset using this repo. Since I found two very great virtual dataset available online, I left this idea. I suggest you take a look at these dataset https://robotvault.bitbucket.io/scenenet-rgbd.html Indoor http://www.sira.diei.unipg.it/supplementary/ral2016/extra.html outdoor

If you still want to use this repo, then I suggest personally mail the authors for providing the documentation.

Sorry I cant help you more.

rmalav15 avatar Jun 24 '17 06:06 rmalav15

Hello! I'm the author of this code. The messages in the log are simply warnings that your graphics drivers are messing with Direct3d's vtables.

Can you upload a crashdump (or minidump). To do this simply set the registry values detailed here: https://msdn.microsoft.com/en-us/library/windows/desktop/bb787181(v=vs.85).aspx

barcharcraz avatar Jun 26 '17 18:06 barcharcraz

Also: targets is a tempate variable where I store pointers to the original functions. This comparison checks if the vtable has been modified. Us replacing the functions does not modify the vtable because we modify the beginning of the function itself.

Also can you send over some system information. Espicially what graphics card and drivers you have installed.

barcharcraz avatar Jun 26 '17 18:06 barcharcraz

I suspect that you aare running into the depth format issues that we've seen on some hardware. Nvidia cards tend to have the depth in a 64bit format (32F depth and 8UI stencil, with 24 unused). I suspect that this is a driver optimization. I have a modified version of the code working on intel cards (with a more standard 24D8S format), but I'd like to know if you are having similar problems. A full dump would actually be great, but bandwidth is a thing and a full dump will be quite large.

barcharcraz avatar Jun 26 '17 18:06 barcharcraz

Thank you @rmalav15 and @barcharcraz for your replies. I tried to generate both mini and full dumps. Normally, when I run the game it keeps generating the same log detected target change, someone else is screwing with our functions and game works fine, but when I hit L, game crashes and generates the dump files.

Here is my PC specs. I am trying to understand these dumps, but it seems like I am not able to understand them easily, it would be great if you could help me out. Thank you.

muaz-git avatar Jun 27 '17 20:06 muaz-git

that log message is just letting you know that your driver is indeed modifying the virtual tables. It should not break anything. I'll take a look at those dumps and get back to you

barcharcraz avatar Jun 27 '17 20:06 barcharcraz

@I manage to get color.raw, stencil.raw and depth.raw files out upon pressing 'L' but when I view them with Photoshop they look like an old UHF TV with the antenna unplugged. I'm guessing something is wrong. Any pointers?

IanKirwan avatar Aug 03 '17 17:08 IanKirwan

@IanKirwan did you receive any errors mentioned above before or did this repo. worked for out of the box?

muaz-git avatar Aug 03 '17 17:08 muaz-git

Hi muaz-git,

I had some errors initially (I have not had GTA crash so far) but that was all due to referencing dlls and putting things in the right folders. E.g. the deps folder had to be copied to the src folder i.e src/deps before the build would work. You also have to add the right paths to the cmake configuration for eigen etc (but solved that by looking at the errors in cmake). The code then built albeit with some fairly benign looking warnings. I'll post up my steps a little later if you think it will help?

On Thu, Aug 3, 2017 at 6:33 PM, muaz-git [email protected] wrote:

@IanKirwan https://github.com/iankirwan did you receive any errors mentioned above before or did this repo. worked for out of the box?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/umautobots/GTAVisionExport/issues/2#issuecomment-320037896, or mute the thread https://github.com/notifications/unsubscribe-auth/Ab7e0XMqp1L67plWA4K6qdPQPO9t_Dntks5sUgR4gaJpZM4NSrKd .

IanKirwan avatar Aug 03 '17 17:08 IanKirwan

@IanKirwan, thank you for your detailed response. And yes it would be great if you could please post those steps in detail, for me and for others who plan to use this repo in future.

muaz-git avatar Aug 03 '17 22:08 muaz-git

Did you try the new code I would uploaded yesterday, it should fix some issues with certain gpus

On Thu, Aug 3, 2017 at 6:25 PM muaz-git [email protected] wrote:

@IanKirwan https://github.com/iankirwan, thank you for your detailed response. And yes it would be great if you could please post those steps in detail, for me and for others who plan to use this repo in future.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/umautobots/GTAVisionExport/issues/2#issuecomment-320106488, or mute the thread https://github.com/notifications/unsubscribe-auth/ABPnveLfjwz10HuCerHZEbhuxo1LRZNxks5sUkjQgaJpZM4NSrKd .

barcharcraz avatar Aug 03 '17 22:08 barcharcraz

muaz-git These were my build steps moved this into the documentation issue thread

IanKirwan avatar Aug 04 '17 12:08 IanKirwan

This is great! Would you be willing to creat a pull request?

On Fri, Aug 4, 2017 at 8:01 AM IanKirwan [email protected] wrote:

@muaz-git https://github.com/muaz-git These were my build steps

GTAVisionExport (native) build steps #==================================== Note: there may be some unessesary steps that could be removed from this procedure at some point, but this is what I did. Also I have a tendency write Linux style paths. All paths (except URLs) should be Windows style. My set-up:

GTX770, Windows 10 64bit, Visual Studio 2017 (community edition), cmake 3.9.0, GTAV version 1.0.231.0 Needed tools and libraries

AsiLoader and ScriptHookV : http://www.dev-c.com/files/ScriptHookV_1.0.1103.2.zip cmake : https://cmake.org/download/ Eigen3 : http://bitbucket.org/eigen/eigen/get/3.3.4.zip Build steps

  1. git clone https://github.com/umautobots/GTAVisionExport (latest! as of today)
  2. Extract Eigen3 somwhere convenient (Your GTAVisionExport folder is as good as any).
  3. Extract ScriptHookV archive and drop the files in 'bin' into your GTAV exe folder.
  4. Run cmake (cmake-gui) from your Windows start menu.
  5. Hit 'Browse Source' and select your GTAVisionExport/native folder.
  6. Hit 'configure' (first time around it will fail but dont worry).
  7. Choose project generator 'Visual Studio 15 2017 Win64' and keep the option 'use default native compilers'
  8. After the fail dialog, modify the EIGEN3_INCLUDE_DIR to point to your Eigen3 folder.
  9. Run 'configure' followed by 'generate'.
  10. cmake should now have generated the Visual Studio solution into GTAVisionExport/build.
  11. Open 'GTANativePlugin.sln' in Visual Studio.
  12. Select 'release' from the 'Solution Configurations' drop down.
  13. Edit GTAVisionNative project properties/configuration propeties/c/c++/additional include dirs in VS to add the GTAVisionExport/src folder (this allows VS to find MinHook.h)
  14. Edit GTAVisionNative project properties/configuration propeties/linker/addition dependencies to add '....\deps\libMinHook.x64.lib' (without the quotes)
  15. Press F6 to build the solution. it should now succeed and the products should be in 'GTAVisionExport\native\build\src\Release'
  16. Copy GTAVisionNative.asi & GTAVisionNative.lib to your GTAV exe folder.
  17. Run GTAV.
  18. Get to a place where you want to grab frames and press 'l' (lowercase 'L') to grab a frame. GTAVisionExport should now create color.raw, stencil.raw and depth.raw files in your GTAV exe folder.

HTH

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/umautobots/GTAVisionExport/issues/2#issuecomment-320231459, or mute the thread https://github.com/notifications/unsubscribe-auth/ABPnvduyE74gedVZvvcoepEMlt8hm24Tks5sUwf4gaJpZM4NSrKd .

barcharcraz avatar Aug 04 '17 12:08 barcharcraz

Would be happy to if I knew how. I'm a bit of a git virgin. Feel free to copy it and do it otherwise. I'll have a go at creating a pull request in the mean time.

IanKirwan avatar Aug 04 '17 13:08 IanKirwan

OK, have created a pull request (I think) with new file GTAVisionExport/native/README.md for the build steps. I think it's in your hands from here?

IanKirwan avatar Aug 04 '17 13:08 IanKirwan

@barcharcraz I have changed my Eigen3 from 3.3.4 to 3.3.1 as you specified if conan.txt and, though I don't know if it's related, it looks like my raw files might contain something useful now (though still barely intelligible to the eye). What do I need to process these files (create training data, annotations etc)? Does the managed code do this? I see some bounding box stuff in the code so I'm inclined to think so but c# is not my langauge.

IanKirwan avatar Aug 04 '17 18:08 IanKirwan

@barcharcraz Hopefully you will have noticed the pull request. I can't merge it as i don't have sufficient permissions so it's in your hands.

Cheers Ian

IanKirwan avatar Aug 08 '17 15:08 IanKirwan

@barcharcraz yes I tried it. The issue persist unfortunately.

muaz-git avatar Aug 20 '17 13:08 muaz-git

I merged said pull request.

Can you try using a debug build of the library? Hopefully that will make the error easier to see (or fix it which is always annoying)...

barcharcraz avatar Aug 21 '17 15:08 barcharcraz

I found some time to debug why the buffers are not extracted using recent Nvidia cards (10xx series in my case). The reason is that apparently desc.Width and desc.Height are often as low as 128 in clear_depth_stencil_view_hook. Therefore the function never extracts the buffer. Could you elaborate why this could be the case and what this means?

By the way the library works fine on my Surface Book with dedicated GPU (something like a GTX 960m I believe, a customized version by Microsoft and the drivers may be different)

Another note: Buffer extraction works if I just disable the size checks of desc.Width and desc.Height. Looking at the buffers and comparing them to the ones I've obtained on the Surface Book, I notice that the size of depth and stencil buffers has been reduced (width, height are now half of what they were).

dominikandreas avatar Aug 31 '17 14:08 dominikandreas

Did someone solve this issue? I got the same problem on Win 10 with Nvidia GTX 960m. Is it enough to disable the size check?

Cuky88 avatar Oct 04 '17 07:10 Cuky88

The message "detected target change..." itself is not an issue, but expected behavior as I understand. If something doesn't work for you, place some logs in the code to see where it fails. It may well be the size check, so you could try disabling that and see if it helps.

dominikandreas avatar Oct 04 '17 07:10 dominikandreas

Ok, my question wasn't exact! The game crashes as soon as I press "L" and creates an empty depth.raw file. @muaz-git could you solve the issue with the crash?

Cuky88 avatar Oct 04 '17 08:10 Cuky88

Update: Crash can be easily fixed by changing if (desc.Format == DXGI_FORMAT_B8G8R8A8_UNORM && desc.Width > 1000 && desc.Height > 1000) in main.cpp to something lower then your current resolution, e.g. desc.Width > 600 && desc.Height > 600. All 3 files will be generated.

Cuky88 avatar Oct 04 '17 10:10 Cuky88

@Cuky88 as far as I understood, Width and Height should match the resolution of game. So if you're running the game in 800x600 then default code (here and here) fails and returns -1. So either change the game resolution to have at least 1000 in both width and height. Or simply change the code. And prefer to run managed repository.

muaz-git avatar Oct 04 '17 12:10 muaz-git