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
REIKAI
ygopro
Commits
ae09b4aa
Commit
ae09b4aa
authored
Dec 08, 2018
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add load script from zip
parent
6667cdc5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
14 deletions
+10
-14
gframe/data_manager.cpp
gframe/data_manager.cpp
+9
-13
gframe/data_manager.h
gframe/data_manager.h
+1
-1
No files found.
gframe/data_manager.cpp
View file @
ae09b4aa
...
@@ -6,6 +6,7 @@ namespace ygo {
...
@@ -6,6 +6,7 @@ namespace ygo {
const
wchar_t
*
DataManager
::
unknown_string
=
L"???"
;
const
wchar_t
*
DataManager
::
unknown_string
=
L"???"
;
wchar_t
DataManager
::
strBuffer
[
4096
];
wchar_t
DataManager
::
strBuffer
[
4096
];
byte
DataManager
::
scriptBuffer
[
0x20000
];
byte
DataManager
::
scriptBuffer
[
0x20000
];
IFileSystem
*
DataManager
::
FileSystem
;
DataManager
dataManager
;
DataManager
dataManager
;
bool
DataManager
::
LoadDB
(
const
wchar_t
*
wfile
)
{
bool
DataManager
::
LoadDB
(
const
wchar_t
*
wfile
)
{
...
@@ -75,7 +76,7 @@ bool DataManager::LoadDB(const wchar_t* wfile) {
...
@@ -75,7 +76,7 @@ bool DataManager::LoadDB(const wchar_t* wfile) {
}
}
}
while
(
step
!=
SQLITE_DONE
);
}
while
(
step
!=
SQLITE_DONE
);
sqlite3_finalize
(
pStmt
);
sqlite3_finalize
(
pStmt
);
spmemvfs_close_db
(
&
db
);
spmemvfs_close_db
(
&
db
);
spmemvfs_env_fini
();
spmemvfs_env_fini
();
return
true
;
return
true
;
}
}
...
@@ -117,7 +118,7 @@ bool DataManager::Error(spmemvfs_db_t* pDB, sqlite3_stmt* pStmt) {
...
@@ -117,7 +118,7 @@ bool DataManager::Error(spmemvfs_db_t* pDB, sqlite3_stmt* pStmt) {
BufferIO
::
DecodeUTF8
(
sqlite3_errmsg
(
pDB
->
handle
),
strBuffer
);
BufferIO
::
DecodeUTF8
(
sqlite3_errmsg
(
pDB
->
handle
),
strBuffer
);
if
(
pStmt
)
if
(
pStmt
)
sqlite3_finalize
(
pStmt
);
sqlite3_finalize
(
pStmt
);
spmemvfs_close_db
(
pDB
);
spmemvfs_close_db
(
pDB
);
spmemvfs_env_fini
();
spmemvfs_env_fini
();
return
false
;
return
false
;
}
}
...
@@ -334,21 +335,16 @@ byte* DataManager::ScriptReaderEx(const char* script_name, int* slen) {
...
@@ -334,21 +335,16 @@ byte* DataManager::ScriptReaderEx(const char* script_name, int* slen) {
return
ScriptReader
(
script_name
,
slen
);
return
ScriptReader
(
script_name
,
slen
);
}
}
byte
*
DataManager
::
ScriptReader
(
const
char
*
script_name
,
int
*
slen
)
{
byte
*
DataManager
::
ScriptReader
(
const
char
*
script_name
,
int
*
slen
)
{
FILE
*
fp
;
#ifdef _WIN32
wchar_t
fname
[
256
];
wchar_t
fname
[
256
];
BufferIO
::
DecodeUTF8
(
script_name
,
fname
);
BufferIO
::
DecodeUTF8
(
script_name
,
fname
);
fp
=
_wfopen
(
fname
,
L"rb"
);
IReadFile
*
reader
=
FileSystem
->
createAndOpenFile
(
fname
);
#else
if
(
reader
==
NULL
)
fp
=
fopen
(
script_name
,
"rb"
);
#endif
if
(
!
fp
)
return
0
;
return
0
;
int
len
=
fread
(
scriptBuffer
,
1
,
sizeof
(
scriptBuffer
),
fp
);
size_t
size
=
reader
->
getSize
();
fclose
(
fp
);
if
(
size
>
sizeof
(
scriptBuffer
))
if
(
len
>=
sizeof
(
scriptBuffer
))
return
0
;
return
0
;
*
slen
=
len
;
reader
->
read
(
scriptBuffer
,
size
);
*
slen
=
size
;
return
scriptBuffer
;
return
scriptBuffer
;
}
}
...
...
gframe/data_manager.h
View file @
ae09b4aa
...
@@ -55,7 +55,7 @@ public:
...
@@ -55,7 +55,7 @@ public:
static
int
CardReader
(
int
,
void
*
);
static
int
CardReader
(
int
,
void
*
);
static
byte
*
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
);
static
byte
*
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
);
static
byte
*
ScriptReader
(
const
char
*
script_name
,
int
*
slen
);
static
byte
*
ScriptReader
(
const
char
*
script_name
,
int
*
slen
);
IFileSystem
*
FileSystem
;
static
IFileSystem
*
FileSystem
;
};
};
extern
DataManager
dataManager
;
extern
DataManager
dataManager
;
...
...
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