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
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
MyCard
ygopro
Commits
8d8bd503
Commit
8d8bd503
authored
Jun 01, 2025
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add gameConf.use_image_load_background_thread
parent
c41aa289
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
37 deletions
+7
-37
gframe/drawing.cpp
gframe/drawing.cpp
+2
-6
gframe/game.cpp
gframe/game.cpp
+2
-0
gframe/game.h
gframe/game.h
+1
-0
gframe/image_manager.cpp
gframe/image_manager.cpp
+2
-19
gframe/image_manager.h
gframe/image_manager.h
+0
-12
No files found.
gframe/drawing.cpp
View file @
8d8bd503
...
...
@@ -1262,12 +1262,8 @@ void Game::DrawDeckBd() {
driver
->
draw2DRectangle
(
Resize
(
805
,
160
,
1020
,
630
),
0x400000ff
,
0x400000ff
,
0x40000000
,
0x40000000
);
driver
->
draw2DRectangleOutline
(
Resize
(
804
,
159
,
1020
,
630
));
}
#ifdef YGOPRO_USE_THUMB_LOAD_THREAD
constexpr
int
MAX_RESULT
=
9
;
#else
constexpr
int
MAX_RESULT
=
7
;
#endif
for
(
int
i
=
0
;
i
<
MAX_RESULT
&&
i
+
scrFilter
->
getPos
()
<
(
int
)
deckBuilder
.
results
.
size
();
++
i
)
{
int
max_result
=
mainGame
->
gameConf
.
use_image_load_background_thread
?
9
:
7
;
for
(
int
i
=
0
;
i
<
max_result
&&
i
+
scrFilter
->
getPos
()
<
(
int
)
deckBuilder
.
results
.
size
();
++
i
)
{
code_pointer
ptr
=
deckBuilder
.
results
[
i
+
scrFilter
->
getPos
()];
if
(
i
>=
7
)
{
...
...
gframe/game.cpp
View file @
8d8bd503
...
...
@@ -1326,6 +1326,8 @@ void Game::LoadConfig() {
gameConf
.
use_d3d
=
std
::
strtol
(
valbuf
,
nullptr
,
10
)
>
0
;
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"use_image_scale"
))
{
gameConf
.
use_image_scale
=
std
::
strtol
(
valbuf
,
nullptr
,
10
)
>
0
;
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"use_image_load_background_thread"
))
{
gameConf
.
use_image_load_background_thread
=
std
::
strtol
(
valbuf
,
nullptr
,
10
)
>
0
;
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"errorlog"
))
{
unsigned
int
val
=
std
::
strtol
(
valbuf
,
nullptr
,
10
);
enable_log
=
val
&
0xff
;
...
...
gframe/game.h
View file @
8d8bd503
...
...
@@ -49,6 +49,7 @@ bool IsExtension(const char* filename, const char(&extension)[N]) {
struct
Config
{
bool
use_d3d
{
false
};
bool
use_image_scale
{
true
};
bool
use_image_load_background_thread
{
false
};
unsigned
short
antialias
{
0
};
unsigned
short
serverport
{
7911
};
unsigned
char
textfontsize
{
14
};
...
...
gframe/image_manager.cpp
View file @
8d8bd503
#include "image_manager.h"
#include "game.h"
#ifdef YGOPRO_USE_THUMB_LOAD_THREAD
#include <thread>
#endif
#ifdef _OPENMP
#include <omp.h>
#endif
...
...
@@ -22,10 +20,8 @@ bool ImageManager::Initial() {
tUnknownFit
=
nullptr
;
tUnknownThumb
=
nullptr
;
tBigPicture
=
nullptr
;
#ifdef YGOPRO_USE_THUMB_LOAD_THREAD
tLoading
=
nullptr
;
tThumbLoadingThreadRunning
=
false
;
#endif
tAct
=
driver
->
getTexture
(
"textures/act.png"
);
tAttack
=
driver
->
getTexture
(
"textures/attack.png"
);
tChain
=
driver
->
getTexture
(
"textures/chain.png"
);
...
...
@@ -66,11 +62,7 @@ void ImageManager::ClearTexture() {
driver
->
removeTexture
(
tit
->
second
);
}
for
(
auto
tit
=
tThumb
.
begin
();
tit
!=
tThumb
.
end
();
++
tit
)
{
#ifdef YGOPRO_USE_THUMB_LOAD_THREAD
if
(
tit
->
second
&&
tit
->
second
!=
tLoading
)
#else
if
(
tit
->
second
)
#endif
driver
->
removeTexture
(
tit
->
second
);
}
if
(
tBigPicture
!=
nullptr
)
{
...
...
@@ -80,14 +72,12 @@ void ImageManager::ClearTexture() {
tMap
[
0
].
clear
();
tMap
[
1
].
clear
();
tThumb
.
clear
();
#ifdef YGOPRO_USE_THUMB_LOAD_THREAD
tThumbLoadingMutex
.
lock
();
tThumbLoading
.
clear
();
while
(
!
tThumbLoadingCodes
.
empty
())
tThumbLoadingCodes
.
pop
();
tThumbLoadingThreadRunning
=
false
;
tThumbLoadingMutex
.
unlock
();
#endif
tFields
.
clear
();
}
void
ImageManager
::
RemoveTexture
(
int
code
)
{
...
...
@@ -123,10 +113,8 @@ void ImageManager::ResizeTexture() {
driver
->
removeTexture
(
tUnknown
);
driver
->
removeTexture
(
tUnknownFit
);
driver
->
removeTexture
(
tUnknownThumb
);
#ifdef YGOPRO_USE_THUMB_LOAD_THREAD
driver
->
removeTexture
(
tLoading
);
tLoading
=
GetTextureFromFile
(
"textures/cover.jpg"
,
imgWidthThumb
,
imgHeightThumb
);
#endif
tUnknown
=
GetTextureFromFile
(
"textures/unknown.jpg"
,
CARD_IMG_WIDTH
,
CARD_IMG_HEIGHT
);
tUnknownFit
=
GetTextureFromFile
(
"textures/unknown.jpg"
,
imgWidthFit
,
imgHeightFit
);
tUnknownThumb
=
GetTextureFromFile
(
"textures/unknown.jpg"
,
imgWidthThumb
,
imgHeightThumb
);
...
...
@@ -298,7 +286,6 @@ irr::video::ITexture* ImageManager::GetBigPicture(int code, float zoom) {
tBigPicture
=
texture
;
return
texture
;
}
#ifdef YGOPRO_USE_THUMB_LOAD_THREAD
int
ImageManager
::
LoadThumbThread
()
{
while
(
true
)
{
imageManager
.
tThumbLoadingMutex
.
lock
();
...
...
@@ -354,13 +341,11 @@ int ImageManager::LoadThumbThread() {
imageManager
.
tThumbLoadingMutex
.
unlock
();
return
0
;
}
#endif // YGOPRO_USE_THUMB_LOAD_THREAD
irr
::
video
::
ITexture
*
ImageManager
::
GetTextureThumb
(
int
code
)
{
if
(
code
==
0
)
return
tUnknownThumb
;
#ifndef YGOPRO_USE_THUMB_LOAD_THREAD
auto
tit
=
tThumb
.
find
(
code
);
if
(
tit
==
tThumb
.
end
())
{
if
(
tit
==
tThumb
.
end
()
&&
!
mainGame
->
gameConf
.
use_image_load_background_thread
)
{
char
file
[
256
];
std
::
snprintf
(
file
,
sizeof
file
,
"expansions/pics/thumbnail/%d.jpg"
,
code
);
int
width
=
CARD_THUMB_WIDTH
*
mainGame
->
xScale
;
...
...
@@ -381,7 +366,6 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
tThumb
[
code
]
=
img
;
return
(
img
==
NULL
)
?
tUnknownThumb
:
img
;
}
#else // YGOPRO_USE_THUMB_LOAD_THREAD
imageManager
.
tThumbLoadingMutex
.
lock
();
auto
lit
=
tThumbLoading
.
find
(
code
);
if
(
lit
!=
tThumbLoading
.
end
())
{
...
...
@@ -397,7 +381,7 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
tThumbLoading
.
erase
(
lit
);
}
imageManager
.
tThumbLoadingMutex
.
unlock
();
auto
tit
=
tThumb
.
find
(
code
);
tit
=
tThumb
.
find
(
code
);
if
(
tit
==
tThumb
.
end
())
{
tThumb
[
code
]
=
tLoading
;
imageManager
.
tThumbLoadingMutex
.
lock
();
...
...
@@ -409,7 +393,6 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
imageManager
.
tThumbLoadingMutex
.
unlock
();
return
tLoading
;
}
#endif // YGOPRO_USE_THUMB_LOAD_THREAD
if
(
tit
->
second
)
return
tit
->
second
;
else
...
...
gframe/image_manager.h
View file @
8d8bd503
#ifndef IMAGEMANAGER_H
#define IMAGEMANAGER_H
#ifndef _OPENMP
#define YGOPRO_USE_THUMB_LOAD_THREAD
#endif
#include "config.h"
#include "data_manager.h"
#include <unordered_map>
#ifdef YGOPRO_USE_THUMB_LOAD_THREAD
#include <queue>
#include <mutex>
#endif
namespace
ygo
{
...
...
@@ -27,19 +21,15 @@ public:
irr
::
video
::
ITexture
*
GetBigPicture
(
int
code
,
float
zoom
);
irr
::
video
::
ITexture
*
GetTextureThumb
(
int
code
);
irr
::
video
::
ITexture
*
GetTextureField
(
int
code
);
#ifdef YGOPRO_USE_THUMB_LOAD_THREAD
static
int
LoadThumbThread
();
#endif
std
::
unordered_map
<
int
,
irr
::
video
::
ITexture
*>
tMap
[
2
];
std
::
unordered_map
<
int
,
irr
::
video
::
ITexture
*>
tThumb
;
std
::
unordered_map
<
int
,
irr
::
video
::
ITexture
*>
tFields
;
#ifdef YGOPRO_USE_THUMB_LOAD_THREAD
std
::
unordered_map
<
int
,
irr
::
video
::
IImage
*>
tThumbLoading
;
std
::
queue
<
int
>
tThumbLoadingCodes
;
std
::
mutex
tThumbLoadingMutex
;
bool
tThumbLoadingThreadRunning
;
#endif
irr
::
IrrlichtDevice
*
device
;
irr
::
video
::
IVideoDriver
*
driver
;
irr
::
video
::
ITexture
*
tCover
[
4
];
...
...
@@ -47,9 +37,7 @@ public:
irr
::
video
::
ITexture
*
tUnknownFit
;
irr
::
video
::
ITexture
*
tUnknownThumb
;
irr
::
video
::
ITexture
*
tBigPicture
;
#ifdef YGOPRO_USE_THUMB_LOAD_THREAD
irr
::
video
::
ITexture
*
tLoading
;
#endif
irr
::
video
::
ITexture
*
tAct
;
irr
::
video
::
ITexture
*
tAttack
;
irr
::
video
::
ITexture
*
tNegated
;
...
...
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