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
nanahira
ygopro
Commits
32da865f
Commit
32da865f
authored
Jan 19, 2024
by
Chen Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setcode use array
parent
6192b5fd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
20 deletions
+23
-20
gframe/data_manager.cpp
gframe/data_manager.cpp
+19
-11
gframe/data_manager.h
gframe/data_manager.h
+3
-8
gframe/game.cpp
gframe/game.cpp
+1
-1
No files found.
gframe/data_manager.cpp
View file @
32da865f
...
...
@@ -7,11 +7,15 @@ namespace ygo {
const
wchar_t
*
DataManager
::
unknown_string
=
L"???"
;
byte
DataManager
::
scriptBuffer
[
0x20000
];
IFileSystem
*
DataManager
::
FileSystem
;
std
::
unordered_map
<
unsigned
int
,
std
::
vector
<
uint16_t
>>
DataManager
::
extra_setcode
{
{
8512558u
,
{
0x8f
,
0x54
,
0x59
,
0x82
,
0x13a
}},
};
DataManager
dataManager
;
DataManager
::
DataManager
()
:
_datas
(
16384
),
_strings
(
16384
)
{
datas_begin
=
_datas
.
begin
();
datas_end
=
_datas
.
end
();
strings_begin
=
_strings
.
begin
();
strings_end
=
_strings
.
end
();
extra_setcode
=
{
{
8512558u
,
{
0x8f
,
0x54
,
0x59
,
0x82
,
0x13a
}},
};
}
bool
DataManager
::
LoadDB
(
const
wchar_t
*
wfile
)
{
char
file
[
256
];
BufferIO
::
EncodeUTF8
(
wfile
,
file
);
...
...
@@ -50,8 +54,13 @@ bool DataManager::LoadDB(const wchar_t* wfile) {
cd
.
ot
=
sqlite3_column_int
(
pStmt
,
1
);
cd
.
alias
=
sqlite3_column_int
(
pStmt
,
2
);
auto
it
=
extra_setcode
.
find
(
cd
.
code
);
if
(
it
!=
extra_setcode
.
end
())
cd
.
setcode
.
assign
(
it
->
second
.
begin
(),
it
->
second
.
end
());
if
(
it
!=
extra_setcode
.
end
())
{
int
len
=
it
->
second
.
size
();
if
(
len
>
SIZE_SETCODE
)
len
=
SIZE_SETCODE
;
if
(
len
)
std
::
memcpy
(
cd
.
setcode
,
it
->
second
.
data
(),
len
*
sizeof
(
uint16_t
));
}
else
cd
.
set_setcode
(
sqlite3_column_int64
(
pStmt
,
3
));
cd
.
type
=
sqlite3_column_int
(
pStmt
,
4
);
...
...
@@ -166,7 +175,7 @@ bool DataManager::GetData(unsigned int code, CardData* pData) {
if
(
pData
)
{
pData
->
code
=
data
.
code
;
pData
->
alias
=
data
.
alias
;
pData
->
setcode
.
assign
(
data
.
setcode
.
begin
(),
data
.
setcode
.
end
()
);
std
::
memcpy
(
pData
->
setcode
,
data
.
setcode
,
SIZE_SETCODE
);
pData
->
type
=
data
.
type
;
pData
->
level
=
data
.
level
;
pData
->
attribute
=
data
.
attribute
;
...
...
@@ -336,12 +345,11 @@ const wchar_t* DataManager::FormatType(int type) {
return
unknown_string
;
return
tpBuffer
;
}
const
wchar_t
*
DataManager
::
FormatSetName
(
const
std
::
vector
<
uint16_t
>&
setcode
)
{
const
wchar_t
*
DataManager
::
FormatSetName
(
const
uint16_t
setcode
[]
)
{
wchar_t
*
p
=
scBuffer
;
int
len
=
setcode
.
size
();
if
(
len
>
10
)
len
=
10
;
for
(
int
i
=
0
;
i
<
len
;
++
i
)
{
for
(
int
i
=
0
;
i
<
10
;
++
i
)
{
if
(
!
setcode
[
i
])
break
;
const
wchar_t
*
setname
=
GetSetName
(
setcode
[
i
]);
if
(
setname
)
{
BufferIO
::
CopyWStrRef
(
setname
,
p
,
32
);
...
...
gframe/data_manager.h
View file @
32da865f
...
...
@@ -11,12 +11,7 @@ namespace ygo {
class
DataManager
{
public:
DataManager
()
:
_datas
(
16384
),
_strings
(
16384
)
{
datas_begin
=
_datas
.
begin
();
datas_end
=
_datas
.
end
();
strings_begin
=
_strings
.
begin
();
strings_end
=
_strings
.
end
();
}
DataManager
();
bool
LoadDB
(
const
wchar_t
*
wfile
);
bool
LoadStrings
(
const
char
*
file
);
bool
LoadStrings
(
IReadFile
*
reader
);
...
...
@@ -39,7 +34,7 @@ public:
const
wchar_t
*
FormatAttribute
(
int
attribute
);
const
wchar_t
*
FormatRace
(
int
race
);
const
wchar_t
*
FormatType
(
int
type
);
const
wchar_t
*
FormatSetName
(
const
std
::
vector
<
uint16_t
>&
setcode
);
const
wchar_t
*
FormatSetName
(
const
uint16_t
setcode
[]
);
const
wchar_t
*
FormatLinkMarker
(
int
link_marker
);
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_counterStrings
;
...
...
@@ -65,11 +60,11 @@ public:
static
byte
*
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
);
static
byte
*
ScriptReader
(
const
char
*
script_name
,
int
*
slen
);
static
IFileSystem
*
FileSystem
;
static
std
::
unordered_map
<
unsigned
int
,
std
::
vector
<
uint16_t
>>
extra_setcode
;
private:
std
::
unordered_map
<
unsigned
int
,
CardDataC
>
_datas
;
std
::
unordered_map
<
unsigned
int
,
CardString
>
_strings
;
std
::
unordered_map
<
unsigned
int
,
std
::
vector
<
uint16_t
>>
extra_setcode
;
};
extern
DataManager
dataManager
;
...
...
gframe/game.cpp
View file @
32da865f
...
...
@@ -1540,7 +1540,7 @@ void Game::ShowCardInfo(int code, bool resize) {
if
(
cd
.
alias
&&
dataManager
.
GetCodePointer
(
cd
.
alias
)
!=
dataManager
.
datas_end
)
{
target
=
dataManager
.
GetCodePointer
(
cd
.
alias
);
}
if
(
target
->
second
.
setcode
.
size
()
)
{
if
(
target
->
second
.
setcode
[
0
]
)
{
offset
=
23
;
// *yScale;
myswprintf
(
formatBuffer
,
L"%ls%ls"
,
dataManager
.
GetSysString
(
1329
),
dataManager
.
FormatSetName
(
target
->
second
.
setcode
));
stSetName
->
setText
(
formatBuffer
);
...
...
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