private void FindDirs_Button_Click(object sender, EventArgs e) { if (pid == 0) { return; } var pm = ps4.GetProcessMaps(pid); if (pm.FindEntry("(NoName)clienthandler") == null) { return; } var dirNameAddr = ps4.AllocateMemory(pid, Marshal.SizeOf(typeof(SceSaveDataDirName)) * 1024); SceSaveDataDirNameSearchCond searchCond = new SceSaveDataDirNameSearchCond { userId = InitialUser() }; SceSaveDataDirNameSearchResult searchResult = new SceSaveDataDirNameSearchResult { dirNames = dirNameAddr, dirNamesNum = 1024 }; Dirs_ComboBox.DataSource = Find(searchCond, searchResult); ps4.FreeMemory(pid, dirNameAddr, Marshal.SizeOf(typeof(SceSaveDataDirName)) * 1024); }
private string[] Find(SceSaveDataDirNameSearchCond searchCond, SceSaveDataDirNameSearchResult searchResult) { var searchCondAddr = ps4.AllocateMemory(pid, Marshal.SizeOf(typeof(SceSaveDataDirNameSearchCond))); var searchResultAddr = ps4.AllocateMemory(pid, Marshal.SizeOf(typeof(SceSaveDataDirNameSearchResult))); ps4.WriteMemory(pid, searchCondAddr, searchCond); ps4.WriteMemory(pid, searchResultAddr, searchResult); if (ps4.Call(pid, stub, libSceSaveDataBase + offsets.sceSaveDataDirNameSearch, searchCondAddr, searchResultAddr) == 0) { searchResult = ps4.ReadMemory <SceSaveDataDirNameSearchResult>(pid, searchResultAddr); string[] dirs = new string[searchResult.hitNum]; for (uint i = 0; i < searchResult.hitNum; i++) { dirs[i] = ps4.ReadMemory <string>(pid, searchResult.dirNames + i * 32); } ps4.FreeMemory(pid, searchCondAddr, Marshal.SizeOf(typeof(SceSaveDataDirNameSearchCond))); ps4.FreeMemory(pid, searchResultAddr, Marshal.SizeOf(typeof(SceSaveDataDirNameSearchResult))); return(dirs); } ps4.FreeMemory(pid, searchCondAddr, Marshal.SizeOf(typeof(SceSaveDataDirNameSearchCond))); ps4.FreeMemory(pid, searchResultAddr, Marshal.SizeOf(typeof(SceSaveDataDirNameSearchResult))); return(new string[0]); }
private SearchEntry[] Find(SceSaveDataDirNameSearchCond searchCond, SceSaveDataDirNameSearchResult searchResult) { var searchCondAddr = ps4.AllocateMemory(pid, Marshal.SizeOf(typeof(SceSaveDataDirNameSearchCond))); var searchResultAddr = ps4.AllocateMemory(pid, Marshal.SizeOf(typeof(SceSaveDataDirNameSearchResult))); ps4.WriteMemory(pid, searchCondAddr, searchCond); ps4.WriteMemory(pid, searchResultAddr, searchResult); if (ps4.Call(pid, stub, libSceSaveDataBase + offsets.sceSaveDataDirNameSearch, searchCondAddr, searchResultAddr) == 0) { searchResult = ps4.ReadMemory <SceSaveDataDirNameSearchResult>(pid, searchResultAddr); SearchEntry[] sEntries = new SearchEntry[searchResult.hitNum]; for (uint i = 0; i < searchResult.hitNum; i++) { SceSaveDataParam tmp = ps4.ReadMemory <SceSaveDataParam>(pid, searchResult.param + i * (uint)Marshal.SizeOf(typeof(SceSaveDataParam))); sEntries[i] = new SearchEntry { dirName = ps4.ReadMemory <string>(pid, searchResult.dirNames + i * 32), title = tmp.title, subtitle = tmp.subTitle, detail = tmp.detail, time = new DateTime(1970, 1, 1).ToLocalTime().AddSeconds(tmp.mtime).ToString(), }; } ps4.FreeMemory(pid, searchCondAddr, Marshal.SizeOf(typeof(SceSaveDataDirNameSearchCond))); ps4.FreeMemory(pid, searchResultAddr, Marshal.SizeOf(typeof(SceSaveDataDirNameSearchResult))); return(sEntries); } ps4.FreeMemory(pid, searchCondAddr, Marshal.SizeOf(typeof(SceSaveDataDirNameSearchCond))); ps4.FreeMemory(pid, searchResultAddr, Marshal.SizeOf(typeof(SceSaveDataDirNameSearchResult))); return(new SearchEntry[0]); }
private void FindDirs_Button_Click(object sender, EventArgs e) { if (pid == 0) { return; } var pm = ps4.GetProcessMaps(pid); if (pm.FindEntry("(NoName)clienthandler") == null) { return; } var dirNameAddr = ps4.AllocateMemory(pid, Marshal.SizeOf(typeof(SceSaveDataDirName)) * 1024); var paramAddr = ps4.AllocateMemory(pid, Marshal.SizeOf(typeof(SceSaveDataParam)) * 1024); SceSaveDataDirNameSearchCond searchCond = new SceSaveDataDirNameSearchCond { userId = InitialUser() }; SceSaveDataDirNameSearchResult searchResult = new SceSaveDataDirNameSearchResult { dirNames = dirNameAddr, dirNamesNum = 1024, param = paramAddr, }; Dirs_ComboBox.DataSource = Find(searchCond, searchResult); ps4.FreeMemory(pid, dirNameAddr, Marshal.SizeOf(typeof(SceSaveDataDirName)) * 1024); ps4.FreeMemory(pid, paramAddr, Marshal.SizeOf(typeof(SceSaveDataParam)) * 1024); if (Dirs_ComboBox.Items.Count > 0) { SetStatus($"Found {Dirs_ComboBox.Items.Count} Save Directories :D"); } else { SetStatus("Found 0 Save Directories :("); } }