Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
import org.json.JSONException;
import org.json.JSONObject;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
Expand Down Expand Up @@ -92,14 +94,29 @@ public static void installWineFromDownloads(final Context context) {
// the tarball-extracted variant so BionicProgramLauncherComponent can find it
private static void ensureBionicLib(Context context, File imagefs) {
if (BuildConfig.MODERN_ANDROID) {
File wxDest = new File(imagefs, "usr/lib/libredirect-bionic-wx.so");
if (!wxDest.exists()) {
FileUtils.copy(context, "libredirect-bionic-wx.so", wxDest);
File wxDest = new File(imagefs, "usr/lib/" + BuildConfig.PRELOAD_BIONIC_SO);
if (!assetContentEquals(context, BuildConfig.PRELOAD_BIONIC_SO, wxDest)) {
FileUtils.copy(context, BuildConfig.PRELOAD_BIONIC_SO, wxDest);
chmod(wxDest);
}
}
}

private static boolean assetContentEquals(Context context, String assetFile, File target) {
Comment thread
joshuatam marked this conversation as resolved.
if (!target.isFile()) return false;
try (InputStream inStream1 = new BufferedInputStream(context.getAssets().open(assetFile));
InputStream inStream2 = new BufferedInputStream(new FileInputStream(target))) {
int data;
while ((data = inStream1.read()) != -1) {
if (data != inStream2.read()) return false;
}
return inStream2.read() == -1;
}
catch (IOException e) {
return false;
}
}

private static Future<Boolean> installFromAssetsFuture(
final Context context,
AssetManager assetManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,14 +300,15 @@ private int execGuestProgram() {

String ld_preload = "";
String sysvPath = imageFs.getLibDir() + "/libandroid-sysvshm.so";
String evshimPath = context.getApplicationInfo().nativeLibraryDir + "/libevshim.so";
String replacePath = imageFs.getLibDir() + "/" + BuildConfig.PRELOAD_BIONIC_SO;

if (new File(sysvPath).exists()) ld_preload += sysvPath;


String evshimPath = context.getApplicationInfo().nativeLibraryDir + "/libevshim.so";
ld_preload += ":" + evshimPath;
ld_preload += ":" + replacePath;

if (BuildConfig.MODERN_ANDROID) {
String replacePath = imageFs.getLibDir() + "/" + BuildConfig.PRELOAD_BIONIC_SO;
ld_preload += ":" + replacePath;
}

envVars.put("LD_PRELOAD", ld_preload);
envVars.put("EVSHIM_WINE", 1);
Expand Down Expand Up @@ -671,12 +672,14 @@ public String execShellCommand(String command, boolean includeStderr) {
envVars.put("SteamGameId", "0");

String ld_preload = "";
String sysvPath = imageFs.getLibDir() + "/libandroid-sysvshm.so";
String replacePath = imageFs.getLibDir() + "/" + BuildConfig.PRELOAD_BIONIC_SO;

String sysvPath = imageFs.getLibDir() + "/libandroid-sysvshm.so";
if (new File(sysvPath).exists()) ld_preload += sysvPath;

ld_preload += ":" + replacePath;
if (BuildConfig.MODERN_ANDROID) {
String replacePath = imageFs.getLibDir() + "/" + BuildConfig.PRELOAD_BIONIC_SO;
ld_preload += ":" + replacePath;
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

envVars.put("LD_PRELOAD", ld_preload);

Expand Down
Binary file modified app/src/modern/assets/libredirect-bionic-wx.so
Binary file not shown.
Loading