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
REIKAI
ygopro
Commits
c23c19fa
Commit
c23c19fa
authored
Nov 12, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
merge subdir in server
parents
d0417aae
de3fe3f2
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
99 additions
and
289 deletions
+99
-289
gframe/data_manager.cpp
gframe/data_manager.cpp
+6
-0
gframe/deck_manager.cpp
gframe/deck_manager.cpp
+12
-33
gframe/deck_manager.h
gframe/deck_manager.h
+0
-1
gframe/game.cpp
gframe/game.cpp
+18
-92
gframe/game.h
gframe/game.h
+0
-1
gframe/image_manager.cpp
gframe/image_manager.cpp
+22
-36
gframe/replay_mode.cpp
gframe/replay_mode.cpp
+10
-31
gframe/single_duel.cpp
gframe/single_duel.cpp
+10
-31
gframe/single_mode.cpp
gframe/single_mode.cpp
+11
-33
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+10
-31
No files found.
gframe/data_manager.cpp
View file @
c23c19fa
...
...
@@ -71,7 +71,13 @@ bool DataManager::LoadDB(const char* file) {
return
true
;
}
bool
DataManager
::
LoadStrings
(
const
char
*
file
)
{
#ifdef _WIN32
wchar_t
fname
[
1024
];
BufferIO
::
DecodeUTF8
(
file
,
fname
);
FILE
*
fp
=
_wfopen
(
fname
,
L"r"
);
#else
FILE
*
fp
=
fopen
(
file
,
"r"
);
#endif // _WIN32
if
(
!
fp
)
return
false
;
char
linebuf
[
256
];
...
...
gframe/deck_manager.cpp
View file @
c23c19fa
...
...
@@ -13,7 +13,13 @@ DeckManager deckManager;
void
DeckManager
::
LoadLFListSingle
(
const
char
*
path
)
{
LFList
*
cur
=
NULL
;
#ifdef _WIN32
wchar_t
fname
[
1024
];
BufferIO
::
DecodeUTF8
(
path
,
fname
);
FILE
*
fp
=
_wfopen
(
fname
,
L"r"
);
#else
FILE
*
fp
=
fopen
(
path
,
"r"
);
#endif // _WIN32
char
linebuf
[
256
];
wchar_t
strBuffer
[
256
];
if
(
fp
)
{
...
...
@@ -52,42 +58,15 @@ void DeckManager::LoadLFListSingle(const char* path) {
fclose
(
fp
);
}
}
void
DeckManager
::
LoadLFListDirectry
(
const
char
*
path
)
{
char
fpath
[
1000
];
sprintf
(
fpath
,
"%s/lflist.conf"
,
path
);
LoadLFListSingle
(
fpath
);
}
void
DeckManager
::
LoadLFList
()
{
LoadLFListSingle
(
"expansions/lflist.conf"
);
#ifdef _WIN32
char
fpath
[
1000
];
WIN32_FIND_DATAW
fdataw
;
HANDLE
fh
=
FindFirstFileW
(
L"./expansions/*"
,
&
fdataw
);
if
(
fh
!=
INVALID_HANDLE_VALUE
)
{
do
{
if
(
wcscmp
(
L"."
,
fdataw
.
cFileName
)
!=
0
&&
wcscmp
(
L".."
,
fdataw
.
cFileName
)
!=
0
&&
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
{
char
fname
[
780
];
BufferIO
::
EncodeUTF8
(
fdataw
.
cFileName
,
fname
);
sprintf
(
fpath
,
"./expansions/%s"
,
fname
);
LoadLFListDirectry
(
fpath
);
}
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
}
#else
DIR
*
dir
;
struct
dirent
*
dirp
;
if
((
dir
=
opendir
(
"./expansions/"
))
!=
NULL
)
{
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
if
(
strcmp
(
"."
,
dirp
->
d_name
)
==
0
||
strcmp
(
".."
,
dirp
->
d_name
)
==
0
||
dirp
->
d_type
!=
DT_DIR
)
continue
;
char
filepath
[
1000
];
sprintf
(
filepath
,
"./expansions/%s"
,
dirp
->
d_name
);
LoadLFListDirectry
(
filepath
);
FileSystem
::
TraversalDir
(
"./expansions"
,
[
this
](
const
char
*
name
,
bool
isdir
)
{
if
(
isdir
&&
strcmp
(
name
,
"."
)
&&
strcmp
(
name
,
".."
))
{
char
fpath
[
1024
];
sprintf
(
fpath
,
"./expansions/%s/lflist.conf"
,
name
);
LoadLFListSingle
(
fpath
);
}
closedir
(
dir
);
}
#endif
});
LoadLFListSingle
(
"lflist.conf"
);
LFList
nolimit
;
myswprintf
(
nolimit
.
listName
,
L"N/A"
);
...
...
gframe/deck_manager.h
View file @
c23c19fa
...
...
@@ -36,7 +36,6 @@ public:
std
::
vector
<
LFList
>
_lfList
;
void
LoadLFListSingle
(
const
char
*
path
);
void
LoadLFListDirectry
(
const
char
*
path
);
void
LoadLFList
();
wchar_t
*
GetLFListName
(
int
lfhash
);
int
CheckDeck
(
Deck
&
deck
,
int
lfhash
,
bool
allow_ocg
,
bool
allow_tcg
);
...
...
gframe/game.cpp
View file @
c23c19fa
...
...
@@ -1045,107 +1045,33 @@ void Game::SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gu
#endif //YGOPRO_SERVER_MODE
void
Game
::
LoadExpansionDB
()
{
LoadExpansionDBDirectry
(
"./expansions"
);
#ifdef _WIN32
char
fpath
[
1000
];
WIN32_FIND_DATAW
fdataw
;
HANDLE
fh
=
FindFirstFileW
(
L"./expansions/*"
,
&
fdataw
);
if
(
fh
!=
INVALID_HANDLE_VALUE
)
{
do
{
if
(
wcscmp
(
L"."
,
fdataw
.
cFileName
)
!=
0
&&
wcscmp
(
L".."
,
fdataw
.
cFileName
)
!=
0
&&
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
{
char
fname
[
780
];
BufferIO
::
EncodeUTF8
(
fdataw
.
cFileName
,
fname
);
sprintf
(
fpath
,
"./expansions/%s"
,
fname
);
LoadExpansionDBDirectry
(
fpath
);
}
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
}
#else
DIR
*
dir
;
struct
dirent
*
dirp
;
if
((
dir
=
opendir
(
"./expansions/"
))
!=
NULL
)
{
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
if
(
strcmp
(
"."
,
dirp
->
d_name
)
==
0
||
strcmp
(
".."
,
dirp
->
d_name
)
==
0
||
dirp
->
d_type
!=
DT_DIR
)
continue
;
char
filepath
[
1000
];
sprintf
(
filepath
,
"./expansions/%s/"
,
dirp
->
d_name
);
LoadExpansionDBDirectry
(
filepath
);
FileSystem
::
TraversalDir
(
"./expansions"
,
[
this
](
const
char
*
name
,
bool
isdir
)
{
if
(
isdir
&&
strcmp
(
name
,
"."
)
&&
strcmp
(
name
,
".."
))
{
char
subdir
[
1024
];
sprintf
(
subdir
,
"./expansions/%s"
,
name
);
LoadExpansionDBDirectry
(
subdir
);
}
closedir
(
dir
);
}
#endif
});
}
void
Game
::
LoadExpansionDBDirectry
(
const
char
*
path
)
{
#ifdef _WIN32
char
fpath
[
1000
];
wchar_t
wpath1
[
1000
];
wchar_t
wpath2
[
1000
];
BufferIO
::
DecodeUTF8
(
path
,
wpath1
);
myswprintf
(
wpath2
,
L"%ls/*.cdb"
,
wpath1
);
WIN32_FIND_DATAW
fdataw
;
HANDLE
fh
=
FindFirstFileW
(
wpath2
,
&
fdataw
);
if
(
fh
!=
INVALID_HANDLE_VALUE
)
{
do
{
if
(
!
(
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
))
{
char
fname
[
780
];
BufferIO
::
EncodeUTF8
(
fdataw
.
cFileName
,
fname
);
sprintf
(
fpath
,
"%s/%s"
,
path
,
fname
);
dataManager
.
LoadDB
(
fpath
);
}
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
}
#else
DIR
*
dir
;
struct
dirent
*
dirp
;
if
((
dir
=
opendir
(
path
))
!=
NULL
)
{
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
size_t
len
=
strlen
(
dirp
->
d_name
);
if
(
len
<
5
||
strcasecmp
(
dirp
->
d_name
+
len
-
4
,
".cdb"
)
!=
0
)
continue
;
char
filepath
[
1000
];
sprintf
(
filepath
,
"%s/%s"
,
path
,
dirp
->
d_name
);
dataManager
.
LoadDB
(
filepath
);
FileSystem
::
TraversalDir
(
path
,
[
path
](
const
char
*
name
,
bool
isdir
)
{
if
(
!
isdir
&&
strrchr
(
name
,
'.'
)
&&
!
mystrncasecmp
(
strrchr
(
name
,
'.'
),
".cdb"
,
4
))
{
char
fpath
[
1024
];
sprintf
(
fpath
,
"%s/%s"
,
path
,
name
);
dataManager
.
LoadDB
(
fpath
);
}
});
}
#ifndef YGOPRO_SERVER_MODE
void
Game
::
LoadExpansionStrings
()
{
LoadExpansionStringsDirectry
(
"./expansions"
);
#ifdef _WIN32
char
fpath
[
1000
];
WIN32_FIND_DATAW
fdataw
;
HANDLE
fh
=
FindFirstFileW
(
L"./expansions/*"
,
&
fdataw
);
if
(
fh
!=
INVALID_HANDLE_VALUE
)
{
do
{
if
(
wcscmp
(
L"."
,
fdataw
.
cFileName
)
!=
0
&&
wcscmp
(
L".."
,
fdataw
.
cFileName
)
!=
0
&&
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
{
char
fname
[
780
];
BufferIO
::
EncodeUTF8
(
fdataw
.
cFileName
,
fname
);
sprintf
(
fpath
,
"./expansions/%s"
,
fname
);
LoadExpansionStringsDirectry
(
fpath
);
}
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
}
#else
DIR
*
dir
;
struct
dirent
*
dirp
;
if
((
dir
=
opendir
(
"./expansions/"
))
!=
NULL
)
{
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
if
(
strcmp
(
"."
,
dirp
->
d_name
)
==
0
||
strcmp
(
".."
,
dirp
->
d_name
)
==
0
||
dirp
->
d_type
!=
DT_DIR
)
continue
;
char
filepath
[
1000
];
sprintf
(
filepath
,
"./expansions/%s/"
,
dirp
->
d_name
);
LoadExpansionStringsDirectry
(
filepath
);
dataManager
.
LoadStrings
(
"./expansions/strings.conf"
);
FileSystem
::
TraversalDir
(
"./expansions"
,
[](
const
char
*
name
,
bool
isdir
)
{
if
(
isdir
&&
strcmp
(
name
,
"."
)
&&
strcmp
(
name
,
".."
))
{
char
fpath
[
1024
];
sprintf
(
fpath
,
"./expansions/%s/strings.conf"
,
name
);
dataManager
.
LoadStrings
(
fpath
);
}
closedir
(
dir
);
}
#endif
}
void
Game
::
LoadExpansionStringsDirectry
(
const
char
*
path
)
{
char
fpath
[
1000
];
sprintf
(
fpath
,
"%s/strings.conf"
,
path
);
dataManager
.
LoadStrings
(
fpath
);
});
}
void
Game
::
RefreshDeck
(
irr
::
gui
::
IGUIComboBox
*
cbDeck
)
{
cbDeck
->
clear
();
...
...
gframe/game.h
View file @
c23c19fa
...
...
@@ -144,7 +144,6 @@ public:
void
LoadExpansionDB
();
void
LoadExpansionDBDirectry
(
const
char
*
path
);
void
LoadExpansionStrings
();
void
LoadExpansionStringsDirectry
(
const
char
*
path
);
void
RefreshDeck
(
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
void
RefreshReplay
();
void
RefreshSingleplay
();
...
...
gframe/image_manager.cpp
View file @
c23c19fa
...
...
@@ -271,23 +271,30 @@ void imageScaleNNAA(irr::video::IImage *src, irr::video::IImage *dest) {
}
}
irr
::
video
::
ITexture
*
ImageManager
::
GetTextureFromFile
(
char
*
file
,
s32
width
,
s32
height
)
{
#ifdef _WIN32
wchar_t
name
[
1024
];
BufferIO
::
DecodeUTF8
(
file
,
name
);
#else
char
*
name
=
file
;
#endif // _WIN32
if
(
mainGame
->
gameConf
.
use_image_scale
)
{
irr
::
video
::
ITexture
*
texture
;
irr
::
video
::
IImage
*
srcimg
=
driver
->
createImageFromFile
(
fil
e
);
irr
::
video
::
IImage
*
srcimg
=
driver
->
createImageFromFile
(
nam
e
);
if
(
srcimg
==
NULL
)
return
NULL
;
if
(
srcimg
->
getDimension
()
==
irr
::
core
::
dimension2d
<
u32
>
(
width
,
height
))
{
texture
=
driver
->
addTexture
(
fil
e
,
srcimg
);
texture
=
driver
->
addTexture
(
nam
e
,
srcimg
);
}
else
{
video
::
IImage
*
destimg
=
driver
->
createImage
(
srcimg
->
getColorFormat
(),
irr
::
core
::
dimension2d
<
u32
>
(
width
,
height
));
imageScaleNNAA
(
srcimg
,
destimg
);
texture
=
driver
->
addTexture
(
fil
e
,
destimg
);
texture
=
driver
->
addTexture
(
nam
e
,
destimg
);
destimg
->
drop
();
}
srcimg
->
drop
();
return
texture
;
}
else
{
return
driver
->
getTexture
(
fil
e
);
return
driver
->
getTexture
(
nam
e
);
}
}
irr
::
video
::
ITexture
*
ImageManager
::
GetTextureUnknown
(
s32
width
,
s32
height
,
int
index
)
{
...
...
@@ -299,39 +306,18 @@ irr::video::ITexture* ImageManager::GetTextureExpansions(char* file, s32 width,
irr
::
video
::
ITexture
*
img
=
GetTextureExpansionsDirectry
(
"./expansions"
,
file
,
width
,
height
);
if
(
img
!=
NULL
)
return
img
;
#ifdef _WIN32
char
fpath
[
1000
];
WIN32_FIND_DATAW
fdataw
;
HANDLE
fh
=
FindFirstFileW
(
L"./expansions/*"
,
&
fdataw
);
if
(
fh
!=
INVALID_HANDLE_VALUE
)
{
do
{
if
(
wcscmp
(
L"."
,
fdataw
.
cFileName
)
!=
0
&&
wcscmp
(
L".."
,
fdataw
.
cFileName
)
!=
0
&&
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
{
char
fname
[
780
];
BufferIO
::
EncodeUTF8
(
fdataw
.
cFileName
,
fname
);
sprintf
(
fpath
,
"./expansions/%s"
,
fname
);
img
=
GetTextureExpansionsDirectry
(
fpath
,
file
,
width
,
height
);
if
(
img
!=
NULL
)
return
img
;
}
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
}
#else
DIR
*
dir
;
struct
dirent
*
dirp
;
if
((
dir
=
opendir
(
"./expansions/"
))
!=
NULL
)
{
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
if
(
strcmp
(
"."
,
dirp
->
d_name
)
==
0
||
strcmp
(
".."
,
dirp
->
d_name
)
==
0
||
dirp
->
d_type
!=
DT_DIR
)
continue
;
char
filepath
[
1000
];
sprintf
(
filepath
,
"./expansions/%s/"
,
dirp
->
d_name
);
img
=
GetTextureExpansionsDirectry
(
filepath
,
file
,
width
,
height
);
if
(
img
!=
NULL
)
return
img
;
bool
find
=
false
;
FileSystem
::
TraversalDir
(
"./expansions"
,
[
this
,
file
,
width
,
height
,
&
img
,
&
find
](
const
char
*
name
,
bool
isdir
)
{
if
(
!
find
&&
isdir
&&
strcmp
(
name
,
"."
)
&&
strcmp
(
name
,
".."
))
{
char
subdir
[
1024
];
sprintf
(
subdir
,
"./expansions/%s"
,
name
);
img
=
GetTextureExpansionsDirectry
(
subdir
,
file
,
width
,
height
);
if
(
img
)
find
=
true
;
}
closedir
(
dir
);
}
#endif
}
);
if
(
find
)
return
img
;
return
img
;
}
irr
::
video
::
ITexture
*
ImageManager
::
GetTextureExpansionsDirectry
(
const
char
*
path
,
char
*
file
,
s32
width
,
s32
height
)
{
...
...
gframe/replay_mode.cpp
View file @
c23c19fa
...
...
@@ -952,39 +952,18 @@ byte* ReplayMode::ScriptReaderEx(const char* script_name, int* slen) {
buffer
=
ScriptReaderExDirectry
(
"./beta"
,
script_name
,
slen
);
if
(
buffer
)
return
buffer
;
#ifdef _WIN32
char
fpath
[
1000
];
WIN32_FIND_DATAW
fdataw
;
HANDLE
fh
=
FindFirstFileW
(
L"./expansions/*"
,
&
fdataw
);
if
(
fh
!=
INVALID_HANDLE_VALUE
)
{
do
{
if
(
wcscmp
(
L"."
,
fdataw
.
cFileName
)
!=
0
&&
wcscmp
(
L".."
,
fdataw
.
cFileName
)
!=
0
&&
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
{
char
fname
[
780
];
BufferIO
::
EncodeUTF8
(
fdataw
.
cFileName
,
fname
);
sprintf
(
fpath
,
"./expansions/%s"
,
fname
);
buffer
=
ScriptReaderExDirectry
(
fpath
,
script_name
,
slen
);
if
(
buffer
)
return
buffer
;
}
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
}
#else
DIR
*
dir
;
struct
dirent
*
dirp
;
if
((
dir
=
opendir
(
"./expansions/"
))
!=
NULL
)
{
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
if
(
strcmp
(
"."
,
dirp
->
d_name
)
==
0
||
strcmp
(
".."
,
dirp
->
d_name
)
==
0
||
dirp
->
d_type
!=
DT_DIR
)
continue
;
char
filepath
[
1000
];
sprintf
(
filepath
,
"./expansions/%s/"
,
dirp
->
d_name
);
buffer
=
ScriptReaderExDirectry
(
filepath
,
script_name
,
slen
);
bool
find
=
false
;
FileSystem
::
TraversalDir
(
"./expansions"
,
[
script_name
,
slen
,
&
buffer
,
&
find
](
const
char
*
name
,
bool
isdir
)
{
if
(
!
find
&&
isdir
&&
strcmp
(
name
,
"."
)
&&
strcmp
(
name
,
".."
))
{
char
subdir
[
1024
];
sprintf
(
subdir
,
"./expansions/%s"
,
name
);
buffer
=
ScriptReaderExDirectry
(
subdir
,
script_name
,
slen
);
if
(
buffer
)
return
buffer
;
find
=
true
;
}
closedir
(
dir
);
}
#endif
}
);
if
(
find
)
return
buffer
;
return
default_script_reader
(
script_name
,
slen
);
}
byte
*
ReplayMode
::
ScriptReaderExDirectry
(
const
char
*
path
,
const
char
*
script_name
,
int
*
slen
,
int
pre_len
)
{
...
...
gframe/single_duel.cpp
View file @
c23c19fa
...
...
@@ -2135,39 +2135,18 @@ byte* SingleDuel::ScriptReaderEx(const char* script_name, int* slen) {
buffer
=
ScriptReaderExDirectry
(
"./beta"
,
script_name
,
slen
);
if
(
buffer
)
return
buffer
;
#ifdef _WIN32
char
fpath
[
1000
];
WIN32_FIND_DATAW
fdataw
;
HANDLE
fh
=
FindFirstFileW
(
L"./expansions/*"
,
&
fdataw
);
if
(
fh
!=
INVALID_HANDLE_VALUE
)
{
do
{
if
(
wcscmp
(
L"."
,
fdataw
.
cFileName
)
!=
0
&&
wcscmp
(
L".."
,
fdataw
.
cFileName
)
!=
0
&&
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
{
char
fname
[
780
];
BufferIO
::
EncodeUTF8
(
fdataw
.
cFileName
,
fname
);
sprintf
(
fpath
,
"./expansions/%s"
,
fname
);
buffer
=
ScriptReaderExDirectry
(
fpath
,
script_name
,
slen
);
if
(
buffer
)
return
buffer
;
}
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
}
#else
DIR
*
dir
;
struct
dirent
*
dirp
;
if
((
dir
=
opendir
(
"./expansions/"
))
!=
NULL
)
{
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
if
(
strcmp
(
"."
,
dirp
->
d_name
)
==
0
||
strcmp
(
".."
,
dirp
->
d_name
)
==
0
||
dirp
->
d_type
!=
DT_DIR
)
continue
;
char
filepath
[
1000
];
sprintf
(
filepath
,
"./expansions/%s/"
,
dirp
->
d_name
);
buffer
=
ScriptReaderExDirectry
(
filepath
,
script_name
,
slen
);
bool
find
=
false
;
FileSystem
::
TraversalDir
(
"./expansions"
,
[
script_name
,
slen
,
&
buffer
,
&
find
](
const
char
*
name
,
bool
isdir
)
{
if
(
!
find
&&
isdir
&&
strcmp
(
name
,
"."
)
&&
strcmp
(
name
,
".."
))
{
char
subdir
[
1024
];
sprintf
(
subdir
,
"./expansions/%s"
,
name
);
buffer
=
ScriptReaderExDirectry
(
subdir
,
script_name
,
slen
);
if
(
buffer
)
return
buffer
;
find
=
true
;
}
closedir
(
dir
);
}
#endif
}
);
if
(
find
)
return
buffer
;
return
default_script_reader
(
script_name
,
slen
);
}
byte
*
SingleDuel
::
ScriptReaderExDirectry
(
const
char
*
path
,
const
char
*
script_name
,
int
*
slen
,
int
pre_len
)
{
...
...
gframe/single_mode.cpp
View file @
c23c19fa
...
...
@@ -872,45 +872,23 @@ byte* SingleMode::ScriptReaderEx(const char* script_name, int* slen) {
buffer
=
ScriptReaderExDirectry
(
"./beta"
,
script_name
,
slen
);
if
(
buffer
)
return
buffer
;
#ifdef _WIN32
char
fpath
[
1000
];
WIN32_FIND_DATAW
fdataw
;
HANDLE
fh
=
FindFirstFileW
(
L"./expansions/*"
,
&
fdataw
);
if
(
fh
!=
INVALID_HANDLE_VALUE
)
{
do
{
if
(
wcscmp
(
L"."
,
fdataw
.
cFileName
)
!=
0
&&
wcscmp
(
L".."
,
fdataw
.
cFileName
)
!=
0
&&
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
{
char
fname
[
780
];
BufferIO
::
EncodeUTF8
(
fdataw
.
cFileName
,
fname
);
sprintf
(
fpath
,
"./expansions/%s"
,
fname
);
buffer
=
ScriptReaderExDirectry
(
fpath
,
script_name
,
slen
);
if
(
buffer
)
return
buffer
;
}
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
}
#else
DIR
*
dir
;
struct
dirent
*
dirp
;
if
((
dir
=
opendir
(
"./expansions/"
))
!=
NULL
)
{
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
if
(
strcmp
(
"."
,
dirp
->
d_name
)
==
0
||
strcmp
(
".."
,
dirp
->
d_name
)
==
0
||
dirp
->
d_type
!=
DT_DIR
)
continue
;
char
filepath
[
1000
];
sprintf
(
filepath
,
"./expansions/%s/"
,
dirp
->
d_name
);
buffer
=
ScriptReaderExDirectry
(
filepath
,
script_name
,
slen
);
bool
find
=
false
;
FileSystem
::
TraversalDir
(
"./expansions"
,
[
script_name
,
slen
,
&
buffer
,
&
find
](
const
char
*
name
,
bool
isdir
)
{
if
(
!
find
&&
isdir
&&
strcmp
(
name
,
"."
)
&&
strcmp
(
name
,
".."
))
{
char
subdir
[
1024
];
sprintf
(
subdir
,
"./expansions/%s"
,
name
);
buffer
=
ScriptReaderExDirectry
(
subdir
,
script_name
,
slen
);
if
(
buffer
)
return
buffer
;
find
=
true
;
}
closedir
(
dir
);
}
#endif
}
);
if
(
find
)
return
buffer
;
return
ScriptReader
(
script_name
,
slen
);
}
byte
*
SingleMode
::
ScriptReaderExDirectry
(
const
char
*
path
,
const
char
*
script_name
,
int
*
slen
,
int
pre_len
)
{
char
sname
[
256
];
strcpy
(
sname
,
path
);
strcat
(
sname
,
script_name
+
pre_len
);
//default script name: ./script/c%d.lua
sprintf
(
sname
,
"%s%s"
,
path
,
script_name
+
pre_len
);
//default script name: ./script/c%d.lua
return
ScriptReader
(
sname
,
slen
);
}
byte
*
SingleMode
::
ScriptReader
(
const
char
*
script_name
,
int
*
slen
)
{
...
...
gframe/tag_duel.cpp
View file @
c23c19fa
...
...
@@ -2295,39 +2295,18 @@ byte* TagDuel::ScriptReaderEx(const char* script_name, int* slen) {
buffer
=
ScriptReaderExDirectry
(
"./beta"
,
script_name
,
slen
);
if
(
buffer
)
return
buffer
;
#ifdef _WIN32
char
fpath
[
1000
];
WIN32_FIND_DATAW
fdataw
;
HANDLE
fh
=
FindFirstFileW
(
L"./expansions/*"
,
&
fdataw
);
if
(
fh
!=
INVALID_HANDLE_VALUE
)
{
do
{
if
(
wcscmp
(
L"."
,
fdataw
.
cFileName
)
!=
0
&&
wcscmp
(
L".."
,
fdataw
.
cFileName
)
!=
0
&&
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
{
char
fname
[
780
];
BufferIO
::
EncodeUTF8
(
fdataw
.
cFileName
,
fname
);
sprintf
(
fpath
,
"./expansions/%s"
,
fname
);
buffer
=
ScriptReaderExDirectry
(
fpath
,
script_name
,
slen
);
if
(
buffer
)
return
buffer
;
}
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
}
#else
DIR
*
dir
;
struct
dirent
*
dirp
;
if
((
dir
=
opendir
(
"./expansions/"
))
!=
NULL
)
{
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
if
(
strcmp
(
"."
,
dirp
->
d_name
)
==
0
||
strcmp
(
".."
,
dirp
->
d_name
)
==
0
||
dirp
->
d_type
!=
DT_DIR
)
continue
;
char
filepath
[
1000
];
sprintf
(
filepath
,
"./expansions/%s/"
,
dirp
->
d_name
);
buffer
=
ScriptReaderExDirectry
(
filepath
,
script_name
,
slen
);
bool
find
=
false
;
FileSystem
::
TraversalDir
(
"./expansions"
,
[
script_name
,
slen
,
&
buffer
,
&
find
](
const
char
*
name
,
bool
isdir
)
{
if
(
!
find
&&
isdir
&&
strcmp
(
name
,
"."
)
&&
strcmp
(
name
,
".."
))
{
char
subdir
[
1024
];
sprintf
(
subdir
,
"./expansions/%s"
,
name
);
buffer
=
ScriptReaderExDirectry
(
subdir
,
script_name
,
slen
);
if
(
buffer
)
return
buffer
;
find
=
true
;
}
closedir
(
dir
);
}
#endif
}
);
if
(
find
)
return
buffer
;
return
default_script_reader
(
script_name
,
slen
);
}
byte
*
TagDuel
::
ScriptReaderExDirectry
(
const
char
*
path
,
const
char
*
script_name
,
int
*
slen
,
int
pre_len
)
{
...
...
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