« first day (1257 days earlier)      last day (3770 days later) » 

12:01 PM
oh, have a nice time!
I just arrived, so i will be at the office for a week :D
 
thanks.
 
12:25 PM
use32			; 32 bit

; First we store the registers we use.
push edx		; store edx                    [ESP-04] -04
add esp, 4		; return to the parameters     [ESP+04] +00

; Then we run the calculations.
add esp, 4		; skip the backjump address    [ESP+04] +04
pop eax			; pop the a1 value into eax    [ESP+04] +08
pop edx			; pop the a2 value into edx    [ESP+04] +12
add eax, edx	; add a2 to a1
sub esp, 12		; balance the stack            [ESP-12] +00

; Then we restore the registers we used.
sub esp, 4		; go to the stored values      [ESP-04] -04
Anyone know if I have to store and restore edx the way I'm doing?
My tests indicate that it works if I don't restore it.
Buut, just because it works, doesn't mean it's right.
 
depends on what you're doing later on
i.e. what the code after it expects to find in:
1) edx
2) the stack
 
Well, it's supposed to just be the body of a function that adds two arguments.
 
@Tordin @AlexM. I got solution
 
It's a test I'm doing. I need some better ASM control in my SharpCraft project.
 
well here's the thing
afaik it's a rule of thumb to remove as many things as you placed on the stack after you're done running your sequence of code
 
12:31 PM
Well, I keep the stack balanced all the way through, so it should look exactly like it did before the call.
I restore EDX because it is used.
 
iirc, I used to change the address a function returned to by placing an extra address on the stack
 
I can't restore EAX since it's used to return the result.
 
over the return address
probably because of that
 
@William'MindWorX'Mariager what are you trying to do?
@Ketan, what was the solution?
 
@Tordin Just learning how ASM works. I've never used it before.
 
12:33 PM
Ahh okay
 
I don't think there's a need to actually restore registers unless your situation requires it
^ captain obvious
 
yeah, all redundant intructions should not be there
 
I'm going to use it to make some __fastcall wrappers in C# since C# doesn't support __fastcall.
And perhaps other goodies now that I have it.
 
mov eax, val
call function
//do something with eax that requires it to have val
here is a situation where function should restore eax if it modifies its value
otherwise, restoring it is redundant
 
Okay
So it's a case-by-case situation.
 
12:35 PM
yeah
 
It shouldn't be a problem either I think. I can just analyze the code around where I'm calling the function.
 
@Tordin there was an method to split texture
 
also pay attention to instructions that use specific registers
my asm is rusty, but eax is supposed to be an accumulator register
 
@all I am going to home to enjoy mini vacation.see you after a week. Thanks for your help.
 
so it's likely to be auto-used under the hood by loops and such
though before the loop you initialize the values in registers anyway
... normally
 
12:37 PM
@Ketan, yes there usualy is. but if you get stuck you should just try to get past it and then make it work and try to fix the after hangs after ;P
But good that you solved it out
 
All I know about EAX is that it's used to return values in stdcall and cdecl.
 
yeah
 
I'm really psyched about this managed flat assembly compiler. It's going to give me lots of versatility.
 
all interrupt codes also go into EAX
 
@Tordin I am new to game dev..next I'll take care.
 
12:40 PM
@William'MindWorX'Mariager I used asm in college mostly, which is a pity
 
the whole semester it felt like the best and most freeing way to program
it was like, having only one or two tools which could be combined into making the whole universe lol
a nice switch from 1000 tools and choosing between them
 
Well, Thats fine :) Beeing new is always okay, and there is always misstakes and bad solutions to do, so you know what not to do the next time
 
12:59 PM
 
"Computers are like Old Testament gods; lots of rules and no mercy."
2
:D
 
First learn computer science and all the theory. Next develop a programming style. Then forget all that and just hack.
George Carrette (1990)
lol
"If a machine can be made so that an idiot can use it, then only an idiot will use it."
Tadao Ichikawa
this is sort of true, in some way
 
1:23 PM
 
@AlexM. Hi alex
 
hi
 
1:44 PM
@AlexM. I find that most people I write software for are idiots
 
it's certainly the trend we're going towards
 
I have a friend who really wants me to help him write some software for his business but he's just technical enough where his requirements are painfully stupid
 
inb4 programming becomes idiot-friendly too
and even general science becomes idiot friendly
 
Programming isn't difficult. It's logic that escapes most people.
8
 
@ToddersLegrande lol I can imagine
 
1:48 PM
We should call you butter, 'cause you're on a roll.
 
butt-er
because I butt
wait, that doesn't make sense
 
2:02 PM
Finally home!
Time to test this assembly stuff. :D
 
yay
 
2:16 PM
Right, first bump. The release was compiled against framework 4.5, but I'm forced to use 4.0
But that's fixed and now my project compiles without problems.
 
#woop
 
First approach to getting EDX was a bust. But I thought so as well.
Too much happens between my hook and when my managed function is called, so EDX has changed on the way.
Next approach is to write a fastcall function body that calls an stdcall with the same arguments.
 
3:02 PM
 
user92578
You can't answer "yes"?
 
it would be weird to have sex with spiders
 
user92578
no she just wants show her web
 
oh yeah
'totally
 
Her sticky web.
 
user92578
3:08 PM
warm web
 
gooey web
also
sup nerds
 
@ToddersLegrande, Answer the man, he's talking to you.
 
I believe you have confused me with someone else
 
hey SG
 
@ToddersLegrande <3
Something tells me the EasyHook API has some sort of issue.
Fails: LocalHook.CreateUnmanaged(address, codePtr, IntPtr.Zero);
Works: LocalHook.Create(address, Marshal.GetDelegateForFunctionPointer(codePtr, typeof(sub_6F471BC0Prototype)), null);
 
3:43 PM
IntPtr.Zero isn't the same as null maybe?
 
3:55 PM
I'm looking at the internals of the functions and it should be the same.
I'm trying to traverse the function calls now and I'll see if I can find a difference
 
ok
 
4:07 PM
Alright
Create makes a call to Marshal.WriteIntPtr(Result.m_Handle, IntPtr.Zero); which zeroes a trace thingy.
CreateUnmanaged forgets to do this.
So, now I either recompile EasyHook which is likely a pain, or I use reflection to call some of the private stuff.
 
buh, more SharpCraft issues?
 
Well, I'm trying to install an unmanaged hook with EasyHook but the API has a bug it seems.
 
Couldn't you zero the trace thingy (or whatever) yourself, or do you not have access to a necessary pointer or scope context?
 
I don't have access to it sadly.
It's created and used in the same function.
So only possible if I intercept the middle of the function.
And in that case, reflection seems a bit easier and more reliable.
Yay! It's working!
I should report that issue, so it's fixed later.
Boy the function is ugly now.
But it works
Might be slower too, but it's not going to be called more than a few dozen times during execution.
 
 
1 hour later…
5:27 PM
Well, one thing is for sure. I suck at assembly. :P
 
5:45 PM
Doesn't everyone?
That's why we made compilers to do it for us.
 
6:05 PM
:D
 
6:22 PM
Also, check this out: govdeals.com
Need something cheap, that may be either discontinued, unused by the government, or confiscated from a druglord or terrorist?
 
W00 an offline simcity is coming :D
 
@Dave Heard about that from reddit
 
i hope its good
 
need a fire truck?
 
9 grand :O
what a bargain
 
6:24 PM
:)
 
heh, Aren't there restrictions on who can use fire trucks?
You could get away with a lot if you drove around in one of those
 
@Dave Online SimCity is great. I expect offline will be the same if not less fun. I'm not saying the DRM was necessary or a good move. Just saying the game being online was great because building regions with other people was fun.
If they do offline mode right I'm sure it will be great as well
 
less fun are you crazy... MODS!
mods make simcity - the vanilla is always shit
course more people will pirate it now though
 
You know what game I'm excited for? Mount & Blade II
 
@Dave I'd believe mods could make it better... but seriously... the new Sim City is great fun minus the bugs that were rampant (maybe still are. haven't played in a while)
For the most part the bugs didn't crop in my games
 
6:35 PM
@JohnMcDonald :D hahaha
 
i cant play it cos my origin account wont let me in i cant remember the email i used to recover the password either
so that was a waste of a purchase
 
woops
 
woops indeed
 
indeed, woops indeed.
 
if live support would just tell me the email
then i can login
 
6:37 PM
Sounds like a job for escalated support I'm afraid
 
How many email addresses do you have?
 
quite a few
 
Can't you just try them all?
I have a handful of emails, but only 2 personal accounts. One of which I use for games
 
i have
they all fail to login
the problem is i suspect the email i used has been deleted for inactivity
hotmail delete after like 6 months
 
Gee.
I use 2 gmail accounts, and one forwards everything to the other. And if I reply to emails sent to my secondary, it sends from my secondary account. So the outside world sees 2 accounts at all times, but I see it all as 1. Works great
 
6:45 PM
I have one account I use. I have a hotmail just for occasional signups at sites that look dodgy.
 
I used to use mytrashmail for that, but I don't think I've registered for anything dodgy in a long time
 
hehe
I used to have almo@fuckinginternet.com when Datapimp was still around with their free forwarding addresses.
"hey what's your email?"
"almo at fucking internet dot com"
"really?!?"
"yeah."
 
oh thank god
they merged it with my new origin account
 
6:59 PM
Gaah assembly!
throws a hissy fit
 
Why are you working with assembly anyway?
 
hes making an Roller coaster tycoon clone ?
(please say you are)
 
lol
pretty sure it's to do with memory editing
 
For what its worth, as an early access game, Prison Architect is good fun. Though not without flaw as should be expected.
 
So, has anyone heard of this engine before: kleber-swf.com/godot-engine-opensource
2
 
7:03 PM
Hello @ShotgunNinja
 
howdy
 
user4704
"That’s is a great opportunity for the ones who want to learn how an engine works." Ugh.
 
I'm learning C
it is really interesting
I'm not learning right now of course, but tried to figure out how pointer works yesterday
 
@JohnMcDonald Memory editing indeed. Trying to inject a hook in a __fastcall function.
The hook is working, but calling from Unmanaged into Managed using only assembly is proving a bit difficult
I tried several tricks, but they all result in some kind of crash. I bet I'm unbalancing the stack.
But I'm not sure how to debug it.
 
So do you know C @ShotgunNinja
 
user4704
7:06 PM
@joapet99 The value of a pointer is an address within C's memory model.
 
I know
within the RAM
 
user4704
No.
 
user4704
Within C's memory model.
 
user4704
C doesn't say anything about "RAM."
 
::_---_::
 
user4704
7:08 PM
C defines an abstract machine that it is written against.
 
@JoshPetrie That's is how you know they are serious business
 
user4704
Usually that abstraction exists over top the implementation and OS, which itself is an abstraction of the hardware.
 
user4704
For example, the OS usually virtualizes memory, so you rarely get an address in a pointer that corresponds to the physical chip.
 
@JoshPetrie so why did my program print out random smiley faces and hearts when C didn't get the 0 quota
 
Probably because you don't understand something about pointers versus values, and you gave a value instead of a pointer to the print function you used.
 
user4704
7:11 PM
I don't understand what you mean by "C didn't get the 0 quota." Can you elaborate?
 
user4704
But my guess is that you invoked undefined behavior, which renders your code "not C" code (that is, no longer subject to the rules of the language).
 
you know when you forget to set an end to an array
 
user4704
You should rarely use "it worked when I tried it" as justification for something being legal, especially in C or C++.
 
user4704
@joapet99 No.
 
user4704
I don't know what you mean. You can't "forget to set an end to an array." They require a size or the code doesn't compile.
 
7:13 PM
That makes sense then. Of course you're going to run past the end of a character array when a null terminator isn't given, and you pass a pointer which points to the array to a string library function.
 
You have to make an 0 char at the end of an array
 
user4704
Can you show me some code that demonstrates what you are talking about?
 
user4704
@joapet99 No you don't.
 
I think he means he forgot the null-terminator, @Josh.
 
user4704
Yes.
 
7:13 PM
Which then makes sense. Dumb input produces a dumb response.
 
user4704
But he's using the wrong terminology so I'm trying to correct him.
 
yes in the ascii system the NUL is 0 as integer
 
user4704
Arrays do not require a 0 terminator.
 
not all
 
"C-style" strings, however, do/should.
 
7:14 PM
but char arrays
 
user4704
Arrays of characters interpreted as strings by convention use a 0 to indicate the end of the string in "C-style" strings.
 
user4704
Not, not all char arrays.
 
user4704
Only char arrays treated as strings.
 
Other conventions for strings in C include a size value at the beginning of the string, or stored alongside it in some other way.
 
user4704
char x[] = { 'a', 'b', 'c' }; is totally legal.
 
7:15 PM
I think C automatically sets an end to that char array
 
user4704
@joapet99 Nope.
 
C does not automatically do much of anything.
 
user4704
char * x = "abc"; includes an implicit null terminator.
 
user4704
The first one does not.
 
user4704
My point is you generally want to say "C string" or just "string" when talking about char arrays used in such a fashion, though.
 
7:16 PM
but isn't the thing printing random things out, the RAM
 
user4704
@joapet99 No.
 
user4704
What happens is that you call a function that's a char * and is assuming the char * points to a char array that is null terminated.
 
@joapet99 The information may come from abstracted rewritable memory space, although in this case, since it's printing a constant, it may come from program data space instead.
 
i wasn't using pointers at that time
 
user4704
It therefore does something like "while(*p != NULL) { put(*p); ++p; }
 
7:17 PM
@joapet99 Arrays are syntactic sugar for pointers.
 
user4704
However the only legal things you can point p to are it's allocated range of memory and one-past-the-end of the range of allocated memory.
 
user4704
Doing anything else invokes undefined behavior, and the implementation of the language is free to do whatever it likes.
 
Everything else is undefined behavior.
 
user4704
Often this results in attempts to read memory that is not mapped within your process, causing an access violation crash.
 
To understand C, you must first understand what "undefined behavior" means, and why it is bad.
 
7:19 PM
ive heard that a that a signed int has a double positive range
 
user4704
It also can result in reading memory that happened to mapped, resulting in "random" gibberish being printed until the loop hits a 0 byte or crashes or whatever.
 
or was it unsigned
 
@joapet99 It's unsigned, not signed.
 
yes I thought so when thinking a little more
 
user4704
Signed and unsigned ints use the same number of bits to hold their values, but an unsigned value is not interpreted to go below 0, so its range in the positive direction is effectively basically doubled, yes.
 
7:20 PM
so am I doing progress
 
And it's more that (approximately half) of the range of binary values are mapped to mean positive numbers instead of the negative numbers you are used to with signed integers.
 
user4704
@joapet99 Do you understand what I said about the pointer issue?
 
no not actually
 
user4704
What part of it?
 
I don't find it
 
7:21 PM
do you know how the print functions work in C?
 
@ShotgunNinja i can print things using puts
 
@joapet99 No, that's how you use them. I was asking if you know how they work.
 
Thats deep man
 
No, it's pretty basic knowledge.
 
terminal nonterminal it is complicated
 
7:23 PM
Aside from the abstraction of the terminal output (which is usually a file handle that the terminal process monitors for new data), the method accepts a pointer to a single character in memory. Can you tell me what it does with that pointer?
 
user4704
It's fundamental to the understanding of C strings.
 
Keep that in mind: All it knows about is a single character's location in memory.
 
I barely know pointers
 
They are addresses in logical memory, which may be mapped to locations in physical memory.
From a pointer, you can read or write a value to that cell of memory, shift register, or input/output buffer.
They're a lookup system, put simply.
 
Yes, but if I don't know about logical and physical things in the memory of my complicated and i am just repeating random words to you because it is so confusing
:D
 
7:27 PM
Well you know what a physical memory device is: A stick of RAM.
 
I knew it
RAM was a part of the stuff
 
However, RAM sticks are not the only type of physical memory.
 
MickLH talked about much complicated stuff yesterday
but he explained it a little different I think
I think it was easier to understand too
 
user4704
I don't think you should worry about "logical and physical RAM" as far as understanding pointers in C goes.
 
When you write to RAM sticks, the result is that the information is stored in a sequence of bit "containers" made out of transistor circuitry.
 
user4704
7:29 PM
It's good to know, but C doesn't admit the existence of either.
 
However, what if you need to write information to something that, instead of storing information, should send information to something else?
 
::__:D_
 
For example, what if you wanted a program to send sound information to an audio device, like a speaker?
 
OH
 
Or what if you wanted to read bits from a serial port?
How would you do that in a program?
 
7:30 PM
bah
I didn't knew you read bits from serial ports
 
C solves this by mapping both physical memory (RAM sticks) and I/O devices (speakers, serial ports, etc.) to logical memory.
 
So they are friends:D
 
However, when it comes to understanding pointers, this doesn't really matter that much.
It might if you start trying to do embedded software, which is often done in C or assembly, and depends heavily on having this deeper level of understanding what pointers actually are.
 
MickLH tried to teach me where they are stored
He were going to teach me how to store more words from a file
than just one
 
Yes, though I think we need to discuss some other stuff first, to clear things up here.
 
7:35 PM
My aim is to make a programming language you know
 
A pointer is just a variable that accesses other variables indirectly. It consists of nothing more than a memory address, when stored. But it is also given a "type" (ie. int, char, SomeStruct, etc.) which the compiler understands and uses to determine the size of the element being pointed to.
So, when you have a pointer, you don't just have pointer somePointer;, you have int* somePointer;.
 
isn't a pointer the value of a variable
 
No. A pointer is a variable which "points to" a location in memory containing a value.
 
int* coolInt = &badInt;
coolInt = &badInt
 
A pointer is an address.
 
user4704
7:38 PM
The value of a pointer is an address within C's memory model.
 
user4704
The value of coolInt is the address of badInt.
 
A pointer contains an address.
 
but isn't the adress holding a value
 
No, the address is the value.
 
A pointer is just an address to a memory space. See malloc.
 
7:40 PM
coolInt = address = value
 
I think malloc can help you understand the concept behind pointers.
if coolInt is your pointer, coolInt = address
 
*coolInt = adress
 
user4704
No.
 
user4704
@joapet99 The value of coolInt is an address. (The value of badInt is just a number.)
 
address = value makes no sense
 
user4704
7:43 PM
coolInt *dereferences coolInt, which you may interpret as taking the value of the operand (coolInt), fetching the value at that address, and reducing the expression to that value.
 
A pointer is an ADDRESS of a previously allocated memory space. So a pointer is always an integer holding this address. You can then dereference this pointer to actually get the pointed value.
 
user4704
Ugh markdown fail.
 
so *coolInt = value
 
*coolInt will dereference the pointer.
 
7:45 PM
yes and get the value
 
Yeah. You are doing two steps there: First, you "dereference" coolInt, which gives you a reference. Then, you assign the value of value into the memory location referred to by the dereferenced coolInt.
 
55
Q: What does "dereferencing" a pointer mean?

asirWhat does it mean to dereference a pointer? Can I please get a explanation with an example?

 
References can be treated like regular variables. Assign to them, compare them with each other, etc.
 
can you have pointers pointing at each other
 
You can do *coolInt == value, but not coolInt == value.
 
7:46 PM
yes and coolInt is not the value. It is the adress
that was micky taught me
 
Since when you try to do the latter, it compares the address stored in coolInt with the value of value.
 
user4704
@Dave No. You can have a pointer pointing at another pointer. int *p; int ** q= &p;
 
ah i see does it cause a compile error then ?
 
user4704
But int *p and int *q could not point at eachother because the types required to do so differ.
 
user4704
You can make it "work" but you invoke UB to do so.
 
7:48 PM
There is a workaround for that, but it requires getting rid of the C type system entirely.
 
Why can you ping people that is offline
 
user4704
(cast a pointer to a integral type, recast to the pointer type, store in a pointer)
 
@joapet99 because they didn't click "leave" in the chat room
 
user4704
But when you dereference that, you break the rule that says you can only dereference through the original type or related hierarchy types and you invoke UB
 
So the chatwindow is not open, but they are in the room
 
7:49 PM
interesting
@joapet99 yes...
 
user4704
0 is the only legal integral value you can "assign" to a pointer per the standard, and doing so invokes a special clause in the standard (that a compile time constant value of 0 is converted to the null pointer constant).
 
user4704
(Because the null pointer constant need not be a value with all bits zero.)
 
@ShotgunNinja Can we just get to the point of arrays as pointers
and how they can help me making an array of arrays
 
user4704
Arrays are not pointers. However, they decay to pointers when passed to a function in C.
 
user4704
And in various other scenarios.
 
user4704
7:52 PM
The distinction, however, is generally academic until you get to C++ and some template resolution. So you can usually safely treat them as interchangeable with a few exceptions.
 
user4704
@joapet99 int aa[5][5] is an array of arrays. It's an array of five arrays of five integers.
 
Right. Well, since arrays are logically-consecutive (type)-sized blocks of memory, you can use a pointer to point to them, and use pointer arithmetic to navigate the array.
 
I am using c++ but in a c way
 
So use C.
 
The print functions work like this:
 
7:55 PM
Because the compilers to C was a little harder to get than i thought and i didn't want to use command line to compile
So i am using VS
 
Or at least you should work with C first because you will need to understand concepts like pointers really well to write proper C++ code.
 
while (*pointer != '\0') { printchar(*pointer); pointer++; }
This does a few things.
 
but I don't understand it
 
Let's break it down, step by step.
 
YAY!
 
7:57 PM
The first part: while (*pointer != '\0').
 
You can write C code in VS. You can compile C++ using command line or just use a more higher level tool as you can with C. I think you are misunderstanding the whole point. Starting with C++ is not a good idea, like not at all.
 
This does a few things.
Obviously, there is a while with a condition.
 
@nathan I am writing C in a C++ file
 
wooh, did my walking exercise for the day
man my feet hurt so good
 
This condition (1) dereferences pointer, so we have access to the pointed-to value. (2) Compares the pointed-to value to a null character.
In other words, if the character pointed to by our current pointer is '\0', stop looping.
 
7:58 PM
is it a char
because the char is NUL and 0
 
This is assuming pointer is a char*, which is read as "A pointer to a char."
 
There is no C or C++ file ^^ They are both text files. You may want to read some C tutorial or books.
 
pointer would be declared as char* pointer;.
 

« first day (1257 days earlier)      last day (3770 days later) »