Feb 282025
 

Normally this should be impossible as the two languages are too similar and they try to interpret each other’s code as if it was there own

However both have a preprocessor of sorts which should help solve this. C++ has a full preprocessor but Csharp only has limited preprocessor capabilities with no macro substitution that greatly limits things. The preprocessor differences actually makes things harder as the CSharp compiler will error on many valid C++ processor statements.

CSharp has an annoying requirement that any line that stats with a # must be valid preprocessor statements even if in inactive preprocessor blocks which means simple things like this following code fail when logic suggests it should work

#if __cplusplus

// C++ code goes here

#include <cstdint>
#include <string>
using std::string;

#else

//CSharp code goes here
using System.Text;
using System.Collections.Generic;

#endif

The Csharp will error on the #include lines even though they are in an inactive block because they start with a #. So is there a way to include a file in C++ without starting the line with a # ? Yes, there is A C++ preprocessor statement is allowed to have white-space in front of it. The problem is so do CSharp preprocessor statements, so adding spaces or tabs before the # wont hide the preprocessor statement from the CSharp compiler. However CSharp and C++ have different ideas on what counts as white space during preprocessing. A C++ compiler converts comments into white-space in the phase before it does the preprocessing. However the CSharp compiler does not . This means adding an inline c style comment before the # is allowed in C++ and still works as a preprocessor statement. However the CSharp compiler does not see it as a preprocessor statement at all and will ignore it if it is in an inactive block which means the following rewritten code from above works when compiled by the CSharp Compiler and a C++ compiler

#if __cplusplus

// C++ code goes here

/**/#include <cstdint>
/**/#include <string>
using std::string;

#else

//CSharp code goes here
using System.Text;
using System.Collections.Generic;

#endif

This works with the CSharp 13 compiler for .Net 9.0 and earlier versions. It might not work in future versions. I don’t suggest anyone use this for anything Serious but it is interesting to know that it can be done. The /**/# trick works for any problematic C++ preprocessor statement in an inactive block, So with careful coding you can have have a class in a .cs file work as a CSharp class and an inline c++ class if you #include the .cs file in a c++project.

ME3 Coalesced Utility

 

The ME3 Coalesced Utility allows you to open the Coalesced.bin file that comes with Mass Effect 3. This tool should work with Mass Effect 3 Legendary Edition too according to user reports. The latest version now supports editing and saving the file. The utility will make a backup of any file loaded (filename.bin.original).

Current Version
1.2 – Supports adding and renaming items in the tree
ME3Coalesced-latest

Previous Versions:
1.1 – Supports editing
ME3Coalesced-1.1

1.0 – Doesn’t support editing
ME3Coalesced-1.0

.net Framework 4 (Client Profile) is needed. Download it here.

May 232011
 

After not being able to find a module that worked quite as we wanted, I created a simple Age Gate module for Drupal 7. This module very basic and has various hardcoded paths in it.

The module redirects all anonymous users to the agegate page and requires that they check the ‘Over 18’ checkbox before they can view content on the site. If they don’t check to box and press submit they get redirected to a page at the path ‘access-denied’ (this is the page we use on our site). The module is coded to allow non agegate access to logged in users, the ‘user/login’ page and the ‘access-denied’ page.

Download it here. Module is provided as is. Agegate Module for Drupal 7