Fixed formatting

This commit is contained in:
OpenSauce04 2024-04-04 15:51:27 +01:00
parent 0929a9ada9
commit b7d8373b2f
9 changed files with 164 additions and 157 deletions

View file

@ -69,11 +69,11 @@ void InitJNI(JNIEnv* env) {
env->NewGlobalRef(env->FindClass("io/github/lime3ds/android/applets/MiiSelector"))); env->NewGlobalRef(env->FindClass("io/github/lime3ds/android/applets/MiiSelector")));
s_mii_selector_config_class = reinterpret_cast<jclass>(env->NewGlobalRef( s_mii_selector_config_class = reinterpret_cast<jclass>(env->NewGlobalRef(
env->FindClass("io/github/lime3ds/android/applets/MiiSelector$MiiSelectorConfig"))); env->FindClass("io/github/lime3ds/android/applets/MiiSelector$MiiSelectorConfig")));
s_mii_selector_data_class = reinterpret_cast<jclass>( s_mii_selector_data_class = reinterpret_cast<jclass>(env->NewGlobalRef(
env->NewGlobalRef(env->FindClass("io/github/lime3ds/android/applets/MiiSelector$MiiSelectorData"))); env->FindClass("io/github/lime3ds/android/applets/MiiSelector$MiiSelectorData")));
s_mii_selector_execute = s_mii_selector_execute = env->GetStaticMethodID(
env->GetStaticMethodID(s_mii_selector_class, "Execute", s_mii_selector_class, "Execute",
"(Lio/github/lime3ds/android/applets/MiiSelector$MiiSelectorConfig;)Lio/" "(Lio/github/lime3ds/android/applets/MiiSelector$MiiSelectorConfig;)Lio/"
"github/lime3ds/android/applets/MiiSelector$MiiSelectorData;"); "github/lime3ds/android/applets/MiiSelector$MiiSelectorData;");
} }

View file

@ -83,9 +83,10 @@ void InitJNI(JNIEnv* env) {
s_validation_error_class = reinterpret_cast<jclass>(env->NewGlobalRef( s_validation_error_class = reinterpret_cast<jclass>(env->NewGlobalRef(
env->FindClass("io/github/lime3ds/android/applets/SoftwareKeyboard$ValidationError"))); env->FindClass("io/github/lime3ds/android/applets/SoftwareKeyboard$ValidationError")));
s_swkbd_execute = env->GetStaticMethodID( s_swkbd_execute =
s_software_keyboard_class, "Execute", env->GetStaticMethodID(s_software_keyboard_class, "Execute",
"(Lio/github/lime3ds/android/applets/SoftwareKeyboard$KeyboardConfig;)Lio/github/lime3ds/android/" "(Lio/github/lime3ds/android/applets/"
"SoftwareKeyboard$KeyboardConfig;)Lio/github/lime3ds/android/"
"applets/SoftwareKeyboard$KeyboardData;"); "applets/SoftwareKeyboard$KeyboardData;");
s_swkbd_show_error = s_swkbd_show_error =
env->GetStaticMethodID(s_software_keyboard_class, "ShowError", "(Ljava/lang/String;)V"); env->GetStaticMethodID(s_software_keyboard_class, "ShowError", "(Ljava/lang/String;)V");
@ -120,11 +121,13 @@ jobject ToJavaValidationError(Frontend::ValidationError error) {
JNIEnv* env = IDCache::GetEnvForThread(); JNIEnv* env = IDCache::GetEnvForThread();
return env->GetStaticObjectField( return env->GetStaticObjectField(
s_validation_error_class, s_validation_error_class,
env->GetStaticFieldID(s_validation_error_class, ValidationErrorNameMap.at(error), env->GetStaticFieldID(
s_validation_error_class, ValidationErrorNameMap.at(error),
"Lio/github/lime3ds/android/applets/SoftwareKeyboard$ValidationError;")); "Lio/github/lime3ds/android/applets/SoftwareKeyboard$ValidationError;"));
} }
jobject Java_io_github_lime3ds_android_applets_SoftwareKeyboard_ValidateFilters(JNIEnv* env, jclass clazz, jobject Java_io_github_lime3ds_android_applets_SoftwareKeyboard_ValidateFilters(JNIEnv* env,
jclass clazz,
jstring text) { jstring text) {
const auto ret = const auto ret =
@ -132,7 +135,8 @@ jobject Java_io_github_lime3ds_android_applets_SoftwareKeyboard_ValidateFilters(
return ToJavaValidationError(ret); return ToJavaValidationError(ret);
} }
jobject Java_io_github_lime3ds_android_applets_SoftwareKeyboard_ValidateInput(JNIEnv* env, jclass clazz, jobject Java_io_github_lime3ds_android_applets_SoftwareKeyboard_ValidateInput(JNIEnv* env,
jclass clazz,
jstring text) { jstring text) {
const auto ret = const auto ret =

View file

@ -15,8 +15,8 @@ static jmethodID s_load_image_from_file;
namespace Camera::StillImage { namespace Camera::StillImage {
void InitJNI(JNIEnv* env) { void InitJNI(JNIEnv* env) {
s_still_image_camera_helper_class = reinterpret_cast<jclass>( s_still_image_camera_helper_class = reinterpret_cast<jclass>(env->NewGlobalRef(
env->NewGlobalRef(env->FindClass("io/github/lime3ds/android/camera/StillImageCameraHelper"))); env->FindClass("io/github/lime3ds/android/camera/StillImageCameraHelper")));
s_open_file_picker = env->GetStaticMethodID(s_still_image_camera_helper_class, "OpenFilePicker", s_open_file_picker = env->GetStaticMethodID(s_still_image_camera_helper_class, "OpenFilePicker",
"()Ljava/lang/String;"); "()Ljava/lang/String;");
s_load_image_from_file = s_load_image_from_file =

View file

@ -29,23 +29,23 @@ jobject CheatToJava(JNIEnv* env, std::shared_ptr<Cheats::CheatBase> cheat) {
extern "C" { extern "C" {
JNIEXPORT void JNICALL Java_io_github_lime3ds_android_features_cheats_model_Cheat_finalize(JNIEnv* env, JNIEXPORT void JNICALL
jobject obj) { Java_io_github_lime3ds_android_features_cheats_model_Cheat_finalize(JNIEnv* env, jobject obj) {
delete CheatFromJava(env, obj); delete CheatFromJava(env, obj);
} }
JNIEXPORT jstring JNICALL Java_io_github_lime3ds_android_features_cheats_model_Cheat_getName(JNIEnv* env, JNIEXPORT jstring JNICALL
jobject obj) { Java_io_github_lime3ds_android_features_cheats_model_Cheat_getName(JNIEnv* env, jobject obj) {
return ToJString(env, (*CheatFromJava(env, obj))->GetName()); return ToJString(env, (*CheatFromJava(env, obj))->GetName());
} }
JNIEXPORT jstring JNICALL Java_io_github_lime3ds_android_features_cheats_model_Cheat_getNotes(JNIEnv* env, JNIEXPORT jstring JNICALL
jobject obj) { Java_io_github_lime3ds_android_features_cheats_model_Cheat_getNotes(JNIEnv* env, jobject obj) {
return ToJString(env, (*CheatFromJava(env, obj))->GetComments()); return ToJString(env, (*CheatFromJava(env, obj))->GetComments());
} }
JNIEXPORT jstring JNICALL Java_io_github_lime3ds_android_features_cheats_model_Cheat_getCode(JNIEnv* env, JNIEXPORT jstring JNICALL
jobject obj) { Java_io_github_lime3ds_android_features_cheats_model_Cheat_getCode(JNIEnv* env, jobject obj) {
return ToJString(env, (*CheatFromJava(env, obj))->GetCode()); return ToJString(env, (*CheatFromJava(env, obj))->GetCode());
} }
@ -59,8 +59,9 @@ JNIEXPORT void JNICALL Java_io_github_lime3ds_android_features_cheats_model_Chea
(*CheatFromJava(env, obj))->SetEnabled(static_cast<bool>(j_enabled)); (*CheatFromJava(env, obj))->SetEnabled(static_cast<bool>(j_enabled));
} }
JNIEXPORT jint JNICALL Java_io_github_lime3ds_android_features_cheats_model_Cheat_isValidGatewayCode( JNIEXPORT jint JNICALL
JNIEnv* env, jclass, jstring j_code) { Java_io_github_lime3ds_android_features_cheats_model_Cheat_isValidGatewayCode(JNIEnv* env, jclass,
jstring j_code) {
const std::string code = GetJString(env, j_code); const std::string code = GetJString(env, j_code);
const auto code_lines = Common::SplitString(code, '\n'); const auto code_lines = Common::SplitString(code, '\n');
@ -74,8 +75,11 @@ JNIEXPORT jint JNICALL Java_io_github_lime3ds_android_features_cheats_model_Chea
return 0; return 0;
} }
JNIEXPORT jobject JNICALL Java_io_github_lime3ds_android_features_cheats_model_Cheat_createGatewayCode( JNIEXPORT jobject JNICALL
JNIEnv* env, jclass, jstring j_name, jstring j_notes, jstring j_code) { Java_io_github_lime3ds_android_features_cheats_model_Cheat_createGatewayCode(JNIEnv* env, jclass,
jstring j_name,
jstring j_notes,
jstring j_code) {
return CheatToJava(env, std::make_shared<Cheats::GatewayCheat>(GetJString(env, j_name), return CheatToJava(env, std::make_shared<Cheats::GatewayCheat>(GetJString(env, j_name),
GetJString(env, j_code), GetJString(env, j_code),
GetJString(env, j_notes))); GetJString(env, j_notes)));

View file

@ -20,13 +20,15 @@ static Cheats::CheatEngine& GetEngine() {
return system.CheatEngine(); return system.CheatEngine();
} }
JNIEXPORT void JNICALL Java_io_github_lime3ds_android_features_cheats_model_CheatEngine_loadCheatFile( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jlong title_id) { Java_io_github_lime3ds_android_features_cheats_model_CheatEngine_loadCheatFile(JNIEnv* env, jclass,
jlong title_id) {
GetEngine().LoadCheatFile(title_id); GetEngine().LoadCheatFile(title_id);
} }
JNIEXPORT void JNICALL Java_io_github_lime3ds_android_features_cheats_model_CheatEngine_saveCheatFile( JNIEXPORT void JNICALL
JNIEnv* env, jclass, jlong title_id) { Java_io_github_lime3ds_android_features_cheats_model_CheatEngine_saveCheatFile(JNIEnv* env, jclass,
jlong title_id) {
GetEngine().SaveCheatFile(title_id); GetEngine().SaveCheatFile(title_id);
} }

View file

@ -60,7 +60,8 @@ static Loader::SMDH* GetPointer(JNIEnv* env, jobject obj) {
return reinterpret_cast<Loader::SMDH*>(env->GetLongField(obj, IDCache::GetGameInfoPointer())); return reinterpret_cast<Loader::SMDH*>(env->GetLongField(obj, IDCache::GetGameInfoPointer()));
} }
JNIEXPORT jlong JNICALL Java_io_github_lime3ds_android_model_GameInfo_initialize(JNIEnv* env, jclass, JNIEXPORT jlong JNICALL Java_io_github_lime3ds_android_model_GameInfo_initialize(JNIEnv* env,
jclass,
jstring j_path) { jstring j_path) {
std::vector<u8> smdh_data = GetSMDHData(GetJString(env, j_path)); std::vector<u8> smdh_data = GetSMDHData(GetJString(env, j_path));
@ -72,7 +73,8 @@ JNIEXPORT jlong JNICALL Java_io_github_lime3ds_android_model_GameInfo_initialize
return reinterpret_cast<jlong>(smdh); return reinterpret_cast<jlong>(smdh);
} }
JNIEXPORT void JNICALL Java_io_github_lime3ds_android_model_GameInfo_finalize(JNIEnv* env, jobject obj) { JNIEXPORT void JNICALL Java_io_github_lime3ds_android_model_GameInfo_finalize(JNIEnv* env,
jobject obj) {
delete GetPointer(env, obj); delete GetPointer(env, obj);
} }
@ -148,7 +150,8 @@ jintArray Java_io_github_lime3ds_android_model_GameInfo_getIcon(JNIEnv* env, job
return icon; return icon;
} }
jboolean Java_io_github_lime3ds_android_model_GameInfo_getIsVisibleSystemTitle(JNIEnv* env, jobject obj) { jboolean Java_io_github_lime3ds_android_model_GameInfo_getIsVisibleSystemTitle(JNIEnv* env,
jobject obj) {
Loader::SMDH* smdh = GetPointer(env, obj); Loader::SMDH* smdh = GetPointer(env, obj);
if (smdh == nullptr) { if (smdh == nullptr) {
return false; return false;

View file

@ -168,8 +168,8 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved) {
// Initialize NativeLibrary // Initialize NativeLibrary
const jclass native_library_class = env->FindClass("io/github/lime3ds/android/NativeLibrary"); const jclass native_library_class = env->FindClass("io/github/lime3ds/android/NativeLibrary");
s_native_library_class = reinterpret_cast<jclass>(env->NewGlobalRef(native_library_class)); s_native_library_class = reinterpret_cast<jclass>(env->NewGlobalRef(native_library_class));
s_on_core_error = s_on_core_error = env->GetStaticMethodID(
env->GetStaticMethodID(s_native_library_class, "onCoreError", s_native_library_class, "onCoreError",
"(Lio/github/lime3ds/android/NativeLibrary$CoreError;Ljava/lang/String;)Z"); "(Lio/github/lime3ds/android/NativeLibrary$CoreError;Ljava/lang/String;)Z");
s_is_portrait_mode = env->GetStaticMethodID(s_native_library_class, "isPortraitMode", "()Z"); s_is_portrait_mode = env->GetStaticMethodID(s_native_library_class, "isPortraitMode", "()Z");
s_landscape_screen_layout = s_landscape_screen_layout =
@ -183,7 +183,8 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved) {
env->DeleteLocalRef(native_library_class); env->DeleteLocalRef(native_library_class);
// Initialize Cheat // Initialize Cheat
const jclass cheat_class = env->FindClass("io/github/lime3ds/android/features/cheats/model/Cheat"); const jclass cheat_class =
env->FindClass("io/github/lime3ds/android/features/cheats/model/Cheat");
s_cheat_class = reinterpret_cast<jclass>(env->NewGlobalRef(cheat_class)); s_cheat_class = reinterpret_cast<jclass>(env->NewGlobalRef(cheat_class));
s_cheat_pointer = env->GetFieldID(cheat_class, "mPointer", "J"); s_cheat_pointer = env->GetFieldID(cheat_class, "mPointer", "J");
s_cheat_constructor = env->GetMethodID(cheat_class, "<init>", "(J)V"); s_cheat_constructor = env->GetMethodID(cheat_class, "<init>", "(J)V");
@ -195,8 +196,8 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved) {
env->DeleteLocalRef(game_info_class); env->DeleteLocalRef(game_info_class);
// Initialize Disk Shader Cache Progress Dialog // Initialize Disk Shader Cache Progress Dialog
s_disk_cache_progress_class = reinterpret_cast<jclass>( s_disk_cache_progress_class = reinterpret_cast<jclass>(env->NewGlobalRef(
env->NewGlobalRef(env->FindClass("io/github/lime3ds/android/utils/DiskShaderCacheProgress"))); env->FindClass("io/github/lime3ds/android/utils/DiskShaderCacheProgress")));
jclass load_callback_stage_class = jclass load_callback_stage_class =
env->FindClass("io/github/lime3ds/android/utils/DiskShaderCacheProgress$LoadCallbackStage"); env->FindClass("io/github/lime3ds/android/utils/DiskShaderCacheProgress$LoadCallbackStage");
s_disk_cache_load_progress = env->GetStaticMethodID( s_disk_cache_load_progress = env->GetStaticMethodID(

View file

@ -90,7 +90,8 @@ static jobject ToJavaCoreError(Core::System::ResultStatus result) {
JNIEnv* env = IDCache::GetEnvForThread(); JNIEnv* env = IDCache::GetEnvForThread();
const jclass core_error_class = IDCache::GetCoreErrorClass(); const jclass core_error_class = IDCache::GetCoreErrorClass();
return env->GetStaticObjectField( return env->GetStaticObjectField(
core_error_class, env->GetStaticFieldID(core_error_class, name, core_error_class,
env->GetStaticFieldID(core_error_class, name,
"Lio/github/lime3ds/android/NativeLibrary$CoreError;")); "Lio/github/lime3ds/android/NativeLibrary$CoreError;"));
} }
@ -283,7 +284,8 @@ void InitializeGpuDriver(const std::string& hook_lib_dir, const std::string& cus
extern "C" { extern "C" {
void Java_io_github_lime3ds_android_NativeLibrary_surfaceChanged(JNIEnv* env, [[maybe_unused]] jobject obj, void Java_io_github_lime3ds_android_NativeLibrary_surfaceChanged(JNIEnv* env,
[[maybe_unused]] jobject obj,
jobject surf) { jobject surf) {
s_surf = ANativeWindow_fromSurface(env, surf); s_surf = ANativeWindow_fromSurface(env, surf);
@ -316,19 +318,15 @@ void Java_io_github_lime3ds_android_NativeLibrary_doFrame([[maybe_unused]] JNIEn
window->TryPresenting(); window->TryPresenting();
} }
void JNICALL Java_io_github_lime3ds_android_NativeLibrary_initializeGpuDriver(JNIEnv* env, jobject obj, void JNICALL Java_io_github_lime3ds_android_NativeLibrary_initializeGpuDriver(
jstring hook_lib_dir, JNIEnv* env, jobject obj, jstring hook_lib_dir, jstring custom_driver_dir,
jstring custom_driver_dir, jstring custom_driver_name, jstring file_redirect_dir) {
jstring custom_driver_name,
jstring file_redirect_dir) {
InitializeGpuDriver(GetJString(env, hook_lib_dir), GetJString(env, custom_driver_dir), InitializeGpuDriver(GetJString(env, hook_lib_dir), GetJString(env, custom_driver_dir),
GetJString(env, custom_driver_name), GetJString(env, file_redirect_dir)); GetJString(env, custom_driver_name), GetJString(env, file_redirect_dir));
} }
void Java_io_github_lime3ds_android_NativeLibrary_notifyOrientationChange([[maybe_unused]] JNIEnv* env, void Java_io_github_lime3ds_android_NativeLibrary_notifyOrientationChange(
[[maybe_unused]] jobject obj, [[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj, jint layout_option, jint rotation) {
jint layout_option,
jint rotation) {
Settings::values.layout_option = static_cast<Settings::LayoutOption>(layout_option); Settings::values.layout_option = static_cast<Settings::LayoutOption>(layout_option);
auto& system = Core::System::GetInstance(); auto& system = Core::System::GetInstance();
if (system.IsPoweredOn()) { if (system.IsPoweredOn()) {
@ -340,7 +338,8 @@ void Java_io_github_lime3ds_android_NativeLibrary_notifyOrientationChange([[mayb
void Java_io_github_lime3ds_android_NativeLibrary_swapScreens([[maybe_unused]] JNIEnv* env, void Java_io_github_lime3ds_android_NativeLibrary_swapScreens([[maybe_unused]] JNIEnv* env,
[[maybe_unused]] jobject obj, [[maybe_unused]] jobject obj,
jboolean swap_screens, jint rotation) { jboolean swap_screens,
jint rotation) {
Settings::values.swap_screen = swap_screens; Settings::values.swap_screen = swap_screens;
auto& system = Core::System::GetInstance(); auto& system = Core::System::GetInstance();
if (system.IsPoweredOn()) { if (system.IsPoweredOn()) {
@ -350,8 +349,8 @@ void Java_io_github_lime3ds_android_NativeLibrary_swapScreens([[maybe_unused]] J
Camera::NDK::g_rotation = rotation; Camera::NDK::g_rotation = rotation;
} }
jboolean Java_io_github_lime3ds_android_NativeLibrary_areKeysAvailable([[maybe_unused]] JNIEnv* env, jboolean Java_io_github_lime3ds_android_NativeLibrary_areKeysAvailable(
[[maybe_unused]] jobject obj) { [[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj) {
HW::AES::InitKeys(); HW::AES::InitKeys();
return HW::AES::IsKeyXAvailable(HW::AES::KeySlotID::NCCHSecure1) && return HW::AES::IsKeyXAvailable(HW::AES::KeySlotID::NCCHSecure1) &&
HW::AES::IsKeyXAvailable(HW::AES::KeySlotID::NCCHSecure2); HW::AES::IsKeyXAvailable(HW::AES::KeySlotID::NCCHSecure2);
@ -411,9 +410,8 @@ jobjectArray Java_io_github_lime3ds_android_NativeLibrary_getInstalledGamePaths(
return jgames; return jgames;
} }
jlongArray Java_io_github_lime3ds_android_NativeLibrary_getSystemTitleIds(JNIEnv* env, jlongArray Java_io_github_lime3ds_android_NativeLibrary_getSystemTitleIds(
[[maybe_unused]] jobject obj, JNIEnv* env, [[maybe_unused]] jobject obj, jint system_type, jint region) {
jint system_type, jint region) {
const auto mode = static_cast<Core::SystemTitleSet>(system_type); const auto mode = static_cast<Core::SystemTitleSet>(system_type);
const std::vector<u64> titles = Core::GetSystemTitleIds(mode, region); const std::vector<u64> titles = Core::GetSystemTitleIds(mode, region);
jlongArray jTitles = env->NewLongArray(titles.size()); jlongArray jTitles = env->NewLongArray(titles.size());
@ -422,9 +420,8 @@ jlongArray Java_io_github_lime3ds_android_NativeLibrary_getSystemTitleIds(JNIEnv
return jTitles; return jTitles;
} }
jobject Java_io_github_lime3ds_android_NativeLibrary_downloadTitleFromNus([[maybe_unused]] JNIEnv* env, jobject Java_io_github_lime3ds_android_NativeLibrary_downloadTitleFromNus(
[[maybe_unused]] jobject obj, [[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj, jlong title) {
jlong title) {
const auto title_id = static_cast<u64>(title); const auto title_id = static_cast<u64>(title);
Service::AM::InstallStatus status = Service::AM::InstallFromNus(title_id); Service::AM::InstallStatus status = Service::AM::InstallFromNus(title_id);
if (status != Service::AM::InstallStatus::Success) { if (status != Service::AM::InstallStatus::Success) {
@ -487,9 +484,8 @@ jlong Java_io_github_lime3ds_android_NativeLibrary_getRunningTitleId([[maybe_unu
return static_cast<jlong>(title_id); return static_cast<jlong>(title_id);
} }
jboolean Java_io_github_lime3ds_android_NativeLibrary_onGamePadEvent([[maybe_unused]] JNIEnv* env, jboolean Java_io_github_lime3ds_android_NativeLibrary_onGamePadEvent(
[[maybe_unused]] jobject obj, [[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj, [[maybe_unused]] jstring j_device,
[[maybe_unused]] jstring j_device,
jint j_button, jint action) { jint j_button, jint action) {
bool consumed{}; bool consumed{};
if (action) { if (action) {
@ -501,9 +497,8 @@ jboolean Java_io_github_lime3ds_android_NativeLibrary_onGamePadEvent([[maybe_unu
return static_cast<jboolean>(consumed); return static_cast<jboolean>(consumed);
} }
jboolean Java_io_github_lime3ds_android_NativeLibrary_onGamePadMoveEvent([[maybe_unused]] JNIEnv* env, jboolean Java_io_github_lime3ds_android_NativeLibrary_onGamePadMoveEvent(
[[maybe_unused]] jobject obj, [[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj, [[maybe_unused]] jstring j_device,
[[maybe_unused]] jstring j_device,
jint axis, jfloat x, jfloat y) { jint axis, jfloat x, jfloat y) {
// Clamp joystick movement to supported minimum and maximum // Clamp joystick movement to supported minimum and maximum
// Citra uses an inverted y axis sent by the frontend // Citra uses an inverted y axis sent by the frontend
@ -521,28 +516,29 @@ jboolean Java_io_github_lime3ds_android_NativeLibrary_onGamePadMoveEvent([[maybe
return static_cast<jboolean>(InputManager::AnalogHandler()->MoveJoystick(axis, x, y)); return static_cast<jboolean>(InputManager::AnalogHandler()->MoveJoystick(axis, x, y));
} }
jboolean Java_io_github_lime3ds_android_NativeLibrary_onGamePadAxisEvent([[maybe_unused]] JNIEnv* env, jboolean Java_io_github_lime3ds_android_NativeLibrary_onGamePadAxisEvent(
[[maybe_unused]] jobject obj, [[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj, [[maybe_unused]] jstring j_device,
[[maybe_unused]] jstring j_device,
jint axis_id, jfloat axis_val) { jint axis_id, jfloat axis_val) {
return static_cast<jboolean>( return static_cast<jboolean>(
InputManager::ButtonHandler()->AnalogButtonEvent(axis_id, axis_val)); InputManager::ButtonHandler()->AnalogButtonEvent(axis_id, axis_val));
} }
jboolean Java_io_github_lime3ds_android_NativeLibrary_onTouchEvent([[maybe_unused]] JNIEnv* env, jboolean Java_io_github_lime3ds_android_NativeLibrary_onTouchEvent([[maybe_unused]] JNIEnv* env,
[[maybe_unused]] jobject obj, jfloat x, [[maybe_unused]] jobject obj,
jfloat y, jboolean pressed) { jfloat x, jfloat y,
jboolean pressed) {
return static_cast<jboolean>( return static_cast<jboolean>(
window->OnTouchEvent(static_cast<int>(x + 0.5), static_cast<int>(y + 0.5), pressed)); window->OnTouchEvent(static_cast<int>(x + 0.5), static_cast<int>(y + 0.5), pressed));
} }
void Java_io_github_lime3ds_android_NativeLibrary_onTouchMoved([[maybe_unused]] JNIEnv* env, void Java_io_github_lime3ds_android_NativeLibrary_onTouchMoved([[maybe_unused]] JNIEnv* env,
[[maybe_unused]] jobject obj, jfloat x, [[maybe_unused]] jobject obj,
jfloat y) { jfloat x, jfloat y) {
window->OnTouchMoved((int)x, (int)y); window->OnTouchMoved((int)x, (int)y);
} }
jlong Java_io_github_lime3ds_android_NativeLibrary_getTitleId(JNIEnv* env, [[maybe_unused]] jobject obj, jlong Java_io_github_lime3ds_android_NativeLibrary_getTitleId(JNIEnv* env,
[[maybe_unused]] jobject obj,
jstring j_filename) { jstring j_filename) {
std::string filepath = GetJString(env, j_filename); std::string filepath = GetJString(env, j_filename);
const auto loader = Loader::GetLoader(filepath); const auto loader = Loader::GetLoader(filepath);
@ -605,8 +601,8 @@ void Java_io_github_lime3ds_android_NativeLibrary_reloadSettings([[maybe_unused]
system.ApplySettings(); system.ApplySettings();
} }
jdoubleArray Java_io_github_lime3ds_android_NativeLibrary_getPerfStats(JNIEnv* env, jdoubleArray Java_io_github_lime3ds_android_NativeLibrary_getPerfStats(
[[maybe_unused]] jobject obj) { JNIEnv* env, [[maybe_unused]] jobject obj) {
auto& core = Core::System::GetInstance(); auto& core = Core::System::GetInstance();
jdoubleArray j_stats = env->NewDoubleArray(4); jdoubleArray j_stats = env->NewDoubleArray(4);
@ -623,9 +619,8 @@ jdoubleArray Java_io_github_lime3ds_android_NativeLibrary_getPerfStats(JNIEnv* e
return j_stats; return j_stats;
} }
void Java_io_github_lime3ds_android_NativeLibrary_run__Ljava_lang_String_2(JNIEnv* env, void Java_io_github_lime3ds_android_NativeLibrary_run__Ljava_lang_String_2(
[[maybe_unused]] jobject obj, JNIEnv* env, [[maybe_unused]] jobject obj, jstring j_path) {
jstring j_path) {
const std::string path = GetJString(env, j_path); const std::string path = GetJString(env, j_path);
if (!stop_run) { if (!stop_run) {
@ -640,14 +635,15 @@ void Java_io_github_lime3ds_android_NativeLibrary_run__Ljava_lang_String_2(JNIEn
} }
} }
void Java_io_github_lime3ds_android_NativeLibrary_reloadCameraDevices([[maybe_unused]] JNIEnv* env, void Java_io_github_lime3ds_android_NativeLibrary_reloadCameraDevices(
[[maybe_unused]] jobject obj) { [[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj) {
if (g_ndk_factory) { if (g_ndk_factory) {
g_ndk_factory->ReloadCameraDevices(); g_ndk_factory->ReloadCameraDevices();
} }
} }
jboolean Java_io_github_lime3ds_android_NativeLibrary_loadAmiibo(JNIEnv* env, [[maybe_unused]] jobject obj, jboolean Java_io_github_lime3ds_android_NativeLibrary_loadAmiibo(JNIEnv* env,
[[maybe_unused]] jobject obj,
jstring j_file) { jstring j_file) {
std::string filepath = GetJString(env, j_file); std::string filepath = GetJString(env, j_file);
Core::System& system{Core::System::GetInstance()}; Core::System& system{Core::System::GetInstance()};
@ -672,9 +668,8 @@ void Java_io_github_lime3ds_android_NativeLibrary_removeAmiibo([[maybe_unused]]
nfc->RemoveAmiibo(); nfc->RemoveAmiibo();
} }
JNIEXPORT jobject JNICALL Java_io_github_lime3ds_android_utils_CiaInstallWorker_installCIA(JNIEnv* env, JNIEXPORT jobject JNICALL Java_io_github_lime3ds_android_utils_CiaInstallWorker_installCIA(
jobject jobj, JNIEnv* env, jobject jobj, jstring jpath) {
jstring jpath) {
std::string path = GetJString(env, jpath); std::string path = GetJString(env, jpath);
Service::AM::InstallStatus res = Service::AM::InstallCIA( Service::AM::InstallStatus res = Service::AM::InstallCIA(
path, [env, jobj](std::size_t total_bytes_read, std::size_t file_size) { path, [env, jobj](std::size_t total_bytes_read, std::size_t file_size) {
@ -685,8 +680,8 @@ JNIEXPORT jobject JNICALL Java_io_github_lime3ds_android_utils_CiaInstallWorker_
return IDCache::GetJavaCiaInstallStatus(res); return IDCache::GetJavaCiaInstallStatus(res);
} }
jobjectArray Java_io_github_lime3ds_android_NativeLibrary_getSavestateInfo(JNIEnv* env, jobjectArray Java_io_github_lime3ds_android_NativeLibrary_getSavestateInfo(
[[maybe_unused]] jobject obj) { JNIEnv* env, [[maybe_unused]] jobject obj) {
const jclass date_class = env->FindClass("java/util/Date"); const jclass date_class = env->FindClass("java/util/Date");
const auto date_constructor = env->GetMethodID(date_class, "<init>", "(J)V"); const auto date_constructor = env->GetMethodID(date_class, "<init>", "(J)V");
@ -720,12 +715,14 @@ jobjectArray Java_io_github_lime3ds_android_NativeLibrary_getSavestateInfo(JNIEn
} }
void Java_io_github_lime3ds_android_NativeLibrary_saveState([[maybe_unused]] JNIEnv* env, void Java_io_github_lime3ds_android_NativeLibrary_saveState([[maybe_unused]] JNIEnv* env,
[[maybe_unused]] jobject obj, jint slot) { [[maybe_unused]] jobject obj,
jint slot) {
Core::System::GetInstance().SendSignal(Core::System::Signal::Save, slot); Core::System::GetInstance().SendSignal(Core::System::Signal::Save, slot);
} }
void Java_io_github_lime3ds_android_NativeLibrary_loadState([[maybe_unused]] JNIEnv* env, void Java_io_github_lime3ds_android_NativeLibrary_loadState([[maybe_unused]] JNIEnv* env,
[[maybe_unused]] jobject obj, jint slot) { [[maybe_unused]] jobject obj,
jint slot) {
Core::System::GetInstance().SendSignal(Core::System::Signal::Load, slot); Core::System::GetInstance().SendSignal(Core::System::Signal::Load, slot);
} }

View file

@ -27,14 +27,13 @@ jboolean Java_io_github_lime3ds_android_utils_SystemSaveGame_getIsSystemSetupNee
return cfg->IsSystemSetupNeeded(); return cfg->IsSystemSetupNeeded();
} }
void Java_io_github_lime3ds_android_utils_SystemSaveGame_setSystemSetupNeeded([[maybe_unused]] JNIEnv* env, void Java_io_github_lime3ds_android_utils_SystemSaveGame_setSystemSetupNeeded(
[[maybe_unused]] jobject obj, [[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj, jboolean needed) {
jboolean needed) {
cfg->SetSystemSetupNeeded(needed); cfg->SetSystemSetupNeeded(needed);
} }
jstring Java_io_github_lime3ds_android_utils_SystemSaveGame_getUsername([[maybe_unused]] JNIEnv* env, jstring Java_io_github_lime3ds_android_utils_SystemSaveGame_getUsername(
[[maybe_unused]] jobject obj) { [[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj) {
return ToJString(env, Common::UTF16ToUTF8(cfg->GetUsername())); return ToJString(env, Common::UTF16ToUTF8(cfg->GetUsername()));
} }
@ -44,8 +43,8 @@ void Java_io_github_lime3ds_android_utils_SystemSaveGame_setUsername([[maybe_unu
cfg->SetUsername(Common::UTF8ToUTF16(GetJString(env, username))); cfg->SetUsername(Common::UTF8ToUTF16(GetJString(env, username)));
} }
jshortArray Java_io_github_lime3ds_android_utils_SystemSaveGame_getBirthday([[maybe_unused]] JNIEnv* env, jshortArray Java_io_github_lime3ds_android_utils_SystemSaveGame_getBirthday(
[[maybe_unused]] jobject obj) { [[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj) {
jshortArray jbirthdayArray = env->NewShortArray(2); jshortArray jbirthdayArray = env->NewShortArray(2);
auto birthday = cfg->GetBirthday(); auto birthday = cfg->GetBirthday();
jshort birthdayArray[2]{static_cast<jshort>(get<0>(birthday)), jshort birthdayArray[2]{static_cast<jshort>(get<0>(birthday)),
@ -60,41 +59,38 @@ void Java_io_github_lime3ds_android_utils_SystemSaveGame_setBirthday([[maybe_unu
cfg->SetBirthday(static_cast<u8>(jmonth), static_cast<u8>(jday)); cfg->SetBirthday(static_cast<u8>(jmonth), static_cast<u8>(jday));
} }
jint Java_io_github_lime3ds_android_utils_SystemSaveGame_getSystemLanguage([[maybe_unused]] JNIEnv* env, jint Java_io_github_lime3ds_android_utils_SystemSaveGame_getSystemLanguage(
[[maybe_unused]] jobject obj) { [[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj) {
return cfg->GetSystemLanguage(); return cfg->GetSystemLanguage();
} }
void Java_io_github_lime3ds_android_utils_SystemSaveGame_setSystemLanguage([[maybe_unused]] JNIEnv* env, void Java_io_github_lime3ds_android_utils_SystemSaveGame_setSystemLanguage(
[[maybe_unused]] jobject obj, [[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj, jint jsystemLanguage) {
jint jsystemLanguage) {
cfg->SetSystemLanguage(static_cast<Service::CFG::SystemLanguage>(jsystemLanguage)); cfg->SetSystemLanguage(static_cast<Service::CFG::SystemLanguage>(jsystemLanguage));
} }
jint Java_io_github_lime3ds_android_utils_SystemSaveGame_getSoundOutputMode([[maybe_unused]] JNIEnv* env, jint Java_io_github_lime3ds_android_utils_SystemSaveGame_getSoundOutputMode(
[[maybe_unused]] jobject obj) { [[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj) {
return cfg->GetSoundOutputMode(); return cfg->GetSoundOutputMode();
} }
void Java_io_github_lime3ds_android_utils_SystemSaveGame_setSoundOutputMode([[maybe_unused]] JNIEnv* env, void Java_io_github_lime3ds_android_utils_SystemSaveGame_setSoundOutputMode(
[[maybe_unused]] jobject obj, [[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj, jint jmode) {
jint jmode) {
cfg->SetSoundOutputMode(static_cast<Service::CFG::SoundOutputMode>(jmode)); cfg->SetSoundOutputMode(static_cast<Service::CFG::SoundOutputMode>(jmode));
} }
jshort Java_io_github_lime3ds_android_utils_SystemSaveGame_getCountryCode([[maybe_unused]] JNIEnv* env, jshort Java_io_github_lime3ds_android_utils_SystemSaveGame_getCountryCode(
[[maybe_unused]] jobject obj) { [[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj) {
return cfg->GetCountryCode(); return cfg->GetCountryCode();
} }
void Java_io_github_lime3ds_android_utils_SystemSaveGame_setCountryCode([[maybe_unused]] JNIEnv* env, void Java_io_github_lime3ds_android_utils_SystemSaveGame_setCountryCode(
[[maybe_unused]] jobject obj, [[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj, jshort jmode) {
jshort jmode) {
cfg->SetCountryCode(static_cast<u8>(jmode)); cfg->SetCountryCode(static_cast<u8>(jmode));
} }
jint Java_io_github_lime3ds_android_utils_SystemSaveGame_getPlayCoins([[maybe_unused]] JNIEnv* env, jint Java_io_github_lime3ds_android_utils_SystemSaveGame_getPlayCoins(
[[maybe_unused]] jobject obj) { [[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj) {
return Service::PTM::Module::GetPlayCoins(); return Service::PTM::Module::GetPlayCoins();
} }
@ -104,13 +100,13 @@ void Java_io_github_lime3ds_android_utils_SystemSaveGame_setPlayCoins([[maybe_un
Service::PTM::Module::SetPlayCoins(static_cast<u16>(jcoins)); Service::PTM::Module::SetPlayCoins(static_cast<u16>(jcoins));
} }
jlong Java_io_github_lime3ds_android_utils_SystemSaveGame_getConsoleId([[maybe_unused]] JNIEnv* env, jlong Java_io_github_lime3ds_android_utils_SystemSaveGame_getConsoleId(
[[maybe_unused]] jobject obj) { [[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj) {
return cfg->GetConsoleUniqueId(); return cfg->GetConsoleUniqueId();
} }
void Java_io_github_lime3ds_android_utils_SystemSaveGame_regenerateConsoleId([[maybe_unused]] JNIEnv* env, void Java_io_github_lime3ds_android_utils_SystemSaveGame_regenerateConsoleId(
[[maybe_unused]] jobject obj) { [[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj) {
const auto [random_number, console_id] = cfg->GenerateConsoleUniqueId(); const auto [random_number, console_id] = cfg->GenerateConsoleUniqueId();
cfg->SetConsoleUniqueId(random_number, console_id); cfg->SetConsoleUniqueId(random_number, console_id);
cfg->UpdateConfigNANDSavegame(); cfg->UpdateConfigNANDSavegame();