mirror of
https://github.com/xoureldeen/Vectras-VM-Android.git
synced 2026-05-19 16:42:13 +00:00
20H33D9M12Y2024
This commit is contained in:
parent
67f5a8ec7b
commit
f3b317f320
4 changed files with 29 additions and 14 deletions
|
|
@ -500,8 +500,13 @@ public class CustomRomActivity extends AppCompatActivity {
|
|||
if (Objects.requireNonNull(getIntent().getStringExtra("romfilename")).endsWith(".cvbi")) {
|
||||
importCVBI(Objects.requireNonNull(getIntent().getStringExtra("rompath")), getIntent().getStringExtra("romfilename"));
|
||||
} else {
|
||||
drive.setText(getIntent().getStringExtra("rompath"));
|
||||
addromnowdone = true;
|
||||
if (!Objects.requireNonNull(getIntent().getStringExtra("rompath")).isEmpty()) {
|
||||
selectedDiskFile(Uri.fromFile(new File((Objects.requireNonNull(getIntent().getStringExtra("rompath"))))), false);
|
||||
}
|
||||
if (!Objects.requireNonNull(getIntent().getStringExtra("addtodrive")).isEmpty()) {
|
||||
drive.setText(AppConfig.vmFolder + vmID + "/" + getIntent().getStringExtra("romfilename"));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
title.setText("New VM");
|
||||
|
|
@ -610,7 +615,7 @@ public class CustomRomActivity extends AppCompatActivity {
|
|||
}
|
||||
}).start();
|
||||
} else if (requestCode == 1002 && resultCode == RESULT_OK) {
|
||||
selectedDiskFile(ReturnedIntent.getData());
|
||||
selectedDiskFile(ReturnedIntent.getData(), true);
|
||||
} else if (requestCode == 1003 && resultCode == RESULT_OK) {
|
||||
Uri content_describer = ReturnedIntent.getData();
|
||||
File selectedFilePath = new File(getPath(content_describer));
|
||||
|
|
@ -1135,17 +1140,17 @@ public class CustomRomActivity extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
|
||||
private void selectedDiskFile(Uri _content_describer) {
|
||||
private void selectedDiskFile(Uri _content_describer, boolean _addtodrive) {
|
||||
File selectedFilePath = new File(getPath(_content_describer));
|
||||
if (VMManager.isADiskFile(selectedFilePath.getPath())) {
|
||||
startProcessingHardDriveFile(_content_describer);
|
||||
startProcessingHardDriveFile(_content_describer, _addtodrive);
|
||||
} 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);
|
||||
startProcessingHardDriveFile(_content_describer, _addtodrive);
|
||||
}
|
||||
});
|
||||
alertDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
|
|
@ -1157,12 +1162,16 @@ public class CustomRomActivity extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
|
||||
private void startProcessingHardDriveFile (Uri _content_describer) {
|
||||
private void startProcessingHardDriveFile (Uri _content_describer, boolean _addtodrive) {
|
||||
LinearLayout custom = findViewById(R.id.custom);
|
||||
File selectedFilePath = new File(getPath(_content_describer));
|
||||
drive.setText(AppConfig.vmFolder + vmID + "/" + selectedFilePath.getName());
|
||||
if (_addtodrive) {
|
||||
drive.setText(AppConfig.vmFolder + vmID + "/" + selectedFilePath.getName());
|
||||
}
|
||||
loadingPb.setVisibility(View.VISIBLE);
|
||||
custom.setVisibility(View.GONE);
|
||||
File romDir = new File(AppConfig.vmFolder + vmID);
|
||||
romDir.mkdirs();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import android.app.Activity;
|
|||
import android.app.ProgressDialog;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
|
@ -157,7 +158,11 @@ public class ExportRomActivity extends AppCompatActivity {
|
|||
}
|
||||
if (listmapForGetData.get(pendingPosition).containsKey("imgIcon")) {
|
||||
iconfile = Objects.requireNonNull(listmapForGetData.get(pendingPosition).get("imgIcon")).toString();
|
||||
mapForGetData.put("icon", Objects.requireNonNull(listmapForGetData.get(pendingPosition).get("imgIcon")).toString().replaceAll(getRomPath, ""));
|
||||
try {
|
||||
mapForGetData.put("icon", Uri.parse(Objects.requireNonNull(listmapForGetData.get(pendingPosition).get("imgIcon")).toString()).getLastPathSegment());
|
||||
} catch (Exception _e){
|
||||
mapForGetData.put("icon", Objects.requireNonNull(listmapForGetData.get(pendingPosition).get("imgIcon")).toString());
|
||||
}
|
||||
} else {
|
||||
mapForGetData.put("icon", "");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -519,18 +519,19 @@ public class RomsManagerActivity extends AppCompatActivity {
|
|||
if (requestCode == 0 && resultCode == RESULT_OK) {
|
||||
Uri content_describer = data.getData();
|
||||
File selectedFilePath = new File(getPath(content_describer));
|
||||
if (selectedFilePath.getName().equals(selectedPath)) {
|
||||
if (selectedFilePath.getName().equals(selectedPath) || selectedFilePath.getName().equals(selectedPath + ".zip")) {
|
||||
Intent intent = new Intent();
|
||||
intent.setClass(getApplicationContext(), CustomRomActivity.class);
|
||||
intent.putExtra("addromnow", "");
|
||||
intent.putExtra("romname", selectedName);
|
||||
intent.putExtra("romfilename", selectedPath);
|
||||
intent.putExtra("finalromfilename", selectedFinalRomFileName);
|
||||
intent.putExtra("rompath", selectedFilePath.getPath());
|
||||
if (selectedExtra.contains(selectedFilePath.getName())) {
|
||||
intent.putExtra("rompath", "");
|
||||
intent.putExtra("romextra", selectedExtra.replace(selectedFilePath.getName(),"\"" + selectedFilePath.getPath() + "\""));
|
||||
intent.putExtra("addtodrive", "");
|
||||
intent.putExtra("romextra", selectedExtra);
|
||||
} else {
|
||||
intent.putExtra("rompath", selectedFilePath.getPath());
|
||||
intent.putExtra("addtodrive", "1");
|
||||
intent.putExtra("romextra", selectedExtra);
|
||||
}
|
||||
intent.putExtra("romicon", AppConfig.maindirpath + "icons/" + selectedPath + ".png");
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
{
|
||||
"rom_name":"MS-DOS",
|
||||
"rom_icon":"https://upload.wikimedia.org/wikipedia/commons/3/3d/Msdos-icon.png",
|
||||
"rom_url":"https://www.mediafire.com/file/8iyxeyyh2yot304/MSDOS.img/file",
|
||||
"rom_path":"MSDOS.img",
|
||||
"rom_url":"https://www.mediafire.com/file/yvgg5ku4o6fnzkf/MS-DOS.cvbi/file",
|
||||
"rom_path":"MS-DOS.cvbi",
|
||||
"rom_avail":true,
|
||||
"rom_size":"128MB",
|
||||
"rom_arch":"X86_64",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue