From 27f65f3fdd2d970f35a4a9ae724b66d0e65251a4 Mon Sep 17 00:00:00 2001 From: sorgelig Date: Wed, 22 Jan 2020 01:47:00 +0800 Subject: [PATCH] Support for auto-mount of boot0-3.vhd --- user_io.cpp | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/user_io.cpp b/user_io.cpp index ee4fd65..f929e53 100644 --- a/user_io.cpp +++ b/user_io.cpp @@ -825,7 +825,7 @@ void user_io_init(const char *path, const char *xml) // check for multipart rom for (char i = 0; i < 4; i++) { - sprintf(mainpath, "%s/boot%i.rom", user_io_get_core_path(), i); + sprintf(mainpath, "%s/boot%d.rom", user_io_get_core_path(), i); user_io_file_tx(mainpath, i << 6); } } @@ -868,15 +868,35 @@ void user_io_init(const char *path, const char *xml) } // check if vhd present + for (char i = 0; i < 4; i++) + { + sprintf(mainpath, "%s/boot%d.vhd", user_io_get_core_path(), i); + if (FileExists(mainpath)) + { + user_io_set_index(i << 6); + user_io_file_mount(mainpath, i); + } + } + sprintf(mainpath, "%s/boot.vhd", user_io_get_core_path()); - user_io_set_index(0); - if (!user_io_file_mount(mainpath)) + if (FileExists(mainpath)) + { + user_io_set_index(0); + user_io_file_mount(mainpath, 0); + } + else { strcpy(name + strlen(name) - 3, "VHD"); sprintf(mainpath, "%s/%s", get_rbf_dir(), name); - if (!get_rbf_dir()[0] || !user_io_file_mount(mainpath)) + if (FileExists(mainpath)) { - user_io_file_mount(name); + user_io_set_index(0); + user_io_file_mount(mainpath, 0); + } + else if (FileExists(name)) + { + user_io_set_index(0); + user_io_file_mount(name, 0); } } }