Ejemplo n.º 1
0
void VFSManagerDialog::OnAdd(wxCommandEvent& event)
{
	m_entries.emplace_back(VFSManagerEntry());
	UpdateList();

	u32 idx = m_entries.size() - 1;
	for(int i=0; i<m_list->GetItemCount(); ++i)
	{
		m_list->SetItemState(i, i == idx ? wxLIST_STATE_SELECTED : ~wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
	}

	wxCommandEvent ce;
	OnEntryConfig(ce);
}
Ejemplo n.º 2
0
Archivo: VFS.cpp Proyecto: ss23/rpcs3
void VFS::SaveLoadDevices(std::vector<VFSManagerEntry>& res, bool is_load)
{
	int count = 0;
	if (is_load)
	{
		count = rpcs3::config.vfs.count.value();

		if (!count)
		{
			res.emplace_back(vfsDevice_LocalFile, "$(EmulatorDir)/dev_hdd0/",   "/dev_hdd0/");
			res.emplace_back(vfsDevice_LocalFile, "$(EmulatorDir)/dev_hdd1/",   "/dev_hdd1/");
			res.emplace_back(vfsDevice_LocalFile, "$(EmulatorDir)/dev_flash/",  "/dev_flash/");
			res.emplace_back(vfsDevice_LocalFile, "$(EmulatorDir)/dev_usb000/", "/dev_usb000/");
			res.emplace_back(vfsDevice_LocalFile, "$(EmulatorDir)/dev_usb000/", "/dev_usb/");
			res.emplace_back(vfsDevice_LocalFile, "",                           "/host_root/");

			return;
		}

		res.resize(count);
	}
	else
	{
		count = (int)res.size();
		rpcs3::config.vfs.count = count;
	}

	// Custom EmulationDir
	if (rpcs3::config.system.emulation_dir_path_enable.value())
	{
		std::string dir = rpcs3::config.system.emulation_dir_path.value();

		if (dir.empty())
		{
			rpcs3::config.system.emulation_dir_path = Emu.GetEmulatorPath();
		}

		if (!fs::is_dir(dir))
		{
			LOG_ERROR(GENERAL, "Custom EmulationDir: directory '%s' not found", dir);
		}
		else
		{
			LOG_NOTICE(GENERAL, "Custom EmulationDir: $(EmulatorDir) bound to '%s'", dir);
		}
	}

	for(int i=0; i<count; ++i)
	{
		rpcs3::config.vfs.add_entry(fmt::format("path[%d]", i), std::string{});
		rpcs3::config.vfs.add_entry(fmt::format("device_path[%d]", i), std::string{});
		rpcs3::config.vfs.add_entry(fmt::format("mount[%d]", i), std::string{});
		rpcs3::config.vfs.add_entry(fmt::format("device[%d]", i), 0);

		if (is_load)
		{
			res[i] = VFSManagerEntry();
			res[i].path = rpcs3::config.vfs.get_entry_value<std::string>(fmt::format("path[%d]", i), std::string{});
			res[i].device_path = rpcs3::config.vfs.get_entry_value<std::string>(fmt::format("device_path[%d]", i), std::string{});
			res[i].mount = rpcs3::config.vfs.get_entry_value<std::string>(fmt::format("mount[%d]", i), std::string{});
			res[i].device = (vfsDeviceType)rpcs3::config.vfs.get_entry_value<int>(fmt::format("device[%d]", i), 0);
		}
		else
		{
			rpcs3::config.vfs.set_entry_value(fmt::format("path[%d]", i), res[i].path);
			rpcs3::config.vfs.set_entry_value(fmt::format("device_path[%d]", i), res[i].device_path);
			rpcs3::config.vfs.set_entry_value(fmt::format("mount[%d]", i), res[i].mount);
			rpcs3::config.vfs.set_entry_value(fmt::format("device[%d]", i), (int)res[i].device);
		}
	}
}
Ejemplo n.º 3
0
void VFS::SaveLoadDevices(std::vector<VFSManagerEntry>& res, bool is_load)
{
	IniEntry<int> entries_count;
	entries_count.Init("count", "VFSManager");

	int count = 0;
	if (is_load)
	{
		count = entries_count.LoadValue(count);

		if (!count)
		{
			res.emplace_back(vfsDevice_LocalFile, "$(EmulatorDir)/dev_hdd0/",   "/dev_hdd0/");
			res.emplace_back(vfsDevice_LocalFile, "$(EmulatorDir)/dev_hdd1/",   "/dev_hdd1/");
			res.emplace_back(vfsDevice_LocalFile, "$(EmulatorDir)/dev_flash/",  "/dev_flash/");
			res.emplace_back(vfsDevice_LocalFile, "$(EmulatorDir)/dev_usb000/", "/dev_usb000/");
			res.emplace_back(vfsDevice_LocalFile, "$(EmulatorDir)/dev_usb000/", "/dev_usb/");
			res.emplace_back(vfsDevice_LocalFile, "",                           "/host_root/");

			return;
		}

		res.resize(count);
	}
	else
	{
		count = (int)res.size();
		entries_count.SaveValue(count);
	}

	// Custom EmulationDir
	if (Ini.SysEmulationDirPathEnable.GetValue())
	{
		std::string dir = Ini.SysEmulationDirPath.GetValue();

		if (dir.empty())
		{
			Ini.SysEmulationDirPath.SetValue(Emu.GetEmulatorPath());
		}

		if (!fs::is_dir(dir))
		{
			LOG_ERROR(GENERAL, "Custom EmulationDir: directory '%s' not found", dir);
		}
		else
		{
			LOG_NOTICE(GENERAL, "Custom EmulationDir: $(EmulatorDir) bound to '%s'", dir);
		}
	}

	for(int i=0; i<count; ++i)
	{
		IniEntry<std::string> entry_path;
		IniEntry<std::string> entry_device_path;
		IniEntry<std::string> entry_mount;
		IniEntry<int> entry_device;

		entry_path.Init(fmt::Format("path[%d]", i), "VFSManager");
		entry_device_path.Init(fmt::Format("device_path[%d]", i), "VFSManager");
		entry_mount.Init(fmt::Format("mount[%d]", i), "VFSManager");
		entry_device.Init(fmt::Format("device[%d]", i), "VFSManager");
		
		if (is_load)
		{
			res[i] = VFSManagerEntry();
			res[i].path = entry_path.LoadValue("");
			res[i].device_path = entry_device_path.LoadValue("");
			res[i].mount = entry_mount.LoadValue("");
			res[i].device = (vfsDeviceType)entry_device.LoadValue(vfsDevice_LocalFile);
		}
		else
		{
			entry_path.SaveValue(res[i].path);
			entry_device_path.SaveValue(res[i].device_path);
			entry_mount.SaveValue(res[i].mount);
			entry_device.SaveValue(res[i].device);
		}
	}
}
Ejemplo n.º 4
0
void VFS::SaveLoadDevices(std::vector<VFSManagerEntry>& res, bool is_load)
{
	IniEntry<int> entries_count;
	entries_count.Init("count", "VFSManager");

	int count = 0;
	if(is_load)
	{
		count = entries_count.LoadValue(count);

		if(!count)
		{
			res.emplace_back(vfsDevice_LocalFile, "$(EmulatorDir)/dev_hdd0/",   "/dev_hdd0/");
			res.emplace_back(vfsDevice_LocalFile, "$(EmulatorDir)/dev_hdd1/",   "/dev_hdd1/");
			res.emplace_back(vfsDevice_LocalFile, "$(EmulatorDir)/dev_flash/",  "/dev_flash/");
			res.emplace_back(vfsDevice_LocalFile, "$(EmulatorDir)/dev_usb000/", "/dev_usb000/");
			res.emplace_back(vfsDevice_LocalFile, "$(EmulatorDir)/dev_usb000/", "/dev_usb/");
			res.emplace_back(vfsDevice_LocalFile, "$(GameDir)",                 "/app_home/");
			res.emplace_back(vfsDevice_LocalFile, "$(GameDir)/../",             "/dev_bdvd/");
			res.emplace_back(vfsDevice_LocalFile, "",                           "/host_root/");
			res.emplace_back(vfsDevice_LocalFile, "$(GameDir)",                 "/");

			return;
		}

		res.resize(count);
	}
	else
	{
		count = res.size();
		entries_count.SaveValue(res.size());
	}

	for(int i=0; i<count; ++i)
	{
		IniEntry<std::string> entry_path;
		IniEntry<std::string> entry_device_path;
		IniEntry<std::string> entry_mount;
		IniEntry<int> entry_device;

		entry_path.Init(fmt::Format("path[%d]", i), "VFSManager");
		entry_device_path.Init(fmt::Format("device_path[%d]", i), "VFSManager");
		entry_mount.Init(fmt::Format("mount[%d]", i), "VFSManager");
		entry_device.Init(fmt::Format("device[%d]", i), "VFSManager");
		
		if(is_load)
		{
			res[i] = VFSManagerEntry();
			res[i].path = entry_path.LoadValue("");
			res[i].device_path = entry_device_path.LoadValue("");
			res[i].mount = entry_mount.LoadValue("");
			res[i].device = (vfsDeviceType)entry_device.LoadValue(vfsDevice_LocalFile);
		}
		else
		{
			entry_path.SaveValue(res[i].path);
			entry_device_path.SaveValue(res[i].device_path);
			entry_mount.SaveValue(res[i].mount);
			entry_device.SaveValue(res[i].device);
		}
	}
}