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
xiaoye
ygopro
Commits
3781c056
Commit
3781c056
authored
Jun 19, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
merge upstream
parents
335f5728
9273069d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
49 additions
and
14 deletions
+49
-14
.github/workflows/server.yml
.github/workflows/server.yml
+1
-1
gframe/game.cpp
gframe/game.cpp
+3
-2
gframe/game.h
gframe/game.h
+5
-2
gframe/gframe.cpp
gframe/gframe.cpp
+26
-4
gframe/single_duel.cpp
gframe/single_duel.cpp
+9
-5
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+5
-0
No files found.
.github/workflows/server.yml
View file @
3781c056
...
@@ -283,7 +283,7 @@ jobs:
...
@@ -283,7 +283,7 @@ jobs:
repo_token
:
"
${{
secrets.GITHUB_TOKEN
}}"
repo_token
:
"
${{
secrets.GITHUB_TOKEN
}}"
automatic_release_tag
:
"
server-latest"
automatic_release_tag
:
"
server-latest"
prerelease
:
true
prerelease
:
true
title
:
"
Development
Build"
title
:
"
Development
Build
(Server
Mode)
"
files
:
|
files
:
|
x64/ygopro.exe
x64/ygopro.exe
x64/AI.Server.exe
x64/AI.Server.exe
\ No newline at end of file
gframe/game.cpp
View file @
3781c056
...
@@ -86,8 +86,9 @@ void DuelInfo::Clear() {
...
@@ -86,8 +86,9 @@ void DuelInfo::Clear() {
#ifdef YGOPRO_SERVER_MODE
#ifdef YGOPRO_SERVER_MODE
unsigned
short
server_port
;
unsigned
short
server_port
;
unsigned
short
replay_mode
;
unsigned
short
replay_mode
;
unsigned
int
pre_seed
[
5
];
uint32_t
pre_seed
[
MAX_MATCH_COUNT
][
SEED_COUNT
];
unsigned
int
duel_flags
;
uint8_t
pre_seed_specified
[
MAX_MATCH_COUNT
];
uint32_t
duel_flags
;
HostInfo
game_info
;
HostInfo
game_info
;
void
Game
::
MainServerLoop
()
{
void
Game
::
MainServerLoop
()
{
...
...
gframe/game.h
View file @
3781c056
...
@@ -717,11 +717,14 @@ public:
...
@@ -717,11 +717,14 @@ public:
extern
Game
*
mainGame
;
extern
Game
*
mainGame
;
#ifdef YGOPRO_SERVER_MODE
#ifdef YGOPRO_SERVER_MODE
#define MAX_MATCH_COUNT 3
extern
unsigned
short
server_port
;
extern
unsigned
short
server_port
;
extern
unsigned
short
replay_mode
;
extern
unsigned
short
replay_mode
;
extern
HostInfo
game_info
;
extern
HostInfo
game_info
;
extern
unsigned
int
pre_seed
[
5
];
extern
uint32_t
pre_seed
[
MAX_MATCH_COUNT
][
SEED_COUNT
];
extern
unsigned
int
duel_flags
;
extern
uint8_t
pre_seed_specified
[
MAX_MATCH_COUNT
];
extern
uint32_t
duel_flags
;
#endif
#endif
}
}
...
...
gframe/gframe.cpp
View file @
3781c056
...
@@ -8,6 +8,9 @@
...
@@ -8,6 +8,9 @@
#ifdef __APPLE__
#ifdef __APPLE__
#import <CoreFoundation/CoreFoundation.h>
#import <CoreFoundation/CoreFoundation.h>
#endif
#endif
#ifdef YGOPRO_SERVER_MODE
#include "base64.h"
#endif
#ifdef YGOPRO_SERVER_MODE
#ifdef YGOPRO_SERVER_MODE
#include <sstream>
#include <sstream>
...
@@ -121,8 +124,8 @@ int main(int argc, char* argv[]) {
...
@@ -121,8 +124,8 @@ int main(int argc, char* argv[]) {
ygo
::
game_info
.
no_shuffle_deck
=
false
;
ygo
::
game_info
.
no_shuffle_deck
=
false
;
ygo
::
game_info
.
duel_rule
=
YGOPRO_DEFAULT_DUEL_RULE
;
ygo
::
game_info
.
duel_rule
=
YGOPRO_DEFAULT_DUEL_RULE
;
ygo
::
game_info
.
time_limit
=
180
;
ygo
::
game_info
.
time_limit
=
180
;
for
(
int
i
=
0
;
i
<
5
;
++
i
)
std
::
memset
(
ygo
::
pre_seed
,
0
,
sizeof
(
ygo
::
pre_seed
));
ygo
::
pre_seed
[
i
]
=
(
unsigned
int
)
0
;
std
::
memset
(
ygo
::
pre_seed_specified
,
0
,
sizeof
(
ygo
::
pre_seed_specified
))
;
if
(
argc
==
2
)
{
if
(
argc
==
2
)
{
int
code
=
atoi
(
argv
[
1
]);
int
code
=
atoi
(
argv
[
1
]);
ygo
::
mainGame
=
&
_game
;
ygo
::
mainGame
=
&
_game
;
...
@@ -165,9 +168,28 @@ int main(int argc, char* argv[]) {
...
@@ -165,9 +168,28 @@ int main(int argc, char* argv[]) {
ygo
::
game_info
.
draw_count
=
atoi
(
argv
[
10
]);
ygo
::
game_info
.
draw_count
=
atoi
(
argv
[
10
]);
ygo
::
game_info
.
time_limit
=
atoi
(
argv
[
11
]);
ygo
::
game_info
.
time_limit
=
atoi
(
argv
[
11
]);
ygo
::
replay_mode
=
atoi
(
argv
[
12
]);
ygo
::
replay_mode
=
atoi
(
argv
[
12
]);
for
(
int
i
=
13
;
(
i
<
argc
&&
i
<
=
17
)
;
++
i
)
for
(
int
i
=
13
;
(
i
<
argc
&&
i
<
(
13
+
MAX_MATCH_COUNT
)
)
;
++
i
)
{
{
ygo
::
pre_seed
[
i
-
13
]
=
(
unsigned
int
)
atol
(
argv
[
i
]);
auto
ok
=
Base64
::
Decode
(
reinterpret_cast
<
const
unsigned
char
*>
(
argv
[
i
]),
strlen
(
argv
[
i
]),
reinterpret_cast
<
unsigned
char
*>
(
ygo
::
pre_seed
[
i
-
13
]),
SEED_COUNT
*
sizeof
(
uint32_t
)
);
if
(
ok
)
{
// check if it isn't all zero
bool
all_zero
=
true
;
for
(
int
j
=
0
;
j
<
SEED_COUNT
;
++
j
)
{
if
(
ygo
::
pre_seed
[
i
-
13
][
j
]
!=
0
)
{
all_zero
=
false
;
break
;
}
}
if
(
!
all_zero
)
ygo
::
pre_seed_specified
[
i
-
13
]
=
1
;
}
else
std
::
fprintf
(
stderr
,
"Failed to decode seed %d: %s
\n
"
,
i
-
13
,
argv
[
i
]);
}
}
}
}
ygo
::
mainGame
=
&
_game
;
ygo
::
mainGame
=
&
_game
;
...
...
gframe/single_duel.cpp
View file @
3781c056
...
@@ -561,6 +561,11 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
...
@@ -561,6 +561,11 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
rh
.
base
.
version
=
PRO_VERSION
;
rh
.
base
.
version
=
PRO_VERSION
;
rh
.
base
.
flag
=
REPLAY_UNIFORM
;
rh
.
base
.
flag
=
REPLAY_UNIFORM
;
rh
.
base
.
start_time
=
(
uint32_t
)
std
::
time
(
nullptr
);
rh
.
base
.
start_time
=
(
uint32_t
)
std
::
time
(
nullptr
);
#ifdef YGOPRO_SERVER_MODE
if
(
pre_seed_specified
[
duel_count
])
memcpy
(
rh
.
seed_sequence
,
pre_seed
[
duel_count
],
SEED_COUNT
*
sizeof
(
uint32_t
));
else
#endif
for
(
auto
&
x
:
rh
.
seed_sequence
)
for
(
auto
&
x
:
rh
.
seed_sequence
)
x
=
rd
();
x
=
rd
();
mtrandom
rnd
(
rh
.
seed_sequence
,
SEED_COUNT
);
mtrandom
rnd
(
rh
.
seed_sequence
,
SEED_COUNT
);
...
@@ -2352,14 +2357,13 @@ void SingleDuel::SingleTimer(evutil_socket_t fd, short events, void* arg) {
...
@@ -2352,14 +2357,13 @@ void SingleDuel::SingleTimer(evutil_socket_t fd, short events, void* arg) {
#ifdef YGOPRO_SERVER_MODE
#ifdef YGOPRO_SERVER_MODE
void
SingleDuel
::
TestCard
(
int
code
)
{
void
SingleDuel
::
TestCard
(
int
code
)
{
std
::
random_device
rd
;
std
::
random_device
rd
;
u
nsigned
int
seed
=
rd
()
;
u
int32_t
seed
[
SEED_COUNT
]
;
mt19937
rnd
(
seed
);
for
(
int
i
=
0
;
i
<
SEED_COUNT
;
++
i
)
unsigned
int
duel_seed
=
rnd
.
ran
d
();
seed
[
i
]
=
r
d
();
set_script_reader
((
script_reader
)
DataManager
::
ScriptReaderEx
);
set_script_reader
((
script_reader
)
DataManager
::
ScriptReaderEx
);
set_card_reader
((
card_reader
)
DataManager
::
CardReader
);
set_card_reader
((
card_reader
)
DataManager
::
CardReader
);
set_message_handler
((
message_handler
)
SingleDuel
::
MessageHandler
);
set_message_handler
((
message_handler
)
SingleDuel
::
MessageHandler
);
rnd
.
reset
(
seed
);
unsigned
long
tduel
=
create_duel_v2
(
seed
);
unsigned
long
tduel
=
create_duel
(
duel_seed
);
preload_script
(
tduel
,
"./script/special.lua"
);
preload_script
(
tduel
,
"./script/special.lua"
);
preload_script
(
tduel
,
"./script/init.lua"
);
preload_script
(
tduel
,
"./script/init.lua"
);
set_player_info
(
tduel
,
0
,
8000
,
5
,
1
);
set_player_info
(
tduel
,
0
,
8000
,
5
,
1
);
...
...
gframe/tag_duel.cpp
View file @
3781c056
...
@@ -538,6 +538,11 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
...
@@ -538,6 +538,11 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
rh
.
base
.
version
=
PRO_VERSION
;
rh
.
base
.
version
=
PRO_VERSION
;
rh
.
base
.
flag
=
REPLAY_UNIFORM
|
REPLAY_TAG
;
rh
.
base
.
flag
=
REPLAY_UNIFORM
|
REPLAY_TAG
;
rh
.
base
.
start_time
=
(
uint32_t
)
std
::
time
(
nullptr
);
rh
.
base
.
start_time
=
(
uint32_t
)
std
::
time
(
nullptr
);
#ifdef YGOPRO_SERVER_MODE
if
(
pre_seed_specified
[
0
])
memcpy
(
rh
.
seed_sequence
,
pre_seed
[
0
],
SEED_COUNT
*
sizeof
(
uint32_t
));
else
#endif
for
(
auto
&
x
:
rh
.
seed_sequence
)
for
(
auto
&
x
:
rh
.
seed_sequence
)
x
=
rd
();
x
=
rd
();
mtrandom
rnd
(
rh
.
seed_sequence
,
SEED_COUNT
);
mtrandom
rnd
(
rh
.
seed_sequence
,
SEED_COUNT
);
...
...
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