Megahal Brain Endianness Converter
This post introduces a converter for megahal.brn files which converts files created on big-endian machines (e.g. PPC Mac, Amiga, SunOS) to files usable on little-endian machines (e.g. Windows, Linux x86).
You can get the source code here.
The source is licensed under the GPL v2 (but you can use v3 at your option), just like the original MegaHAL.
At this point, anyone running MegaHAL on OS X had to compile it from source, so I don’t feel bad about not providing an OS X executable, despite the fact that I run OS X as my primary OS. Frankly, I doubt anyone will use this, but I feel I’ve been sitting on the code and it might be useful to someone. If you do require an OS X executable, just leave a comment. The only reason I included the Windows exe was to test out my cross-compiler. You can compile the code with a simple
gcc brnconvert.c -o brnconvert.
IMPORTANT NOTE: Do not try to make the output file the same as the input file. I have a check in there to prevent this, but there may be cases it doesn’t catch. If you make the input and output files the same, it will just erase the file.
On a less dangerous note, there is a DOS binary of MegaHAL which is being distributed from the official site’s /old/ directory. For some reason, it does not write the first byte of the root node of each tree, but other than that it uses the same format. This should break MegaHAL, but it strangely doesn’t. I could not find the source code for that version, so my converter will not work with brain files generated by that version. If you have any insight into this problem, please contact me.