int Ui_MainWindowBase::set_recent_disk(int drv, int num)
{
QString s_path;
- char path_shadow[PATH_MAX];
+
+ if(using_flags->get_max_drive() <= drv) return -1;
if((num < 0) || (num >= MAX_HISTORY)) return -1;
s_path = QString::fromLocal8Bit(p_config->recent_floppy_disk_path[drv][num]);
- strncpy(path_shadow, s_path.toLocal8Bit().constData(), PATH_MAX - 1);
- UPDATE_HISTORY(path_shadow, p_config->recent_floppy_disk_path[drv], listFDs[drv]);
-
- strncpy(p_config->initial_floppy_disk_dir, get_parent_dir((const _TCHAR *)path_shadow), _MAX_PATH - 1);
- strncpy(path_shadow, s_path.toLocal8Bit().constData(), PATH_MAX - 1);
-
-// if(emu) {
- emit sig_close_disk(drv);
- emit sig_open_disk(drv, s_path, 0);
- menu_fds[drv]->do_update_histories(listFDs[drv]);
+ if(!(s_path.isEmpty())) {
+ _open_disk(drv, s_path);
+ return 0;
+ }
+ return -1;
+}
+
+void Ui_MainWindowBase::do_ui_floppy_insert_history(int drv, QString fname, quint64 bank)
+{
+ if(fname.length() <= 0) return;
+ if(using_flags->get_max_drive() <= drv) return;
+
+ _TCHAR path_shadow[_MAX_PATH] = {0};
+ strncpy(path_shadow, fname.toLocal8Bit().constData(), _MAX_PATH - 1);
+ if(!(FILEIO::IsFileExisting(path_shadow))) return;
+
+ if((bank & 0x80) == 0) {
+ UPDATE_HISTORY(path_shadow, p_config->recent_floppy_disk_path[drv], listFDs[drv]);
+ strcpy(p_config->initial_floppy_disk_dir, get_parent_dir((const _TCHAR *)path_shadow));
+ // Update List
+ strncpy(path_shadow, fname.toLocal8Bit().constData(), _MAX_PATH - 1);
menu_fds[drv]->do_set_initialize_directory(p_config->initial_floppy_disk_dir);
- if(check_file_extension(path_shadow, ".d88") || check_file_extension(path_shadow, ".d77")) {
- UPDATE_D88_LIST(drv, listD88[drv]);
- menu_fds[drv]->do_update_inner_media(listD88[drv], 0);
- } else {
- menu_fds[drv]->do_clear_inner_media();
- }
- if(using_flags->get_max_drive() >= 2) {
- strncpy(path_shadow, s_path.toLocal8Bit().constData(), PATH_MAX - 1);
- if(check_file_extension(path_shadow, ".d88") || check_file_extension(path_shadow, ".d77")) {
- if(((drv & 1) == 0) && ((drv + 1) < using_flags->get_max_drive()) && (1 < hRunEmu->get_d88_file_bank_num(drv))) {
-
- int drv2 = drv + 1;
- emit sig_close_disk(drv2);
- emit sig_open_disk(drv2, s_path, 1);
- menu_fds[drv2]->do_update_histories(listFDs[drv2]);
- menu_fds[drv2]->do_set_initialize_directory(p_config->initial_floppy_disk_dir);
- UPDATE_D88_LIST(drv2, listD88[drv2]);
- menu_fds[drv2]->do_update_inner_media(listD88[drv2], 1);
- }
- }
- }
-// }
- return 0;
+ }
+ do_update_floppy_history(drv, listFDs[drv]);
+
+ if(check_file_extension(path_shadow, ".d88") || check_file_extension(path_shadow, ".d77")) {
+ UPDATE_D88_LIST(drv, listD88[drv]);
+ menu_fds[drv]->do_update_inner_media(listD88[drv], bank & 0x7f);
+ } else {
+ menu_fds[drv]->do_clear_inner_media();
+ }
}
void Ui_MainWindowBase::_open_disk(int drv, const QString fname)
if(!(FILEIO::IsFileExisting(fname.toLocal8Bit().constData()))) return; // File not found.
// drv = drv & 7;
strncpy(path_shadow, fname.toLocal8Bit().constData(), PATH_MAX - 1);
-
- UPDATE_HISTORY(path_shadow, p_config->recent_floppy_disk_path[drv], listFDs[drv]);
- strcpy(p_config->initial_floppy_disk_dir, get_parent_dir((const _TCHAR *)path_shadow));
- // Update List
- strncpy(path_shadow, fname.toLocal8Bit().constData(), PATH_MAX - 1);
-
-// if(emu) {
- emit sig_close_disk(drv);
- emit sig_open_disk(drv, fname, 0);
- menu_fds[drv]->do_update_histories(listFDs[drv]);
- menu_fds[drv]->do_set_initialize_directory(p_config->initial_floppy_disk_dir);
- if(check_file_extension(path_shadow, ".d88") || check_file_extension(path_shadow, ".d77")) {
- UPDATE_D88_LIST(drv, listD88[drv]);
- menu_fds[drv]->do_update_inner_media(listD88[drv], 0);
- } else {
- menu_fds[drv]->do_clear_inner_media();
- }
-// }
+ emit sig_close_disk(drv);
+ emit sig_open_disk(drv, fname, 0);
+
if(using_flags->get_max_drive() > (drv + 1)) {
if(check_file_extension(path_shadow, ".d88") || check_file_extension(path_shadow, ".d77")) {
if(((drv & 1) == 0) && (drv + 1 < using_flags->get_max_drive()) && (1 < hRunEmu->get_d88_file_bank_num(drv))) {
int drv2 = drv + 1;
emit sig_close_disk(drv2);
- strncpy(path_shadow, fname.toLocal8Bit().constData(), PATH_MAX - 1);
- emit sig_open_disk(drv2, fname, 1);
- menu_fds[drv2]->do_update_histories(listFDs[drv2]);
- menu_fds[drv2]->do_set_initialize_directory(p_config->initial_floppy_disk_dir);
- UPDATE_D88_LIST(drv2, listD88[drv2]);
- menu_fds[drv2]->do_update_inner_media(listD88[drv2], 1);
+ emit sig_open_disk(drv2, fname, 1 + 128);
}
}
}
UPDATE_D88_LIST(drv, listD88[drv]);
menu_fds[drv]->do_update_inner_media(listD88[drv], bank);
}
-
//#endif