Apoc, or anyone, where might I find these "easy and clean" ways of doing math on IntPtrs?
Apoc why are you being so rude to Joe? He just complimented the community and tried to contribute with somthing he obviously finds as a hobby, and your giving him the gesture that MMOwned is a non-helping flaming website.
Sorry Apoc. I mistook you for meaning something that was actually clean looking and didn't involve casting twice (best case scenario).
Tbh, first read I thought you said cats. lol.
Im in the middle of writing my own memory reading/writing class at the moment, yes I could use BlackMagic but I prefer the satisfaction and experience of doing it myself![]()
@Apoc, if it's ok, could I use your code on page 1 as inspiration for some aspects of my own? no copy and pasting of course just ideas. Thanks.
I had to change this code
to thisCode:case TypeCode.Object: // Double check this. It *should* work. But may not. Untested GCHandle handle = GCHandle.Alloc(buffer, GCHandleType.Pinned); Marshal.PtrToStructure((handle.AddrOfPinnedObject(), ret); handle.Free(); break;
The PtrToStructure method was throwing an exception and complaining that "The structure must not be a value class." with your code.Code:case TypeCode.Object: // Double check this. It *should* work. But may not. Untested GCHandle handle = GCHandle.Alloc(buffer, GCHandleType.Pinned); ret = Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(T)); handle.Free(); break;
Thanks for sharing your memory reading class by the way.![]()