Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OMSI freezes when hooking the vehicle script texture #96

Closed
jjb-pro opened this issue Mar 28, 2024 · 2 comments · Fixed by #98
Closed

OMSI freezes when hooking the vehicle script texture #96

jjb-pro opened this issue Mar 28, 2024 · 2 comments · Fixed by #98
Assignees
Labels
bug Something isn't working

Comments

@jjb-pro
Copy link

jjb-pro commented Mar 28, 2024

Describe the bug
When I try to set a script texture via OMSI Hook in an OMSI plugin, OMSI freezes.

To Reproduce
I use the following code for this:

_texture = _context.OMSI.CreateTextureObject();
await _texture.CreateD3DTexture(1024, 1024);

Console.WriteLine(_context.OMSI.IsD3DReady); // True

var scriptTextures = _context.OMSI.Globals.Map.PlayerVehicle.ComplObjInst.ScriptTextures;
// but this works: var scriptTextures = _context.OMSI.Globals.Map.Kacheln[0].Objects[14].ComplObjInst.ScriptTextures;
var old = scriptTextures[0];
if (old.tex != (IntPtr)_texture.TextureAddress)
{
   scriptTextures[0] = new()
   {
      TexPn = old.TexPn,
      color = old.color,
      tex = unchecked((IntPtr)_texture.TextureAddress)
   };
}

If I comment out the last instruction (scriptTextures[0] = ...), OMSI continues to run. Setting of script textures for scenery objects also works.

Expected behaviour
OMSI should not freeze after executing the code, but continue to run.

@jjb-pro jjb-pro added the bug Something isn't working label Mar 28, 2024
@amathieson amathieson self-assigned this Apr 7, 2024
@amathieson
Copy link
Collaborator

Hi, I had not noticed any particular freezing when doig it on my version previously, have you got the latest build of the OH plugin loaded? maybe its a version mis-match issue?

@space928
Copy link
Owner

space928 commented Apr 7, 2024

Can you provide a complete minimal example that can reproduce this bug (including which bus you're using)?

Otherwise I might be able to gleam some insight into the issue if you can provide a minidump of OMSI; if you can get WinDbg or your favourite debugger to attach to Omsi (not always easy) then you should be able to create a minidump which I can analyse. In WinDbg the steps would be:

  1. Trigger the bug causing Omsi to freeze.
  2. Attach to omsi.exe in WinDbg
  3. Execute the command .dump /mA C:\Users\<username>\Documents\omsi.dmp
  4. Private message me the dump (Discord or email)

That being said a reproduceable example would be ideal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants