public void writeRawfile(Rawfile raw) { int index = raw.index; uint write_addr = WRITE_ADDR + WRITE_POS; /* * if(raw.CustomFile) * { * PS3.WriteString(write_addr, raw.name); * * WRITE_POS += (uint)raw.name.Length + 1; * * raw.name_ptr = write_addr; * PS3.WriteUInt(XAssetPool + (uint)(index * RawfileSize) + 4, raw.name_ptr); //update the name ptr * } */ PS3.SetMemory(write_addr, raw.buffer);//write in mem WRITE_POS += raw.length; raw.buffer_ptr = write_addr; PS3.WriteUInt(XAssetPool + (uint)(index * RawfileSize) + 12, raw.buffer_ptr); //update the table PS3.WriteUInt(XAssetPool + (uint)(index * RawfileSize) + 8, raw.length); //update the length. uint table_addr = XAssetPool + (uint)(index * RawfileSize) + 12; uint len_addr = XAssetPool + (uint)(index * RawfileSize) + 8; }
private void button2_Click(object sender, EventArgs e) //Inject custom GSCs { richTextBox1.Text = ""; if (mod_path == null || !Directory.Exists(mod_path)) //stop if no folder selected { return; } //toolStripProgressBar1.Value = 0; progress = 0; RawPool pool = new RawPool(xassetpool); pool.ReadPoolData(); pool.ReadFree(); pool.ReadRawfiles(); for (int i = 0; i < pool.rawfiles.Count - 1; i++) { pool.rawfiles[i].name = PS3.ReadCString(pool.rawfiles[i].name_ptr); richTextBox1.Text += "[ 0x" + pool.rawfiles[i].index.ToString("X") + " ] Found: " + pool.rawfiles[i].name + "\n"; //toolStripProgressBar1.Value = Convert.ToInt32((progress / pool.rawfiles.Count) * RawPool.PoolMax); progress++; Goto(richTextBox1, progress); } //read local files. string output = pool.ReadLocalFiles(mod_path); richTextBox1.Text += output; Goto(richTextBox1, richTextBox1.Lines.Count() - 1); //start injecting.. for (int i = 0; i < pool.rawfiles.Count; i++) { if (pool.rawfiles[i].requireOverwrite) { pool.writeRawfile(pool.rawfiles[i]); } } //update the freehead. //pool.updateFreeHead(); }
private void button3_Click(object sender, EventArgs e) //Dump GSCs { richTextBox1.Text = ""; FolderBrowserDialog fb = new FolderBrowserDialog(); if (fb.ShowDialog() == DialogResult.OK) { RawPool pool = new RawPool(xassetpool); pool.ReadPoolData(); pool.ReadFree(); pool.ReadRawfiles(); for (int i = 0; i < pool.rawfiles.Count - 1; i++) { string name = PS3.ReadCString(pool.rawfiles[i].name_ptr); if (!String.IsNullOrEmpty(name)) { byte[] buffer = PS3.GetMemory(pool.rawfiles[i].buffer_ptr, (int)pool.rawfiles[i].length); if (name.Contains("/")) { name = name.Replace("/", @"\"); String[] lel = name.Replace(@"\", "|").Split('|'); String directory = fb.SelectedPath + @"\" + name.Replace(lel[lel.Length - 1], ""); if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory); } } String path = name.Replace("//", @"\").Replace("/", @"\"); File.WriteAllBytes(fb.SelectedPath + @"\" + path, buffer); richTextBox1.Text += "Dump " + name + "\n"; Goto(richTextBox1, richTextBox1.Lines.Count() - 1); } } } }
public void ReadPoolData() { PoolBuffer = PS3.GetMemory(XAssetPool, (PoolMax * RawfileSize) + 4); //get the entire table. }
public void updateFreeHead() { PS3.WriteUInt(XAssetPool, (uint)freeIndices[0]); }
public static void Connect() { PS3.Connect(); PS3.AttachProcess(); }