Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YGOPRO-520DIY
ygopro
Commits
98edda72
Commit
98edda72
authored
Jun 08, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refa to CTOS_EXTERNAL_ADDRESS
parent
7e584bb9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
13 deletions
+23
-13
gframe/duelclient.cpp
gframe/duelclient.cpp
+7
-3
gframe/netserver.cpp
gframe/netserver.cpp
+7
-2
gframe/network.h
gframe/network.h
+9
-8
No files found.
gframe/duelclient.cpp
View file @
98edda72
...
@@ -118,9 +118,13 @@ void DuelClient::ClientEvent(bufferevent* bev, short events, void* ctx) {
...
@@ -118,9 +118,13 @@ void DuelClient::ClientEvent(bufferevent* bev, short events, void* ctx) {
if
(
events
&
BEV_EVENT_CONNECTED
)
{
if
(
events
&
BEV_EVENT_CONNECTED
)
{
bool
create_game
=
(
intptr_t
)
ctx
;
bool
create_game
=
(
intptr_t
)
ctx
;
if
(
!
create_game
)
{
if
(
!
create_game
)
{
uint16_t
msgbuf
[
LEN_HOSTNAME
];
uint16_t
hostname_buf
[
LEN_HOSTNAME
];
int
len
=
BufferIO
::
CopyCharArray
(
mainGame
->
ebJoinHost
->
getText
(),
msgbuf
);
auto
hostname_len
=
BufferIO
::
CopyCharArray
(
mainGame
->
ebJoinHost
->
getText
(),
hostname_buf
);
DuelClient
::
SendBufferToServer
(
CTOS_HOSTNAME
,
msgbuf
,
(
len
+
1
)
*
sizeof
(
uint16_t
));
auto
hostname_msglen
=
(
hostname_len
+
1
)
*
sizeof
(
uint16_t
);
char
buf
[
LEN_HOSTNAME
*
sizeof
(
int16_t
)
+
sizeof
(
uint32_t
)];
memset
(
buf
,
0
,
sizeof
(
uint32_t
));
memcpy
(
buf
+
sizeof
(
uint32_t
),
hostname_buf
,
hostname_msglen
);
DuelClient
::
SendBufferToServer
(
CTOS_EXTERNAL_ADDRESS
,
buf
,
hostname_msglen
+
sizeof
(
uint32_t
));
}
}
CTOS_PlayerInfo
cspi
;
CTOS_PlayerInfo
cspi
;
BufferIO
::
CopyCharArray
(
mainGame
->
ebNickName
->
getText
(),
cspi
.
name
);
BufferIO
::
CopyCharArray
(
mainGame
->
ebNickName
->
getText
(),
cspi
.
name
);
...
...
gframe/netserver.cpp
View file @
98edda72
...
@@ -253,8 +253,13 @@ void NetServer::HandleCTOSPacket(DuelPlayer* dp, unsigned char* data, int len) {
...
@@ -253,8 +253,13 @@ void NetServer::HandleCTOSPacket(DuelPlayer* dp, unsigned char* data, int len) {
BufferIO
::
CopyCharArray
(
pkt
->
name
,
dp
->
name
);
BufferIO
::
CopyCharArray
(
pkt
->
name
,
dp
->
name
);
break
;
break
;
}
}
case
CTOS_HOSTNAME
:
{
case
CTOS_EXTERNAL_ADDRESS
:
{
// for other server impl use only
// for other server & reverse proxy use only
/*
wchar_t hostname[LEN_HOSTNAME];
uint32_t real_ip = BufferIO::ReadInt32(pdata);
BufferIO::CopyCharArray((uint16_t*)pdata, hostname);
*/
break
;
break
;
}
}
case
CTOS_CREATE_GAME
:
{
case
CTOS_CREATE_GAME
:
{
...
...
gframe/network.h
View file @
98edda72
...
@@ -103,6 +103,14 @@ struct CTOS_Kick {
...
@@ -103,6 +103,14 @@ struct CTOS_Kick {
check_trivially_copyable
(
CTOS_Kick
);
check_trivially_copyable
(
CTOS_Kick
);
static_assert
(
sizeof
(
CTOS_Kick
)
==
1
,
"size mismatch: CTOS_Kick"
);
static_assert
(
sizeof
(
CTOS_Kick
)
==
1
,
"size mismatch: CTOS_Kick"
);
/*
* CTOS_ExternalAddress
* uint32_t real_ip; (IPv4 address)
* uint16_t hostname[256]; (UTF-16 string)
*/
constexpr
int
LEN_HOSTNAME
=
256
;
// STOC
// STOC
struct
STOC_ErrorMsg
{
struct
STOC_ErrorMsg
{
uint8_t
msg
{};
uint8_t
msg
{};
...
@@ -164,13 +172,6 @@ constexpr int LEN_CHAT_PLAYER = 1;
...
@@ -164,13 +172,6 @@ constexpr int LEN_CHAT_PLAYER = 1;
constexpr
int
LEN_CHAT_MSG
=
256
;
constexpr
int
LEN_CHAT_MSG
=
256
;
constexpr
int
SIZE_STOC_CHAT
=
(
LEN_CHAT_PLAYER
+
LEN_CHAT_MSG
)
*
sizeof
(
uint16_t
);
constexpr
int
SIZE_STOC_CHAT
=
(
LEN_CHAT_PLAYER
+
LEN_CHAT_MSG
)
*
sizeof
(
uint16_t
);
/*
* STOC_HOSTNAME
* uint16_t hostname[256]; (UTF-16 string)
*/
constexpr
int
LEN_HOSTNAME
=
256
;
struct
STOC_HS_PlayerEnter
{
struct
STOC_HS_PlayerEnter
{
uint16_t
name
[
20
]{};
uint16_t
name
[
20
]{};
uint8_t
pos
{};
uint8_t
pos
{};
...
@@ -276,7 +277,7 @@ public:
...
@@ -276,7 +277,7 @@ public:
#define CTOS_SURRENDER 0x14 // no data
#define CTOS_SURRENDER 0x14 // no data
#define CTOS_TIME_CONFIRM 0x15 // no data
#define CTOS_TIME_CONFIRM 0x15 // no data
#define CTOS_CHAT 0x16 // uint16_t array
#define CTOS_CHAT 0x16 // uint16_t array
#define CTOS_
HOSTNAME 0x17 // uint16_t array
#define CTOS_
EXTERNAL_ADDRESS 0x17 // CTOS_ExternalAddress
#define CTOS_HS_TODUELIST 0x20 // no data
#define CTOS_HS_TODUELIST 0x20 // no data
#define CTOS_HS_TOOBSERVER 0x21 // no data
#define CTOS_HS_TOOBSERVER 0x21 // no data
#define CTOS_HS_READY 0x22 // no data
#define CTOS_HS_READY 0x22 // no data
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment