mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 12:56:06 +00:00
The five files the audit measured as Winlator's are replaced: a one-method callback interface by java.util.function.Consumer, the component base by SessionPart (attach an application context, start, stop), the environment list by HostEnvironment, the process starter by HostProcess, and the pad's state holder by PadState with named sticks, triggers, directions and buttons. The frame-generation tree is framegen/ (its contents were never Winlator's: lsfg-vk's port and Bannerlator's Win-FG), the log tags are the app's, and the fake pad's rumble socket is now one the app actually serves: RumbleComponent turns a game's force-feedback effects into the phone's vibrator, which used to go nowhere. The two design notes describing Bannerlator's X11 path are gone, and the README and credits say what is whose.
70 lines
2.8 KiB
C++
70 lines
2.8 KiB
C++
// JNI surface for native LSFG shader-cache management.
|
|
//
|
|
// Deliberately free of any renderer handle: extracting the shader chain from
|
|
// Lossless.dll and caching it is a slow, once-per-DLL operation that the app
|
|
// runs off the render thread, long before a game launches.
|
|
|
|
#include "lsfg_dll.h"
|
|
|
|
#include <jni.h>
|
|
#include <string>
|
|
|
|
namespace {
|
|
|
|
std::string toStdString(JNIEnv* env, jstring s) {
|
|
if (!s) return {};
|
|
const char* chars = env->GetStringUTFChars(s, nullptr);
|
|
if (!chars) return {};
|
|
std::string out(chars);
|
|
env->ReleaseStringUTFChars(s, chars);
|
|
return out;
|
|
}
|
|
|
|
} // namespace
|
|
|
|
extern "C" JNIEXPORT jint JNICALL
|
|
Java_com_steamdeck_launcher_gpu_LsfgNative_nativeValidateDll(JNIEnv* env, jclass, jstring dllPath) {
|
|
return (jint)lsfg::validateDll(toStdString(env, dllPath));
|
|
}
|
|
|
|
extern "C" JNIEXPORT jint JNICALL
|
|
Java_com_steamdeck_launcher_gpu_LsfgNative_nativeDllVariant(JNIEnv* env, jclass, jstring dllPath,
|
|
jboolean preferFp16) {
|
|
return (jint)lsfg::dllVariant(toStdString(env, dllPath), preferFp16 == JNI_TRUE);
|
|
}
|
|
|
|
extern "C" JNIEXPORT jint JNICALL
|
|
Java_com_steamdeck_launcher_gpu_LsfgNative_nativeBuildCache(JNIEnv* env, jclass, jstring dllPath,
|
|
jstring cachePath, jboolean preferFp16) {
|
|
return (jint)lsfg::buildCache(toStdString(env, dllPath), toStdString(env, cachePath),
|
|
preferFp16 == JNI_TRUE);
|
|
}
|
|
|
|
extern "C" JNIEXPORT jboolean JNICALL
|
|
Java_com_steamdeck_launcher_gpu_LsfgNative_nativeCacheMatchesSource(JNIEnv* env, jclass,
|
|
jstring cachePath,
|
|
jstring dllPath) {
|
|
bool matches = false;
|
|
const lsfg::DllStatus status = lsfg::cacheMatchesSource(toStdString(env, cachePath),
|
|
toStdString(env, dllPath), matches);
|
|
return (jboolean)(status == lsfg::DllStatus::Ok && matches);
|
|
}
|
|
|
|
extern "C" JNIEXPORT jint JNICALL
|
|
Java_com_steamdeck_launcher_gpu_LsfgNative_nativeCacheVariant(JNIEnv* env, jclass, jstring cachePath) {
|
|
lsfg::Variant variant = lsfg::Variant::None;
|
|
if (lsfg::cacheVariant(toStdString(env, cachePath), variant) != lsfg::DllStatus::Ok)
|
|
return (jint)lsfg::Variant::None;
|
|
return (jint)variant;
|
|
}
|
|
|
|
extern "C" JNIEXPORT jstring JNICALL
|
|
Java_com_steamdeck_launcher_gpu_LsfgNative_nativeStatusName(JNIEnv* env, jclass, jint status) {
|
|
return env->NewStringUTF(lsfg::statusName((lsfg::DllStatus)status));
|
|
}
|
|
|
|
extern "C" JNIEXPORT jstring JNICALL
|
|
Java_com_steamdeck_launcher_gpu_LsfgNative_nativeVariantName(JNIEnv* env, jclass, jint variant) {
|
|
return env->NewStringUTF(lsfg::variantName((lsfg::Variant)variant));
|
|
}
|