mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-15 10:40:01 +01:00
Add a new "queryConfig" native android function, so that the Java code can check
config options like rotation lock (config is implemented on the C++ side).
This commit is contained in:
1 parent
4818a85042
commit
c960fdb0b2
5 files changed
+17
-2
No files matched your search
@@ -147,6 +147,14 @@ extern "C" void Java_com_henrikrydgard_libnative_NativeApp_audioConfig
|
||||
optimalSampleRate = optimalSR;
|
||||
}
|
||||
|
||||
extern "C" jstring Java_com_henrikrydgard_libnative_NativeApp_queryConfig
|
||||
(JNIEnv *env, jclass, jstring jquery) {
|
||||
std::string query = GetJavaString(env, jquery);
|
||||
std::string result = NativeQueryConfig(query);
|
||||
jstring jresult = env->NewStringUTF(result.c_str());
|
||||
return jresult;
|
||||
}
|
||||
|
||||
extern "C" void Java_com_henrikrydgard_libnative_NativeApp_init
|
||||
(JNIEnv *env, jclass, jint dpi, jstring jdevicetype, jstring jlangRegion, jstring japkpath,
|
||||
jstring jdataDir, jstring jexternalDir, jstring jlibraryDir, jstring jshortcutParam,
|
||||
|
||||
@@ -669,7 +669,7 @@ public class NativeActivity extends Activity {
|
||||
dlg.setCancelable(true);
|
||||
dlg.show();
|
||||
}
|
||||
|
||||
|
||||
public boolean processCommand(String command, String params) {
|
||||
if (command.equals("launchBrowser")) {
|
||||
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(params));
|
||||
|
||||
@@ -40,5 +40,7 @@ public class NativeApp {
|
||||
public static native void accelerometer(float x, float y, float z);
|
||||
|
||||
public static native void sendMessage(String msg, String arg);
|
||||
|
||||
public static native String queryConfig(String queryName);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,11 @@ void NativeGetAppInfo(std::string *app_dir_name, std::string *app_nice_name, boo
|
||||
// Generic host->C++ messaging, used for functionality like system-native popup input boxes.
|
||||
void NativeMessageReceived(const char *message, const char *value);
|
||||
|
||||
// Easy way for the Java side to ask the C++ side for configuration options, such as
|
||||
// the rotation lock which must be controlled from Java on Android.
|
||||
// It is currently not called on non-Android platforms.
|
||||
std::string NativeQueryConfig(std::string query);
|
||||
|
||||
// For the back button to work right, this should return true on your main or title screen.
|
||||
// Otherwise, just return false.
|
||||
bool NativeIsAtTopLevel();
|
||||
|
||||
+1
-1
@@ -6,6 +6,6 @@ int dp_yres;
|
||||
int pixel_xres;
|
||||
int pixel_yres;
|
||||
|
||||
int g_dpi = 1.0f;
|
||||
int g_dpi = 1; // will be overwritten
|
||||
float g_dpi_scale = 1.0f;
|
||||
float pixel_in_dps = 1.0f;
|
||||
Reference in new issue
Block a user