Author Topic: I want to learn here  (Read 1630 times)

0 Members and 1 Guest are viewing this topic.

Offline Metaliturtle

I want to learn here
« on: June 26, 2015, 04:55:00 AM »
I'm learning (or trying to learn) programming (have a post in OT)  any .exe modification basics you could point me to?


(I get that it's in C++ and will be over my head but I've got smattering of knowledge in Python, Java, JS, and learning some VBA)

Offline Yitzi

Re: I want to learn here
« Reply #1 on: June 26, 2015, 04:17:51 PM »
Actually, if you want to modify an existing .exe without source code, you'd need to do it in assembly.

As for basics...all I used was Ollydbg and the manual here.  The rest was just looking at the results and figuring out how it worked.  (If you want to go that way, two of the early breakthroughs I made were realizing the importance of breakpoints, and using plaintext stuff as a "handle" to start figuring out what's going on where.)

Offline DrazharLn

Re: I want to learn here
« Reply #2 on: June 26, 2015, 04:22:04 PM »
Disclaimer: I have not been following any developments in exe modification over the last year or so.

Editing the .exe itself isn't C++ or C, it's machine code.

The too long, didn't read version is that low level languages are much more fiddly to use than higher level ones, and in this usage, C++ counts as high level, python and java are stratospheric. If you wanted to, you could learn how to do it, and it's not too hard to make small changes. Making larger changes requires a hard won familiarity with the machine code and, depending on exactly what the change is, an expertise that, AFAIK, only PlotinusRedux possesses in this community

It is possible, with specialist tools, to resolve this machine code back to x86 Assembly Language, which is just about human readable. To do this, you should look at ollydbg and IDAFree.

It is not really possible to resolve the code back to the original C++, though it is possible to "decompile" bits of the machine code to something plausibly similar to the original. This decompilation process is not wholly automated and is difficult and error prone.

Scient, Kyrub and Yitzi have all edited SMAC/X by running the game in a debugger and watching the flow of control through the machine code (resolved to assembly). This is a time consuming operation that eventually results in them gaining enough understanding of the system they want to modify.

Once they know what they want to do and how the current system works, they edit the machine code at that point (writing direct to assembly) to effect their change.

PlotinusRedux has taken a slightly different approach: he has found various systems in the machine code that he would like to change and has inserted machine code to call an external "dynamic linked library" (dll) for those functions.

He can then write the dll's source code in C++ and compile it to machine code. Overall, this allows more broad changes (namely his complete reimplementation of the drawing engine) but requires some more initial expertise (I tried to do something conceptually similar a while ago and failed). It is not so suitable an approach for lots of the bugfixing work that the others have been doing but could be used there if the tool chain and use of it was explained (I'm not familiar enough with assembly or the windows executable format to get it).

If you are still interested in learning .exe modding, a logical start point would be to ask Yitzi for a build of his patch before some fix and the save file used to isolate that fix and then ask him to give you some pointers on where to start.

There's probably a tutorial on ollydbg somewhere as well (this is the tool that Yitzi uses, or at least used to use).

If you'd like some help learning a high level language I'd be happy to chat to you sometime (IRC/xmpp/VoIP/Skype) to gauge your experience and goals and recommend some material to you.

Online Buster's Uncle

  • With community service, I
  • Ascend
  • *
  • Posts: 49389
  • €1036
  • View Inventory
  • Send /Gift
  • Because there are times when people just need a cute puppy  Soft kitty, warm kitty, little ball of fur  A WONDERFUL concept, Unity - & a 1-way trip that cost 400 trillion & 40 yrs.  
  • AC2 is my instrument, my heart, as I play my song.
  • Planet tales writer Smilie Artist Custom Faction Modder AC2 Wiki contributor Downloads Contributor
    • View Profile
    • My Custom Factions
    • Awards
Re: I want to learn here
« Reply #3 on: June 26, 2015, 04:55:38 PM »
I'll add that I learned everything I know about SMACX graphics modding by figuring out how to make minor alterations and getting better (and better - and I'm still learning) at it as I persevered, and getting more ambitious as my skillset expanded with practice.  Young Mr. harLn definitely has a point, above.

So the first thing you do is try to figure out how to make the game say "METALITURLE!" somewhere and work up from there.

Offline Yitzi

Re: I want to learn here
« Reply #4 on: June 26, 2015, 07:49:04 PM »
Disclaimer: I have not been following any developments in exe modification over the last year or so.

Editing the .exe itself isn't C++ or C, it's machine code.

The too long, didn't read version is that low level languages are much more fiddly to use than higher level ones

Not really; in assembly you don't have to worry about forgetting a semicolon.  There are definitely aspects that are harder than in higher-level languages, but "fiddly" isn't really one of them.

Quote
It is possible, with specialist tools, to resolve this machine code back to x86 Assembly Language, which is just about human readable. To do this, you should look at ollydbg and IDAFree.

It is not really possible to resolve the code back to the original C++, though it is possible to "decompile" bits of the machine code to something plausibly similar to the original. This decompilation process is not wholly automated and is difficult and error prone.

Well, it's possible, but would be a major project done a small portion at a time.

Quote
Scient, Kyrub and Yitzi have all edited SMAC/X by running the game in a debugger and watching the flow of control through the machine code (resolved to assembly). This is a time consuming operation that eventually results in them gaining enough understanding of the system they want to modify.

Actually, I'd guess that my primary analysis method is by reading the assembly; actually watching control flow is a major tool as well, but I think it's secondary.

Quote
There's probably a tutorial on ollydbg somewhere as well (this is the tool that Yitzi uses, or at least used to use).

I still do.

Offline Metaliturtle

Re: I want to learn here
« Reply #5 on: June 27, 2015, 12:32:19 AM »
Woah, thank you all, this is crazy how good of a response this is.

It may be way ambitious to think about it now, but I would like to learn.  If there's a better place to start I would be all ears.

 

* User

Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Select language:

* Community poll

SMAC v.4 SMAX v.2 (or previous versions)
-=-
24 (7%)
XP Compatibility patch
-=-
9 (2%)
Gog version for Windows
-=-
103 (32%)
Scient (unofficial) patch
-=-
40 (12%)
Kyrub's latest patch
-=-
14 (4%)
Yitzi's latest patch
-=-
89 (28%)
AC for Mac
-=-
3 (0%)
AC for Linux
-=-
6 (1%)
Gog version for Mac
-=-
10 (3%)
No patch
-=-
16 (5%)
Total Members Voted: 314
AC2 Wiki Logo
-click pic for wik-

* Random quote

As we approached we were confronted by the ruined splendor of Sparta Command. The true immensity of the place became instantly apparent as our Quantum Tank crunched over the rubble and parked next to a shattered bunker, but the extent of the destruction took weeks to assess. The shielded datacore had sustained several massive breaches and smoke still billowed from the numerous cannon ports. There were few signs of human life.
~ Lady Deirdre Skye ‘Our Secret War’

* Select your theme

*
Templates: 5: index (default), PortaMx/Mainindex (default), PortaMx/Frames (default), Display (default), GenericControls (default).
Sub templates: 8: init, html_above, body_above, portamx_above, main, portamx_below, body_below, html_below.
Language files: 4: index+Modifications.english (default), TopicRating/.english (default), PortaMx/PortaMx.english (default), OharaYTEmbed.english (default).
Style sheets: 0: .
Files included: 45 - 1228KB. (show)
Queries used: 40.

[Show Queries]