It is currently 17 Jun 2019, 01:46
   
Text Size

Magic.c

Discuss Upcoming Releases, Coding New Cards, Etc.
PLEASE DO NOT REPORT BUGS HERE!

Moderators: BAgate, drool66, stassy, Aswan jaguar, gmzombie, CCGHQ Admins

Magic.c

Postby Gargaroz » 28 Feb 2012, 14:31

Here's an old decryption of Magic.exe in C. Most of the stuff is still really basic, with casual variable names and so on.
If we could work on fully rewriting it in C, it will help me a lot in future developments. Since most of the code is still in ASM-like form, I couldn't really read it correctly, so if someone more proficiend could help, I'll appreciate it a lot.
In the package there's also "manalink.h" and "manalink.lds", which hosts the current names of some variables / functions / events.

Edit by Aswan Jaguar: For current status see the link not the attachment:
viewtopic.php?f=56&t=6528&start=15#p147097
Attachments
magic_decoded.rar
(449.23 KiB) Downloaded 427 times
Last edited by Aswan jaguar on 24 Feb 2014, 05:13, edited 2 times in total.
Reason: edit current status
----
- Current / medium term task: adjusting the code for making Misdirection and such usable
- Long term task: inserting all the good stuff I left out from the "Golden Years" mod
Gargaroz
Programmer
 
Posts: 7095
Joined: 06 Nov 2009, 11:11
Has thanked: 82 times
Been thanked: 593 times

Re: Magic.c

Postby foolosopher » 01 Mar 2012, 23:04

This has been tried before, check this thread

viewtopic.php?f=56&t=973&start=45

I think what Mok said is the best way to go, which is to slowly strip down cards from the exe into c and isolate the basic game engine, then recode little by little.
I long for the time where one man could make a difference...
foolosopher
 
Posts: 189
Joined: 19 May 2010, 20:53
Location: Greece
Has thanked: 13 times
Been thanked: 17 times

Re: Magic.c

Postby gmzombie » 02 Mar 2012, 12:36

but i think this can help us a bit at renaming some subs and locations in the exe. then gather and discuss that and see if there is anything we have missed. but this wil help us out no doubt about it.
can I maze of ith your snowstorm?

http://home.comcast.net/~gmzombie/index.html old stuff in here. don't use this stuff right now till I get time to get back into it and readjust.
gmzombie
 
Posts: 855
Joined: 26 Feb 2009, 01:05
Location: Wyoming, Mi
Has thanked: 199 times
Been thanked: 50 times

Re: Magic.c

Postby Gargaroz » 02 Mar 2012, 14:55

Yup, we could start with what is actually known and labeled (and this is why I inluded the two Manalink files) and the first job is a carefully renaming.
Then, we'll discuss if something is to be renamed.
----
- Current / medium term task: adjusting the code for making Misdirection and such usable
- Long term task: inserting all the good stuff I left out from the "Golden Years" mod
Gargaroz
Programmer
 
Posts: 7095
Joined: 06 Nov 2009, 11:11
Has thanked: 82 times
Been thanked: 593 times

Re: Magic.c

Postby gmzombie » 02 Mar 2012, 23:45

hey how old is this by the way..obviously pre 2k fix but do u know how old?
can I maze of ith your snowstorm?

http://home.comcast.net/~gmzombie/index.html old stuff in here. don't use this stuff right now till I get time to get back into it and readjust.
gmzombie
 
Posts: 855
Joined: 26 Feb 2009, 01:05
Location: Wyoming, Mi
Has thanked: 199 times
Been thanked: 50 times

Re: Magic.c

Postby Gargaroz » 03 Mar 2012, 14:07

No, it was sent to my by Jatill. It seems it was decoded until Antiquities, as Legends card aren't featured.
But id doesn't matter, it's still useful to understant how some part of the game works. My main interest is the targeting part, so we could inject new keywords.
----
- Current / medium term task: adjusting the code for making Misdirection and such usable
- Long term task: inserting all the good stuff I left out from the "Golden Years" mod
Gargaroz
Programmer
 
Posts: 7095
Joined: 06 Nov 2009, 11:11
Has thanked: 82 times
Been thanked: 593 times

Re: Magic.c

Postby Gargaroz » 27 Apr 2012, 13:26

I'm bumping this topic up as I really would like to rewrite the targeting function in order to incorporate new keywords and fix all the issues with subtypes. Anyone that has ASM knowledge, please help !
----
- Current / medium term task: adjusting the code for making Misdirection and such usable
- Long term task: inserting all the good stuff I left out from the "Golden Years" mod
Gargaroz
Programmer
 
Posts: 7095
Joined: 06 Nov 2009, 11:11
Has thanked: 82 times
Been thanked: 593 times

Re: Magic.c

Postby Huggybaby » 03 May 2012, 13:04

I asked a friend about this who knows x86, 680x0, and z80 flavors of asm, and the principles of amd64 (x86_64) asm.
He deals almost entirely with Linux, so take that into consideration. Anyway, he's the only guy I know working with asm, other than Steve gibson at GRC, and I don't know Steve. Maybe someone could ask him!

My friend's edited replies:
Courageous project I would say, working on the optimized output of a compiler is quite horrible, I did it a long time ago when I cracked a few things, but stopped a long time ago (since I switched to linux, in linux you don't need to crack anything, it's better this way !).
Well I heard there are some uncompilers for this kind of work, but never saw any, and I guess they would work best with some debug symbols and unoptimized code anyway.
And later:
On 2nd thought I am not even sure your project is doable.
The problem are the debug symbols : with them it would be hard but possible.
Without them... ? The big problem are the external libraries, if you can't understand the system calls then you can't get anything out of this code.
Now your chance is that it's windows, so it means less external libs than in linux for example, and if I remember correctly you might be able to read dll calls even without debug symbols. Still very tedious to translate, you need a good api documentatino to reverse all that.

Anyway that's the part which decides if your idea is feasable or not, and even if it is it will be hard and tedious.
Good luck again !
User avatar
Huggybaby
Administrator
 
Posts: 3080
Joined: 15 Jan 2006, 19:44
Location: Finally out of Atlanta
Has thanked: 580 times
Been thanked: 572 times

Re: Magic.c

Postby Gargaroz » 05 May 2012, 12:40

The fact is, we don't need to reverse engineer ALL the stuff : the graphic part could stay alone for now, for example. But some areas need to be reworked to allow updating the rules and similat stuff : mainly the targeting functions and the stack system. The second is really over me, but I understood 50% of the targeting functions, the only problem is that I know almost nothing of ASM, so a lot of symbols generated by the decompiler are quite obscure to me.
----
- Current / medium term task: adjusting the code for making Misdirection and such usable
- Long term task: inserting all the good stuff I left out from the "Golden Years" mod
Gargaroz
Programmer
 
Posts: 7095
Joined: 06 Nov 2009, 11:11
Has thanked: 82 times
Been thanked: 593 times

Re: Magic.c

Postby Gargaroz » 15 May 2012, 13:05

Guys, please, I know I'm stressing everyone about this fact but this will be a major improvement to the game : everyone that can undestand ASM please get in touch with me so we could recode the targeting functions ! Moderators, please "stick" this thread.
----
- Current / medium term task: adjusting the code for making Misdirection and such usable
- Long term task: inserting all the good stuff I left out from the "Golden Years" mod
Gargaroz
Programmer
 
Posts: 7095
Joined: 06 Nov 2009, 11:11
Has thanked: 82 times
Been thanked: 593 times

Re: Magic.c

Postby gmzombie » 19 May 2012, 19:59

Garg i wish i could help but i havent picked back up in learning the asm or c books yet..too busy at the moment. the only thing i can recommend is the book i currently have which is more like a textbook by Kip. R Irvine Assembly language for intel based computers. I have the 4th edition in text book and a pdf if your interested in trying to learn asm. The only reason why i didnt get to far is i dont know C. that is why i stopped reading asm and jumped into learning c. im still not even close to learning that though. :( i think i would have to goto a class to really learn this stuff.. anyways hit me up if you would like that pdf file and ill email it to ya. i have about 8 gbs of programming info and vids that i got off of a torrent.
can I maze of ith your snowstorm?

http://home.comcast.net/~gmzombie/index.html old stuff in here. don't use this stuff right now till I get time to get back into it and readjust.
gmzombie
 
Posts: 855
Joined: 26 Feb 2009, 01:05
Location: Wyoming, Mi
Has thanked: 199 times
Been thanked: 50 times

Re: Magic.c

Postby gmzombie » 30 Nov 2012, 18:21

I had a thought though. Is there anyway anyone could strip just the card code left out of magic.exe. Then possibly in a separate area strip the visual winodws api out of it. Then we should be left with just ai code i believe. Im just trying to think outside the bo,.
can I maze of ith your snowstorm?

http://home.comcast.net/~gmzombie/index.html old stuff in here. don't use this stuff right now till I get time to get back into it and readjust.
gmzombie
 
Posts: 855
Joined: 26 Feb 2009, 01:05
Location: Wyoming, Mi
Has thanked: 199 times
Been thanked: 50 times

Re: Magic.c

Postby Korath » 17 Jul 2013, 13:54

What I've got labelled currently.

(If anyone has access to Hex Rays and could post what it comes up with for Shandalar.exe, I'd like to take a look at that eventually, too.)
User avatar
Korath
DEVELOPER
 
Posts: 3384
Joined: 02 Jun 2013, 05:57
Has thanked: 482 times
Been thanked: 937 times

Re: Magic.c

Postby gmzombie » 17 Jul 2013, 16:16

As soon as I get home I will build a .c for shandalar. I have hex rays 5.5 I believe also pe explorer and of course ollydbg
can I maze of ith your snowstorm?

http://home.comcast.net/~gmzombie/index.html old stuff in here. don't use this stuff right now till I get time to get back into it and readjust.
gmzombie
 
Posts: 855
Joined: 26 Feb 2009, 01:05
Location: Wyoming, Mi
Has thanked: 199 times
Been thanked: 50 times

Re: Magic.c

Postby Gargaroz » 17 Jul 2013, 16:38

Well, a recode / improvement for Shandalar will be a dream came true.
----
- Current / medium term task: adjusting the code for making Misdirection and such usable
- Long term task: inserting all the good stuff I left out from the "Golden Years" mod
Gargaroz
Programmer
 
Posts: 7095
Joined: 06 Nov 2009, 11:11
Has thanked: 82 times
Been thanked: 593 times

Next

Return to Development

Who is online

Users browsing this forum: No registered users and 1 guest


Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 10 minutes)
Most users ever online was 287 on 31 Mar 2019, 04:11

Users browsing this forum: No registered users and 1 guest

Login Form