Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro for rd
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 for rd
Commits
bd56c1a2
Commit
bd56c1a2
authored
Jun 17, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add --expansions
parent
f746bf7d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
122 additions
and
56 deletions
+122
-56
gframe/config.h
gframe/config.h
+2
-0
gframe/data_manager.cpp
gframe/data_manager.cpp
+5
-3
gframe/game.cpp
gframe/game.cpp
+37
-4
gframe/game.h
gframe/game.h
+5
-2
gframe/gframe.cpp
gframe/gframe.cpp
+13
-0
gframe/image_manager.cpp
gframe/image_manager.cpp
+60
-47
No files found.
gframe/config.h
View file @
bd56c1a2
...
...
@@ -114,5 +114,7 @@ extern bool auto_watch_mode;
extern
bool
open_file
;
extern
wchar_t
open_file_name
[
256
];
extern
bool
bot_mode
;
extern
bool
expansions_specified
;
extern
std
::
vector
<
std
::
wstring
>
expansions_list
;
#endif
gframe/data_manager.cpp
View file @
bd56c1a2
...
...
@@ -402,9 +402,11 @@ unsigned char* DataManager::ScriptReaderEx(const char* script_name, int* slen) {
buffer
=
ScriptReaderExSingle
(
"specials/"
,
script_name
,
slen
,
9
);
if
(
buffer
)
return
buffer
;
buffer
=
ScriptReaderExSingle
(
"expansions/"
,
script_name
,
slen
);
if
(
buffer
)
return
buffer
;
for
(
auto
ex
:
mainGame
->
GetExpansionsListU
(
"/"
))
{
buffer
=
ScriptReaderExSingle
(
ex
.
c_str
(),
script_name
,
slen
);
if
(
buffer
)
return
buffer
;
}
buffer
=
ScriptReaderExSingle
(
""
,
script_name
,
slen
,
2
,
TRUE
);
if
(
buffer
)
return
buffer
;
...
...
gframe/game.cpp
View file @
bd56c1a2
...
...
@@ -124,7 +124,6 @@ bool Game::Initialize() {
ErrorLog
(
"Failed to load strings!"
);
return
false
;
}
LoadExpansions
();
dataManager
.
LoadDB
(
L"specials/special.cdb"
);
env
=
device
->
getGUIEnvironment
();
numFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
numfont
,
16
);
...
...
@@ -1044,6 +1043,7 @@ bool Game::Initialize() {
return
true
;
}
void
Game
::
MainLoop
()
{
LoadExpansionsAll
();
wchar_t
cap
[
256
];
camera
=
smgr
->
addCameraSceneNode
(
0
);
irr
::
core
::
matrix4
mProjection
;
...
...
@@ -1229,12 +1229,12 @@ std::wstring Game::SetStaticText(irr::gui::IGUIStaticText* pControl, irr::u32 cW
ret
.
assign
(
strBuffer
);
return
ret
;
}
void
Game
::
LoadExpansions
()
{
FileSystem
::
TraversalDir
(
L"./expansions"
,
[
](
const
wchar_t
*
name
,
bool
isdir
)
{
void
Game
::
LoadExpansions
(
const
wchar_t
*
expansions_path
)
{
FileSystem
::
TraversalDir
(
expansions_path
,
[
&
](
const
wchar_t
*
name
,
bool
isdir
)
{
if
(
isdir
)
return
;
wchar_t
fpath
[
1024
];
myswprintf
(
fpath
,
L"
./expansions/%ls"
,
name
);
myswprintf
(
fpath
,
L"
%ls/%ls"
,
expansions_path
,
name
);
if
(
IsExtension
(
name
,
L".cdb"
))
{
dataManager
.
LoadDB
(
fpath
);
return
;
...
...
@@ -1293,6 +1293,39 @@ void Game::LoadExpansions() {
}
}
}
void
Game
::
LoadExpansionsAll
()
{
auto
list
=
GetExpansionsList
();
for
(
const
auto
&
exp
:
list
)
{
LoadExpansions
(
exp
.
c_str
());
}
}
std
::
vector
<
std
::
wstring
>
Game
::
GetExpansionsList
(
const
wchar_t
*
suffix
)
{
if
(
!
suffix
)
return
expansions_list
;
std
::
vector
<
std
::
wstring
>
list
;
wchar_t
buf
[
1024
];
for
(
const
auto
&
exp
:
expansions_list
)
{
myswprintf
(
buf
,
L"%ls%ls"
,
exp
.
c_str
(),
suffix
);
list
.
push_back
(
buf
);
}
return
list
;
}
std
::
vector
<
std
::
string
>
Game
::
GetExpansionsListU
(
const
char
*
suffix
)
{
auto
list
=
GetExpansionsList
(
nullptr
);
std
::
vector
<
std
::
string
>
expansions_list_u
;
char
exp_u
[
1024
];
char
exp_u2
[
1024
];
for
(
const
auto
&
exp
:
list
)
{
BufferIO
::
EncodeUTF8
(
exp
.
c_str
(),
exp_u
);
if
(
!
suffix
)
expansions_list_u
.
push_back
(
exp_u
);
else
{
std
::
snprintf
(
exp_u2
,
sizeof
exp_u2
,
"%s%s"
,
exp_u
,
suffix
);
expansions_list_u
.
push_back
(
exp_u2
);
}
}
return
expansions_list_u
;
}
void
Game
::
RefreshCategoryDeck
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
,
bool
selectlastused
)
{
cbCategory
->
clear
();
cbCategory
->
addItem
(
dataManager
.
GetSysString
(
1450
));
...
...
gframe/game.h
View file @
bd56c1a2
...
...
@@ -187,8 +187,11 @@ public:
void
BuildProjectionMatrix
(
irr
::
core
::
matrix4
&
mProjection
,
irr
::
f32
left
,
irr
::
f32
right
,
irr
::
f32
bottom
,
irr
::
f32
top
,
irr
::
f32
znear
,
irr
::
f32
zfar
);
void
InitStaticText
(
irr
::
gui
::
IGUIStaticText
*
pControl
,
irr
::
u32
cWidth
,
irr
::
u32
cHeight
,
irr
::
gui
::
CGUITTFont
*
font
,
const
wchar_t
*
text
);
std
::
wstring
SetStaticText
(
irr
::
gui
::
IGUIStaticText
*
pControl
,
irr
::
u32
cWidth
,
irr
::
gui
::
CGUITTFont
*
font
,
const
wchar_t
*
text
,
irr
::
u32
pos
=
0
);
void
LoadExpansions
();
void
RefreshCategoryDeck
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
,
bool
selectlastused
=
true
);
void
LoadExpansions
(
const
wchar_t
*
expansions_path
);
void
LoadExpansionsAll
();
std
::
vector
<
std
::
wstring
>
GetExpansionsList
(
const
wchar_t
*
suffix
=
nullptr
);
std
::
vector
<
std
::
string
>
GetExpansionsListU
(
const
char
*
suffix
=
nullptr
);
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
(
const
wchar_t
*
deckpath
,
const
std
::
function
<
void
(
const
wchar_t
*
)
>&
additem
);
void
RefreshReplay
();
...
...
gframe/gframe.cpp
View file @
bd56c1a2
...
...
@@ -15,6 +15,8 @@ bool auto_watch_mode = false;
bool
open_file
=
false
;
wchar_t
open_file_name
[
256
]
=
L""
;
bool
bot_mode
=
false
;
bool
expansions_specified
=
false
;
std
::
vector
<
std
::
wstring
>
expansions_list
;
void
ClickButton
(
irr
::
gui
::
IGUIElement
*
btn
)
{
irr
::
SEvent
event
;
...
...
@@ -87,6 +89,7 @@ int main(int argc, char* argv[]) {
bool
keep_on_return
=
false
;
bool
deckCategorySpecified
=
false
;
expansions_list
.
push_back
(
L"./expansions"
);
for
(
int
i
=
1
;
i
<
wargc
;
++
i
)
{
if
(
wargc
==
2
&&
std
::
wcslen
(
wargv
[
1
])
>=
4
)
{
wchar_t
*
pstrext
=
wargv
[
1
]
+
std
::
wcslen
(
wargv
[
1
])
-
4
;
...
...
@@ -211,6 +214,16 @@ int main(int argc, char* argv[]) {
if
(
open_file
)
ClickButton
(
ygo
::
mainGame
->
btnLoadSinglePlay
);
break
;
}
else
if
(
!
std
::
wcscmp
(
wargv
[
i
],
L"--expansions"
))
{
// specify expansions
++
i
;
if
(
i
<
wargc
)
{
if
(
!
expansions_specified
)
{
expansions_list
.
clear
();
expansions_specified
=
true
;
}
expansions_list
.
push_back
(
wargv
[
i
]);
}
continue
;
}
}
ygo
::
mainGame
->
MainLoop
();
...
...
gframe/image_manager.cpp
View file @
bd56c1a2
...
...
@@ -331,13 +331,15 @@ irr::video::ITexture* ImageManager::GetTexture(int code, bool fit) {
if
(
tit
==
tMap
[
fit
?
1
:
0
].
end
())
{
char
file
[
256
];
irr
::
video
::
ITexture
*
img
=
nullptr
;
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"expansions/pics/%d.png"
,
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"expansions/pics/%d.jpg"
,
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
for
(
auto
ex
:
mainGame
->
GetExpansionsListU
())
{
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"%s/pics/%d.png"
,
ex
.
c_str
(),
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"%s/pics/%d.jpg"
,
ex
.
c_str
(),
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
}
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
mainGame
->
GetLocaleDir
(
"pics/%d.png"
),
code
);
...
...
@@ -377,10 +379,11 @@ irr::video::ITexture* ImageManager::GetBigPicture(int code, float zoom) {
irr
::
video
::
ITexture
*
texture
;
char
file
[
256
];
irr
::
video
::
IImage
*
srcimg
=
nullptr
;
if
(
srcimg
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"expansions/pics/%d.jpg"
,
code
);
srcimg
=
driver
->
createImageFromFile
(
file
);
}
for
(
auto
ex
:
mainGame
->
GetExpansionsListU
())
if
(
srcimg
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"%s/pics/%d.jpg"
,
ex
.
c_str
(),
code
);
srcimg
=
driver
->
createImageFromFile
(
file
);
}
if
(
srcimg
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"pics/%d.jpg"
,
code
);
srcimg
=
driver
->
createImageFromFile
(
file
);
...
...
@@ -409,13 +412,15 @@ int ImageManager::LoadThumbThread() {
imageManager
.
tThumbLoadingMutex
.
unlock
();
char
file
[
256
];
irr
::
video
::
IImage
*
img
=
nullptr
;
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"expansions/pics/thumbnail/%d.png"
,
code
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"expansions/pics/thumbnail/%d.jpg"
,
code
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
for
(
auto
ex
:
mainGame
->
GetExpansionsListU
())
{
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"%s/pics/thumbnail/%d.png"
,
ex
.
c_str
(),
code
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"%s/pics/thumbnail/%d.jpg"
,
ex
.
c_str
(),
code
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
}
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
mainGame
->
GetLocaleDir
(
"pics/thumbnail/%d.png"
),
code
);
...
...
@@ -434,13 +439,15 @@ int ImageManager::LoadThumbThread() {
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
if
(
img
==
nullptr
&&
mainGame
->
gameConf
.
use_image_scale
)
{
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"expansions/pics/%d.png"
,
code
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"expansions/pics/%d.jpg"
,
code
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
for
(
auto
ex
:
mainGame
->
GetExpansionsListU
())
{
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"%s/pics/%d.png"
,
ex
.
c_str
(),
code
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"%s/pics/%d.jpg"
,
ex
.
c_str
(),
code
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
}
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
mainGame
->
GetLocaleDir
(
"pics/%d.png"
),
code
);
...
...
@@ -502,19 +509,21 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
int
width
=
CARD_THUMB_WIDTH
*
mainGame
->
xScale
;
int
height
=
CARD_THUMB_HEIGHT
*
mainGame
->
yScale
;
irr
::
video
::
ITexture
*
img
=
nullptr
;
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"expansions/pics/thumbnail/%d.jpg"
,
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
for
(
auto
ex
:
mainGame
->
GetExpansionsListU
())
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"%s/pics/thumbnail/%d.jpg"
,
ex
.
c_str
(),
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"pics/thumbnail/%d.jpg"
,
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
if
(
img
==
nullptr
&&
mainGame
->
gameConf
.
use_image_scale
)
{
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"expansions/pics/%d.jpg"
,
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
for
(
auto
ex
:
mainGame
->
GetExpansionsListU
())
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"%s/pics/%d.jpg"
,
ex
.
c_str
(),
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"pics/%d.jpg"
,
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
...
...
@@ -561,13 +570,15 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
if
(
tit
==
tFields
.
end
())
{
char
file
[
256
];
irr
::
video
::
ITexture
*
img
=
nullptr
;
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"expansions/pics/field/%d.png"
,
code
);
irr
::
video
::
ITexture
*
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
}
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"expansions/pics/field/%d.jpg"
,
code
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
for
(
auto
ex
:
mainGame
->
GetExpansionsListU
())
{
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"%s/pics/field/%d.png"
,
ex
.
c_str
(),
code
);
irr
::
video
::
ITexture
*
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
}
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"%s/pics/field/%d.jpg"
,
ex
.
c_str
(),
code
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
}
}
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
mainGame
->
GetLocaleDir
(
"pics/field/%d.png"
),
code
);
...
...
@@ -608,13 +619,15 @@ irr::video::ITexture* ImageManager::GetTextureField(int code) {
if
(
tit
==
tFields
.
end
())
{
char
file
[
256
];
irr
::
video
::
ITexture
*
img
=
nullptr
;
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"expansions/pics/field/%d.png"
,
code
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
}
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"expansions/pics/field/%d.jpg"
,
code
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
for
(
auto
ex
:
mainGame
->
GetExpansionsListU
())
{
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"%s/pics/field/%d.png"
,
ex
.
c_str
(),
code
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
}
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"%s/pics/field/%d.jpg"
,
ex
.
c_str
(),
code
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
}
}
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
mainGame
->
GetLocaleDir
(
"pics/field/%d.png"
),
code
);
...
...
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