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
1
Merge Requests
1
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
67ffbd75
Commit
67ffbd75
authored
Jun 17, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add YGOPRO_ENV_foo=bar to env_bar injection
parent
eb133fef
Pipeline
#37737
failed with stages
in 6 minutes
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
0 deletions
+43
-0
gframe/game.cpp
gframe/game.cpp
+38
-0
gframe/game.h
gframe/game.h
+1
-0
gframe/replay_mode.cpp
gframe/replay_mode.cpp
+1
-0
gframe/single_duel.cpp
gframe/single_duel.cpp
+1
-0
gframe/single_mode.cpp
gframe/single_mode.cpp
+1
-0
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+1
-0
No files found.
gframe/game.cpp
View file @
67ffbd75
...
...
@@ -2545,5 +2545,43 @@ void Game::SetCursor(irr::gui::ECURSOR_ICON icon) {
cursor
->
setActiveIcon
(
icon
);
}
}
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 @
67ffbd75
...
...
@@ -269,6 +269,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/replay_mode.cpp
View file @
67ffbd75
...
...
@@ -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 @
67ffbd75
...
...
@@ -439,6 +439,7 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
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
());
...
...
gframe/single_mode.cpp
View file @
67ffbd75
...
...
@@ -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 @
67ffbd75
...
...
@@ -416,6 +416,7 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
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
());
...
...
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