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

Experimenting with sharing DirectX textures #74

Merged
merged 10 commits into from
Nov 20, 2023
Merged

Experimenting with sharing DirectX textures #74

merged 10 commits into from
Nov 20, 2023

Conversation

space928
Copy link
Owner

  • Added HookD3D and CreateTexture methods to OmsiHookInvoker and related RPC classes
  • These methods allow Omsi's own d3d context to be used to create new textures and get the shared handle from them to be used by another d3d context for writing

 - Added HookD3D and CreateTexture methods to OmsiHookInvoker and related RPC classes
 - These methods allow Omsi's own d3d context to be used to create new textures and get the shared handle from them to be used by another d3d context for writing
@space928 space928 self-assigned this Oct 25, 2023
space928 and others added 9 commits October 26, 2023 09:02
 - Fixed build issue with OmsiExtensionsCLI
 - Handle exceptions in CLI program
 - Added some demo code to fiddle with D3D  textures
 - Theoretically Memory is now thread safe
 - Replaced AccessViolationException with custom exception
 - Added ReadMemoryObject as a factory for OmsiObjects with null checking
 - ReadMemoryObjArray now does null checking on items
 - ComplObjInst.ScriptTextures is now a MemArray
 - OmsiGlobals returns nulls where appropriate
 - Added experimental events to OmsiHook
 - Better exceptions for remote methods
 - Experimental async/multithreading support for RemoteMethods (currently broken)
 - Fixed various bugs
 - Exposed Memory to the public when using debug builds
 - MemArray refactoring + fixes
 - Added some overloads to Memory for uint addresses
 - Memory allocation is now async
 - Updated classes to support async memory allocation
 - Rewrote much of OmsiRemoteMethods and the RPC plugin to support async calls
 - Updated assembly versions
 - D3D still doesn't work...
 - Implemented UpdateSubresource in OmsiHookInvoker, OmsiHookRPC and OmsiHook
 - Removed shared resource support from create texture, it never would have worked
 - Other small tweaks
 - Fixed example code
 - Fixed WriteMemory(addr, T[]) buffer overrun
 - Exposed AllocRemoteMemory()
 - Added HRESULT enum for easier debugging of OmsiHookInvoker
 - Added many more sanity checks to DXHook.cpp
 - Added more bugs
 - Dereference the newly created texture pointer correctly
 - Re-enabled script texture replacement
 - Added some animation to the texture modification example
 - Removed dependency on SharpDX
 - Updated example program
 - Implemented new D3DTexture class
 - Improved memory writing methods to be allocation free
 - Added FreeRemoteMemory method
 - OmsiHook now automatically hooks d3d
 - Added new RPC methods
 - Fixed UpdateSubresource not copying enough bytes
 - Improved OmsiHookRPCPlugin logging
 - Fixed build system a bit, no longer depends on Omsi existing at the assumed path
@space928 space928 marked this pull request as ready for review November 19, 2023 19:35
@space928 space928 requested a review from amathieson November 19, 2023 19:35
@space928 space928 linked an issue Nov 20, 2023 that may be closed by this pull request
/// <param name="address">the address of the existing texture</param>
/// <exception cref="NullReferenceException"></exception>
/// <exception cref="Exception"></exception>
public async void CreateFromExisting(uint address)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to have a test case for this in the CLI

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but we'll leave that on the backlog for now.

//-------------------------------------------------------------------------------------
// Returns bits-per-pixel for a given D3D9 format, or 0 on failure
//-------------------------------------------------------------------------------------
constexpr size_t DXHook::BitsPerPixel(D3DFORMAT fmt) noexcept
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this not a copy of the switch from the other class?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it mirrors the C# implementation, that is intentional.

@space928 space928 merged commit 6b1c257 into main Nov 20, 2023
1 check passed
@amathieson amathieson deleted the d3dHooking branch December 29, 2023 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Asynchronous RPC calls.
2 participants