MapId parsed as BYTE instead of ShortLittleEndian
Description:
The client struct PRECEIVE_JOIN_MAP_SERVER_EXTENDED defines the map
field as BYTE Map (1 byte) at offset 6, with BYTE Angle at offset 7.
However, the OpenMU server sends MapId as ShortLittleEndian (2 bytes,
ushort) at indices 6-7 in the CharacterInformationExtended packet.
Server packet layout (indices 6-7):
ShortLittleEndian MapId (2 bytes, supports maps 0-65535)
Client struct layout (offsets 6-7):
BYTE Map (1 byte) — reads low byte of MapId only
BYTE Angle (1 byte) — reads high byte of MapId, treats it as angle
Impact:
- For maps with ID < 256 (all currently defined maps, 0-81):
High byte is always 0 -> Map reads correctly, Angle reads 0
(no visible bug, angle defaults to no rotation)
- For maps with ID >= 256:
Map would read wrong value (only low byte)
Angle would read garbage (high byte of MapId)
Character would spawn at wrong angle
Data->Angle is used in 3 places in ReceiveJoinMapServer
(WSclient.cpp:988, 2034, 3407) to set character rotation:
((float)Data->Angle - 1.f) * 45.f
Server code populating this field:
UpdateCharacterStatsExtendedPlugIn.cs:45
this._player.SelectedCharacter!.CurrentMap!.Number.ToUnsigned()
-> confirmed to be the numeric map ID
Fix:
In WSclient.h, change:
BYTE Map;
BYTE Angle;
To:
WORD MapId;
In WSclient.cpp, replace all 3 Data->Angle usages in
ReceiveJoinMapServer with a default angle (0).
Current status: Not fixed. Not triggered (all maps are 0-81).
Future risk: Custom maps or newer seasons may add maps >= 256.
Files:
- Client: src/source/Network/Server/WSclient.h (struct definition)
- Client: src/source/Network/Server/WSclient.cpp (Angle usage)
- Server: src/Network/Packets/ServerToClient/ServerToClientPackets.xml
(CharacterInformationExtended, indices 6-7)
- Server: src/GameServer/RemoteView/Character/
UpdateCharacterStatsExtendedPlugIn.cs (populates MapId)
MapId parsed as BYTE instead of ShortLittleEndian
Description:
The client struct PRECEIVE_JOIN_MAP_SERVER_EXTENDED defines the map
field as BYTE Map (1 byte) at offset 6, with BYTE Angle at offset 7.
However, the OpenMU server sends MapId as ShortLittleEndian (2 bytes,
ushort) at indices 6-7 in the CharacterInformationExtended packet.
Server packet layout (indices 6-7):
ShortLittleEndian MapId (2 bytes, supports maps 0-65535)
Client struct layout (offsets 6-7):
BYTE Map (1 byte) — reads low byte of MapId only
BYTE Angle (1 byte) — reads high byte of MapId, treats it as angle
Impact:
High byte is always 0 -> Map reads correctly, Angle reads 0
(no visible bug, angle defaults to no rotation)
Map would read wrong value (only low byte)
Angle would read garbage (high byte of MapId)
Character would spawn at wrong angle
Data->Angle is used in 3 places in ReceiveJoinMapServer
(WSclient.cpp:988, 2034, 3407) to set character rotation:
((float)Data->Angle - 1.f) * 45.f
Server code populating this field:
UpdateCharacterStatsExtendedPlugIn.cs:45
this._player.SelectedCharacter!.CurrentMap!.Number.ToUnsigned()
-> confirmed to be the numeric map ID
Fix:
In WSclient.h, change:
BYTE Map;
BYTE Angle;
To:
WORD MapId;
In WSclient.cpp, replace all 3 Data->Angle usages in
ReceiveJoinMapServer with a default angle (0).
Current status: Not fixed. Not triggered (all maps are 0-81).
Future risk: Custom maps or newer seasons may add maps >= 256.
Files:
(CharacterInformationExtended, indices 6-7)
UpdateCharacterStatsExtendedPlugIn.cs (populates MapId)