Beispiel #1
0
s32 WBFS_OpenDisc(u8 *discid)
{
	s32 ret;

	/* Initialize USB */
	ret = usbstorage_Startup();
	if (!ret)
		return 1;

	/* Read capacity */
	ret = usbstorage_ReadCapacity(&sectorSz, &nbSector);
	if (!ret)
		return 2;

	/* Close disc */
	if (disc)
		wbfs_close_disc(disc);

	/* Close SD */
	if (hdd)
		wbfs_close(hdd);

	/* Open SD */
	hdd = wbfs_open_hd(__WBFS_ReadSector, NULL, NULL, sectorSz, 0, 0);
	if (!hdd)
		return 3;

	/* Open disc */
	disc = wbfs_open_disc(hdd, discid);
	if (!disc)
		return 4;

	return 0;
}
Beispiel #2
0
s32 WBFS_OpenDisc(u8 *discid)
{
	s32 ret;

	/* Initialize SDIO */
	ret = sdio_Startup();
	if (!ret)
		return 1;

	/* Close disc */
	if (disc)
		wbfs_close_disc(disc);

	/* Close SD */
	if (hdd)
		wbfs_close(hdd);

	/* Open SD */
	hdd = wbfs_open_hd(__WBFS_ReadSector, NULL, NULL, SECTOR_SIZE, 0, 0);
	if (!hdd)
		return 2;

	/* Open disc */
	disc = wbfs_open_disc(hdd, discid);
	if (!disc)
		return 3;

	return 0;
}
Beispiel #3
0
int op_init_partition(char *device)
{
  if (app_state.wbfs) {
    wbfs_close(app_state.wbfs);
    app_state.wbfs = NULL;
  }

  app_state.wbfs = wbfs_try_open_partition(device, 1);
  if (app_state.wbfs != NULL)
    return 0;
  return 1;
}
Beispiel #4
0
s32 WBFS_Open(void)
{
	/* Close hard disk */
	if (hdd)
		wbfs_close(hdd);

	/* Open hard disk */
	hdd = wbfs_open_hd(readCallback, writeCallback, NULL, sector_size, nb_sectors, 0);
	if (!hdd)
		return -1;

	return 0;
}
Beispiel #5
0
s32 WBFS_Format(u32 lba, u32 size)
{
	wbfs_t *partition = NULL;

	/* Reset partition */
	partition = wbfs_open_partition(readCallback, writeCallback, NULL, sector_size, size, lba, 1);
	if (!partition)
		return -1;

	/* Free memory */
	wbfs_close(partition);

	return 0;
}
Beispiel #6
0
s32 WBFS_OpenLBA(u32 lba, u32 size)
{
	wbfs_t *part = NULL;

	/* Open partition */
	part = wbfs_open_partition(readCallback, writeCallback, NULL, wbfs_dev_sector_size, size, lba, 0);
	if (!part) return -1;

	/* Close current hard disk */
	if (hdd) wbfs_close(hdd);
	hdd = part;

	return 0;
}
Beispiel #7
0
bool WBFS_Close()
{
	/* Close hard disk */
	if (hdd) {
		wbfs_close(hdd);
		hdd = NULL;
	}
	UnmountFS(GAME_MOUNT);
	wbfs_part_fs = 0;
	wbfs_part_idx = 0;
	wbfs_part_lba = 0;
	strcpy(wbfs_fs_drive, "");

	return 0;
}
Beispiel #8
0
s32 WBFS_Open(void)
{
	/* Close hard disk */
	if (hdd)
		wbfs_close(hdd);
	
	/* Open hard disk */
	wbfs_part_fs = 0;
	wbfs_part_idx = 0;
	wbfs_part_lba = 0;
	hdd = wbfs_open_hd(readCallback, writeCallback, NULL, wbfs_dev_sector_size, nb_sectors, 0);
	if (!hdd)
		return -1;
	wbfs_part_idx = 1;
	wbfs_part_lba = hdd->part_lba;

	return 0;
}
void PartitionHandle::UnMount(int pos)
{
	if(!interface || (pos >= (int)MountNameList.size()) || (MountNameList[pos].size() == 0))
		return;

	WBFS_Close();
	char DeviceSyn[10];
	memcpy(DeviceSyn, MountName(pos), 8);
	strcat(DeviceSyn, ":");
	DeviceSyn[9] = '\0';

	if(strncmp(GetFSName(pos), "WBFS", 4) == 0)
	{
		wbfs_t *wbfshandle = GetWbfsHandle(pos);
		if(wbfshandle) wbfs_close(wbfshandle);
		gprintf("WBFS Partition at %s unmounted.\n", DeviceSyn);
	}
	else if(strncmp(GetFSName(pos), "FAT", 3) == 0)
	{
		fatUnmount(DeviceSyn);
		gprintf("FAT Partition at %s unmounted.\n", DeviceSyn);
	}
	else if(strncmp(GetFSName(pos), "NTFS", 4) == 0)
	{
		ntfsUnmount(DeviceSyn, true);
		gprintf("NTFS Partition at %s unmounted.\n", DeviceSyn);
	}
	else if(strncmp(GetFSName(pos), "LINUX", 5) == 0)
	{
		ext2Unmount(DeviceSyn);
		gprintf("EXT Partition at %s unmounted.\n", DeviceSyn);
	}
	/* Remove name from list */
	MountNameList[pos].clear();
	SetWbfsHandle(pos, NULL);
}