Jump to content

Tmp4's source moved to windows


Amun

Recommended Posts

  • Contributor

This is the hidden content, please

Metin2 Download

 

Hi

 

I noticed quite a bit of people have problems opening a dev server on Tmp4's source.

I moved the server source to windows hoping it'd be easier for any beginners to get started. If anyone wants to give it a try, here it is:

This is the hidden content, please

I've also removed matrix card, auction, udp port, etc.. Not all of them, but quite a few.

 

NOTE: If you don't have the Client from Tmp4, go to his topic and download it(maybe give him a thanks while you're there).

Here's the topic:

 

 

OK, let's get started.

How to:
 

Download the files and move them in a folder.

Open a terminal (CMD/PowerShell/GitBash, etc..) and cd into the folder where you downloaded the files.

Now run:

tar -xvzf client_src.tgz
tar -xvzf root.tgz
tar -xvzf server_extern.tgz
tar -xvzf server_src.tgz
tar -xvzf winsf.tgz

If you get any errors from tar, you might need to install Git Bash(or just use WinRar or something).

 

I wanted to give you the server already compiled, just to get started faster, but I cleaned up the objects and forgot to make a backup of the game and db.exe..

So, you'll have to compile them yourself, unfortunately.

 

Go to server_src and open m2_server.2008.sln(I didn't rename it, do it yourself) then select Debug(or release, whatever you want) and Win32.

After the game and db files are compiled, go back and open `winsf` folder.

Now run `make_test_env.bat` with admin rights(it needs them to create the shortcuts(links)).

After each compilation you just run `refresh.bat` to remove the old exe files and replace them with the new ones(Or just change the out directory in VS to winsf.. your choice).

 

To start in debug mode, just run `run_d.bat`.

 

If you don't have mysql server installed on your PC, get it from here:

https://downloads.mysql.com/archives/installer/?version=5.6.26

And click the second button(294.4MB).

 

After it's installed, connect to the mysql server with either MySql WorkBench or with Navicat and import the sql scripts found in sql.rar.

The tables are taken from some old serverfiles(from Marty, if I'm not mistaken). The tables are fucked, but it should work fine to get started.

I'll fix them up later if I have time.. but not now.. Also, don't forget to change the user and password in the configs.(You'll find them in share/cores_config).

 

Also. If your PC slows down while compiling, you might want to disable Multi-processor Compilation(I don't know if it's user specific or if it's saved in the solution's config, but I wanted to mention it just in case it's saved).

 

The last step is to copy the exe files from client_src/binary into your client, pack the root folder with Eternexus(or whatever you use) and replace them in Client/pack.

Here's two pictures:

 

If I forgot anything, just let me know and I'll update the post as soon as I can. Also, please report whatever bugs/errors you find. It would be greatly appreciated.

Cheers!

 

Virus total found BitDefenderTheta in server_extern, but Antivirus found none, so you decide if you want to use them or just compile the libs yourself:

Spoiler

root

This is the hidden content, please

server_src

This is the hidden content, please

sql

This is the hidden content, please

winsf

This is the hidden content, please

client_src

This is the hidden content, please

server_extern

This is the hidden content, please

 

Spoiler

Spoiler

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 156
  • kekw 2
  • Eyes 4
  • Dislove 1
  • Angry 1
  • Cry 1
  • Smile Tear 1
  • Think 2
  • Scream 1
  • Lmao 2
  • Good 36
  • Love 9
  • Love 90
Link to comment
Share on other sites

  • Contributor
1 hour ago, TMP4 said:

Nice release and tutorial for windows but to be clear the source actually came from @ Mali as I stated in my topic, I only fixed the known bugs & exploits in the r40250 src. So give him a thanks too here! 🙂

Thank you! And many thanks to @ Mali as well!

He saved me from having to dig out and compile MySql connector and DevIL. I just "stole" them from a source he posted on GitHub xD

Link to comment
Share on other sites

  • 2 weeks later...
  • Premium
2 hours ago, EnneGi said:

Did you edit something about socket count server side?

Cause with the client TMP4 provided i can't see items in my inventory, even if i have them.

In logs i had an error like "Invalid Socket Count 3, set to maximum"

when you add an item to your inventory with AddToCharacter print the index out and look if you really have the item or not if your console says you have it check if the update packet is sending to the client and check if python update correctly

Link to comment
Share on other sites

1 hour ago, xTryhard said:

when you add an item to your inventory with AddToCharacter print the index out and look if you really have the item or not if your console says you have it check if the update packet is sending to the client and check if python update correctly

Really thanks, i solved, items were really in the inventory, i spawned some item in admin account and then all items reappear (magic?)

 

For OP, i have found another bug, don't know if anyone has the same. Skill points not setting correctly, the abilities stay with 0 points.

Someone know a fix for this? Thanks

Link to comment
Share on other sites

  • Premium
4 hours ago, EnneGi said:

Really thanks, i solved, items were really in the inventory, i spawned some item in admin account and then all items reappear (magic?)

 

For OP, i have found another bug, don't know if anyone has the same. Skill points not setting correctly, the abilities stay with 0 points.

Someone know a fix for this? Thanks

it is always the same you ( client ) want something from the server so for example you press a button now you send a packet to the server he looks what you want and after that he will validate your packet if everything is good you get a callback from the server with the data you want if something is wrong he will not send you anything ( anti cheat )

the best way to debug something is to start at the beginning from the road look what will happen when you press on the button and check everything the way to the server and back to the client

use printf in source to see if you get what you expect or not
 

Edited by xTryhard
Link to comment
Share on other sites

17 hours ago, xTryhard said:

it is always the same you ( client ) want something from the server so for example you press a button now you send a packet to the server he looks what you want and after that he will validate your packet if everything is good you get a callback from the server with the data you want if something is wrong he will not send you anything ( anti cheat )

the best way to debug something is to start at the beginning from the road look what will happen when you press on the button and check everything the way to the server and back to the client

use printf in source to see if you get what you expect or not
 

Really thanks for the tips. I'm working on it, if i found the root cause i will post it.

Meanwhile, i found that this bug happens only in Release mode compilation with Windows. In debug mode, it just works out of the box, Skill points are setted. OBV this bug doesn't happen if you compile TMP4 source in freebsd.

To summarize, it is reproducible only if you compile these source in Windows via Visual Studio in Release Mode - 32 bit.

Link to comment
Share on other sites

  • Contributor
9 minutes ago, EnneGi said:

Really thanks for the tips. I'm working on it, if i found the root cause i will post it.

Meanwhile, i found that this bug happens only in Release mode compilation with Windows. In debug mode, it just works out of the box, Skill points are setted. OBV this bug doesn't happen if you compile TMP4 source in freebsd.

To summarize, it is reproducible only if you compile these source in Windows via Visual Studio in Release Mode - 32 bit.

I'm compiling right now. I'll take a look once it's done.

 

Does it happen when both the client and the server are running in release?

Or when only one of them is running in release while the other is in debug?

Link to comment
Share on other sites

1 hour ago, Amun said:

I'm compiling right now. I'll take a look once it's done.

 

Does it happen when both the client and the server are running in release?

Or when only one of them is running in release while the other is in debug?

Client in release/distribution mode, db/game server in release to reproduce the bug.

I tried db/game in debug mode, and client still in release/distribution and it works

Thanks!!

Link to comment
Share on other sites

  • 2 weeks later...
  • Contributor
On 3/10/2022 at 1:11 PM, EnneGi said:

Client in release/distribution mode, db/game server in release to reproduce the bug.

I tried db/game in debug mode, and client still in release/distribution and it works

Thanks!!

Apologies for the late reply, I didn't have a lot of time for metin2.

 

Now, in regards to the bug, I remembered about a conversation I had with @MrQuin in Dec 2020 and he said he had a similar problem when running the server in release mode on windows.

 

I've just compiled the server with this and seems like it's fixed now.

In common/tables.h search for:

typedef struct SPlayerSkill

 

And replace it with:

typedef struct SPlayerSkill
{
	BYTE    bMasterType;
	BYTE    bLevel;
#ifdef _WIN32
	DWORD    tNextRead;
#else
	time_t    tNextRead;
#endif
} TPlayerSkill;

 

I'll upload the source with the update when I have a bit of free time.

Thank you for letting us know!

 

For everyone else:

Please don't hesitate to write a comment or shoot me a message if you find any other bugs!

Thank You!

 

Here's a picture of the server running in release:

 

https://metin2.download/picture/Wm8fP1eA7eiz6Q7tbSp17lwWCH097CJL/.png

 

Problem update: 17/01/2023

Just found out(by mistake) it happens because `_USE_32BIT_TIME_T` preprocessor definition is only added in debug build. To fix it once and for all(no need to edit the tables anymore), do the following:

Select all projects(game, db, gamelib, etc), right click -> properties -> C/C++ -> Preprocessor

(note: make sure the configuration is set for `Release`)

Extend preprocessor definitions with `_USE_32BIT_TIME_T`

Edited by Amun
Found out why it was happening
  • Love 1
Link to comment
Share on other sites

1 hour ago, Amun said:

Apologies for the late reply, I didn't have a lot of time for metin2.

 

Now, in regards to the bug, I remembered about a conversation I had with @MrQuin in Dec 2020 and he said he had a similar problem when running the server in release mode on windows.

 

I've just compiled the server with this and seems like it's fixed now.

In common/tables.h search for:

typedef struct SPlayerSkill

 

And replace it with:

typedef struct SPlayerSkill
{
	BYTE    bMasterType;
	BYTE    bLevel;
#ifdef _WIN32
	DWORD    tNextRead;
#else
	time_t    tNextRead;
#endif
} TPlayerSkill;

 

I'll upload the source with the update when I have a bit of free time.

Thank you for letting us know!

 

For everyone else:

Please don't hesitate to write a comment or shoot me a message if you find any other bugs!

Thank You!

 

Here's a picture of the server running in release:

 

https://metin2.download/picture/Wm8fP1eA7eiz6Q7tbSp17lwWCH097CJL/.png

You are the GOAT, thank you!!
With the help of other guys in the forum, we have also found a solution for the drop bug (excessive drop bug):
Excessive drop - Questions & Answers - Metin2 Dev

If someone is interested, i leave the link shared for anyone 🙂 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 1
Link to comment
Share on other sites

Announcements



  • Similar Content

  • Activity

    1. 3

      [Discussion] Rain - The First Person that leaked the M2 Files

    2. 0

      [Client] All tabs opening after quest/npc talk or even shop // PORTS

    3. 0

      Arrow does not hide at warp

    4. 0

      Problem with sidebar by vegas

    5. 58

      Discord Rich Presence

    6. 145

      Full Costume Mount System

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.