Fast shared Array, Buffer and Circular Buffer / Ring Buffer for .NET IPC with Memory Mapped Files

About the SharedMemory library

The SharedMemory class library provides a set of C# classes that utilise a non-persisted memory-mapped file for very fast low-level inter-process communication (IPC) to share data using the following data structures: buffer, array and circular buffer (also known as a ring buffer).

SharedMemory uses the MemoryMappedFile class introduced in .NET 4, and provides a partial P/Invoke wrapper around the Windows API for versions prior to this. The library was originally inspired by the following CodeProject article: “Fast IPC Communication Using Shared Memory and InterlockedCompareExchange“.

The library abstracts the use of the memory mapped file, adding a header that includes information about the size of the shared memory region so that readers are able to open the shared memory without knowing the size before hand. A helper class to support the fast copying of C# fixed-size structures in a generic fashion is also included.

The project source can be found on GitHub and Codeplex, with binaries available via Nuget and Codeplex.

What is a memory mapped file?

A memory-mapped file is an area of virtual memory that may have been mapped to a physical file and can be read from and written to by multiple processes on the same system. The file or portions thereof are accessed via views to one or more processes as a contiguous block of memory. Each view can then be read/written to using a memory location.

A memory-mapped file can be created as one of two types:

  • persisted: mapped to a physical file, and
  • non-persisted: in-memory only,  commonly used for inter-process communication (IPC).

A memory-mapped file is referenced using a unique name, unlike named pipes however a memory-mapped file cannot be accessed directly over a network.

Continue reading Fast shared Array, Buffer and Circular Buffer / Ring Buffer for .NET IPC with Memory Mapped Files

x86/x86-64 Disassembler for .NET – SharpDisasm

About the disassembler

SharpDisasm is a full C# port of the libudis86 x86/x86-64 disassembler. Disassembly of 16-bit, 32-bit and 64-bit instructions can be output to both Intel and AT&T syntax.

The library supports decoding each instruction to an object that provides access to low-level information for further analysis (e.g. instruction size, operand number and types etc).

SharpDisasm is a full C# port of the libudis86 C-library disassembler.

Disassembler features

  • a full C# port of the libudis86 C library
  • a set of simple C# classes wrapping the udis86 C API
  • support for x86 16-bit, 32-bit and 64-bit instruction set architectures
  • support for outputting in Intel and AT&T syntax
  • support for all x86 and x86-64 (AMD64) General purpose and System instructions.
  • support for the following ISA extensions:
    • MMX, FPU (x87), AMD 3DNow
    • SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AES
    • AMD-V, INTEL-VMX, SMX

The disassembler is exposed through the SharpDisam.Disassembler class.

Output from the provided example console app:

Downloads

Download source from GitHub or download binaries on Codeplex or NuGet.

EasyHook 2.7.5558.0 Released

A new beta version of EasyHook 2.7 has been released with the following fixes:

2.7.5558.0 Mar-21-2015

Download from here

Ludum Dare 31 – Cubelicious

My first Ludum Dare entry for Ludum Dare 31 – Cubelicious. I’m cheating and using this as my first #1GAM entry too :)

Theme: Entire game on one screen, built solo and from scratch within 48hrs.

You can play in  Unity web player, or download for Windows or Mac from the Ludum Dare entry page above.

Unity3D asset source available as a Unity package (released under the Creative Commons non-commercial share-alike license).

EasyHook 2.7.5159.0 Released

A new beta version of EasyHook 2.7 has been released with the following fixes:

Download the new version here.

Direct3D Rendering Cookbook Reviews

Reviews for Direct3D Rendering Cookbook

Having fallen in love with C# some years ago, and more willing to lose my favorite toe than go back to C++ ever again, this book is exactly what I needed. SharpDX makes it possible to continue with XNA type graphics development in C# and DirectX 11, but it’s not easy to get help or anything besides reference docs at the time of this review. This book serves as a comprehensive manual for SharpDX development that is timely and sorely needed. It’s the only book of it’s kind and fills an important and useful purpose, what else needs to be said? If you’ve been messing with SharpDX, buy this book and read it cover to cover.

5 stars – Richard Marinaccio @ Amazon.com

I am impressed by the writing style. From start to finish, each topic is explained clearly in detailed step-by-step instructions…Good introduction for those new to DirectX 11, and also covers some topics that will be of interest to more experienced coders.

5 stars – S J MCGLINCHEY @ Amazon.co.uk

I loved this book, even if you are not a C# developer, you can port/include these techniques to/in your C++ engine. If you are just starting out, this may not be the book for you, if you have been working with earlier versions of DX and looking for an interesting read, then I don’t think you can go wrong with this book.

  @ http://xboxoneindiedevelopment.blogspot.com.au/2014/02/direct3d-rendering-cookbook-by-justin.html

Direct3D Rendering Cookbook is a great starting point for those looking to jump into 3D rendering, and even remains relevant once the basics have been covered by providing reference information about advanced shaders and techniques that you may want to make use of later…

…I would recommend this book to anyone who is interested in having a solid resource for 3D development that will last them past the basics…

Michael @ http://mquandt.com/blog/2014/02/review-direct3d-rendering-cookbook/

All in all, as you see, a lot of knowledge + interesting topics + good execution.
Final mark: 4/5

Continue reading Direct3D Rendering Cookbook Reviews

Direct3D Rendering Cookbook is published!

After 8 months of hard work, I am now a published author! It has been a challenging but rewarding experience and I’m really excited to finally see it published. I hope people find it as enjoyable to read as I found it to write.

If you’re interested in taking a look, there is a sample chapter available on the book’s page at Packt Publishing or from Amazon (Direct3D Rendering Cookbook) where you can choose to purchase the print and/or e-book editions.

Direct3D Rendering Cookbook (font cover)

Continue reading Direct3D Rendering Cookbook is published!