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
wyykak
ygopro
Commits
03bd9b95
Commit
03bd9b95
authored
Apr 30, 2021
by
salix5
Committed by
GitHub
Apr 30, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2341 from Fluorohydride/patch-remove-static
remove dataManager::strBuffer[]
parents
2f8dbc6c
0fbe7e48
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
17 deletions
+24
-17
gframe/data_manager.cpp
gframe/data_manager.cpp
+3
-1
gframe/data_manager.h
gframe/data_manager.h
+0
-1
gframe/game.cpp
gframe/game.cpp
+20
-14
gframe/game.h
gframe/game.h
+1
-1
No files found.
gframe/data_manager.cpp
View file @
03bd9b95
...
@@ -5,13 +5,13 @@
...
@@ -5,13 +5,13 @@
namespace
ygo
{
namespace
ygo
{
const
wchar_t
*
DataManager
::
unknown_string
=
L"???"
;
const
wchar_t
*
DataManager
::
unknown_string
=
L"???"
;
wchar_t
DataManager
::
strBuffer
[
4096
];
byte
DataManager
::
scriptBuffer
[
0x20000
];
byte
DataManager
::
scriptBuffer
[
0x20000
];
IFileSystem
*
DataManager
::
FileSystem
;
IFileSystem
*
DataManager
::
FileSystem
;
DataManager
dataManager
;
DataManager
dataManager
;
bool
DataManager
::
LoadDB
(
const
wchar_t
*
wfile
)
{
bool
DataManager
::
LoadDB
(
const
wchar_t
*
wfile
)
{
char
file
[
256
];
char
file
[
256
];
wchar_t
strBuffer
[
4096
];
BufferIO
::
EncodeUTF8
(
wfile
,
file
);
BufferIO
::
EncodeUTF8
(
wfile
,
file
);
#ifdef _WIN32
#ifdef _WIN32
IReadFile
*
reader
=
FileSystem
->
createAndOpenFile
(
wfile
);
IReadFile
*
reader
=
FileSystem
->
createAndOpenFile
(
wfile
);
...
@@ -118,6 +118,7 @@ void DataManager::ReadStringConfLine(const char* linebuf) {
...
@@ -118,6 +118,7 @@ void DataManager::ReadStringConfLine(const char* linebuf) {
return
;
return
;
char
strbuf
[
256
];
char
strbuf
[
256
];
int
value
;
int
value
;
wchar_t
strBuffer
[
4096
];
sscanf
(
linebuf
,
"!%s"
,
strbuf
);
sscanf
(
linebuf
,
"!%s"
,
strbuf
);
if
(
!
strcmp
(
strbuf
,
"system"
))
{
if
(
!
strcmp
(
strbuf
,
"system"
))
{
sscanf
(
&
linebuf
[
7
],
"%d %240[^
\n
]"
,
&
value
,
strbuf
);
sscanf
(
&
linebuf
[
7
],
"%d %240[^
\n
]"
,
&
value
,
strbuf
);
...
@@ -138,6 +139,7 @@ void DataManager::ReadStringConfLine(const char* linebuf) {
...
@@ -138,6 +139,7 @@ void DataManager::ReadStringConfLine(const char* linebuf) {
}
}
}
}
bool
DataManager
::
Error
(
spmemvfs_db_t
*
pDB
,
sqlite3_stmt
*
pStmt
)
{
bool
DataManager
::
Error
(
spmemvfs_db_t
*
pDB
,
sqlite3_stmt
*
pStmt
)
{
wchar_t
strBuffer
[
4096
];
BufferIO
::
DecodeUTF8
(
sqlite3_errmsg
(
pDB
->
handle
),
strBuffer
);
BufferIO
::
DecodeUTF8
(
sqlite3_errmsg
(
pDB
->
handle
),
strBuffer
);
if
(
pStmt
)
if
(
pStmt
)
sqlite3_finalize
(
pStmt
);
sqlite3_finalize
(
pStmt
);
...
...
gframe/data_manager.h
View file @
03bd9b95
...
@@ -51,7 +51,6 @@ public:
...
@@ -51,7 +51,6 @@ public:
wchar_t
scBuffer
[
128
];
wchar_t
scBuffer
[
128
];
wchar_t
lmBuffer
[
32
];
wchar_t
lmBuffer
[
32
];
static
wchar_t
strBuffer
[
4096
];
static
byte
scriptBuffer
[
0x20000
];
static
byte
scriptBuffer
[
0x20000
];
static
const
wchar_t
*
unknown_string
;
static
const
wchar_t
*
unknown_string
;
static
int
CardReader
(
int
,
void
*
);
static
int
CardReader
(
int
,
void
*
);
...
...
gframe/game.cpp
View file @
03bd9b95
...
@@ -254,8 +254,8 @@ bool Game::Initialize() {
...
@@ -254,8 +254,8 @@ bool Game::Initialize() {
chkHostPrepReady
[
i
]
->
setEnabled
(
false
);
chkHostPrepReady
[
i
]
->
setEnabled
(
false
);
}
}
btnHostPrepOB
=
env
->
addButton
(
rect
<
s32
>
(
10
,
180
,
110
,
205
),
wHostPrepare
,
BUTTON_HP_OBSERVER
,
dataManager
.
GetSysString
(
1252
));
btnHostPrepOB
=
env
->
addButton
(
rect
<
s32
>
(
10
,
180
,
110
,
205
),
wHostPrepare
,
BUTTON_HP_OBSERVER
,
dataManager
.
GetSysString
(
1252
));
myswprintf
(
dataManager
.
strBuffer
,
L"%ls%d"
,
dataManager
.
GetSysString
(
1253
),
0
);
myswprintf
(
strbuf
,
L"%ls%d"
,
dataManager
.
GetSysString
(
1253
),
0
);
stHostPrepOB
=
env
->
addStaticText
(
dataManager
.
strBuffer
,
rect
<
s32
>
(
10
,
285
,
270
,
305
),
false
,
false
,
wHostPrepare
);
stHostPrepOB
=
env
->
addStaticText
(
strbuf
,
rect
<
s32
>
(
10
,
285
,
270
,
305
),
false
,
false
,
wHostPrepare
);
stHostPrepRule
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
280
,
30
,
460
,
230
),
false
,
true
,
wHostPrepare
);
stHostPrepRule
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
280
,
30
,
460
,
230
),
false
,
true
,
wHostPrepare
);
env
->
addStaticText
(
dataManager
.
GetSysString
(
1254
),
rect
<
s32
>
(
10
,
210
,
110
,
230
),
false
,
false
,
wHostPrepare
);
env
->
addStaticText
(
dataManager
.
GetSysString
(
1254
),
rect
<
s32
>
(
10
,
210
,
110
,
230
),
false
,
false
,
wHostPrepare
);
cbCategorySelect
=
env
->
addComboBox
(
rect
<
s32
>
(
10
,
230
,
138
,
255
),
wHostPrepare
,
COMBOBOX_HP_CATEGORY
);
cbCategorySelect
=
env
->
addComboBox
(
rect
<
s32
>
(
10
,
230
,
138
,
255
),
wHostPrepare
,
COMBOBOX_HP_CATEGORY
);
...
@@ -709,7 +709,7 @@ bool Game::Initialize() {
...
@@ -709,7 +709,7 @@ bool Game::Initialize() {
btnStartFilter
->
setRelativePosition
(
rect
<
s32
>
(
260
,
80
+
125
/
6
,
390
,
100
+
125
/
6
));
btnStartFilter
->
setRelativePosition
(
rect
<
s32
>
(
260
,
80
+
125
/
6
,
390
,
100
+
125
/
6
));
btnClearFilter
=
env
->
addButton
(
rect
<
s32
>
(
205
,
80
+
125
/
6
,
255
,
100
+
125
/
6
),
wFilter
,
BUTTON_CLEAR_FILTER
,
dataManager
.
GetSysString
(
1304
));
btnClearFilter
=
env
->
addButton
(
rect
<
s32
>
(
205
,
80
+
125
/
6
,
255
,
100
+
125
/
6
),
wFilter
,
BUTTON_CLEAR_FILTER
,
dataManager
.
GetSysString
(
1304
));
}
}
wCategories
=
env
->
addWindow
(
rect
<
s32
>
(
600
,
60
,
1000
,
305
),
false
,
dataManager
.
strBuffer
);
wCategories
=
env
->
addWindow
(
rect
<
s32
>
(
600
,
60
,
1000
,
305
),
false
,
L""
);
wCategories
->
getCloseButton
()
->
setVisible
(
false
);
wCategories
->
getCloseButton
()
->
setVisible
(
false
);
wCategories
->
setDrawTitlebar
(
false
);
wCategories
->
setDrawTitlebar
(
false
);
wCategories
->
setDraggable
(
false
);
wCategories
->
setDraggable
(
false
);
...
@@ -727,7 +727,7 @@ bool Game::Initialize() {
...
@@ -727,7 +727,7 @@ bool Game::Initialize() {
wCategories
->
setRelativePosition
(
rect
<
s32
>
(
1000
-
wcatewidth
,
60
,
1000
,
305
));
wCategories
->
setRelativePosition
(
rect
<
s32
>
(
1000
-
wcatewidth
,
60
,
1000
,
305
));
btnCategoryOK
->
setRelativePosition
(
recti
(
wcatewidth
/
2
-
50
,
210
,
wcatewidth
/
2
+
50
,
235
));
btnCategoryOK
->
setRelativePosition
(
recti
(
wcatewidth
/
2
-
50
,
210
,
wcatewidth
/
2
+
50
,
235
));
btnMarksFilter
=
env
->
addButton
(
rect
<
s32
>
(
60
,
80
+
125
/
6
,
190
,
100
+
125
/
6
),
wFilter
,
BUTTON_MARKS_FILTER
,
dataManager
.
GetSysString
(
1374
));
btnMarksFilter
=
env
->
addButton
(
rect
<
s32
>
(
60
,
80
+
125
/
6
,
190
,
100
+
125
/
6
),
wFilter
,
BUTTON_MARKS_FILTER
,
dataManager
.
GetSysString
(
1374
));
wLinkMarks
=
env
->
addWindow
(
rect
<
s32
>
(
700
,
30
,
820
,
150
),
false
,
dataManager
.
strBuffer
);
wLinkMarks
=
env
->
addWindow
(
rect
<
s32
>
(
700
,
30
,
820
,
150
),
false
,
L""
);
wLinkMarks
->
getCloseButton
()
->
setVisible
(
false
);
wLinkMarks
->
getCloseButton
()
->
setVisible
(
false
);
wLinkMarks
->
setDrawTitlebar
(
false
);
wLinkMarks
->
setDrawTitlebar
(
false
);
wLinkMarks
->
setDraggable
(
false
);
wLinkMarks
->
setDraggable
(
false
);
...
@@ -1013,25 +1013,29 @@ void Game::BuildProjectionMatrix(irr::core::matrix4& mProjection, f32 left, f32
...
@@ -1013,25 +1013,29 @@ void Game::BuildProjectionMatrix(irr::core::matrix4& mProjection, f32 left, f32
mProjection
[
14
]
=
znear
*
zfar
/
(
znear
-
zfar
);
mProjection
[
14
]
=
znear
*
zfar
/
(
znear
-
zfar
);
}
}
void
Game
::
InitStaticText
(
irr
::
gui
::
IGUIStaticText
*
pControl
,
u32
cWidth
,
u32
cHeight
,
irr
::
gui
::
CGUITTFont
*
font
,
const
wchar_t
*
text
)
{
void
Game
::
InitStaticText
(
irr
::
gui
::
IGUIStaticText
*
pControl
,
u32
cWidth
,
u32
cHeight
,
irr
::
gui
::
CGUITTFont
*
font
,
const
wchar_t
*
text
)
{
SetStaticText
(
pControl
,
cWidth
,
font
,
text
);
std
::
wstring
format_text
;
if
(
font
->
getDimension
(
dataManager
.
strBuffer
).
Height
<=
cHeight
)
{
format_text
=
SetStaticText
(
pControl
,
cWidth
,
font
,
text
);
if
(
font
->
getDimension
(
format_text
.
c_str
()).
Height
<=
cHeight
)
{
scrCardText
->
setVisible
(
false
);
scrCardText
->
setVisible
(
false
);
if
(
env
->
hasFocus
(
scrCardText
))
if
(
env
->
hasFocus
(
scrCardText
))
env
->
removeFocus
(
scrCardText
);
env
->
removeFocus
(
scrCardText
);
return
;
return
;
}
}
SetStaticText
(
pControl
,
cWidth
-
25
,
font
,
text
);
format_text
=
SetStaticText
(
pControl
,
cWidth
-
25
,
font
,
text
);
u32
fontheight
=
font
->
getDimension
(
L"A"
).
Height
+
font
->
getKerningHeight
();
u32
fontheight
=
font
->
getDimension
(
L"A"
).
Height
+
font
->
getKerningHeight
();
u32
step
=
(
font
->
getDimension
(
dataManager
.
strBuffer
).
Height
-
cHeight
)
/
fontheight
+
1
;
u32
step
=
(
font
->
getDimension
(
format_text
.
c_str
()
).
Height
-
cHeight
)
/
fontheight
+
1
;
scrCardText
->
setVisible
(
true
);
scrCardText
->
setVisible
(
true
);
scrCardText
->
setMin
(
0
);
scrCardText
->
setMin
(
0
);
scrCardText
->
setMax
(
step
);
scrCardText
->
setMax
(
step
);
scrCardText
->
setPos
(
0
);
scrCardText
->
setPos
(
0
);
}
}
void
Game
::
SetStaticText
(
irr
::
gui
::
IGUIStaticText
*
pControl
,
u32
cWidth
,
irr
::
gui
::
CGUITTFont
*
font
,
const
wchar_t
*
text
,
u32
pos
)
{
std
::
wstring
Game
::
SetStaticText
(
irr
::
gui
::
IGUIStaticText
*
pControl
,
u32
cWidth
,
irr
::
gui
::
CGUITTFont
*
font
,
const
wchar_t
*
text
,
u32
pos
)
{
int
pbuffer
=
0
;
int
pbuffer
=
0
;
u32
_width
=
0
,
_height
=
0
;
u32
_width
=
0
,
_height
=
0
;
wchar_t
prev
=
0
;
wchar_t
prev
=
0
;
wchar_t
strBuffer
[
4096
];
std
::
wstring
ret
;
for
(
size_t
i
=
0
;
text
[
i
]
!=
0
&&
i
<
wcslen
(
text
);
++
i
)
{
for
(
size_t
i
=
0
;
text
[
i
]
!=
0
&&
i
<
wcslen
(
text
);
++
i
)
{
wchar_t
c
=
text
[
i
];
wchar_t
c
=
text
[
i
];
u32
w
=
font
->
getCharDimension
(
c
).
Width
+
font
->
getKerningWidth
(
c
,
prev
);
u32
w
=
font
->
getCharDimension
(
c
).
Width
+
font
->
getKerningWidth
(
c
,
prev
);
...
@@ -1039,7 +1043,7 @@ void Game::SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gu
...
@@ -1039,7 +1043,7 @@ void Game::SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gu
if
(
text
[
i
]
==
L'\r'
)
{
if
(
text
[
i
]
==
L'\r'
)
{
continue
;
continue
;
}
else
if
(
text
[
i
]
==
L'\n'
)
{
}
else
if
(
text
[
i
]
==
L'\n'
)
{
dataManager
.
strBuffer
[
pbuffer
++
]
=
L'\n'
;
strBuffer
[
pbuffer
++
]
=
L'\n'
;
_width
=
0
;
_width
=
0
;
_height
++
;
_height
++
;
prev
=
0
;
prev
=
0
;
...
@@ -1047,7 +1051,7 @@ void Game::SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gu
...
@@ -1047,7 +1051,7 @@ void Game::SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gu
pbuffer
=
0
;
pbuffer
=
0
;
continue
;
continue
;
}
else
if
(
_width
>
0
&&
_width
+
w
>
cWidth
)
{
}
else
if
(
_width
>
0
&&
_width
+
w
>
cWidth
)
{
dataManager
.
strBuffer
[
pbuffer
++
]
=
L'\n'
;
strBuffer
[
pbuffer
++
]
=
L'\n'
;
_width
=
0
;
_width
=
0
;
_height
++
;
_height
++
;
prev
=
0
;
prev
=
0
;
...
@@ -1055,10 +1059,12 @@ void Game::SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gu
...
@@ -1055,10 +1059,12 @@ void Game::SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gu
pbuffer
=
0
;
pbuffer
=
0
;
}
}
_width
+=
w
;
_width
+=
w
;
dataManager
.
strBuffer
[
pbuffer
++
]
=
c
;
strBuffer
[
pbuffer
++
]
=
c
;
}
}
dataManager
.
strBuffer
[
pbuffer
]
=
0
;
strBuffer
[
pbuffer
]
=
0
;
pControl
->
setText
(
dataManager
.
strBuffer
);
pControl
->
setText
(
strBuffer
);
ret
.
assign
(
strBuffer
);
return
ret
;
}
}
void
Game
::
LoadExpansions
()
{
void
Game
::
LoadExpansions
()
{
FileSystem
::
TraversalDir
(
L"./expansions"
,
[](
const
wchar_t
*
name
,
bool
isdir
)
{
FileSystem
::
TraversalDir
(
L"./expansions"
,
[](
const
wchar_t
*
name
,
bool
isdir
)
{
...
...
gframe/game.h
View file @
03bd9b95
...
@@ -119,7 +119,7 @@ public:
...
@@ -119,7 +119,7 @@ public:
void
MainLoop
();
void
MainLoop
();
void
BuildProjectionMatrix
(
irr
::
core
::
matrix4
&
mProjection
,
f32
left
,
f32
right
,
f32
bottom
,
f32
top
,
f32
znear
,
f32
zfar
);
void
BuildProjectionMatrix
(
irr
::
core
::
matrix4
&
mProjection
,
f32
left
,
f32
right
,
f32
bottom
,
f32
top
,
f32
znear
,
f32
zfar
);
void
InitStaticText
(
irr
::
gui
::
IGUIStaticText
*
pControl
,
u32
cWidth
,
u32
cHeight
,
irr
::
gui
::
CGUITTFont
*
font
,
const
wchar_t
*
text
);
void
InitStaticText
(
irr
::
gui
::
IGUIStaticText
*
pControl
,
u32
cWidth
,
u32
cHeight
,
irr
::
gui
::
CGUITTFont
*
font
,
const
wchar_t
*
text
);
void
SetStaticText
(
irr
::
gui
::
IGUIStaticText
*
pControl
,
u32
cWidth
,
irr
::
gui
::
CGUITTFont
*
font
,
const
wchar_t
*
text
,
u32
pos
=
0
);
std
::
wstring
SetStaticText
(
irr
::
gui
::
IGUIStaticText
*
pControl
,
u32
cWidth
,
irr
::
gui
::
CGUITTFont
*
font
,
const
wchar_t
*
text
,
u32
pos
=
0
);
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
);
...
...
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