Forum Archive

Go Back   3D Realms Forums > 3D Realms Topics > Other Apogee/3D Realms Games
Blogs FAQ Community Calendar

Notices

 
 
Thread Tools
Old 06-26-2010, 07:46 PM   #41
Malvineous

Malvineous's Avatar
Re: Source code for older games
Funny you link to Keen:Modding, the disassembly of Keen produced a large number of patches, but the "C" version was still rewritten from scratch because it was far easier than reconstructing anything. Advanced disassemblers like IDA Pro will automatically recognise common code signatures and convert them to familiar C statements (while loops, switch blocks, etc.) but even with that help it's still easier to do a rewrite from scratch instead.

The problem is that most people don't realise just how low-level the disassembly still is. Using the keyboard as an example, you need to be familiar with the protocol used by a chip on the motherboard just to recognise when some part of the code is dealing with the keyboard. Take a look at some documentation on the keyboard interface and you'll see what I mean. You need to be familiar with much of that before you can hope to understand the disassembly - for just the keyboard routines! Those are also by far the simplest, once you start looking at the video card or even worse setting up DMA transfers for digitised sounds you'll be tearing your hair out...

The 'easy tweaks for fun' is about the most you could reasonably hope to achieve, but that's still very, very time consuming...
Malvineous is offline  
Old 06-27-2010, 06:22 PM   #42
Psycho87

Psycho87's Avatar
Re: Source code for older games
Quote:
Originally Posted by Malvineous View Post
Funny you link to Keen:Modding, the disassembly of Keen produced a large number of patches, but the "C" version was still rewritten from scratch because it was far easier than reconstructing anything.
What "C" version are you referring to? I believe there is more than one remake. I don't know too much of the Keen projects actually, I only linked to that site to show that there is interest in modding the Keen games.

If you are interested in the exact behaviour of the games (like I am), starting from scratch is not an option.

Quote:
Originally Posted by Malvineous View Post
Advanced disassemblers like IDA Pro will automatically recognise common code signatures and convert them to familiar C statements (while loops, switch blocks, etc.) but even with that help it's still easier to do a rewrite from scratch instead.
IDA Pro has a plugin now called Hex-Rays that you can use to view a C-version of any function. It can also recognise jump tables for switch statements and functions of popular libraries. But the main output is still assembly. Really, with some patience and time it is quite possible to create a well-commented and documented disassembly to fix bugs, or alter parts of the game. And to figure out how certain things are done, just out of curiosity.

Quote:
Originally Posted by Malvineous View Post
The problem is that most people don't realise just how low-level the disassembly still is. Using the keyboard as an example, you need to be familiar with the protocol used by a chip on the motherboard just to recognise when some part of the code is dealing with the keyboard. Take a look at some documentation on the keyboard interface and you'll see what I mean. You need to be familiar with much of that before you can hope to understand the disassembly - for just the keyboard routines! Those are also by far the simplest, once you start looking at the video card or even worse setting up DMA transfers for digitised sounds you'll be tearing your hair out...
Any good DOS programmer would know that stuff. Programming the EGA or VGA, the SoundBlaster or all the other hardware in use back then isn't hard at all imo. Back then processors weren't as fast as they are today either, and in-depth knowledge of the hardware you were programming for was essential to writing optimized code.

http://www.osdever.net/FreeVGA/vga/vga.htm
http://www.qzx.com/pc-gpe/

Quote:
Originally Posted by Malvineous View Post
The 'easy tweaks for fun' is about the most you could reasonably hope to achieve, but that's still very, very time consuming...
Like I said. With some patience and time, it is quite possible to create a well-commented and documented disassembly. I already said I have a copy of Herman Perk's Supaplex disassembly. Supaplex may be a fairly simple game, but Monster Bash and the Keen series aren't really that much different.
__________________
~ Psycho ~
Psycho87 is offline  
Old 06-28-2010, 06:30 AM   #43
Qbix
DOSBox Advisor

Qbix's Avatar
Re: Source code for older games
In the above:
s/some/'a lot'/

Thanks.
Qbix is offline  
Old 06-28-2010, 07:01 AM   #44
Psycho87

Psycho87's Avatar
Re: Source code for older games
Quote:
Originally Posted by Qbix View Post
In the above:
s/some/'a lot'/

Thanks.
Well, it depends on the program, and how patient you are But fine, 'some' is too easy. Still, games like the Commander Keen series and Monster Bash are definitely quite doable.

For these 16-bit games:

1) Clean up disassembly, data into arrays etc., make sure all code is properly disassembled, create offsets where necessary.

At this point you should be able to reassemble the program, test if all is ok by shifting parts of the code and data segments.

2) Interpret code and comment functions and data accordingly. (Takes the most time, but quite doable if you have the knowledge, patience and time)

And if you want,
3) Port disassembly to C
__________________
~ Psycho ~
Last edited by Psycho87; 06-28-2010 at 11:16 AM.
Psycho87 is offline  
Old 06-28-2010, 05:38 PM   #45
Malvineous

Malvineous's Avatar
Re: Source code for older games
Exactly my point. You can't just download a disassembler, run it and be done. You need to know almost enough to have written the game in the first place, or at least be very familiar with the hardware it used.

Also since (AFAIK) most ID games did everything themselves (no external code/libraries used) then that part of a disassembler wouldn't be much help. Your step 2 of "interpret code" also belies the true complexity of such a task. If you think it is that easy, why not try it with Monster Bash? Plenty of people would love to see a properly annotated disassembled version, but I suspect you would find it much harder than it seems... (although it certainly sounds like you have the skills to get it done eventually!)

Re the C version of Keen I was referring to Commander Genius, it has gotten the furthest of the handful of remakes.
Malvineous is offline  
Old 06-29-2010, 09:45 AM   #46
Psycho87

Psycho87's Avatar
Re: Source code for older games
Quote:
Originally Posted by Malvineous View Post
Your step 2 of "interpret code" also belies the true complexity of such a task. If you think it is that easy, why not try it with Monster Bash? Plenty of people would love to see a properly annotated disassembled version, but I suspect you would find it much harder than it seems... (although it certainly sounds like you have the skills to get it done eventually!)
I started working on BASH2 two days ago. I successfuly unpacked the executable and already cleaned up much of it. I currently have 744 functions, which is a lot more than I expected (a lot of them are small). But I will keep working on it. Will be slow though, as I have a lot of other things to do aswell.

One problem, would 3DR/Apogee allow me to put it online when I'm done?
__________________
~ Psycho ~
Psycho87 is offline  
Old 06-29-2010, 05:48 PM   #47
Malvineous

Malvineous's Avatar
Re: Source code for older games
As long as you don't post the game data files, it will be impossible for anyone to use your disassembled version without owning the game already. So I don't think 3DRealms will have a problem with it. They've certainly never complained about the various Commander Keen disassemblies and patches floating around.

Having so many little functions is one of the things I found annoying when I disassembled Bio Menace to discover the cheats. Many of the functions are so small that there is no clue what they are for, until you have figured out what many other functions do first - and following the execution path through all these little functions can get really confusing!
Malvineous is offline  
Old 03-06-2011, 04:50 PM   #48
lemm
Re: Source code for older games
Hello,

I'm starting a reverse project on a certain unmentionable game (II). I have a few questions about the source code from the old EGA 2D scrollers.


First, I was wondering if any of the source of the 16-colour 2D EGA games has been found (particularly those of the Duke/Cosmo/MajorStryker family). From the responses in this thread, it doesn't look like it. I'm interested in what appears to be an EGA graphics library for drawing tiles+sprites (it is in the same segment as the borland std c libraries), but using IDA sigmake on any of the borland libraries doesn't identify these functions. Anyways, I was wondering if anyone might have the source for that library.

Second, is the source of Jason Blochowiak's sound module available somewhere?
lemm is offline  
Old 03-07-2011, 08:23 PM   #49
JeremyHDragon
Re: Source code for older games
Hmmmmmm.....Amazing of this kind of idea. Having the source codes. I thought of HD remake of them. But oh well.
JeremyHDragon is offline  
Old 03-09-2011, 03:57 AM   #50
Darkman 4
Re: Source code for older games
Quote:
Originally Posted by JeremyHDragon View Post
Hmmmmmm.....Amazing of this kind of idea. Having the source codes. I thought of HD remake of them. But oh well.
Making HD remakes of old EGA sidescrollers would be easier by starting from scratch instead of trying to fit HD graphics into old 1991-era engines.
Darkman 4 is offline  
Old 03-11-2011, 12:20 PM   #51
IceColdDuke
Re: Source code for older games
Quote:
Originally Posted by Psycho87 View Post
I started working on BASH2 two days ago. I successfuly unpacked the executable and already cleaned up much of it. I currently have 744 functions, which is a lot more than I expected (a lot of them are small). But I will keep working on it. Will be slow though, as I have a lot of other things to do aswell.

One problem, would 3DR/Apogee allow me to put it online when I'm done?
I doubt 3dr will come after you but it doesn't mean they won't. Aside from the fact your not grasping how much of a endeavor something like this is even for a small exe. I don't get what you mean by "unpacked the executable", and "cleaned up most of it", are you using IDA?
Last edited by IceColdDuke; 03-11-2011 at 12:22 PM.
IceColdDuke is offline  
Old 03-27-2011, 05:36 AM   #52
Malvineous

Malvineous's Avatar
Re: Source code for older games
Quote:
Originally Posted by lemm View Post
First, I was wondering if any of the source of the 16-colour 2D EGA games has been found (particularly those of the Duke/Cosmo/MajorStryker family). From the responses in this thread, it doesn't look like it. I'm interested in what appears to be an EGA graphics library for drawing tiles+sprites (it is in the same segment as the borland std c libraries), but using IDA sigmake on any of the borland libraries doesn't identify these functions. Anyways, I was wondering if anyone might have the source for that library.
I would guess the library was written in house, and it was a library rather than part of the game to make it easier to use again in other games. Remember these were the days when game engines were the main selling point for each new game - smoother scrolling, parallax'd backgrounds, more colours, etc. Reusing the engine from one game in another - without significantly improving it first - was almost unheard of. So it's extremely unlikely it would be an off the shelf library.

Having said that, the source code for Xargon is available, and they did use a third party library for parts of it (such as the audio) but in that case all the sprite/tile code was still custom.
Malvineous is offline  
Old 03-27-2011, 12:17 PM   #53
King Duke

King Duke's Avatar
Re: Source code for older games
Quote:
Originally Posted by lemm View Post
Second, is the source of Jason Blochowiak's sound module available somewhere?
I think the Wolf3D sound code was written by Jason Blochowiak, so this might be worth a shot. Thinking about it, Duke II offers the same sound features (PC Speaker/AdLib/Digitized sound effects) as Wolf3D.
King Duke is offline  
Old 03-28-2011, 01:25 AM   #54
Psycho87

Psycho87's Avatar
Re: Source code for older games
Quote:
Originally Posted by IceColdDuke View Post
I doubt 3dr will come after you but it doesn't mean they won't. Aside from the fact your not grasping how much of a endeavor something like this is even for a small exe. I don't get what you mean by "unpacked the executable", and "cleaned up most of it", are you using IDA?
With cleaning up I meant what I said in a post above: "Clean up disassembly, data into arrays etc., make sure all code is properly disassembled, create offsets where necessary."

Unpacking the executable: http://en.wikipedia.org/wiki/Executable_packer

And yes, I am using IDA, as I mentioned in a post above as well.

Anyway, I stopped working on this project months ago. I still believe that with a lot of patience it is quite doable, but like I said, the game has a lot more code than I expected and a disassembly of Monster Bash is not important enough for me to spend the required time on.
__________________
~ Psycho ~
Psycho87 is offline  
Old 04-06-2011, 09:42 PM   #55
Darkman 4
Re: Source code for older games
Quote:
Originally Posted by bulldozer View Post
Wouldnt it be easier asking Carmack if he could release the source of his work in the Keen games?
It's been so long that iD might've gotten rid of it a while ago. Still worth a shot tho.
Darkman 4 is offline  
Old 04-09-2011, 07:02 PM   #56
IceColdDuke
Re: Source code for older games
Quote:
Originally Posted by bulldozer View Post
Yeah, someone should email him if he still has them.
Having them and having a working copy are two different things, knowing John Carmack if he had a working copy that he could release he probably would have done it ages ago.

You really can't expect to use IDA to reverse a complete working copy of any executable module. The best route would be to identify specific functions that used by the engine to load in assets, and any game specific functions you need(timing etc) and reprogram the entire the game based on your findings from IDA.
IceColdDuke is offline  
Old 04-15-2011, 06:29 AM   #57
Psycho87

Psycho87's Avatar
Re: Source code for older games
Quote:
Originally Posted by IceColdDuke View Post
You really can't expect to use IDA to reverse a complete working copy of any executable module. The best route would be to identify specific functions that used by the engine to load in assets, and any game specific functions you need(timing etc) and reprogram the entire the game based on your findings from IDA.
Yes you can. It depends on the size of the executable of course, disassembling the Unreal 3 Engine is practically impossible, but like I said, I have a copy of Herman Perk's disassembly of the old DOS game Supaplex. It can be reassembled and has comments. A lot of bugs were fixed and some features were added.
Monster Bash and other old Apogee/Id games are a little more complex, but with patience, these games can be reverse engineered as well.
__________________
~ Psycho ~
Psycho87 is offline  
 

Bookmarks

Tags
source code


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 02:51 PM.

Page generated in 0.14529610 seconds (100.00% PHP - 0% MySQL) with 19 queries

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.

Website is ©1987-2014 Apogee Software, Ltd.
Ideas and messages posted here become property of Apogee Software Ltd.