Skip to content

Commit

Permalink
Update app
Browse files Browse the repository at this point in the history
  • Loading branch information
brunodev85 committed Apr 4, 2024
1 parent 3af161c commit 8feeff4
Show file tree
Hide file tree
Showing 43 changed files with 248 additions and 42 deletions.
6 changes: 4 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId 'com.winlator'
minSdkVersion 26
targetSdkVersion 28
versionCode 12
versionName "6.0"
versionCode 13
versionName "6.1"
}

buildTypes {
Expand All @@ -27,6 +27,8 @@ android {
checkReleaseBuilds false
}

ndkVersion '22.1.7171670'

externalNativeBuild {
cmake {
version '3.22.1'
Expand Down
Binary file modified app/src/main/assets/box86_64/box64-0.2.6.tzst
Binary file not shown.
Binary file modified app/src/main/assets/box86_64/box64-0.2.7.tzst
Binary file not shown.
Binary file modified app/src/main/assets/box86_64/box86-0.3.0.tzst
Binary file not shown.
Binary file modified app/src/main/assets/box86_64/box86-0.3.5.tzst
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions app/src/main/assets/imagefs.txz
Git LFS file not shown
Binary file modified app/src/main/assets/imagefs_patches.tzst
Binary file not shown.
Binary file modified app/src/main/assets/pulseaudio.tzst
Binary file not shown.
2 changes: 1 addition & 1 deletion app/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.22.1)

Project(Winlator)

set(CMAKE_C_FLAGS "-O2 -Wno-unused-function -Wimplicit-function-declaration")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -Wno-unused-function -Wimplicit-function-declaration")

add_subdirectory(proot)
add_subdirectory(virglrenderer)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/cpp/proot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.22.1)

project(PRoot)

set(CMAKE_C_FLAGS "-O2 -Wno-unused-function -Wimplicit-function-declaration")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -Wno-unused-function -Wimplicit-function-declaration")

add_library(talloc STATIC
talloc/talloc.c)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/cpp/virglrenderer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.22.1)

project(VirGLRenderer)

set(CMAKE_C_FLAGS "-O2 -Wno-unused-function -Wimplicit-function-declaration")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -Wno-unused-function -Wimplicit-function-declaration")

include_directories(src
src/gallium/include
Expand Down
21 changes: 16 additions & 5 deletions app/src/main/java/com/winlator/ContainerDetailFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
Expand Down Expand Up @@ -32,6 +31,7 @@
import com.winlator.container.ContainerManager;
import com.winlator.contentdialog.AddEnvVarDialog;
import com.winlator.contentdialog.DXVKConfigDialog;
import com.winlator.contentdialog.TurnipConfigDialog;
import com.winlator.core.AppUtils;
import com.winlator.core.Callback;
import com.winlator.core.EnvVars;
Expand Down Expand Up @@ -135,8 +135,11 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup r
final View vDXWrapperConfig = view.findViewById(R.id.BTDXWrapperConfig);
vDXWrapperConfig.setTag(editContainer ? container.getDXWrapperConfig() : "");

final View vGraphicsDriverConfig = view.findViewById(R.id.BTGraphicsDriverConfig);
vGraphicsDriverConfig.setTag(editContainer ? container.getGraphicsDriverConfig() : "");

setupDXWrapperSpinner(sDXWrapper, vDXWrapperConfig);
loadGraphicsDriverSpinner(sGraphicsDriver, sDXWrapper,
loadGraphicsDriverSpinner(sGraphicsDriver, sDXWrapper, vGraphicsDriverConfig,
editContainer ? container.getGraphicsDriver() : Container.DEFAULT_GRAPHICS_DRIVER, editContainer ? container.getDXWrapper() : Container.DEFAULT_DXWRAPPER);

view.findViewById(R.id.BTHelpDXWrapper).setOnClickListener((v) -> AppUtils.showHelpBox(context, v, R.string.dxwrapper_help_content));
Expand Down Expand Up @@ -175,6 +178,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup r
String graphicsDriver = StringUtils.parseIdentifier(sGraphicsDriver.getSelectedItem());
String dxwrapper = StringUtils.parseIdentifier(sDXWrapper.getSelectedItem());
String dxwrapperConfig = vDXWrapperConfig.getTag().toString();
String graphicsDriverConfig = vGraphicsDriverConfig.getTag().toString();
String audioDriver = StringUtils.parseIdentifier(sAudioDriver.getSelectedItem());
String wincomponents = getWinComponents(view);
String drives = getDrives(view);
Expand All @@ -193,6 +197,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup r
container.setGraphicsDriver(graphicsDriver);
container.setDXWrapper(dxwrapper);
container.setDXWrapperConfig(dxwrapperConfig);
container.setGraphicsDriverConfig(graphicsDriverConfig);
container.setAudioDriver(audioDriver);
container.setWinComponents(wincomponents);
container.setDrives(drives);
Expand All @@ -214,6 +219,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup r
data.put("graphicsDriver", graphicsDriver);
data.put("dxwrapper", dxwrapper);
data.put("dxwrapperConfig", dxwrapperConfig);
data.put("graphicsDriverConfig", graphicsDriverConfig);
data.put("audioDriver", audioDriver);
data.put("wincomponents", wincomponents);
data.put("drives", drives);
Expand Down Expand Up @@ -442,7 +448,7 @@ public void onNothingSelected(AdapterView<?> parent) {}
}
}

public static void loadGraphicsDriverSpinner(final Spinner sGraphicsDriver, final Spinner sDXWrapper, String selectedGraphicsDriver, String selectedDXWrapper) {
public static void loadGraphicsDriverSpinner(final Spinner sGraphicsDriver, final Spinner sDXWrapper, final View vGraphicsDriverConfig, String selectedGraphicsDriver, String selectedDXWrapper) {
final Context context = sGraphicsDriver.getContext();
final String[] dxwrapperEntries = context.getResources().getStringArray(R.array.dxwrapper_entries);

Expand All @@ -459,6 +465,12 @@ public static void loadGraphicsDriverSpinner(final Spinner sGraphicsDriver, fina
sGraphicsDriver.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
String graphicsDriver = StringUtils.parseIdentifier(sGraphicsDriver.getSelectedItem());
if (graphicsDriver.equals("turnip")) {
vGraphicsDriverConfig.setOnClickListener((v) -> (new TurnipConfigDialog(vGraphicsDriverConfig)).show());
vGraphicsDriverConfig.setVisibility(View.VISIBLE);
}
else vGraphicsDriverConfig.setVisibility(View.GONE);
update.run();
}

Expand All @@ -467,11 +479,10 @@ public void onNothingSelected(AdapterView<?> parent) {}
});

AppUtils.setSpinnerSelectionFromIdentifier(sGraphicsDriver, selectedGraphicsDriver);

update.run();
}

public static void setupDXWrapperSpinner(Spinner sDXWrapper, View vDXWrapperConfig) {
public static void setupDXWrapperSpinner(final Spinner sDXWrapper, final View vDXWrapperConfig) {
sDXWrapper.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/winlator/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ private void showAboutDialog() {
try {
final PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);

TextView tvDeveloper = dialog.findViewById(R.id.TVDeveloper);
tvDeveloper.setText(Html.fromHtml("by BrunoSX (<a href=\"https://www.winlator.org\">winlator.org</a>)", Html.FROM_HTML_MODE_LEGACY));
tvDeveloper.setMovementMethod(LinkMovementMethod.getInstance());
TextView tvWebpage = dialog.findViewById(R.id.TVWebpage);
tvWebpage.setText(Html.fromHtml("<a href=\"https://www.winlator.org\">winlator.org</a>", Html.FROM_HTML_MODE_LEGACY));
tvWebpage.setMovementMethod(LinkMovementMethod.getInstance());

((TextView)dialog.findViewById(R.id.TVAppVersion)).setText(getString(R.string.version)+" "+pInfo.versionName);

Expand Down
12 changes: 9 additions & 3 deletions app/src/main/java/com/winlator/XServerDisplayActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.winlator.container.Shortcut;
import com.winlator.contentdialog.ContentDialog;
import com.winlator.contentdialog.DXVKConfigDialog;
import com.winlator.contentdialog.TurnipConfigDialog;
import com.winlator.core.AppUtils;
import com.winlator.core.CursorLocker;
import com.winlator.core.EnvVars;
Expand Down Expand Up @@ -96,6 +97,7 @@ public class XServerDisplayActivity extends AppCompatActivity implements Navigat
private String audioDriver = Container.DEFAULT_AUDIO_DRIVER;
private String dxwrapper = Container.DEFAULT_DXWRAPPER;
private KeyValueSet dxwrapperConfig;
private KeyValueSet graphicsDriverConfig;
private WineInfo wineInfo;
private final EnvVars envVars = new EnvVars();
private boolean firstTimeBoot = false;
Expand Down Expand Up @@ -145,20 +147,23 @@ public void onCreate(Bundle savedInstanceState) {
audioDriver = container.getAudioDriver();
dxwrapper = container.getDXWrapper();
String dxwrapperConfig = container.getDXWrapperConfig();
String graphicsDriverConfig = container.getGraphicsDriverConfig();
screenSize = container.getScreenSize();

if (shortcut != null) {
graphicsDriver = shortcut.getExtra("graphicsDriver", container.getGraphicsDriver());
audioDriver = shortcut.getExtra("audioDriver", container.getAudioDriver());
dxwrapper = shortcut.getExtra("dxwrapper", container.getDXWrapper());
dxwrapperConfig = shortcut.getExtra("dxwrapperConfig", container.getDXWrapperConfig());
graphicsDriverConfig = shortcut.getExtra("graphicsDriverConfig", container.getGraphicsDriverConfig());
screenSize = shortcut.getExtra("screenSize", container.getScreenSize());

String dinputMapperType = shortcut.getExtra("dinputMapperType");
if (!dinputMapperType.isEmpty()) winHandler.setDInputMapperType(Byte.parseByte(dinputMapperType));
}

if (dxwrapper.equals("dxvk")) this.dxwrapperConfig = DXVKConfigDialog.parseConfig(dxwrapperConfig);
if (graphicsDriver.equals("turnip")) this.graphicsDriverConfig = TurnipConfigDialog.parseConfig(this, graphicsDriverConfig);

if (!wineInfo.isWin64()) {
onExtractFileListener = (file, size) -> {
Expand Down Expand Up @@ -407,6 +412,7 @@ else if (audioDriver.equals("pulseaudio")) {
winHandler.start();
envVars.clear();
dxwrapperConfig = null;
graphicsDriverConfig = null;
}

private void setupUI() {
Expand Down Expand Up @@ -529,7 +535,7 @@ private void hideInputControls() {
private void extractGraphicsDriverFiles() {
String cacheId = graphicsDriver;
if (graphicsDriver.equals("turnip")) {
cacheId += "-"+DefaultVersion.TURNIP+"-"+DefaultVersion.ZINK;
cacheId += "-"+graphicsDriverConfig.get("version")+"-"+DefaultVersion.ZINK;
}
else if (graphicsDriver.equals("virgl")) {
cacheId += "-"+DefaultVersion.VIRGL;
Expand All @@ -549,8 +555,8 @@ else if (graphicsDriver.equals("virgl")) {

if (graphicsDriver.equals("turnip")) {
if (dxwrapper.equals("dxvk")) DXVKConfigDialog.setEnvVars(this, dxwrapperConfig, envVars);
TurnipConfigDialog.setEnvVars(graphicsDriverConfig, envVars);
envVars.put("GALLIUM_DRIVER", "zink");
envVars.put("TU_DEBUG", "noconform");
envVars.put("MESA_VK_WSI_PRESENT_MODE", "mailbox");
envVars.put("vblank_mode", "0");

Expand All @@ -561,7 +567,7 @@ else if (graphicsDriver.equals("virgl")) {
}

if (changed) {
TarCompressorUtils.extract(TarCompressorUtils.Type.ZSTD, this, "graphics_driver/turnip-"+DefaultVersion.TURNIP+".tzst", rootDir);
TarCompressorUtils.extract(TarCompressorUtils.Type.ZSTD, this, "graphics_driver/turnip-"+graphicsDriverConfig.get("version")+".tzst", rootDir);
TarCompressorUtils.extract(TarCompressorUtils.Type.ZSTD, this, "graphics_driver/zink-"+DefaultVersion.ZINK+".tzst", rootDir);
}
}
Expand Down
16 changes: 15 additions & 1 deletion app/src/main/java/com/winlator/container/Container.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class Container {
public static final String DEFAULT_DXWRAPPER = "wined3d";
public static final String DEFAULT_WINCOMPONENTS = "direct3d=1,directsound=1,directmusic=0,directshow=0,directplay=0,vcrun2010=1";
public static final String FALLBACK_WINCOMPONENTS = "direct3d=0,directsound=0,directmusic=0,directshow=0,directplay=0,vcrun2010=0";
public static final String DEFAULT_DRIVES = "D:"+Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
public static final String DEFAULT_DRIVES = "D:"+Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)+"E:/data/data/com.winlator/storage";
public static final byte MAX_DRIVE_LETTERS = 8;
public final int id;
private String name;
Expand All @@ -34,6 +34,7 @@ public class Container {
private String graphicsDriver = DEFAULT_GRAPHICS_DRIVER;
private String dxwrapper = DEFAULT_DXWRAPPER;
private String dxwrapperConfig = "";
private String graphicsDriverConfig = "";
private String wincomponents = DEFAULT_WINCOMPONENTS;
private String audioDriver = DEFAULT_AUDIO_DRIVER;
private String drives = DEFAULT_DRIVES;
Expand Down Expand Up @@ -100,6 +101,14 @@ public void setDXWrapperConfig(String dxwrapperConfig) {
this.dxwrapperConfig = dxwrapperConfig != null ? dxwrapperConfig : "";
}

public String getGraphicsDriverConfig() {
return graphicsDriverConfig;
}

public void setGraphicsDriverConfig(String graphicsDriverConfig) {
this.graphicsDriverConfig = graphicsDriverConfig != null ? graphicsDriverConfig : "";
}

public String getAudioDriver() {
return audioDriver;
}
Expand Down Expand Up @@ -267,6 +276,7 @@ public void saveData() {
data.put("graphicsDriver", graphicsDriver);
data.put("dxwrapper", dxwrapper);
if (!dxwrapperConfig.isEmpty()) data.put("dxwrapperConfig", dxwrapperConfig);
if (!graphicsDriverConfig.isEmpty()) data.put("graphicsDriverConfig", graphicsDriverConfig);
data.put("audioDriver", audioDriver);
data.put("wincomponents", wincomponents);
data.put("drives", drives);
Expand All @@ -289,6 +299,7 @@ public void saveData() {
public void loadData(JSONObject data) throws JSONException {
wineVersion = WineInfo.MAIN_WINE_VERSION.identifier();
dxwrapperConfig = "";
graphicsDriverConfig = "";
checkObsoleteOrMissingProperties(data);

for (Iterator<String> it = data.keys(); it.hasNext(); ) {
Expand Down Expand Up @@ -318,6 +329,9 @@ public void loadData(JSONObject data) throws JSONException {
case "dxwrapperConfig" :
setDXWrapperConfig(data.getString(key));
break;
case "graphicsDriverConfig" :
setGraphicsDriverConfig(data.getString(key));
break;
case "drives" :
setDrives(data.getString(key));
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ private void duplicateContainer(Container srcContainer) {
dstContainer.setGraphicsDriver(srcContainer.getGraphicsDriver());
dstContainer.setDXWrapper(srcContainer.getDXWrapper());
dstContainer.setDXWrapperConfig(srcContainer.getDXWrapperConfig());
dstContainer.setGraphicsDriverConfig(srcContainer.getGraphicsDriverConfig());
dstContainer.setAudioDriver(srcContainer.getAudioDriver());
dstContainer.setWinComponents(srcContainer.getWinComponents());
dstContainer.setDrives(srcContainer.getDrives());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,17 @@ private void createContentView() {
final View vDXWrapperConfig = findViewById(R.id.BTDXWrapperConfig);
vDXWrapperConfig.setTag(shortcut.getExtra("dxwrapperConfig", shortcut.container.getDXWrapperConfig()));

final View vGraphicsDriverConfig = findViewById(R.id.BTGraphicsDriverConfig);
vGraphicsDriverConfig.setTag(shortcut.getExtra("graphicsDriverConfig", shortcut.container.getGraphicsDriverConfig()));

ContainerDetailFragment.setupDXWrapperSpinner(sDXWrapper, vDXWrapperConfig);
ContainerDetailFragment.loadGraphicsDriverSpinner(sGraphicsDriver, sDXWrapper,
ContainerDetailFragment.loadGraphicsDriverSpinner(sGraphicsDriver, sDXWrapper, vGraphicsDriverConfig,
shortcut.getExtra("graphicsDriver", shortcut.container.getGraphicsDriver()), shortcut.getExtra("dxwrapper", shortcut.container.getDXWrapper()));

findViewById(R.id.BTHelpDXWrapper).setOnClickListener((v) -> AppUtils.showHelpBox(context, v, R.string.dxwrapper_help_content));

final Spinner sAudioDriver = findViewById(R.id.SAudioDriver);
AppUtils.setSpinnerSelectionFromIdentifier(sAudioDriver, shortcut.getExtra("audioDriver"));
AppUtils.setSpinnerSelectionFromIdentifier(sAudioDriver, shortcut.getExtra("audioDriver", shortcut.container.getAudioDriver()));

final CheckBox cbForceFullscreen = findViewById(R.id.CBForceFullscreen);
cbForceFullscreen.setChecked(shortcut.getExtra("forceFullscreen", "0").equals("1"));
Expand Down Expand Up @@ -117,6 +120,7 @@ private void createContentView() {
String graphicsDriver = StringUtils.parseIdentifier(sGraphicsDriver.getSelectedItem());
String dxwrapper = StringUtils.parseIdentifier(sDXWrapper.getSelectedItem());
String dxwrapperConfig = vDXWrapperConfig.getTag().toString();
String graphicsDriverConfig = vGraphicsDriverConfig.getTag().toString();
String audioDriver = StringUtils.parseIdentifier(sAudioDriver.getSelectedItem());

String execArgs = etExecArgs.getText().toString();
Expand All @@ -125,6 +129,7 @@ private void createContentView() {
shortcut.putExtra("graphicsDriver", !graphicsDriver.equals(shortcut.container.getGraphicsDriver()) ? graphicsDriver : null);
shortcut.putExtra("dxwrapper", !dxwrapper.equals(shortcut.container.getDXWrapper()) ? dxwrapper : null);
shortcut.putExtra("dxwrapperConfig", !dxwrapperConfig.equals(shortcut.container.getDXWrapperConfig()) ? dxwrapperConfig : null);
shortcut.putExtra("graphicsDriverConfig", !graphicsDriverConfig.equals(shortcut.container.getGraphicsDriverConfig()) ? graphicsDriverConfig : null);
shortcut.putExtra("audioDriver", !audioDriver.equals(shortcut.container.getAudioDriver())? audioDriver : null);
shortcut.putExtra("forceFullscreen", cbForceFullscreen.isChecked() ? "1" : null);
shortcut.putExtra("wincomponents", getWinComponents());
Expand Down
Loading

0 comments on commit 8feeff4

Please sign in to comment.