mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-05-02 10:14:48 +12:00
Bonk v2
This commit is contained in:
parent
c8db0098f5
commit
f1e97fcd61
4 changed files with 20 additions and 16 deletions
|
@ -37,20 +37,6 @@ JNIEnv* jniEnv() {
|
||||||
return env;
|
return env;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AndroidUtils::openDocument(const char* path, const char* perms) {
|
|
||||||
auto env = jniEnv();
|
|
||||||
|
|
||||||
jstring uri = env->NewStringUTF(path);
|
|
||||||
jstring jmode = env->NewStringUTF(perms);
|
|
||||||
|
|
||||||
jint result = env->CallStaticIntMethod(alberClass, alberClassOpenDocument, uri, jmode);
|
|
||||||
|
|
||||||
env->DeleteLocalRef(uri);
|
|
||||||
env->DeleteLocalRef(jmode);
|
|
||||||
|
|
||||||
return (int)result;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
#define MAKE_SETTING(functionName, type, settingName) \
|
#define MAKE_SETTING(functionName, type, settingName) \
|
||||||
|
@ -140,3 +126,17 @@ AlberFunction(jbyteArray, GetSmdh)(JNIEnv* env, jobject obj) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef AlberFunction
|
#undef AlberFunction
|
||||||
|
|
||||||
|
int AndroidUtils::openDocument(const char* path, const char* perms) {
|
||||||
|
auto env = jniEnv();
|
||||||
|
|
||||||
|
jstring uri = env->NewStringUTF(path);
|
||||||
|
jstring jmode = env->NewStringUTF(perms);
|
||||||
|
|
||||||
|
jint result = env->CallStaticIntMethod(alberClass, alberClassOpenDocument, uri, jmode);
|
||||||
|
|
||||||
|
env->DeleteLocalRef(uri);
|
||||||
|
env->DeleteLocalRef(jmode);
|
||||||
|
|
||||||
|
return (int)result;
|
||||||
|
}
|
|
@ -26,6 +26,6 @@ public class Constants {
|
||||||
public static final String PREF_GAME_UTILS = "app.GameUtils";
|
public static final String PREF_GAME_UTILS = "app.GameUtils";
|
||||||
public static final String PREF_INPUT_MAP = "app.InputMap";
|
public static final String PREF_INPUT_MAP = "app.InputMap";
|
||||||
public static final String PREF_SCREEN_CONTROLLER_PROFILES = "app.input.ScreenControllerManager";
|
public static final String PREF_SCREEN_CONTROLLER_PROFILES = "app.input.ScreenControllerManager";
|
||||||
public static final String RESOURCE_FOLDER_ELF = "ELF";
|
public static final String RESOURCE_FOLDER_ELF = "ELF"; // Folder for caching ELF files
|
||||||
public static final String RESOURCE_FOLDER_LUA_SCRIPTS = "Lua Scripts";
|
public static final String RESOURCE_FOLDER_LUA_SCRIPTS = "Lua Scripts";
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,6 +91,7 @@ public class FileUtils {
|
||||||
case "wa":
|
case "wa":
|
||||||
return "wa";
|
return "wa";
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new IllegalArgumentException("Invalid file mode: "+mode);
|
throw new IllegalArgumentException("Invalid file mode: "+mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,6 +283,7 @@ public class FileUtils {
|
||||||
return name.toLowerCase();
|
return name.toLowerCase();
|
||||||
}
|
}
|
||||||
String[] parts = name.split("\\.");
|
String[] parts = name.split("\\.");
|
||||||
|
|
||||||
return parts[parts.length-1].toLowerCase();
|
return parts[parts.length-1].toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,12 +68,14 @@ public class GameUtils {
|
||||||
if (!lower.contains("://")) {
|
if (!lower.contains("://")) {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
Uri uri = Uri.parse(path);
|
Uri uri = Uri.parse(path);
|
||||||
switch (uri.getScheme().toLowerCase()) {
|
switch (uri.getScheme().toLowerCase()) {
|
||||||
case "elf":{
|
case "elf": {
|
||||||
return FileUtils.getResourcePath(Constants.RESOURCE_FOLDER_ELF)+"/"+uri.getAuthority();
|
return FileUtils.getResourcePath(Constants.RESOURCE_FOLDER_ELF)+"/"+uri.getAuthority();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue