Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Who have the 1.13c D2GS source code ? #29

Open
Nightshades1 opened this issue Jul 15, 2017 · 21 comments
Open

Who have the 1.13c D2GS source code ? #29

Nightshades1 opened this issue Jul 15, 2017 · 21 comments

Comments

@Nightshades1
Copy link

@Nightshades1 Nightshades1 commented Jul 15, 2017

Hello as the title say it, i'm searching a working 1.13c D2GS source code that can compile on VS 2017.
It's impossible to get that damn D2GS Multi-threaded to work on windows.

I spent 4h to fix it, i re-used official PVPGN.Pro protocol for authentication and all, the Custom D2CS now connect fine with the official PVPGN i'm able to connect/create characters and all, the realm is fine as well.

I did recompile D2GS (MultiThreaded) and disabled the Patch_D2.mpq file size as i have custom patch, and this still doesn't do anything ! that trash error "main: Failed to startup net connector".

Also i don't really want the MultiThread i would like the original 1.13c D2GS that is used by MagicBuilder but i didn't find the source of this D2GS, is it public at least ?

I would like the source because in addition to my mod i would like to introduce server sided administrator command and a real WorldEvent trigger.

Any help would be appreciated !

Ps: I don't want to use linux ! wtf.

@HarpyWar

This comment has been minimized.

Copy link
Member

@HarpyWar HarpyWar commented Jul 15, 2017

There is only 1.09d source code for D2GS.exe https://github.com/pvpgn/d2gs109
Source code for 1.10 was not published, and this D2GS.exe used for all later versions (for example, checksum is the same for 1.10 and 1.13c).

As I understand, @tesseract2048 takes 1.09d sources and made some modifications to make it working with his D2GE engine, that handles game logic https://github.com/pvpgn/d2gs/tree/master/D2GS
His D2GE uses LibD2Server that was written by Marsgod — it's a patch in assembler for d2server.dll and C++ source of d2warden.dll.

Source for LibD2Server you can find in @tesseract2048 repository or in every build from Marsgod https://pvpgn.pro/download/d2gs/
There is no source for d2server.dll, this is a gateway to communicate with Diablo 2 game.

@Nightshades1

This comment has been minimized.

Copy link
Author

@Nightshades1 Nightshades1 commented Jul 16, 2017

Thanks for the reply, looking to fix the "failed to start net connector" error, i'm so close to have it working on windows 🥇

By the way to fix the fdwatch iop error i simply re-used fdwatch select() so the custom D2CS connect on the official CURRENT pvpgn (changed some auth-reply packet) and done.

@HarpyWar

This comment has been minimized.

Copy link
Member

@HarpyWar HarpyWar commented Jul 16, 2017

I was able to compile all the required binaries. This is really a quest how to do it and to understand how to setup. I spent whole the day, all programs are running and connected in logs, but I still could not connect to a server with No realms are available in Diablo 2.
May be you can make it work or someone else. I just will describe below all that I know about it.

Download complete binaries pvpgn_d2gs_tesseract.zip

All the binaries are required to run together. So it's not enough only modified D2CS as I assumed before — modified PvPGN and D2DBSDotNet are also required.

Compile

D2GS.exe, D2GE.exe
https://github.com/pvpgn/d2gs (in this repository I removed Patch_D2.mpq size verification for D2GS.exe)
It can be compiled in Visual Studio 2015/17, if in a project property set Linker > Input > Ignore All Default Libraries from Yes (/NODEFAULTLIB) to No.

PvPGN.exe, d2cs.exe
https://github.com/tesseract2048/pvpgn
I take my old package with PvPGN 1.8.5 http://harpywar.com/?a=articles&b=2&c=1&d=30 and replace files from the repository.
Open PvPGN.sln and add new files: bnetd/bnetd_log.c, bnetd/bnetd_log.h, fdwatch_iocp.h, fdwatch_iocp.c (for d2cs only two last). And remove three fprintf functions defininions, cause it was already defined somewhere else in my Visual Studio environment.

D2DBSDotNet.exe
https://github.com/tesseract2048/D2DBSDotNet
Download MySql.Data.dll from http://mysql.com and update the unresolved MySql.Data dependency for the Visual Studio project. Then build the project, nothing special.

How to setup

Mostly similar with https://pvpgn.pro/d2gs_installation.html

PvPGN

  1. conf/bnetd.conf
    (I don't know the purpose of these vars, I assume it's optional)
mirror_ip = 127.0.0.1
vip_experience = 0
#eqn_hashstr =
  1. Run PvPGN.exe or PvPGNConsole.exe

D2DBSDotNet

  1. conf/d2dbs.conf
mysql_host=127.0.0.1
mysql_database=d2dbs
mysql_user=root
mysql_pass=
  1. Create a new MySQL database d2dbs and execute script d2dbs_init.sql
  2. Run D2DBSDotNet.exe, it has no any visible interface, you should see a running process in a task manager. It can be installed as a Windows service with -s or --service parameter.

D2CS

Run d2cs.exe or d2csConsole.exe

D2GS

Run d2gs/D2GS.exe, it also has no any visible interface, but a process should be running.
You should see in d2gs.log:

07/16 19:24:05.766 D2GSConnectToD2xS: Connected to D2DBS Successfully
07/16 19:24:05.767 D2GSSendClassToD2DBS: Send connection class packet to D2DBS
07/16 19:24:05.867 D2GSConnectToD2xS: Connected to D2CS Successfully
07/16 19:24:05.867 D2GSSendClassToD2CS: Send connection class packet to D2CS
07/16 19:24:05.967 D2GSNetRecvPacket: CS socket become writable
07/16 19:24:05.967 D2GSNetRecvPacket: DBS socket become writable

As I understand, a new process D2GE.exe should start for every created Diablo 2 game.

Note: D2GS.exe will exit immediately if D2CS or D2DBSDotNet is not running.

@Nightshades1

This comment has been minimized.

Copy link
Author

@Nightshades1 Nightshades1 commented Jul 20, 2017

I still have some bug with net_recv (not enough call parameter), could you make a giant compressed rar and upload all the solutions somewhere ? it would be cool.

It's terrible to see that tesseract just let this rot for windows ...

@HarpyWar

This comment has been minimized.

Copy link
Member

@HarpyWar HarpyWar commented Jul 25, 2017

What do you mean? You do not need to compile it yourself, I already shared pvpgn_d2gs_tesseract.zip in the previous post.

@pedr0machad0

This comment has been minimized.

Copy link

@pedr0machad0 pedr0machad0 commented Apr 6, 2018

I've heard that Tesseract's D2GS has a built in firewall, so that we can block 0xFF01 and 0x1400 packets, without the false positives from iptables.
How can I use it?

@geckotdf

This comment has been minimized.

Copy link

@geckotdf geckotdf commented Apr 23, 2018

@HarpyWar why the pvpgn_d2gs_tesseract.zip cant run in windows xp for example? Send the error win32 not valid application.

@RElesgoe

This comment has been minimized.

Copy link
Member

@RElesgoe RElesgoe commented Apr 23, 2018

@geckotdf you should really question why you would use Windows XP in 2018.

@geckotdf

This comment has been minimized.

Copy link

@geckotdf geckotdf commented Apr 23, 2018

@RElesgoe Its because I was trying to figure it out why this not work - first we know tesseract desing all this for 32 bits, and for windows XP originally - And the problem with the compiled version at this moment is the d2cs - When you open it say:

fdw_iocp_add_fd: cannot update iocp sock 512 with read state: 10057

And thats the trick with this multi thread D2GS - In fact the D2GS works OK but the realms are not working at this moment.-
Probably inside the D2CS we have a 32 library or something like that.-

The real question here is, in Windows XP say that error because its Windows XP ? or because its a 64 bits app?

@RElesgoe

This comment has been minimized.

Copy link
Member

@RElesgoe RElesgoe commented Apr 23, 2018

Likely because it's Windows XP. I'm guessing that @HarpyWar compiled the binaries without Windows XP support which occurs by default with newer versions of Visual Studio.

@geckotdf

This comment has been minimized.

Copy link

@geckotdf geckotdf commented Apr 23, 2018

@RElesgoe I see, well I try in 32 bits Windows 7 and works, so its related to the Win XP support.-
By the way continue working on - And I believe its something related with "Mirror_IP" in the bnetd.conf

If you any IP different from the host or # in Mirror_IP you have two errors:

[error] sd_accept: s_addr: 301a8c0, mirror_addr: xxxxxx
[fatal] sd_tcpinput: d2cs sock: 1000
[info ] on_d2cs_authreply: d2cs 192.168.1.11 authed [debug] conn_set_realm: [1000] set to "D2CS" [info ] realm_active: realm D2CS actived

And the Realm its created, but in practice we know thats not true, I believe because we have a "fatal" error in the tcpinput.

But if you put the local IP where D2CS its running in the Mirror_IP you get:
[error] sd_accept: s_addr: 301a8c0, mirror_addr: 301a8c0

No fatal error, but the realm dont say its created.-

I believe the mirror IP its where the realm its working - In any of the two ways if you try to connect via "Multiplayer" options you can connect but when try to create a game you get

handle_bnet_packet: [572] (logged in) got error handling packet type 0x1cff, len 32

In my opinion its very clear the problem its the compilation of the D2CS.-

@RElesgoe

This comment has been minimized.

Copy link
Member

@RElesgoe RElesgoe commented Apr 23, 2018

Ignore this message [error] sd_accept: s_addr: 301a8c0, mirror_addr: 301a8c0, it's not actually an error. Do you ever get a message saying could not create realm?

@RElesgoe

This comment has been minimized.

Copy link
Member

@RElesgoe RElesgoe commented Apr 23, 2018

In regards to handle_bnet_packet: [572] (logged in) got error handling packet type 0x1cff, len 32, it seems that tesseract is blocking open game types.
https://github.com/tesseract2048/pvpgn/blob/master/src/bnetd/handle_bnet.c#L3784-L3788

@geckotdf

This comment has been minimized.

Copy link

@geckotdf geckotdf commented Apr 23, 2018

@RElesgoe I see, so the D2GS HT dont allow open games and it's fine this was desing to be used in a pvpgn server.-

And about the "could not create realm" - No never.-
Only two conditions the first when you put in mirror_ip something different to the local ip you get the [fatal] sd_tcpinput: d2cs sock: 1000 error, but say the realm its created, we know that not work.-

And the other condition its when you put the same local IP in themirror_ipyou dont get the [fatal] sd_tcpinput: d2cs sock: 1000 error, but you dont see "Realm xxxx Activated"

And no, in any of this two posible conditions I find get the error could not create realm.-

I test this in 32 bits or 64 bits, Windows 10 or 7, its the same.-

Then I try to create two servers in different local ips to see if the mirror its related and no, nothing happend its the same.-

The D2DBS works OK, the D2GS, works fine too, the PVPGN start OK - but, we still have the problem with the D2CS

@RElesgoe

This comment has been minimized.

Copy link
Member

@RElesgoe RElesgoe commented Apr 23, 2018

[fatal] sd_tcpinput: d2cs sock: 1000 isn't an actual error either, but it does indicate that d2cs made a connection to pvpgn. What is not working when it says realm activated?

@geckotdf

This comment has been minimized.

Copy link

@geckotdf geckotdf commented Apr 23, 2018

When say "realm activated" happend what @HarpyWar say:
No realms are available

You can register, login, create the character but after that say no realms available and logout - Then when you try to login again happend the same No realms are available

@RElesgoe

This comment has been minimized.

Copy link
Member

@RElesgoe RElesgoe commented Apr 23, 2018

What do you have in realm.conf?

@geckotdf

This comment has been minimized.

Copy link

@geckotdf geckotdf commented Apr 23, 2018

"D2CS" "PvPGN Closed Realm" 192.168.1.20:6113

Use the same IP where my D2CS its running.-

@geckotdf

This comment has been minimized.

Copy link

@geckotdf geckotdf commented Apr 23, 2018

@RElesgoe for example this is an output trying to login:

Apr 23 16:43:59 [error] sd_accept: s_addr: 1401a8c0, mirror_addr: 301a8c0
Apr 23 16:43:59 [info ] conn_create: [1052][1000] sessionkey=0x5ade1fa4 sessionnum=0x00000002
Apr 23 16:43:59 [debug] sd_accept: [1052] client connected to a bnet listening address
Apr 23 16:43:59 [info ] handle_init_packet: [1052] client initiated file download connection
Apr 23 16:43:59 [trace] conn_shutdown: [1052] connection allready closed
Apr 23 16:43:59 [info ] file_send: [1052] sending file "bnserver-D2DV.ini" of length 364
Apr 23 16:43:59 [debug] sd_tcpinput: [1052] read returned -1 (closing connection)
Apr 23 16:43:59 [info ] conn_destroy: [1052] closed file connection
Apr 23 16:44:01 [debug] file_read_attrs: loading "var\users/gecko"
Apr 23 16:44:01 [fatal] conn_login: [1028] "gecko" from 192.168.1.20 logged in (right password)
Apr 23 16:44:01 [info ] _client_loginreq2: [1028] "gecko" logged in (correct password)
Apr 23 16:44:07 [info ] _client_setemailreply: [1028] init account "gecko" email to "123@123.com"
Apr 23 16:44:07 [debug] sd_tcpinput: [1028] read returned -1 (closing connection)
Apr 23 16:44:07 [info ] conn_destroy: [1028] "gecko" logged out
Apr 23 16:44:07 [info ] conn_destroy: [1028] closed bnet connection

@geckotdf

This comment has been minimized.

Copy link

@geckotdf geckotdf commented Apr 24, 2018

Last thing I try it was put the server in my job and connect me from outside, to avoid any LAN problem between the PVPGN and client.-
No working, the same error "realms not available"

@zysus

This comment has been minimized.

Copy link

@zysus zysus commented Sep 14, 2019

Rookie question.
Can someone tell me how to add mid Mod (several dll) to the D2gs to make it work? What should I change in the source code to read it? I appreciate the help.
Or what parameters should I modify?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.