Can C# decompress unknown files compressed with CoDec::Compress calls in C/C++?

This is a discussion on Can C# decompress unknown files compressed with CoDec::Compress calls in C/C++? within the C# Programming forums, part of the General Programming Boards category; My story: I have an Enemy Nations savegame file and I would like to write a C# routine to decompress ...

  1. #1
    Registered User
    Join Date
    Jan 2011
    Posts
    8

    Question Can C# decompress unknown files compressed with CoDec::Compress calls in C/C++?

    My story: I have an Enemy Nations savegame file and I would like to write a C# routine to decompress it. This is so I can learn what the file format is, and whether some old files that don't work can be fixed to work using C# methods written to parse them. I'll be trying to figure out the parsing myself, I just don't know if this would work or not, as the only information I've been able to dig up on CoDec relates to video codecs, and I'm not even sure if that would be the right reference.

    I've been looking through 892MB of Enemy Nations source code, and in order to decompress it I think I need to make calls to a C# equivalent of a C++ CoDec::Decompress routine that was written several years ago, but I'm not sure if that exists, or if it would even work.

    First, this depends on whether you have a copy of an 892MB Enemy Nations source file, and additionally depends on whether you have an interest in looking through page after page of unfamiliar code looking for clues on whether this is actually possible or not.

    Second, it also depends on having access to an Enemy Nations savegame file to test decompression on, but that's a relatively easy task if you have a copy of Enemy Nations installed on your hard drive.

    If none of the above paragraphs throws you off, and if you've read this far, can you tell me what I need in order to decompress the savegame files?

    Cheers ...

    DarkVoid

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,533
    > I've been looking through 892MB of Enemy Nations source code
    If you've got the source code, then look for where "Load game..." is implemented, and trace forward from that point.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Jan 2011
    Posts
    8
    Quote Originally Posted by Salem View Post
    > I've been looking through 892MB of Enemy Nations source code
    If you've got the source code, then look for where "Load game..." is implemented, and trace forward from that point.
    Tracing forward is a bit hard if I have to do it without any idea of how to compile source which was written for a compiler that is long since obsolete.

    From the license.txt file included with the source code:

    3) This was built using the VC++ in release in 1990/91 - the one that came in the very big box.

    That's several years ago, almost two decades ago now if I'm not misplacing my carries.

    Cheers ...

    DarkVoid

  4. #4
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,460
    While possibly not compilable off the bat, you can still load these files into an empty project in Visual Studio and obtain from IntelliSense where the class CoDec is being implemented.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,533
    I figure that 890MB of the files you have is just data files (images, animations, audio etc etc).

    As Mario says, all you need is a decent code editor with some index capability, and you should be able to get going with a few searches.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  6. #6
    Registered User
    Join Date
    Jan 2011
    Posts
    8
    Quote Originally Posted by Salem View Post
    I figure that 890MB of the files you have is just data files (images, animations, audio etc etc).

    As Mario says, all you need is a decent code editor with some index capability, and you should be able to get going with a few searches.
    Would you have any recommendations? I've been trying to find a good editor, that is a problem for me here.

    It should be Windows-based or at the very least capable of running on Windows XP patched up to the latest patches.

    I don't have a VC++ .vcproj file anywhere in the source, so either this wasn't created back then or was left out of the distribution folder.

    If anyone wants to obtain the source for a look please visit the link below and click on the "Full Source Package" download link, which takes you to a download page where the rar archive is:

    https://launchpad.net/enations

    Cheers ...

    DarkVoid

  7. #7
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,460
    You said you want to develop a C# program. I'm surprised you are asking for an editor. What's wrong with Visual Studio?
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  8. #8
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,533
    Projects that old used .dsw / .dsp files.
    IIRC, these could be imported (one way) into the later IDE's.

    Do you really mean C#?
    The link you posted mentioned cross-platform / C++ / Qt
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  9. #9
    Registered User
    Join Date
    Jan 2011
    Posts
    8
    Quote Originally Posted by Salem View Post
    Projects that old used .dsw / .dsp files.
    IIRC, these could be imported (one way) into the later IDE's.

    Do you really mean C#?
    The link you posted mentioned cross-platform / C++ / Qt
    Yes I really mean C# - for a couple of reasons:

    C# is a much more structured programming language, there's less that could go wrong and I don't have to rely on getting my C++ correctly built to handle all the possibilities, plus I would be spending a lot more time having to go through possible cases with C++ whereas I could use C# to simplify things a bit as stated below.

    Classes mean a lot more in C# than they do in C++ and the nature of them means if correctly designed, I could save a lot of programming just by building the classes properly.

    There is much more developed Windows Forms accessibility in the Microsoft C# implementation.

    That being said, I do find C# more difficult than C++ to get to grips with, maybe it's because C# actually requires you to think things through and plan out your methods and program flow, where with C++ you can get by with messes of simplistic statements that don't really represent the flow through your program properly. I did try C++ initially, but after someone pointed out that a lot of poorly built code would look like spaghetti code with no real meaning or purpose, I decided I wanted to at least give C#'s more methodical programming a try.

    I did want to have a thorough go at doing it in C#, if someone could point out things C# could not do with data manipulation from an input file that are possible with C++, then please do. However, kindly take discussion of which language is better to the appropriate forum here, as I do not wish for this topic to devolve into "which language is better" discussions and flaming.

    Cheers ...

    DarkVoid

  10. #10
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    Classes mean a lot more in C# than they do in C++ and the nature of them means if correctly designed, I could save a lot of programming just by building the classes properly.
    Um wrong, wrong, and...wrong.

    • Classes do not mean more in C# than C++ or vice versa. This statement makes no sense at all.
    • Correctly designed classes are just as powerful in either language. The language of choice has nothing to do with how powerful the class is with respect to C# and C++.
    • You can create ugly code in C# just as in C++ if you do not have the skills to create well structured object oriented code. C# doesn't save you from yourself anymore than C++ does. You can still create memory leaks in C# and if you code in C# without thinking about the underlying memory ramifications then you are not using the language correctly. Just because it shelters you from the nitty gritty of memory management does not mean you can just ignore it altogether. C# also does not force you to structure your code correctly and you do not become a better object oriented programmer by using C# if you were not a good object oriented programmer to begin with.

  11. #11
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,460
    Quote Originally Posted by DarkVoid View Post
    However, kindly take discussion of which language is better to the appropriate forum here, as I do not wish for this topic to devolve into "which language is better" discussions and flaming.
    Yes well, you were the one that suddenly brought it up when no one was asking about anything like that. And you brought it in a way to induce discussion, since your arguments are just plain and simply wrong.

    Anyways, Visual Studio is what you will want to use. Reuse one of the Project or Workspace files on that project (if it has one) to load it in Visual Studio, or create a new project and load the files into it.

    One more thing...

    Quote Originally Posted by DarkVoid View Post
    spaghetti code
    When you come to realize you cannot separate declaration from definition in C#, your classes and their elements have to be defined where they have been declared and your only mechanism for some sanity relies on building partial classes, you may change your mind.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  12. #12
    Registered User
    Join Date
    Jan 2011
    Posts
    8
    Quote Originally Posted by Bubba View Post
    Um wrong, wrong, and...wrong.
    You make no sense ... First you start off with "um". Then you proceed to cite all of your arguments underneath a single sentence of my reply. If you're going to debunk someone's arguments you really should reply to them properly.

    What your posting just yelled at me is that you have no clue whatsoever about what you just said, and that you're trying to seem intelligent.

    And this from a supermod. I think I'll go elsewhere to find my answers, this is exactly the sort of discussion I no longer need.

    Finally, please do everyone a favor and delete this thread, it has obviously become useless.

    Cheers ...

    DarkVoid

  13. #13
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,460
    Son, Bubba has more lines of code under his armpit than you can possibly carry in your brain. I suggest you find another target.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  14. #14
    Registered User
    Join Date
    Aug 2003
    Posts
    1,205
    Well one final tip from me before you leave then; you probably want to spend more time listening to the people who are correct in what they are saying rather than getting offended because somebody told you you were wrong (yes you were wrong in that sentence and bubba is right).

    Edit: Nice one Mario, will have to remember that one

  15. #15
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,399
    Quote Originally Posted by DarkVoid View Post
    What your posting just yelled at me is that you have no clue whatsoever about what you just said, and that you're trying to seem intelligent.
    That's entertaining, considering I had the exact same feeling about your post.

    At least this saves me from wasting time looking through the code that just finished downloading.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  2. Linking header files, Source files and main program(Accel. C++)
    By Daniel Primed in forum C++ Programming
    Replies: 3
    Last Post: 01-17-2006, 10:46 AM
  3. Reading compressed files
    By clancyPC in forum C Programming
    Replies: 4
    Last Post: 10-04-2005, 10:38 AM
  4. Writing Compressed Image Files
    By BenBartle in forum C++ Programming
    Replies: 1
    Last Post: 03-09-2005, 07:55 PM
  5. Replies: 1
    Last Post: 05-02-2003, 07:27 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21