Jump to content

CnCNet Forums

Search In
  • More options...
Find results that contain...
Find results in...
ROB

Coding and Hexadecimal

Recommended Posts

So I'm afraid I may have missed my calling, I never really learned how to program other than a few classes here or there. I understand the basics, like binary, IF THEN logic, but I don't know any languages. I got wrapped up in something totally different. Lately I have been trying to figure out exactly what hexadecimal is. I think I got the basics of that down. When I look at topics such ashttp://cnc-comm.com/community/index.php?topic=2456.0 and see the code there, it looks like just Hex editing. Is that correct? How do you guys even know what your looking at then? It seems like it could translate to almost anything, seems like shooting blind to me. Can anyone explain or clarify further? I'm not looking for lessons here just curious on how it works.

Share this post


Link to post
Share on other sites

The computer only "read" numbers. An bunch of numbers can mean an instruction for the processor to exectute. When you change those numbers, the computer may do something different, for example, instead of adding two numbers, it can multiply it.

 

The Hexadecimal base is an abstraction for a easier binary editing. instead saying 11111111, we could just say FF.

 

If you want to understeand more how the eletric computer works, take a look at http://hipo.sourceforge.net/ .

Share this post


Link to post
Share on other sites

Thing is, reverse engineering is a bunch of intuition and deductive reasoning.  Disassemblers, decompilers, debuggers and process/memory searching tools can simply the task such that a highly experienced person can tear apart a binary quickly.

Share this post


Link to post
Share on other sites

Hmm, sorry I cant read Portuguese Pichorra, but I could recognize it was not Spanish  :laugh:

Nice website Matt, reading it now. So seems like I was right. So the Iran-Patch and Nyerguds C&C patch, that was all done with reverse engineering. Hex editing?

Share this post


Link to post
Share on other sites

Hmm, sorry I cant read Portuguese Pichorra, but I could recognize it was not Spanish  :laugh:

 

There was supposed to be a english manual in that page. They post everything there in english, even the software itself is in english, but they don't give you a english manual... Sorry for that.

 

Nice website Matt, reading it now. So seems like I was right. So the Iran-Patch and Nyerguds C&C patch, that was all done with reverse engineering. Hex editing?

Yes.

 

Share this post


Link to post
Share on other sites

So the Iran-Patch and Nyerguds C&C patch, that was all done with reverse engineering. Hex editing?

Reverse engineering is basically throwing the exe into a disassembler, which transforms the bytes back to readable code. Though since it is really only the raw instructions, things like function names or variable names are all lost, meaning a lot of the work involved is finding out what all the code does.

 

As for modifying code, I just write my own code in the programming language of the CPU (x86 Assembler) and use some system to convert that to bytes to be inserted back into the exe file. The basic method for doing this is what's generally called "hooking"; finding the spot where the new code needs to come, modifying the code there to jump out to my own new code, and then making sure it returns to that spot after the new code was executed, so the game's normal flow can continue.

 

There's usually no real "hex editing" involved, except for the fact my old method just generated bytes I had to paste into the exe file at the right spot. But hifi's new asm development system automates this, meaning that it can be done without any actual hex editing.

Share this post


Link to post
Share on other sites

Wow. So I understand the frustration when people ask for little improvements here and there. I can only imagine the difficulty if variable names are not retained. So adding building frames should require finding the hospital offset or something, needle in a haystack!

Share this post


Link to post
Share on other sites

Well, I did already find the building animations in C&C95. But generally? Yeah.

 

The only good leads to start from are the filenames and ini strings the game uses, which are obviously in the exe as plain text, and the disassembler automatically cross-links them to the code using them. So that does help a bit. Especially since all code for initializing buildings, units and projectiles contains references to the names of their SHP graphics :)

Share this post


Link to post
Share on other sites

Matt: where's the part 1 of the Core Concepts of Reverse Engineering? Also I'd like to know if this is somehow applicable to Tiberian Sun.

Share this post


Link to post
Share on other sites

Ahh good good. I was trying to make some visualizations on how I could make my own unofficial TS patch anyway. And what I mean by visualizations by things that I need to know and what to analyze in advance stage. So far the basic patching that I know is just inserting something that is missing (i.e Mutant Woman's missing voice). By advance stage I mean the fixes I should learn in weapon logics. By the way.... do D2K+ Dune 2000 Audio Converter and Command line Aud - Wav tool turns a .AUD file into a mono compression?

Share this post


Link to post
Share on other sites

CCHyper said that AUD format actually supports stereo, but no converters were ever made for it. Not by the community, anyway.

 

It'd only be useful for the soundtrack anyway, since the C&C engine plays sound effects on the specific point on the map where they should sound from, making you hear it louder or quieter depending on how close to that spot your currently viewed area is. So making sound effects stereo would... complicate this, I guess.

Share this post


Link to post
Share on other sites

Allen: yea I know that. I do stay there more frequently.

 

Nyer: but how come when I convert a .wav file that has 44100hZ it turns into mono .aud

Share this post


Link to post
Share on other sites

Nyer: but how come when I convert a .wav file that has 44100hZ it turns into mono .aud

What part of "no converters were ever made for it" didn't you understand? All existing AUD converters can only produce mono AUD files :dry:

Share this post


Link to post
Share on other sites

ahhh hooohoohoooo I see what you're trying to explain that there's such no converter that would retain its stereo sound effect for AUD files and we can't do anything about it.

Share this post


Link to post
Share on other sites

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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...