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
64a26c4e
Commit
64a26c4e
authored
Jun 17, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into server-develop
parents
fbac61c4
67ffbd75
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
90 additions
and
1 deletion
+90
-1
gframe/game.cpp
gframe/game.cpp
+38
-0
gframe/game.h
gframe/game.h
+1
-0
gframe/network.h
gframe/network.h
+1
-0
gframe/replay_mode.cpp
gframe/replay_mode.cpp
+1
-0
gframe/single_duel.cpp
gframe/single_duel.cpp
+25
-0
gframe/single_mode.cpp
gframe/single_mode.cpp
+1
-0
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+22
-0
ocgcore
ocgcore
+1
-1
No files found.
gframe/game.cpp
View file @
64a26c4e
...
...
@@ -2669,5 +2669,43 @@ void Game::SetCursor(irr::gui::ECURSOR_ICON icon) {
}
}
#endif //YGOPRO_SERVER_MODE
void
Game
::
InjectEnvToRegistry
(
intptr_t
pduel
)
{
#ifdef _WIN32
LPTCH
env_strings
=
GetEnvironmentStringsA
();
if
(
!
env_strings
)
return
;
const
std
::
string
prefix
=
"YGOPRO_ENV_"
;
for
(
char
*
var
=
env_strings
;
*
var
;
var
+=
strlen
(
var
)
+
1
)
{
std
::
string
entry
(
var
);
if
(
entry
.
compare
(
0
,
prefix
.
size
(),
prefix
)
==
0
)
{
auto
eq_pos
=
entry
.
find
(
'='
);
if
(
eq_pos
==
std
::
string
::
npos
)
continue
;
std
::
string
name
=
entry
.
substr
(
0
,
eq_pos
);
std
::
string
value
=
entry
.
substr
(
eq_pos
+
1
);
std
::
string
key
=
"env_"
+
name
.
substr
(
prefix
.
size
());
set_registry_value
(
pduel
,
key
.
c_str
(),
value
.
c_str
());
}
}
FreeEnvironmentStringsA
(
env_strings
);
#else
const
std
::
string
prefix
=
"YGOPRO_ENV_"
;
for
(
char
**
env
=
environ
;
*
env
!=
nullptr
;
++
env
)
{
std
::
string
entry
(
*
env
);
if
(
entry
.
compare
(
0
,
prefix
.
size
(),
prefix
)
==
0
)
{
// 以 prefix 开头
auto
eq_pos
=
entry
.
find
(
'='
);
if
(
eq_pos
==
std
::
string
::
npos
)
continue
;
std
::
string
name
=
entry
.
substr
(
0
,
eq_pos
);
// YGOPRO_ENV_foo
std
::
string
value
=
entry
.
substr
(
eq_pos
+
1
);
// bar
std
::
string
key
=
"env_"
+
name
.
substr
(
prefix
.
size
());
// env_foo
set_registry_value
(
pduel
,
key
.
c_str
(),
value
.
c_str
());
}
}
#endif
}
}
gframe/game.h
View file @
64a26c4e
...
...
@@ -284,6 +284,7 @@ public:
void
FlashWindow
();
void
takeScreenshot
();
void
SetCursor
(
irr
::
gui
::
ECURSOR_ICON
icon
);
void
InjectEnvToRegistry
(
intptr_t
pduel
);
template
<
typename
T
>
static
void
DrawShadowText
(
irr
::
gui
::
CGUITTFont
*
font
,
const
T
&
text
,
const
irr
::
core
::
rect
<
irr
::
s32
>&
position
,
const
irr
::
core
::
rect
<
irr
::
s32
>&
padding
,
irr
::
video
::
SColor
color
=
0xffffffff
,
irr
::
video
::
SColor
shadowcolor
=
0xff000000
,
bool
hcenter
=
false
,
bool
vcenter
=
false
,
const
irr
::
core
::
rect
<
irr
::
s32
>*
clip
=
nullptr
);
...
...
gframe/network.h
View file @
64a26c4e
...
...
@@ -238,6 +238,7 @@ public:
intptr_t
pduel
{};
wchar_t
name
[
20
]{};
wchar_t
pass
[
20
]{};
std
::
vector
<
byte
>
registry_dump
;
};
}
...
...
gframe/replay_mode.cpp
View file @
64a26c4e
...
...
@@ -169,6 +169,7 @@ bool ReplayMode::StartDuel() {
BufferIO
::
CopyWideString
(
cur_replay
.
players
[
1
].
c_str
(),
mainGame
->
dInfo
.
clientname
);
}
pduel
=
create_duel
(
rnd
());
mainGame
->
InjectEnvToRegistry
(
pduel
);
mainGame
->
dInfo
.
duel_rule
=
cur_replay
.
params
.
duel_flag
>>
16
;
set_player_info
(
pduel
,
0
,
cur_replay
.
params
.
start_lp
,
cur_replay
.
params
.
start_hand
,
cur_replay
.
params
.
draw_count
);
set_player_info
(
pduel
,
1
,
cur_replay
.
params
.
start_lp
,
cur_replay
.
params
.
start_hand
,
cur_replay
.
params
.
draw_count
);
...
...
gframe/single_duel.cpp
View file @
64a26c4e
...
...
@@ -584,6 +584,28 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
set_card_reader
(
DataManager
::
CardReader
);
set_message_handler
(
SingleDuel
::
MessageHandler
);
pduel
=
create_duel
(
duel_seed
);
if
(
!
registry_dump
.
empty
())
{
load_registry
(
pduel
,
registry_dump
.
data
(),
(
int32_t
)
registry_dump
.
size
());
}
mainGame
->
InjectEnvToRegistry
(
pduel
);
set_registry_value
(
pduel
,
"duel_mode"
,
match_mode
?
"match"
:
"single"
);
if
(
match_mode
)
{
set_registry_value
(
pduel
,
"duel_count"
,
std
::
to_string
(
duel_count
).
c_str
());
}
set_registry_value
(
pduel
,
"start_lp"
,
std
::
to_string
(
host_info
.
start_lp
).
c_str
());
set_registry_value
(
pduel
,
"start_hand"
,
std
::
to_string
(
host_info
.
start_hand
).
c_str
());
set_registry_value
(
pduel
,
"draw_count"
,
std
::
to_string
(
host_info
.
draw_count
).
c_str
());
wchar_t
player_name_buf
[
40
];
char
player_name_buf_u
[
40
];
char
player_key_buf
[
15
];
for
(
int
i
=
0
;
i
<
2
;
++
i
)
{
BufferIO
::
CopyCharArray
(
players
[
i
]
->
name
,
player_name_buf
);
BufferIO
::
EncodeUTF8
(
player_name_buf
,
player_name_buf_u
);
std
::
snprintf
(
player_key_buf
,
sizeof
(
player_key_buf
),
"player_name_%d"
,
i
);
set_registry_value
(
pduel
,
player_key_buf
,
player_name_buf_u
);
std
::
snprintf
(
player_key_buf
,
sizeof
(
player_key_buf
),
"player_type_%d"
,
i
);
set_registry_value
(
pduel
,
player_key_buf
,
std
::
to_string
(
players
[
i
]
->
type
).
c_str
());
}
set_player_info
(
pduel
,
0
,
host_info
.
start_lp
,
host_info
.
start_hand
,
host_info
.
draw_count
);
set_player_info
(
pduel
,
1
,
host_info
.
start_lp
,
host_info
.
start_hand
,
host_info
.
draw_count
);
preload_script
(
pduel
,
"./script/special.lua"
);
...
...
@@ -1887,6 +1909,9 @@ void SingleDuel::EndDuel() {
for
(
auto
oit
=
observers
.
begin
();
oit
!=
observers
.
end
();
++
oit
)
NetServer
::
ReSendToPlayer
(
*
oit
);
#endif //YGOPRO_SERVER_MODE
registry_dump
.
resize
(
0x2000
);
int
len
=
dump_registry
(
pduel
,
registry_dump
.
data
());
registry_dump
.
resize
(
len
);
end_duel
(
pduel
);
event_del
(
etimer
);
pduel
=
0
;
...
...
gframe/single_mode.cpp
View file @
64a26c4e
...
...
@@ -42,6 +42,7 @@ int SingleMode::SinglePlayThread() {
set_card_reader
(
DataManager
::
CardReader
);
set_message_handler
(
SingleMode
::
MessageHandler
);
pduel
=
create_duel
(
rnd
.
rand
());
mainGame
->
InjectEnvToRegistry
(
pduel
);
set_player_info
(
pduel
,
0
,
start_lp
,
start_hand
,
draw_count
);
set_player_info
(
pduel
,
1
,
start_lp
,
start_hand
,
draw_count
);
preload_script
(
pduel
,
"./script/special.lua"
);
...
...
gframe/tag_duel.cpp
View file @
64a26c4e
...
...
@@ -565,6 +565,25 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
set_card_reader
(
DataManager
::
CardReader
);
set_message_handler
(
TagDuel
::
MessageHandler
);
pduel
=
create_duel
(
duel_seed
);
if
(
!
registry_dump
.
empty
())
{
load_registry
(
pduel
,
registry_dump
.
data
(),
(
int32_t
)
registry_dump
.
size
());
}
mainGame
->
InjectEnvToRegistry
(
pduel
);
set_registry_value
(
pduel
,
"duel_mode"
,
"tag"
);
set_registry_value
(
pduel
,
"start_lp"
,
std
::
to_string
(
host_info
.
start_lp
).
c_str
());
set_registry_value
(
pduel
,
"start_hand"
,
std
::
to_string
(
host_info
.
start_hand
).
c_str
());
set_registry_value
(
pduel
,
"draw_count"
,
std
::
to_string
(
host_info
.
draw_count
).
c_str
());
wchar_t
player_name_buf
[
40
];
char
player_name_buf_u
[
40
];
char
player_key_buf
[
15
];
for
(
int
i
=
0
;
i
<
2
;
++
i
)
{
BufferIO
::
CopyCharArray
(
players
[
i
]
->
name
,
player_name_buf
);
BufferIO
::
EncodeUTF8
(
player_name_buf
,
player_name_buf_u
);
std
::
snprintf
(
player_key_buf
,
sizeof
(
player_key_buf
),
"player_name_%d"
,
i
);
set_registry_value
(
pduel
,
player_key_buf
,
player_name_buf_u
);
std
::
snprintf
(
player_key_buf
,
sizeof
(
player_key_buf
),
"player_type_%d"
,
i
);
set_registry_value
(
pduel
,
player_key_buf
,
std
::
to_string
(
players
[
i
]
->
type
).
c_str
());
}
set_player_info
(
pduel
,
0
,
host_info
.
start_lp
,
host_info
.
start_hand
,
host_info
.
draw_count
);
set_player_info
(
pduel
,
1
,
host_info
.
start_lp
,
host_info
.
start_hand
,
host_info
.
draw_count
);
preload_script
(
pduel
,
"./script/special.lua"
);
...
...
@@ -1981,6 +2000,9 @@ void TagDuel::EndDuel() {
for
(
auto
oit
=
observers
.
begin
();
oit
!=
observers
.
end
();
++
oit
)
NetServer
::
ReSendToPlayer
(
*
oit
);
#endif
registry_dump
.
resize
(
0x2000
);
int
len
=
dump_registry
(
pduel
,
registry_dump
.
data
());
registry_dump
.
resize
(
len
);
end_duel
(
pduel
);
event_del
(
etimer
);
pduel
=
0
;
...
...
ocgcore
@
7e4dcb52
Subproject commit
ee1548f719cd4d371ae687fb623fac75bd8a64f4
Subproject commit
7e4dcb52699be7631d0abcc9617c7276bb3cc50d
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