private bool InjectRom() { bool injected = true; try { Cll.Log.WriteLine("Empty \"base\\content\\rom\" folder."); Directory.Delete("base\\content\\rom", true); Directory.CreateDirectory("base\\content\\rom"); Cll.Log.WriteLine("Injecting ROM."); if (RomN64.ToBigEndian(RomPath, "base\\content\\rom\\U" + Rom.ProductCodeVersion + ".z64")) { Cll.Log.WriteLine("CRC16: " + Rom.HashCRC16.ToString("X4")); Cll.Log.WriteLine("In: \"base\\content\\rom\\U" + Rom.ProductCodeVersion + ".z64\""); Cll.Log.WriteLine("Injected ROM."); } else { Cll.Log.WriteLine("ROM not injected, \"RomN64.ToBigEndian\" failed."); injected = false; } } catch { Cll.Log.WriteLine("Error injecting ROM."); injected = false; } return(injected); }
public _64Injector() { BasePath = null; ShortName = null; LongName = null; DarkFilter = true; Widescreen = false; Zoom = null; InPath = null; RomPath = null; IniPath = null; IconPath = null; BootTvPath = null; BootDrcPath = null; OutPath = null; Encrypt = true; _base = GetLoadedBase(); Rom = null; Ini = null; Scale = 1.0F; BootTvImg = new BootImage(); BootDrcImg = new BootImage(); IconImg = new IconImage(); }
private bool InjectRom() { bool injected = true; try { Cll.Log.WriteLine("Empty \"base\\content\\config\" folder."); Directory.Delete("base\\content\\config", true); Directory.CreateDirectory("base\\content\\config"); Cll.Log.WriteLine("Injecting INI data."); if (IniIsLoaded) { FileStream fs = File.Open("base\\content\\config\\U" + Rom.ProductCodeVersion + ".z64.ini", FileMode.Create); fs.Write(_ini, 0, _ini.Length); fs.Close(); Cll.Log.WriteLine("INI injected."); } else { File.Create("base\\content\\config\\U" + Rom.ProductCodeVersion + ".z64.ini").Close(); Cll.Log.WriteLine("An empty INI injected."); } Cll.Log.WriteLine("Empty \"base\\content\\rom\" folder."); Directory.Delete("base\\content\\rom", true); Directory.CreateDirectory("base\\content\\rom"); Cll.Log.WriteLine("Injecting ROM."); if (RomN64.ToBigEndian(RomPath, "base\\content\\rom\\U" + Rom.ProductCodeVersion + ".z64")) { Cll.Log.WriteLine("Injected ROM."); } else { Cll.Log.WriteLine("ROM not injected, \"ToBigEndian\" failed."); injected = false; } } catch { Cll.Log.WriteLine("Error injecting ROM."); injected = false; } return(injected); }
public static bool ToBigEndian(string source, string destination) { RomN64 rom = new RomN64(source); if (rom.IsValid) { try { FileStream fs = File.Open(source, FileMode.Open); byte[] data = new byte[fs.Length]; fs.Read(data, 0, data.Length); fs.Close(); data = ToBigEndian(data, rom.Endianness); fs = File.Open(destination, FileMode.Create); fs.Write(data, 0, data.Length); fs.Close(); return(true); } catch { } } return(false); }