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
49a77402
Commit
49a77402
authored
May 01, 2025
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/Fluorohydride/ygopro
into server
parents
7b0c09e8
4da80f72
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
472 additions
and
218 deletions
+472
-218
.gitignore
.gitignore
+2
-0
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
+2
-10
gframe/duelclient.cpp
gframe/duelclient.cpp
+6
-2
gframe/game.cpp
gframe/game.cpp
+34
-21
gframe/gframe.cpp
gframe/gframe.cpp
+5
-1
gframe/myfilesystem.h
gframe/myfilesystem.h
+18
-0
gframe/network.h
gframe/network.h
+1
-1
gframe/premake5.lua
gframe/premake5.lua
+0
-3
gframe/replay.cpp
gframe/replay.cpp
+3
-11
gframe/replay.h
gframe/replay.h
+7
-7
lflist.conf
lflist.conf
+228
-16
premake/event/premake5.lua
premake/event/premake5.lua
+1
-0
premake/irrlicht/defines.lua
premake/irrlicht/defines.lua
+0
-49
premake/irrlicht/premake5.lua
premake/irrlicht/premake5.lua
+148
-92
premake5.lua
premake5.lua
+0
-1
No files found.
.gitignore
View file @
49a77402
...
@@ -10,6 +10,8 @@
...
@@ -10,6 +10,8 @@
/pics
/pics
/replay
/replay
/single
/single
/sound
!/sound/files.txt
/WindBot
/WindBot
/cards.cdb
/cards.cdb
/error.log
/error.log
...
...
gframe/config.h
View file @
49a77402
...
@@ -72,6 +72,21 @@ inline FILE* mywfopen(const wchar_t* filename, const char* mode) {
...
@@ -72,6 +72,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
#if !defined(YGOPRO_SERVER_MODE) || defined(SERVER_ZIP_SUPPORT)
#if !defined(YGOPRO_SERVER_MODE) || defined(SERVER_ZIP_SUPPORT)
#include <irrlicht.h>
#include <irrlicht.h>
#endif
#endif
...
...
gframe/data_manager.cpp
View file @
49a77402
...
@@ -131,7 +131,7 @@ bool DataManager::LoadDB(const wchar_t* wfile) {
...
@@ -131,7 +131,7 @@ bool DataManager::LoadDB(const wchar_t* wfile) {
}
}
#ifndef YGOPRO_SERVER_MODE
#ifndef YGOPRO_SERVER_MODE
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
]{};
...
@@ -475,9 +475,7 @@ unsigned char* DataManager::ReadScriptFromIrrFS(const char* script_name, int* sl
...
@@ -475,9 +475,7 @@ unsigned char* DataManager::ReadScriptFromIrrFS(const char* script_name, int* sl
}
}
#endif //YGOPRO_SERVER_MODE
#endif //YGOPRO_SERVER_MODE
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 @
49a77402
...
@@ -12,7 +12,7 @@ DeckManager deckManager;
...
@@ -12,7 +12,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
]{};
char
str1
[
16
]{};
char
str1
[
16
]{};
...
@@ -340,15 +340,7 @@ bool DeckManager::SaveDeck(Deck& deck, const wchar_t* file) {
...
@@ -340,15 +340,7 @@ bool DeckManager::SaveDeck(Deck& deck, const wchar_t* file) {
return
true
;
return
true
;
}
}
bool
DeckManager
::
DeleteDeck
(
const
wchar_t
*
file
)
{
bool
DeckManager
::
DeleteDeck
(
const
wchar_t
*
file
)
{
#ifdef _WIN32
return
FileSystem
::
RemoveFile
(
file
);
BOOL
result
=
DeleteFileW
(
file
);
return
!!
result
;
#else
char
filefn
[
256
];
BufferIO
::
EncodeUTF8
(
file
,
filefn
);
int
result
=
unlink
(
filefn
);
return
result
==
0
;
#endif
}
}
bool
DeckManager
::
CreateCategory
(
const
wchar_t
*
name
)
{
bool
DeckManager
::
CreateCategory
(
const
wchar_t
*
name
)
{
if
(
!
FileSystem
::
IsDirExists
(
L"./deck"
)
&&
!
FileSystem
::
MakeDir
(
L"./deck"
))
if
(
!
FileSystem
::
IsDirExists
(
L"./deck"
)
&&
!
FileSystem
::
MakeDir
(
L"./deck"
))
...
...
gframe/duelclient.cpp
View file @
49a77402
...
@@ -3868,7 +3868,9 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
...
@@ -3868,7 +3868,9 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
break
;
break
;
}
}
case
MSG_RELOAD_FIELD
:
{
case
MSG_RELOAD_FIELD
:
{
mainGame
->
gMutex
.
lock
();
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
mainGame
->
gMutex
.
lock
();
}
mainGame
->
dField
.
Clear
();
mainGame
->
dField
.
Clear
();
mainGame
->
dInfo
.
duel_rule
=
BufferIO
::
ReadUInt8
(
pbuf
);
mainGame
->
dInfo
.
duel_rule
=
BufferIO
::
ReadUInt8
(
pbuf
);
int
val
=
0
;
int
val
=
0
;
...
@@ -3974,7 +3976,9 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
...
@@ -3974,7 +3976,9 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1609
),
dataManager
.
GetName
(
mainGame
->
dField
.
current_chain
.
code
));
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1609
),
dataManager
.
GetName
(
mainGame
->
dField
.
current_chain
.
code
));
mainGame
->
dField
.
last_chain
=
true
;
mainGame
->
dField
.
last_chain
=
true
;
}
}
mainGame
->
gMutex
.
unlock
();
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
mainGame
->
gMutex
.
unlock
();
}
break
;
break
;
}
}
}
}
...
...
gframe/game.cpp
View file @
49a77402
...
@@ -151,6 +151,9 @@ bool Game::Initialize() {
...
@@ -151,6 +151,9 @@ bool Game::Initialize() {
numFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
numfont
,
16
);
numFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
numfont
,
16
);
if
(
!
numFont
)
{
if
(
!
numFont
)
{
const
wchar_t
*
numFontPaths
[]
=
{
const
wchar_t
*
numFontPaths
[]
=
{
L"./fonts/numFont.ttf"
,
L"./fonts/numFont.ttc"
,
L"./fonts/numFont.otf"
,
L"C:/Windows/Fonts/arialbd.ttf"
,
L"C:/Windows/Fonts/arialbd.ttf"
,
L"/usr/share/fonts/truetype/DroidSansFallbackFull.ttf"
,
L"/usr/share/fonts/truetype/DroidSansFallbackFull.ttf"
,
L"/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc"
,
L"/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc"
,
...
@@ -158,9 +161,6 @@ bool Game::Initialize() {
...
@@ -158,9 +161,6 @@ bool Game::Initialize() {
L"/usr/share/fonts/noto-cjk/NotoSansCJK-Bold.ttc"
,
L"/usr/share/fonts/noto-cjk/NotoSansCJK-Bold.ttc"
,
L"/System/Library/Fonts/SFNSTextCondensed-Bold.otf"
,
L"/System/Library/Fonts/SFNSTextCondensed-Bold.otf"
,
L"/System/Library/Fonts/SFNS.ttf"
,
L"/System/Library/Fonts/SFNS.ttf"
,
L"./fonts/numFont.ttf"
,
L"./fonts/numFont.ttc"
,
L"./fonts/numFont.otf"
};
};
for
(
const
wchar_t
*
path
:
numFontPaths
)
{
for
(
const
wchar_t
*
path
:
numFontPaths
)
{
BufferIO
::
CopyWideString
(
path
,
gameConf
.
numfont
);
BufferIO
::
CopyWideString
(
path
,
gameConf
.
numfont
);
...
@@ -172,6 +172,9 @@ bool Game::Initialize() {
...
@@ -172,6 +172,9 @@ bool Game::Initialize() {
textFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
textfont
,
gameConf
.
textfontsize
);
textFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
textfont
,
gameConf
.
textfontsize
);
if
(
!
textFont
)
{
if
(
!
textFont
)
{
const
wchar_t
*
textFontPaths
[]
=
{
const
wchar_t
*
textFontPaths
[]
=
{
L"./fonts/textFont.ttf"
,
L"./fonts/textFont.ttc"
,
L"./fonts/textFont.otf"
,
L"C:/Windows/Fonts/msyh.ttc"
,
L"C:/Windows/Fonts/msyh.ttc"
,
L"C:/Windows/Fonts/msyh.ttf"
,
L"C:/Windows/Fonts/msyh.ttf"
,
L"C:/Windows/Fonts/simsun.ttc"
,
L"C:/Windows/Fonts/simsun.ttc"
,
...
@@ -183,9 +186,7 @@ bool Game::Initialize() {
...
@@ -183,9 +186,7 @@ bool Game::Initialize() {
L"/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc"
,
L"/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc"
,
L"/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc"
,
L"/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc"
,
L"/System/Library/Fonts/PingFang.ttc"
,
L"/System/Library/Fonts/PingFang.ttc"
,
L"./fonts/textFont.ttf"
,
L"/System/Library/Fonts/STHeiti Medium.ttc"
,
L"./fonts/textFont.ttc"
,
L"./fonts/textFont.otf"
};
};
for
(
const
wchar_t
*
path
:
textFontPaths
)
{
for
(
const
wchar_t
*
path
:
textFontPaths
)
{
BufferIO
::
CopyWideString
(
path
,
gameConf
.
textfont
);
BufferIO
::
CopyWideString
(
path
,
gameConf
.
textfont
);
...
@@ -203,7 +204,7 @@ bool Game::Initialize() {
...
@@ -203,7 +204,7 @@ bool Game::Initialize() {
}
}
});
});
if
(
fpath
[
0
]
==
0
)
{
if
(
fpath
[
0
]
==
0
)
{
ErrorLog
(
"
Failed to load font(s)!
"
);
ErrorLog
(
"
No fonts found! Please place appropriate font file in the fonts directory, or edit system.conf manually.
"
);
return
false
;
return
false
;
}
}
if
(
!
numFont
)
{
if
(
!
numFont
)
{
...
@@ -215,6 +216,10 @@ bool Game::Initialize() {
...
@@ -215,6 +216,10 @@ bool Game::Initialize() {
textFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
textfont
,
gameConf
.
textfontsize
);
textFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
textfont
,
gameConf
.
textfontsize
);
}
}
}
}
if
(
!
numFont
||
!
textFont
)
{
ErrorLog
(
"Failed to load font(s)!"
);
return
false
;
}
adFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
numfont
,
12
);
adFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
numfont
,
12
);
lpcFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
numfont
,
48
);
lpcFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
numfont
,
48
);
guiFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
textfont
,
gameConf
.
textfontsize
);
guiFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
textfont
,
gameConf
.
textfontsize
);
...
@@ -1331,7 +1336,7 @@ void Game::RefreshBot() {
...
@@ -1331,7 +1336,7 @@ void Game::RefreshBot() {
if
(
!
gameConf
.
enable_bot_mode
)
if
(
!
gameConf
.
enable_bot_mode
)
return
;
return
;
botInfo
.
clear
();
botInfo
.
clear
();
FILE
*
fp
=
std
::
fopen
(
"bot.conf"
,
"r"
);
FILE
*
fp
=
my
fopen
(
"bot.conf"
,
"r"
);
char
linebuf
[
256
]{};
char
linebuf
[
256
]{};
char
strbuf
[
256
]{};
char
strbuf
[
256
]{};
if
(
fp
)
{
if
(
fp
)
{
...
@@ -1384,7 +1389,7 @@ void Game::RefreshBot() {
...
@@ -1384,7 +1389,7 @@ void Game::RefreshBot() {
}
}
}
}
void
Game
::
LoadConfig
()
{
void
Game
::
LoadConfig
()
{
FILE
*
fp
=
std
::
fopen
(
"system.conf"
,
"r"
);
FILE
*
fp
=
my
fopen
(
"system.conf"
,
"r"
);
if
(
!
fp
)
if
(
!
fp
)
return
;
return
;
char
linebuf
[
CONFIG_LINE_SIZE
]{};
char
linebuf
[
CONFIG_LINE_SIZE
]{};
...
@@ -1402,14 +1407,6 @@ void Game::LoadConfig() {
...
@@ -1402,14 +1407,6 @@ void Game::LoadConfig() {
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"errorlog"
))
{
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"errorlog"
))
{
unsigned
int
val
=
std
::
strtol
(
valbuf
,
nullptr
,
10
);
unsigned
int
val
=
std
::
strtol
(
valbuf
,
nullptr
,
10
);
enable_log
=
val
&
0xff
;
enable_log
=
val
&
0xff
;
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"textfont"
))
{
int
textfontsize
=
0
;
if
(
std
::
sscanf
(
linebuf
,
"%63s = %959s %d"
,
strbuf
,
valbuf
,
&
textfontsize
)
!=
3
)
continue
;
gameConf
.
textfontsize
=
textfontsize
;
BufferIO
::
DecodeUTF8
(
valbuf
,
gameConf
.
textfont
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"numfont"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
gameConf
.
numfont
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"serverport"
))
{
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"serverport"
))
{
gameConf
.
serverport
=
std
::
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
serverport
=
std
::
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"lasthost"
))
{
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"lasthost"
))
{
...
@@ -1504,7 +1501,18 @@ void Game::LoadConfig() {
...
@@ -1504,7 +1501,18 @@ void Game::LoadConfig() {
// options allowing multiple words
// options allowing multiple words
if
(
std
::
sscanf
(
linebuf
,
"%63s = %959[^
\n
]"
,
strbuf
,
valbuf
)
!=
2
)
if
(
std
::
sscanf
(
linebuf
,
"%63s = %959[^
\n
]"
,
strbuf
,
valbuf
)
!=
2
)
continue
;
continue
;
if
(
!
std
::
strcmp
(
strbuf
,
"nickname"
))
{
if
(
!
std
::
strcmp
(
strbuf
,
"textfont"
))
{
char
*
last_space
=
std
::
strrchr
(
valbuf
,
' '
);
if
(
last_space
==
nullptr
)
continue
;
int
fontsize
=
std
::
strtol
(
last_space
+
1
,
nullptr
,
10
);
if
(
fontsize
>
0
)
gameConf
.
textfontsize
=
fontsize
;
*
last_space
=
0
;
BufferIO
::
DecodeUTF8
(
valbuf
,
gameConf
.
textfont
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"numfont"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
gameConf
.
numfont
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"nickname"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
gameConf
.
nickname
);
BufferIO
::
DecodeUTF8
(
valbuf
,
gameConf
.
nickname
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"gamename"
))
{
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"gamename"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
gameConf
.
gamename
);
BufferIO
::
DecodeUTF8
(
valbuf
,
gameConf
.
gamename
);
...
@@ -1522,7 +1530,7 @@ void Game::LoadConfig() {
...
@@ -1522,7 +1530,7 @@ void Game::LoadConfig() {
std
::
fclose
(
fp
);
std
::
fclose
(
fp
);
}
}
void
Game
::
SaveConfig
()
{
void
Game
::
SaveConfig
()
{
FILE
*
fp
=
std
::
fopen
(
"system.conf"
,
"w"
);
FILE
*
fp
=
my
fopen
(
"system.conf"
,
"w"
);
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
];
std
::
fprintf
(
fp
,
"use_d3d = %d
\n
"
,
gameConf
.
use_d3d
?
1
:
0
);
std
::
fprintf
(
fp
,
"use_d3d = %d
\n
"
,
gameConf
.
use_d3d
?
1
:
0
);
...
@@ -1765,7 +1773,7 @@ void Game::ClearChatMsg() {
...
@@ -1765,7 +1773,7 @@ void Game::ClearChatMsg() {
#endif //YGOPRO_SERVER_MODE
#endif //YGOPRO_SERVER_MODE
void
Game
::
AddDebugMsg
(
const
char
*
msg
)
{
void
Game
::
AddDebugMsg
(
const
char
*
msg
)
{
#ifdef YGOPRO_SERVER_MODE
#ifdef YGOPRO_SERVER_MODE
fprintf
(
stderr
,
"%s
\n
"
,
msg
);
std
::
fprintf
(
stderr
,
"%s
\n
"
,
msg
);
#else
#else
if
(
enable_log
&
0x1
)
{
if
(
enable_log
&
0x1
)
{
wchar_t
wbuf
[
1024
];
wchar_t
wbuf
[
1024
];
...
@@ -1781,7 +1789,12 @@ void Game::AddDebugMsg(const char* msg) {
...
@@ -1781,7 +1789,12 @@ void Game::AddDebugMsg(const char* msg) {
}
}
#ifndef YGOPRO_SERVER_MODE
#ifndef YGOPRO_SERVER_MODE
void
Game
::
ErrorLog
(
const
char
*
msg
)
{
void
Game
::
ErrorLog
(
const
char
*
msg
)
{
FILE
*
fp
=
std
::
fopen
(
"error.log"
,
"a"
);
#ifdef _WIN32
OutputDebugStringA
(
msg
);
#else
std
::
fprintf
(
stderr
,
"%s
\n
"
,
msg
);
#endif
FILE
*
fp
=
myfopen
(
"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 @
49a77402
...
@@ -25,8 +25,12 @@ void ClickButton(irr::gui::IGUIElement* btn) {
...
@@ -25,8 +25,12 @@ void ClickButton(irr::gui::IGUIElement* btn) {
#endif //YGOPRO_SERVER_MODE
#endif //YGOPRO_SERVER_MODE
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"
);
#elif defined(__APPLE__)
std
::
setlocale
(
LC_CTYPE
,
"UTF-8"
);
std
::
setlocale
(
LC_CTYPE
,
"UTF-8"
);
#elif !defined(_WIN32)
std
::
setlocale
(
LC_CTYPE
,
""
);
#endif
#endif
#if defined __APPLE__ && !defined YGOPRO_SERVER_MODE
#if defined __APPLE__ && !defined YGOPRO_SERVER_MODE
CFURLRef
bundle_url
=
CFBundleCopyBundleURL
(
CFBundleGetMainBundle
());
CFURLRef
bundle_url
=
CFBundleCopyBundleURL
(
CFBundleGetMainBundle
());
...
...
gframe/myfilesystem.h
View file @
49a77402
...
@@ -86,6 +86,14 @@ public:
...
@@ -86,6 +86,14 @@ public:
return
DeleteDir
(
wdir
);
return
DeleteDir
(
wdir
);
}
}
static
bool
RemoveFile
(
const
wchar_t
*
wfile
)
{
return
DeleteFileW
(
wfile
);
}
static
bool
RemoveFile
(
const
char
*
file
)
{
return
DeleteFileA
(
file
);
}
static
void
TraversalDir
(
const
wchar_t
*
wpath
,
const
std
::
function
<
void
(
const
wchar_t
*
,
bool
)
>&
cb
)
{
static
void
TraversalDir
(
const
wchar_t
*
wpath
,
const
std
::
function
<
void
(
const
wchar_t
*
,
bool
)
>&
cb
)
{
wchar_t
findstr
[
1024
];
wchar_t
findstr
[
1024
];
std
::
swprintf
(
findstr
,
sizeof
findstr
/
sizeof
findstr
[
0
],
L"%ls/*"
,
wpath
);
std
::
swprintf
(
findstr
,
sizeof
findstr
/
sizeof
findstr
[
0
],
L"%ls/*"
,
wpath
);
...
@@ -195,6 +203,16 @@ public:
...
@@ -195,6 +203,16 @@ public:
return
success
;
return
success
;
}
}
static
bool
RemoveFile
(
const
wchar_t
*
wfile
)
{
char
file
[
1024
];
BufferIO
::
EncodeUTF8
(
wfile
,
file
);
return
RemoveFile
(
file
);
}
static
bool
RemoveFile
(
const
char
*
file
)
{
return
unlink
(
file
)
==
0
;
}
#ifndef YGOPRO_SERVER_MODE
#ifndef YGOPRO_SERVER_MODE
struct
file_unit
{
struct
file_unit
{
std
::
string
filename
;
std
::
string
filename
;
...
...
gframe/network.h
View file @
49a77402
...
@@ -27,7 +27,7 @@ struct HostInfo {
...
@@ -27,7 +27,7 @@ struct HostInfo {
uint8_t
no_shuffle_deck
{};
uint8_t
no_shuffle_deck
{};
// byte padding[3]
// byte padding[3]
u
int32_t
start_lp
{};
int32_t
start_lp
{};
uint8_t
start_hand
{};
uint8_t
start_hand
{};
uint8_t
draw_count
{};
uint8_t
draw_count
{};
uint16_t
time_limit
{};
uint16_t
time_limit
{};
...
...
gframe/premake5.lua
View file @
49a77402
...
@@ -86,9 +86,6 @@ end
...
@@ -86,9 +86,6 @@ end
filter
"system:windows"
filter
"system:windows"
defines
{
"_IRR_WCHAR_FILESYSTEM"
}
defines
{
"_IRR_WCHAR_FILESYSTEM"
}
files
"ygopro.rc"
files
"ygopro.rc"
if
not
SERVER_MODE
then
libdirs
{
"$(DXSDK_DIR)Lib/x86"
}
end
if
SERVER_PRO2_SUPPORT
then
if
SERVER_PRO2_SUPPORT
then
targetname
(
"AI.Server"
)
targetname
(
"AI.Server"
)
end
end
...
...
gframe/replay.cpp
View file @
49a77402
...
@@ -48,9 +48,9 @@ void Replay::BeginRecord() {
...
@@ -48,9 +48,9 @@ void Replay::BeginRecord() {
strftime
(
tmppath
,
40
,
"./replay/%Y-%m-%d %H-%M-%S %%u.yrp"
,
localedtime
);
strftime
(
tmppath
,
40
,
"./replay/%Y-%m-%d %H-%M-%S %%u.yrp"
,
localedtime
);
char
path
[
40
];
char
path
[
40
];
sprintf
(
path
,
tmppath
,
server_port
);
sprintf
(
path
,
tmppath
,
server_port
);
fp
=
std
::
fopen
(
path
,
"wb"
);
fp
=
my
fopen
(
path
,
"wb"
);
#else
#else
fp
=
std
::
fopen
(
"./replay/_LastReplay.yrp"
,
"wb"
);
fp
=
my
fopen
(
"./replay/_LastReplay.yrp"
,
"wb"
);
#endif //YGOPRO_SERVER_MODE
#endif //YGOPRO_SERVER_MODE
if
(
!
fp
)
if
(
!
fp
)
return
;
return
;
...
@@ -199,15 +199,7 @@ bool Replay::CheckReplay(const wchar_t* name) {
...
@@ -199,15 +199,7 @@ bool Replay::CheckReplay(const wchar_t* name) {
bool
Replay
::
DeleteReplay
(
const
wchar_t
*
name
)
{
bool
Replay
::
DeleteReplay
(
const
wchar_t
*
name
)
{
wchar_t
fname
[
256
];
wchar_t
fname
[
256
];
myswprintf
(
fname
,
L"./replay/%ls"
,
name
);
myswprintf
(
fname
,
L"./replay/%ls"
,
name
);
#ifdef _WIN32
return
FileSystem
::
RemoveFile
(
fname
);
BOOL
result
=
DeleteFileW
(
fname
);
return
!!
result
;
#else
char
filefn
[
256
];
BufferIO
::
EncodeUTF8
(
fname
,
filefn
);
int
result
=
unlink
(
filefn
);
return
result
==
0
;
#endif
}
}
bool
Replay
::
RenameReplay
(
const
wchar_t
*
oldname
,
const
wchar_t
*
newname
)
{
bool
Replay
::
RenameReplay
(
const
wchar_t
*
oldname
,
const
wchar_t
*
newname
)
{
wchar_t
oldfname
[
256
];
wchar_t
oldfname
[
256
];
...
...
gframe/replay.h
View file @
49a77402
...
@@ -23,13 +23,13 @@ constexpr int MAX_COMP_SIZE = UINT16_MAX + 1;
...
@@ -23,13 +23,13 @@ constexpr int MAX_COMP_SIZE = UINT16_MAX + 1;
#endif // YGOPRO_SERVER_MODE
#endif // YGOPRO_SERVER_MODE
struct
ReplayHeader
{
struct
ReplayHeader
{
u
nsigned
in
t
id
{};
u
int32_
t
id
{};
u
nsigned
in
t
version
{};
u
int32_
t
version
{};
u
nsigned
in
t
flag
{};
u
int32_
t
flag
{};
u
nsigned
in
t
seed
{};
u
int32_
t
seed
{};
u
nsigned
in
t
datasize
{};
u
int32_
t
datasize
{};
u
nsigned
in
t
start_time
{};
u
int32_
t
start_time
{};
u
nsigned
char
props
[
8
]{};
u
int8_t
props
[
8
]{};
};
};
class
Replay
{
class
Replay
{
...
...
lflist.conf
View file @
49a77402
This diff is collapsed.
Click to expand it.
premake/event/premake5.lua
View file @
49a77402
...
@@ -11,3 +11,4 @@ project "event"
...
@@ -11,3 +11,4 @@ project "event"
filter
"system:windows"
filter
"system:windows"
prebuildcommands
{
"xcopy /E /Y $(ProjectDir)..\\event\\WIN32-Code $(ProjectDir)..\\event\\include"
}
prebuildcommands
{
"xcopy /E /Y $(ProjectDir)..\\event\\WIN32-Code $(ProjectDir)..\\event\\include"
}
files
{
"win32select.c"
,
"evthread_win32.c"
,
"buffer_iocp.c"
,
"event_iocp.c"
,
"bufferevent_async.c"
}
files
{
"win32select.c"
,
"evthread_win32.c"
,
"buffer_iocp.c"
,
"event_iocp.c"
,
"bufferevent_async.c"
}
defines
{
"WIN32"
}
-- quirk of old libevent
premake/irrlicht/defines.lua
deleted
100644 → 0
View file @
7b0c09e8
defines
{
"_IRR_STATIC_LIB_"
,
"NO_IRR_USE_NON_SYSTEM_BZLIB_"
,
"NO_IRR_COMPILE_WITH_BZIP2_"
,
"NO_IRR_COMPILE_WITH_CONSOLE_DEVICE_"
,
"NO_IRR_COMPILE_WITH_DIRECT3D_8_"
,
"NO_IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_"
,
"NO_IRR_COMPILE_WITH_JOYSTICK_EVENTS_"
,
"NO_IRR_COMPILE_WITH_SOFTWARE_"
,
"NO_IRR_COMPILE_WITH_BURNINGSVIDEO_"
,
"NO_IRR_COMPILE_WITH_IRR_SCENE_LOADER_"
,
"NO_IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_"
,
"NO_IRR_COMPILE_WITH_IRR_MESH_LOADER_"
,
"NO_IRR_COMPILE_WITH_HALFLIFE_LOADER_"
,
"NO_IRR_COMPILE_WITH_MD2_LOADER_"
,
"NO_IRR_COMPILE_WITH_MD3_LOADER_"
,
"NO_IRR_COMPILE_WITH_3DS_LOADER_"
,
"NO_IRR_COMPILE_WITH_COLLADA_LOADER_"
,
"NO_IRR_COMPILE_WITH_CSM_LOADER_"
,
"NO_IRR_COMPILE_WITH_BSP_LOADER_"
,
"NO_IRR_COMPILE_WITH_DMF_LOADER_"
,
"NO_IRR_COMPILE_WITH_LMTS_LOADER_"
,
"NO_IRR_COMPILE_WITH_MY3D_LOADER_"
,
"NO_IRR_COMPILE_WITH_OBJ_LOADER_"
,
"NO_IRR_COMPILE_WITH_OCT_LOADER_"
,
"NO_IRR_COMPILE_WITH_LWO_LOADER_"
,
"NO_IRR_COMPILE_WITH_STL_LOADER_"
,
"NO_IRR_COMPILE_WITH_PLY_LOADER_"
,
"NO_IRR_COMPILE_WITH_SMF_LOADER_"
,
"NO_IRR_COMPILE_WITH_IRR_WRITER_"
,
"NO_IRR_COMPILE_WITH_COLLADA_WRITER_"
,
"NO_IRR_COMPILE_WITH_STL_WRITER_"
,
"NO_IRR_COMPILE_WITH_OBJ_WRITER_"
,
"NO_IRR_COMPILE_WITH_PLY_WRITER_"
,
"NO_IRR_COMPILE_WITH_PCX_LOADER_"
,
"NO_IRR_COMPILE_WITH_PPM_LOADER_"
,
"NO_IRR_COMPILE_WITH_PSD_LOADER_"
,
"NO_IRR_COMPILE_WITH_TGA_LOADER_"
,
"NO_IRR_COMPILE_WITH_WAL_LOADER_"
,
"NO_IRR_COMPILE_WITH_LMP_LOADER_"
,
"NO_IRR_COMPILE_WITH_RGB_LOADER_"
,
"NO_IRR_COMPILE_WITH_PCX_WRITER_"
,
"NO_IRR_COMPILE_WITH_PPM_WRITER_"
,
"NO_IRR_COMPILE_WITH_PSD_WRITER_"
,
"NO_IRR_COMPILE_WITH_TGA_WRITER_"
,
"NO__IRR_COMPILE_WITH_PAK_ARCHIVE_LOADER_"
,
"NO__IRR_COMPILE_WITH_NPK_ARCHIVE_LOADER_"
,
"NO__IRR_COMPILE_WITH_WAD_ARCHIVE_LOADER_"
,
}
premake/irrlicht/premake5.lua
View file @
49a77402
This diff is collapsed.
Click to expand it.
premake5.lua
View file @
49a77402
...
@@ -229,7 +229,6 @@ workspace "YGOPro"
...
@@ -229,7 +229,6 @@ workspace "YGOPro"
end
end
filter
"system:windows"
filter
"system:windows"
defines
{
"WIN32"
,
"_WIN32"
}
entrypoint
"mainCRTStartup"
entrypoint
"mainCRTStartup"
systemversion
"latest"
systemversion
"latest"
startproject
"YGOPro"
startproject
"YGOPro"
...
...
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