diff --git a/iop/atad_emu/src/ps2atad.c b/iop/atad_emu/src/ps2atad.c index 0f7ef5e..d1cc0e3 100644 --- a/iop/atad_emu/src/ps2atad.c +++ b/iop/atad_emu/src/ps2atad.c @@ -39,7 +39,7 @@ ata_devinfo_t *ata_get_devinfo(int device) if (device == 0 && dev[0].exists == 0) { // Initialize - u32 size = fhi_size(1); + u32 size = fhi_size(FHI_FID_ATA0); if (size > 0) { M_PRINTF("(%d) size = %d sectors\n", device, size); dev[0].exists = 1; @@ -86,10 +86,10 @@ int ata_device_sector_io(int device, void *buf, u32 lba, u32 nsectors, int dir) M_PRINTF("(%d, 0x%x, %d, %d, %d)\n", device, buf, lba, nsectors, dir); if (dir == ATA_DIR_WRITE) { - fhi_write(1, buf, lba, nsectors); + fhi_write(FHI_FID_ATA0, buf, lba, nsectors); return 0; } else { - fhi_read(1, buf, lba, nsectors); + fhi_read(FHI_FID_ATA0, buf, lba, nsectors); return 0; } diff --git a/iop/cdvdman_emu/src/device-fhi.c b/iop/cdvdman_emu/src/device-fhi.c index 607f6df..510eedd 100644 --- a/iop/cdvdman_emu/src/device-fhi.c +++ b/iop/cdvdman_emu/src/device-fhi.c @@ -35,7 +35,7 @@ void DeviceFSInit(void) DPRINTF("Waiting for device...\n"); while (1) { - iso_size = fp_fhi_size(0); + iso_size = fp_fhi_size(FHI_FID_CDVD); if (iso_size > 0) break; DelayThread(100 * 1000); // 100ms diff --git a/iop/common/fhi.h b/iop/common/fhi.h index 80fe939..22913bb 100644 --- a/iop/common/fhi.h +++ b/iop/common/fhi.h @@ -8,6 +8,12 @@ #include #include +#define FHI_FID_CDVD 0 +#define FHI_FID_ATA0 1 +#define FHI_FID_ATA1 2 +#define FHI_FID_MC0 3 +#define FHI_FID_MC1 4 + // Size of the file in SECTORS of 512b uint32_t fhi_size(int file_handle); // Read SECTORS from file diff --git a/iop/common/fhi_bdm.h b/iop/common/fhi_bdm.h index 120883a..e07efeb 100644 --- a/iop/common/fhi_bdm.h +++ b/iop/common/fhi_bdm.h @@ -8,7 +8,7 @@ #define MODULE_SETTINGS_MAGIC 0xf1f2f3f4 -#define BDM_MAX_FILES 4 +#define BDM_MAX_FILES 5 #define BDM_MAX_FRAGS 64 // 64 * 12bytes = 768bytes struct fhi_bdm_fragfile diff --git a/iop/mc_emu/src/mcemu.c b/iop/mc_emu/src/mcemu.c index fec8779..42cd3bf 100644 --- a/iop/mc_emu/src/mcemu.c +++ b/iop/mc_emu/src/mcemu.c @@ -668,7 +668,7 @@ int MceEraseBlock(MemoryCard *mcd, int page) memset(mcd->dbufp, r, mcd->cspec.PageSize); for (i = 0; i < mcd->cspec.BlockSize; i++) { - r = fhi_write(mcd->mcnum + 3, mcd->dbufp, page + i, 1); + r = fhi_write(FHI_FID_MC0 + mcd->mcnum, mcd->dbufp, page + i, 1); if (!r) { DPRINTF("erase error\n"); return 0; @@ -686,7 +686,7 @@ static int do_read(MemoryCard *mcd) r = (mcd->flags & 0x10) ? 0xFF : 0x0; memset(mcd->cbufp, r, 0x10); - r = fhi_read(mcd->mcnum + 3, mcd->dbufp, mcd->rpage, 1); + r = fhi_read(FHI_FID_MC0 + mcd->mcnum, mcd->dbufp, mcd->rpage, 1); if (!r) { DPRINTF("read error\n"); return 0; @@ -788,7 +788,7 @@ int MceWrite(MemoryCard *mcd, void *buf, u32 size) size = tot_size - size; mcd->wroff = 0; - r = fhi_write(mcd->mcnum + 3, mcd->dbufp, mcd->wpage, 1); + r = fhi_write(FHI_FID_MC0 + mcd->mcnum, mcd->dbufp, mcd->wpage, 1); if (!r) { DPRINTF("write error.\n"); return 0;