Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile
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
fallenstardust
YGOMobile
Commits
cb6a8d61
Commit
cb6a8d61
authored
Mar 29, 2019
by
fallenstardust
Committed by
GitHub
Mar 29, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #22 from mercury233/patch-zip
merge zip support
parents
445e34ac
592058c4
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
763 additions
and
58 deletions
+763
-58
Classes/gframe/data_manager.cpp
Classes/gframe/data_manager.cpp
+72
-44
Classes/gframe/data_manager.h
Classes/gframe/data_manager.h
+6
-3
Classes/gframe/game.cpp
Classes/gframe/game.cpp
+54
-10
Classes/gframe/game.h
Classes/gframe/game.h
+1
-1
Classes/gframe/spmemvfs/Android.mk
Classes/gframe/spmemvfs/Android.mk
+10
-0
Classes/gframe/spmemvfs/premake4.lua
Classes/gframe/spmemvfs/premake4.lua
+6
-0
Classes/gframe/spmemvfs/spmemvfs.c
Classes/gframe/spmemvfs/spmemvfs.c
+548
-0
Classes/gframe/spmemvfs/spmemvfs.h
Classes/gframe/spmemvfs/spmemvfs.h
+64
-0
libcore/jni/Android.mk
libcore/jni/Android.mk
+2
-0
No files found.
Classes/gframe/data_manager.cpp
View file @
cb6a8d61
...
@@ -7,19 +7,37 @@ namespace ygo {
...
@@ -7,19 +7,37 @@ 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
char
*
file
)
{
bool
DataManager
::
LoadDB
(
const
wchar_t
*
wfile
)
{
sqlite3
*
pDB
;
char
file
[
256
];
BufferIO
::
EncodeUTF8
(
wfile
,
file
);
#ifdef _WIN32
IReadFile
*
reader
=
FileSystem
->
createAndOpenFile
(
wfile
);
#else
IReadFile
*
reader
=
FileSystem
->
createAndOpenFile
(
file
);
#endif
if
(
reader
==
NULL
)
return
false
;
spmemvfs_db_t
db
;
spmembuffer_t
*
mem
=
(
spmembuffer_t
*
)
calloc
(
sizeof
(
spmembuffer_t
),
1
);
spmemvfs_env_init
();
mem
->
total
=
mem
->
used
=
reader
->
getSize
();
mem
->
data
=
(
char
*
)
malloc
(
mem
->
total
+
1
);
reader
->
read
(
mem
->
data
,
mem
->
total
);
reader
->
drop
();
(
mem
->
data
)[
mem
->
total
]
=
'\0'
;
int
err
=
0
;
int
err
=
0
;
if
((
err
=
sqlite3_open_v2
(
file
,
&
pDB
,
SQLITE_OPEN_READONLY
,
0
))
!=
SQLITE_OK
)
if
((
err
=
spmemvfs_open_db
(
&
db
,
file
,
mem
))
!=
SQLITE_OK
)
return
Error
(
pDB
,
NULL
,
err
);
return
Error
(
&
db
,
NULL
,
err
);
sqlite3
*
pDB
=
db
.
handle
;
sqlite3_stmt
*
pStmt
;
sqlite3_stmt
*
pStmt
;
const
char
*
sql_2
=
"select datas._id, ot, alias, setcode, type, atk, def, level, race, attribute, category, texts.* from datas,texts where datas._id = texts._id;"
;
const
char
*
sql_2
=
"select datas._id, ot, alias, setcode, type, atk, def, level, race, attribute, category, texts.* from datas,texts where datas._id = texts._id;"
;
const
char
*
sql
=
"select datas.id, ot, alias, setcode, type, atk, def, level, race, attribute, category, texts.* from datas,texts where datas.id = texts.id;"
;
const
char
*
sql
=
"select datas.id, ot, alias, setcode, type, atk, def, level, race, attribute, category, texts.* from datas,texts where datas.id = texts.id;"
;
if
((
err
=
sqlite3_prepare_v2
(
pDB
,
sql
,
-
1
,
&
pStmt
,
0
))
!=
SQLITE_OK
){
if
((
err
=
sqlite3_prepare_v2
(
pDB
,
sql
,
-
1
,
&
pStmt
,
0
))
!=
SQLITE_OK
){
if
((
err
=
sqlite3_prepare_v2
(
pDB
,
sql_2
,
-
1
,
&
pStmt
,
0
))
!=
SQLITE_OK
){
if
((
err
=
sqlite3_prepare_v2
(
pDB
,
sql_2
,
-
1
,
&
pStmt
,
0
))
!=
SQLITE_OK
){
return
Error
(
pDB
,
NULL
,
err
);
return
Error
(
&
db
,
NULL
,
err
);
}
}
}
}
CardDataC
cd
;
CardDataC
cd
;
...
@@ -28,7 +46,7 @@ bool DataManager::LoadDB(const char* file) {
...
@@ -28,7 +46,7 @@ bool DataManager::LoadDB(const char* file) {
do
{
do
{
step
=
sqlite3_step
(
pStmt
);
step
=
sqlite3_step
(
pStmt
);
if
(
step
==
SQLITE_BUSY
||
step
==
SQLITE_ERROR
||
step
==
SQLITE_MISUSE
)
if
(
step
==
SQLITE_BUSY
||
step
==
SQLITE_ERROR
||
step
==
SQLITE_MISUSE
)
return
Error
(
pDB
,
pStmt
);
return
Error
(
&
db
,
pStmt
);
else
if
(
step
==
SQLITE_ROW
)
{
else
if
(
step
==
SQLITE_ROW
)
{
cd
.
code
=
sqlite3_column_int
(
pStmt
,
0
);
cd
.
code
=
sqlite3_column_int
(
pStmt
,
0
);
cd
.
ot
=
sqlite3_column_int
(
pStmt
,
1
);
cd
.
ot
=
sqlite3_column_int
(
pStmt
,
1
);
...
@@ -68,7 +86,8 @@ bool DataManager::LoadDB(const char* file) {
...
@@ -68,7 +86,8 @@ bool DataManager::LoadDB(const char* file) {
}
}
}
while
(
step
!=
SQLITE_DONE
);
}
while
(
step
!=
SQLITE_DONE
);
sqlite3_finalize
(
pStmt
);
sqlite3_finalize
(
pStmt
);
sqlite3_close
(
pDB
);
spmemvfs_close_db
(
&
db
);
spmemvfs_env_fini
();
return
true
;
return
true
;
}
}
bool
DataManager
::
LoadStrings
(
const
char
*
file
)
{
bool
DataManager
::
LoadStrings
(
const
char
*
file
)
{
...
@@ -76,37 +95,55 @@ bool DataManager::LoadStrings(const char* file) {
...
@@ -76,37 +95,55 @@ bool DataManager::LoadStrings(const char* file) {
if
(
!
fp
)
if
(
!
fp
)
return
false
;
return
false
;
char
linebuf
[
256
];
char
linebuf
[
256
];
char
strbuf
[
256
];
int
value
;
while
(
fgets
(
linebuf
,
256
,
fp
))
{
while
(
fgets
(
linebuf
,
256
,
fp
))
{
if
(
linebuf
[
0
]
!=
'!'
)
ReadStringConfLine
(
linebuf
);
continue
;
sscanf
(
linebuf
,
"!%s"
,
strbuf
);
if
(
!
strcmp
(
strbuf
,
"system"
))
{
sscanf
(
&
linebuf
[
7
],
"%d %240[^
\n
]"
,
&
value
,
strbuf
);
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
_sysStrings
[
value
]
=
strBuffer
;
}
else
if
(
!
strcmp
(
strbuf
,
"victory"
))
{
sscanf
(
&
linebuf
[
8
],
"%x %240[^
\n
]"
,
&
value
,
strbuf
);
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
_victoryStrings
[
value
]
=
strBuffer
;
}
else
if
(
!
strcmp
(
strbuf
,
"counter"
))
{
sscanf
(
&
linebuf
[
8
],
"%x %240[^
\n
]"
,
&
value
,
strbuf
);
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
_counterStrings
[
value
]
=
strBuffer
;
}
else
if
(
!
strcmp
(
strbuf
,
"setname"
))
{
sscanf
(
&
linebuf
[
8
],
"%x %240[^
\t\n
]"
,
&
value
,
strbuf
);
//using tab for comment
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
_setnameStrings
[
value
]
=
strBuffer
;
}
}
}
fclose
(
fp
);
fclose
(
fp
);
for
(
int
i
=
0
;
i
<
255
;
++
i
)
for
(
int
i
=
0
;
i
<
255
;
++
i
)
myswprintf
(
numStrings
[
i
],
L"%d"
,
i
);
myswprintf
(
numStrings
[
i
],
L"%d"
,
i
);
return
true
;
return
true
;
}
}
bool
DataManager
::
Error
(
sqlite3
*
pDB
,
sqlite3_stmt
*
pStmt
,
int
errNo
)
{
bool
DataManager
::
LoadStrings
(
IReadFile
*
reader
)
{
const
char
*
msg
=
sqlite3_errmsg
(
pDB
);
char
ch
[
2
]
=
" "
;
char
linebuf
[
256
]
=
""
;
while
(
reader
->
read
(
&
ch
[
0
],
1
))
{
if
(
ch
[
0
]
==
'\0'
)
break
;
strcat
(
linebuf
,
ch
);
if
(
ch
[
0
]
==
'\n'
)
{
ReadStringConfLine
(
linebuf
);
linebuf
[
0
]
=
'\0'
;
}
}
reader
->
drop
();
return
true
;
}
void
DataManager
::
ReadStringConfLine
(
const
char
*
linebuf
)
{
if
(
linebuf
[
0
]
!=
'!'
)
return
;
char
strbuf
[
256
];
int
value
;
sscanf
(
linebuf
,
"!%s"
,
strbuf
);
if
(
!
strcmp
(
strbuf
,
"system"
))
{
sscanf
(
&
linebuf
[
7
],
"%d %240[^
\n
]"
,
&
value
,
strbuf
);
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
_sysStrings
[
value
]
=
strBuffer
;
}
else
if
(
!
strcmp
(
strbuf
,
"victory"
))
{
sscanf
(
&
linebuf
[
8
],
"%x %240[^
\n
]"
,
&
value
,
strbuf
);
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
_victoryStrings
[
value
]
=
strBuffer
;
}
else
if
(
!
strcmp
(
strbuf
,
"counter"
))
{
sscanf
(
&
linebuf
[
8
],
"%x %240[^
\n
]"
,
&
value
,
strbuf
);
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
_counterStrings
[
value
]
=
strBuffer
;
}
else
if
(
!
strcmp
(
strbuf
,
"setname"
))
{
sscanf
(
&
linebuf
[
8
],
"%x %240[^
\t\n
]"
,
&
value
,
strbuf
);
//using tab for comment
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
_setnameStrings
[
value
]
=
strBuffer
;
}
}
bool
DataManager
::
Error
(
spmemvfs_db_t
*
pDB
,
sqlite3_stmt
*
pStmt
,
int
errNo
)
{
const
char
*
msg
=
sqlite3_errmsg
(
pDB
->
handle
);
BufferIO
::
DecodeUTF8
(
msg
,
strBuffer
);
BufferIO
::
DecodeUTF8
(
msg
,
strBuffer
);
if
(
pStmt
)
if
(
pStmt
)
sqlite3_finalize
(
pStmt
);
sqlite3_finalize
(
pStmt
);
...
@@ -114,7 +151,8 @@ bool DataManager::Error(sqlite3* pDB, sqlite3_stmt* pStmt, int errNo) {
...
@@ -114,7 +151,8 @@ bool DataManager::Error(sqlite3* pDB, sqlite3_stmt* pStmt, int errNo) {
char
buff
[
len
+
32
];
char
buff
[
len
+
32
];
sprintf
(
buff
,
"cdb Error code=%d,msg=%s"
,
errNo
,
msg
);
sprintf
(
buff
,
"cdb Error code=%d,msg=%s"
,
errNo
,
msg
);
os
::
Printer
::
log
(
buff
);
os
::
Printer
::
log
(
buff
);
sqlite3_close
(
pDB
);
spmemvfs_close_db
(
pDB
);
spmemvfs_env_fini
();
return
false
;
return
false
;
}
}
bool
DataManager
::
GetData
(
int
code
,
CardData
*
pData
)
{
bool
DataManager
::
GetData
(
int
code
,
CardData
*
pData
)
{
...
@@ -344,14 +382,7 @@ byte* DataManager::ScriptReaderEx(const char* script_name, int* slen) {
...
@@ -344,14 +382,7 @@ byte* DataManager::ScriptReaderEx(const char* script_name, int* slen) {
return
ScriptReaderZip
(
second
,
slen
);
return
ScriptReaderZip
(
second
,
slen
);
}
}
byte
*
DataManager
::
ScriptReader
(
const
char
*
script_name
,
int
*
slen
)
{
byte
*
DataManager
::
ScriptReader
(
const
char
*
script_name
,
int
*
slen
)
{
FILE
*
fp
;
FILE
*
fp
=
fopen
(
script_name
,
"rb"
);
#ifdef _WIN32
wchar_t
fname
[
256
];
BufferIO
::
DecodeUTF8
(
script_name
,
fname
);
fp
=
_wfopen
(
fname
,
L"rb"
);
#else
fp
=
fopen
(
script_name
,
"rb"
);
#endif
if
(
!
fp
)
if
(
!
fp
)
return
0
;
return
0
;
int
len
=
fread
(
scriptBuffer
,
1
,
sizeof
(
scriptBuffer
),
fp
);
int
len
=
fread
(
scriptBuffer
,
1
,
sizeof
(
scriptBuffer
),
fp
);
...
@@ -362,10 +393,7 @@ byte* DataManager::ScriptReader(const char* script_name, int* slen) {
...
@@ -362,10 +393,7 @@ byte* DataManager::ScriptReader(const char* script_name, int* slen) {
return
scriptBuffer
;
return
scriptBuffer
;
}
}
byte
*
DataManager
::
ScriptReaderZip
(
const
char
*
script_name
,
int
*
slen
)
{
byte
*
DataManager
::
ScriptReaderZip
(
const
char
*
script_name
,
int
*
slen
)
{
wchar_t
fname
[
256
];
IReadFile
*
reader
=
FileSystem
->
createAndOpenFile
(
script_name
);
BufferIO
::
DecodeUTF8
(
script_name
,
fname
);
IFileSystem
*
fs
=
mainGame
->
device
->
getFileSystem
();
IReadFile
*
reader
=
fs
->
createAndOpenFile
(
fname
);
if
(
reader
==
NULL
)
if
(
reader
==
NULL
)
return
0
;
return
0
;
size_t
size
=
reader
->
getSize
();
size_t
size
=
reader
->
getSize
();
...
...
Classes/gframe/data_manager.h
View file @
cb6a8d61
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#else
#else
#include "sqlite3.h"
#include "sqlite3.h"
#endif
#endif
#include "spmemvfs/spmemvfs.h"
#include "client_card.h"
#include "client_card.h"
#include <unordered_map>
#include <unordered_map>
...
@@ -15,9 +16,11 @@ namespace ygo {
...
@@ -15,9 +16,11 @@ namespace ygo {
class
DataManager
{
class
DataManager
{
public:
public:
DataManager
()
:
_datas
(
8192
),
_strings
(
8192
)
{}
DataManager
()
:
_datas
(
8192
),
_strings
(
8192
)
{}
bool
LoadDB
(
const
char
*
file
);
bool
LoadDB
(
const
wchar_t
*
w
file
);
bool
LoadStrings
(
const
char
*
file
);
bool
LoadStrings
(
const
char
*
file
);
bool
Error
(
sqlite3
*
pDB
,
sqlite3_stmt
*
pStmt
=
0
,
int
err
=
0
);
bool
LoadStrings
(
IReadFile
*
reader
);
void
ReadStringConfLine
(
const
char
*
linebuf
);
bool
Error
(
spmemvfs_db_t
*
pDB
,
sqlite3_stmt
*
pStmt
=
0
,
int
err
=
0
);
bool
GetData
(
int
code
,
CardData
*
pData
);
bool
GetData
(
int
code
,
CardData
*
pData
);
code_pointer
GetCodePointer
(
int
code
);
code_pointer
GetCodePointer
(
int
code
);
bool
GetString
(
int
code
,
CardString
*
pStr
);
bool
GetString
(
int
code
,
CardString
*
pStr
);
...
@@ -59,7 +62,7 @@ public:
...
@@ -59,7 +62,7 @@ public:
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
);
static
byte
*
ScriptReaderZip
(
const
char
*
script_name
,
int
*
slen
);
static
byte
*
ScriptReaderZip
(
const
char
*
script_name
,
int
*
slen
);
static
IFileSystem
*
FileSystem
;
};
};
extern
DataManager
dataManager
;
extern
DataManager
dataManager
;
...
...
Classes/gframe/game.cpp
View file @
cb6a8d61
...
@@ -73,7 +73,7 @@ bool Game::Initialize() {
...
@@ -73,7 +73,7 @@ bool Game::Initialize() {
ILogger
*
logger
=
device
->
getLogger
();
ILogger
*
logger
=
device
->
getLogger
();
// logger->setLogLevel(ELL_WARNING);
// logger->setLogLevel(ELL_WARNING);
isPSEnabled
=
options
->
isPendulumScaleEnabled
();
isPSEnabled
=
options
->
isPendulumScaleEnabled
();
IFileSystem
*
fs
=
device
->
getFileSystem
();
dataManager
.
FileSystem
=
device
->
getFileSystem
();
xScale
=
android
::
getScreenHeight
(
app
)
/
1024.0
;
xScale
=
android
::
getScreenHeight
(
app
)
/
1024.0
;
yScale
=
android
::
getScreenWidth
(
app
)
/
640.0
;
yScale
=
android
::
getScreenWidth
(
app
)
/
640.0
;
/* if (xScale < yScale) {
/* if (xScale < yScale) {
...
@@ -88,7 +88,7 @@ bool Game::Initialize() {
...
@@ -88,7 +88,7 @@ bool Game::Initialize() {
char
log_working
[
256
]
=
{
0
};
char
log_working
[
256
]
=
{
0
};
sprintf
(
log_working
,
"workingDir= %s"
,
workingDir
.
c_str
());
sprintf
(
log_working
,
"workingDir= %s"
,
workingDir
.
c_str
());
Printer
::
log
(
log_working
);
Printer
::
log
(
log_working
);
fs
->
changeWorkingDirectoryTo
(
workingDir
);
dataManager
.
FileSystem
->
changeWorkingDirectoryTo
(
workingDir
);
/* Your media must be somewhere inside the assets folder. The assets folder is the root for the file system.
/* Your media must be somewhere inside the assets folder. The assets folder is the root for the file system.
This example copies the media in the Android.mk makefile. */
This example copies the media in the Android.mk makefile. */
...
@@ -97,9 +97,9 @@ bool Game::Initialize() {
...
@@ -97,9 +97,9 @@ bool Game::Initialize() {
// The Android assets file-system does not know which sub-directories it has (blame google).
// The Android assets file-system does not know which sub-directories it has (blame google).
// So we have to add all sub-directories in assets manually. Otherwise we could still open the files,
// So we have to add all sub-directories in assets manually. Otherwise we could still open the files,
// but existFile checks will fail (which are for example needed by getFont).
// but existFile checks will fail (which are for example needed by getFont).
for
(
u32
i
=
0
;
i
<
fs
->
getFileArchiveCount
();
++
i
)
for
(
u32
i
=
0
;
i
<
dataManager
.
FileSystem
->
getFileArchiveCount
();
++
i
)
{
{
IFileArchive
*
archive
=
fs
->
getFileArchive
(
i
);
IFileArchive
*
archive
=
dataManager
.
FileSystem
->
getFileArchive
(
i
);
if
(
archive
->
getType
()
==
EFAT_ANDROID_ASSET
)
if
(
archive
->
getType
()
==
EFAT_ANDROID_ASSET
)
{
{
archive
->
addDirectoryToFileList
(
mediaPath
);
archive
->
addDirectoryToFileList
(
mediaPath
);
...
@@ -111,7 +111,7 @@ bool Game::Initialize() {
...
@@ -111,7 +111,7 @@ bool Game::Initialize() {
int
len
=
options
->
getArchiveCount
();
int
len
=
options
->
getArchiveCount
();
for
(
int
i
=
0
;
i
<
len
;
i
++
){
for
(
int
i
=
0
;
i
<
len
;
i
++
){
io
::
path
zip_path
=
zips
[
i
];
io
::
path
zip_path
=
zips
[
i
];
if
(
fs
->
addFileArchive
(
zip_path
.
c_str
(),
false
,
false
,
EFAT_ZIP
))
{
if
(
dataManager
.
FileSystem
->
addFileArchive
(
zip_path
.
c_str
(),
false
,
false
,
EFAT_ZIP
))
{
os
::
Printer
::
log
(
"add arrchive ok "
,
zip_path
.
c_str
());
os
::
Printer
::
log
(
"add arrchive ok "
,
zip_path
.
c_str
());
}
else
{
}
else
{
os
::
Printer
::
log
(
"add arrchive fail "
,
zip_path
.
c_str
());
os
::
Printer
::
log
(
"add arrchive fail "
,
zip_path
.
c_str
());
...
@@ -170,12 +170,16 @@ bool Game::Initialize() {
...
@@ -170,12 +170,16 @@ bool Game::Initialize() {
imageManager
.
SetDevice
(
device
);
imageManager
.
SetDevice
(
device
);
if
(
!
imageManager
.
Initial
(
workingDir
))
if
(
!
imageManager
.
Initial
(
workingDir
))
return
false
;
return
false
;
LoadExpansions
();
// LoadExpansions only load zips, the other cdb databases are still loaded by getDBFiles
io
::
path
*
cdbs
=
options
->
getDBFiles
();
io
::
path
*
cdbs
=
options
->
getDBFiles
();
len
=
options
->
getDbCount
();
len
=
options
->
getDbCount
();
//os::Printer::log("load cdbs count %d", len);
//os::Printer::log("load cdbs count %d", len);
for
(
int
i
=
0
;
i
<
len
;
i
++
){
for
(
int
i
=
0
;
i
<
len
;
i
++
){
io
::
path
cdb_path
=
cdbs
[
i
];
io
::
path
cdb_path
=
cdbs
[
i
];
if
(
dataManager
.
LoadDB
(
cdb_path
.
c_str
()))
{
wchar_t
wpath
[
1024
];
BufferIO
::
DecodeUTF8
(
cdb_path
.
c_str
(),
wpath
);
if
(
dataManager
.
LoadDB
(
wpath
))
{
os
::
Printer
::
log
(
"add cdb ok "
,
cdb_path
.
c_str
());
os
::
Printer
::
log
(
"add cdb ok "
,
cdb_path
.
c_str
());
}
else
{
}
else
{
os
::
Printer
::
log
(
"add cdb fail "
,
cdb_path
.
c_str
());
os
::
Printer
::
log
(
"add cdb fail "
,
cdb_path
.
c_str
());
...
@@ -190,10 +194,10 @@ bool Game::Initialize() {
...
@@ -190,10 +194,10 @@ bool Game::Initialize() {
return
false
;
return
false
;
env
=
device
->
getGUIEnvironment
();
env
=
device
->
getGUIEnvironment
();
bool
isAntialias
=
options
->
isFontAntiAliasEnabled
();
bool
isAntialias
=
options
->
isFontAntiAliasEnabled
();
numFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
driver
,
fs
,
gameConf
.
numfont
,
(
int
)
16
*
yScale
,
isAntialias
,
false
);
numFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
driver
,
dataManager
.
FileSystem
,
gameConf
.
numfont
,
(
int
)
16
*
yScale
,
isAntialias
,
false
);
adFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
driver
,
fs
,
gameConf
.
numfont
,
(
int
)
12
*
yScale
,
isAntialias
,
false
);
adFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
driver
,
dataManager
.
FileSystem
,
gameConf
.
numfont
,
(
int
)
12
*
yScale
,
isAntialias
,
false
);
lpcFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
driver
,
fs
,
gameConf
.
numfont
,
(
int
)
48
*
yScale
,
isAntialias
,
true
);
lpcFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
driver
,
dataManager
.
FileSystem
,
gameConf
.
numfont
,
(
int
)
48
*
yScale
,
isAntialias
,
true
);
guiFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
driver
,
fs
,
gameConf
.
textfont
,
(
int
)
gameConf
.
textfontsize
*
yScale
,
isAntialias
,
true
);
guiFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
driver
,
dataManager
.
FileSystem
,
gameConf
.
textfont
,
(
int
)
gameConf
.
textfontsize
*
yScale
,
isAntialias
,
true
);
textFont
=
guiFont
;
textFont
=
guiFont
;
if
(
!
numFont
||
!
textFont
)
{
if
(
!
numFont
||
!
textFont
)
{
os
::
Printer
::
log
(
"add font fail "
);
os
::
Printer
::
log
(
"add font fail "
);
...
@@ -1259,6 +1263,46 @@ void Game::SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gu
...
@@ -1259,6 +1263,46 @@ void Game::SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gu
dataManager
.
strBuffer
[
pbuffer
]
=
0
;
dataManager
.
strBuffer
[
pbuffer
]
=
0
;
pControl
->
setText
(
dataManager
.
strBuffer
);
pControl
->
setText
(
dataManager
.
strBuffer
);
}
}
void
Game
::
LoadExpansions
()
{
// TODO: get isUseExtraCards
#ifdef _IRR_ANDROID_PLATFORM_
DIR
*
dir
;
struct
dirent
*
dirp
;
if
((
dir
=
opendir
(
"./expansions/"
))
==
NULL
)
return
;
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
size_t
len
=
strlen
(
dirp
->
d_name
);
if
(
len
<
5
||
strcasecmp
(
dirp
->
d_name
+
len
-
4
,
".zip"
)
!=
0
)
continue
;
char
upath
[
1024
];
sprintf
(
upath
,
"./expansions/%s"
,
dirp
->
d_name
);
dataManager
.
FileSystem
->
addFileArchive
(
upath
,
true
,
false
);
}
closedir
(
dir
);
#endif
for
(
u32
i
=
0
;
i
<
DataManager
::
FileSystem
->
getFileArchiveCount
();
++
i
)
{
const
IFileList
*
archive
=
DataManager
::
FileSystem
->
getFileArchive
(
i
)
->
getFileList
();
for
(
u32
j
=
0
;
j
<
archive
->
getFileCount
();
++
j
)
{
#ifdef _WIN32
const
wchar_t
*
fname
=
archive
->
getFullFileName
(
j
).
c_str
();
#else
wchar_t
fname
[
1024
];
const
char
*
uname
=
archive
->
getFullFileName
(
j
).
c_str
();
BufferIO
::
DecodeUTF8
(
uname
,
fname
);
#endif
if
(
wcsrchr
(
fname
,
'.'
)
&&
!
wcsncasecmp
(
wcsrchr
(
fname
,
'.'
),
L".cdb"
,
4
))
dataManager
.
LoadDB
(
fname
);
if
(
wcsrchr
(
fname
,
'.'
)
&&
!
wcsncasecmp
(
wcsrchr
(
fname
,
'.'
),
L".conf"
,
5
))
{
#ifdef _WIN32
IReadFile
*
reader
=
DataManager
::
FileSystem
->
createAndOpenFile
(
fname
);
#else
IReadFile
*
reader
=
DataManager
::
FileSystem
->
createAndOpenFile
(
uname
);
#endif
dataManager
.
LoadStrings
(
reader
);
}
}
}
}
void
Game
::
RefreshDeck
(
irr
::
gui
::
IGUIComboBox
*
cbDeck
)
{
void
Game
::
RefreshDeck
(
irr
::
gui
::
IGUIComboBox
*
cbDeck
)
{
cbDeck
->
clear
();
cbDeck
->
clear
();
#ifdef _WIN32
#ifdef _WIN32
...
...
Classes/gframe/game.h
View file @
cb6a8d61
...
@@ -118,7 +118,7 @@ public:
...
@@ -118,7 +118,7 @@ public:
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
);
void
SetStaticText
(
irr
::
gui
::
IGUIStaticText
*
pControl
,
u32
cWidth
,
irr
::
gui
::
CGUITTFont
*
font
,
const
wchar_t
*
text
,
u32
pos
=
0
);
void
LoadExpansion
DB
();
void
LoadExpansion
s
();
void
RefreshDeck
(
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
void
RefreshDeck
(
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
void
RefreshReplay
();
void
RefreshReplay
();
void
RefreshSingleplay
();
void
RefreshSingleplay
();
...
...
Classes/gframe/spmemvfs/Android.mk
0 → 100644
View file @
cb6a8d61
# File: Android.mk
LOCAL_PATH
:=
$(
call
my-dir
)
include
$(CLEAR_VARS)
LOCAL_MODULE
:=
cspmemvfs
LOCAL_SRC_FILES
:=
spmemvfs.c
LOCAL_CFLAGS
:=
-O2
include
$(BUILD_STATIC_LIBRARY)
Classes/gframe/spmemvfs/premake4.lua
0 → 100644
View file @
cb6a8d61
project
"cspmemvfs"
kind
"StaticLib"
files
{
"**.c"
,
"**.h"
}
configuration
"windows"
includedirs
{
"../../sqlite3"
}
Classes/gframe/spmemvfs/spmemvfs.c
0 → 100644
View file @
cb6a8d61
This diff is collapsed.
Click to expand it.
Classes/gframe/spmemvfs/spmemvfs.h
0 → 100644
View file @
cb6a8d61
/*
* BSD 2-Clause License
*
* Copyright 2009 Stephen Liu
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __spmemvfs_h__
#define __spmemvfs_h__
#ifdef __cplusplus
extern
"C"
{
#endif
#include "../../sqlite3/sqlite3.h"
#define SPMEMVFS_NAME "spmemvfs"
typedef
struct
spmembuffer_t
{
char
*
data
;
int
used
;
int
total
;
}
spmembuffer_t
;
typedef
struct
spmemvfs_db_t
{
sqlite3
*
handle
;
spmembuffer_t
*
mem
;
}
spmemvfs_db_t
;
int
spmemvfs_env_init
();
void
spmemvfs_env_fini
();
int
spmemvfs_open_db
(
spmemvfs_db_t
*
db
,
const
char
*
path
,
spmembuffer_t
*
mem
);
int
spmemvfs_close_db
(
spmemvfs_db_t
*
db
);
#ifdef __cplusplus
}
#endif
#endif
libcore/jni/Android.mk
View file @
cb6a8d61
...
@@ -85,6 +85,7 @@ LOCAL_STATIC_LIBRARIES += libevent2
...
@@ -85,6 +85,7 @@ LOCAL_STATIC_LIBRARIES += libevent2
LOCAL_STATIC_LIBRARIES
+=
libocgcore_static
LOCAL_STATIC_LIBRARIES
+=
libocgcore_static
LOCAL_STATIC_LIBRARIES
+=
liblua5.3
LOCAL_STATIC_LIBRARIES
+=
liblua5.3
LOCAL_STATIC_LIBRARIES
+=
clzma
LOCAL_STATIC_LIBRARIES
+=
clzma
LOCAL_STATIC_LIBRARIES
+=
cspmemvfs
LOCAL_STATIC_LIBRARIES
+=
sqlite3
LOCAL_STATIC_LIBRARIES
+=
sqlite3
LOCAL_STATIC_LIBRARIES
+=
libft2
LOCAL_STATIC_LIBRARIES
+=
libft2
...
@@ -100,6 +101,7 @@ $(call import-module,ocgcore)
...
@@ -100,6 +101,7 @@ $(call import-module,ocgcore)
$(call
import-module,lua)
$(call
import-module,lua)
$(call
import-module,freetype)
$(call
import-module,freetype)
$(call
import-module,gframe/lzma)
$(call
import-module,gframe/lzma)
$(call
import-module,gframe/spmemvfs)
$(call
import-module,android/native_app_glue)
$(call
import-module,android/native_app_glue)
...
...
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