Duke4.net Forums: Disassembly - Duke4.net Forums

Jump to content

  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Disassembly  "Adding New Assembly Language Code To Duke3D"

User is offline   Nukester10 

#1

If anyone else has even slightly taken a shot at this,Id really like to hear your story.
From what I understand when Apogee first developed Duke3D they wrote it in what's called Assembly Language.
The 3 Con files that allow editing can only be edited in relation to what has already been written in Assembly code in the Duke3D.exe.

Case in point,Meaning that you cannot add new perimeters to the game unless you get a hold of a good Disassembler and know what your doing, then after adding new assembly code you get an Assembler to reassemble the whole thing over again.

Without attempting this most complex endeavor I'm speaking of, I tried some things in the Con files a while back,it isn't like the program wouldn't run it ran splendidly it's just that, that's as far as it would go period, run.Because the stock assembly language just didn't understand what in the hell this new line in there was trying to say.Believe it or not there seems to be some actually really good Free Disassembly/Assembly Programs on the net but from what I've seen, unless you've gone to MIT or something you really are going to have fun trying to figure out how to run these things.One time I read a tutorial on fixing a Wacom bug a lot of people where having in relation to using the drawing pad with PSP and Gimp, no problem with Photoshop though because, I'm just guessing here, that Wacom designed it's interface based off of Photoshop originally.Anyhow the author said,to get a hold of HxD in which I did,turn a few 1's to 0's and off you go and sure enough it did the trick.Now of course that would obviously be considered a simple fix by most in comparison.Disassembling and Reassembling a program is a new one to me,that's why I'm asking. I don't really know what Apogee used but if you can picture what the dashboard of a 747 looks like to a pilot,then that picture would come the closest in comparison to what I saw as far as a free Disassembler and free Assembler looks like.Besides the fact that there isn't really any HowTo programs available out there for operating these things.Again,Just Askin,

Thanks for reading

This post has been edited by Nukester10: 13 November 2010 - 07:45 PM

0

User is offline   Jimmy 

  • Let's go Brandon!

#2

This might have been a good idea before the source was released, seems like it'd just be a whole lot of trouble for nothing.
0

User is offline   Hendricks266 

  • Weaponized Autism

  #3

3D Realms released the source code in 2003, and it's in C, not assembly. There's no need to decompile and disassemble the exe.

EDuke32 (and it's parent port JFDuke3D), with everyone that has worked on the chain, including Matt Saettler, Ken Silverman (original programmer on Duke's engine), JonoF, TerminX, Plagman, Hunter_rus, Helixhorned, Qbix, etc, has improved on this released source for 7 years, adding tons to the programming.

This post has been edited by Hendricks266: 14 November 2010 - 08:20 AM

0

User is offline   Hank 

#4

View PostHendricks266, on Nov 14 2010, 11:14 AM, said:

3D Realms released the source code in 2003, and it's in C, not assembly. There's no need to decompile and disassemble the exe.

EDuke32 (and it's parent port JFDuke3D), with everyone that has worked on the chain, including Matt Saettler, Ken Silverman (original programmer on Duke's engine), JonoF, TerminX, Plagman, Hunter_rus, Helixhorned, Qbix, etc, has improved on this released source for 7 years, adding tons to the programming.

Not quite. Ken Silverman re-wrote the assembly portions to c. The source I've got, has assembly and c in it. The catch was that you needed Watcom to compile it.

EDuke32, is now so flexible that you can use any C compiler, including Visual Studio Express (free), you can use OpenGL and DirectX, you have one of the best sound engines in it, you have a setup and those guys like TerminX, Plagman and Helixhorned and more are still improving on it as we speak. Forget assembly :blink:

This post has been edited by Hank: 14 November 2010 - 02:52 PM

0

User is offline   Hendricks266 

  • Weaponized Autism

  #5

View PostHank, on Nov 14 2010, 04:49 PM, said:

Not quite. Ken Silverman re-wrote the assembly portions to c.

True, although the assembly code only affected the classic renderer, and IIRC is still used when EDuke32 is compiled for x86.
0

User is offline   Nukester10 

#6

Well anyway I got a hold of Watcom after I got it set up for 32 I started reading through a whole bunch of info on the program
then once I got to an IDE help file,I started reading that one.
Within one of the subdirectorys contained herein there was a how to called,"Getting Started With A Short Tutorial"
next,"A Simple Executable".

Under Simple Executable it wasn't quite so simple,I got up to step 4 and that was it,

(1)Double-click on the IDE icon in the Open Watcom Tools window.
The Open Watcom IDE Project window appears


(2) Choose New Project from the File menu.
The Enter Project Filename dialog appears. The default project name is noname.wpj


(3) Enter the filename \project\first in the File Name field and click on OK.

Figure 4. Enter the filename in the Enter Project Filename dialog.

This is the name of the project you are creating. If you enter a directory that doesn't exist (in this case, \project), the IDE reveals a message box asking if you want to create the specified directory. Click on OK to create the specified directory and project file.


Note:
The IDE looks for existing projects with the new name. If a project with the specified name already exists, the IDE will prompt youthe IDE will prompt you rather than simply overwriting the existing project.
The project name appears in the title bar of the Open Watcom IDE Project window. Note that the IDE added the extension ".wpj" to the project name. The New Target dialog appears on the screen where you define a target for the new project.




Posted Image

Yea,it wasn't quite that simple though,what happened was that box popped up alright but it didn't say,LOOK IN Project Folder,it said look in my documents like it was random or something,like the program really didn't know where to look in the first place.In the File name it said "noname"but that was normal though and I was supposed to change it to,
"\project\first" in which I did and click "OK"

.........Notice it doesn't say, OK up there

For "Files of type" it did say what it says up there,"Project Files(*.wpj)

Now that one up there is what the 2003 Enter project filename Gui looks like,
this is what mine looks like for XP

Posted Image

The only reason now it says,Look in: Wacom folder is because I changed it.

So anyways what what was supposed to happen after I hit the OK button.....or in this case OPEN and what actually did happen are two different
stories,notice it said what should happen and that the "IDE will prompt you"
Well,I can tell you for sure no prompt popped up at all so there was NO prompting.At the most all it would do is create a shortcut and/or either a file called,project or first,depending on how I typed it when I was debugging and once I found the folder or folders, it/they would be empty anyhow.

Besides starting to see typos if I even got the bugs out of this setup,i don't know..... maybe there'll be more probs later on down the road too,what do you think?.
That's why I'm thinking about using something a little newer like,Visual Studio Express (free) but I checked and this deal seems to kinda suck too because even though its free it's only free for 90 days!?

Like I said in an earlier post,this kind of thing is all new to me,

Thanks for reading

This post has been edited by Nukester10: 14 November 2010 - 09:22 PM

0

User is offline   Omni 

#7

It sounds like programming is new to you and you are attempting to learn? If so I suggest to start with simple tutorials not the 12 year old Duke3d source code, which will probably turn you off of programming forever after your 3rd mental breakdown....

Also a newer then the specific version of Watcom this was written in will be more work then you are doing now. Work that has already been done in other source ports.

This post has been edited by Omni: 14 November 2010 - 09:22 PM

0

User is offline   Nukester10 

#8

Omni said,

Quote

programming is new to you so I suggest to start with simple tutorials


Well in order to do that you would have to get the program running in the first place wouldn't you think?

Quote

Also a newer then the specific version of Watcom this was written in will be more work then you are
doing now


I don't know exactly what your talking about but this version I'm using does happen to be the current stable
version 1.9 and was released in June 2010.
0

User is offline   Mr. Pink 

#9

Lots more people in the same boat, and just as many willing to help: C Programming - all you need is over here
0

User is offline   Omni 

#10

I think me and Mr. Pink are thinking the same thing here, let me see if I can be more clear.

If you are attempting to compile the original Duke3d source code and you have no programming experience or very little experience you would be better off with basic "Hello World" tutorials and progress from that point. If you are determined to learn by the Duke3d source you are better off doing that with Eduke32 or something in a more modern environment.

If you are absolutely determined to compile the original Duke3d source you will need Watcom 11 I think it is. This is the version from the mid 90's.
0

User is offline   Jimmy 

  • Let's go Brandon!

#11

I don't know much about programming, but I do know that the Duke3D Source was not well written at all, even for it's time. Everything is pretty much held together by bubblegum and scotch tape.
1

User is offline   Mr. Pink 

#12

+1 Omni ^^ I used to teach beginning/intermediate & a little advanced C. Even got paid for it back in the day (approx 20 (sheesh) years ago). Thankfully there are better & cheaper solutions online nowadays!

.
.
.

View PostCaptain Awesome, on Nov 15 2010, 03:44 PM, said:

I don't know much about programming, but I do know that the Duke3D Source was not well written at all, even for it's time. Everything is pretty much held together by bubblegum and scotch tape.


0) Not entirely sure, but my understanding is that certain portions of the Duke source tree are held together by scotch. Lots of scotch.

1) We don't need no steeeenkin' comments! (EDIT: reference to the code, not CA)

2) All kidding aside, you are absolutely right. This would explain why Duke is always out of gum.

This post has been edited by Mr. Pink: 16 November 2010 - 09:46 PM

0

User is offline   Nukester10 

#13

I'd just like to verify one thing, that what your looking at here actually is what's called "Assembly"not "Source"code correct?
Posted Image
This is a screebgrab taken of the Duke3D.exe within Notepad ++.
Notepad++ has many different language settings to chose from when viewing.

If you click on the Language tab right off as soon as you load the exe,it will highlight that what your looking at is not Assembly or any other language,it won't even tell you what language this is either,all that's ticked off is "normal text",if you wish to see what it looks like,click on another language but it won't look much different than it does here.

See,I had hoped that after viewing this in HxD originally that HxD could have also had shown this in C where it could have been edited more easily,but unfortunately that's not the way it seems to work. You'd figure by now that someone would
have come up with such a simplified program,rather than having to do the same old same old procedure of having to use a compiler to edit files like this.

Now heres a screengrab of the same Duke3D.exe within HxD
Posted Image
One slight difference between the two programs being,HxD calls this an RTS file,whereas Notepad++ calls this an exe file.
0

User is offline   Plagman 

  • Former VP of Media Operations

#14

DUKE.RTS is actually a different file, it has the multiplayer voice sound data; you just opened the wrong file. Anyway, DUKE3D.EXE isn't source code nor assembly: it's binary machine code. Assembly is a little more verbose than that. You can disassemble a binary like that to get instructions and registers, but you won't get the labels or annotations that might have been used to develop it. There's no trivial way to go from a binary to useful source code, though. The source code for Duke3D was released separately by 3D Realms a few years ago. See: http://www.3drealms....kem_3d_s_4.html

You can also find the source code for EDuke32 there: http://eduke32.svn.sourceforge.net/viewvc/...eduke32/source/
0

User is offline   Jimmy 

  • Let's go Brandon!

#15

Hahahaha... wow.
0

User is offline   Nukester10 

#16

Yes,Plagman I checked again and you where right,I did happen to open the wrong file,I'd like to correct myself
here and now and state that,"Yes HxD does actually show exe files also".

I would like to add though,that there's seems to be a lot of talk on HOW and WHERE to retrieve the original
Sourcecode for one to edit for oneself, but not really any posts by anyone on what they ended up with AFTER they compiled it and what compiler they actually used etc. etc. and for that matter not even any step by step details, how to's so to speak on the subject matter.

Now I'm not saying that it can't be done,all I'm doing is asking everyone if you know what you need to do it,
and you know how to do it.What did you come up with and could you enlighten me and everyone else with
that information after you did it?
0

User is offline   Omni 

#17

Ok let me try to put it in clear terms. You need to do research in this field, I suggest wiki and the terms "decompiler" and "disassmbler".

If you want to edit a binary program there are a few ways...

Easiest: If you have the source, adjust and compile it. THIS IS THE BEST/EASIEST WAY.

Hard: Decompiling a BINARY or machine language file. You will need alot of technical knowledge to do it this way properly.


The great thing about wanting to edit Duke3d is the source is available, you just want the version of Watcom they used 13 years ago...

I believe Watcom 10.0 or 11.0c work. Openwatcom may work if you can find a version old enough.

Edit: I worked on the post while doing other things and you posted before me. I am including a link to OpenWatcom. I suggest you get the duke3d source from 3drealms site under downloads and read the README.TXT in the zip.
Now getting it to compile is if I remember is tedious but straight forward if you know what your doing.

Now that I covered all that no one will hold your hand with this due to the fact no one messes with THIS VERSION of the source any more. If you want more help and a bigger community with a more in depth build process in the wiki then I suggest Eduke32. If this is still complicated you need beginner classes or Tutorials on the subject of programing.

ftp://ftp.openwatcom...m-win32-1.0.exe

This post has been edited by Omni: 16 November 2010 - 01:48 PM

0

User is offline   Hank 

#18

View PostNukester10, on Nov 16 2010, 04:31 PM, said:

Now I'm not saying that it can't be done,all I'm doing is asking everyone if you know what you need to do it,
and you know how to do it.What did you come up with and could you enlighten me and everyone else with
that information after you did it?

That's what I did. I contacted the original maker of the Build engine.
http://www.advsys.net/ken/build.htm

Than as Captain Awesome suggested, had a lot of scotch, actually Bourbon, went to the library and took every book about c. After a lot of coffee, I decided, c is not my language. - Ken Silverman himself suggest to use the farther developed source code written by JonoF http://www.jonof.id.au/jfduke3d . This will be the closest workable Build source code there is, for anyone to learn, because it's supported and activly developed, even so slowly.

Yet, I stand behind what I wrote also! Eduke32 is it, it's better, has more features, and has much more room for individuals to get into.

Added 9:00hr 17 Nov. 2010 after reading the below:
The above statement is based on my first approach to Build ten years ago and reading the current source code. I do not claim to be right, simply giving my opinion. In other words, if you need to know all the details on who did what and where and how on this code, and who is working on it – contact the current team. The Eduke team needs me like a hole in the head. :blink:

This post has been edited by Hank: 17 November 2010 - 06:26 AM

0

User is offline   Hendricks266 

  • Weaponized Autism

  #19

Just to clarify any potential misunderstanding for future readers, EDuke32 is based on JFDuke3D and continues to receive contributions, directly or indirectly, from JonoF.
0

User is offline   Plagman 

  • Former VP of Media Operations

#20

View PostNukester10, on Nov 16 2010, 01:31 PM, said:

I would like to add though,that there's seems to be a lot of talk on HOW and WHERE to retrieve the original
Sourcecode for one to edit for oneself, but not really any posts by anyone on what they ended up with AFTER they compiled it and what compiler they actually used etc. etc. and for that matter not even any step by step details, how to's so to speak on the subject matter.


There's a text file that describes what to do with it inside the source archive, IIRC. Basically, it involves installing some outdated version of the Watcom C compiler and it should compile right. After compiling all the C and assembly code to machine code, it links it into a DOS DUKE3D.EXE binary that you can use just like the one on the Duke3D CD.

However, that's all very old stuff. From this original source code people have branched source ports that support modern operating systems and compilers. See:

http://wiki.eduke32....ke32_on_Windows
0

User is offline   Nukester10 

#21

All I simply wanted is to have some of the features and flexibility one normally see's quite often in todays games,yet
sticking with a version of Dos so that I could run it through Dosbox. Also being able to add to the sourcecode,making the original code not necessarily better but bigger later on possibly. I don't want to have to download some 7 or 800MB program with better graphics and fancy map editors,call me Retro.

I'm really a big fan of the original look and sound of the original game,to me THAT'S DUKE NUKEM, one exception though
as far as modernization goes and that would be DUKE NUKEM FOREVER but that's a whole other story.

In case your wondering what features offhand I'm talking about I can only think of a very few at the moment.
Adding your own sound effects would be one.Placing one window over another would be nice also,
maybe even adding models to Dosbuild might be interesting,from what I understand you already can
do this with JFDuke but Dosbox doesn't support JFDuke so once again a dilemma stands.

This post has been edited by Nukester10: 16 November 2010 - 09:27 PM

0

User is offline   Omni 

#22

So you want to modify the original game to be like a new game but all running in dos? That is not retro. That is... I do not know what that is, I can not even begin to fathom what that is

This post has been edited by Omni: 16 November 2010 - 09:24 PM

0

#23

Yeah, you can just throw EDuke32 into 8-Bit graphics mode and not install the HRP, it will look, sound and feel like the original DOS version but you would have to option of using the advanced features if you later wished to.

@Omni; Aye, Retro is when you have a load of DOS machines lying around and run it on one of those, IMHO DosBOX does a poor job at emulating some of the features available in MS-DOS, for example, the AdLib. Ah, MS-DOS...

This post has been edited by High Treason: 16 November 2010 - 09:26 PM

0

User is offline   Omni 

#24

Yes, but he does not want to keep those original features. He just wants a modern game to run in dosbox.

Edit: What he wants can already be done in Eduke32 with con code but he can not use Eduke32 because it does not run in dosbox.

This post has been edited by Omni: 16 November 2010 - 09:30 PM

0

User is offline   Nukester10 

#25

Yes,it has to run in Dosbox.
0

User is offline   Tetsuo 

#26

Or he doesn't want to use it.
0

User is offline   Omni 

#27

Then that is a ridiculous self imposed limitation Eduke32 does EXACTLY what you want with the original artwork, it just runs in Windows/Linux/MacOS natively with out the need for Dosbox.
0

User is offline   Omni 

#28

If you are truly wanting to do what you say you want to do the best advice would be run a later source port in windows. If you are hellbent on Dosbox only(WHY?!) you will need to learn Programming to an advanced level. Specifically C and ASM. The problem is I do not believe Duke3d was written in ANSI C(Someone correct me?).

This post has been edited by Omni: 16 November 2010 - 09:44 PM

0

User is offline   Nukester10 

#29

Omni said,

Quote

Yes, but he does not want to keep those original features.

What i basically want is to have what looks and sounds like the original Dos game,yet
be able to have newer features and run it specifically through Dosbox only.


Tetsuo said,

Quote

Or he doesn't want to use it.

I don't know what your talking about and yes I do want to use it.
0

User is offline   Mr. Pink 

#30

View PostHendricks266, on Nov 16 2010, 06:49 PM, said:

Just to clarify any potential misunderstanding for future readers, EDuke32 is based on JFDuke3D and continues to receive contributions, directly or indirectly, from JonoF.
Glad to hear it! I was wondering if he was in the loop.
0

Share this topic:


  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options