Skip to content

Commit

Permalink
Merge pull request #11 from Duckos-Mods/StructFixing
Browse files Browse the repository at this point in the history
feat: add more struct info
  • Loading branch information
wu-vincent authored May 24, 2024
2 parents 236a462 + 48abed5 commit d974784
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 12 deletions.
4 changes: 2 additions & 2 deletions include/bedrock/command/command_origin_identity.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
#include <string>

struct CommandOriginIdentity {
std::string unknown1;
std::string unknown2;
std::string mXuid;
std::string mPlatformOnlineId;
};
2 changes: 1 addition & 1 deletion include/bedrock/hashed_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ class HashedString {
public:
std::uint64_t hash;
std::string str;
void *unknown;
const HashedString* mLastMatch;
};
19 changes: 19 additions & 0 deletions include/bedrock/network/compressibility.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) 2024, The Endstone Project. (https://endstone.dev) All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once

enum class Compressibility {
Compressible = 0x0,
Incompressible = 0x1,
};
28 changes: 28 additions & 0 deletions include/bedrock/network/network_peer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright (c) 2024, The Endstone Project. (https://endstone.dev) All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <chrono>

// Only defined as a class to make sure that name mangling happens the same
class NetworkPeer {
public:
enum class Reliability {
Reliable = 0x0,
ReliableOrdered = 0x1,
Unreliable = 0x2,
UnreliableSequenced = 0x3,
};

using PacketRecvTimepoint = std::chrono::steady_clock::time_point;
};
23 changes: 23 additions & 0 deletions include/bedrock/network/packet_priority.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) 2024, The Endstone Project. (https://endstone.dev) All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once


enum class PacketPriority {
IMMEDIATE_PRIORITY = 0x0,
HIGH_PRIORITY = 0x1,
MEDIUM_PRIORITY = 0x2,
LOW_PRIORITY = 0x3,
NUMBER_OF_PRIORITIES = 0x4,
};
18 changes: 11 additions & 7 deletions include/bedrock/network/protocol/packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,21 @@
// limitations under the License.

#pragma once

#include "bedrock/network/packet_priority.h"
#include "bedrock/network/network_peer.h"
#include "bedrock/network/protocol/sub_client_id.h"
#include "bedrock/network/compressibility.h"
class Packet {
public:
virtual ~Packet() = default;

private:
int unknown1_{2}; // +8
int unknown2_{1}; // +12
int unknown3_{0}; // +16
std::int64_t unknown4_{0}; // +24
std::int64_t unknown5_{0}; // +32
int unknown6_{0}; // +40
PacketPriority mPriority; // + 8
NetworkPeer::Reliability mReliability; // + 12
SubClientId mSubClientId; // + 16
bool mIsHandled; // + 17
NetworkPeer::PacketRecvTimepoint mReceiveTimepoint; // + 24
void* mHandler; // + 32
Compressibility mCompressible; // + 40
};
BEDROCK_STATIC_ASSERT_SIZE(Packet, 48, 48);
6 changes: 4 additions & 2 deletions include/bedrock/social.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@ class MultiplayerServiceObserver {
virtual ~MultiplayerServiceObserver() = 0;

private:
void *unknown_;
void *mpSubject;
// Real type of this is Core::Observer<Social::MultiplayerServiceObserver,Core::SingleThreadedLock>::SubjectType
};

class XboxLiveUserObserver {
public:
virtual ~XboxLiveUserObserver() = 0;

private:
void *unknown_;
void *mpSubject;
// Real type of this is Core::Observer<Social::XboxLiveUserObserver,Core::SingleThreadedLock>::SubjectType ;
};

} // namespace Social

0 comments on commit d974784

Please sign in to comment.