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
1
Merge Requests
1
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
ecda872e
Commit
ecda872e
authored
Dec 04, 2025
by
salix5
Committed by
GitHub
Dec 04, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add default statement SELECT_STMT (#2936)
parent
3be352ff
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
gframe/data_manager.cpp
gframe/data_manager.cpp
+8
-7
gframe/data_manager.h
gframe/data_manager.h
+3
-2
No files found.
gframe/data_manager.cpp
View file @
ecda872e
...
@@ -6,6 +6,9 @@ namespace ygo {
...
@@ -6,6 +6,9 @@ namespace ygo {
unsigned
char
DataManager
::
scriptBuffer
[
0x100000
]
=
{};
unsigned
char
DataManager
::
scriptBuffer
[
0x100000
]
=
{};
DataManager
dataManager
;
DataManager
dataManager
;
static
const
char
SELECT_STMT
[]
=
"SELECT datas.id, datas.ot, datas.alias, datas.setcode, datas.type, datas.atk, datas.def, datas.level, datas.race, datas.attribute, datas.category,"
" texts.name, texts.desc, texts.str1, texts.str2, texts.str3, texts.str4, texts.str5, texts.str6, texts.str7, texts.str8,"
" texts.str9, texts.str10, texts.str11, texts.str12, texts.str13, texts.str14, texts.str15, texts.str16 FROM datas INNER JOIN texts ON datas.id = texts.id"
;
DataManager
::
DataManager
()
:
_datas
(
32768
),
_strings
(
32768
)
{
DataManager
::
DataManager
()
:
_datas
(
32768
),
_strings
(
32768
)
{
extra_setcode
=
{
extra_setcode
=
{
...
@@ -15,8 +18,7 @@ DataManager::DataManager() : _datas(32768), _strings(32768) {
...
@@ -15,8 +18,7 @@ DataManager::DataManager() : _datas(32768), _strings(32768) {
}
}
bool
DataManager
::
ReadDB
(
sqlite3
*
pDB
)
{
bool
DataManager
::
ReadDB
(
sqlite3
*
pDB
)
{
sqlite3_stmt
*
pStmt
=
nullptr
;
sqlite3_stmt
*
pStmt
=
nullptr
;
const
char
*
sql
=
"select * from datas,texts where datas.id=texts.id"
;
if
(
sqlite3_prepare_v2
(
pDB
,
SELECT_STMT
,
-
1
,
&
pStmt
,
nullptr
)
!=
SQLITE_OK
)
if
(
sqlite3_prepare_v2
(
pDB
,
sql
,
-
1
,
&
pStmt
,
nullptr
)
!=
SQLITE_OK
)
return
Error
(
pDB
,
pStmt
);
return
Error
(
pDB
,
pStmt
);
wchar_t
strBuffer
[
4096
];
wchar_t
strBuffer
[
4096
];
for
(
int
step
=
sqlite3_step
(
pStmt
);
step
!=
SQLITE_DONE
;
step
=
sqlite3_step
(
pStmt
))
{
for
(
int
step
=
sqlite3_step
(
pStmt
);
step
!=
SQLITE_DONE
;
step
=
sqlite3_step
(
pStmt
))
{
...
@@ -46,17 +48,16 @@ bool DataManager::ReadDB(sqlite3* pDB) {
...
@@ -46,17 +48,16 @@ bool DataManager::ReadDB(sqlite3* pDB) {
cd
.
attribute
=
static_cast
<
decltype
(
cd
.
attribute
)
>
(
sqlite3_column_int64
(
pStmt
,
9
));
cd
.
attribute
=
static_cast
<
decltype
(
cd
.
attribute
)
>
(
sqlite3_column_int64
(
pStmt
,
9
));
cd
.
category
=
static_cast
<
decltype
(
cd
.
category
)
>
(
sqlite3_column_int64
(
pStmt
,
10
));
cd
.
category
=
static_cast
<
decltype
(
cd
.
category
)
>
(
sqlite3_column_int64
(
pStmt
,
10
));
auto
&
cs
=
_strings
[
code
];
auto
&
cs
=
_strings
[
code
];
if
(
const
char
*
text
=
(
const
char
*
)
sqlite3_column_text
(
pStmt
,
1
2
))
{
if
(
const
char
*
text
=
(
const
char
*
)
sqlite3_column_text
(
pStmt
,
1
1
))
{
BufferIO
::
DecodeUTF8
(
text
,
strBuffer
);
BufferIO
::
DecodeUTF8
(
text
,
strBuffer
);
cs
.
name
=
strBuffer
;
cs
.
name
=
strBuffer
;
}
}
if
(
const
char
*
text
=
(
const
char
*
)
sqlite3_column_text
(
pStmt
,
1
3
))
{
if
(
const
char
*
text
=
(
const
char
*
)
sqlite3_column_text
(
pStmt
,
1
2
))
{
BufferIO
::
DecodeUTF8
(
text
,
strBuffer
);
BufferIO
::
DecodeUTF8
(
text
,
strBuffer
);
cs
.
text
=
strBuffer
;
cs
.
text
=
strBuffer
;
}
}
constexpr
int
desc_count
=
sizeof
cs
.
desc
/
sizeof
cs
.
desc
[
0
];
for
(
int
i
=
0
;
i
<
DESC_COUNT
;
++
i
)
{
for
(
int
i
=
0
;
i
<
desc_count
;
++
i
)
{
if
(
const
char
*
text
=
(
const
char
*
)
sqlite3_column_text
(
pStmt
,
13
+
i
))
{
if
(
const
char
*
text
=
(
const
char
*
)
sqlite3_column_text
(
pStmt
,
i
+
14
))
{
BufferIO
::
DecodeUTF8
(
text
,
strBuffer
);
BufferIO
::
DecodeUTF8
(
text
,
strBuffer
);
cs
.
desc
[
i
]
=
strBuffer
;
cs
.
desc
[
i
]
=
strBuffer
;
}
}
...
...
gframe/data_manager.h
View file @
ecda872e
...
@@ -19,7 +19,7 @@ namespace ygo {
...
@@ -19,7 +19,7 @@ namespace ygo {
constexpr
int
MAX_STRING_ID
=
0x7ff
;
constexpr
int
MAX_STRING_ID
=
0x7ff
;
constexpr
uint32_t
MIN_CARD_ID
=
(
uint32_t
)(
MAX_STRING_ID
+
1
)
>>
4
;
constexpr
uint32_t
MIN_CARD_ID
=
(
uint32_t
)(
MAX_STRING_ID
+
1
)
>>
4
;
constexpr
uint32_t
MAX_CARD_ID
=
0x0fffffffU
;
constexpr
uint32_t
MAX_CARD_ID
=
0x0fffffffU
;
using
CardData
=
card_data
;
using
CardData
=
card_data
;
struct
CardDataC
{
struct
CardDataC
{
uint32_t
code
{};
uint32_t
code
{};
...
@@ -49,10 +49,11 @@ struct CardDataC {
...
@@ -49,10 +49,11 @@ struct CardDataC {
return
false
;
return
false
;
}
}
};
};
constexpr
int
DESC_COUNT
=
16
;
struct
CardString
{
struct
CardString
{
std
::
wstring
name
;
std
::
wstring
name
;
std
::
wstring
text
;
std
::
wstring
text
;
std
::
wstring
desc
[
16
];
std
::
wstring
desc
[
DESC_COUNT
];
};
};
using
code_pointer
=
std
::
unordered_map
<
uint32_t
,
CardDataC
>::
const_iterator
;
using
code_pointer
=
std
::
unordered_map
<
uint32_t
,
CardDataC
>::
const_iterator
;
using
string_pointer
=
std
::
unordered_map
<
uint32_t
,
CardString
>::
const_iterator
;
using
string_pointer
=
std
::
unordered_map
<
uint32_t
,
CardString
>::
const_iterator
;
...
...
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