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
df79cc30
Commit
df79cc30
authored
Apr 10, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'patch-myfopen' of github.com:mercury233/ygopro into develop
parents
b6437560
dd96a75a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
14 deletions
+31
-14
gframe/config.h
gframe/config.h
+15
-0
gframe/data_manager.cpp
gframe/data_manager.cpp
+2
-4
gframe/deck_manager.cpp
gframe/deck_manager.cpp
+1
-1
gframe/game.cpp
gframe/game.cpp
+6
-6
gframe/gframe.cpp
gframe/gframe.cpp
+6
-2
gframe/replay.cpp
gframe/replay.cpp
+1
-1
No files found.
gframe/config.h
View file @
df79cc30
...
@@ -79,6 +79,21 @@ inline FILE* mywfopen(const wchar_t* filename, const char* mode) {
...
@@ -79,6 +79,21 @@ inline FILE* mywfopen(const wchar_t* filename, const char* mode) {
return
fp
;
return
fp
;
}
}
#if !defined(_WIN32)
#define myfopen std::fopen
#elif defined(WDK_NTDDI_VERSION) && (WDK_NTDDI_VERSION >= 0x0A000005) // Redstone 4, Version 1803, Build 17134.
#define FOPEN_WINDOWS_SUPPORT_UTF8
#define myfopen std::fopen
#else
inline
FILE
*
myfopen
(
const
char
*
filename
,
const
char
*
mode
)
{
wchar_t
wfilename
[
256
]{};
BufferIO
::
DecodeUTF8
(
filename
,
wfilename
);
wchar_t
wmode
[
20
]{};
BufferIO
::
CopyCharArray
(
mode
,
wmode
);
return
_wfopen
(
wfilename
,
wmode
);
}
#endif
#include <irrlicht.h>
#include <irrlicht.h>
extern
unsigned
short
PRO_VERSION
;
extern
unsigned
short
PRO_VERSION
;
...
...
gframe/data_manager.cpp
View file @
df79cc30
...
@@ -108,7 +108,7 @@ bool DataManager::LoadDB(const wchar_t* wfile) {
...
@@ -108,7 +108,7 @@ bool DataManager::LoadDB(const wchar_t* wfile) {
return
ret
;
return
ret
;
}
}
bool
DataManager
::
LoadStrings
(
const
char
*
file
)
{
bool
DataManager
::
LoadStrings
(
const
char
*
file
)
{
FILE
*
fp
=
std
::
fopen
(
file
,
"r"
);
FILE
*
fp
=
my
fopen
(
file
,
"r"
);
if
(
!
fp
)
if
(
!
fp
)
return
false
;
return
false
;
char
linebuf
[
TEXT_LINE_SIZE
]{};
char
linebuf
[
TEXT_LINE_SIZE
]{};
...
@@ -437,9 +437,7 @@ unsigned char* DataManager::ReadScriptFromIrrFS(const char* script_name, int* sl
...
@@ -437,9 +437,7 @@ unsigned char* DataManager::ReadScriptFromIrrFS(const char* script_name, int* sl
return
scriptBuffer
;
return
scriptBuffer
;
}
}
unsigned
char
*
DataManager
::
ReadScriptFromFile
(
const
char
*
script_name
,
int
*
slen
)
{
unsigned
char
*
DataManager
::
ReadScriptFromFile
(
const
char
*
script_name
,
int
*
slen
)
{
wchar_t
fname
[
256
]{};
FILE
*
fp
=
myfopen
(
script_name
,
"rb"
);
BufferIO
::
DecodeUTF8
(
script_name
,
fname
);
FILE
*
fp
=
mywfopen
(
fname
,
"rb"
);
if
(
!
fp
)
if
(
!
fp
)
return
nullptr
;
return
nullptr
;
size_t
len
=
std
::
fread
(
scriptBuffer
,
1
,
sizeof
scriptBuffer
,
fp
);
size_t
len
=
std
::
fread
(
scriptBuffer
,
1
,
sizeof
scriptBuffer
,
fp
);
...
...
gframe/deck_manager.cpp
View file @
df79cc30
...
@@ -11,7 +11,7 @@ DeckManager deckManager;
...
@@ -11,7 +11,7 @@ DeckManager deckManager;
void
DeckManager
::
LoadLFListSingle
(
const
char
*
path
)
{
void
DeckManager
::
LoadLFListSingle
(
const
char
*
path
)
{
auto
cur
=
_lfList
.
rend
();
auto
cur
=
_lfList
.
rend
();
FILE
*
fp
=
std
::
fopen
(
path
,
"r"
);
FILE
*
fp
=
my
fopen
(
path
,
"r"
);
char
linebuf
[
256
]{};
char
linebuf
[
256
]{};
wchar_t
strBuffer
[
256
]{};
wchar_t
strBuffer
[
256
]{};
if
(
fp
)
{
if
(
fp
)
{
...
...
gframe/game.cpp
View file @
df79cc30
...
@@ -1389,9 +1389,9 @@ void Game::RefreshBot() {
...
@@ -1389,9 +1389,9 @@ void Game::RefreshBot() {
if
(
!
gameConf
.
enable_bot_mode
)
if
(
!
gameConf
.
enable_bot_mode
)
return
;
return
;
botInfo
.
clear
();
botInfo
.
clear
();
FILE
*
fp
=
std
::
fopen
(
GetLocaleDir
(
"bot.conf"
),
"r"
);
FILE
*
fp
=
my
fopen
(
GetLocaleDir
(
"bot.conf"
),
"r"
);
if
(
!
fp
)
if
(
!
fp
)
fp
=
std
::
fopen
(
"bot.conf"
,
"r"
);
fp
=
my
fopen
(
"bot.conf"
,
"r"
);
char
linebuf
[
256
]{};
char
linebuf
[
256
]{};
char
strbuf
[
256
]{};
char
strbuf
[
256
]{};
if
(
fp
)
{
if
(
fp
)
{
...
@@ -1452,7 +1452,7 @@ void Game::RefreshBot() {
...
@@ -1452,7 +1452,7 @@ void Game::RefreshBot() {
}
}
}
}
bool
Game
::
LoadConfigFromFile
(
const
char
*
file
)
{
bool
Game
::
LoadConfigFromFile
(
const
char
*
file
)
{
FILE
*
fp
=
std
::
fopen
(
file
,
"r"
);
FILE
*
fp
=
my
fopen
(
file
,
"r"
);
if
(
!
fp
){
if
(
!
fp
){
return
false
;
return
false
;
}
}
...
@@ -1725,9 +1725,9 @@ void Game::LoadConfig() {
...
@@ -1725,9 +1725,9 @@ void Game::LoadConfig() {
}
}
void
Game
::
SaveConfig
()
{
void
Game
::
SaveConfig
()
{
#ifdef YGOPRO_COMPAT_MYCARD
#ifdef YGOPRO_COMPAT_MYCARD
FILE
*
fp
=
std
::
fopen
(
"system.conf"
,
"w"
);
FILE
*
fp
=
my
fopen
(
"system.conf"
,
"w"
);
#else
#else
FILE
*
fp
=
std
::
fopen
(
"system_user.conf"
,
"w"
);
FILE
*
fp
=
my
fopen
(
"system_user.conf"
,
"w"
);
#endif //YGOPRO_COMPAT_MYCARD
#endif //YGOPRO_COMPAT_MYCARD
std
::
fprintf
(
fp
,
"#config file
\n
#nickname & gamename should be less than 20 characters
\n
"
);
std
::
fprintf
(
fp
,
"#config file
\n
#nickname & gamename should be less than 20 characters
\n
"
);
char
linebuf
[
CONFIG_LINE_SIZE
];
char
linebuf
[
CONFIG_LINE_SIZE
];
...
@@ -1993,7 +1993,7 @@ void Game::AddDebugMsg(const char* msg) {
...
@@ -1993,7 +1993,7 @@ void Game::AddDebugMsg(const char* msg) {
}
}
}
}
void
Game
::
ErrorLog
(
const
char
*
msg
)
{
void
Game
::
ErrorLog
(
const
char
*
msg
)
{
FILE
*
fp
=
std
::
fopen
(
"error.log"
,
"a"
);
FILE
*
fp
=
my
fopen
(
"error.log"
,
"a"
);
if
(
!
fp
)
if
(
!
fp
)
return
;
return
;
time_t
nowtime
=
std
::
time
(
nullptr
);
time_t
nowtime
=
std
::
time
(
nullptr
);
...
...
gframe/gframe.cpp
View file @
df79cc30
...
@@ -25,8 +25,12 @@ void ClickButton(irr::gui::IGUIElement* btn) {
...
@@ -25,8 +25,12 @@ void ClickButton(irr::gui::IGUIElement* btn) {
}
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
#ifndef _WIN32
#if defined(FOPEN_WINDOWS_SUPPORT_UTF8)
std
::
setlocale
(
LC_CTYPE
,
"UTF-8"
);
std
::
setlocale
(
LC_CTYPE
,
".UTF-8"
);
#elif defined(__APPLE__)
std
::
setlocale
(
LC_CTYPE
,
"C.UTF-8"
);
#elif !defined(_WIN32)
std
::
setlocale
(
LC_CTYPE
,
""
);
#endif
#endif
#ifdef __APPLE__
#ifdef __APPLE__
CFURLRef
bundle_url
=
CFBundleCopyBundleURL
(
CFBundleGetMainBundle
());
CFURLRef
bundle_url
=
CFBundleCopyBundleURL
(
CFBundleGetMainBundle
());
...
...
gframe/replay.cpp
View file @
df79cc30
...
@@ -24,7 +24,7 @@ void Replay::BeginRecord() {
...
@@ -24,7 +24,7 @@ void Replay::BeginRecord() {
#else
#else
if
(
is_recording
)
if
(
is_recording
)
std
::
fclose
(
fp
);
std
::
fclose
(
fp
);
fp
=
std
::
fopen
(
"./replay/_LastReplay.yrp"
,
"wb"
);
fp
=
my
fopen
(
"./replay/_LastReplay.yrp"
,
"wb"
);
if
(
!
fp
)
if
(
!
fp
)
return
;
return
;
#endif
#endif
...
...
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