From bf1e9d135015a4224d06a14f3e907ebd9d36e2f9 Mon Sep 17 00:00:00 2001 From: CPunch Date: Fri, 10 Mar 2023 00:58:29 -0600 Subject: [PATCH] updated README --- README.md | 4 ++++ server/login.go | 2 +- server/loginserver.go | 14 +++++++------- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 2ac3885..fe3b599 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,10 @@ A toy implementation of the [Fusionfall Packet Protocol](https://openpunk.com/pages/fusionfall-openfusion/) written in Go. +## Login Sever + +An example login server implementation exists in `server/`. This implementation should be compatible with existing OpenFusion databases, however this only exists as an example and doesn't direct clients to a shard server (they're softlocked after the tutorial, or during character selection). + ## Generating structures Dump and decompile the `Assembly - CSharp.dll` assembly from the fusionfall main.unity3d, using a tool like [ilspycmd](https://www.nuget.org/packages/ilspycmd/). The full output source can then be passed to `genstructs.py` script located in `tools/`, which will handle scraping constants and calculating structure padding. See the script for details on usage. \ No newline at end of file diff --git a/server/login.go b/server/login.go index 29bcfc3..7930cd1 100644 --- a/server/login.go +++ b/server/login.go @@ -211,7 +211,7 @@ func (server *LoginServer) CharacterCreate(peer *Peer, pkt *protocol.Packet) { ILevel: int16(plr.Level), SPC_Style: PCStyle, SPC_Style2: PCStyle2, - SOn_Item: charPkt.SOn_Item, // if the items were faked, we don't really care since the db only stores the sanitized fields + SOn_Item: charPkt.SOn_Item, // if items were faked, we don't really care since the db only stores the sanitized fields }, protocol.P_LS2CL_REP_CHAR_CREATE_SUCC) } diff --git a/server/loginserver.go b/server/loginserver.go index fed6184..21b0302 100644 --- a/server/loginserver.go +++ b/server/loginserver.go @@ -9,9 +9,9 @@ import ( ) type LoginServer struct { - listener net.Listener - peers map[*Peer]bool - lock sync.Mutex + listener net.Listener + peers map[*Peer]bool + peersLock sync.Mutex } func NewLoginServer() *LoginServer { @@ -78,13 +78,13 @@ func (server *LoginServer) HandlePacket(peer *Peer, typeID uint32, pkt *protocol } func (server *LoginServer) Disconnect(peer *Peer) { - server.lock.Lock() + server.peersLock.Lock() delete(server.peers, peer) - server.lock.Unlock() + server.peersLock.Unlock() } func (server *LoginServer) Connect(peer *Peer) { - server.lock.Lock() + server.peersLock.Lock() server.peers[peer] = true - server.lock.Unlock() + server.peersLock.Unlock() }