Fix for boat/channel outside network

Joined
Mar 22, 2006
Messages
211
Reaction score
810
EDIT 1: Found that I cant make this work with WAN IP or DDNS. I will research a bit more. (VPN works great tho)

So, if you can play in LAN without problem, but your friends cant join even with VPN, you can try this solution.

I found that Channel and Boat services were trying to connect to my physical LAN ip, which my PC and everyone in my LAN could resolve because its a valid IP withing my network, but everyone else outside the network couldnt join channel nor start a boat (they could still roam the world and use the cash shop).

Well, looks like the culprit is "Core.dll".

EDIT2: So, I made a V2 for this process, so now I made it so Core.dll would read a .txt file from the bin folder (where Core.dll is), and take the IP from there. In theory you can parse DDNS or IPv4. But as stated in EDIT-1, this doesnt work when trying to assing something outside the network, so only local adapters (Lan or VPN).

V2 Steps:

1 - Download my modified Core.dll

- Mediafire:
- AnonFiles (mirror1):
- FileTranfer.io (mirror2):

2 - Now go to ..."\Server\zh-tw-x-gm\Bin`" and create "ServicesHostname.txt". (FILENAME IS CASESENSITIVE! S and H CAPITAL LETTERS)
3 - Put your VPN or LAN IP (the one you are using in the rest of your server files for connection.)

ServicesHostname.txt accepts IPv4 and domain names.


V1:
I will leave V1 steps just in case you want to know how to peek into the .dll's and want to do your own approach or research.
Code:
Steps:
1 - Download dnSpy ( [url]https://github.com/dnSpy/dnSpy/releases/[/url] )
2 - Make a backup of Core.dll ( \Server\zh-tw-x-gm\Bin`\Core.dll )
3 - Open dnSpy, go to File > Open... and select the Core.dll you want to edit.
4 - Go to Core > Core.dll > Devcat.Core.Net and click on "TcpServerBase<TClient>"
5 - Search for: "public static IPAddress GetLocalIP(ServerBindType bindType)" (around line 224)

It should look something like this:
[url=https://ibb.co/W6Mhbrs][img]https://i.ibb.co/NsJv807/imagen-2022-12-27-113316257.png[/img][/url]

6 - Now right click over "GetLocalIP" and select "Edit Method (C#)..."   - (DO NOT SELECT EDIT CLASS)
It should look like:
[url=https://ibb.co/k2PZkc8][img]https://i.ibb.co/d4HZ1K2/imagen-2022-12-27-113749882.png[/img][/url]

7 - Now just select all (shortcut Ctrl+A) and paste this:
using System;
using System.Net;
using System.Net.Sockets;
using System.Runtime.CompilerServices;
using Devcat.Core.Threading;

namespace Devcat.Core.Net
{
    // Token: 0x0200006B RID: 107
    public abstract partial class TcpServerBase<TClient> : ITcpServer where TClient : TcpClient, new()
    {
        // Token: 0x060002EE RID: 750 RVA: 0x00003E26 File Offset: 0x00002026
        public static IPAddress GetLocalIP(ServerBindType bindType)
        {
            return IPAddress.Parse("YOUR-IP-HERE");
        }
    }
}

8 - Replace "YOUR-IP-HERE" with your VPN or WAN Ip. (Dont delete the Quotes " ")
Example: return IPAddress.Parse("10.72.13.20");

9 - Hit compile in the bottom right corner.

10 - Go to File > Save Module... > Untick Shared Method Modules (this means, DO NOT SELECT SHARED METHOD BODIES).
Like this:
[IMG]https://i.ibb.co/kGf7bxZ/imagen-2022-12-27-114542379.png[/IMG]

Save wherever you want.

11 - Replace your modified Core.dll in "\Server\zh-tw-x-gm\Bin`"

12 - Enjoy

(This is a rubbish modification, but it works, also I know **** about C# or dev all along so this was kinda a miracle haha)

Any improvement or question is welcome.
 
Last edited:
Back