public EditorEntities(RSDKv5.Scene scene) { foreach (var obj in scene.Objects) { entities.AddRange(obj.Entities.Select(x => GenerateEditorEntity(x))); } entitiesBySlot = entities.ToDictionary(x => x.Entity.SlotID); }
public EditorEntities(RSDKv5.Scene scene) { foreach (var obj in scene.ObjectDefinitions) { entities.AddRange(obj.ObjectList.Select(x => new EditorEntity(x))); } entitiesBySlot = entities.ToDictionary(x => x.Entity.Unused); }
private void ImportButton_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "Retro-Sonic Stages|Act*.map|RSDKv1 (Sonic Nexus) Stages|Act*.bin|RSDKv2 (Sonic CD) Stages|Act*.bin|RSDKvB (Sonic 1 & 2) Stages|Act*.bin|RSDKv5 (Sonic Mania) Stages|Scene.bin"; if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { loadedRSDKver = dlg.FilterIndex - 1; switch (loadedRSDKver) { case 0: //vRS Lvlv1 = new RSDKv1.Level(dlg.FileName); ImportedLvlBox.Text = dlg.FileName; break; case 1: //v1 Lvlv2 = new RSDKv2.Level(dlg.FileName); ImportedLvlBox.Text = dlg.FileName; break; case 2: //v2 Lvlv3 = new RSDKv3.Level(dlg.FileName); ImportedLvlBox.Text = dlg.FileName; break; case 3: //vB Lvlv4 = new RSDKv4.Level(dlg.FileName); ImportedLvlBox.Text = dlg.FileName; break; case 4: //v5 Lvlv5 = new RSDKv5.Scene(dlg.FileName); ImportedLvlBox.Text = dlg.FileName; break; default: break; } } }
public void ConvertLevel(int NewVer) { if (NewVer == 2) { switch (loadedRSDKver) { case 0: //vRS break; case 1: //v1 Lvlv3 = new RSDKv3.Level(); Lvlv3.width = Lvlv2.width; Lvlv3.height = Lvlv2.height; Lvlv3.Title = Lvlv2.Title; Lvlv3.MapLayout = Lvlv2.MapLayout; Lvlv3.objects.Add(new RSDKv3.Object(1, 0, 64, 0)); //Player Lvlv3.objects.Add(new RSDKv3.Object(2, 0, 0, 0)); //Stage Setup Lvlv3.objects.Add(new RSDKv3.Object(3, 0, 0, 0)); //HUD Lvlv3.objects.Add(new RSDKv3.Object(5, 0, 0, 0)); //Death Event Lvlv3.objects.Add(new RSDKv3.Object(7, 0, 0, 0)); //Pause Menu Lvlv3.Write(exportPath); break; case 2: //v2 break; case 3: //vB Lvlv3 = new RSDKv3.Level(); Lvlv3.width = Lvlv4.width; Lvlv3.height = Lvlv4.height; Lvlv3.Title = Lvlv4.Title; Lvlv3.MapLayout = Lvlv4.MapLayout; Lvlv3.objects.Add(new RSDKv3.Object(1, 0, 64, 1893)); Lvlv3.objects.Add(new RSDKv3.Object(1, 0, 64, 0)); //Player Lvlv3.objects.Add(new RSDKv3.Object(2, 0, 0, 0)); //Stage Setup Lvlv3.objects.Add(new RSDKv3.Object(3, 0, 0, 0)); //HUD Lvlv3.objects.Add(new RSDKv3.Object(5, 0, 0, 0)); //Death Event Lvlv3.objects.Add(new RSDKv3.Object(7, 0, 0, 0)); //Pause Menu Lvlv3.Write(exportPath); break; case 4: //v5 break; default: break; } } if (NewVer == 4) { switch (loadedRSDKver) { case 0: //vRS break; case 1: //v1 break; case 2: //v2 RSDKv5.Scene scn = new RSDKv5.Scene("C:\\Program Files (x86)\\Steam\\steamapps\\common\\Sonic Mania\\Data\\Stages\\GHZ\\Scene1 - Copy.bin"); scn.Layers[0].Height = (ushort)(Lvlv3.height * 8); scn.Layers[0].Width = (ushort)(Lvlv3.width * 8); scn.Layers[0].Tiles = new ushort[Lvlv3.height * 8][]; for (ushort i = 0; i < Lvlv3.height * 8; i++) { scn.Layers[0].Tiles[i] = new ushort[(ushort)(Lvlv3.width * 8)]; for (int j = 0; j < (ushort)(Lvlv3.width * 8); ++j) { scn.Layers[0].Tiles[i][j] = 0xffff; /* the new ones with blanks*/ } } for (int h = 0; h < Lvlv3.height; h++) { for (int w = 0; w < Lvlv3.width; w++) { for (int y = 0; h < 128; y++) { for (int x = 0; w < 128; x++) { ushort tile; tile = 0xffff; } } //scn.MapLayout[h][w] = (ushort)(Lvlv3.MapLayout[h][w])); } } scn.Write("C:\\Program Files (x86)\\Steam\\steamapps\\common\\Sonic Mania\\Data\\Stages\\GHZ\\Scene1.bin"); break; case 3: //vB break; default: break; } } }
private void button1_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); if (dlg.ShowDialog(this) == DialogResult.OK) { string filepath = dlg.FileName; //RSDKv5.GameConfig gc = new RSDKv5.GameConfig(filepath); //RSDKv5.GameConfig gc = new RSDKv5.GameConfig("C:\\Program Files (x86)\\Steam\\steamapps\\common\\Sonic Mania\\Data\\Game\\GameConfig.bin"); //RSDKv5.GameConfig gc = new RSDKv5.GameConfig("C:\\Program Files (x86)\\Steam\\steamapps\\common\\Sonic Mania\\mods\\Sonic Mega Mania\\Data\\Game\\GameConfig.bin"); //RSDKvB.GameConfig gc = new RSDKvB.GameConfig("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Sonic 1 Source\\Data - Dev\\Game\\GameConfig.bin"); //gc.Write("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Sonic 1 Source\\Data\\Game\\GameConfig2.bin"); //RSDKv2.GameConfig gc = new RSDKv2.GameConfig(filepath); //gc.SetDevMenu(); //gc.Write("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Sonic CD Source\\Data\\Game\\GameConfig2.bin"); //RSDKv1.GameConfig gc = new RSDKv1.GameConfig("C:\\Users\\owner\\Downloads\\sonic-legends-master\\Data\\Game\\GameConfig.bin"); //RSDKv1.GameConfig gc = new RSDKv1.GameConfig("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Sonic Nexus Source\\Data\\Game\\GameConfig.bin"); //gc.Write("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Sonic Nexus Source\\Data\\Game\\GameConfig2.bin"); //RSDKvRS.Zoneconfig zc = new RSDKvRS.Zoneconfig("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Retro Sonic Source\\PC (2007)\\Data\\Levels\\EGZ\\Zone.zcf"); //zc.Write("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Retro Sonic Source\\PC (2007)\\Data\\Levels\\EGZ\\Zone2.zcf"); //RSDKv1.StageConfig sc = new RSDKv1.StageConfig("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Sonic Nexus Source\\Data\\Stages\\SSZ\\StageConfig.bin"); //sc.Write("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Sonic Nexus Source\\Stages\\SSZ\\StageConfigCopy.bin"); //RSDKv2.StageConfig sc = new RSDKv2.StageConfig("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Sonic CD Source\\Data\\Stages\\R11A\\StageConfig.bin"); //sc.Write("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Sonic CD Source\\Data\\Stages\\R11A\\StageConfigCopy.bin"); //RSDKvB.StageConfig sc = new RSDKvB.StageConfig("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Sonic 1 Source\\Data\\Stages\\Zone01\\StageConfig.bin"); //sc.Write("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Sonic 1 Source\\Data\\Stages\\Zone01\\StageConfigCopy.bin"); //RSDKvRS.Level lvl = new RSDKvRS.Level("C:\\Users\\owner\\Documents\\Fan Games\\Retro Sonic\\Data\\Levels\\CPZ\\Act1.map"); //lvl.Write("C:\\Users\\owner\\Documents\\Fan Games\\Retro Sonic\\Data\\Levels\\CPZ\\Act1copy.map"); //RSDKvRS.Level lvl = new RSDKvRS.Level("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Retro Sonic Source\\DATA\\LEVELS\\EHZ\\Act1.map"); //lvl.Write("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Retro Sonic Source\\DATA\\LEVELS\\EHZ\\Act1copy.map"); //RSDKvRS.BGLayout BGmap = new RSDKvRS.BGLayout("C:\\Users\\owner\\Documents\\Fan Games\\Retro Sonic\\Data\\Levels\\EHZ\\ZoneBG.map"); //BGmap.Write("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Retro Sonic Source\\Data\\Levels\\EHZ\\ZoneBG2.map"); //RSDKv2.BGLayout BGmap = new RSDKv2.BGLayout("C:\\Program Files (x86)\\Steam\\steamapps\\common\\Sonic CD\\mods\\Testing things\\Data\\Stages\\R31A\\Backgrounds.bin"); //BGmap.Write("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Sonic CD Source\\Data\\Stages\\R11A\\Backgrounds2.bin"); //RSDKvB.BGLayout BGmap = new RSDKvB.BGLayout("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Sonic 2 Source\\Data\\Stages\\Zone01\\Backgrounds.bin"); //BGmap.Write("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Sonic 2 Source\\Data\\Stages\\Zone01\\Backgrounds2.bin"); //RSDKvRS.til chunks = new RSDKvRS.til("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Retro Sonic Source\\Data\\Levels\\EHZ\\Zone.til"); //RSDKv1.Level lvl = new RSDKv1.Level("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Sonic Nexus Source\\Stages\\SSZ\\Act1.bin"); //RSDKv2.Level lvl = new RSDKv2.Level("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Sonic CD Source\\Data\\Stages\\R11A\\Act1.bin"); //lvl.Write("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Sonic CD Source\\Data\\Stages\\R11A\\Act1Copy.bin"); //RSDKvB.Level lvl = new RSDKvB.Level("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Sonic 1 Source\\Data\\Stages\\Zone01\\Act1.bin"); //RSDKv5.Scene lvl = new RSDKv5.Scene("C:\\Program Files (x86)\\Steam\\steamapps\\common\\Sonic Mania\\Data\\Stages\\GHZCutscene\\Scene1.bin"); //lvl.Write("C:\\Program Files (x86)\\Steam\\steamapps\\common\\Sonic Mania\\Data\\Stages\\GHZ\\Scene1b2.bin"); //RSDKvB.Tiles128x128 t128 = new RSDKvB.Tiles128x128("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Sonic 1 Source\\Data\\Stages\\Zone01\\128x128Tiles.bin"); //RSDKvRS.gfx img = new RSDKvRS.gfx("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Retro Sonic Source\\Levels\\EGZ\\Zone.gfx"); //RSDKvRS.tcf tc = new RSDKvRS.tcf("C:\\Users\\owner\\Documents\\Fan Games\\Retro Sonic Plus\\Data\\Levels\\CPZ\\ZoneOG.tcf", true); //for (int i = 0; i < 1024; i++) //{ //tc.Collision[i].PCunknown = 68; //} //tc.Write("C:\\Users\\owner\\Documents\\Fan Games\\Retro Sonic Plus\\Data\\Levels\\CPZ\\Zone.tcf", false); //cm.Write("C:\\Program Files (x86)\\Steam\\steamapps\\common\\Sonic CD\\mods\\Testing things\\Data\\Stages\\R12A\\CollisionMasks.bin"); //RSDKvB.CollisionMask cm = new RSDKvB.CollisionMask("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Sonic 1 Source\\(Source) Data\\Stages\\Zone01\\CollisionMasks.bin"); //RSDKv5.TilesConfig tc = new RSDKv5.TilesConfig("C:\\Program Files (x86)\\Steam\\steamapps\\common\\Sonic Mania\\Data\\Stages\\GHZ\\TileConfig.bin"); //RSDKvRS.mdf RetroStages = new RSDKvRS.mdf("C:\\Users\\owner\\Documents\\Fan Games\\Retro Sonic\\Data\\TitleScr\\Zones.mdf"); //RetroStages.Write("C:\\Users\\owner\\Documents\\Fan Games\\Retro Sonic\\Data\\TitleScr\\Zones2.mdf"); //CONFIGS //RSDKv5.GameConfig gameConfig = new RSDKv5.GameConfig(dlg.FileName); //RSDKv5.RSDKConfig RSDKConfig = new RSDKv5.RSDKConfig(dlg.FileName); //TIME ATTACK //RSDKv5.ReplayDB replayDB = new RSDKv5.ReplayDB(new RSDKv5.Reader(filepath)); //ANIMATIONS /*RSDKv5.Animation anim = new RSDKv5.Animation(new RSDKv5.Reader(dlg.FileName)); * * for (int i = 0; i < anim.Animations.Count; i++) * { * for (int ii = 0; ii < anim.Animations[i].Frames.Count; ii++) * { * anim.Animations[i].Frames[ii].X += 256; * } * } * anim.Write(new RSDKv5.Writer(dlg.FileName + "2"));*/ //Containers //RSDKv2.ArcContainer arc = new RSDKv2.ArcContainer(new RSDKv2.Reader(dlg.FileName)); //Videos //RSDKv1.Video rsv = new RSDKv1.Video(filepath); //RSDKv2.Video rsv = new RSDKv2.Video(filepath); //SCENES RSDKv5.Scene scene = new RSDKv5.Scene(filepath); //SAVES //RSDKv5.SaveFiles save = new RSDKv5.SaveFiles(new RSDKv5.Reader(filepath)); //save.EncoreBuddyChar = 1; //Scripts //RSDKv5.StaticObject Obj = new RSDKv5.StaticObject(new RSDKv5.Reader(filepath)); //RSDKvRS.Reader reader = new RSDKvRS.Reader(filepath); //RSDKvRS.Script rsf = new RSDKvRS.Script(reader); /*string destName = Path.GetFileNameWithoutExtension(filepath); * string destName2 = Path.GetFileName(filepath); * * string dirpath = filepath.Replace(destName2, ""); * DirectoryInfo dir = new DirectoryInfo(dirpath); * DirectoryInfo dir2 = new DirectoryInfo(dirpath + "//Scripts"); * dir2.Create(); * * foreach (FileInfo f in dir.GetFiles()) * { * destName = Path.GetFileNameWithoutExtension(f.FullName); * string destpath = dirpath + "//Scripts//" + destName + ".txt"; * reader = new RSDKvRS.Reader(f.FullName); * //try * //{ * //rsf = new RSDKvRS.Script(reader); * //rsf.Decompile(destpath); * ///} * //catch (Exception ex) * //{ * // Console.WriteLine(ex.Message); * // reader.Close(); * //} * }*/ //Models //RSDKv5.Model MDL = new RSDKv5.Model(filepath); //string tmp = filepath.Replace(Path.GetExtension(filepath), ""); //MDL.Write(new RSDKv5.Writer(tmp + "2.bin")); //MDL.WriteAsSTLBinary(new RSDKv5.Writer(tmp + ".stl")); //MDL.WriteAsOBJ(tmp + ".obj", Path.GetFileName(tmp) + ".mtl"); //MDL.WriteMTL(new RSDKv5.Writer(tmp + ".mtl")); //RSDKvB.Model MDL = new RSDKvB.Model(filepath); //Text/Font stuff //RSDKvB.BitmapFont BMF = new RSDKvB.BitmapFont(new StreamReader(File.OpenRead(filepath))); //RSDKvB.StringList Strings = new RSDKvB.StringList(new StreamReader(File.OpenRead(filepath))); //Strings.Write(new StreamWriter(File.OpenWrite(filepath + "2"))); //Console.WriteLine(); /* Palettes * RSDKvB.Palette p = new RSDKvB.Palette(); * RSDKvB.Reader r = new RSDKvB.Reader(File.Open("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Sonic 1 Source\\Data\\Palettes\\SYZ_PalCycle.act", FileMode.Open)); * p.Read(r); * RSDKvB.Writer w = new RSDKvB.Writer(File.Open("C:\\Users\\owner\\Documents\\Sonic Hacking Stuff\\Retro Engine Tools\\Sonic 1 Source\\Data\\Palettes\\SYZ_PalCycle2.act", FileMode.Create)); * p.Write(w);*/ //RSDKv2.StringSet ss = new RSDKv2.StringSet(new RSDKv2.Reader(filepath)); //ushort c = 2 * (160 >> 3) | ((ushort)(192 >> 3) << 11) | 1 | ((ushort)(224 >> 3) << 6); //ushort c = 2 * (224 >> 3) | ((ushort)(192 >> 3) << 11) | 1 | ((ushort)(160 >> 3) << 6); //ushort c = ((ushort)(R >> 3) << 11) | ((ushort)(G >> 3) << 6) | 2 * (B >> 3); //ushort c = ((ushort)(160 >> 3) << 11) | ((ushort)(192 >> 3) << 6) | 2 * (224 >> 3); //Console.WriteLine(c); /*int r = 0x20; * int g = 0x20; * int b = 0x80; * * ushort paltest = (ushort)(((ushort)(r >> 3) << 11) | ((ushort)(g >> 3) << 6) | 1 | 2 * (b >> 3)); * Console.WriteLine(paltest);*/ /*StreamReader reader = new StreamReader(File.OpenRead(filepath)); * string data = reader.ReadToEnd(); * reader.Close(); * StreamWriter writer = new StreamWriter(File.OpenWrite(filepath)); * for (int i = 0; i < data.Length; i++) * { * if (data[i] == 0x2E) * { * writer.WriteLine(); * } * else * { * writer.Write(data[i]); * } * } * //writer.Write(data); * writer.Close();*/ //MATH //MANIA HEADER CHECKER BinaryReader reader = new BinaryReader(File.OpenRead(filepath)); int value = reader.ReadInt32(); Console.WriteLine(Path.GetFileNameWithoutExtension(filepath) + ": " + value); reader.Close(); #region Exe Scanning /* * StreamReader reader = new StreamReader(File.OpenRead(dlg.FileName)); * * List<string> DataNames = new List<string>(); * * //string buffer = reader.ReadToEnd(); * * string buffer = ""; * * bool isChar(char a) * { * * if (a == 'a' || a == 'A') * { * return true; * } * * if (a == 'b' || a == 'B') * { * return true; * } * * if (a == 'c' || a == 'C') * { * return true; * } * * if (a == 'd' || a == 'D') * { * return true; * } * * if (a == 'e' || a == 'E') * { * return true; * } * * if (a == 'f' || a == 'F') * { * return true; * } * * if (a == 'g' || a == 'G') * { * return true; * } * * if (a == 'h' || a == 'H') * { * return true; * } * * if (a == 'i' || a == 'I') * { * return true; * } * * if (a == 'j' || a == 'J') * { * return true; * } * * if (a == 'k' || a == 'K') * { * return true; * } * * if (a == 'l' || a == 'L') * { * return true; * } * * if (a == 'm' || a == 'M') * { * return true; * } * * if (a == 'n' || a == 'N') * { * return true; * } * * if (a == 'o' || a == 'O') * { * return true; * } * * if (a == 'p' || a == 'P') * { * return true; * } * * if (a == 'q' || a == 'Q') * { * return true; * } * * if (a == 'r' || a == 'R') * { * return true; * } * * if (a == 's' || a == 'S') * { * return true; * } * * if (a == 't' || a == 'T') * { * return true; * } * * if (a == 'u' || a == 'U') * { * return true; * } * * if (a == 'v' || a == 'V') * { * return true; * } * * if (a == 'w' || a == 'W') * { * return true; * } * * if (a == 'x' || a == 'X') * { * return true; * } * * if (a == 'y' || a == 'Y') * { * return true; * } * * if (a == 'z' || a == 'Z') * { * return true; * } * * if (a == '/' || a == '\\') * { * return true; * } * * if (a == '.') * { * return true; * } * * return false; * } * * * while (!reader.EndOfStream) * { * char d = (char)reader.Read(); * if (d == 'd' || d == 'D') * { * char a1 = (char)reader.Read(); * if (a1 == 'a' || a1 == 'A') * { * char t = (char)reader.Read(); * if (t == 't' || t == 'T') * { * char a2 = (char)reader.Read(); * if (a2 == 'a' || a2 == 'A') * { * char sl = (char)reader.Read(); * if (sl == '/' || sl == '/') * { * buffer = buffer + "Data/"; * * char c; * * while (reader.Peek() != (char)0) * { * c = (char)reader.Read(); * buffer = buffer + c; * } * DataNames.Add(buffer); * } * } * } * } * } * * } * * StreamWriter writer = new StreamWriter(File.OpenWrite("Paths.txt")); * * for (int i = 0; i < DataNames.Count; i++) * { * writer.Write(DataNames[i] + Environment.NewLine); * } */ #endregion } }