Naomi: fix raw BIN/DAT files loading on win32

This commit is contained in:
flyinghead 2018-10-24 10:34:50 +02:00
parent 976d647e1c
commit ebca83e56e
2 changed files with 7 additions and 2 deletions

View File

@ -835,6 +835,9 @@ u32 libExtDevice_ReadMem_A0_006(u32 addr,u32 size) {
return *(u16 *)&mem600[addr & ~1];
case 4:
return *(u32 *)&mem600[addr & ~3];
default:
die("Invalid size");
return 0;
}
}

View File

@ -182,6 +182,7 @@ bool naomi_cart_LoadRom(char* file)
vector<u32> fstart;
vector<u32> fsize;
u32 setsize = 0;
bool raw_bin_file = false;
char *pdot = strrchr(file, '.');
if (pdot != NULL && (!strcmp(pdot, ".lst") || !strcmp(pdot, ".LST")))
@ -254,6 +255,7 @@ bool naomi_cart_LoadRom(char* file)
fsize.push_back(file_size);
setsize = file_size;
RomSize = file_size;
raw_bin_file = true;
}
printf("+%ld romfiles, %.2f MB set size, %.2f MB set address space\n", files.size(), setsize / 1024.f / 1024.f, RomSize / 1024.f / 1024.f);
@ -282,7 +284,7 @@ bool naomi_cart_LoadRom(char* file)
//Create File Mapping Objects
for (size_t i = 0; i<files.size(); i++)
{
if (files[i][0] != '/' && files[i][0] != '\\')
if (!raw_bin_file)
{
strncpy(t, file, sizeof(t));
t[sizeof(t) - 1] = '\0';
@ -414,7 +416,7 @@ bool naomi_cart_SelectFile(void* handle)
ofn.hInstance = (HINSTANCE)GetModuleHandle(0);
ofn.lpstrFile = SelectedFile;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrFilter = "*.lst\0*.lst\0\0";
ofn.lpstrFilter = "*.lst\0*.lst\0*.bin\0*.bin\0*.dat\0*.dat\0\0";
ofn.nFilterIndex = 0;
ofn.hwndOwner = (HWND)handle;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR;