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
nanahira
ygopro
Commits
4d045555
Commit
4d045555
authored
Jun 13, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
read lflist in ypk
parent
64a6b8ee
Pipeline
#37523
failed with stages
in 9 minutes and 1 second
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
86 additions
and
36 deletions
+86
-36
gframe/deck_manager.cpp
gframe/deck_manager.cpp
+30
-33
gframe/deck_manager.h
gframe/deck_manager.h
+47
-1
gframe/game.cpp
gframe/game.cpp
+9
-2
No files found.
gframe/deck_manager.cpp
View file @
4d045555
...
@@ -9,44 +9,41 @@ namespace ygo {
...
@@ -9,44 +9,41 @@ namespace ygo {
char
DeckManager
::
deckBuffer
[
0x10000
]{};
char
DeckManager
::
deckBuffer
[
0x10000
]{};
DeckManager
deckManager
;
DeckManager
deckManager
;
void
DeckManager
::
LoadLFListSingle
(
const
char
*
path
)
{
void
DeckManager
::
LoadLFListSingle
(
const
char
*
path
,
bool
insert
)
{
auto
cur
=
_lfList
.
rend
();
FILE
*
fp
=
myfopen
(
path
,
"r"
);
FILE
*
fp
=
myfopen
(
path
,
"r"
);
char
linebuf
[
256
]{};
if
(
!
fp
)
return
;
wchar_t
strBuffer
[
256
]{};
_LoadLFListFromLineProvider
([
&
](
char
*
buf
,
size_t
sz
)
{
char
str1
[
16
]{};
return
std
::
fgets
(
buf
,
sz
,
fp
)
!=
nullptr
;
if
(
fp
)
{
},
insert
);
while
(
std
::
fgets
(
linebuf
,
sizeof
linebuf
,
fp
))
{
std
::
fclose
(
fp
);
if
(
linebuf
[
0
]
==
'#'
)
}
continue
;
void
DeckManager
::
LoadLFListSingle
(
const
wchar_t
*
path
,
bool
insert
)
{
if
(
linebuf
[
0
]
==
'!'
)
{
FILE
*
fp
=
mywfopen
(
path
,
"r"
);
auto
len
=
std
::
strcspn
(
linebuf
,
"
\r\n
"
);
if
(
!
fp
)
return
;
linebuf
[
len
]
=
0
;
_LoadLFListFromLineProvider
([
&
](
char
*
buf
,
size_t
sz
)
{
BufferIO
::
DecodeUTF8
(
&
linebuf
[
1
],
strBuffer
);
return
std
::
fgets
(
buf
,
sz
,
fp
)
!=
nullptr
;
LFList
newlist
;
},
insert
);
newlist
.
listName
=
strBuffer
;
std
::
fclose
(
fp
);
newlist
.
hash
=
0x7dfcee6a
;
}
_lfList
.
push_back
(
newlist
);
void
DeckManager
::
LoadLFListSingle
(
irr
::
io
::
IReadFile
*
reader
,
bool
insert
)
{
cur
=
_lfList
.
rbegin
();
std
::
string
linebuf
;
continue
;
char
ch
{};
_LoadLFListFromLineProvider
([
&
](
char
*
buf
,
size_t
sz
)
{
while
(
reader
->
read
(
&
ch
,
1
))
{
if
(
ch
==
'\0'
)
break
;
linebuf
.
push_back
(
ch
);
if
(
ch
==
'\n'
||
linebuf
.
size
()
>=
sz
-
1
)
{
std
::
strncpy
(
buf
,
linebuf
.
c_str
(),
sz
-
1
);
buf
[
sz
-
1
]
=
'\0'
;
linebuf
.
clear
();
return
true
;
}
}
if
(
cur
==
_lfList
.
rend
())
continue
;
unsigned
int
code
=
0
;
int
count
=
-
1
;
if
(
std
::
sscanf
(
linebuf
,
"%10s%*[ ]%1d"
,
str1
,
&
count
)
!=
2
)
continue
;
if
(
count
<
0
||
count
>
2
)
continue
;
code
=
std
::
strtoul
(
str1
,
nullptr
,
10
);
cur
->
content
[
code
]
=
count
;
cur
->
hash
=
cur
->
hash
^
((
code
<<
18
)
|
(
code
>>
14
))
^
((
code
<<
(
27
+
count
))
|
(
code
>>
(
5
-
count
)));
}
}
std
::
fclose
(
fp
);
return
false
;
}
},
insert
);
reader
->
drop
();
}
}
void
DeckManager
::
LoadLFList
()
{
void
DeckManager
::
LoadLFList
()
{
LoadLFListSingle
(
"expansions/lflist.conf"
);
LoadLFListSingle
(
"specials/lflist.conf"
);
LoadLFListSingle
(
"specials/lflist.conf"
);
LoadLFListSingle
(
"lflist.conf"
);
LoadLFListSingle
(
"lflist.conf"
);
LFList
nolimit
;
LFList
nolimit
;
...
...
gframe/deck_manager.h
View file @
4d045555
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#include <vector>
#include <vector>
#include <sstream>
#include <sstream>
#include "data_manager.h"
#include "data_manager.h"
#include "bufferio.h"
#ifndef YGOPRO_MAX_DECK
#ifndef YGOPRO_MAX_DECK
#define YGOPRO_MAX_DECK 60
#define YGOPRO_MAX_DECK 60
...
@@ -64,7 +65,9 @@ public:
...
@@ -64,7 +65,9 @@ public:
static
char
deckBuffer
[
0x10000
];
static
char
deckBuffer
[
0x10000
];
void
LoadLFListSingle
(
const
char
*
path
);
void
LoadLFListSingle
(
const
char
*
path
,
bool
insert
=
false
);
void
LoadLFListSingle
(
const
wchar_t
*
path
,
bool
insert
=
false
);
void
LoadLFListSingle
(
irr
::
io
::
IReadFile
*
reader
,
bool
insert
=
false
);
void
LoadLFList
();
void
LoadLFList
();
const
wchar_t
*
GetLFListName
(
unsigned
int
lfhash
);
const
wchar_t
*
GetLFListName
(
unsigned
int
lfhash
);
const
LFList
*
GetLFList
(
unsigned
int
lfhash
);
const
LFList
*
GetLFList
(
unsigned
int
lfhash
);
...
@@ -89,6 +92,49 @@ public:
...
@@ -89,6 +92,49 @@ public:
static
bool
RenameCategory
(
const
wchar_t
*
oldname
,
const
wchar_t
*
newname
);
static
bool
RenameCategory
(
const
wchar_t
*
oldname
,
const
wchar_t
*
newname
);
static
bool
DeleteCategory
(
const
wchar_t
*
name
);
static
bool
DeleteCategory
(
const
wchar_t
*
name
);
static
bool
SaveDeckArray
(
const
DeckArray
&
deck
,
const
wchar_t
*
name
);
static
bool
SaveDeckArray
(
const
DeckArray
&
deck
,
const
wchar_t
*
name
);
private:
template
<
typename
LineProvider
>
void
_LoadLFListFromLineProvider
(
LineProvider
getLine
,
bool
insert
=
false
)
{
std
::
vector
<
LFList
>
loadedLists
;
auto
cur
=
loadedLists
.
rend
();
// 注意:在临时 list 上操作
char
line
[
256
]{};
wchar_t
strBuffer
[
256
]{};
char
str1
[
16
]{};
while
(
getLine
(
line
,
sizeof
(
line
)))
{
if
(
line
[
0
]
==
'#'
)
continue
;
if
(
line
[
0
]
==
'!'
)
{
auto
len
=
std
::
strcspn
(
line
,
"
\r\n
"
);
line
[
len
]
=
0
;
BufferIO
::
DecodeUTF8
(
&
line
[
1
],
strBuffer
);
LFList
newlist
;
newlist
.
listName
=
strBuffer
;
newlist
.
hash
=
0x7dfcee6a
;
loadedLists
.
push_back
(
newlist
);
cur
=
loadedLists
.
rbegin
();
continue
;
}
if
(
cur
==
loadedLists
.
rend
())
continue
;
unsigned
int
code
=
0
;
int
count
=
-
1
;
if
(
std
::
sscanf
(
line
,
"%10s%*[ ]%1d"
,
str1
,
&
count
)
!=
2
)
continue
;
if
(
count
<
0
||
count
>
2
)
continue
;
code
=
std
::
strtoul
(
str1
,
nullptr
,
10
);
cur
->
content
[
code
]
=
count
;
cur
->
hash
=
cur
->
hash
^
((
code
<<
18
)
|
(
code
>>
14
))
^
((
code
<<
(
27
+
count
))
|
(
code
>>
(
5
-
count
)));
}
if
(
insert
)
{
_lfList
.
insert
(
_lfList
.
begin
(),
loadedLists
.
begin
(),
loadedLists
.
end
());
}
else
{
_lfList
.
insert
(
_lfList
.
end
(),
loadedLists
.
begin
(),
loadedLists
.
end
());
}
}
};
};
extern
DeckManager
deckManager
;
extern
DeckManager
deckManager
;
...
...
gframe/game.cpp
View file @
4d045555
...
@@ -1239,12 +1239,16 @@ void Game::LoadExpansions() {
...
@@ -1239,12 +1239,16 @@ void Game::LoadExpansions() {
dataManager
.
LoadDB
(
fpath
);
dataManager
.
LoadDB
(
fpath
);
return
;
return
;
}
}
if
(
IsExtension
(
name
,
L".conf"
))
{
if
(
IsExtension
(
name
,
L".conf"
)
&&
std
::
wcscmp
(
name
,
L"lflist.conf"
)
)
{
char
upath
[
1024
];
char
upath
[
1024
];
BufferIO
::
EncodeUTF8
(
fpath
,
upath
);
BufferIO
::
EncodeUTF8
(
fpath
,
upath
);
dataManager
.
LoadStrings
(
upath
);
dataManager
.
LoadStrings
(
upath
);
return
;
return
;
}
}
if
(
!
std
::
wcscmp
(
name
,
L"lflist.conf"
))
{
deckManager
.
LoadLFListSingle
(
fpath
,
true
);
return
;
}
if
(
IsExtension
(
name
,
L".zip"
)
||
IsExtension
(
name
,
L".ypk"
))
{
if
(
IsExtension
(
name
,
L".zip"
)
||
IsExtension
(
name
,
L".ypk"
))
{
#ifdef _WIN32
#ifdef _WIN32
DataManager
::
FileSystem
->
addFileArchive
(
fpath
,
true
,
false
,
irr
::
io
::
EFAT_ZIP
);
DataManager
::
FileSystem
->
addFileArchive
(
fpath
,
true
,
false
,
irr
::
io
::
EFAT_ZIP
);
...
@@ -1276,7 +1280,10 @@ void Game::LoadExpansions() {
...
@@ -1276,7 +1280,10 @@ void Game::LoadExpansions() {
#else
#else
auto
reader
=
DataManager
::
FileSystem
->
createAndOpenFile
(
uname
);
auto
reader
=
DataManager
::
FileSystem
->
createAndOpenFile
(
uname
);
#endif
#endif
dataManager
.
LoadStrings
(
reader
);
if
(
!
std
::
wcscmp
(
fname
,
L"lflist.conf"
))
deckManager
.
LoadLFListSingle
(
reader
,
true
);
else
dataManager
.
LoadStrings
(
reader
);
continue
;
continue
;
}
}
if
(
!
mywcsncasecmp
(
fname
,
L"pack/"
,
5
)
&&
IsExtension
(
fname
,
L".ydk"
))
{
if
(
!
mywcsncasecmp
(
fname
,
L"pack/"
,
5
)
&&
IsExtension
(
fname
,
L".ydk"
))
{
...
...
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