Add usb storage calls #1

Merged
Zer0xFF merged 1 commit from usb_storage into master 2018-12-25 01:54:32 -06:00
Zer0xFF commented 2018-12-24 14:40:22 -06:00 (Migrated from github.com)

I noticed the requestMap function fails in Shellcore that causes mount to fail, if app category is not (app_cat | 1) == 5 (aka app_cat == 4 or 5) or if skip param flag is not set.
P.S one of the valid app cat is gdd, the 2nd one is probably gdi (what the media app use, but app fails to launch using that)

however there is an unexported/No NID call that set the skip param which I access like this.

	#define SCE_SYSMODULE_USB_STORAGE 0xD5

	int ret = sceSysmoduleLoadModule(SCE_SYSMODULE_USB_STORAGE);
	if (ret != SCE_OK) {
		printf("Error: sceSysmoduleLoadModule(SCE_SYSMODULE_USB_STORAGE), ret 0x%08x\n", ret);
		return ret;
	}
	typedef int32_t (*__sceUsbStorageRequestMap2)(uint32_t id, const char * directory, const char * mountpt);
	ret = sceUsbStorageInit(0);
	int32_t device_count = 0;
	uint32_t device_ids[10] = {0};
	sceUsbStorageGetDeviceList(device_ids, &device_count);
	__sceUsbStorageRequestMap2 _sceUsbStorageRequestMap2 = (__sceUsbStorageRequestMap2)(((uint64_t)&(*sceUsbStorageRequestMap)) - (0xF0 - 0x50)); // offset on 5.05

	for(int i = 0; i < device_count; ++i )
	{
		std::string mount_pt = std::string("/usb") + std::to_string(i);
		ret = _sceUsbStorageRequestMap2(device_ids[i],"/", mount_pt.c_str());
	}

if someone finds a none hack solution, I'd love to hear about it.

side note you can also get usb to work by patching sceUsbStorageRequestMapWSB(), this function calls 1 other function but adds 2 more arugments, the 1st new argument, aka argument (?) 8-9, can be patched from 3 to 2 and should have the same effect.

I noticed the requestMap function fails in Shellcore that causes mount to fail, if app category is not `(app_cat | 1) == 5` (aka app_cat == 4 or 5) or if skip param flag is not set. P.S one of the valid app cat is gdd, the 2nd one is probably gdi (what the media app use, but app fails to launch using that) however there is an unexported/No NID call that set the skip param which I access like this. ```C #define SCE_SYSMODULE_USB_STORAGE 0xD5 int ret = sceSysmoduleLoadModule(SCE_SYSMODULE_USB_STORAGE); if (ret != SCE_OK) { printf("Error: sceSysmoduleLoadModule(SCE_SYSMODULE_USB_STORAGE), ret 0x%08x\n", ret); return ret; } typedef int32_t (*__sceUsbStorageRequestMap2)(uint32_t id, const char * directory, const char * mountpt); ret = sceUsbStorageInit(0); int32_t device_count = 0; uint32_t device_ids[10] = {0}; sceUsbStorageGetDeviceList(device_ids, &device_count); __sceUsbStorageRequestMap2 _sceUsbStorageRequestMap2 = (__sceUsbStorageRequestMap2)(((uint64_t)&(*sceUsbStorageRequestMap)) - (0xF0 - 0x50)); // offset on 5.05 for(int i = 0; i < device_count; ++i ) { std::string mount_pt = std::string("/usb") + std::to_string(i); ret = _sceUsbStorageRequestMap2(device_ids[i],"/", mount_pt.c_str()); } ``` if someone finds a none hack solution, I'd love to hear about it. side note you can also get usb to work by patching `sceUsbStorageRequestMapWSB()`, this function calls 1 other function but adds 2 more arugments, the 1st new argument, aka argument (?) 8-9, can be patched from 3 to 2 and should have the same effect.
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-flatz/ps4_stub_lib_maker_v2!1
No description provided.