void loaddisc(int drive, char *fn) { int c = 0; char *p; FILE *f; setejecttext(drive, ""); if (!fn) return; p = get_extension(fn); if (!p) return; setejecttext(drive, fn); rpclog("Loading :%i %s %s\n", drive, fn, p); while (loaders[c].ext) { if (!strcasecmp(p, loaders[c].ext)) { driveloaders[drive] = c; loaders[c].load(drive, fn); return; } c++; } // printf("Couldn't load %s %s\n",fn,p); /*No extension match, so guess based on image size*/ f = fopen(fn, "rb"); if (!f) return; fseek(f, -1, SEEK_END); c = ftell(f) + 1; fclose(f); rpclog("Size %i\n", c); if (c <= (200 * 1024)) /*200k DFS - 80*1*10*256*/ { driveloaders[drive] = 0; loaders[0].load(drive, fn); return; } if (c <= (400 * 1024)) /*400k DFS - 80*2*10*256*/ { driveloaders[drive] = 1; loaders[1].load(drive, fn); return; } }
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { HMENU hmenu; RECT rect; int c; LRESULT r; switch (message) { case WM_COMMAND: hmenu = GetMenu(hwnd); switch (LOWORD(wParam)) { case IDM_FILE_RESET: EnterCriticalSection(&cs); main_reset(); LeaveCriticalSection(&cs); break; case IDM_FILE_LSTATE: EnterCriticalSection(&cs); if (!getfile(hwnd, "Save State (*.SNP)\0*.SNP\0All files (*.*)\0*.*\0\0", savestate_name)) { CheckMenuItem(hmenu, IDM_TUBE_6502 + selecttube, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_MODEL_0 + curmodel, MF_UNCHECKED); savestate_load(); CheckMenuItem(hmenu, IDM_TUBE_6502 + selecttube, MF_CHECKED); CheckMenuItem(hmenu, IDM_MODEL_0 + curmodel, MF_CHECKED); } main_cleardrawit(); LeaveCriticalSection(&cs); break; case IDM_FILE_SSTATE: EnterCriticalSection(&cs); if (curtube != -1) { log_error("Second processor save states not supported yet."); } else { if (!getsfile(hwnd, "Save State (*.SNP)\0*.SNP\0All files (*.*)\0*.*\0\0", savestate_name, "SNP")) savestate_save(); } main_cleardrawit(); LeaveCriticalSection(&cs); break; case IDM_FILE_EXIT: PostQuitMessage (0); /* send a WM_QUIT to the message queue */ break; case IDM_DISC_AUTOBOOT: if (!getfile(hwnd, "Disc image (*.SSD;*.DSD;*.IMG;*.ADF;*.ADL;*.FDI)\0*.SSD;*.DSD;*.IMG;*.ADF;*.ADL;*.FDI\0All files (*.*)\0*.*\0", discfns[0])) { doautoboot = 1; } break; case IDM_DISC_LOAD_0: if (!getfile(hwnd, "Disc image (*.SSD;*.DSD;*.IMG;*.ADF;*.ADL;*.FDI)\0*.SSD;*.DSD;*.IMG;*.ADF;*.ADL;*.FDI\0All files (*.*)\0*.*\0", discfns[0])) { disc_close(0); disc_load(0, discfns[0]); if (defaultwriteprot) writeprot[0] = 1; CheckMenuItem(hmenu, IDM_DISC_WPROT_0, (writeprot[0]) ? MF_CHECKED : MF_UNCHECKED); } break; case IDM_DISC_LOAD_1: if (!getfile(hwnd, "Disc image (*.SSD;*.DSD;*.IMG;*.ADF;*.ADL;*.FDI)\0*.SSD;*.DSD;*.IMG;*.ADF;*.ADL;*.FDI\0All files (*.*)\0*.*\0", discfns[1])) { disc_close(1); disc_load(1, discfns[1]); if (defaultwriteprot) writeprot[1] = 1; CheckMenuItem(hmenu, IDM_DISC_WPROT_1, (writeprot[1]) ? MF_CHECKED : MF_UNCHECKED); } break; case IDM_DISC_EJECT_0: disc_close(0); discfns[0][0] = 0; setejecttext(0, ""); break; case IDM_DISC_EJECT_1: disc_close(1); discfns[1][0] = 0; setejecttext(1, ""); break; case IDM_DISC_NEW_0: if (!getsfile(hwnd, "Disc image (*.SSD;*.DSD;*.ADF;*.ADL)\0*.SSD;*.DSD;*.ADF;*.ADL\0All files (*.*)\0*.*\0", discfns[0], "SSD")) { disc_close(0); disc_new(0, discfns[0]); if (defaultwriteprot) writeprot[0] = 1; CheckMenuItem(hmenu, IDM_DISC_WPROT_0, (writeprot[0]) ? MF_CHECKED : MF_UNCHECKED); } break; case IDM_DISC_NEW_1: if (!getsfile(hwnd, "Disc image (*.SSD;*.DSD;*.ADF;*.ADL)\0*.SSD;*.DSD;*.ADF;*.ADL\0All files (*.*)\0*.*\0", discfns[1], "SSD")) { disc_close(1); disc_new(1, discfns[1]); if (defaultwriteprot) writeprot[1] = 1; CheckMenuItem(hmenu, IDM_DISC_WPROT_1, (writeprot[1]) ? MF_CHECKED : MF_UNCHECKED); } break; case IDM_DISC_WPROT_0: writeprot[0] = !writeprot[0]; if (fwriteprot[0]) writeprot[0] = 1; CheckMenuItem(hmenu, IDM_DISC_WPROT_0, (writeprot[0]) ? MF_CHECKED : MF_UNCHECKED); break; case IDM_DISC_WPROT_1: writeprot[1] = !writeprot[1]; if (fwriteprot[1]) writeprot[1] = 1; CheckMenuItem(hmenu, IDM_DISC_WPROT_1, (writeprot[1]) ? MF_CHECKED : MF_UNCHECKED); break; case IDM_DISC_WPROT_D: defaultwriteprot = !defaultwriteprot; CheckMenuItem(hmenu, IDM_DISC_WPROT_D, (defaultwriteprot) ? MF_CHECKED : MF_UNCHECKED); break; case IDM_DISC_VDFS_ENABLE: vdfs_enabled = !vdfs_enabled; CheckMenuItem(hmenu, IDM_DISC_VDFS_ENABLE, (vdfs_enabled) ? MF_CHECKED : MF_UNCHECKED); break; case IDM_DISC_VDFS_ROOT: strncpy(openfilestring, vdfs_get_root(), MAX_PATH); if (!getDir(hwnd, "VDFS Root")) vdfs_set_root(openfilestring); break; case IDM_TAPE_LOAD: if (!getfile(hwnd, "Tape image (*.UEF;*.CSW)\0*.UEF;*.CSW\0All files (*.*)\0*.*\0", tape_fn)) { tape_close(); tape_load(tape_fn); tape_loaded = 1; } break; case IDM_TAPE_EJECT: tape_close(); tape_loaded = 0; break; case IDM_TAPE_REWIND: tape_close(); tape_load(tape_fn); break; case IDM_TAPE_CAT: showcatalogue(hinstance, ghwnd); break; case IDM_TAPES_NORMAL: case IDM_TAPES_FAST: fasttape = LOWORD(wParam) - IDM_TAPES_NORMAL; CheckMenuItem(hmenu, IDM_TAPES_NORMAL, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_TAPES_FAST, MF_UNCHECKED); CheckMenuItem(hmenu, LOWORD(wParam), MF_CHECKED); break; case IDM_VIDEO_NOBORDERS: case IDM_VIDEO_MBORDERS: case IDM_VIDEO_FBORDERS: CheckMenuItem(hmenu, IDM_VIDEO_NOBORDERS + vid_fullborders, MF_UNCHECKED); vid_fullborders = LOWORD(wParam) - IDM_VIDEO_NOBORDERS; CheckMenuItem(hmenu, IDM_VIDEO_NOBORDERS + vid_fullborders, MF_CHECKED); break; case IDM_VIDEO_FULLSCR: fullscreen = 1; EnterCriticalSection(&cs); video_enterfullscreen(); LeaveCriticalSection(&cs); break; case IDM_VIDEO_NULA: if (nula_disable) nula_disable = 0; else nula_disable = 1; break; case IDM_VIDEO_RESIZE: videoresize = !videoresize; CheckMenuItem(hmenu, IDM_VIDEO_RESIZE, (videoresize) ? MF_CHECKED : MF_UNCHECKED); if (videoresize) SetWindowLong(hwnd, GWL_STYLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE); else SetWindowLong(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX & ~WS_THICKFRAME & ~WS_MAXIMIZEBOX) | WS_VISIBLE); GetWindowRect(hwnd, &rect); SetWindowPos(hwnd, 0, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER | SWP_FRAMECHANGED); break; case IDM_VIDEO_SLINEDBL: case IDM_VIDEO_LINEDBL: case IDM_VIDEO_SCANLINES: case IDM_VIDEO_INTERLACED: case IDM_VIDEO_PAL: case IDM_VIDEO_PALI: CheckMenuItem(hmenu, IDM_VIDEO_SLINEDBL, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_VIDEO_LINEDBL, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_VIDEO_SCANLINES, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_VIDEO_INTERLACED, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_VIDEO_PAL, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_VIDEO_PALI, MF_UNCHECKED); CheckMenuItem(hmenu, LOWORD(wParam), MF_CHECKED); vid_scanlines = vid_interlace = vid_linedbl = vid_pal = 0; if (LOWORD(wParam) == IDM_VIDEO_INTERLACED) vid_interlace = 1; if (LOWORD(wParam) == IDM_VIDEO_SCANLINES) vid_scanlines = 1; if (LOWORD(wParam) == IDM_VIDEO_SLINEDBL) vid_linedbl = 1; if (LOWORD(wParam) == IDM_VIDEO_PAL) vid_pal = 1; if (LOWORD(wParam) == IDM_VIDEO_PALI) vid_interlace = vid_pal = 1; video_clearscreen(); break; case IDM_TUBE_NONE: case IDM_TUBE_6502: case IDM_TUBE_Z80: case IDM_TUBE_65816: case IDM_TUBE_32016: CheckMenuItem(hmenu, IDM_TUBE_NONE, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_TUBE_6502, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_TUBE_65816, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_TUBE_Z80, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_TUBE_32016, MF_UNCHECKED); CheckMenuItem(hmenu, LOWORD(wParam), MF_CHECKED); selecttube = LOWORD(wParam) - IDM_TUBE_6502; main_restart(); break; case IDM_TUBES_4: case IDM_TUBES_8: case IDM_TUBES_16: case IDM_TUBES_32: case IDM_TUBES_64: CheckMenuItem(hmenu, IDM_TUBES_4, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_TUBES_8, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_TUBES_16, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_TUBES_32, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_TUBES_64, MF_UNCHECKED); CheckMenuItem(hmenu, LOWORD(wParam), MF_CHECKED); tube_6502_speed = (LOWORD(wParam) - IDM_TUBES_4) + 1; tube_updatespeed(); break; case IDM_SOUND_INTERNAL: sound_internal = !sound_internal; CheckMenuItem(hmenu, IDM_SOUND_INTERNAL, (sound_internal) ? MF_CHECKED : MF_UNCHECKED); break; case IDM_SOUND_BEEBSID: sound_beebsid = !sound_beebsid; CheckMenuItem(hmenu, IDM_SOUND_BEEBSID, (sound_beebsid) ? MF_CHECKED : MF_UNCHECKED); break; case IDM_SOUND_MUSIC5000: sound_music5000 = !sound_music5000; CheckMenuItem(hmenu, IDM_SOUND_MUSIC5000, (sound_music5000) ? MF_CHECKED : MF_UNCHECKED); break; case IDM_SOUND_DAC: sound_dac = !sound_dac; CheckMenuItem(hmenu, IDM_SOUND_DAC, (sound_dac) ? MF_CHECKED : MF_UNCHECKED); break; case IDM_SOUND_DDNOISE: sound_ddnoise = !sound_ddnoise; CheckMenuItem(hmenu, IDM_SOUND_DDNOISE, (sound_ddnoise) ? MF_CHECKED : MF_UNCHECKED); break; case IDM_SOUND_TAPE: sound_tape = !sound_tape; CheckMenuItem(hmenu, IDM_SOUND_TAPE, (sound_tape) ? MF_CHECKED : MF_UNCHECKED); break; case IDM_SOUND_FILTER: sound_filter = !sound_filter; CheckMenuItem(hmenu, IDM_SOUND_FILTER, (sound_filter) ? MF_CHECKED : MF_UNCHECKED); break; case IDM_WAVE_SQUARE: case IDM_WAVE_SAW: case IDM_WAVE_SINE: case IDM_WAVE_TRI: case IDM_WAVE_SID: CheckMenuItem(hmenu, IDM_WAVE_SQUARE + curwave, MF_UNCHECKED); curwave = LOWORD(wParam) - IDM_WAVE_SQUARE; CheckMenuItem(hmenu, IDM_WAVE_SQUARE + curwave, MF_CHECKED); break; case IDM_SID_INTERP: case IDM_SID_RESAMP: CheckMenuItem(hmenu, IDM_SID_INTERP, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_SID_RESAMP, MF_UNCHECKED); CheckMenuItem(hmenu, LOWORD(wParam), MF_CHECKED); sidmethod = LOWORD(wParam) - IDM_SID_INTERP; sid_settype(sidmethod, cursid); break; case IDM_DDV_33: case IDM_DDV_66: case IDM_DDV_100: CheckMenuItem(hmenu, (IDM_DDV_33 + ddnoise_vol) - 1, MF_UNCHECKED); ddnoise_vol = (LOWORD(wParam) - IDM_DDV_33) + 1; CheckMenuItem(hmenu, (IDM_DDV_33 + ddnoise_vol) - 1, MF_CHECKED); break; case IDM_DDT_525: case IDM_DDT_35: CheckMenuItem(hmenu, IDM_DDT_525 + ddnoise_type, MF_UNCHECKED); ddnoise_type = LOWORD(wParam) - IDM_DDT_525; CheckMenuItem(hmenu, IDM_DDT_525 + ddnoise_type, MF_CHECKED); ddnoise_close(); ddnoise_init(); break; case IDM_DEBUGGER: EnterCriticalSection(&cs); rest(200); debug_toggle_core(); CheckMenuItem(hmenu, IDM_DEBUGGER, (debug_core) ? MF_CHECKED: MF_UNCHECKED); LeaveCriticalSection(&cs); break; case IDM_DEBUG_TUBE: EnterCriticalSection(&cs); rest(200); debug_toggle_tube(); CheckMenuItem(hmenu, IDM_DEBUG_TUBE, (debug_tube) ? MF_CHECKED: MF_UNCHECKED); LeaveCriticalSection(&cs); break; case IDM_BREAK: debug_step = 1; break; case IDM_SCRSHOT: if (!getsfile(hwnd, "Bitmap file (*.BMP)\0*.BMP\0All files (*.*)\0*.*\0", vid_scrshotname, "BMP")) { vid_savescrshot = 1; } break; case IDM_KEY_REDEFINE: redefinekeys(); break; case IDM_KEY_AS: keyas = !keyas; CheckMenuItem(hmenu, IDM_KEY_AS, (keyas) ? MF_CHECKED : MF_UNCHECKED); break; case IDM_MOUSE_AMX: mouse_amx = !mouse_amx; CheckMenuItem(hmenu, IDM_MOUSE_AMX, (mouse_amx) ? MF_CHECKED : MF_UNCHECKED); main_setmouse(); updatewindowtitle(); break; case IDM_SCSI_ENABLE: EnterCriticalSection(&cs); CheckMenuItem(hmenu, IDM_SCSI_ENABLE, (!scsi_enabled) ? MF_CHECKED : MF_UNCHECKED); scsi_enabled = !scsi_enabled; main_restart(); LeaveCriticalSection(&cs); break; case IDM_IDE_ENABLE: EnterCriticalSection(&cs); CheckMenuItem(hmenu, IDM_IDE_ENABLE, (!ide_enable) ? MF_CHECKED : MF_UNCHECKED); ide_enable = !ide_enable; main_restart(); LeaveCriticalSection(&cs); break; case IDM_SPD_10: case IDM_SPD_25: case IDM_SPD_50: case IDM_SPD_75: case IDM_SPD_100: case IDM_SPD_150: case IDM_SPD_200: case IDM_SPD_300: case IDM_SPD_400: case IDM_SPD_500: CheckMenuItem(hmenu, IDM_SPD_10 + emuspeed, MF_UNCHECKED); emuspeed = curmodel = LOWORD(wParam) - IDM_SPD_10; changetimerspeed(timerspeeds[emuspeed]); vid_fskipmax = frameskips[emuspeed]; CheckMenuItem(hmenu, IDM_SPD_10 + emuspeed, MF_CHECKED); break; } if (LOWORD(wParam) >= IDM_MODEL_0 && LOWORD(wParam) < (IDM_MODEL_0 + 50)) { CheckMenuItem(hmenu, IDM_MODEL_0 + curmodel, MF_UNCHECKED); oldmodel = curmodel; curmodel = LOWORD(wParam) - IDM_MODEL_0; CheckMenuItem(hmenu, IDM_MODEL_0 + curmodel, MF_CHECKED); main_restart(); updatewindowtitle(); } if (LOWORD(wParam) >= IDM_SID_TYPE && LOWORD(wParam) < (IDM_SID_TYPE + 100)) { CheckMenuItem(hmenu, IDM_SID_TYPE + cursid, MF_UNCHECKED); cursid = LOWORD(wParam) - IDM_SID_TYPE; CheckMenuItem(hmenu, IDM_SID_TYPE + cursid, MF_CHECKED); sid_settype(sidmethod, cursid); } return 0; case WM_USER: if (videoresize) SetWindowLong(hwnd, GWL_STYLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE); else SetWindowLong(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX & ~WS_THICKFRAME & ~WS_MAXIMIZEBOX) | WS_VISIBLE); GetWindowRect(hwnd, &rect); SetWindowPos(hwnd, 0, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER | SWP_FRAMECHANGED); break; case WM_USER+1: if (videoresize) SetWindowLong(hwnd, GWL_STYLE, WS_OVERLAPPEDWINDOW & ~WS_VISIBLE); else SetWindowLong(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX & ~WS_THICKFRAME & ~WS_MAXIMIZEBOX) & ~WS_VISIBLE); GetWindowRect(hwnd,&rect); SetWindowPos(hwnd, 0, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER | SWP_FRAMECHANGED); break; case WM_DESTROY: PostQuitMessage (0); /* send a WM_QUIT to the message queue */ break; case WM_KILLFOCUS: // log_debug("KillFocus\n"); // infocus=0; // spdcount=0; if (mousecapture) { ClipCursor(&oldclip); mousecapture = 0; updatewindowtitle(); } break; case WM_LBUTTONUP: if (!mousecapture && (curtube == 3 || mouse_amx)) { GetClipCursor(&oldclip); GetWindowRect(hwnd, &newclip); newclip.left += GetSystemMetrics(SM_CXFIXEDFRAME) + 10; newclip.right -= GetSystemMetrics(SM_CXFIXEDFRAME) + 10; newclip.top += GetSystemMetrics(SM_CXFIXEDFRAME) + GetSystemMetrics(SM_CYMENUSIZE) + GetSystemMetrics(SM_CYCAPTION) + 10; newclip.bottom -= GetSystemMetrics(SM_CXFIXEDFRAME) + 10; ClipCursor(&newclip); mousecapture = 1; updatewindowtitle(); } break; case WM_ENTERMENULOOP: // log_debug("EnterMenuLoop\n"); bempause = 1; //EnterCriticalSection(&cs); break; case WM_EXITMENULOOP: // log_debug("ExitMenuLoop\n"); bempause = 0; key_clear(); for (c = 0; c < 128; c++) key[c] = 0; //LeaveCriticalSection(&cs); break; case WM_SETFOCUS: // log_debug("SetFocus\n"); key_clear(); for (c = 0; c < 128; c++) key[c] = 0; bempause = 0; break; case WM_SIZE: winsizex = lParam & 0xFFFF; winsizey = lParam >> 16; break; case WM_SYSKEYDOWN: case WM_KEYDOWN: if (LOWORD(wParam) != 255) { //log_debug("Key %04X %04X\n",LOWORD(wParam),VK_LEFT); c = MapVirtualKey(LOWORD(wParam),0); c = hw_to_mycode[c]; // log_debug("MVK %i %i %i\n",c,hw_to_mycode[c],KEY_PGUP); if (LOWORD(wParam) == VK_LEFT) c = KEY_LEFT; if (LOWORD(wParam) == VK_RIGHT) c = KEY_RIGHT; if (LOWORD(wParam) == VK_UP) c = KEY_UP; if (LOWORD(wParam) == VK_DOWN) c = KEY_DOWN; if (LOWORD(wParam) == VK_HOME) c = KEY_HOME; if (LOWORD(wParam) == VK_END) c = KEY_END; if (LOWORD(wParam) == VK_INSERT) c = KEY_INSERT; if (LOWORD(wParam) == VK_DELETE) c = KEY_DEL; if (LOWORD(wParam) == VK_PRIOR) c = KEY_PGUP; if (LOWORD(wParam) == VK_NEXT) c = KEY_PGDN; //log_debug("MVK2 %i %i %i\n",c,hw_to_mycode[c],KEY_PGUP); key[c]=1; } break; case WM_SYSKEYUP: case WM_KEYUP: if (LOWORD(wParam) != 255) { // log_debug("Key %04X %04X\n",LOWORD(wParam),VK_LEFT); c = MapVirtualKey(LOWORD(wParam), 0); c = hw_to_mycode[c]; if (LOWORD(wParam) == VK_LEFT) c = KEY_LEFT; if (LOWORD(wParam) == VK_RIGHT) c = KEY_RIGHT; if (LOWORD(wParam) == VK_UP) c = KEY_UP; if (LOWORD(wParam) == VK_DOWN) c = KEY_DOWN; if (LOWORD(wParam) == VK_HOME) c = KEY_HOME; if (LOWORD(wParam) == VK_END) c = KEY_END; if (LOWORD(wParam) == VK_INSERT) c = KEY_INSERT; if (LOWORD(wParam) == VK_DELETE) c = KEY_DEL; if (LOWORD(wParam) == VK_PRIOR) c = KEY_PGUP; if (LOWORD(wParam) == VK_NEXT) c = KEY_PGDN; // log_debug("MVK %i\n",c); key[c] = 0; } break; case WM_CREATE: // initbbc(argc,argv); // free(argv); // mainthread=(HANDLE)_beginthread(_mainthread,0,NULL); break; default: r = DefWindowProc (hwnd, message, wParam, lParam); return r; } return 0; }
void disc_load(int drive, char *fn) { int c = 0; char *p; FILE *f; setejecttext(drive, ""); if (!fn) return; p = get_extension(fn); if (!p) return; setejecttext(drive, fn); bem_debugf("Loading :%i %s %s\n", drive, fn,p); while (loaders[c].ext) { if (!strcasecmp(p, loaders[c].ext)) { driveloaders[drive] = c; loaders[c].load(drive, fn); return; } c++; } // printf("Couldn't load %s %s\n",fn,p); /*No extension match, so guess based on image size*/ f=x_fopen(fn, "rb"); if (!f) return; fseek(f, -1, SEEK_END); c = ftell(f)+1; fclose(f); bem_debugf("Size %i\n",c); if (c == (800*1024)) /*800k ADFS/DOS - 80*2*5*1024*/ { driveloaders[drive] = 2; loaders[2].load(drive, fn); return; } if (c == (640*1024)) /*640k ADFS/DOS - 80*2*16*256*/ { driveloaders[drive] = 3; loaders[3].load(drive, fn); return; } if (c == (720*1024)) /*720k DOS - 80*2*9*512*/ { driveloaders[drive] = 3; adl_loadex(drive, fn, 9, 512, 0); return; } if (c == (360*1024)) /*360k DOS - 40*2*9*512*/ { driveloaders[drive] = 3; adl_loadex(drive, fn, 9, 512, 1); return; } if (c <= (200 * 1024)) /*200k DFS - 80*1*10*256*/ { driveloaders[drive] = 0; loaders[0].load(drive, fn); return; } if (c <= (400 * 1024)) /*400k DFS - 80*2*10*256*/ { driveloaders[drive] = 1; loaders[1].load(drive, fn); return; } }