I’m trying to develop a monogame application for Virtual Reality using Oculus Rift and I need to add two really simple functions to Monogame in order to make my tutorial work (I can give you the link if some of you are interested)
So my question is simple : how can I edit/add some functions in Monogame files?
I never edited an open source framework before, and when I press F12 to see the definition, I can’t edit it.
I was indeed looking into the github files, and I found out the .cs files I was looking for.
But I didn’t found the .sln file for my platform (I’m using Monogame for windows).
As soon as I can find this file, I will be able to edit the files easily and generate a new dll file, I’m gonna keep looking you already helped me a lot.
Howdie folks !!! On the topic of adding functions to the framework how does it work if one would like to release with these added functions ? Is this permitted or does it have to make its way into an official monogame release build ? Can one release a custom build of Monogame dll with your apps where you have added additional functions in the source ?
Hey guys thanks a lot for your help, after some testing I managed to get the .sln files, and it worked great ! (Had to install git, and run the commands given on Jjagg’s link, wouldn’t work otherwise don’t know why)
I did add 2 functions and tried to compile the code I was working on (Oculus with monogame example), and it did compile, but I’m having another issue : it says “System.AccessViolationException exception” on OcculusRift.SubmitRenderTargets(eye[0], eye[1]);
I know it’s a different problem, I just wanted to let you know you helped me going a step further
If I can get it to work I can post the solution in here in case some people may encounter the same problem.
Maybe the render targets are disposed or not intialized correctly. AccessViolationException is thrown when unmanaged code reads or writes to protected memory.
I am debugging a lot, and it feels like a pretty weird bug : The render targets seems to have been initialized correctly (they have a width, height, IsDisposed at false, etc…), but the weird part is that when I’m in release mode, the program throw the exception in this line :
int result = rift.SubmitRenderTargets(renderTargetEye[0], renderTargetEye[1]);
but when I’m in debug mode, it throws the same exception inside the function :
public int SubmitRenderTargets(RenderTarget2D rtLeft, RenderTarget2D rtRight, int frame = 0)
{
IntPtr dxTexLeft = rtLeft.GetNativeDxResource();
IntPtr dxTexRight = rtRight.GetNativeDxResource();
SharpDX objects are COM based.
I don’t remember exactly what the calling convention for COM is, but in any case, have you tried to call IUnknown.AddReference() once on the render targets before you send them to SubmitRenderTargets()?