2 Attachment(s)
Re: [GUIDE] Adding Code to Client or Server via a DLL. (Part 1.)
Quote:
Originally Posted by
tnrh1
Ok the how a c++ or c progrommar can help in the pristontale world?only build a launcher..
so c and c++ is useless for pt am I right?
and just wondering, triglow will sell the sources?and if they does you have any idea what is the range?just wondering.
thanks..
For example you can write clan files in C#...
Actually C programmer would be great help for me right now :)
Heres server4096.c (attached) C code(pseudocode :)) migrate it to 64bits or compile it under Winelib so it will be more compatible with linux.
I wonder if its possible.
If its possible to do something with this we could start project where we would name all functions we know and than produce .c file that will be understandable.
Split in 2 files because ragezone cant take big files... if 1.10 MB is big XD
Re: [GUIDE] Adding Code to Client or Server via a DLL. (Part 1.)
Quote:
Originally Posted by
Vormav
For example you can write clan files in C#...
Only if your C# compiler allows you to set a build target of x86 Win32 PE... the last Visual C# I used would only build MSIL CLR assembly .exe / .dll files... and these cannot be called from x86 PE.
Can Mono do any better, or do newer, or more expensive VC# implementations allow you to compile machine native code.
C, C++, Basic, Fortran, Pascal (Delphi etc), ADA, even COBOL can be useful. But you must be able to build an x86 Win32 Portable Executable.
Visual Basic 5 and 6 could, VB4 and below only produced PCode... and the interoperability of those is questionable. VB 2005 + produce MSIL CLR binaries which are completely useless (for present PT servers). If you look at something like RapidQ, XBasic and many PHP, Python or Perl compilers, they actually only add an executable header stub, and maybe make some form of tokenised version of the source... Like VB 3 - 6 PCode. That's probably not going to help much.
On the other hand, if you took PHP, Python, Perl or Java and built the executable core (VM or whatever) into the server then you could use them to script it, just as it already supports LUA scripts for particle effects.
I've heard people talk about proxying between x86 / x64 and MSIL, but I've never seen any proof of a workable solution... which is a shame, because I know a lot of you like VB.net. :(
Here's the thing, if you have an x86 Windows OS, you can run 16 Bit LE, 16-bit MZ, 32-bit PE or MSIL CLR binary executables, but all the DLLs they link to (MZ can't link to DLLs but can load .OVLs or .MODs) must be of the same type as the primary executable, except MSIL CLR EXEs which can call pretty much anything, and that's the point of them. If you have an x64 Windows OS you can run 32-bit PE, or 64-bit PE+ or MSIL CLR EXEs, but any DLLs they call must be of the same type as the main executable, unless it is MSIL CLR EXE.
Quote:
Originally Posted by
tnrh1
and just wondering, triglow will sell the sources?and if they does you have any idea what is the range?
Not sure what you mean about range... price or size I'm guessing. It's been suggested that the PT source code has been purchased / licensed either by Sandurr or other MMO developers like Yetime. I don't know if it's true, it's just a rumour, but the fact that Triglow still advertise PT as it was before Yedang got involved suggests that if the price was right, they may. I also don't know if one who wanted to make inquiries should contact Triglow directly, or via Yedang. That all depends on the agreement they have between them.
--- Edit ---
Triglow via HanGame (their owner?)
Re: [GUIDE] Adding Code to Client or Server via a DLL. (Part 1.)
Quote:
Originally Posted by
Vormav
...Heres server4096.c (attached) C code(pseudocode :)) migrate it to 64bits or compile it under Winelib so it will be more compatible with linux.
I wonder if its possible.
If its possible to do something with this we could start project where we would name all functions we know and than produce .c file that will be understandable.
Split in 2 files because ragezone cant take big files... if 1.10 MB is big XD
That is so hard to make any sense of, let alone compile.
Here are links to a Disassembly of the original jPT 4096 that will almost compile in FASM, and is much more readable. More readable even that the code listing in Olly.
Hotfile
4shared
Ziddu
You have to set the compiler memory above the normal 65536 that fasmw.exe will list... you can type 131072 to give 128Meg instead of 64Meg... and it will start to compile.
The code needs some cleaning, and humanised labels. There are some labels in the "undefined" allocated space in the exe that have no definition. It's easy, you look at those addresses in Olly and see how big they are, then define a "db x DUP (?)" where x is the number of bytes between that label and the next one.
You also need to fix imports and exports listed in the "Imports.txt" and "Exports.txt" files in FASM syntax.
macro.inc fixes some common MASM syntax that is meaningless to FASM, and I've done some extensive Search & Replace to fix "F8h" which is invalid in FASM, as you can say "0F8h" or "$F8" or "0xF8" but anything starting with a non-numeric character is a label, even if it ends with "h". And fixed the fmul, fmulp syntax from MASM style "fmul ST,ST(0)" to FASM "fmul st0,st0" and such.
MASM doesn't seem to cope with the source as well as FASM (In my tests) even though the syntax was produced to match MASM. :s
I've fixed at least one Korean text string which the disassembler can't recognise as anything other than plain bytes of data... it misses some references DWords too.
Anyway... so it needs some fixing. I have the source for the .res which still has some missing Korean text because I can't quite get an accurate decompilation of Korean "forms" yet... but that I built with GoRC so... Again, it's not hard.
If you want to create complete "compilable" source code for a PT server (or client) this is really the way to go. Once it builds, you can start re-writing routines in C or C++ and create .lib files from them that you can import into this, until such time as there is no pure x86 dependant assembler left.
BTW... from the point of view of an x64 (AMD64) or Linux build, FASM will build PE+ (Win x64) and Linux from the same source... you would have to use some "ifdef" type statements and write / re-write OS calls to equivalent routines. But this is not so difficult either... Time consuming, but not difficult.
For the client, it would be much harder, because nothing (OpenGL, Quartz Extreme, Core Services, Software Direct Layer etc.) works like DirectX, and PT doesn't use DirectX in any way Microsoft documents, so it's calls are very hard to understand.
Oh yes; Okay so the source packs to 1.2Meg from a 3.07Meg executable!!! :o However, using the same compression the binary compresses to 776Kb so, it's not so impressive. :wink:
I also used LZMA, not LZMA2 in this 7zip since the new compression method seems to cause people so much trouble with their "old archivers". (poke poke :wink:)
Re: [GUIDE] Adding Code to Client or Server via a DLL. (Part 1.)
Playing with pseudo code giving a lot of information, like:
/Blowing DAVID! <-- this command must rock, whatever it do lol
because right after it is txt:
}
Code:
T.T 흑흑 난 이제 틀렸어 ~~~
{
Boo-hoo ~ ~ ~ now I was wrong T.T
@_@ But who would be so crazy to fix ~389314 lines of code? Anyone Crazy here XD?
Re: [GUIDE] Adding Code to Client or Server via a DLL. (Part 1.)
Quote:
Originally Posted by
Vormav
@_@ But who would be so crazy to fix ~389314 lines of code? Anyone Crazy here XD?
My x86 source is weighing in at 1'554'842 lines of code without the resource section. XD Once it works, I can define the string data the disassembler couldn't "guess" and the number of lines will reduce by the number of characters in each misidentified string... and once it works, we can if-def out the client code and imports from a server build, so I think it's well worth the effort.
I've got my x86 code to a point where it "compiles"... but it doesn't run yet, because the load time linking for DLLs isn't being filled in. ^_^ So yea... It looks like I'm that crazy, provided the errors are simple syntax variation.
A little search and replace, and a few macros go a long way.
The translation I get for "/날린다뇨!" is "/snowed!" or Yahoo! says "/Distinguishes the [nyo]! which"
Those strings can all be seen in Olly if your system codepage is set to Korean. :wink:
The "MrLee" commands are tantalizing too.
Code:
db '이방범: 스킬ShortKey 초기화',0
Align 4
SSZ005EBD44__LeeShotKeyReset:
db '/LeeShotKeyReset',0
Align 4
SSZ005EBD58__________________:
db '/이방범숏키초기화',0
Align 4
SSZ005EBD6C_MrLee__I_like_force_________:
db 'MrLee: I like force /(-_-)/ ',0
Align 4
SSZ005EBD8C__LeeForce:
db '/LeeForce',0
Align 4
SSZ005EBD98____________:
db '/이방범포스:진행중인퀘스트초기화',0
SSZ005EBDA4_____________________________:
db '/이방범퀘스트초기화',0
Align 4
SSZ005EBDC4____________________:
db '/이방범전업퀘스트',0
SSZ005EBDD8_MrLee_Reconnect_again___:
db 'MrLee:Reconnect again!! ',0
Align 4
SSZ005EBDF4_MrLee__Clear_Job_Quest_of_3th_:
db 'MrLee: Clear Job Quest of 3th ',0
Align 4
SSZ005EBE14_MrLee__Clear_Job_Quest_of_Moryon:
db 'MrLee: Clear Job Quest of Moryon 2th',0
Align 4
SSZ005EBE3C_MrLee__Clear_Job_Quest_of_Temscr:
db 'MrLee: Clear Job Quest of Temscron 2th',0
Align 4
SSZ005EBE64__LeeResetRankUp:
db '/LeeResetRankUp',0
SSZ005EBE74__________________:
db '/이방범전업퀘스트',0
Align 4
SSZ005EBE88_MeLee__it_s_good_________:
db 'MeLee: it',27h,'s good /(-_-)/ ',0
Align 4
SSZ005EBEA4__PassRankUp:
db '/PassRankUp',0
SSZ005EBEB0____________:
db /이방범전업',0
SSZ005EBEBC______________________:
db '잘쓰게(-_-)/ ',0
Align 4
SSZ005EBED4__________________:
db '/이방범증정아이템',0
Align 4
SSZ005EBEE8___________________________:
db '이방범: 스탯초기화/(-_-)/ ',0
Align 4
SSZ005EBF04__LeeHelpMeStat:
db '/LeeHelpMeStat',0
Align 4
SSZ005EBF14____________________:
db '/이방범도와줘요스탯',0
SSZ005EBF28___________________________:
db '이방범: 스킬초기화/(-_-)/ ',0
Align 4
SSZ005EBF44__LeeHelpMeSkill:
db '/LeeHelpMeSkill',0
SSZ005EBF54____________________:
db '/이방범도와줘요스킬',0
SSZ005EBF68_MrLee__OK__finished_Level_UP____:
db 'MrLee: OK! finished Level UP /(-_-)/ ',0
Align 4
SSZ005EBF90__LeeWhereIs:
db '/LeeWhereIs',0
SSZ005EBF9C________________:
db '/이방범순찰갔네',0
SSZ005EBFAC_MrLee__Try_again_Quest_:
db 'MrLee: Try again Quest~',0
SSZ005EBFC4_MrLee__Clear_90th_Quest__:
db 'MrLee: Clear 90th Quest ~',0
Align 4
SSZ005EBFE0_MrLee__Clear_80_2th_Quest__:
db 'MrLee: Clear 80_2th Quest ~',0
SSZ005EBFFC_MrLee__Clear_90_2th_Quest__:
db 'MrLee: Clear 90_2th Quest ~',0
SSZ005EC018_MrLee__Clear_85th_Quest__:
db 'MrLee: Clear 85th Quest ~',0
Align 4
SSZ005EC034_MrLee__Clear_80th_Quest__:
db 'MrLee: Clear 80th Quest ~',0
Align 4
SSZ005EC050_MrLee__Clear_70th_Quest__:
db 'MrLee: Clear 70th Quest ~',0
Align 4
SSZ005EC06C_MrLee__Clear_55th_Quest__:
db 'MrLee: Clear 55th Quest ~',0
Align 4
SSZ005EC088_MrLee__Clear_30th_Quest__:
db 'MrLee: Clear 30th Quest ~',0
Align 4
SSZ005EC0A4__LeeResetQuest:
db '/LeeResetQuest',0
Align 4
SSZ005EC0B4__________________:
db '/이방범레벨퀘스트',0
Align 4
SSZ005EC0C8_MrLee_Retry_change_Job_Quest__:
db 'MrLee:Retry change Job Quest~ ',0
Align 4
SSZ005EC0E8__Lee3thRankUp:
db '/Lee3thRankUp',0
Align 4
SSZ005EC0F8________3________:
db '/이방범3차퀘스트',0
Align 4
SSZ005EC10C__Lee4thRankUp:
db '/Lee4thRankUp',0
Align 4
SSZ005EC11C________4________:
db '/이방범4차퀘스트',0
Align 4
SSZ005EC130__________________________:
db '임군:초기화해주는 센스!! ',0
Align 4
SSZ005EC14C________________:
db '/임군초보퀘스트',0
SSZ005EC15C_________________________________:
db '임군:머 그까이것 그냥 대충 해주지.. !! ',0
SSZ005EC184______100______:
db '/임군100퀘스트',0
Align 4
SSZ005EC194__s__s:
db '%s %s',0
Align 4
SSZ005EC19C__T_T_________________________:
db 'T.T 흑흑 난 이제 틀렸어 ~~~',0
Align 4
SSZ005EC1BC___________:
db '/날린다뇨!',0
Align 4
SSZ005EC1C8__________________:
db '/마군오오오오에요',0
Re: [GUIDE] Adding Code to Client or Server via a DLL. (Part 1.)
I really enjoy reading your posts bobsobol you explain an incredible way, I always added a. dll directly by adding the entry point, after starting the operation, i demand free memory, add the calls correctly etc. Finally, you explained in an easier way to show how to give the function. dll, very good
Re: [GUIDE] Adding Code to Client or Server via a DLL. (Part 1.)
Thank you Exellsior, both for caring to read, and for reminding me of this guide so I can add bits I've decided are easier along the way and fix my awful spellink. :ott1: