mirror of
https://github.com/xoureldeen/Vectras-VM-Android.git
synced 2026-05-05 17:56:59 +00:00
Chick
This commit is contained in:
parent
4473dec0f0
commit
54e34dbc20
15 changed files with 257 additions and 116 deletions
|
|
@ -256,11 +256,11 @@ public class MainSettingsManager extends AppCompatActivity
|
|||
|
||||
mHandler = new Handler();
|
||||
|
||||
Preference prefIfType = findPreference("ifType");
|
||||
if (getArch(activity).equals("ARM64"))
|
||||
if (prefIfType != null) {
|
||||
prefIfType.setVisible(false);
|
||||
}
|
||||
//Preference prefIfType = findPreference("ifType");
|
||||
//if (getArch(activity).equals("ARM64"))
|
||||
//if (prefIfType != null) {
|
||||
//prefIfType.setVisible(false);
|
||||
//}
|
||||
|
||||
Preference pref = findPreference("vmArch");
|
||||
if (pref != null) {
|
||||
|
|
@ -577,7 +577,7 @@ public class MainSettingsManager extends AppCompatActivity
|
|||
|
||||
public static String getIfType(Activity activity) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
return prefs.getString("ifType", "ide");
|
||||
return prefs.getString("ifType", "");
|
||||
}
|
||||
|
||||
public static void setBoot(Activity activity, String boot) {
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ import android.net.Uri;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import com.google.android.gms.ads.AdRequest;
|
||||
import com.google.android.gms.ads.AdView;
|
||||
import com.google.android.gms.ads.LoadAdError;
|
||||
|
|
@ -20,7 +20,7 @@ import com.google.android.gms.ads.initialization.InitializationStatus;
|
|||
import com.google.android.gms.ads.initialization.OnInitializationCompleteListener;
|
||||
import com.google.android.gms.ads.interstitial.InterstitialAd;
|
||||
import com.google.android.gms.ads.interstitial.InterstitialAdLoadCallback;
|
||||
import com.vectras.vm.adapters.GithubUserAdapter;
|
||||
import com.vectras.vm.adapters.GithubUserAdapter;
|
||||
import com.vectras.vm.utils.UIUtils;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
|
@ -165,9 +165,9 @@ public class AboutActivity extends AppCompatActivity implements View.OnClickList
|
|||
Log.d("TAG", "The interstitial ad wasn't ready yet.");
|
||||
}
|
||||
|
||||
TextView textversionname = findViewById(R.id.versionname);
|
||||
PackageInfo pinfo = MainActivity.activity.getAppInfo(getApplicationContext());
|
||||
textversionname.setText(pinfo.versionName);
|
||||
//TextView textversionname = findViewById(R.id.versionname);
|
||||
//PackageInfo pinfo = MainActivity.activity.getAppInfo(getApplicationContext());
|
||||
//textversionname.setText(pinfo.versionName);
|
||||
|
||||
RecyclerView recyclerView = findViewById(R.id.github_users_recycler_view);
|
||||
String[] usernames = {"vectras-team", "xoureldeen", "ahmedbarakat2007", "anbui2004"};
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ public class CustomRomActivity extends AppCompatActivity {
|
|||
}
|
||||
cdrom.setText("");
|
||||
|
||||
Pattern pattern = Pattern.compile("-drive index=1,media=cdrom,file='([^']*)'");
|
||||
Pattern pattern = Pattern.compile(cdromPatternCompile());
|
||||
Matcher matcher = pattern.matcher(qemu.getText().toString());
|
||||
|
||||
if (matcher.find()) {
|
||||
|
|
@ -441,7 +441,7 @@ public class CustomRomActivity extends AppCompatActivity {
|
|||
icon.setText(current.itemIcon);
|
||||
drive.setText(current.itemPath);
|
||||
|
||||
Pattern pattern = Pattern.compile("-drive index=1,media=cdrom,file='([^']*)'");
|
||||
Pattern pattern = Pattern.compile(cdromPatternCompile());
|
||||
Matcher matcher = pattern.matcher(current.itemExtra);
|
||||
|
||||
if (matcher.find()) {
|
||||
|
|
@ -591,57 +591,7 @@ public class CustomRomActivity extends AppCompatActivity {
|
|||
}
|
||||
}).start();
|
||||
} else if (requestCode == 1002 && resultCode == RESULT_OK) {
|
||||
Uri content_describer = ReturnedIntent.getData();
|
||||
File selectedFilePath = new File(getPath(content_describer));
|
||||
drive.setText(AppConfig.maindirpath + "roms/" + title.getText().toString() + "/" + selectedFilePath.getName());
|
||||
loadingPb.setVisibility(View.VISIBLE);
|
||||
custom.setVisibility(View.GONE);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
FileInputStream File = null;
|
||||
try {
|
||||
File = (FileInputStream) getContentResolver().openInputStream(content_describer);
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
try {
|
||||
try {
|
||||
OutputStream out = new FileOutputStream(new File(AppConfig.maindirpath + "roms/" + title.getText().toString() + "/" + selectedFilePath.getName()));
|
||||
try {
|
||||
// Transfer bytes from in to out
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
while ((len = File.read(buf)) > 0) {
|
||||
out.write(buf, 0, len);
|
||||
}
|
||||
} finally {
|
||||
out.close();
|
||||
}
|
||||
} finally {
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
loadingPb.setVisibility(View.GONE);
|
||||
custom.setVisibility(View.VISIBLE);
|
||||
}
|
||||
};
|
||||
activity.runOnUiThread(runnable);
|
||||
File.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
loadingPb.setVisibility(View.GONE);
|
||||
custom.setVisibility(View.VISIBLE);
|
||||
UIUtils.UIAlert(activity, "error", e.toString());
|
||||
}
|
||||
};
|
||||
activity.runOnUiThread(runnable);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
selectedDiskFile(ReturnedIntent.getData());
|
||||
} else if (requestCode == 1003 && resultCode == RESULT_OK) {
|
||||
Uri content_describer = ReturnedIntent.getData();
|
||||
File selectedFilePath = new File(getPath(content_describer));
|
||||
|
|
@ -652,10 +602,21 @@ public class CustomRomActivity extends AppCompatActivity {
|
|||
String qemuText = qemu.getText().toString();
|
||||
String cdromParam = "-drive index=1,media=cdrom,file='" + cdromPath + "'";
|
||||
|
||||
Pattern pattern = Pattern.compile("-drive index=1,media=cdrom,file='(.*?)'");
|
||||
if (MainSettingsManager.getArch(activity).equals("ARM64")) {
|
||||
if (!qemu.getText().toString().contains("-device nec-usb-xhci")) {
|
||||
qemu.setText(qemu.getText().toString() + " -device nec-usb-xhci");
|
||||
}
|
||||
cdromParam = "-device usb-storage,drive=cdrom -drive if=none,id=cdrom,format=raw,media=cdrom,file='" + cdromPath + "'";
|
||||
} else {
|
||||
if (MainSettingsManager.getIfType(activity).isEmpty()) {
|
||||
cdromParam = "-cdrom '" + cdromPath + "'";
|
||||
}
|
||||
}
|
||||
|
||||
Pattern pattern = Pattern.compile(cdromPatternCompile2());
|
||||
Matcher matcher = pattern.matcher(qemuText);
|
||||
|
||||
if (!qemuText.contains("-drive index=1,media=cdrom,file=")) {
|
||||
if (!qemuText.contains("-drive index=1,media=cdrom,file=") || !qemuText.contains("-cdrom") || !qemuText.contains("-device usb-storage,drive=cdrom -drive if=none,id=cdrom,format=raw,media=cdrom,file=")) {
|
||||
qemu.append(" " + cdromParam);
|
||||
} else {
|
||||
if (matcher.find()) {
|
||||
|
|
@ -792,7 +753,7 @@ public class CustomRomActivity extends AppCompatActivity {
|
|||
errorjsondialog();
|
||||
|
||||
File isoFile = new File(cdrom.getText().toString());
|
||||
if (isoFile.exists() && !qemu.getText().toString().contains("-drive index=1,media=cdrom,file=")) {
|
||||
if (isoFile.exists() && !qemu.getText().toString().contains(cdrom.getText().toString())) {
|
||||
isoFile.delete();
|
||||
}
|
||||
|
||||
|
|
@ -1100,6 +1061,104 @@ public class CustomRomActivity extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
|
||||
private void selectedDiskFile(Uri _content_describer) {
|
||||
File selectedFilePath = new File(getPath(_content_describer));
|
||||
if (VectrasApp.isADiskFile(selectedFilePath.getPath())) {
|
||||
startProcessingHardDriveFile(_content_describer);
|
||||
} else {
|
||||
alertDialog = new AlertDialog.Builder(activity, R.style.MainDialogTheme).create();
|
||||
alertDialog.setTitle(getResources().getString(R.string.problem_has_been_detected));
|
||||
alertDialog.setMessage(getResources().getString(R.string.file_format_is_not_supported));
|
||||
alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, getResources().getString(R.string.continuetext), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
startProcessingHardDriveFile(_content_describer);
|
||||
}
|
||||
});
|
||||
alertDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
alertDialog.dismiss();
|
||||
}
|
||||
});
|
||||
alertDialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
private void startProcessingHardDriveFile (Uri _content_describer) {
|
||||
LinearLayout custom = findViewById(R.id.custom);
|
||||
File selectedFilePath = new File(getPath(_content_describer));
|
||||
drive.setText(AppConfig.maindirpath + "roms/" + title.getText().toString() + "/" + selectedFilePath.getName());
|
||||
loadingPb.setVisibility(View.VISIBLE);
|
||||
custom.setVisibility(View.GONE);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
FileInputStream File = null;
|
||||
try {
|
||||
File = (FileInputStream) getContentResolver().openInputStream(_content_describer);
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
try {
|
||||
try {
|
||||
OutputStream out = new FileOutputStream(new File(AppConfig.maindirpath + "roms/" + title.getText().toString() + "/" + selectedFilePath.getName()));
|
||||
try {
|
||||
// Transfer bytes from in to out
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
while ((len = File.read(buf)) > 0) {
|
||||
out.write(buf, 0, len);
|
||||
}
|
||||
} finally {
|
||||
out.close();
|
||||
}
|
||||
} finally {
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
loadingPb.setVisibility(View.GONE);
|
||||
custom.setVisibility(View.VISIBLE);
|
||||
}
|
||||
};
|
||||
activity.runOnUiThread(runnable);
|
||||
File.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
loadingPb.setVisibility(View.GONE);
|
||||
custom.setVisibility(View.VISIBLE);
|
||||
UIUtils.UIAlert(activity, "error", e.toString());
|
||||
}
|
||||
};
|
||||
activity.runOnUiThread(runnable);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
private String cdromPatternCompile() {
|
||||
//Matches any string of characters that does not contain single quotes
|
||||
if (MainSettingsManager.getArch(activity).equals("ARM64")) {
|
||||
return "-device usb-storage,drive=cdrom -drive if=none,id=cdrom,format=raw,media=cdrom,file='([^']*)'";
|
||||
} else if (MainSettingsManager.getIfType(activity).isEmpty()) {
|
||||
return "-cdrom '([^']*)'";
|
||||
} else {
|
||||
return "-drive index=1,media=cdrom,file='([^']*)'";
|
||||
}
|
||||
}
|
||||
|
||||
private String cdromPatternCompile2() {
|
||||
//Matches any string of characters, but will try to match the shortest string possible
|
||||
if (MainSettingsManager.getArch(activity).equals("ARM64")) {
|
||||
return "-device usb-storage,drive=cdrom -drive if=none,id=cdrom,format=raw,media=cdrom,file='(.*?)'";
|
||||
} else if (MainSettingsManager.getIfType(activity).isEmpty()) {
|
||||
return "-cdrom '(.*?)'";
|
||||
} else {
|
||||
return "-drive index=1,media=cdrom,file='(.*?)'";
|
||||
}
|
||||
}
|
||||
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
File lol = new File(AppConfig.maindirpath + drive.getText().toString());
|
||||
|
|
|
|||
|
|
@ -131,6 +131,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
private AlertDialog alertDialog;
|
||||
private boolean doneonstart = false;
|
||||
public static boolean isActivate = false;
|
||||
public boolean skipIDEwithARM64DialogInStartVM = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle bundle) {
|
||||
|
|
@ -756,7 +757,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
int versionCode = pinfo.versionCode;
|
||||
String versionName = pinfo.versionName;
|
||||
|
||||
if (versionCode < obj.getInt("versionCode") || !versionName.equals(obj.getString("versionName"))) {
|
||||
if (versionCode < obj.getInt("versionCode") || !obj.getString("versionName").contains(versionName)) {
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(activity, R.style.MainDialogTheme);
|
||||
alert.setTitle("Install the latest version")
|
||||
.setMessage(Html.fromHtml(obj.getString("Message") + "<br><br>update size:<br>" + obj.getString("size")))
|
||||
|
|
@ -951,6 +952,27 @@ public class MainActivity extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
|
||||
if (MainSettingsManager.getArch(activity).equals("ARM64") && MainSettingsManager.getIfType(activity).equals("ide") && !activity.skipIDEwithARM64DialogInStartVM) {
|
||||
AlertDialog abiAlertDialog = new AlertDialog.Builder(activity, R.style.MainDialogTheme).create();
|
||||
abiAlertDialog.setTitle(activity.getResources().getString(R.string.problem_has_been_detected));
|
||||
abiAlertDialog.setMessage(activity.getResources().getString(R.string.you_cannot_use_IDE_hard_drive_type_with_ARM64));
|
||||
abiAlertDialog.setButton(DialogInterface.BUTTON_POSITIVE, activity.getResources().getString(R.string.continuetext), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
activity.skipIDEwithARM64DialogInStartVM = true;
|
||||
startVM(vmName, env, itemExtra, itemPath);
|
||||
}
|
||||
});
|
||||
abiAlertDialog.setButton(DialogInterface.BUTTON_NEGATIVE, activity.getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
}
|
||||
});
|
||||
abiAlertDialog.show();
|
||||
return;
|
||||
} else if (activity.skipIDEwithARM64DialogInStartVM) {
|
||||
activity.skipIDEwithARM64DialogInStartVM = false;
|
||||
}
|
||||
|
||||
boolean isRunning = isMyServiceRunning(MainService.class);
|
||||
|
||||
ProgressDialog progressDialog = new ProgressDialog(activity, R.style.MainDialogTheme);
|
||||
|
|
|
|||
|
|
@ -335,7 +335,7 @@ public class SetupQemuActivity extends AppCompatActivity implements View.OnClick
|
|||
} else if (textToAdd.contains("Installing packages...")) {
|
||||
title.setText("It won't take long...");
|
||||
textviewsettingup.setText("Completed 10%\nIt won't take long...");
|
||||
} else if (textToAdd.contains("50/")) {
|
||||
} else if (textToAdd.contains("(50/")) {
|
||||
textviewsettingup.setText("Completed 20%\nIt won't take long...");
|
||||
} else if (textToAdd.contains("100/")) {
|
||||
textviewsettingup.setText("Completed 30%\nIt won't take long...");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package com.vectras.vm;
|
|||
|
||||
import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
|
||||
import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
|
||||
import android.app.ProgressDialog;
|
||||
import android.app.ProgressDialog;
|
||||
import static android.os.Build.VERSION.SDK_INT;
|
||||
|
||||
import android.app.Notification;
|
||||
|
|
@ -28,7 +28,7 @@ import android.widget.Toast;
|
|||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
|
|
@ -58,10 +58,10 @@ public class SplashActivity extends AppCompatActivity implements Runnable {
|
|||
activity = this;
|
||||
setContentView(R.layout.activity_splash);
|
||||
|
||||
TextView textversionname;
|
||||
textversionname = findViewById(R.id.versionname);
|
||||
PackageInfo pinfo = MainActivity.activity.getAppInfo(getApplicationContext());
|
||||
textversionname.setText(pinfo.versionName);
|
||||
//TextView textversionname;
|
||||
//textversionname = findViewById(R.id.versionname);
|
||||
//PackageInfo pinfo = MainActivity.activity.getAppInfo(getApplicationContext());
|
||||
//textversionname.setText(pinfo.versionName);
|
||||
VectrasApp.prepareDataForAppConfig(activity);
|
||||
setupFolders();
|
||||
SharedPreferences prefs = getSharedPreferences(CREDENTIAL_SHARED_PREF, Context.MODE_PRIVATE);
|
||||
|
|
|
|||
|
|
@ -37,48 +37,87 @@ public class StartVM {
|
|||
params.add("qemu-system-ppc");
|
||||
|
||||
String ifType;
|
||||
if (MainSettingsManager.getArch(activity).equals("ARM64"))
|
||||
ifType = "ahci";
|
||||
else
|
||||
ifType= MainSettingsManager.getIfType(activity);
|
||||
ifType= MainSettingsManager.getIfType(activity);
|
||||
|
||||
String cdrom;
|
||||
String hdd0;
|
||||
String hdd1;
|
||||
|
||||
if (!(img.length() == 0)) {
|
||||
String hdd0 = "-drive";
|
||||
hdd0 += " index=0";
|
||||
hdd0 += ",media=disk";
|
||||
hdd0 += ",if=" + ifType;
|
||||
hdd0 += ",file='" + img + "'";
|
||||
if (!img.isEmpty()) {
|
||||
if (ifType.isEmpty()) {
|
||||
hdd0 = "-hda";
|
||||
hdd0 += " '" + img + "'";
|
||||
} else {
|
||||
hdd0 = "-drive";
|
||||
hdd0 += " index=0";
|
||||
hdd0 += ",media=disk";
|
||||
hdd0 += ",if=" + ifType;
|
||||
hdd0 += ",file='" + img + "'";
|
||||
|
||||
if ((MainSettingsManager.getArch(activity).equals("ARM64") && ifType.equals("ide")) || MainSettingsManager.getArch(activity).equals("PPC")) {
|
||||
hdd0 = "-drive";
|
||||
hdd0 += " index=0";
|
||||
hdd0 += ",media=disk";
|
||||
hdd0 += ",file='" + img + "'";
|
||||
}
|
||||
}
|
||||
params.add(hdd0);
|
||||
}
|
||||
|
||||
File cdromFile = new File(filesDir + "/data/Vectras/drive.iso");
|
||||
|
||||
if (cdromFile.exists()) {
|
||||
cdrom = "-drive";
|
||||
cdrom += " index=1";
|
||||
cdrom += ",media=cdrom";
|
||||
cdrom += ",file='" + cdromFile.getPath() + "'";
|
||||
if (MainSettingsManager.getArch(activity).equals("ARM64")) {
|
||||
cdrom = "-device";
|
||||
cdrom += " usb-storage,drive=cdrom";
|
||||
cdrom += " -drive";
|
||||
cdrom += " if=none,id=cdrom,format=raw,media=cdrom,file='" + cdromFile.getPath() + "'";
|
||||
if (!extras.contains("-device nec-usb-xhci")) {
|
||||
cdrom += " -device";
|
||||
cdrom += " qemu-xhci";
|
||||
cdrom += " -device";
|
||||
cdrom += " nec-usb-xhci";
|
||||
}
|
||||
} else {
|
||||
if (ifType.isEmpty()) {
|
||||
cdrom = "-cdrom";
|
||||
cdrom += " '" + cdromFile.getPath() + "'";
|
||||
} else {
|
||||
cdrom = "-drive";
|
||||
cdrom += " index=1";
|
||||
cdrom += ",media=cdrom";
|
||||
cdrom += ",file='" + cdromFile.getPath() + "'";
|
||||
}
|
||||
}
|
||||
|
||||
params.add(cdrom);
|
||||
}
|
||||
|
||||
File hdd1File = new File(filesDir + "/data/Vectras/hdd1.qcow2");
|
||||
|
||||
if (hdd1File.exists()) {
|
||||
hdd1 = "-drive";
|
||||
hdd1 += " index=2";
|
||||
hdd1 += ",media=disk";
|
||||
hdd1 += ",if=" + ifType;
|
||||
hdd1 += ",file='" + hdd1File.getPath() + "'";
|
||||
if (ifType.isEmpty()) {
|
||||
hdd1 = "-hdb";
|
||||
hdd1 += " '" + hdd1File.getPath() + "'";
|
||||
} else {
|
||||
hdd1 = "-drive";
|
||||
hdd1 += " index=2";
|
||||
hdd1 += ",media=disk";
|
||||
hdd1 += ",if=" + ifType;
|
||||
hdd1 += ",file='" + hdd1File.getPath() + "'";
|
||||
}
|
||||
|
||||
params.add(hdd1);
|
||||
}
|
||||
|
||||
|
||||
if (MainSettingsManager.getSharedFolder(activity)) {
|
||||
String driveParams = "-drive ";
|
||||
driveParams += "index=3,media=disk,file=fat:";
|
||||
if (ifType.isEmpty()) {
|
||||
driveParams += "media=disk,file=fat:";
|
||||
} else {
|
||||
driveParams += "index=3,media=disk,file=fat:";
|
||||
}
|
||||
driveParams += "rw:"; //Disk Drives are always Read/Write
|
||||
driveParams += FileUtils.getExternalFilesDirectory(activity).getPath() + "/SharedFolder,format=raw";
|
||||
params.add(driveParams);
|
||||
|
|
@ -88,7 +127,12 @@ public class StartVM {
|
|||
memoryStr += RamInfo.vectrasMemory();
|
||||
|
||||
String boot = "-boot ";
|
||||
boot += MainSettingsManager.getBoot(activity);
|
||||
if (extras.contains(".iso ")) {
|
||||
|
||||
boot += MainSettingsManager.getBoot(activity);
|
||||
} else {
|
||||
boot += "c";
|
||||
}
|
||||
|
||||
String soundDevice = "-audiodev pa,id=pa -device AC97,audiodev=pa";
|
||||
|
||||
|
|
@ -145,14 +189,8 @@ public class StartVM {
|
|||
params.add(qmpParams);
|
||||
}
|
||||
|
||||
if (!MainSettingsManager.getArch(activity).equals("PPC")) {
|
||||
if (!MainSettingsManager.getArch(activity).equals("ARM64")) {
|
||||
params.add("-monitor");
|
||||
}
|
||||
}
|
||||
if (MainSettingsManager.getArch(activity).equals("ARM64")) {
|
||||
//params.add("stdio");
|
||||
} else if (!MainSettingsManager.getArch(activity).equals("PPC")) {
|
||||
if (!MainSettingsManager.getArch(activity).equals("PPC") || !MainSettingsManager.getArch(activity).equals("ARM64")) {
|
||||
params.add("-monitor");
|
||||
params.add("vc");
|
||||
}
|
||||
} else if (MainSettingsManager.getVmUi(activity).equals("SPICE")) {
|
||||
|
|
@ -169,7 +207,23 @@ public class StartVM {
|
|||
params.add("-qmp");
|
||||
params.add("tcp:localhost:4444,server,nowait");
|
||||
|
||||
params.add(extras);
|
||||
String finalextra;
|
||||
|
||||
if (ifType.isEmpty()) {
|
||||
if (extras.contains("-drive index=1,media=cdrom,file=")) {
|
||||
finalextra = extras.replace("-drive index=1,media=cdrom,file=", "-cdrom ");
|
||||
} else {
|
||||
finalextra = extras;
|
||||
}
|
||||
} else {
|
||||
if (extras.contains("-cdrom ")) {
|
||||
finalextra = extras.replace("-cdrom ", "-drive index=1,media=cdrom,file=");
|
||||
} else {
|
||||
finalextra = extras;
|
||||
}
|
||||
}
|
||||
|
||||
params.add(finalextra);
|
||||
|
||||
return String.join(" ", params);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue