Removed NioTSO client and server

- NioTSO client isn't needed because we're using RayLib
- Added FreeSO's API server to handle most backend operations
This commit is contained in:
Tony Bark 2024-05-01 02:55:43 -04:00
parent f12ba1502b
commit 22191ce648
591 changed files with 53264 additions and 3362 deletions

View file

@ -0,0 +1,13 @@
namespace FSO.Common.Serialization.Primitives
{
public class cTSOGenericData
{
public byte[] Data;
public cTSOGenericData() { }
public cTSOGenericData(byte[] data)
{
Data = data;
}
}
}

View file

@ -0,0 +1,114 @@
using System;
using Mina.Core.Buffer;
using System.ComponentModel;
using FSO.Common.Serialization.TypeSerializers;
namespace FSO.Common.Serialization.Primitives
{
[cTSOValue(0x125194E5)]
public class cTSONetMessageStandard : IoBufferSerializable, IoBufferDeserializable
{
public uint Unknown_1 { get; set; }
public uint SendingAvatarID { get; set; }
public cTSOParameterizedEntityFlags Flags { get; set; }
public uint MessageID { get; set; }
public uint? DatabaseType { get; set; }
public uint? DataServiceType { get; set; }
public uint? Parameter { get; set; }
public uint RequestResponseID { get; set; }
[TypeConverter(typeof(ExpandableObjectConverter))]
public object ComplexParameter { get; set; }
public uint Unknown_2 { get; set; }
public cTSONetMessageStandard(){
}
public void Deserialize(IoBuffer input, ISerializationContext context)
{
this.Unknown_1 = input.GetUInt32();
this.SendingAvatarID = input.GetUInt32();
var flagsByte = input.Get();
this.Flags = (cTSOParameterizedEntityFlags)flagsByte;
this.MessageID = input.GetUInt32();
if ((this.Flags & cTSOParameterizedEntityFlags.HAS_DS_TYPE) == cTSOParameterizedEntityFlags.HAS_DS_TYPE)
{
this.DataServiceType = input.GetUInt32();
}else if ((this.Flags & cTSOParameterizedEntityFlags.HAS_DB_TYPE) == cTSOParameterizedEntityFlags.HAS_DB_TYPE){
this.DatabaseType = input.GetUInt32();
}
if ((this.Flags & cTSOParameterizedEntityFlags.HAS_BASIC_PARAMETER) == cTSOParameterizedEntityFlags.HAS_BASIC_PARAMETER)
{
this.Parameter = input.GetUInt32();
}
if ((this.Flags & cTSOParameterizedEntityFlags.UNKNOWN) == cTSOParameterizedEntityFlags.UNKNOWN)
{
this.Unknown_2 = input.GetUInt32();
}
if ((this.Flags & cTSOParameterizedEntityFlags.HAS_COMPLEX_PARAMETER) == cTSOParameterizedEntityFlags.HAS_COMPLEX_PARAMETER)
{
uint typeId = DatabaseType.HasValue ? DatabaseType.Value : DataServiceType.Value;
this.ComplexParameter = context.ModelSerializer.Deserialize(typeId, input, context);
}
}
public void Serialize(IoBuffer output, ISerializationContext context)
{
output.PutUInt32(Unknown_1);
output.PutUInt32(SendingAvatarID);
byte flags = 0;
if (this.DatabaseType.HasValue){
flags |= (byte)cTSOParameterizedEntityFlags.HAS_DB_TYPE;
}
if (this.DataServiceType.HasValue){
flags |= (byte)cTSOParameterizedEntityFlags.HAS_DB_TYPE;
flags |= (byte)cTSOParameterizedEntityFlags.HAS_DS_TYPE;
}
if (this.Parameter != null){
flags |= (byte)cTSOParameterizedEntityFlags.HAS_BASIC_PARAMETER;
}
if(this.ComplexParameter != null){
flags |= (byte)cTSOParameterizedEntityFlags.HAS_COMPLEX_PARAMETER;
}
output.Put(flags);
output.PutUInt32(MessageID);
if (this.DataServiceType.HasValue)
{
output.PutUInt32(this.DataServiceType.Value);
}else if (this.DatabaseType.HasValue){
output.PutUInt32(this.DatabaseType.Value);
}
if (this.Parameter.HasValue){
output.PutUInt32(this.Parameter.Value);
}
if (this.ComplexParameter != null){
context.ModelSerializer.Serialize(output, ComplexParameter, context, false);
}
}
}
[Flags]
public enum cTSOParameterizedEntityFlags
{
HAS_DB_TYPE = 1,
HAS_DS_TYPE = 2,
HAS_BASIC_PARAMETER = 4,
UNKNOWN = 8,
HAS_COMPLEX_PARAMETER = 32
}
}

View file

@ -0,0 +1,53 @@
using System.Collections.Generic;
using Mina.Core.Buffer;
namespace FSO.Common.Serialization.Primitives
{
public class cTSOProperty : IoBufferSerializable, IoBufferDeserializable
{
public uint StructType;
public List<cTSOPropertyField> StructFields;
public void Serialize(IoBuffer output, ISerializationContext context)
{
output.PutUInt32(0x89739A79);
output.PutUInt32(StructType);
output.PutUInt32((uint)StructFields.Count);
foreach (var item in StructFields)
{
output.PutUInt32(item.StructFieldID);
context.ModelSerializer.Serialize(output, item.Value, context, true);
}
}
public void Deserialize(IoBuffer input, ISerializationContext context)
{
//Unknown
input.GetUInt32();
StructType = input.GetUInt32();
StructFields = new List<cTSOPropertyField>();
var numFields = input.GetUInt32();
for(int i=0; i < numFields; i++){
var fieldId = input.GetUInt32();
var typeId = input.GetUInt32();
var value = context.ModelSerializer.Deserialize(typeId, input, context);
StructFields.Add(new cTSOPropertyField
{
StructFieldID = fieldId,
Value = value
});
}
}
}
public class cTSOPropertyField
{
public uint StructFieldID;
public object Value;
}
}

View file

@ -0,0 +1,70 @@
using Mina.Core.Buffer;
using FSO.Common.Serialization.TypeSerializers;
namespace FSO.Common.Serialization.Primitives
{
[cTSOValue(0x9736027)]
public class cTSOTopicUpdateMessage : IoBufferSerializable, IoBufferDeserializable
{
public uint MessageId { get; set; } = 0xA97360C5;
public uint StructType { get; set; }
public uint StructId { get; set; }
public uint StructField { get; set; }
public uint[] DotPath { get; set; }
public uint Unknown1 { get; set; }
public uint Unknown2 { get; set; }
public object Value { get; set; }
public string ReasonText { get; set; }
public void Serialize(IoBuffer output, ISerializationContext context)
{
output.PutUInt32(Unknown1); //Update counter
output.PutUInt32(MessageId); //Message id
output.PutUInt32(Unknown2); //Unknown
if (DotPath != null)
{
output.PutUInt32((uint)DotPath.Length);
foreach(var component in DotPath){
output.PutUInt32(component);
}
}
else
{
//Vector size
output.PutUInt32(3);
output.PutUInt32(StructType);
output.PutUInt32(StructId);
output.PutUInt32(StructField);
}
//Write value
context.ModelSerializer.Serialize(output, Value, context, true);
output.PutPascalVLCString(ReasonText);
}
public void Deserialize(IoBuffer input, ISerializationContext context)
{
Unknown1 = input.GetUInt32();
MessageId = input.GetUInt32();
Unknown2 = input.GetUInt32();
var vectorSize = input.GetUInt32();
DotPath = new uint[vectorSize];
for(int i=0; i < vectorSize; i++){
DotPath[i] = input.GetUInt32();
}
var valueType = input.GetUInt32();
this.Value = context.ModelSerializer.Deserialize(valueType, input, context);
//this.ReasonText = input.GetPascalVLCString();
}
}
}