More MO fixes.
This commit is contained in:
@@ -326,12 +326,31 @@ mo_load_abort(mo_t *dev)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
image_is_mdi(const wchar_t *s)
|
||||
{
|
||||
int len;
|
||||
wchar_t ext[5] = { 0, 0, 0, 0, 0 };
|
||||
char *ws = (char *) s;
|
||||
len = wcslen(s);
|
||||
if ((len < 4) || (s[0] == L'.'))
|
||||
return 0;
|
||||
memcpy(ext, ws + ((len - 4) << 1), 8);
|
||||
if (! wcscasecmp(ext, L".MDI"))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mo_load(mo_t *dev, wchar_t *fn)
|
||||
{
|
||||
int size = 0;
|
||||
int is_mdi, size = 0;
|
||||
unsigned int i, found = 0;
|
||||
|
||||
is_mdi = image_is_mdi(fn);
|
||||
|
||||
dev->drv->f = plat_fopen(fn, dev->drv->read_only ? L"rb" : L"rb+");
|
||||
if (!dev->drv->f) {
|
||||
if (!dev->drv->read_only) {
|
||||
@@ -347,6 +366,12 @@ mo_load(mo_t *dev, wchar_t *fn)
|
||||
fseek(dev->drv->f, 0, SEEK_END);
|
||||
size = ftell(dev->drv->f);
|
||||
|
||||
if (is_mdi) {
|
||||
/* This is a MDI image. */
|
||||
size -= 0x1000;
|
||||
dev->drv->base = 0x1000;
|
||||
}
|
||||
|
||||
for (i = 0; i < KNOWN_MO_TYPES; i++) {
|
||||
if (size == mo_types[i].disk_size) {
|
||||
found = 1;
|
||||
@@ -356,9 +381,8 @@ mo_load(mo_t *dev, wchar_t *fn)
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
if (!found)
|
||||
return mo_load_abort(dev);
|
||||
}
|
||||
|
||||
if (fseek(dev->drv->f, dev->drv->base, SEEK_SET) == -1)
|
||||
fatal("mo_load(): Error seeking to the beginning of the file\n");
|
||||
|
@@ -112,6 +112,7 @@
|
||||
#define IDS_2136 2136 // "Don't Exit"
|
||||
#define IDS_2137 2137 // "Reset"
|
||||
#define IDS_2138 2138 // "Don't Reset"
|
||||
#define IDS_2139 2139 // "MO images (*.IM?)\0*.IM?..."
|
||||
|
||||
#define IDS_4096 4096 // "Hard disk (%s)"
|
||||
#define IDS_4097 4097 // "%01i:%01i"
|
||||
@@ -208,7 +209,7 @@
|
||||
|
||||
#define IDS_LANG_ENUS IDS_7168
|
||||
|
||||
#define STR_NUM_2048 91
|
||||
#define STR_NUM_2048 92
|
||||
#define STR_NUM_3072 11
|
||||
#define STR_NUM_4096 18
|
||||
#define STR_NUM_4352 7
|
||||
|
@@ -979,7 +979,7 @@ BEGIN
|
||||
IDS_2113 "Are you sure you want to exit 86Box?"
|
||||
IDS_2114 "Unable to initialize Ghostscript"
|
||||
IDS_2115 "MO %i (%ls): %ls"
|
||||
IDS_2116 "MO images (*.IM?)\0*.IM?\0All files (*.*)\0*.*\0"
|
||||
IDS_2116 "MO images (*.IM?;*.MDI)\0*.IM?;*.MDI\0All files (*.*)\0*.*\0"
|
||||
IDS_2117 "Welcome to 86Box!"
|
||||
IDS_2118 "Internal controller"
|
||||
IDS_2119 "Exit"
|
||||
@@ -1022,6 +1022,7 @@ BEGIN
|
||||
IDS_2136 "Don't Exit"
|
||||
IDS_2137 "Reset"
|
||||
IDS_2138 "Don't Reset"
|
||||
IDS_2139 "MO images (*.IM?;*.MDI)\0*.IM?;*.MDI\0All files (*.*)\0*.*\0"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
|
@@ -754,7 +754,7 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
return TRUE;
|
||||
|
||||
case IDC_CFILE:
|
||||
if (!file_dlg_w(hdlg, plat_get_string(is_zip ? IDS_2055 : IDS_2062), L"", 1)) {
|
||||
if (!file_dlg_w(hdlg, plat_get_string(is_mo ? IDS_2139 : (is_zip ? IDS_2055 : IDS_2062)), L"", 1)) {
|
||||
if (!wcschr(wopenfilestring, L'.')) {
|
||||
if (wcslen(wopenfilestring) && (wcslen(wopenfilestring) <= 256)) {
|
||||
twcs = &wopenfilestring[wcslen(wopenfilestring)];
|
||||
|
Reference in New Issue
Block a user