xemu
xemu copied to clipboard
Handle tray eject/load via smc
As per #1563, allow user to specify -no_dvd to clear the dvd_path on startup.
Is this different from -dvd_path ""?
On Tue, Nov 28, 2023, 18:21 BiatuAutMiahn @.***> wrote:
As per #1563 https://github.com/xemu-project/xemu/issues/1563, allow user to specify -no-dvd to clear the dvd_path on startup.
You can view, comment on, or merge this pull request online at:
https://github.com/xemu-project/xemu/pull/1564 Commit Summary
- 21eab43 https://github.com/xemu-project/xemu/pull/1564/commits/21eab4381cf9cbd7b3fbf74b4340b845b9ecbaec Add -no_dvd parameter
File Changes
(1 file https://github.com/xemu-project/xemu/pull/1564/files)
- M softmmu/vl.c https://github.com/xemu-project/xemu/pull/1564/files#diff-b6cd26cc031333f54cf7765de0d501e6fbc28c9177201c22730e56a6f75884c4 (12)
Patch Links:
- https://github.com/xemu-project/xemu/pull/1564.patch
- https://github.com/xemu-project/xemu/pull/1564.diff
— Reply to this email directly, view it on GitHub https://github.com/xemu-project/xemu/pull/1564, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJYNE2YQ355PJ26IUKVLNDYGYMSTAVCNFSM6AAAAAA76DTPYSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGAYTIOJTGM2TGNI . You are receiving this because you are subscribed to this thread.Message ID: @.***>
-dvd_path "" did not clear the path in my testing.
-no-dvd I'd assume we aren't attaching the drive (which could be useful for developers), not that we're claiming there's no disc inserted.
-no-dvdI'd assume we aren't attaching the drive (which could be useful for developers), not that we're claiming there's no disc inserted.
It's only clearing the path. Maybe I should implement -no_dvd_drive for testing as you suggested?
if (strlen(dvd_path) > 0) {
// Allow clearing the dvd path on boot.
for (int i = 1; i < argc; i++) {
if (argv[i] && strcmp(argv[i], "-no_dvd") == 0) {
argv[i] = NULL;
dvd_path = "";
xemu_settings_set_string(&g_config.sys.files.dvd_path, "");
break;
}
}
}
How's this?
bool no_dvd_drive = false;
bool no_dvd = false;
// debug only.
#ifdef DEBUG_XEMU_C
for (int i = 1; i < argc; i++) {
if (argv[i] && strcmp(argv[i], "-no_dvd_drive") == 0) {
argv[i] = NULL;
no_dvd_drive = true;
break;
}
}
#endif
const char *dvd_path = g_config.sys.files.dvd_path;
if (!no_dvd_drive) {
// Allow clearing the dvd path on boot.
for (int i = 1; i < argc; i++) {
if (argv[i] && strcmp(argv[i], "-no_dvd") == 0) {
argv[i] = NULL;
no_dvd = true;
dvd_path = "";
xemu_settings_set_string(&g_config.sys.files.dvd_path, "");
break;
}
}
if (!no_dvd) {
// Allow overriding the dvd path from command line
for (int i = 1; i < argc; i++) {
if (argv[i] && strcmp(argv[i], "-dvd_path") == 0) {
argv[i] = NULL;
if (i < argc - 1 && argv[i+1]) {
dvd_path = argv[i+1];
argv[i+1] = NULL;
}
break;
}
}
if (strlen(dvd_path) > 0) {
if (xemu_check_file(dvd_path) || strcmp(dvd_path, hdd_path) == 0) {
char *msg = g_strdup_printf("Failed to open DVD image file '%s'. Please check machine settings.", dvd_path);
xemu_queue_error_message(msg);
g_free(msg);
dvd_path = "";
}
}
}
// Always populate DVD drive. If disc path is the empty string, drive is
// connected but no media present.
fake_argv[fake_argc++] = strdup("-drive");
char *escaped_dvd_path = strdup_double_commas(dvd_path);
fake_argv[fake_argc++] = g_strdup_printf("index=1,media=cdrom,file=%s",
escaped_dvd_path);
free(escaped_dvd_path);
}
I thought an eject boot option was going to be added. This is different than starting with no dvd in the tray. -dvd_path "" should just load with no dvd in the tray (if it doesn't then it's a bug and should also be fixed).
I thought an eject boot option was going to be added. This is different than starting with no dvd in the tray.
-dvd_path ""should just load with no dvd in the tray (if it doesn't then it's a bug and should also be fixed).
I think this is what you had in mind
Edit:
also the -dvd_path bit is bugged. If any args follow the -dvd_path, they get appended to the dvd_path string. However the "" works fine just doesn't update the config.