Jump to content
Sign in to follow this  
Sonarpulse

A command line Mix editor

Recommended Posts

well pretty much everything is better than C so Haskell probably isn't an exception to that rule. Took me like 30 minutes to port a simple C++ macro to get the value of a memory address as a value of a specific type to C. Can kinda blame GCC giving me gay warnings though (never used GCC before). In the end I did fix cnc-ddraw video stretching for RA1 and added support for GDI stretching. Though to stretch the score and map selection screens you need to be running my unreleased patch. :)

Edited by Iran

Share this post


Link to post

Yeah C is really not worth it in this situation. I mean installing virtual machines can be annoying, but there are plenty of languages that will give you a good old, self-contained, native binary. Haskell included.

 

And if performance really becomes an issue, there is always the foreign function interface (or compiling Haskell to C, but good luck reading that!)

Share this post


Link to post

well even Unix has .Net so it's not much of an issue unless you need all the performance or are constrained in cpu/memory or w/e.

Share this post


Link to post

Oh that wasn't supposed to be a dig on c# in particular (and certainly not anything you wrote). Mono is a great project, but the idea of any language mandating that it must be compiled to a VM binary strikes me as a bad engineering. The performance impact is usually not an issue so that doesn't concern me.

 

Edit: Also github is removing their download's feature. Stuff already there will be hosted for another 90 days but I guess I'll be putting new binaries on mediafire or something.

Edited by Sonarpulse

Share this post


Link to post

Thanks for the notice, gotta move my RAED standalone download.

 

VMs have some really useful benefits over compiled binaries though, one of them being performance.

Share this post


Link to post

hmm? VMs definitely hamper performance. I guess you can run multiple programs under the same VM to save on process start-up time, but threads also solve that problem.

Share this post


Link to post

Uhm, the official Java VM has around 10% less performance than C, the only downside is that it uses a lot of memory. .Net also isn't doing that badly, though Mono is crap. Java is pretty slow with start up because of a mess with their depdency loading logic but .Net programs load up pretty much instantly for me.

 

For example Paint.Net has around 162k lines of code according to Wikipedia and it starts up in 2 seconds on my PC. .Net can be compiled AOT to native code with NGEN for quite a while, which is also designed to prevent slow start up time.

Edited by Iran

Share this post


Link to post

Well what's done is a release is compiled and you can run NGEN.exe to AOT compile it. The downside being of course that the program doesn't work on anything but supported Windows versions anymore.

Share this post


Link to post

Ooh, neat. Gotta check it out.

Share this post


Link to post

Thanks! Tiberian Dawn and Red Alert uncompressed are now supported. Help menus are also better. My windows is still not compiling for some reason, so if anybody could install Haskell that would be great. Merri from IRC compiled this windows binary for me, but I haven't seen him on the forum so I dare not rely on him.

Share this post


Link to post

Merri? The Finnish dude who made the String editor? You got him on irc? where does he hang out?

 

I've wanted to ask him about his string editor for ages... I fixed some bugs in it (by hacking it), but it would be nice if he published an official version with the same fixes. Basically, his current version has a 1-based index while it should be 0-based, and the internal "changes not saved" flag doesn't reset when saving, which causes the program to always give an annoying warning when you close it.

 

ppmsite.com/forum/viewtopic.php?p=441859

Share this post


Link to post

Hi guys! I just found this thread while searching for how to decode XCC Local MIX Database files.

Nyerguds' reference in post #5 was a good starting point. Unfortunately, after fiddling around with this for hours and looking at several MIX files created by XCC as well as the XCC source code, i found out he was totally wrong about the structure. If you're looking at lots of packed zero bytes you easily get confused. But if it looks like a PC program would be using big endian there's a reason to become suspicious. And indeed, XCC doesn't.

So here is what I found out to be the real structure of LMD files:

  • 32 ID-Bytes: "XCC by Olaf van der Spek\x1a\x04\x17\x27\x10\x19\x80\x00"
  • 4 Bytes: Total Filesize
  • 4 Bytes: XCC File Type. This seems to be always 0 for LMDs but it is 2 for XIFs.
  • 4 Bytes: XCC File Version. Currently this is hardcoded to always be 0 in XCCs sources
  • 4 Bytes: Gametype! This allows you to identify how the keys were calculated. 0 for TD, 1 for RA, 2 for TS, and so on...
  • 4 Bytes: Number of names in file.

This is followed by all names separated by zeros.

In the XCC sources the first four blocks are organized as a separate data structure called XCC header, while the rest of the file belongs to the LMD header.

Enumeration of Gametype is as follows, even though there are no differences between some of these:

enum t_game
{
    game_td,
    game_ra,
    game_ts,
    game_dune2,
    game_dune2000,
    game_ra2,
    game_ra2_yr,
    game_rg,
    game_gr,
    game_gr_zh,
    game_ebfd,
    game_nox,
    game_bfme,
    game_bfme2,
    game_tw,
    game_ts_fs,
    game_unknown
};

I'm currently coding a MIX Editor in Python 3. You can find the sources at http://github.com/Bachsau/Mixtool.

Here is what it currently looks like:
post-10277-0-48059200-1434798555_thumb.png
And it works!

Edited by Bachsau

Share this post


Link to post

Nice! Yeah, game type is definitely important so the program knows which mix algorithm to use for hashing the filenames.

Share this post


Link to post

Check out https://github.com/OmniBlade/ccmix where I've implemented reading and writing of the encrypted header using a crypto library rather than relying on the almost unfathomable XCC code. There is also code there for handling the LMD and GMD and if you intend to allow creating mix files from scratch, please make the addition of the LMD optional. If your C++ isn't too great I can explain the structure of the encrypted header to help you implement it instead. I assume there are crypto modules available for python that provide raw RSA transforms and Blowfish.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×