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
ab260bc6
Commit
ab260bc6
authored
Jul 01, 2019
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:Fluorohydride/ygopro
parents
fb1a1fdb
e65e5c61
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
50 deletions
+69
-50
gframe/duelclient.cpp
gframe/duelclient.cpp
+43
-30
gframe/netserver.cpp
gframe/netserver.cpp
+3
-9
gframe/replay_mode.cpp
gframe/replay_mode.cpp
+12
-9
strings.conf
strings.conf
+11
-2
No files found.
gframe/duelclient.cpp
View file @
ab260bc6
...
...
@@ -990,12 +990,46 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len, bool retry) {
if
(
last_successful_msg_length
)
{
char
*
p
=
last_successful_msg
;
auto
last_msg
=
BufferIO
::
ReadUInt8
(
p
);
int
err_desc
=
142
2
;
int
err_desc
=
142
1
;
switch
(
last_msg
)
{
case
MSG_ANNOUNCE_CARD
:
case
MSG_ANNOUNCE_CARD_FILTER
:
err_desc
=
1421
;
//TODO: other cases
err_desc
=
1422
;
break
;
case
MSG_ANNOUNCE_ATTRIB
:
err_desc
=
1423
;
break
;
case
MSG_ANNOUNCE_RACE
:
err_desc
=
1424
;
break
;
case
MSG_ANNOUNCE_NUMBER
:
err_desc
=
1425
;
break
;
case
MSG_SELECT_EFFECTYN
:
case
MSG_SELECT_YESNO
:
case
MSG_SELECT_OPTION
:
err_desc
=
1426
;
break
;
case
MSG_SELECT_CARD
:
case
MSG_SELECT_UNSELECT_CARD
:
case
MSG_SELECT_TRIBUTE
:
case
MSG_SELECT_SUM
:
case
MSG_SORT_CARD
:
err_desc
=
1427
;
break
;
case
MSG_SELECT_CHAIN
:
err_desc
=
1428
;
break
;
case
MSG_SELECT_PLACE
:
case
MSG_SELECT_DISFIELD
:
err_desc
=
1429
;
break
;
case
MSG_SELECT_POSITION
:
err_desc
=
1430
;
break
;
case
MSG_SELECT_COUNTER
:
err_desc
=
1431
;
break
;
default:
break
;
}
...
...
@@ -4029,45 +4063,24 @@ void DuelClient::BeginRefreshHost() {
if
(
!
host
)
return
;
SOCKET
reply
=
socket
(
AF_INET
,
SOCK_DGRAM
,
IPPROTO_UDP
);
sockaddr_in
reply_addr
;
memset
(
&
reply_addr
,
0
,
sizeof
(
reply_addr
));
reply_addr
.
sin_family
=
AF_INET
;
reply_addr
.
sin_port
=
htons
(
7921
);
reply_addr
.
sin_addr
.
s_addr
=
0
;
if
(
bind
(
reply
,
(
sockaddr
*
)
&
reply_addr
,
sizeof
(
reply_addr
))
==
SOCKET_ERROR
)
{
closesocket
(
reply
);
return
;
}
BOOL
opt
=
TRUE
;
setsockopt
(
reply
,
SOL_SOCKET
,
SO_BROADCAST
,
(
const
char
*
)
&
opt
,
sizeof
(
BOOL
));
timeval
timeout
=
{
3
,
0
};
resp_event
=
event_new
(
broadev
,
reply
,
EV_TIMEOUT
|
EV_READ
|
EV_PERSIST
,
BroadcastReply
,
broadev
);
event_add
(
resp_event
,
&
timeout
);
Thread
::
NewThread
(
RefreshThread
,
broadev
);
//send request
SOCKADDR_IN
local
;
local
.
sin_family
=
AF_INET
;
local
.
sin_port
=
htons
(
7922
);
SOCKADDR_IN
sockTo
;
sockTo
.
sin_addr
.
s_addr
=
htonl
(
INADDR_BROADCAST
);
SOCKADDR_IN
sockTo
=
{};
sockTo
.
sin_family
=
AF_INET
;
sockTo
.
sin_port
=
htons
(
79
20
);
sockTo
.
sin_port
=
htons
(
79
11
);
HostRequest
hReq
;
hReq
.
identifier
=
NETWORK_CLIENT_ID
;
for
(
int
i
=
0
;
i
<
8
;
++
i
)
{
if
(
host
->
h_addr_list
[
i
]
==
0
)
break
;
unsigned
int
local_addr
=
*
(
unsigned
int
*
)
host
->
h_addr_list
[
i
];
local
.
sin_addr
.
s_addr
=
local_addr
;
SOCKET
sSend
=
socket
(
AF_INET
,
SOCK_DGRAM
,
IPPROTO_UDP
);
if
(
sSend
==
INVALID_SOCKET
)
break
;
BOOL
opt
=
TRUE
;
setsockopt
(
sSend
,
SOL_SOCKET
,
SO_BROADCAST
,
(
const
char
*
)
&
opt
,
sizeof
(
BOOL
));
if
(
bind
(
sSend
,
(
sockaddr
*
)
&
local
,
sizeof
(
sockaddr
))
==
SOCKET_ERROR
)
{
closesocket
(
sSend
);
break
;
}
sendto
(
sSend
,
(
const
char
*
)
&
hReq
,
sizeof
(
HostRequest
),
0
,
(
sockaddr
*
)
&
sockTo
,
sizeof
(
sockaddr
));
closesocket
(
sSend
);
sockTo
.
sin_addr
.
s_addr
=
local_addr
;
sendto
(
reply
,
(
const
char
*
)
&
hReq
,
sizeof
(
HostRequest
),
0
,
(
sockaddr
*
)
&
sockTo
,
sizeof
(
sockaddr
));
}
}
int
DuelClient
::
RefreshThread
(
void
*
arg
)
{
...
...
gframe/netserver.cpp
View file @
ab260bc6
...
...
@@ -40,13 +40,11 @@ bool NetServer::StartBroadcast() {
if
(
!
net_evbase
)
return
false
;
SOCKET
udp
=
socket
(
AF_INET
,
SOCK_DGRAM
,
IPPROTO_UDP
);
BOOL
opt
=
TRUE
;
setsockopt
(
udp
,
SOL_SOCKET
,
SO_BROADCAST
,
(
const
char
*
)
&
opt
,
sizeof
(
BOOL
));
sockaddr_in
addr
;
memset
(
&
addr
,
0
,
sizeof
(
addr
));
addr
.
sin_family
=
AF_INET
;
addr
.
sin_port
=
htons
(
79
20
);
addr
.
sin_addr
.
s_addr
=
0
;
addr
.
sin_port
=
htons
(
79
11
);
addr
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
)
;
if
(
bind
(
udp
,
(
sockaddr
*
)
&
addr
,
sizeof
(
addr
))
==
SOCKET_ERROR
)
{
closesocket
(
udp
);
return
false
;
...
...
@@ -85,17 +83,13 @@ void NetServer::BroadcastEvent(evutil_socket_t fd, short events, void* arg) {
return
;
HostRequest
*
pHR
=
(
HostRequest
*
)
buf
;
if
(
pHR
->
identifier
==
NETWORK_CLIENT_ID
)
{
SOCKADDR_IN
sockTo
;
sockTo
.
sin_addr
.
s_addr
=
bc_addr
.
sin_addr
.
s_addr
;
sockTo
.
sin_family
=
AF_INET
;
sockTo
.
sin_port
=
htons
(
7921
);
HostPacket
hp
;
hp
.
identifier
=
NETWORK_SERVER_ID
;
hp
.
port
=
server_port
;
hp
.
version
=
PRO_VERSION
;
hp
.
host
=
duel_mode
->
host_info
;
BufferIO
::
CopyWStr
(
duel_mode
->
name
,
hp
.
name
,
20
);
sendto
(
fd
,
(
const
char
*
)
&
hp
,
sizeof
(
HostPacket
),
0
,
(
sockaddr
*
)
&
sockTo
,
sizeof
(
sockTo
)
);
sendto
(
fd
,
(
const
char
*
)
&
hp
,
sizeof
(
HostPacket
),
0
,
(
sockaddr
*
)
&
bc_addr
,
sz
);
}
}
void
NetServer
::
ServerAccept
(
evconnlistener
*
listener
,
evutil_socket_t
fd
,
sockaddr
*
address
,
int
socklen
,
void
*
ctx
)
{
...
...
gframe/replay_mode.cpp
View file @
ab260bc6
...
...
@@ -101,6 +101,8 @@ int ReplayMode::ReplayThread(void* param) {
if
(
is_restarting
)
{
mainGame
->
gMutex
.
Lock
();
is_restarting
=
false
;
mainGame
->
dInfo
.
isReplaySkiping
=
true
;
Restart
(
false
);
int
step
=
current_step
-
1
;
if
(
step
<
0
)
step
=
0
;
...
...
@@ -109,10 +111,13 @@ int ReplayMode::ReplayThread(void* param) {
skip_step
=
0
;
int
len
=
get_message
(
pduel
,
(
byte
*
)
engineBuffer
);
if
(
len
>
0
)
{
mainGame
->
gMutex
.
Unlock
();
is_continuing
=
ReplayAnalyze
(
engineBuffer
,
len
);
mainGame
->
gMutex
.
Lock
();
}
}
else
{
ReplayRefreshDeck
(
0
);
ReplayRefreshDeck
(
1
);
ReplayRefreshExtra
(
0
);
ReplayRefreshExtra
(
1
);
}
if
(
step
==
0
)
{
Pause
(
true
,
false
);
...
...
@@ -175,14 +180,14 @@ bool ReplayMode::StartDuel() {
int
extra
=
cur_replay
.
ReadInt32
();
for
(
int
i
=
0
;
i
<
extra
;
++
i
)
new_card
(
pduel
,
cur_replay
.
ReadInt32
(),
0
,
0
,
LOCATION_EXTRA
,
0
,
POS_FACEDOWN_DEFENSE
);
mainGame
->
dField
.
Initial
(
0
,
main
,
extra
);
mainGame
->
dField
.
Initial
(
mainGame
->
LocalPlayer
(
0
)
,
main
,
extra
);
main
=
cur_replay
.
ReadInt32
();
for
(
int
i
=
0
;
i
<
main
;
++
i
)
new_card
(
pduel
,
cur_replay
.
ReadInt32
(),
1
,
1
,
LOCATION_DECK
,
0
,
POS_FACEDOWN_DEFENSE
);
extra
=
cur_replay
.
ReadInt32
();
for
(
int
i
=
0
;
i
<
extra
;
++
i
)
new_card
(
pduel
,
cur_replay
.
ReadInt32
(),
1
,
1
,
LOCATION_EXTRA
,
0
,
POS_FACEDOWN_DEFENSE
);
mainGame
->
dField
.
Initial
(
1
,
main
,
extra
);
mainGame
->
dField
.
Initial
(
mainGame
->
LocalPlayer
(
1
)
,
main
,
extra
);
}
else
{
int
main
=
cur_replay
.
ReadInt32
();
for
(
int
i
=
0
;
i
<
main
;
++
i
)
...
...
@@ -190,7 +195,7 @@ bool ReplayMode::StartDuel() {
int
extra
=
cur_replay
.
ReadInt32
();
for
(
int
i
=
0
;
i
<
extra
;
++
i
)
new_card
(
pduel
,
cur_replay
.
ReadInt32
(),
0
,
0
,
LOCATION_EXTRA
,
0
,
POS_FACEDOWN_DEFENSE
);
mainGame
->
dField
.
Initial
(
0
,
main
,
extra
);
mainGame
->
dField
.
Initial
(
mainGame
->
LocalPlayer
(
0
)
,
main
,
extra
);
main
=
cur_replay
.
ReadInt32
();
for
(
int
i
=
0
;
i
<
main
;
++
i
)
new_tag_card
(
pduel
,
cur_replay
.
ReadInt32
(),
0
,
LOCATION_DECK
);
...
...
@@ -203,7 +208,7 @@ bool ReplayMode::StartDuel() {
extra
=
cur_replay
.
ReadInt32
();
for
(
int
i
=
0
;
i
<
extra
;
++
i
)
new_card
(
pduel
,
cur_replay
.
ReadInt32
(),
1
,
1
,
LOCATION_EXTRA
,
0
,
POS_FACEDOWN_DEFENSE
);
mainGame
->
dField
.
Initial
(
1
,
main
,
extra
);
mainGame
->
dField
.
Initial
(
mainGame
->
LocalPlayer
(
1
)
,
main
,
extra
);
main
=
cur_replay
.
ReadInt32
();
for
(
int
i
=
0
;
i
<
main
;
++
i
)
new_tag_card
(
pduel
,
cur_replay
.
ReadInt32
(),
1
,
LOCATION_DECK
);
...
...
@@ -271,13 +276,11 @@ void ReplayMode::Restart(bool refresh) {
//mainGame->dInfo.isReplay = true;
}
skip_turn
=
0
;
is_restarting
=
true
;
}
void
ReplayMode
::
Undo
()
{
if
(
skip_step
>
0
||
current_step
==
0
)
return
;
mainGame
->
dInfo
.
isReplaySkiping
=
true
;
Restart
(
false
);
is_restarting
=
true
;
Pause
(
false
,
false
);
}
bool
ReplayMode
::
ReplayAnalyze
(
char
*
msg
,
unsigned
int
len
)
{
...
...
strings.conf
View file @
ab260bc6
...
...
@@ -447,8 +447,17 @@
!
system
1418
额外卡组数量应不超过
15
张,当前卡组数量为%
d
张。
!
system
1419
副卡组数量应不超过
15
张,当前卡组数量为%
d
张。
!
system
1420
有额外卡组卡片存在于主卡组,可能是额外卡组数量超过
15
张。
!
system
1421
宣言的卡不符合条件,或无法被主机识别。
!
system
1422
操作无效,请重试。
!
system
1421
操作无效,请重试。
!
system
1422
宣言的卡不符合条件,或无法被主机识别。
!
system
1423
宣言的属性不符合条件。
!
system
1424
宣言的种族不符合条件
!
system
1425
宣言的数字不符合条件。
!
system
1426
选择的选项不符合条件
!
system
1427
选择的卡片不符合条件。
!
system
1428
选择的连锁不符合条件。
!
system
1429
选择的位置不符合条件。
!
system
1430
选择的表示形式不符合条件。
!
system
1431
选择的指示物不符合条件。
!
system
1450
卡包展示
!
system
1451
人机卡组
!
system
1452
未分类卡组
...
...
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