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
nanahira
ygopro
Commits
632dd98c
Commit
632dd98c
authored
Jun 29, 2025
by
nanahira
Committed by
GitHub
Jun 29, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add CTOS_EXTERNAL_ADDRESS (#2832)
parent
e7ebb75f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
0 deletions
+27
-0
gframe/duelclient.cpp
gframe/duelclient.cpp
+9
-0
gframe/netserver.cpp
gframe/netserver.cpp
+9
-0
gframe/network.h
gframe/network.h
+9
-0
No files found.
gframe/duelclient.cpp
View file @
632dd98c
...
@@ -118,6 +118,15 @@ void DuelClient::ClientRead(bufferevent* bev, void* ctx) {
...
@@ -118,6 +118,15 @@ void DuelClient::ClientRead(bufferevent* bev, void* ctx) {
void DuelClient::ClientEvent(bufferevent* bev, short events, void* ctx) {
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) {
uint16_t hostname_buf[LEN_HOSTNAME];
auto hostname_len = BufferIO::CopyCharArray(mainGame->ebJoinHost->getText(), hostname_buf);
auto hostname_msglen = (hostname_len + 1) * sizeof(uint16_t);
char buf[LEN_HOSTNAME * sizeof(uint16_t) + sizeof(uint32_t)];
memset(buf, 0, sizeof(uint32_t)); // real_ip
memcpy(buf + sizeof(uint32_t), hostname_buf, hostname_msglen);
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);
SendPacketToServer(CTOS_PLAYER_INFO, cspi);
SendPacketToServer(CTOS_PLAYER_INFO, cspi);
...
...
gframe/netserver.cpp
View file @
632dd98c
...
@@ -257,6 +257,15 @@ void NetServer::HandleCTOSPacket(DuelPlayer* dp, unsigned char* data, int len) {
...
@@ -257,6 +257,15 @@ 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_EXTERNAL_ADDRESS
:
{
// for other server & reverse proxy use only
/*
wchar_t hostname[LEN_HOSTNAME];
uint32_t real_ip = ntohl(BufferIO::ReadInt32(pdata));
BufferIO::CopyCharArray((uint16_t*)pdata, hostname);
*/
break
;
}
case
CTOS_CREATE_GAME
:
{
case
CTOS_CREATE_GAME
:
{
if
(
dp
->
game
||
duel_mode
)
if
(
dp
->
game
||
duel_mode
)
return
;
return
;
...
...
gframe/network.h
View file @
632dd98c
...
@@ -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, BE, alway 0 in normal client)
* 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
{};
...
@@ -258,6 +266,7 @@ public:
...
@@ -258,6 +266,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_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