Server按照平台区分单个玩家使用数据长度为byte,ushort

This commit is contained in:
sin365 2025-01-25 01:34:43 +08:00
parent 9abbce930f
commit 912468b674
4 changed files with 107 additions and 52 deletions

View File

@ -728,14 +728,38 @@ namespace AxibugEmuOnline.Server
/// 按照SlotIdx设置Input
/// </summary>
/// <param name="slotIdx"></param>
void SetInputDataBySlotIdx(uint slotIdx, byte val)
void SetInputDataBySlotIdx(uint slotIdx, ushort val)
{
switch (slotIdx)
switch (GameRomPlatformType)
{
case 0: mCurrInputData.p1_byte = val; break;
case 1: mCurrInputData.p2_byte = val; break;
case 2: mCurrInputData.p3_byte = val; break;
case 4: mCurrInputData.p3_byte = val; break;
case RomPlatformType.Cps1:
case RomPlatformType.Cps2:
case RomPlatformType.Neogeo:
case RomPlatformType.Igs:
case RomPlatformType.ArcadeOld:
{
//ushort 类型作为单个玩家操作
switch (slotIdx)
{
case 0: mCurrInputData.p1_ushort = val; break;
case 1: mCurrInputData.p2_ushort = val; break;
case 2: mCurrInputData.p3_ushort = val; break;
case 4: mCurrInputData.p3_ushort = val; break;
}
}
break;
default:
{
//byte 类型作为单个玩家操作
switch (slotIdx)
{
case 0: mCurrInputData.p1_byte = (byte)val; break;
case 1: mCurrInputData.p2_byte = (byte)val; break;
case 2: mCurrInputData.p3_byte = (byte)val; break;
case 4: mCurrInputData.p3_byte = (byte)val; break;
}
}
break;
}
}
/// <summary>
@ -766,13 +790,38 @@ namespace AxibugEmuOnline.Server
/// <param name="slotIdx"></param>
void ClearInputDataBySlotIdx(uint slotIdx)
{
switch (slotIdx)
switch (GameRomPlatformType)
{
case 0: mCurrInputData.p1_byte = 0; break;
case 1: mCurrInputData.p2_byte = 0; break;
case 2: mCurrInputData.p3_byte = 0; break;
case 4: mCurrInputData.p3_byte = 0; break;
case RomPlatformType.Cps1:
case RomPlatformType.Cps2:
case RomPlatformType.Neogeo:
case RomPlatformType.Igs:
case RomPlatformType.ArcadeOld:
{
//ushort 类型作为单个玩家操作
switch (slotIdx)
{
case 0: mCurrInputData.p1_ushort = 0; break;
case 1: mCurrInputData.p2_ushort = 0; break;
case 2: mCurrInputData.p3_ushort = 0; break;
case 4: mCurrInputData.p4_ushort = 0; break;
}
}
break;
default:
{
//byte 类型作为单个玩家操作
switch (slotIdx)
{
case 0: mCurrInputData.p1_byte = 0; break;
case 1: mCurrInputData.p2_byte = 0; break;
case 2: mCurrInputData.p3_byte = 0; break;
case 4: mCurrInputData.p3_byte = 0; break;
}
}
break;
}
}
/// <summary>
/// 更新同步名单
@ -981,7 +1030,9 @@ namespace AxibugEmuOnline.Server
//mDictPlayerIdx2SendQueue.Clear();
mCurrServerFrameId = 0;
mCurrInputData.all = 1;
//??????????=>>mCurrInputData.all = 1;
mCurrInputData.all = 0;
UpdateRoomForwardNum();

View File

@ -72,7 +72,7 @@ namespace AxibugProtobuf {
"aW5pSW5mbyJLChVQcm90b2J1Zl9TY3Jlbm5fRnJhbWUSDgoGUm9vbUlEGAEg",
"ASgFEg8KB0ZyYW1lSUQYAiABKAUSEQoJUmF3Qml0bWFwGAMgASgMIkkKI1By",
"b3RvYnVmX1Jvb21fU2luZ2xlUGxheWVySW5wdXREYXRhEg8KB0ZyYW1lSUQY",
"ASABKA0SEQoJSW5wdXREYXRhGAIgASgNIoABCidQcm90b2J1Zl9Sb29tX1N5",
"ASABKA0SEQoJSW5wdXREYXRhGAIgASgEIoABCidQcm90b2J1Zl9Sb29tX1N5",
"bl9Sb29tRnJhbWVBbGxJbnB1dERhdGESDwoHRnJhbWVJRBgBIAEoDRIRCglJ",
"bnB1dERhdGEYAiABKAQSFQoNU2VydmVyRnJhbWVJRBgDIAEoDRIaChJTZXJ2",
"ZXJGb3J3YXJkQ291bnQYBCABKA0iPgoUUHJvdG9idWZfUm9vbV9DcmVhdGUS",
@ -157,16 +157,17 @@ namespace AxibugProtobuf {
"bBAFEhQKEFN3aXRjaFByb0NvbnRyb2wQBhIQCgxTd2l0Y2hKb3lDb24QBxIS",
"Cg5YQk9YMzYwQ29udHJv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hc2VEZWZhdWx0EAASBgoCT0sQARIOCgpBY2NvdW50RXJyEAJC",
"AkgBYgZwcm90bzM="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::AxibugProtobuf.CommandID), typeof(global::AxibugProtobuf.ErrorCode), typeof(global::AxibugProtobuf.LoginType), typeof(global::AxibugProtobuf.DeviceType), typeof(global::AxibugProtobuf.GamePadType), typeof(global::AxibugProtobuf.RomPlatformType), typeof(global::AxibugProtobuf.RoomGameState), typeof(global::AxibugProtobuf.LoginResultStatus), }, null, new pbr::GeneratedClrTypeInfo[] {
@ -478,6 +479,7 @@ namespace AxibugProtobuf {
[pbr::OriginalName("IGS")] Igs = 21,
[pbr::OriginalName("CPS1")] Cps1 = 22,
[pbr::OriginalName("CPS2")] Cps2 = 23,
[pbr::OriginalName("Arcade_OLD")] ArcadeOld = 30,
[pbr::OriginalName("All")] All = 999,
}
@ -5797,12 +5799,12 @@ namespace AxibugProtobuf {
/// <summary>Field number for the "InputData" field.</summary>
public const int InputDataFieldNumber = 2;
private uint inputData_;
private ulong inputData_;
/// <summary>
///单个玩家操作位运算汇总
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public uint InputData {
public ulong InputData {
get { return inputData_; }
set {
inputData_ = value;
@ -5831,7 +5833,7 @@ namespace AxibugProtobuf {
public override int GetHashCode() {
int hash = 1;
if (FrameID != 0) hash ^= FrameID.GetHashCode();
if (InputData != 0) hash ^= InputData.GetHashCode();
if (InputData != 0UL) hash ^= InputData.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
@ -5852,9 +5854,9 @@ namespace AxibugProtobuf {
output.WriteRawTag(8);
output.WriteUInt32(FrameID);
}
if (InputData != 0) {
if (InputData != 0UL) {
output.WriteRawTag(16);
output.WriteUInt32(InputData);
output.WriteUInt64(InputData);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
@ -5869,9 +5871,9 @@ namespace AxibugProtobuf {
output.WriteRawTag(8);
output.WriteUInt32(FrameID);
}
if (InputData != 0) {
if (InputData != 0UL) {
output.WriteRawTag(16);
output.WriteUInt32(InputData);
output.WriteUInt64(InputData);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
@ -5885,8 +5887,8 @@ namespace AxibugProtobuf {
if (FrameID != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(FrameID);
}
if (InputData != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(InputData);
if (InputData != 0UL) {
size += 1 + pb::CodedOutputStream.ComputeUInt64Size(InputData);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
@ -5902,7 +5904,7 @@ namespace AxibugProtobuf {
if (other.FrameID != 0) {
FrameID = other.FrameID;
}
if (other.InputData != 0) {
if (other.InputData != 0UL) {
InputData = other.InputData;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
@ -5924,7 +5926,7 @@ namespace AxibugProtobuf {
break;
}
case 16: {
InputData = input.ReadUInt32();
InputData = input.ReadUInt64();
break;
}
}
@ -5946,7 +5948,7 @@ namespace AxibugProtobuf {
break;
}
case 16: {
InputData = input.ReadUInt32();
InputData = input.ReadUInt64();
break;
}
}

View File

@ -72,7 +72,7 @@ namespace AxibugProtobuf {
"aW5pSW5mbyJLChVQcm90b2J1Zl9TY3Jlbm5fRnJhbWUSDgoGUm9vbUlEGAEg",
"ASgFEg8KB0ZyYW1lSUQYAiABKAUSEQoJUmF3Qml0bWFwGAMgASgMIkkKI1By",
"b3RvYnVmX1Jvb21fU2luZ2xlUGxheWVySW5wdXREYXRhEg8KB0ZyYW1lSUQY",
"ASABKA0SEQoJSW5wdXREYXRhGAIgASgNIoABCidQcm90b2J1Zl9Sb29tX1N5",
"ASABKA0SEQoJSW5wdXREYXRhGAIgASgEIoABCidQcm90b2J1Zl9Sb29tX1N5",
"bl9Sb29tRnJhbWVBbGxJ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FiBnByb3RvMw=="));
"UzIQFxIOCgpBcmNhZGVfT0xEEB4SCAoDQWxsEOcHKnAKDVJvb21HYW1lU3Rh",
"dGUSEgoOTm9uZV9HYW1lU3RhdGUQABIMCghPbmx5SG9zdBABEhEKDVdhaXRS",
"YXdVcGRhdGUQAhINCglXYWl0UmVhZHkQAxIJCgVQYXVzZRAEEhAKDEluT25s",
"aW5lR2FtZRAFKk4KEUxvZ2luUmVzdWx0U3RhdHVzEiEKHUxvZ2luUmVzdWx0",
"U3RhdHVzX0Jhc2VEZWZhdWx0EAASBgoCT0sQARIOCgpBY2NvdW50RXJyEAJC",
"AkgBYgZwcm90bzM="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::AxibugProtobuf.CommandID), typeof(global::AxibugProtobuf.ErrorCode), typeof(global::AxibugProtobuf.LoginType), typeof(global::AxibugProtobuf.DeviceType), typeof(global::AxibugProtobuf.GamePadType), typeof(global::AxibugProtobuf.RomPlatformType), typeof(global::AxibugProtobuf.RoomGameState), typeof(global::AxibugProtobuf.LoginResultStatus), }, null, new pbr::GeneratedClrTypeInfo[] {
@ -478,6 +479,7 @@ namespace AxibugProtobuf {
[pbr::OriginalName("IGS")] Igs = 21,
[pbr::OriginalName("CPS1")] Cps1 = 22,
[pbr::OriginalName("CPS2")] Cps2 = 23,
[pbr::OriginalName("Arcade_OLD")] ArcadeOld = 30,
[pbr::OriginalName("All")] All = 999,
}
@ -5797,12 +5799,12 @@ namespace AxibugProtobuf {
/// <summary>Field number for the "InputData" field.</summary>
public const int InputDataFieldNumber = 2;
private uint inputData_;
private ulong inputData_;
/// <summary>
///单个玩家操作位运算汇总
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public uint InputData {
public ulong InputData {
get { return inputData_; }
set {
inputData_ = value;
@ -5831,7 +5833,7 @@ namespace AxibugProtobuf {
public override int GetHashCode() {
int hash = 1;
if (FrameID != 0) hash ^= FrameID.GetHashCode();
if (InputData != 0) hash ^= InputData.GetHashCode();
if (InputData != 0UL) hash ^= InputData.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
@ -5852,9 +5854,9 @@ namespace AxibugProtobuf {
output.WriteRawTag(8);
output.WriteUInt32(FrameID);
}
if (InputData != 0) {
if (InputData != 0UL) {
output.WriteRawTag(16);
output.WriteUInt32(InputData);
output.WriteUInt64(InputData);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
@ -5869,9 +5871,9 @@ namespace AxibugProtobuf {
output.WriteRawTag(8);
output.WriteUInt32(FrameID);
}
if (InputData != 0) {
if (InputData != 0UL) {
output.WriteRawTag(16);
output.WriteUInt32(InputData);
output.WriteUInt64(InputData);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
@ -5885,8 +5887,8 @@ namespace AxibugProtobuf {
if (FrameID != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(FrameID);
}
if (InputData != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(InputData);
if (InputData != 0UL) {
size += 1 + pb::CodedOutputStream.ComputeUInt64Size(InputData);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
@ -5902,7 +5904,7 @@ namespace AxibugProtobuf {
if (other.FrameID != 0) {
FrameID = other.FrameID;
}
if (other.InputData != 0) {
if (other.InputData != 0UL) {
InputData = other.InputData;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
@ -5924,7 +5926,7 @@ namespace AxibugProtobuf {
break;
}
case 16: {
InputData = input.ReadUInt32();
InputData = input.ReadUInt64();
break;
}
}
@ -5946,7 +5948,7 @@ namespace AxibugProtobuf {
break;
}
case 16: {
InputData = input.ReadUInt32();
InputData = input.ReadUInt64();
break;
}
}

View File

@ -147,7 +147,7 @@ enum RomPlatformType
IGS = 21;
CPS1 = 22;
CPS2 = 23;
Arcade_OLD = 30
Arcade_OLD = 30;
All = 999;
}
@ -342,7 +342,7 @@ message Protobuf_Screnn_Frame
message Protobuf_Room_SinglePlayerInputData
{
uint32 FrameID = 1;//
uint32 InputData = 2;//
uint64 InputData = 2;//
}
message Protobuf_Room_Syn_RoomFrameAllInputData