Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
9a0fba5
Fix #1698: Add ALSA stub for libjsound.so compatibility on Android
razureink Jul 24, 2026
6b37f0d
Restore original Chinese comments in CMakeLists.txt
razureink Jul 24, 2026
27b5eeb
Fix incomplete type error for snd_mixer_selem_id_t
razureink Jul 24, 2026
dc807fa
Implement real ALSA PCM playback via OpenSL ES
razureink Jul 24, 2026
86a9067
Link OpenSLES library for alsa_stub
razureink Jul 24, 2026
0c6e2e0
Fix OpenSL ES include: use OpenSLES_Android.h
razureink Jul 24, 2026
b89a42d
Fix: remove non-NDK SL_DATAFORMAT_PCM_SUB_BITS constants
razureink Jul 24, 2026
615af02
Add custom libjsound.so with OpenSL ES PCM playback
razureink Jul 24, 2026
92dd923
Add jsound library target (custom libjsound.so)
razureink Jul 24, 2026
5e42d94
Preload custom libjsound.so for javax.sound support
razureink Jul 24, 2026
85157ed
fix: add custom libjsound.so with OpenSL ES PortMixer implementation
razureink Jul 24, 2026
9cac96d
fix: remove BOM from FCLauncher.java
razureink Jul 24, 2026
8a3977c
fix: correct callback signature and remove nonexistent field
razureink Jul 24, 2026
69d38f7
fix: replace alsa_stub.c with simple stub (no OpenSL ES), add OpenSLE…
razureink Jul 24, 2026
386ba8e
fix: copy libjsound.so to JRE lib dir for Java 25 module system lookup
razureink Jul 24, 2026
7dbdd62
fix: split JNI method registration by class (PortMixerProvider, Direc…
razureink Jul 25, 2026
6638cc0
fix: make PortMixerProvider registration optional in JDK 25
razureink Jul 26, 2026
81502dc
fix: rewrite jsound.c with correct JDK 25 JNI signatures (Java_* nami…
razureink Jul 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 42 additions & 15 deletions FCLauncher/src/main/java/com/tungsten/fclauncher/FCLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,33 @@ private static void addCustomEnv(FCLConfig config, HashMap<String, String> envMa

}

private static void setUpJavaRuntime(FCLConfig config, FCLBridge bridge) throws IOException {
printTaskTitle(bridge, "DLOPEN");
private static void setUpJavaRuntime(FCLConfig config, FCLBridge bridge) throws IOException {
printTaskTitle(bridge, "DLOPEN");
// Load ALSA stub for ALSA-dependent system libraries
try {
File alsaStub = new File(config.getContext().getApplicationInfo().nativeLibraryDir, "libalsa_stub.so");
if (alsaStub.exists()) {
bridge.dlopen(alsaStub.getAbsolutePath());
}
} catch (Exception ignored) {
}
// Copy jsound native lib to JRE lib dir for javax.sound module
// Java 25's module system uses System.loadLibrary("jsound") which searches
// the JRE's system library path, not java.library.path.
try {
File jsoundLib = new File(config.getContext().getApplicationInfo().nativeLibraryDir, "libjsound.so");
if (jsoundLib.exists()) {
String javaLibDir = config.getJavaPath() + getJavaLibDir(config.getJavaPath());
File target = new File(javaLibDir, "libjsound.so");
if (!target.exists()) {
java.nio.file.Files.copy(jsoundLib.toPath(), target.toPath(),
java.nio.file.StandardCopyOption.REPLACE_EXISTING);
log(bridge, "Copied libjsound.so to " + target.getAbsolutePath());
}
bridge.dlopen(jsoundLib.getAbsolutePath());
}
} catch (Exception ignored) {
}
String javaLibDir = config.getJavaPath() + getJavaLibDir(config.getJavaPath());
String jliLibDir = new File(javaLibDir + "/jli/libjli.so").exists() ? javaLibDir + "/jli" : javaLibDir;
if (isJDK8(config.getJavaPath()))
Expand All @@ -363,19 +388,19 @@ private static void setUpJavaRuntime(FCLConfig config, FCLBridge bridge) throws
}
}

public static ArrayList<File> locateLibs(File path) {
ArrayList<File> returnValue = new ArrayList<>();
File[] list = path.listFiles();
if (list != null) {
for (File f : list) {
if (f.isFile() && f.getName().endsWith(".so")) {
returnValue.add(f);
} else if (f.isDirectory()) {
returnValue.addAll(locateLibs(f));
}
}
}
return returnValue;
public static ArrayList<File> locateLibs(File path) {
ArrayList<File> returnValue = new ArrayList<>();
File[] list = path.listFiles();
if (list != null) {
for (File f : list) {
if (f.isFile() && f.getName().endsWith(".so")) {
returnValue.add(f);
} else if (f.isDirectory()) {
returnValue.addAll(locateLibs(f));
}
}
}
return returnValue;
}

private static void setupGraphicAndSoundEngine(FCLConfig config, FCLBridge bridge) {
Expand Down Expand Up @@ -570,3 +595,5 @@ public static boolean isJDK8(String javaPath) {
}

}


52 changes: 36 additions & 16 deletions FCLauncher/src/main/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,19 @@ cmake_minimum_required(VERSION 3.18.1)

project("fcl")

# 设置C标准
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 11)

# 查找ByteHook库
find_package(bytehook REQUIRED CONFIG)

# 设置全局包含目录
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
)

# 检查架构
if(${ANDROID_ABI} STREQUAL "arm64-v8a")
add_definitions(-DADRENO_POSSIBLE)
endif()

# 模块:fcl
add_library(
fcl
SHARED
Expand All @@ -44,7 +39,6 @@ target_link_libraries(
android
)

# 模块:driver_helper
add_library(
driver_helper
SHARED
Expand All @@ -66,7 +60,6 @@ target_link_libraries(
android
)

# 仅在arm64-v8a架构下链接EGL和GLESv2
if(${ANDROID_ABI} STREQUAL "arm64-v8a")
target_link_libraries(
driver_helper
Expand All @@ -76,7 +69,6 @@ if(${ANDROID_ABI} STREQUAL "arm64-v8a")
)
endif()

# 模块:linkerhook
add_library(
linkerhook
SHARED
Expand All @@ -90,22 +82,18 @@ target_link_options(
-z global
)

# 模块:awt_headless - 占位库
add_library(
awt_headless
SHARED
# 空库,仅作为占位
${CMAKE_CURRENT_SOURCE_DIR}/awt_headless/placeholder.c
awt_headless/placeholder.c
)

# 为占位库添加必要的链接选项
target_link_libraries(
awt_headless
PRIVATE
log
)

# 模块:awt_xawt
add_library(
awt_xawt
SHARED
Expand All @@ -124,7 +112,6 @@ target_link_libraries(
awt_headless
)

# 模块:pojavexec_awt
add_library(
pojavexec_awt
SHARED
Expand All @@ -137,7 +124,6 @@ target_link_libraries(
fcl
)

# 模块:pojavexec
add_library(
pojavexec
SHARED
Expand Down Expand Up @@ -175,7 +161,6 @@ target_link_libraries(
android
)

# 仅在arm64-v8a架构下链接EGL和GLESv2
if(${ANDROID_ABI} STREQUAL "arm64-v8a")
target_link_libraries(
pojavexec
Expand All @@ -184,3 +169,38 @@ if(${ANDROID_ABI} STREQUAL "arm64-v8a")
GLESv2
)
endif()

add_library(
alsa_stub
SHARED
alsa_stub/alsa_stub.c
)

target_link_options(
alsa_stub
PRIVATE
-Wl,-soname,libasound.so.2
)

target_link_libraries(
alsa_stub
PRIVATE
OpenSLES
log
dl
)

add_library(
jsound
SHARED
jsound/jsound.c
)

target_link_libraries(
jsound
PRIVATE
OpenSLES
log
dl
android
)
Loading
Loading