QuestionGetting back to coding

Posts 115 of 15 · Page 1 of 1
Getting back to coding
A year ago I started learning c++ and after a few months I stopped with it due school work.
Because I'm almost done at school I want to pick it up again.
So should I go more advanced on c++ or should I consider learning somethine else?
I mainly want to start making hacks.
Stick to C++. If you've already started, no reason to ditch it.
Quote Originally Posted by atom0s View Post
Stick to C++. If you've already started, no reason to ditch it.
I mean starting asm or reserve engineering or such.
Quote Originally Posted by Skulhead = hacked. View Post
I mean starting asm or reserve engineering or such.
If you plan to start making game hacks, sure then learning ASM and how to debug / reverse engineer things is going to help a lot.
But stick to learning the language first.

You can use what you write to understand ASM as well. Write some basic things like a calculator, then disassemble it/reverse it to understand what the code you wrote compiled into etc.
Quote Originally Posted by atom0s View Post
If you plan to start making game hacks, sure then learning ASM and how to debug / reverse engineer things is going to help a lot.
But stick to learning the language first.

You can use what you write to understand ASM as well. Write some basic things like a calculator, then disassemble it/reverse it to understand what the code you wrote compiled into etc.
Only problem is that instead of seeing how to do the things in assembly, you will just see calls to windows.
Quote Originally Posted by Auxilium View Post


Only problem is that instead of seeing how to do the things in assembly, you will just see calls to windows.
Because that would be how to do things in assembly as well..
Quote Originally Posted by atom0s View Post
Because that would be how to do things in assembly as well..
Yeah, but if you always rely on the macros and calls to windows, you won't get as good a grasp on how to do it.

for example, instead of actually learning how to make an atoi you would just call the c function. Where is the learning in that?

Anybody can move values into the appropriate register and call an external function, but where is the learning in actually knowing how it works in Assembly?
Quote Originally Posted by Auxilium View Post
Yeah, but if you always rely on the macros and calls to windows, you won't get as good a grasp on how to do it.
Rely on macros..? Uh what? When you disassemble an application, there are no macros shown/created/used. The code is compiled down to the bare ASM of what is used to make the application work. Macros are handled by an interpreter at compile time. They never make it into the application itself. They unfold and are injected into the position they are used during compile time.

For example, writing a macro to call MessageBoxA in C++:
Code:
#define MSGBOX( hWnd, msg, caption, flags ) \
    MessageBoxA( hWnd, msg, caption, flags );

BOOL APIENTRY DllMain( HMODULE hModule, DWORD fdwReason, LPVOID lpReserved )
{
    MSGBOX( 0, "Hello world!", "Hello!", MB_OK );
    return TRUE;
}
Compiles down to: (Default settings, debug mode, no optimization)
Code:
0F431550 >/> 55             PUSH EBP
0F431551  |. 8BEC           MOV EBP,ESP
0F431553  |. 56             PUSH ESI
0F431554  |. 8BF4           MOV ESI,ESP
0F431556  |. 6A 00          PUSH 0                                   ; /Style = MB_OK|MB_APPLMODAL
0F431558  |. 68 D0C5430F    PUSH gtasa_sa.0F43C5D0                   ; |Title = "Hello!"
0F43155D  |. 68 D8C5430F    PUSH gtasa_sa.0F43C5D8                   ; |Text = "Hello world!"
0F431562  |. 6A 00          PUSH 0                                   ; |hOwner = NULL
0F431564  |. FF15 0CF4430F  CALL DWORD PTR DS:[<&USER32.MessageBoxA>>; \MessageBoxA
0F43156A  |. 3BF4           CMP ESI,ESP
0F43156C  |. E8 7F230000    CALL gtasa_sa._RTC_CheckEsp
0F431571  |. B8 01000000    MOV EAX,1
0F431576  |. 5E             POP ESI
0F431577  |. 3BEC           CMP EBP,ESP
0F431579  |. E8 72230000    CALL gtasa_sa._RTC_CheckEsp
0F43157E  |. 5D             POP EBP
0F43157F  \. C2 0C00        RETN 0C
And if you write it out without the macro:
Code:
0F981550 >/> 55             PUSH EBP
0F981551  |. 8BEC           MOV EBP,ESP
0F981553  |. 56             PUSH ESI
0F981554  |. 8BF4           MOV ESI,ESP
0F981556  |. 6A 00          PUSH 0                                   ; /Style = MB_OK|MB_APPLMODAL
0F981558  |. 68 D0C5980F    PUSH gtasa_sa.0F98C5D0                   ; |Title = "Hello!"
0F98155D  |. 68 D8C5980F    PUSH gtasa_sa.0F98C5D8                   ; |Text = "Hello world!"
0F981562  |. 6A 00          PUSH 0                                   ; |hOwner = NULL
0F981564  |. FF15 0CF4980F  CALL DWORD PTR DS:[<&USER32.MessageBoxA>>; \MessageBoxA
0F98156A  |. 3BF4           CMP ESI,ESP
0F98156C  |. E8 7F230000    CALL gtasa_sa._RTC_CheckEsp
0F981571  |. B8 01000000    MOV EAX,1
0F981576  |. 5E             POP ESI
0F981577  |. 3BEC           CMP EBP,ESP
0F981579  |. E8 72230000    CALL gtasa_sa._RTC_CheckEsp
0F98157E  |. 5D             POP EBP
0F98157F  \. C2 0C00        RETN 0C
You end up with the same code.

Quote Originally Posted by Auxilium View Post
for example, instead of actually learning how to make an atoi you would just call the c function. Where is the learning in that?
Or you know.. step into atoi's function and earn how its done? And atoi isn't a macro either.

Quote Originally Posted by Auxilium View Post
Anybody can move values into the appropriate register and call an external function, but where is the learning in actually knowing how it works in Assembly?[/SIZE]
That is the whole point to what I said.. writing out code in C++ then analyzing what it compiles to in ASM. To understand how things are done, what they translate to, etc. to better understand how to find something being coded, understand the code flow while debugging, and so on.
Quote Originally Posted by atom0s View Post
...
I wasn't talking about C macros. But nevermind.

I'm just telling OP if he wants to learn assembly, instead of disassembling applications and seeing all these calls to windows, he should try learning from the ground up and experiment. Which if why I said macros, I meant assembly macros used by MASM and such, which is used too much will make him reliant on it.


Don't get me wrong, disassembling to see how something works is good, but if that's all you learn off, you're going to be pretty dependant on making calls to external functions.


---------- Post added at 11:41 PM ---------- Previous post was at 11:37 PM ----------

but maybe it's just me, because I like building everything from the ground up, I don't make calls to external functions unless I made them
Visual Basic is pretty easy to learn tho..
But i suggest you to stick to C++
If you remember some of C++, keep at it, however like @Julma Henri Said, Visual Basic would be a great start off.
You just got owned sir. atom0s is spot on.
Quote Originally Posted by 258456 View Post
You just got owned sir. atom0s is spot on.
Wasn't looking to own anyone, just a friendly debate. I think he was just a bit off/confused due to his usage of certain terms like macro.
Quote Originally Posted by atom0s View Post
Wasn't looking to own anyone, just a friendly debate. I think he was just a bit off/confused due to his usage of certain terms like macro.
When I talked about macros, you were the one who assumed I meant C macros.
All I was saying was to stay away from macros when you are learning assembly, because you will get dependant on them. Which is why I am against MASM, because right out of the box it gives all these useful macros, which useful, cut back on how much you learn. For example, instead of the guy making his own way to convert and integer to a null terminated string, he would just use the macro that comes with MASM to do it for him. Which means there is no learning on how to implement it yourself.

I never said atoi was a macro either btw.
Quote Originally Posted by Auxilium View Post
When I talked about macros, you were the one who assumed I meant C macros.
Given that this topic pertains to C++ (as stated in the first post) why wouldn't I assume that?

Quote Originally Posted by Auxilium View Post
All I was saying was to stay away from macros when you are learning assembly, because you will get dependant on them. Which is why I am against MASM, because right out of the box it gives all these useful macros, which useful, cut back on how much you learn. For example, instead of the guy making his own way to convert and integer to a null terminated string, he would just use the macro that comes with MASM to do it for him. Which means there is no learning on how to implement it yourself.
To each their own. Everyone learns differently. It's up to the OP if they wish to use macros or not while they code. Let alone, using them doesn't imply that you never looked at how they work, what their actual code is etc.

Quote Originally Posted by Auxilium View Post
I never said atoi was a macro either btw
The way your sentences are worded in the post you mention atoi implies it.
Posts 115 of 15 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?