Skip to content

Commit

Permalink
v2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
epicstudios856 committed Jan 13, 2024
1 parent a512997 commit 6d93a35
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 19 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ android {
applicationId "com.vectras.vm"
minSdk 21
targetSdk 34
versionCode 7
versionName "2.3"
versionCode 8
versionName "2.4"

ndk { abiFilters "armeabi-v7a","arm64-v8a", "x86", "x86_64" }
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/java/com/vectras/qemu/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ public static final String getBasefileDir() {
return getCacheDir() + "/vectras/";
}

public static String getTmpFolder() {
return getBasefileDir() + "var/tmp"; // Do not modify
}
public static String machineFolder = "machines/";
public static String getMachineDir(){
return getBasefileDir() + machineFolder;
Expand Down
33 changes: 30 additions & 3 deletions app/src/main/java/com/vectras/qemu/MainSettingsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package com.vectras.qemu;

import static android.os.Build.VERSION.SDK_INT;

import android.app.Activity;
import android.app.AlarmManager;
import android.app.PendingIntent;
Expand Down Expand Up @@ -248,7 +250,9 @@ public static class QemuPreferencesFragment extends PreferenceFragmentCompat
implements Preference.OnPreferenceChangeListener {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);/*
super.onCreate(savedInstanceState);
if (SDK_INT > 33)
findPreference("sharedFolder").setEnabled(false);/*
Preference pref = findPreference("customMemory");
if (pref != null) {
pref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
Expand Down Expand Up @@ -282,27 +286,32 @@ public boolean onPreferenceChange(@NonNull Preference preference,
}

private void onMemory() {
findPreference("memory").setEnabled(sp.getBoolean("customMemory", false));
//findPreference("memory").setEnabled(sp.getBoolean("customMemory", false));
}

@Override
public void onResume() {
super.onResume();
onMemory();
if (SDK_INT > 33)
findPreference("sharedFolder").setEnabled(false);
}

@Override
public void onPause() {
super.onPause();
onMemory();
if (SDK_INT > 33)
findPreference("sharedFolder").setEnabled(false);
}


@Override
public void onCreatePreferences(Bundle bundle, String root_key) {
// Load the Preferences from the XML file
setPreferencesFromResource(R.xml.qemu, root_key);

if (SDK_INT > 33)
findPreference("sharedFolder").setEnabled(false);
}

@Override
Expand Down Expand Up @@ -660,30 +669,48 @@ public static void setVmUi(Activity activity, String vmUi) {
edit.putString("vmUi", vmUi);
edit.apply();
}

public static String getVmUi(Activity activity) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
return prefs.getString("vmUi", "VNC");
}

public static void setUsbTablet(Activity activity, boolean UsbTablet) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
SharedPreferences.Editor edit = prefs.edit();
edit.putBoolean("UsbTablet", UsbTablet);
edit.apply();
}

public static boolean getUsbTablet(Activity activity) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
return prefs.getBoolean("UsbTablet", false);
}

public static void setCustomParams(Activity activity, String customParams) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
SharedPreferences.Editor edit = prefs.edit();
edit.putString("customParams", customParams);
edit.apply();
}

public static String getCustomParams(Activity activity) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
return prefs.getString("customParams", "");
}

public static void setSharedFolder(Activity activity, boolean customParams) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
SharedPreferences.Editor edit = prefs.edit();
edit.putBoolean("customParams", customParams);
edit.apply();
}

public static boolean getSharedFolder(Activity activity) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
return prefs.getBoolean("sharedFolder", false);
}

public static boolean isFirstLaunch(Activity activity) {
PackageInfo pInfo = null;

Expand Down
11 changes: 7 additions & 4 deletions app/src/main/java/com/vectras/qemu/jni/StartVM.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.vectras.qemu.jni;

import static android.os.Build.VERSION.SDK_INT;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
Expand Down Expand Up @@ -77,7 +79,7 @@ public class StartVM {
public String hdb_img_path;
public String hdc_img_path;
public String hdd_img_path;
public String shared_folder_path;
public String shared_folder_path = null;
public int shared_folder_readonly = 1;
public String hd_cache = "default";

Expand Down Expand Up @@ -129,12 +131,14 @@ public StartVM(Context context) throws Exception {
extra_params += " ";
extra_params += MainSettingsManager.getCustomParams(MainActivity.activity);

shared_folder_path = Config.sharedFolder;
if (MainSettingsManager.getSharedFolder(MainActivity.activity) && SDK_INT < 33)
shared_folder_path = Config.sharedFolder;
//extra_params = Config.extra_params;
this.context = context;
this.libqemu = FileUtils.getNativeLibDir(context) + "/libqemu-system-x86_64.so";
this.arch = "x86_64";
this.cpuNum = MainSettingsManager.getCpuNum(MainActivity.activity);
this.cpu = "qemu64";
if (MainSettingsManager.getMTTCG(MainActivity.activity))
this.enable_mttcg = 1;
else
Expand Down Expand Up @@ -428,8 +432,7 @@ else if (arch.equals("x86_64"))

if (this.cpu != null && !cpu.equals("Default")) {
paramsList.add("-cpu");
String cpuParams = null;
cpuParams += cpu;
String cpuParams = cpu;
if (enablleAvx)
cpuParams += ",+avx";
paramsList.add(cpuParams);
Expand Down
6 changes: 0 additions & 6 deletions app/src/main/java/com/vectras/vm/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -770,12 +770,6 @@ public static void setupFolders() {
try {
Config.cacheDir = activity.getCacheDir().getAbsolutePath();
Config.storagedir = Environment.getDataDirectory().toString();

// Create Temp folder
File folder = new File(Config.getTmpFolder());
if (!folder.exists())
folder. mkdirs();

} catch (Exception ignored) {

}
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/round_folder_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M10.59,4.59C10.21,4.21 9.7,4 9.17,4H4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V8c0,-1.1 -0.9,-2 -2,-2h-8l-1.41,-1.41z"/>
</vector>
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources>
<string name="app_name">Vectras VM</string>
<string name="app_version">2.3</string>
<string name="app_version">2.4</string>
<string name="str_home">Home</string>
<string name="str_logger">Logger</string>
<string name="fab_info">Start Emulation</string>
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/res/xml/qemu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@
android:summaryOff="hdd type: ide"
app:summaryOn="hdd type: virtio"
app:icon="@drawable/round_dns_24" />
<SwitchPreferenceCompat
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:defaultValue="false"
android:title="SHARED FOLDER"
android:key="sharedFolder"
android:summary="/data/Vectras/ProgramFiles/"
app:icon="@drawable/round_folder_24" />
<EditTextPreference
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand Down
Binary file added screenshots/play_store_512.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/play_store_feature_graphic.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/screenshots.rar
Binary file not shown.

0 comments on commit 6d93a35

Please sign in to comment.