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
f92244e3
Commit
f92244e3
authored
Jun 17, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into server-develop
parents
9d50c0c3
9e22a70e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
13 deletions
+23
-13
gframe/game.cpp
gframe/game.cpp
+23
-13
No files found.
gframe/game.cpp
View file @
f92244e3
...
@@ -2671,25 +2671,35 @@ void Game::SetCursor(irr::gui::ECURSOR_ICON icon) {
...
@@ -2671,25 +2671,35 @@ void Game::SetCursor(irr::gui::ECURSOR_ICON icon) {
#endif //YGOPRO_SERVER_MODE
#endif //YGOPRO_SERVER_MODE
void Game::InjectEnvToRegistry(intptr_t pduel) {
void Game::InjectEnvToRegistry(intptr_t pduel) {
#ifdef _WIN32
#ifdef _WIN32
auto env_strings = GetEnvironmentStringsA
();
LPWCH env_block = GetEnvironmentStringsW
();
if (!env_
strings
) return;
if (!env_
block
) return;
const std::string prefix = "YGOPRO_ENV_";
const wchar_t* prefix = L"YGOPRO_ENV_";
for (auto* var = env_strings; *var; var += strlen(var) + 1) {
const size_t prefix_len = wcslen(prefix);
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);
for (LPWCH var = env_block; *var != L'\0'; ) {
std::string value = entry.substr(eq_pos + 1);
// 是 YGOPRO_ENV_ 开头
if (wcsncmp(var, prefix, prefix_len) == 0) {
const wchar_t* equal_pos = wcschr(var, L'=');
if (equal_pos && equal_pos > var + prefix_len) {
// 拆 key 和 value(UTF-16)
std::wstring key_w(var + prefix_len, equal_pos); // foo
std::wstring value_w(equal_pos + 1); // bar
std::string key = "env_" + name.substr(prefix.size());
char key_utf8[256]{};
set_registry_value(pduel, key.c_str(), value.c_str());
char value_utf8[1024]{};
// 转成 UTF-8:key = env_foo
BufferIO::EncodeUTF8((L"env_" + key_w).c_str(), key_utf8);
BufferIO::EncodeUTF8(value_w.c_str(), value_utf8);
set_registry_value(pduel, key_utf8, value_utf8);
}
}
}
var += wcslen(var) + 1;
}
}
FreeEnvironmentStrings
A(env_strings
);
FreeEnvironmentStrings
W(env_block
);
#else
#else
const std::string prefix = "YGOPRO_ENV_";
const std::string prefix = "YGOPRO_ENV_";
for (char** env = environ; *env != nullptr; ++env) {
for (char** env = environ; *env != nullptr; ++env) {
...
...
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