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
fcbcbc2c
Commit
fcbcbc2c
authored
Jun 13, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove port field
parent
bc999cbb
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
41 deletions
+19
-41
gframe/duelclient.cpp
gframe/duelclient.cpp
+4
-11
gframe/duelclient.h
gframe/duelclient.h
+1
-1
gframe/game.cpp
gframe/game.cpp
+6
-8
gframe/game.h
gframe/game.h
+1
-2
gframe/gframe.cpp
gframe/gframe.cpp
+5
-10
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+2
-9
No files found.
gframe/duelclient.cpp
View file @
fcbcbc2c
...
@@ -4470,7 +4470,9 @@ bool DuelClient::LookupSRV(char *hostname, HostResult* result) {
...
@@ -4470,7 +4470,9 @@ bool DuelClient::LookupSRV(char *hostname, HostResult* result) {
auto
record
=
RetrivedSRVRecord
(
nsMsg
,
i
);
auto
record
=
RetrivedSRVRecord
(
nsMsg
,
i
);
if
(
!
record
.
valid
||
record
.
priority
>
minPriority
)
if
(
!
record
.
valid
||
record
.
priority
>
minPriority
)
continue
;
continue
;
for
(
int
j
=
0
;
j
<
record
.
weight
;
++
j
)
{
if
(
!
record
.
weight
)
record
.
weight
=
1
;
for
(
int
j
=
0
;
j
<
record
.
weight
;
++
j
)
{
if
(
record
.
priority
<
minPriority
)
{
if
(
record
.
priority
<
minPriority
)
{
records
.
clear
();
records
.
clear
();
minPriority
=
record
.
priority
;
minPriority
=
record
.
priority
;
...
@@ -4503,17 +4505,8 @@ bool DuelClient::CheckHostnameSplitter(char* hostname, HostResult* result) {
...
@@ -4503,17 +4505,8 @@ bool DuelClient::CheckHostnameSplitter(char* hostname, HostResult* result) {
return
true
;
return
true
;
}
}
HostResult
DuelClient
::
ParseHost
(
char
*
hostname
,
unsigned
short
port
)
{
HostResult
DuelClient
::
ParseHost
(
char
*
hostname
)
{
HostResult
result
;
HostResult
result
;
// if port found, use port directly
if
(
port
)
{
// if hostname contains splitter, use port after splitter in priority
if
(
!
CheckHostnameSplitter
(
hostname
,
&
result
))
{
result
.
host
=
LookupHost
(
hostname
);
result
.
port
=
port
;
}
return
result
;
}
// if hostname is an IP, use it directly and use default port
// if hostname is an IP, use it directly and use default port
unsigned
int
tryAddress
=
htonl
(
inet_addr
(
hostname
));
unsigned
int
tryAddress
=
htonl
(
inet_addr
(
hostname
));
...
...
gframe/duelclient.h
View file @
fcbcbc2c
...
@@ -93,7 +93,7 @@ public:
...
@@ -93,7 +93,7 @@ public:
static
unsigned
int
LookupHost
(
char
*
host
);
static
unsigned
int
LookupHost
(
char
*
host
);
static
bool
LookupSRV
(
char
*
hostname
,
HostResult
*
result
);
static
bool
LookupSRV
(
char
*
hostname
,
HostResult
*
result
);
static
bool
CheckHostnameSplitter
(
char
*
hostname
,
HostResult
*
result
);
static
bool
CheckHostnameSplitter
(
char
*
hostname
,
HostResult
*
result
);
static
HostResult
ParseHost
(
char
*
hostname
,
unsigned
short
port
);
static
HostResult
ParseHost
(
char
*
hostname
);
static
void
SendPacketToServer
(
unsigned
char
proto
)
{
static
void
SendPacketToServer
(
unsigned
char
proto
)
{
auto
p
=
duel_client_write
;
auto
p
=
duel_client_write
;
buffer_write
<
uint16_t
>
(
p
,
1
);
buffer_write
<
uint16_t
>
(
p
,
1
);
...
...
gframe/game.cpp
View file @
fcbcbc2c
...
@@ -238,12 +238,9 @@ bool Game::Initialize() {
...
@@ -238,12 +238,9 @@ bool Game::Initialize() {
lstHostList
->
setItemHeight
(
18
);
lstHostList
->
setItemHeight
(
18
);
btnLanRefresh
=
env
->
addButton
(
irr
::
core
::
rect
<
irr
::
s32
>
(
240
,
325
,
340
,
350
),
wLanWindow
,
BUTTON_LAN_REFRESH
,
dataManager
.
GetSysString
(
1217
));
btnLanRefresh
=
env
->
addButton
(
irr
::
core
::
rect
<
irr
::
s32
>
(
240
,
325
,
340
,
350
),
wLanWindow
,
BUTTON_LAN_REFRESH
,
dataManager
.
GetSysString
(
1217
));
env
->
addStaticText
(
dataManager
.
GetSysString
(
1221
),
irr
::
core
::
rect
<
irr
::
s32
>
(
10
,
360
,
220
,
380
),
false
,
false
,
wLanWindow
);
env
->
addStaticText
(
dataManager
.
GetSysString
(
1221
),
irr
::
core
::
rect
<
irr
::
s32
>
(
10
,
360
,
220
,
380
),
false
,
false
,
wLanWindow
);
ebJoinHost
=
env
->
addEditBox
(
gameConf
.
lasthost
,
irr
::
core
::
rect
<
irr
::
s32
>
(
110
,
355
,
35
0
,
380
),
true
,
wLanWindow
);
ebJoinHost
=
env
->
addEditBox
(
gameConf
.
lasthost
,
irr
::
core
::
rect
<
irr
::
s32
>
(
110
,
355
,
42
0
,
380
),
true
,
wLanWindow
);
ebJoinHost
->
setTextAlignment
(
irr
::
gui
::
EGUIA_CENTER
,
irr
::
gui
::
EGUIA_CENTER
);
ebJoinHost
->
setTextAlignment
(
irr
::
gui
::
EGUIA_CENTER
,
irr
::
gui
::
EGUIA_CENTER
);
editbox_list
.
push_back
(
ebJoinHost
);
editbox_list
.
push_back
(
ebJoinHost
);
ebJoinPort
=
env
->
addEditBox
(
gameConf
.
lastport
,
irr
::
core
::
rect
<
irr
::
s32
>
(
360
,
355
,
420
,
380
),
true
,
wLanWindow
);
ebJoinPort
->
setTextAlignment
(
irr
::
gui
::
EGUIA_CENTER
,
irr
::
gui
::
EGUIA_CENTER
);
editbox_list
.
push_back
(
ebJoinPort
);
env
->
addStaticText
(
dataManager
.
GetSysString
(
1222
),
irr
::
core
::
rect
<
irr
::
s32
>
(
10
,
390
,
220
,
410
),
false
,
false
,
wLanWindow
);
env
->
addStaticText
(
dataManager
.
GetSysString
(
1222
),
irr
::
core
::
rect
<
irr
::
s32
>
(
10
,
390
,
220
,
410
),
false
,
false
,
wLanWindow
);
ebJoinPass
=
env
->
addEditBox
(
gameConf
.
roompass
,
irr
::
core
::
rect
<
irr
::
s32
>
(
110
,
385
,
420
,
410
),
true
,
wLanWindow
);
ebJoinPass
=
env
->
addEditBox
(
gameConf
.
roompass
,
irr
::
core
::
rect
<
irr
::
s32
>
(
110
,
385
,
420
,
410
),
true
,
wLanWindow
);
ebJoinPass
->
setTextAlignment
(
irr
::
gui
::
EGUIA_CENTER
,
irr
::
gui
::
EGUIA_CENTER
);
ebJoinPass
->
setTextAlignment
(
irr
::
gui
::
EGUIA_CENTER
,
irr
::
gui
::
EGUIA_CENTER
);
...
@@ -1470,7 +1467,11 @@ bool Game::LoadConfigFromFile(const char* file) {
...
@@ -1470,7 +1467,11 @@ bool Game::LoadConfigFromFile(const char* file) {
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"lasthost"
))
{
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"lasthost"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
gameConf
.
lasthost
);
BufferIO
::
DecodeUTF8
(
valbuf
,
gameConf
.
lasthost
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"lastport"
))
{
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"lastport"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
gameConf
.
lastport
);
// for migration
auto
old_lastport
=
std
::
strtol
(
valbuf
,
nullptr
,
10
);
wchar_t
old_host
[
100
];
memcpy
(
old_host
,
gameConf
.
lasthost
,
sizeof
(
wchar_t
)
*
100
);
myswprintf
(
gameConf
.
lasthost
,
L"%ls:%d"
,
old_host
,
old_lastport
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"automonsterpos"
))
{
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"automonsterpos"
))
{
gameConf
.
chkMAutoPos
=
std
::
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
chkMAutoPos
=
std
::
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"autospellpos"
))
{
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"autospellpos"
))
{
...
@@ -1611,7 +1612,6 @@ void Game::LoadConfig() {
...
@@ -1611,7 +1612,6 @@ void Game::LoadConfig() {
gameConf
.
numfont
[
0
]
=
0
;
gameConf
.
numfont
[
0
]
=
0
;
gameConf
.
textfont
[
0
]
=
0
;
gameConf
.
textfont
[
0
]
=
0
;
gameConf
.
lasthost
[
0
]
=
0
;
gameConf
.
lasthost
[
0
]
=
0
;
gameConf
.
lastport
[
0
]
=
0
;
gameConf
.
roompass
[
0
]
=
0
;
gameConf
.
roompass
[
0
]
=
0
;
//settings
//settings
gameConf
.
chkMAutoPos
=
0
;
gameConf
.
chkMAutoPos
=
0
;
...
@@ -1747,8 +1747,6 @@ void Game::SaveConfig() {
...
@@ -1747,8 +1747,6 @@ void Game::SaveConfig() {
std
::
fprintf
(
fp
,
"serverport = %d
\n
"
,
gameConf
.
serverport
);
std
::
fprintf
(
fp
,
"serverport = %d
\n
"
,
gameConf
.
serverport
);
BufferIO
::
EncodeUTF8
(
gameConf
.
lasthost
,
linebuf
);
BufferIO
::
EncodeUTF8
(
gameConf
.
lasthost
,
linebuf
);
std
::
fprintf
(
fp
,
"lasthost = %s
\n
"
,
linebuf
);
std
::
fprintf
(
fp
,
"lasthost = %s
\n
"
,
linebuf
);
BufferIO
::
EncodeUTF8
(
gameConf
.
lastport
,
linebuf
);
std
::
fprintf
(
fp
,
"lastport = %s
\n
"
,
linebuf
);
BufferIO
::
EncodeUTF8
(
gameConf
.
roompass
,
linebuf
);
BufferIO
::
EncodeUTF8
(
gameConf
.
roompass
,
linebuf
);
std
::
fprintf
(
fp
,
"roompass = %s
\n
"
,
linebuf
);
std
::
fprintf
(
fp
,
"roompass = %s
\n
"
,
linebuf
);
//settings
//settings
...
...
gframe/game.h
View file @
fcbcbc2c
...
@@ -56,7 +56,7 @@ struct Config {
...
@@ -56,7 +56,7 @@ struct Config {
unsigned
short
serverport
{
7911
};
unsigned
short
serverport
{
7911
};
unsigned
char
textfontsize
{
14
};
unsigned
char
textfontsize
{
14
};
wchar_t
lasthost
[
100
]{};
wchar_t
lasthost
[
100
]{};
wchar_t
lastport
[
10
]{};
//
wchar_t lastport[10]{};
wchar_t
nickname
[
20
]{};
wchar_t
nickname
[
20
]{};
wchar_t
gamename
[
20
]{};
wchar_t
gamename
[
20
]{};
wchar_t
roompass
[
20
]{};
wchar_t
roompass
[
20
]{};
...
@@ -411,7 +411,6 @@ public:
...
@@ -411,7 +411,6 @@ public:
irr
::
gui
::
IGUIListBox
*
lstHostList
;
irr
::
gui
::
IGUIListBox
*
lstHostList
;
irr
::
gui
::
IGUIButton
*
btnLanRefresh
;
irr
::
gui
::
IGUIButton
*
btnLanRefresh
;
irr
::
gui
::
IGUIEditBox
*
ebJoinHost
;
irr
::
gui
::
IGUIEditBox
*
ebJoinHost
;
irr
::
gui
::
IGUIEditBox
*
ebJoinPort
;
irr
::
gui
::
IGUIEditBox
*
ebJoinPass
;
irr
::
gui
::
IGUIEditBox
*
ebJoinPass
;
irr
::
gui
::
IGUIButton
*
btnJoinHost
;
irr
::
gui
::
IGUIButton
*
btnJoinHost
;
irr
::
gui
::
IGUIButton
*
btnJoinCancel
;
irr
::
gui
::
IGUIButton
*
btnJoinCancel
;
...
...
gframe/gframe.cpp
View file @
fcbcbc2c
...
@@ -87,7 +87,6 @@ int main(int argc, char* argv[]) {
...
@@ -87,7 +87,6 @@ int main(int argc, char* argv[]) {
bool
keep_on_return
=
false
;
bool
keep_on_return
=
false
;
bool
deckCategorySpecified
=
false
;
bool
deckCategorySpecified
=
false
;
bool
portSpecified
=
false
;
for
(
int
i
=
1
;
i
<
wargc
;
++
i
)
{
for
(
int
i
=
1
;
i
<
wargc
;
++
i
)
{
if
(
wargc
==
2
&&
std
::
wcslen
(
wargv
[
1
])
>=
4
)
{
if
(
wargc
==
2
&&
std
::
wcslen
(
wargv
[
1
])
>=
4
)
{
wchar_t
*
pstrext
=
wargv
[
1
]
+
std
::
wcslen
(
wargv
[
1
])
-
4
;
wchar_t
*
pstrext
=
wargv
[
1
]
+
std
::
wcslen
(
wargv
[
1
])
-
4
;
...
@@ -126,21 +125,17 @@ int main(int argc, char* argv[]) {
...
@@ -126,21 +125,17 @@ int main(int argc, char* argv[]) {
++
i
;
++
i
;
if
(
i
<
wargc
)
{
if
(
i
<
wargc
)
{
ygo
::
mainGame
->
ebJoinHost
->
setText
(
wargv
[
i
]);
ygo
::
mainGame
->
ebJoinHost
->
setText
(
wargv
[
i
]);
if
(
!
portSpecified
)
ygo
::
mainGame
->
ebJoinPort
->
setText
(
L""
);
}
}
continue
;
continue
;
}
else
if
(
!
std
::
wcscmp
(
wargv
[
i
],
L"-p"
))
{
// host Port
}
else
if
(
!
std
::
wcscmp
(
wargv
[
i
],
L"-p"
))
{
// host Port
++
i
;
++
i
;
if
(
i
<
wargc
)
{
if
(
i
<
wargc
)
{
portSpecified
=
true
;
auto
port
=
_wtoi
(
wargv
[
i
]);
auto
port
=
_wtoi
(
wargv
[
i
]);
if
(
port
)
{
auto
hostText
=
ygo
::
mainGame
->
ebJoinHost
->
getText
();
wchar_t
portStr
[
6
];
if
(
port
&&
hostText
)
{
myswprintf
(
portStr
,
L"%d"
,
port
);
wchar_t
newHostStr
[
100
];
ygo
::
mainGame
->
ebJoinPort
->
setText
(
portStr
);
myswprintf
(
newHostStr
,
L"%ls:%d"
,
hostText
,
port
);
}
else
{
ygo
::
mainGame
->
ebJoinHost
->
setText
(
newHostStr
);
ygo
::
mainGame
->
ebJoinPort
->
setText
(
L""
);
}
}
}
}
continue
;
continue
;
...
...
gframe/menu_handler.cpp
View file @
fcbcbc2c
...
@@ -64,15 +64,11 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -64,15 +64,11 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
case
BUTTON_JOIN_HOST
:
{
case
BUTTON_JOIN_HOST
:
{
bot_mode
=
false
;
bot_mode
=
false
;
mainGame
->
TrimText
(
mainGame
->
ebJoinHost
);
mainGame
->
TrimText
(
mainGame
->
ebJoinHost
);
mainGame
->
TrimText
(
mainGame
->
ebJoinPort
);
char
hostname_tag
[
100
];
char
hostname_tag
[
100
];
wchar_t
pstr
[
100
];
wchar_t
pstr
[
100
];
wchar_t
portstr
[
10
];
BufferIO
::
CopyWideString
(
mainGame
->
ebJoinHost
->
getText
(),
pstr
);
BufferIO
::
CopyWideString
(
mainGame
->
ebJoinHost
->
getText
(),
pstr
);
BufferIO
::
CopyWideString
(
mainGame
->
ebJoinPort
->
getText
(),
portstr
);
BufferIO
::
EncodeUTF8
(
pstr
,
hostname_tag
);
BufferIO
::
EncodeUTF8
(
pstr
,
hostname_tag
);
auto
port
=
std
::
wcstol
(
portstr
,
nullptr
,
10
);
HostResult
remote
=
DuelClient
::
ParseHost
(
hostname_tag
);
HostResult
remote
=
DuelClient
::
ParseHost
(
hostname_tag
,
port
);
if
(
!
remote
.
isValid
())
{
if
(
!
remote
.
isValid
())
{
mainGame
->
gMutex
.
lock
();
mainGame
->
gMutex
.
lock
();
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
...
@@ -85,7 +81,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -85,7 +81,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
break
;
}
}
BufferIO
::
CopyWideString
(
pstr
,
mainGame
->
gameConf
.
lasthost
);
BufferIO
::
CopyWideString
(
pstr
,
mainGame
->
gameConf
.
lasthost
);
BufferIO
::
CopyWideString
(
portstr
,
mainGame
->
gameConf
.
lastport
);
BufferIO
::
CopyWideString
(
mainGame
->
ebJoinPass
->
getText
(),
mainGame
->
gameConf
.
roompass
);
BufferIO
::
CopyWideString
(
mainGame
->
ebJoinPass
->
getText
(),
mainGame
->
gameConf
.
roompass
);
if
(
DuelClient
::
StartClient
(
remote
.
host
,
remote
.
port
,
false
))
{
if
(
DuelClient
::
StartClient
(
remote
.
host
,
remote
.
port
,
false
))
{
mainGame
->
btnCreateHost
->
setEnabled
(
false
);
mainGame
->
btnCreateHost
->
setEnabled
(
false
);
...
@@ -505,10 +500,8 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -505,10 +500,8 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
int
addr
=
DuelClient
::
hosts
[
sel
].
ipaddr
;
int
addr
=
DuelClient
::
hosts
[
sel
].
ipaddr
;
int
port
=
DuelClient
::
hosts
[
sel
].
port
;
int
port
=
DuelClient
::
hosts
[
sel
].
port
;
wchar_t
buf
[
20
];
wchar_t
buf
[
20
];
myswprintf
(
buf
,
L"%d.%d.%d.%d
"
,
addr
&
0xff
,
(
addr
>>
8
)
&
0xff
,
(
addr
>>
16
)
&
0xff
,
(
addr
>>
24
)
&
0xff
);
myswprintf
(
buf
,
L"%d.%d.%d.%d
:%d"
,
addr
&
0xff
,
(
addr
>>
8
)
&
0xff
,
(
addr
>>
16
)
&
0xff
,
(
addr
>>
24
)
&
0xff
,
port
);
mainGame
->
ebJoinHost
->
setText
(
buf
);
mainGame
->
ebJoinHost
->
setText
(
buf
);
myswprintf
(
buf
,
L"%d"
,
port
);
mainGame
->
ebJoinPort
->
setText
(
buf
);
break
;
break
;
}
}
case
LISTBOX_REPLAY_LIST
:
{
case
LISTBOX_REPLAY_LIST
:
{
...
...
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