From 250d79582357d2804db544fbd0afba64b58216a2 Mon Sep 17 00:00:00 2001 From: xoureldeen Date: Wed, 28 Aug 2024 22:55:24 +0300 Subject: [PATCH] initial commit --- README.md | 50 ++++++++++++++++++- app/src/main/AndroidManifest.xml | 3 +- .../main/java/com/vectras/qemu/Config.java | 4 +- .../com/vectras/qemu/MainSettingsManager.java | 2 +- .../java/com/vectras/vm/MainActivity.java | 19 ++++++- app/src/main/java/com/vectras/vm/StartVM.java | 2 + .../java/com/vectras/vm/core/TermuxX11.java | 2 +- .../main/java/com/vectras/vterm/Terminal.java | 5 +- 8 files changed, 79 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 701f1a8..1cc8395 100644 --- a/README.md +++ b/README.md @@ -1 +1,49 @@ -What should i type here? +

+ +

+ +# Vectras VM +[![Ceasefire Now](https://badge.techforpalestine.org/default)](https://techforpalestine.org/learn-more) + +[![Telegram Channel][ico-telegram]][link-telegram] +[![Latest Version][ico-version]][link-releases] +[![Software License][ico-license]](LICENSE.md) + +Welcome to Vectras VM! A virtual machine app for Android based on QEMU that let you emulate various OS including: Windows, MacOS, Linux and Android. + +If you want help you can go through [our documention](https://vectrasvm.blackstorm.cc/how.html). If you are short in time, you could get a straight to the point answer in [Vectras Telegram group](http://t.me/vectras_vm_discussion) + +# Installation +> [!NOTE] +> Starting from 2.8, there will be no official support for ARMv7 devices. + +You can either download Vectras VM from [releases](https://github.com/epicstudios856/Vectras-VM-Android/releases) or [official website](https://vectrasvm.blackstorm.cc/download.html). + +[![OpenAPK](https://www.openapk.net/images/openapk-badge.png)](https://www.openapk.net/vectras-vm/com.vectras.vm/) + +### Minimum System Requirement +- Android 5.0 and up +- 3GB RAM (1GB of free RAM) +- ARM64-v8A or X86_64 devices only +- A good processor +> [!TIP] +> If the OS you are trying to emulate crashed, try with an older version. + +# Donate +Help support the project by funding it. +

Buy Me A Coffee Buy Me a Coffee at ko-fi.com

+ + +# Thanks to +- [QEMU](https://github.com/qemu/qemu) +- [3DFX QEMU PATCH](https://github.com/kjliew/qemu-3dfx) +- [PROOT](https://proot-me.github.io/) +- [Alpine Linux](https://www.alpinelinux.org/) + +[ico-telegram]: https://raw.githubusercontent.com/epicstudios856/Vectras-windows-emulator/main/res/images/telegram.svg +[ico-version]: https://raw.githubusercontent.com/epicstudios856/Vectras-windows-emulator/main/res/images/version.svg +[ico-license]: https://img.shields.io/badge/License-GPL_v2-blue.svg + +[link-telegram]: https://t.me/vectras_os +[link-repo]: https://github.com/epicstudios856/Vectras-VM-Android/ +[link-releases]: https://github.com/epicstudios856/Vectras-VM-Android/releases/ diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b57ce46..95d55d3 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,7 @@ + xmlns:tools="http://schemas.android.com/tools" + android:sharedUserId="com.vectras.shared"> diff --git a/app/src/main/java/com/vectras/qemu/Config.java b/app/src/main/java/com/vectras/qemu/Config.java index 3aca7f6..ed268d6 100644 --- a/app/src/main/java/com/vectras/qemu/Config.java +++ b/app/src/main/java/com/vectras/qemu/Config.java @@ -64,7 +64,7 @@ public class Config { public static boolean enableSMPOnlyOnKVM = false; //set to true if you need to debug native library loading - public static boolean loadNativeLibsEarly = false; + public static boolean loadNativeLibsEarly = false; //XXX: QEMU 3.1.0 needs the libraries to be loaded from the main thread public static boolean loadNativeLibsMainThread = true; @@ -174,7 +174,7 @@ public static enum MouseMode { public static String machinename = "VECTRAS"; public static int paused = 0; - public static String ui = "VNC"; + public static String ui = "X11"; public static boolean maxPriority = false; public static final String defaultVNCColorMode = COLORMODEL.C24bit.nameString(); public static final ScaleType defaultFullscreenScaleMode = ScaleType.FIT_CENTER; diff --git a/app/src/main/java/com/vectras/qemu/MainSettingsManager.java b/app/src/main/java/com/vectras/qemu/MainSettingsManager.java index e3f2a83..2a6df03 100644 --- a/app/src/main/java/com/vectras/qemu/MainSettingsManager.java +++ b/app/src/main/java/com/vectras/qemu/MainSettingsManager.java @@ -601,7 +601,7 @@ public static void setVmUi(Activity activity, String vmUi) { public static String getVmUi(Activity activity) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity); - return prefs.getString("vmUi", "VNC"); + return prefs.getString("vmUi", Config.ui); } public static void setResolution(Activity activity, String RESOLUTION) { diff --git a/app/src/main/java/com/vectras/vm/MainActivity.java b/app/src/main/java/com/vectras/vm/MainActivity.java index a8ab4c8..628814e 100644 --- a/app/src/main/java/com/vectras/vm/MainActivity.java +++ b/app/src/main/java/com/vectras/vm/MainActivity.java @@ -8,6 +8,7 @@ import android.app.Dialog; import android.app.NotificationManager; import android.app.ProgressDialog; +import android.content.ActivityNotFoundException; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; @@ -22,6 +23,7 @@ import android.os.Environment; import android.os.Handler; import android.provider.DocumentsContract; +import android.system.ErrnoException; import android.text.Html; import android.util.Log; import android.view.Menu; @@ -67,6 +69,7 @@ import com.vectras.vm.MainRoms.AdapterMainRoms; import com.vectras.vm.MainRoms.DataMainRoms; import com.vectras.vm.adapter.LogsAdapter; +import com.vectras.vm.core.TermuxX11; import com.vectras.vm.logger.VectrasStatus; import com.vectras.vm.utils.AppUpdater; import com.vectras.vm.utils.FileUtils; @@ -788,7 +791,21 @@ public void run() { } else if (MainSettingsManager.getVmUi(activity).equals("SPICE")) { //activity.startActivity(new Intent(activity, RemoteCanvasActivity.class)); } else if (MainSettingsManager.getVmUi(activity).equals("X11")) { - //activity.startActivity(new Intent(activity, X11Activity.class)); + try { + TermuxX11.main(new String[]{":0"}); + } catch (ErrnoException e) { + throw new RuntimeException(e); + } + + Intent x11Intent = new Intent(); + x11Intent.setClassName("com.termux.x11", "com.termux.x11.MainActivity"); + x11Intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + + try { + activity.startActivity(x11Intent); + } catch (ActivityNotFoundException e) { + Log.e("LaunchActivity", "Activity not found: " + e.getMessage()); + } } } diff --git a/app/src/main/java/com/vectras/vm/StartVM.java b/app/src/main/java/com/vectras/vm/StartVM.java index b88c19e..a0b7e84 100644 --- a/app/src/main/java/com/vectras/vm/StartVM.java +++ b/app/src/main/java/com/vectras/vm/StartVM.java @@ -25,6 +25,8 @@ public static String env(Activity activity, String extras, String img, String cp ArrayList params = new ArrayList<>(Arrays.asList(qemu)); + params.add("awesome;"); + if (MainSettingsManager.getArch(activity).equals("I386")) params.add("qemu-system-i386"); else if (MainSettingsManager.getArch(activity).equals("X86_64")) diff --git a/app/src/main/java/com/vectras/vm/core/TermuxX11.java b/app/src/main/java/com/vectras/vm/core/TermuxX11.java index 6d13263..e6d2ca2 100644 --- a/app/src/main/java/com/vectras/vm/core/TermuxX11.java +++ b/app/src/main/java/com/vectras/vm/core/TermuxX11.java @@ -19,7 +19,7 @@ public class TermuxX11 { public static void main(String[] args) throws ErrnoException { String filesDir = VectrasApp.vectrasapp.getFilesDir().getAbsolutePath(); - File xkbConfigRoot = new File(filesDir + "/distro/share/X11/xkb"); + File xkbConfigRoot = new File(filesDir + "/distro/usr/share/X11/xkb"); if (!xkbConfigRoot.exists()) throw new RuntimeException("XKB_CONFIG_ROOT not found: " + xkbConfigRoot); Os.setenv("XKB_CONFIG_ROOT", xkbConfigRoot.getAbsolutePath(), true); diff --git a/app/src/main/java/com/vectras/vterm/Terminal.java b/app/src/main/java/com/vectras/vterm/Terminal.java index 8466c22..4374ae0 100644 --- a/app/src/main/java/com/vectras/vterm/Terminal.java +++ b/app/src/main/java/com/vectras/vterm/Terminal.java @@ -31,7 +31,7 @@ public class Terminal { private String user = "root"; public static Process qemuProcess; - public static String DISPLAY = ":1"; + public static String DISPLAY = ":0"; public Terminal(Context context) { this.context = context; @@ -108,6 +108,9 @@ public void executeShellCommand(String userCommand, boolean showResultDialog, Ac "-b", "/storage", "-b", "/data", "-w", "/root", + "/usr/bin/env", "-i", + "HOME=/root", + "DISPLAY="+DISPLAY, "/bin/sh", "--login"// The shell to execute inside PRoot };