pouët.net

64k intro in c#

category: code [glöplog]
 
Someone had developed 64k intro using .net framework ?
added on the 2018-05-04 21:07:48 by fxgen fxgen
I don't think this is viable/possible at all. Please correct me if I'm wrong.
added on the 2018-05-04 21:15:29 by jco jco
I think it would be tough; executable compressors do exist, but I'm not sure their compression ratio vs the .NET code size makes it viable.
added on the 2018-05-04 21:29:52 by Gargaj Gargaj
I *think* it's possible (I have been thinking about this for quite a while), but it'll need some effort.

.NETZ seems to just compress the binary and add some hacks to make it work, like a basic dropper. This is far from ideal, as the file format is rather redundant and stupid (UTF-16 strings, really?).

.NET binaries consist of the bytecode (which could benefit from a transformation à la kkrunchy), and the metadata tables (lots of uninteresting stuff you probably want to get rid of, unless you're using reflection). Libraries such as dnlib can be used for this. (Mono.Cecil only performs 'high-level' bytecode modification, so it isn't suited for this.)

There are multiple ways to approach this:
* 'nondestructive transformation' of the binary: make the data more compressible while leaving it legible for the parser, then prepend a smaller CorExeMain stub.
* Store the data in a custom format, reconstruct a valid file at runtime, then execute it.
* This can be done using both a .NET dropper or a native dropper. Both have up- and downsides. (Cross-platform, code can be loaded through reflection, but it's large, vs. small, but harder to set up, and both the .NET Framework and Mono have to be taken into account.) (Though, I'm probably the only one here who cares about Mono.)
* Compile from source at runtime. Most .NET installations come with csc (command-line C# compiler) automatically, but I don't think this is the case for newer .NET versions, although I'm not sure (it's been ages since I last used Windows). Most Linux distros (and probably BSDs, too) ship the Mono runtime and the entire thing separately as well.

Of course, a compressor has to be fit somewhere in between, and getting a window + an OpenGL context set up probably won't be easy either, as XNA/MonoGame/OpenTK/... won't be available. (You probably want runtime code generation to create all the OpenGL functions. Either do this in the dropper, or using System.Reflection.Emit)
added on the 2018-05-05 16:54:34 by porocyon porocyon

login