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
d537d3b9
Commit
d537d3b9
authored
Sep 01, 2022
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
read pack from expansion ypk
parent
113e0e8b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
16 deletions
+23
-16
gframe/deck_con.cpp
gframe/deck_con.cpp
+2
-10
gframe/deck_con.h
gframe/deck_con.h
+1
-0
gframe/deck_manager.cpp
gframe/deck_manager.cpp
+6
-0
gframe/game.cpp
gframe/game.cpp
+13
-5
gframe/game.h
gframe/game.h
+1
-1
No files found.
gframe/deck_con.cpp
View file @
d537d3b9
...
@@ -1601,15 +1601,7 @@ void DeckBuilder::RefreshDeckList() {
...
@@ -1601,15 +1601,7 @@ void DeckBuilder::RefreshDeckList() {
wchar_t
catepath
[
256
];
wchar_t
catepath
[
256
];
deckManager
.
GetCategoryPath
(
catepath
,
lstCategories
->
getSelected
(),
lstCategories
->
getListItem
(
lstCategories
->
getSelected
()));
deckManager
.
GetCategoryPath
(
catepath
,
lstCategories
->
getSelected
(),
lstCategories
->
getListItem
(
lstCategories
->
getSelected
()));
lstDecks
->
clear
();
lstDecks
->
clear
();
FileSystem
::
TraversalDir
(
catepath
,
[
lstDecks
](
const
wchar_t
*
name
,
bool
isdir
)
{
mainGame
->
RefreshDeck
(
catepath
,
[
lstDecks
](
const
wchar_t
*
item
)
{
lstDecks
->
addItem
(
item
);
});
if
(
!
isdir
&&
wcsrchr
(
name
,
'.'
)
&&
!
mywcsncasecmp
(
wcsrchr
(
name
,
'.'
),
L".ydk"
,
4
))
{
size_t
len
=
wcslen
(
name
);
wchar_t
deckname
[
256
];
wcsncpy
(
deckname
,
name
,
len
-
4
);
deckname
[
len
-
4
]
=
0
;
lstDecks
->
addItem
(
deckname
);
}
});
}
}
void
DeckBuilder
::
RefreshReadonly
(
int
catesel
)
{
void
DeckBuilder
::
RefreshReadonly
(
int
catesel
)
{
bool
hasDeck
=
mainGame
->
cbDBDecks
->
getItemCount
()
!=
0
;
bool
hasDeck
=
mainGame
->
cbDBDecks
->
getItemCount
()
!=
0
;
...
@@ -1667,7 +1659,7 @@ void DeckBuilder::ShowDeckManage() {
...
@@ -1667,7 +1659,7 @@ void DeckBuilder::ShowDeckManage() {
if
(
isdir
)
{
if
(
isdir
)
{
lstCategories
->
addItem
(
name
);
lstCategories
->
addItem
(
name
);
}
}
});
});
lstCategories
->
setSelected
(
prev_category
);
lstCategories
->
setSelected
(
prev_category
);
RefreshDeckList
();
RefreshDeckList
();
RefreshReadonly
(
prev_category
);
RefreshReadonly
(
prev_category
);
...
...
gframe/deck_con.h
View file @
d537d3b9
...
@@ -84,6 +84,7 @@ public:
...
@@ -84,6 +84,7 @@ public:
const
std
::
unordered_map
<
int
,
int
>*
filterList
;
const
std
::
unordered_map
<
int
,
int
>*
filterList
;
std
::
vector
<
code_pointer
>
results
;
std
::
vector
<
code_pointer
>
results
;
wchar_t
result_string
[
8
];
wchar_t
result_string
[
8
];
std
::
vector
<
std
::
wstring
>
expansionPacks
;
};
};
}
}
...
...
gframe/deck_manager.cpp
View file @
d537d3b9
...
@@ -272,6 +272,11 @@ bool DeckManager::LoadDeck(const wchar_t* file, bool is_packlist) {
...
@@ -272,6 +272,11 @@ bool DeckManager::LoadDeck(const wchar_t* file, bool is_packlist) {
myswprintf
(
localfile
,
L"./deck/%ls.ydk"
,
file
);
myswprintf
(
localfile
,
L"./deck/%ls.ydk"
,
file
);
reader
=
OpenDeckReader
(
localfile
);
reader
=
OpenDeckReader
(
localfile
);
}
}
if
(
!
reader
&&
!
mywcsncasecmp
(
file
,
L"./pack"
,
6
))
{
wchar_t
zipfile
[
64
];
myswprintf
(
zipfile
,
L"%ls"
,
file
+
2
);
reader
=
OpenDeckReader
(
zipfile
);
}
if
(
!
reader
)
if
(
!
reader
)
return
false
;
return
false
;
size_t
size
=
reader
->
getSize
();
size_t
size
=
reader
->
getSize
();
...
@@ -279,6 +284,7 @@ bool DeckManager::LoadDeck(const wchar_t* file, bool is_packlist) {
...
@@ -279,6 +284,7 @@ bool DeckManager::LoadDeck(const wchar_t* file, bool is_packlist) {
reader
->
drop
();
reader
->
drop
();
return
false
;
return
false
;
}
}
memset
(
deckBuffer
,
0
,
sizeof
(
deckBuffer
));
reader
->
read
(
deckBuffer
,
size
);
reader
->
read
(
deckBuffer
,
size
);
reader
->
drop
();
reader
->
drop
();
std
::
istringstream
deckStream
(
deckBuffer
);
std
::
istringstream
deckStream
(
deckBuffer
);
...
...
gframe/game.cpp
View file @
d537d3b9
...
@@ -1141,6 +1141,9 @@ void Game::LoadExpansions() {
...
@@ -1141,6 +1141,9 @@ void Game::LoadExpansions() {
#endif
#endif
dataManager
.
LoadStrings
(
reader
);
dataManager
.
LoadStrings
(
reader
);
}
}
if
(
wcsrchr
(
fname
,
'.'
)
&&
!
mywcsncasecmp
(
wcsrchr
(
fname
,
'.'
),
L".ydk"
,
4
))
{
deckBuilder
.
expansionPacks
.
push_back
(
fname
);
}
}
}
}
}
}
}
...
@@ -1182,17 +1185,22 @@ void Game::RefreshDeck(irr::gui::IGUIComboBox* cbCategory, irr::gui::IGUIComboBo
...
@@ -1182,17 +1185,22 @@ void Game::RefreshDeck(irr::gui::IGUIComboBox* cbCategory, irr::gui::IGUIComboBo
}
}
wchar_t
catepath
[
256
];
wchar_t
catepath
[
256
];
deckManager
.
GetCategoryPath
(
catepath
,
cbCategory
->
getSelected
(),
cbCategory
->
getText
());
deckManager
.
GetCategoryPath
(
catepath
,
cbCategory
->
getSelected
(),
cbCategory
->
getText
());
RefreshDeck
(
catepath
,
cbDeck
);
}
void
Game
::
RefreshDeck
(
const
wchar_t
*
deckpath
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
)
{
cbDeck
->
clear
();
cbDeck
->
clear
();
FileSystem
::
TraversalDir
(
deckpath
,
[
cbDeck
](
const
wchar_t
*
name
,
bool
isdir
)
{
RefreshDeck
(
catepath
,
[
cbDeck
](
const
wchar_t
*
item
)
{
cbDeck
->
addItem
(
item
);
});
}
void
Game
::
RefreshDeck
(
const
wchar_t
*
deckpath
,
const
std
::
function
<
void
(
const
wchar_t
*
)
>&
additem
)
{
if
(
!
mywcsncasecmp
(
deckpath
,
L"./pack"
,
6
))
{
for
(
auto
pack
:
deckBuilder
.
expansionPacks
)
{
additem
(
pack
.
substr
(
5
,
pack
.
size
()
-
9
).
c_str
());
}
}
FileSystem
::
TraversalDir
(
deckpath
,
[
additem
](
const
wchar_t
*
name
,
bool
isdir
)
{
if
(
!
isdir
&&
wcsrchr
(
name
,
'.'
)
&&
!
mywcsncasecmp
(
wcsrchr
(
name
,
'.'
),
L".ydk"
,
4
))
{
if
(
!
isdir
&&
wcsrchr
(
name
,
'.'
)
&&
!
mywcsncasecmp
(
wcsrchr
(
name
,
'.'
),
L".ydk"
,
4
))
{
size_t
len
=
wcslen
(
name
);
size_t
len
=
wcslen
(
name
);
wchar_t
deckname
[
256
];
wchar_t
deckname
[
256
];
wcsncpy
(
deckname
,
name
,
len
-
4
);
wcsncpy
(
deckname
,
name
,
len
-
4
);
deckname
[
len
-
4
]
=
0
;
deckname
[
len
-
4
]
=
0
;
cbDeck
->
addI
tem
(
deckname
);
addi
tem
(
deckname
);
}
}
});
});
}
}
...
...
gframe/game.h
View file @
d537d3b9
...
@@ -123,7 +123,7 @@ public:
...
@@ -123,7 +123,7 @@ public:
void
LoadExpansions
();
void
LoadExpansions
();
void
RefreshCategoryDeck
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
,
bool
selectlastused
=
true
);
void
RefreshCategoryDeck
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
,
bool
selectlastused
=
true
);
void
RefreshDeck
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
void
RefreshDeck
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
void
RefreshDeck
(
const
wchar_t
*
deckpath
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
void
RefreshDeck
(
const
wchar_t
*
deckpath
,
const
std
::
function
<
void
(
const
wchar_t
*
)
>&
additem
);
void
RefreshReplay
();
void
RefreshReplay
();
void
RefreshSingleplay
();
void
RefreshSingleplay
();
void
RefreshBot
();
void
RefreshBot
();
...
...
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