Revert adding A2V3 format as it is unnecessary

- Re-gzipping ejected images is based solely on the file extension and not the actual file stream contents
    - Read/write disk images with extension ".gz" are re-gzipped in-place upon ejection
    - Read/write disk images without extension ".gz" are not changed upon ejection
    - Read-only disk images maintain current behavior (no modifications performed at all)
This commit is contained in:
Aaron Culliney
2017-07-06 19:36:37 -10:00
parent f8b570869f
commit 55cba116e4
10 changed files with 23 additions and 83 deletions
@@ -119,17 +119,6 @@ public class Apple2DisksMenu implements Apple2MenuView {
return true;
}
},
CURRENT_DISK_PATH_A_GZ {
@Override
public String getPrefKey() {
return "driveAInsertedDiskGZ";
}
@Override
public Object getPrefDefault() {
return true;
}
},
CURRENT_DISK_PATH_B {
@Override
public String getPrefKey() {
@@ -152,17 +141,6 @@ public class Apple2DisksMenu implements Apple2MenuView {
return true;
}
},
CURRENT_DISK_PATH_B_GZ {
@Override
public String getPrefKey() {
return "driveBInsertedDiskGZ";
}
@Override
public Object getPrefDefault() {
return true;
}
},
USE_NEWSCHOOL_DISK_SELECTION {
@Override
public String getPrefKey() {
@@ -385,26 +363,21 @@ public class Apple2DisksMenu implements Apple2MenuView {
map.put("disk", imageName);
map.put("drive", isDriveA ? "0" : "1");
map.put("readOnly", isReadOnly ? "true" : "false");
if (onLaunch) {
boolean wasGzipped = (boolean) (isDriveA ? Apple2Preferences.getJSONPref(SETTINGS.CURRENT_DISK_PATH_A_GZ) : Apple2Preferences.getJSONPref(SETTINGS.CURRENT_DISK_PATH_B_GZ));
map.put("wasGzipped", wasGzipped ? "true" : "false");
}
String jsonString = nativeChooseDisk(map.toString());
try {
diskArgs.pfd.close(); // at this point diskArgs.pfd !null
} catch (IOException ioe) {
Log.e(TAG, "Error attempting to close PFD : " + ioe);
if (diskArgs.pfd != null) {
try {
diskArgs.pfd.close();
} catch (IOException ioe) {
Log.e(TAG, "Error attempting to close PFD : " + ioe);
}
}
diskArgs.pfd = null;
map = new JSONObject(jsonString);
boolean inserted = map.getBoolean("inserted");
if (inserted) {
boolean wasGzipped = map.getBoolean("wasGzipped");
Apple2Preferences.setJSONPref(isDriveA ? Apple2DisksMenu.SETTINGS.CURRENT_DISK_PATH_A_GZ : Apple2DisksMenu.SETTINGS.CURRENT_DISK_PATH_B_GZ, wasGzipped);
} else {
if (!inserted) {
ejectDisk(isDriveA);
}
@@ -415,15 +415,6 @@ public class Apple2MainMenu {
}
map = new JSONObject(jsonString);
{
boolean wasGzippedA = map.getBoolean("wasGzippedA");
Apple2Preferences.setJSONPref(Apple2DisksMenu.SETTINGS.CURRENT_DISK_PATH_A_GZ, wasGzippedA);
}
{
boolean wasGzippedB = map.getBoolean("wasGzippedB");
Apple2Preferences.setJSONPref(Apple2DisksMenu.SETTINGS.CURRENT_DISK_PATH_B_GZ, wasGzippedB);
}
restored = map.getBoolean("loadStateSuccess");
} catch (Throwable t) {
+1 -12
View File
@@ -410,16 +410,8 @@ jstring Java_org_deadc0de_apple2ix_Apple2DisksMenu_nativeChooseDisk(JNIEnv *env,
inserted = false;
} else {
video_animations->animation_showDiskChosen(drive);
// possibly override was_gzipped, if specified in args ...
bool wasGzipped = false;
if (json_mapParseBoolValue(jsonData, "wasGzipped", &wasGzipped)) {
disk6.disk[drive].was_gzipped = wasGzipped;
}
}
// remember if image was gzipped
prefs_setBoolValue(PREF_DOMAIN_VM, drive == 0 ? PREF_DISK_DRIVEA_GZ : PREF_DISK_DRIVEB_GZ, disk6.disk[drive].was_gzipped); // HACK FIXME TODO ... refactor : this is erased on the Java side when we resume emulation
json_mapSetBoolValue(jsonData, "wasGzipped", disk6.disk[drive].was_gzipped);
json_mapSetBoolValue(jsonData, "inserted", inserted);
if (fd >= 0) {
@@ -543,10 +535,7 @@ jstring Java_org_deadc0de_apple2ix_Apple2Activity_nativeLoadState(JNIEnv *env, j
}
bool loadStateSuccess = true;
if (emulator_loadState(fdState, (int)fdA, (int)fdB)) {
json_mapSetBoolValue(jsonData, "wasGzippedA", disk6.disk[0].was_gzipped);
json_mapSetBoolValue(jsonData, "wasGzippedB", disk6.disk[1].was_gzipped);
} else {
if (!emulator_loadState(fdState, (int)fdA, (int)fdB)) {
loadStateSuccess = false;
LOG("OOPS, could not load emulator state");
// FIXME TODO : should show invalid state animation here ...