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
2f52e8ce
Commit
2f52e8ce
authored
Jul 19, 2021
by
kenan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
open yrp
parent
3144ceef
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
88 additions
and
45 deletions
+88
-45
libcore/android/android_tools.cpp
libcore/android/android_tools.cpp
+47
-29
libcore/android/android_tools.h
libcore/android/android_tools.h
+2
-0
libcore/src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
.../src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
+22
-0
libcore/src/main/java/cn/garymb/ygomobile/core/IrrlichtBridge.java
...rc/main/java/cn/garymb/ygomobile/core/IrrlichtBridge.java
+2
-0
mobile/src/main/java/cn/garymb/ygomobile/GameUriManager.java
mobile/src/main/java/cn/garymb/ygomobile/GameUriManager.java
+11
-12
mobile/src/main/java/cn/garymb/ygomobile/ui/activities/LogoActivity.java
.../java/cn/garymb/ygomobile/ui/activities/LogoActivity.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
...c/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
...c/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/mycard/MyCard.java
...e/src/main/java/cn/garymb/ygomobile/ui/mycard/MyCard.java
+1
-1
No files found.
libcore/android/android_tools.cpp
View file @
2f52e8ce
...
@@ -63,7 +63,7 @@ irr::io::path getExternalStorageDir(ANDROID_APP app) {
...
@@ -63,7 +63,7 @@ irr::io::path getExternalStorageDir(ANDROID_APP app) {
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
if
(
!
jni
)
return
ret
;
return
ret
;
...
@@ -95,7 +95,7 @@ irr::io::path getExternalFilesDir(ANDROID_APP app) {
...
@@ -95,7 +95,7 @@ irr::io::path getExternalFilesDir(ANDROID_APP app) {
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
if
(
!
jni
)
return
ret
;
return
ret
;
...
@@ -125,7 +125,7 @@ float getScreenHeight(ANDROID_APP app) {
...
@@ -125,7 +125,7 @@ float getScreenHeight(ANDROID_APP app) {
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
if
(
!
jni
)
return
ret
;
return
ret
;
...
@@ -150,7 +150,7 @@ float getScreenWidth(ANDROID_APP app) {
...
@@ -150,7 +150,7 @@ float getScreenWidth(ANDROID_APP app) {
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
if
(
!
jni
)
return
ret
;
return
ret
;
...
@@ -175,7 +175,7 @@ irr::io::path getDBDir(ANDROID_APP app) {
...
@@ -175,7 +175,7 @@ irr::io::path getDBDir(ANDROID_APP app) {
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
if
(
!
jni
)
return
ret
;
return
ret
;
...
@@ -204,7 +204,7 @@ irr::io::path getCardImagePath(ANDROID_APP app) {
...
@@ -204,7 +204,7 @@ irr::io::path getCardImagePath(ANDROID_APP app) {
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
if
(
!
jni
)
return
ret
;
return
ret
;
...
@@ -233,7 +233,7 @@ irr::io::path getCoreConfigVersion(ANDROID_APP app) {
...
@@ -233,7 +233,7 @@ irr::io::path getCoreConfigVersion(ANDROID_APP app) {
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
if
(
!
jni
)
return
ret
;
return
ret
;
...
@@ -261,7 +261,7 @@ int getOpenglVersion(ANDROID_APP app) {
...
@@ -261,7 +261,7 @@ int getOpenglVersion(ANDROID_APP app) {
int
ret
=
1
;
int
ret
=
1
;
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
if
(
!
jni
)
return
ret
;
return
ret
;
...
@@ -285,7 +285,7 @@ int getCardQuality(ANDROID_APP app) {
...
@@ -285,7 +285,7 @@ int getCardQuality(ANDROID_APP app) {
int
ret
=
1
;
int
ret
=
1
;
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
if
(
!
jni
)
return
ret
;
return
ret
;
...
@@ -310,7 +310,7 @@ irr::io::path getFontPath(ANDROID_APP app) {
...
@@ -310,7 +310,7 @@ irr::io::path getFontPath(ANDROID_APP app) {
irr
::
io
::
path
ret
;
irr
::
io
::
path
ret
;
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
if
(
!
jni
)
return
ret
;
return
ret
;
...
@@ -338,7 +338,7 @@ irr::io::path getResourcePath(ANDROID_APP app) {
...
@@ -338,7 +338,7 @@ irr::io::path getResourcePath(ANDROID_APP app) {
irr
::
io
::
path
ret
;
irr
::
io
::
path
ret
;
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
if
(
!
jni
)
return
ret
;
return
ret
;
...
@@ -366,7 +366,7 @@ float getXScale(ANDROID_APP app){
...
@@ -366,7 +366,7 @@ float getXScale(ANDROID_APP app){
float
ret
=
1
;
float
ret
=
1
;
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
if
(
!
jni
)
return
ret
;
return
ret
;
...
@@ -390,7 +390,7 @@ float getYScale(ANDROID_APP app){
...
@@ -390,7 +390,7 @@ float getYScale(ANDROID_APP app){
float
ret
=
1
;
float
ret
=
1
;
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
if
(
!
jni
)
return
ret
;
return
ret
;
...
@@ -424,7 +424,7 @@ irr::io::path getSetting(ANDROID_APP app, const char* key) {
...
@@ -424,7 +424,7 @@ irr::io::path getSetting(ANDROID_APP app, const char* key) {
irr
::
io
::
path
ret
;
irr
::
io
::
path
ret
;
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
if
(
!
jni
)
return
ret
;
return
ret
;
...
@@ -468,7 +468,7 @@ void setLastCategory(ANDROID_APP app, const char* catename) {
...
@@ -468,7 +468,7 @@ void setLastCategory(ANDROID_APP app, const char* catename) {
int
getIntSetting
(
ANDROID_APP
app
,
const
char
*
key
,
int
defvalue
){
int
getIntSetting
(
ANDROID_APP
app
,
const
char
*
key
,
int
defvalue
){
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
defvalue
;
return
defvalue
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
if
(
!
jni
)
return
defvalue
;
return
defvalue
;
...
@@ -496,7 +496,7 @@ int getIntSetting(ANDROID_APP app, const char* key,int defvalue){
...
@@ -496,7 +496,7 @@ int getIntSetting(ANDROID_APP app, const char* key,int defvalue){
void
saveIntSetting
(
ANDROID_APP
app
,
const
char
*
key
,
int
value
)
{
void
saveIntSetting
(
ANDROID_APP
app
,
const
char
*
key
,
int
value
)
{
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
;
return
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
if
(
!
jni
)
return
;
return
;
...
@@ -522,7 +522,7 @@ void saveIntSetting(ANDROID_APP app, const char* key, int value) {
...
@@ -522,7 +522,7 @@ void saveIntSetting(ANDROID_APP app, const char* key, int value) {
void
saveSetting
(
ANDROID_APP
app
,
const
char
*
key
,
const
char
*
value
)
{
void
saveSetting
(
ANDROID_APP
app
,
const
char
*
key
,
const
char
*
value
)
{
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
;
return
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
if
(
!
jni
)
return
;
return
;
...
@@ -553,7 +553,7 @@ bool perfromTrick(ANDROID_APP app) {
...
@@ -553,7 +553,7 @@ bool perfromTrick(ANDROID_APP app) {
bool
ret
=
true
;
bool
ret
=
true
;
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
false
;
return
false
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
if
(
!
jni
)
return
false
;
return
false
;
...
@@ -582,7 +582,7 @@ bool getFontAntiAlias(ANDROID_APP app) {
...
@@ -582,7 +582,7 @@ bool getFontAntiAlias(ANDROID_APP app) {
bool
ret
=
true
;
bool
ret
=
true
;
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
true
;
return
true
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
if
(
!
jni
)
return
true
;
return
true
;
...
@@ -611,7 +611,7 @@ bool getFontAntiAlias(ANDROID_APP app) {
...
@@ -611,7 +611,7 @@ bool getFontAntiAlias(ANDROID_APP app) {
void
perfromHapticFeedback
(
ANDROID_APP
app
)
{
void
perfromHapticFeedback
(
ANDROID_APP
app
)
{
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
;
return
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
if
(
!
jni
)
return
;
return
;
...
@@ -629,7 +629,7 @@ irr::io::path getCacheDir(ANDROID_APP app) {
...
@@ -629,7 +629,7 @@ irr::io::path getCacheDir(ANDROID_APP app) {
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
if
(
!
jni
)
return
ret
;
return
ret
;
...
@@ -662,7 +662,7 @@ irr::io::path getCacheDir(ANDROID_APP app) {
...
@@ -662,7 +662,7 @@ irr::io::path getCacheDir(ANDROID_APP app) {
void
toggleIME
(
ANDROID_APP
app
,
bool
pShow
,
const
char
*
hint
)
{
void
toggleIME
(
ANDROID_APP
app
,
bool
pShow
,
const
char
*
hint
)
{
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
;
return
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
// Retrieves NativeActivity.
// Retrieves NativeActivity.
jobject
lNativeActivity
=
app
->
activity
->
clazz
;
jobject
lNativeActivity
=
app
->
activity
->
clazz
;
...
@@ -686,7 +686,7 @@ void toggleGlobalIME(ANDROID_APP app, bool pShow) {
...
@@ -686,7 +686,7 @@ void toggleGlobalIME(ANDROID_APP app, bool pShow) {
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
;
return
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
jint
lFlags
=
2
;
jint
lFlags
=
2
;
...
@@ -752,7 +752,7 @@ void toggleGlobalIME(ANDROID_APP app, bool pShow) {
...
@@ -752,7 +752,7 @@ void toggleGlobalIME(ANDROID_APP app, bool pShow) {
core
::
position2di
initJavaBridge
(
ANDROID_APP
app
,
void
*
handle
)
{
core
::
position2di
initJavaBridge
(
ANDROID_APP
app
,
void
*
handle
)
{
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
core
::
position2di
(
0
,
0
);
return
core
::
position2di
(
0
,
0
);
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
jobject
lNativeActivity
=
app
->
activity
->
clazz
;
jobject
lNativeActivity
=
app
->
activity
->
clazz
;
jclass
ClassNativeActivity
=
jni
->
GetObjectClass
(
lNativeActivity
);
jclass
ClassNativeActivity
=
jni
->
GetObjectClass
(
lNativeActivity
);
...
@@ -777,7 +777,7 @@ core::position2di initJavaBridge(ANDROID_APP app, void* handle) {
...
@@ -777,7 +777,7 @@ core::position2di initJavaBridge(ANDROID_APP app, void* handle) {
InitOptions
*
getInitOptions
(
ANDROID_APP
app
)
{
InitOptions
*
getInitOptions
(
ANDROID_APP
app
)
{
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
NULL
;
return
NULL
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
jobject
lNativeActivity
=
app
->
activity
->
clazz
;
jobject
lNativeActivity
=
app
->
activity
->
clazz
;
jclass
ClassNativeActivity
=
jni
->
GetObjectClass
(
lNativeActivity
);
jclass
ClassNativeActivity
=
jni
->
GetObjectClass
(
lNativeActivity
);
...
@@ -795,7 +795,7 @@ int getLocalAddr(ANDROID_APP app) {
...
@@ -795,7 +795,7 @@ int getLocalAddr(ANDROID_APP app) {
int
addr
=
-
1
;
int
addr
=
-
1
;
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
addr
;
return
addr
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
jobject
lNativeActivity
=
app
->
activity
->
clazz
;
jobject
lNativeActivity
=
app
->
activity
->
clazz
;
jclass
ClassNativeActivity
=
jni
->
GetObjectClass
(
lNativeActivity
);
jclass
ClassNativeActivity
=
jni
->
GetObjectClass
(
lNativeActivity
);
...
@@ -807,11 +807,29 @@ int getLocalAddr(ANDROID_APP app) {
...
@@ -807,11 +807,29 @@ int getLocalAddr(ANDROID_APP app) {
return
addr
;
return
addr
;
}
}
void
OnShareFile
(
ANDROID_APP
app
,
char
*
title
,
char
*
path
){
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
nullptr
);
jobject
lNativeActivity
=
app
->
activity
->
clazz
;
jclass
ClassNativeActivity
=
jni
->
GetObjectClass
(
lNativeActivity
);
jmethodID
MethodGetAddr
=
jni
->
GetMethodID
(
ClassNativeActivity
,
"shareFile"
,
"(Ljava/lang/String;Ljava/lang/String;)V"
);
jstring
s_title
=
jni
->
NewStringUTF
(
title
);
jstring
s_path
=
jni
->
NewStringUTF
(
path
);
jni
->
CallVoidMethod
(
lNativeActivity
,
MethodGetAddr
,
s_title
,
s_path
;
jni
->
ReleaseStringUTFChars
(
s_title
,
title
);
jni
->
ReleaseStringUTFChars
(
s_path
,
path
);
jni
->
DeleteLocalRef
(
ClassNativeActivity
);
app
->
activity
->
vm
->
DetachCurrentThread
();
}
void
showAndroidComboBoxCompat
(
ANDROID_APP
app
,
bool
pShow
,
char
**
pContents
,
void
showAndroidComboBoxCompat
(
ANDROID_APP
app
,
bool
pShow
,
char
**
pContents
,
int
count
,
int
mode
)
{
int
count
,
int
mode
)
{
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
;
return
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
jobject
lNativeActivity
=
app
->
activity
->
clazz
;
jobject
lNativeActivity
=
app
->
activity
->
clazz
;
jclass
ClassNativeActivity
=
jni
->
GetObjectClass
(
lNativeActivity
);
jclass
ClassNativeActivity
=
jni
->
GetObjectClass
(
lNativeActivity
);
...
@@ -834,7 +852,7 @@ void showAndroidComboBoxCompat(ANDROID_APP app, bool pShow, char** pContents,
...
@@ -834,7 +852,7 @@ void showAndroidComboBoxCompat(ANDROID_APP app, bool pShow, char** pContents,
void
toggleOverlayView
(
ANDROID_APP
app
,
bool
pShow
)
{
void
toggleOverlayView
(
ANDROID_APP
app
,
bool
pShow
)
{
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
;
return
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
jobject
lNativeActivity
=
app
->
activity
->
clazz
;
jobject
lNativeActivity
=
app
->
activity
->
clazz
;
jclass
ClassNativeActivity
=
jni
->
GetObjectClass
(
lNativeActivity
);
jclass
ClassNativeActivity
=
jni
->
GetObjectClass
(
lNativeActivity
);
...
@@ -956,7 +974,7 @@ bool android_deck_delete(const char* deck_name) {
...
@@ -956,7 +974,7 @@ bool android_deck_delete(const char* deck_name) {
void
runWindbot
(
ANDROID_APP
app
,
const
char
*
args
)
{
void
runWindbot
(
ANDROID_APP
app
,
const
char
*
args
)
{
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
;
return
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
if
(
!
jni
)
return
;
return
;
...
...
libcore/android/android_tools.h
View file @
2f52e8ce
...
@@ -98,6 +98,8 @@ extern float getScreenWidth(ANDROID_APP app);
...
@@ -98,6 +98,8 @@ extern float getScreenWidth(ANDROID_APP app);
extern
float
getScreenHeight
(
ANDROID_APP
app
);
extern
float
getScreenHeight
(
ANDROID_APP
app
);
extern
void
OnShareFile
(
ANDROID_APP
app
,
char
*
title
,
char
*
path
);
// Get SDCard path.
// Get SDCard path.
extern
irr
::
io
::
path
getExternalStorageDir
(
ANDROID_APP
app
);
extern
irr
::
io
::
path
getExternalStorageDir
(
ANDROID_APP
app
);
...
...
libcore/src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
View file @
2f52e8ce
...
@@ -6,8 +6,10 @@
...
@@ -6,8 +6,10 @@
*/
*/
package
cn.garymb.ygomobile
;
package
cn.garymb.ygomobile
;
import
android.app.AlertDialog
;
import
android.app.NativeActivity
;
import
android.app.NativeActivity
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.pm.ActivityInfo
;
import
android.content.pm.ActivityInfo
;
import
android.content.res.Resources
;
import
android.content.res.Resources
;
...
@@ -522,4 +524,24 @@ public class YGOMobileActivity extends NativeActivity implements
...
@@ -522,4 +524,24 @@ public class YGOMobileActivity extends NativeActivity implements
}
}
super
.
surfaceRedrawNeeded
(
holder
);
super
.
surfaceRedrawNeeded
(
holder
);
}
}
@Override
public
void
shareFile
(
final
String
title
,
final
String
path
)
{
//TODO 分享文件
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
YGOMobileActivity
.
this
);
builder
.
setTitle
(
title
);
builder
.
setMessage
(
path
);
builder
.
setNeutralButton
(
android
.
R
.
string
.
ok
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
dialog
.
dismiss
();
}
});
builder
.
show
();
}
});
}
}
}
libcore/src/main/java/cn/garymb/ygomobile/core/IrrlichtBridge.java
View file @
2f52e8ce
...
@@ -197,6 +197,8 @@ public final class IrrlichtBridge {
...
@@ -197,6 +197,8 @@ public final class IrrlichtBridge {
void
showComboBoxCompat
(
String
[]
items
,
boolean
isShow
,
int
mode
);
void
showComboBoxCompat
(
String
[]
items
,
boolean
isShow
,
int
mode
);
void
shareFile
(
String
title
,
String
path
);
void
performHapticFeedback
();
void
performHapticFeedback
();
/**
/**
...
...
mobile/src/main/java/cn/garymb/ygomobile/GameUriManager.java
View file @
2f52e8ce
...
@@ -30,6 +30,7 @@ import static cn.garymb.ygomobile.Constants.QUERY_NAME;
...
@@ -30,6 +30,7 @@ import static cn.garymb.ygomobile.Constants.QUERY_NAME;
public
class
GameUriManager
{
public
class
GameUriManager
{
private
Activity
activity
;
private
Activity
activity
;
private
String
fname
;
public
GameUriManager
(
Activity
activity
)
{
public
GameUriManager
(
Activity
activity
)
{
this
.
activity
=
activity
;
this
.
activity
=
activity
;
...
@@ -56,7 +57,7 @@ public class GameUriManager {
...
@@ -56,7 +57,7 @@ public class GameUriManager {
options
.
mUserName
=
intent
.
getStringExtra
(
Constants
.
QUERY_USER
);
options
.
mUserName
=
intent
.
getStringExtra
(
Constants
.
QUERY_USER
);
options
.
mPort
=
intent
.
getIntExtra
(
Constants
.
QUERY_PORT
,
0
);
options
.
mPort
=
intent
.
getIntExtra
(
Constants
.
QUERY_PORT
,
0
);
options
.
mRoomName
=
intent
.
getStringExtra
(
Constants
.
QUERY_ROOM
);
options
.
mRoomName
=
intent
.
getStringExtra
(
Constants
.
QUERY_ROOM
);
YGOStarter
.
startGame
(
getActivity
(),
options
);
YGOStarter
.
startGame
(
getActivity
(),
options
,
null
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
Toast
.
makeText
(
getActivity
(),
R
.
string
.
start_game_error
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
getActivity
(),
R
.
string
.
start_game_error
,
Toast
.
LENGTH_SHORT
).
show
();
activity
.
finish
();
activity
.
finish
();
...
@@ -133,7 +134,7 @@ public class GameUriManager {
...
@@ -133,7 +134,7 @@ public class GameUriManager {
}
}
activity
.
startActivity
(
startdeck
);
activity
.
startActivity
(
startdeck
);
}
else
if
(
file
.
getName
().
toLowerCase
(
Locale
.
US
).
endsWith
(
".ypk"
))
{
}
else
if
(
file
.
getName
().
toLowerCase
(
Locale
.
US
).
endsWith
(
".ypk"
))
{
File
ypk
=
new
File
(
AppsSettings
.
get
().
getExpansionsPath
()
+
"/"
+
file
.
getName
()
.
toLowerCase
(
Locale
.
US
)
);
File
ypk
=
new
File
(
AppsSettings
.
get
().
getExpansionsPath
()
+
"/"
+
file
.
getName
());
if
(
ypk
.
exists
()
&&
file
.
lastModified
()
==
ypk
.
lastModified
())
{
if
(
ypk
.
exists
()
&&
file
.
lastModified
()
==
ypk
.
lastModified
())
{
Toast
.
makeText
(
activity
,
activity
.
getString
(
R
.
string
.
file_exist
),
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
activity
,
activity
.
getString
(
R
.
string
.
file_exist
),
Toast
.
LENGTH_LONG
).
show
();
}
else
{
}
else
{
...
@@ -151,9 +152,8 @@ public class GameUriManager {
...
@@ -151,9 +152,8 @@ public class GameUriManager {
Toast
.
makeText
(
activity
,
R
.
string
.
ypk_installed
,
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
activity
,
R
.
string
.
ypk_installed
,
Toast
.
LENGTH_LONG
).
show
();
}
}
}
else
if
(
file
.
getName
().
toLowerCase
(
Locale
.
US
).
endsWith
(
".yrp"
))
{
}
else
if
(
file
.
getName
().
toLowerCase
(
Locale
.
US
).
endsWith
(
".yrp"
))
{
File
yrp
=
new
File
(
AppsSettings
.
get
().
getResourcePath
()
+
"/"
+
CORE_REPLAY_PATH
+
"/"
+
file
.
getName
()
.
toLowerCase
(
Locale
.
US
)
);
File
yrp
=
new
File
(
AppsSettings
.
get
().
getResourcePath
()
+
"/"
+
CORE_REPLAY_PATH
+
"/"
+
file
.
getName
());
if
(
yrp
.
exists
())
{
if
(
yrp
.
exists
())
{
YGOStarter
.
startGame
(
getActivity
(),
null
);
Toast
.
makeText
(
activity
,
activity
.
getString
(
R
.
string
.
file_exist
),
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
activity
,
activity
.
getString
(
R
.
string
.
file_exist
),
Toast
.
LENGTH_LONG
).
show
();
}
else
{
}
else
{
try
{
try
{
...
@@ -161,10 +161,10 @@ public class GameUriManager {
...
@@ -161,10 +161,10 @@ public class GameUriManager {
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
Toast
.
makeText
(
activity
,
activity
.
getString
(
R
.
string
.
install_failed_bcos
)
+
e
,
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
activity
,
activity
.
getString
(
R
.
string
.
install_failed_bcos
)
+
e
,
Toast
.
LENGTH_LONG
).
show
();
}
}
if
(!
ComponentUtils
.
isActivityRunning
(
getActivity
(),
new
ComponentName
(
getActivity
(),
YGOMobileActivity
.
class
)))
{
}
YGOStarter
.
startGame
(
getActivity
(),
null
);
if
(!
ComponentUtils
.
isActivityRunning
(
getActivity
(),
new
ComponentName
(
getActivity
(),
YGOMobileActivity
.
class
)))
{
Toast
.
makeText
(
activity
,
activity
.
getString
(
R
.
string
.
yrp_installed
),
Toast
.
LENGTH_LONG
).
show
(
);
YGOStarter
.
startGame
(
getActivity
(),
null
,
"-r"
+
yrp
.
getName
()
);
}
Toast
.
makeText
(
activity
,
""
+
yrp
.
getName
(),
Toast
.
LENGTH_LONG
).
show
();
}
}
}
}
}
else
if
(
"content"
.
equals
(
uri
.
getScheme
()))
{
}
else
if
(
"content"
.
equals
(
uri
.
getScheme
()))
{
...
@@ -221,11 +221,10 @@ public class GameUriManager {
...
@@ -221,11 +221,10 @@ public class GameUriManager {
Toast
.
makeText
(
activity
,
R
.
string
.
ypk_installed
,
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
activity
,
R
.
string
.
ypk_installed
,
Toast
.
LENGTH_LONG
).
show
();
}
}
}
else
if
(
urifile
.
getName
().
toLowerCase
(
Locale
.
US
).
endsWith
(
".yrp"
))
{
}
else
if
(
urifile
.
getName
().
toLowerCase
(
Locale
.
US
).
endsWith
(
".yrp"
))
{
File
yrp
=
new
File
(
AppsSettings
.
get
().
getResourcePath
()
+
"/"
+
CORE_REPLAY_PATH
+
"/"
+
urifile
.
getName
().
toLowerCase
(
Locale
.
US
));
try
{
try
{
File
yrp
=
new
File
(
AppsSettings
.
get
().
getResourcePath
()
+
"/"
+
CORE_REPLAY_PATH
+
"/"
+
urifile
.
getName
().
toLowerCase
(
Locale
.
US
));
ParcelFileDescriptor
pfd
=
getActivity
().
getContentResolver
().
openFileDescriptor
(
uri
,
"r"
);
ParcelFileDescriptor
pfd
=
getActivity
().
getContentResolver
().
openFileDescriptor
(
uri
,
"r"
);
if
(
yrp
.
exists
())
{
if
(
yrp
.
exists
())
{
YGOStarter
.
startGame
(
getActivity
(),
null
);
Toast
.
makeText
(
activity
,
activity
.
getString
(
R
.
string
.
file_exist
),
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
activity
,
activity
.
getString
(
R
.
string
.
file_exist
),
Toast
.
LENGTH_SHORT
).
show
();
}
else
{
}
else
{
if
(
pfd
==
null
)
{
if
(
pfd
==
null
)
{
...
@@ -244,7 +243,7 @@ public class GameUriManager {
...
@@ -244,7 +243,7 @@ public class GameUriManager {
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
if
(!
ComponentUtils
.
isActivityRunning
(
activity
,
new
ComponentName
(
activity
,
YGOMobileActivity
.
class
)))
{
if
(!
ComponentUtils
.
isActivityRunning
(
activity
,
new
ComponentName
(
activity
,
YGOMobileActivity
.
class
)))
{
YGOStarter
.
startGame
(
activity
,
null
);
YGOStarter
.
startGame
(
getActivity
(),
null
,
"-r "
+
yrp
.
getName
()
);
Toast
.
makeText
(
activity
,
activity
.
getString
(
R
.
string
.
yrp_installed
),
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
activity
,
activity
.
getString
(
R
.
string
.
yrp_installed
),
Toast
.
LENGTH_LONG
).
show
();
}
}
}
}
...
@@ -273,7 +272,7 @@ public class GameUriManager {
...
@@ -273,7 +272,7 @@ public class GameUriManager {
// options.mUserName = uri.getQueryParameter(Constants.QUERY_USER);
// options.mUserName = uri.getQueryParameter(Constants.QUERY_USER);
// options.mPort = Integer.parseInt(uri.getQueryParameter(Constants.QUERY_PORT));
// options.mPort = Integer.parseInt(uri.getQueryParameter(Constants.QUERY_PORT));
// options.mRoomName = uri.getQueryParameter(Constants.QUERY_ROOM);
// options.mRoomName = uri.getQueryParameter(Constants.QUERY_ROOM);
// YGOStarter.startGame(getActivity(), options);
// YGOStarter.startGame(getActivity(), options
, null
);
// } catch (Exception e) {
// } catch (Exception e) {
// Toast.makeText(getActivity(), R.string.start_game_error, Toast.LENGTH_SHORT).show();
// Toast.makeText(getActivity(), R.string.start_game_error, Toast.LENGTH_SHORT).show();
// activity.finish();
// activity.finish();
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/activities/LogoActivity.java
View file @
2f52e8ce
...
@@ -23,7 +23,7 @@ public class LogoActivity extends Activity {
...
@@ -23,7 +23,7 @@ public class LogoActivity extends Activity {
hideBottomUIMenu
();
hideBottomUIMenu
();
setContentView
(
R
.
layout
.
activity_logo
);
setContentView
(
R
.
layout
.
activity_logo
);
if
(
AppsSettings
.
get
().
isOnlyGame
())
{
if
(
AppsSettings
.
get
().
isOnlyGame
())
{
YGOStarter
.
startGame
(
this
,
null
);
YGOStarter
.
startGame
(
this
,
null
,
null
);
finish
();
finish
();
return
;
return
;
}
else
{
}
else
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
View file @
2f52e8ce
...
@@ -473,7 +473,7 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
...
@@ -473,7 +473,7 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
options
.
mUserName
=
serverInfo
.
getPlayerName
();
options
.
mUserName
=
serverInfo
.
getPlayerName
();
options
.
mPort
=
serverInfo
.
getPort
();
options
.
mPort
=
serverInfo
.
getPort
();
options
.
mRoomName
=
name
;
options
.
mRoomName
=
name
;
YGOStarter
.
startGame
(
this
,
options
);
YGOStarter
.
startGame
(
this
,
options
,
null
);
}
}
protected
abstract
void
checkResourceDownload
(
ResCheckTask
.
ResCheckListener
listener
);
protected
abstract
void
checkResourceDownload
(
ResCheckTask
.
ResCheckListener
listener
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
View file @
2f52e8ce
...
@@ -246,7 +246,7 @@ public class MainActivity extends HomeActivity {
...
@@ -246,7 +246,7 @@ public class MainActivity extends HomeActivity {
@Override
@Override
protected
void
openGame
()
{
protected
void
openGame
()
{
if
(
enableStart
)
{
if
(
enableStart
)
{
YGOStarter
.
startGame
(
this
,
null
);
YGOStarter
.
startGame
(
this
,
null
,
null
);
}
else
{
}
else
{
VUiKit
.
show
(
this
,
R
.
string
.
dont_start_game
);
VUiKit
.
show
(
this
,
R
.
string
.
dont_start_game
);
}
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/mycard/MyCard.java
View file @
2f52e8ce
...
@@ -257,7 +257,7 @@ public class MyCard {
...
@@ -257,7 +257,7 @@ public class MyCard {
activity
.
runOnUiThread
(
new
Runnable
()
{
activity
.
runOnUiThread
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
YGOStarter
.
startGame
(
activity
,
options
);
YGOStarter
.
startGame
(
activity
,
options
,
null
);
}
}
});
});
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
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