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
MobiusMei
ygopro
Commits
81ab1943
Commit
81ab1943
authored
Sep 24, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revert port box
parent
61422aa7
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
92 additions
and
71 deletions
+92
-71
gframe/duelclient.cpp
gframe/duelclient.cpp
+6
-1
gframe/duelclient.h
gframe/duelclient.h
+1
-1
gframe/game.cpp
gframe/game.cpp
+8
-6
gframe/game.h
gframe/game.h
+2
-0
gframe/gframe.cpp
gframe/gframe.cpp
+14
-7
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+7
-3
system.conf
system.conf
+54
-53
No files found.
gframe/duelclient.cpp
View file @
81ab1943
...
@@ -4147,8 +4147,13 @@ bool DuelClient::LookupSRV(char *hostname, HostResult* result) {
...
@@ -4147,8 +4147,13 @@ bool DuelClient::LookupSRV(char *hostname, HostResult* result) {
return
true
;
return
true
;
}
}
HostResult
DuelClient
::
ParseHost
(
char
*
hostname
)
{
HostResult
DuelClient
::
ParseHost
(
char
*
hostname
,
unsigned
short
port
)
{
HostResult
result
;
HostResult
result
;
if
(
port
)
{
result
.
host
=
LookupHost
(
hostname
);
result
.
port
=
port
;
return
result
;
}
unsigned
int
tryAddress
=
htonl
(
inet_addr
(
hostname
));
unsigned
int
tryAddress
=
htonl
(
inet_addr
(
hostname
));
if
(
tryAddress
!=
-
1
)
{
if
(
tryAddress
!=
-
1
)
{
result
.
host
=
tryAddress
;
result
.
host
=
tryAddress
;
...
...
gframe/duelclient.h
View file @
81ab1943
...
@@ -92,7 +92,7 @@ public:
...
@@ -92,7 +92,7 @@ public:
static
void
SendResponse
();
static
void
SendResponse
();
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
HostResult
ParseHost
(
char
*
hostname
);
static
HostResult
ParseHost
(
char
*
hostname
,
unsigned
short
port
);
static
void
SendPacketToServer
(
unsigned
char
proto
)
{
static
void
SendPacketToServer
(
unsigned
char
proto
)
{
char
*
p
=
duel_client_write
;
char
*
p
=
duel_client_write
;
BufferIO
::
WriteInt16
(
p
,
1
);
BufferIO
::
WriteInt16
(
p
,
1
);
...
...
gframe/game.cpp
View file @
81ab1943
...
@@ -177,8 +177,10 @@ bool Game::Initialize() {
...
@@ -177,8 +177,10 @@ bool Game::Initialize() {
lstHostList
->
setItemHeight
(
18
);
lstHostList
->
setItemHeight
(
18
);
btnLanRefresh
=
env
->
addButton
(
rect
<
s32
>
(
240
,
325
,
340
,
350
),
wLanWindow
,
BUTTON_LAN_REFRESH
,
dataManager
.
GetSysString
(
1217
));
btnLanRefresh
=
env
->
addButton
(
rect
<
s32
>
(
240
,
325
,
340
,
350
),
wLanWindow
,
BUTTON_LAN_REFRESH
,
dataManager
.
GetSysString
(
1217
));
env
->
addStaticText
(
dataManager
.
GetSysString
(
1221
),
rect
<
s32
>
(
10
,
360
,
220
,
380
),
false
,
false
,
wLanWindow
);
env
->
addStaticText
(
dataManager
.
GetSysString
(
1221
),
rect
<
s32
>
(
10
,
360
,
220
,
380
),
false
,
false
,
wLanWindow
);
ebJoinHost
=
env
->
addEditBox
(
gameConf
.
lasthost
,
rect
<
s32
>
(
110
,
355
,
42
0
,
380
),
true
,
wLanWindow
);
ebJoinHost
=
env
->
addEditBox
(
gameConf
.
lasthost
,
rect
<
s32
>
(
110
,
355
,
35
0
,
380
),
true
,
wLanWindow
);
ebJoinHost
->
setTextAlignment
(
irr
::
gui
::
EGUIA_CENTER
,
irr
::
gui
::
EGUIA_CENTER
);
ebJoinHost
->
setTextAlignment
(
irr
::
gui
::
EGUIA_CENTER
,
irr
::
gui
::
EGUIA_CENTER
);
ebJoinPort
=
env
->
addEditBox
(
gameConf
.
lastport
,
rect
<
s32
>
(
360
,
355
,
420
,
380
),
true
,
wLanWindow
);
ebJoinPort
->
setTextAlignment
(
irr
::
gui
::
EGUIA_CENTER
,
irr
::
gui
::
EGUIA_CENTER
);
env
->
addStaticText
(
dataManager
.
GetSysString
(
1222
),
rect
<
s32
>
(
10
,
390
,
220
,
410
),
false
,
false
,
wLanWindow
);
env
->
addStaticText
(
dataManager
.
GetSysString
(
1222
),
rect
<
s32
>
(
10
,
390
,
220
,
410
),
false
,
false
,
wLanWindow
);
ebJoinPass
=
env
->
addEditBox
(
gameConf
.
roompass
,
rect
<
s32
>
(
110
,
385
,
420
,
410
),
true
,
wLanWindow
);
ebJoinPass
=
env
->
addEditBox
(
gameConf
.
roompass
,
rect
<
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
);
...
@@ -1290,6 +1292,7 @@ void Game::LoadConfig() {
...
@@ -1290,6 +1292,7 @@ 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
;
gameConf
.
bot_deck_path
[
0
]
=
0
;
gameConf
.
bot_deck_path
[
0
]
=
0
;
//settings
//settings
...
@@ -1351,11 +1354,8 @@ void Game::LoadConfig() {
...
@@ -1351,11 +1354,8 @@ void Game::LoadConfig() {
}
else
if
(
!
strcmp
(
strbuf
,
"lasthost"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"lasthost"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
lasthost
,
100
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
lasthost
,
100
);
}
else
if
(
!
strcmp
(
strbuf
,
"lastport"
))
{
// for config migration
}
else
if
(
!
strcmp
(
strbuf
,
"lastport"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
gameConf
.
lastport
=
(
unsigned
short
)
atoi
(
valbuf
);
wchar_t
tmpLastHost
[
100
];
BufferIO
::
CopyWStr
(
gameConf
.
lasthost
,
tmpLastHost
,
100
);
myswprintf
(
gameConf
.
lasthost
,
L"%ls:%ls"
,
tmpLastHost
,
wstr
);
}
else
if
(
!
strcmp
(
strbuf
,
"roompass"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"roompass"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
roompass
,
20
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
roompass
,
20
);
...
@@ -1478,6 +1478,8 @@ void Game::SaveConfig() {
...
@@ -1478,6 +1478,8 @@ void Game::SaveConfig() {
fprintf
(
fp
,
"serverport = %d
\n
"
,
gameConf
.
serverport
);
fprintf
(
fp
,
"serverport = %d
\n
"
,
gameConf
.
serverport
);
BufferIO
::
EncodeUTF8
(
gameConf
.
lasthost
,
linebuf
);
BufferIO
::
EncodeUTF8
(
gameConf
.
lasthost
,
linebuf
);
fprintf
(
fp
,
"lasthost = %s
\n
"
,
linebuf
);
fprintf
(
fp
,
"lasthost = %s
\n
"
,
linebuf
);
BufferIO
::
EncodeUTF8
(
gameConf
.
lastport
,
linebuf
);
fprintf
(
fp
,
"lastport = %s
\n
"
,
linebuf
);
//settings
//settings
fprintf
(
fp
,
"automonsterpos = %d
\n
"
,
(
chkMAutoPos
->
isChecked
()
?
1
:
0
));
fprintf
(
fp
,
"automonsterpos = %d
\n
"
,
(
chkMAutoPos
->
isChecked
()
?
1
:
0
));
fprintf
(
fp
,
"autospellpos = %d
\n
"
,
(
chkSTAutoPos
->
isChecked
()
?
1
:
0
));
fprintf
(
fp
,
"autospellpos = %d
\n
"
,
(
chkSTAutoPos
->
isChecked
()
?
1
:
0
));
...
...
gframe/game.h
View file @
81ab1943
...
@@ -18,6 +18,7 @@ struct Config {
...
@@ -18,6 +18,7 @@ struct Config {
unsigned
short
serverport
;
unsigned
short
serverport
;
unsigned
char
textfontsize
;
unsigned
char
textfontsize
;
wchar_t
lasthost
[
100
];
wchar_t
lasthost
[
100
];
unsigned
short
lastport
;
wchar_t
nickname
[
20
];
wchar_t
nickname
[
20
];
wchar_t
gamename
[
20
];
wchar_t
gamename
[
20
];
wchar_t
lastcategory
[
64
];
wchar_t
lastcategory
[
64
];
...
@@ -326,6 +327,7 @@ public:
...
@@ -326,6 +327,7 @@ 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 @
81ab1943
...
@@ -76,6 +76,7 @@ int main(int argc, char* argv[]) {
...
@@ -76,6 +76,7 @@ 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
(
wargv
[
i
][
0
]
==
L'-'
&&
wargv
[
i
][
1
]
==
L'e'
&&
wargv
[
i
][
2
]
!=
L'\0'
)
{
if
(
wargv
[
i
][
0
]
==
L'-'
&&
wargv
[
i
][
1
]
==
L'e'
&&
wargv
[
i
][
2
]
!=
L'\0'
)
{
ygo
::
dataManager
.
LoadDB
(
&
wargv
[
i
][
2
]);
ygo
::
dataManager
.
LoadDB
(
&
wargv
[
i
][
2
]);
...
@@ -94,17 +95,23 @@ int main(int argc, char* argv[]) {
...
@@ -94,17 +95,23 @@ int main(int argc, char* argv[]) {
continue
;
continue
;
}
else
if
(
!
wcscmp
(
wargv
[
i
],
L"-h"
))
{
// Host address
}
else
if
(
!
wcscmp
(
wargv
[
i
],
L"-h"
))
{
// Host address
++
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
(
!
wcscmp
(
wargv
[
i
],
L"-p"
))
{
// host
port, deprecated, and should use 1.1.1.1:7911 instead
}
else
if
(
!
wcscmp
(
wargv
[
i
],
L"-p"
))
{
// host
Port
++
i
;
++
i
;
if
(
i
<
wargc
)
{
if
(
i
<
wargc
)
{
auto
host
=
ygo
::
mainGame
->
ebJoinHost
->
getText
();
portSpecified
=
true
;
if
(
wcslen
(
host
)
>
0
)
{
auto
port
=
_wtoi
(
wargv
[
i
]);
wchar_t
appended
[
100
];
if
(
port
)
{
myswprintf
(
appended
,
L"%ls:%ls"
,
host
,
wargv
[
i
]);
wchar_t
portStr
[
6
];
ygo
::
mainGame
->
ebJoinHost
->
setText
(
appended
);
myswprintf
(
portStr
,
L"%d"
,
port
);
ygo
::
mainGame
->
ebJoinPort
->
setText
(
portStr
);
}
else
{
ygo
::
mainGame
->
ebJoinPort
->
setText
(
L""
);
}
}
}
}
continue
;
continue
;
...
...
gframe/menu_handler.cpp
View file @
81ab1943
...
@@ -68,7 +68,8 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -68,7 +68,8 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
char
hostname
[
100
];
char
hostname
[
100
];
const
wchar_t
*
pstr
=
mainGame
->
ebJoinHost
->
getText
();
const
wchar_t
*
pstr
=
mainGame
->
ebJoinHost
->
getText
();
BufferIO
::
CopyWStr
(
pstr
,
hostname
,
100
);
BufferIO
::
CopyWStr
(
pstr
,
hostname
,
100
);
HostResult
remote
=
DuelClient
::
ParseHost
(
hostname
);
auto
port
=
(
unsigned
short
)
_wtoi
(
mainGame
->
ebJoinPort
->
getText
());
HostResult
remote
=
DuelClient
::
ParseHost
(
hostname
,
port
);
if
(
!
remote
.
isValid
())
{
if
(
!
remote
.
isValid
())
{
mainGame
->
gMutex
.
lock
();
mainGame
->
gMutex
.
lock
();
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
...
@@ -77,6 +78,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -77,6 +78,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
break
;
}
}
BufferIO
::
CopyWStr
(
pstr
,
mainGame
->
gameConf
.
lasthost
,
100
);
BufferIO
::
CopyWStr
(
pstr
,
mainGame
->
gameConf
.
lasthost
,
100
);
mainGame
->
gameConf
.
lastport
=
port
;
if
(
DuelClient
::
StartClient
(
remote
.
host
,
remote
.
port
,
false
))
{
if
(
DuelClient
::
StartClient
(
remote
.
host
,
remote
.
port
,
false
))
{
mainGame
->
btnCreateHost
->
setEnabled
(
false
);
mainGame
->
btnCreateHost
->
setEnabled
(
false
);
mainGame
->
btnJoinHost
->
setEnabled
(
false
);
mainGame
->
btnJoinHost
->
setEnabled
(
false
);
...
@@ -476,9 +478,11 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -476,9 +478,11 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
break
;
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
[
2
6
];
wchar_t
buf
[
2
0
];
myswprintf
(
buf
,
L"%d.%d.%d.%d
:%d"
,
addr
&
0xff
,
(
addr
>>
8
)
&
0xff
,
(
addr
>>
16
)
&
0xff
,
(
addr
>>
24
)
&
0xff
,
port
);
myswprintf
(
buf
,
L"%d.%d.%d.%d
"
,
addr
&
0xff
,
(
addr
>>
8
)
&
0xff
,
(
addr
>>
16
)
&
0xff
,
(
addr
>>
24
)
&
0xff
);
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
:
{
...
...
system.conf
View file @
81ab1943
#config file
#config file
#nickname & gamename should be less than 20 characters
#nickname & gamename should be less than 20 characters
use_d3d
=
0
use_d3d
=
0
use_image_scale
=
1
use_image_scale
=
1
antialias
=
2
antialias
=
2
errorlog
=
3
errorlog
=
3
nickname
=
Player
nickname
=
Player
gamename
=
Game
gamename
=
Game
lastcategory
= 未分类卡组
lastcategory
= 未分类卡组
lastdeck
=
new
lastdeck
=
new
textfont
= ./
fonts
/
textFont
.
ttf
14
textfont
= ./
fonts
/
textFont
.
ttf
14
numfont
= ./
fonts
/
numFont
.
ttf
numfont
= ./
fonts
/
numFont
.
ttf
serverport
=
7911
serverport
=
7911
lasthost
=
127
.
0
.
0
.
1
:
7911
lasthost
=
127
.
0
.
0
.
1
automonsterpos
=
0
lastport
=
7911
autospellpos
=
0
automonsterpos
=
0
randompos
=
0
autospellpos
=
0
autochain
=
0
randompos
=
0
waitchain
=
0
autochain
=
0
showchain
=
0
waitchain
=
0
mute_opponent
=
0
showchain
=
0
mute_spectators
=
0
mute_opponent
=
0
use_lflist
=
1
mute_spectators
=
0
default_lflist
=
0
use_lflist
=
1
default_rule
=
0
default_lflist
=
0
hide_setname
=
0
default_rule
=
0
hide_hint_button
=
0
hide_setname
=
0
#control_mode = 0: Key A/S/D/R Chain Buttons. control_mode = 1: MouseLeft/MouseRight/NULL/F9 Without Chain Buttons
hide_hint_button
=
0
control_mode
=
0
#control_mode = 0: Key A/S/D/R Chain Buttons. control_mode = 1: MouseLeft/MouseRight/NULL/F9 Without Chain Buttons
draw_field_spell
=
1
control_mode
=
0
separate_clear_button
=
1
draw_field_spell
=
1
#auto_search_limit >= 0: Start search automatically when the user enters N chars
separate_clear_button
=
1
auto_search_limit
= -
1
#auto_search_limit >= 0: Start search automatically when the user enters N chars
#search_multiple_keywords = 0: Disable. 1: Search mutiple keywords with separator " ". 2: with separator "+"
auto_search_limit
= -
1
search_multiple_keywords
=
1
#search_multiple_keywords = 0: Disable. 1: Search mutiple keywords with separator " ". 2: with separator "+"
ignore_deck_changes
=
0
search_multiple_keywords
=
1
default_ot
=
1
ignore_deck_changes
=
0
enable_bot_mode
=
0
default_ot
=
1
bot_deck_path
= ./
botdeck
enable_bot_mode
=
0
quick_animation
=
0
bot_deck_path
= ./
botdeck
auto_save_replay
=
0
quick_animation
=
0
draw_single_chain
=
0
auto_save_replay
=
0
prefer_expansion_script
=
0
draw_single_chain
=
0
window_maximized
=
0
prefer_expansion_script
=
0
window_width
=
1280
window_maximized
=
0
window_height
=
800
window_width
=
1280
resize_popup_menu
=
0
window_height
=
800
enable_sound
=
1
resize_popup_menu
=
0
enable_music
=
1
enable_sound
=
1
#Volume of sound and music, between 0 and 100
enable_music
=
1
sound_volume
=
50
#Volume of sound and music, between 0 and 100
music_volume
=
50
sound_volume
=
50
music_mode
=
1
music_volume
=
50
music_mode
=
1
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