private void CopyDir(string source, string target) { GmacOut.AppendText("Copying Directory: \"" + source + "\" -> \"" + target + "\"\r\n"); if (!Directory.Exists(target)) { Directory.CreateDirectory(target); } string[] sysEntries = Directory.GetFileSystemEntries(source); foreach (string sysEntry in sysEntries) { string fileName = Path.GetFileName(sysEntry); string targetPath = Path.Combine(target, fileName); if (Directory.Exists(sysEntry)) { CopyDir(sysEntry, targetPath); } else { GmacOut.AppendText("Copying \"" + fileName + "\" -> \"" + targetPath + "\"\r\n"); File.Copy(sysEntry, targetPath, true); } } }
void gmacError(object sender, DataReceivedEventArgs e) { this.BeginInvoke(new MethodInvoker(() => { stderr += e.Data + "\n"; GmacOut.AppendText(e.Data + "\n"); })); }
void gmacWrite(object sender, DataReceivedEventArgs e) { Trace.WriteLine(e.Data); this.BeginInvoke(new MethodInvoker(() => { GmacOut.AppendText(e.Data + "\n"); })); }
void gmacWrite(object sender, DataReceivedEventArgs e) { this.BeginInvoke(new MethodInvoker(() => { if (e.Data != null) { if (e.Data.ToString().ToLower().Contains("error")) { stderr += e.Data + "\n"; } } GmacOut.AppendText(e.Data + "\n"); })); }
private void Make8Bit(string Src, string Dst) { GmacOut.AppendText("Making " + Src + " 8 bit color depth!"); Bitmap orig = new Bitmap(Src); if ((orig.PixelFormat != PixelFormat.Format8bppIndexed) || (!CheckSetting("IndexedColor"))) { Bitmap clone = orig.Clone(new Rectangle(0, 0, orig.Width, orig.Height), PixelFormat.Format8bppIndexed); clone.Save(@Dst); clone.Dispose(); GmacOut.AppendText(" Done!\n"); } else { GmacOut.AppendText(" No need!\n"); File.Copy(Src, Dst); } orig.Dispose(); }
private void Make24Bit(string Src, string Dst) { GmacOut.AppendText("Making " + Src + " 24 bit color depth!"); Bitmap orig = new Bitmap(Src); if ((orig.PixelFormat != PixelFormat.Format24bppRgb)) { Bitmap clone = orig.Clone(new Rectangle(0, 0, orig.Width, orig.Height), PixelFormat.Format24bppRgb); clone.Save(@Dst); clone.Dispose(); GmacOut.AppendText(" Done!\n"); } else { GmacOut.AppendText(" No need!\n"); File.Copy(Src, Dst); } orig.Dispose(); }
private void Logo_DoubleClick(object sender, EventArgs e) { try { string appdata = Environment.GetEnvironmentVariable("appdata"); if (!File.ReadAllText(appdata + "\\GameMaker-Studio\\fnames").Contains("// PlayStation Vita specific")) { DialogResult MSG = MessageBox.Show("Do you want to install PSVita Specific functions into\nGameMaker:Studio?", "Install vita functions?", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (MSG == DialogResult.Yes) { GmacOut.AppendText("Adding vita functions to (global) fnames file...\n"); File.AppendAllText(appdata + "\\GameMaker-Studio\\fnames", Resources.fnames); MessageBox.Show("PSVita Specific functions have been added to:\n%appdata%\\GameMaker-Studio\\fnames", "Installed", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("PSVita Specific functions allready installed!", "Installed Allready", MessageBoxButtons.OK, MessageBoxIcon.Error); } } finally{} }
private void CreateVPK_Click(object sender, EventArgs e) { string tempdir = ""; SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.Filter = "Vita Packages|*.VPK"; saveFileDialog1.Title = "Save VPK File"; if (YYCEnabled.Checked) { string SDKPath = ReadSetting("SDKPath"); string VCVars = ReadSetting("VCVarsPath"); if (SDKPath == "invalid") { MessageBox.Show("SDK Not Defined!", "SDK Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Prefs_Click(null, null); return; } if (VCVars == "invalid") { MessageBox.Show("vcvars32.bat Not Defined!", "VCVars Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Prefs_Click(null, null); return; } if (!Directory.Exists(SDKPath)) { MessageBox.Show("SDK Directory: " + SDKPath + " Doesnt exist!", "SDK Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Prefs_Click(null, null); return; } if (!File.Exists(VCVars)) { MessageBox.Show("Directory: " + VCVars + " Doesnt exist!", "VCVars Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Prefs_Click(null, null); return; } if (saveFileDialog1.ShowDialog() == DialogResult.OK) { string GMVer = GMVersion.SelectedItem.ToString(); tempdir = Path.GetDirectoryName(saveFileDialog1.FileName) + "\\_temp"; if (Directory.Exists(tempdir)) { GmacOut.AppendText("Deleting _temp\n"); Directory.Delete(tempdir, true); } Directory.CreateDirectory(tempdir); if (GMVer == "1.4.9999") { CopyDir(@"Runner", tempdir); } else { CopyDir("versions\\" + GMVer + "\\Runner", tempdir); } Make8Bit(IconPath.Text, tempdir + "\\sce_sys\\icon0.png"); Make8Bit(PicPath.Text, tempdir + "\\sce_sys\\pic0.png"); Make8Bit(BgPath.Text, tempdir + "\\sce_sys\\livearea\\contents\\bg0.png"); Make8Bit(GatePath.Text, tempdir + "\\sce_sys\\livearea\\contents\\startup.png"); if (!CompileProject(ProjectPath.Text, tempdir + "\\games", true)) { Directory.Delete(tempdir, true); CreateVPK.Enabled = true; return; } Regex rgx = new Regex("[^a-zA-Z0-9-]"); string AppNameSln = rgx.Replace(AppName.Text, "_"); string ProjectName = Path.GetFileNameWithoutExtension(Path.GetFileNameWithoutExtension(ProjectPath.Text)); string args = "/c \"\"" + ReadSetting("VCVarsPath") + "\" && " + Path.GetPathRoot(tempdir).Replace("\\", "") + " && cd \"" + tempdir + "\\YYCCache\\" + ProjectName + "\\Default\\Scripts\\PSVitaSolution\" && msbuild /m:%NUMBER_OF_PROCESSORS% \"" + AppNameSln + ".sln\" /p:Configuration=Release /t:build /verbosity:minimal\""; GmacOut.AppendText("cmd.exe " + args); Process cmd = new Process(); cmd.StartInfo.FileName = "cmd.exe"; cmd.StartInfo.Arguments = args; cmd.StartInfo.UseShellExecute = false; cmd.StartInfo.CreateNoWindow = true; cmd.StartInfo.RedirectStandardOutput = true; cmd.StartInfo.RedirectStandardError = true; cmd.ErrorDataReceived += new DataReceivedEventHandler(gmacError); cmd.OutputDataReceived += new DataReceivedEventHandler(gmacWrite); cmd.Start(); cmd.BeginOutputReadLine(); cmd.BeginErrorReadLine(); while (!cmd.HasExited) { Application.DoEvents(); } if (cmd.ExitCode != 0) { try { cmd.CancelErrorRead(); cmd.CancelOutputRead(); } catch (Exception) { }; MessageBox.Show("Compilation Error: " + cmd.ExitCode + "\n\n" + stderr, "Compile Error", MessageBoxButtons.OK, MessageBoxIcon.Error); stderr = ""; Directory.Delete(tempdir, true); CreateVPK.Enabled = true; return; } cmd.Dispose(); GmacOut.AppendText("Locating SELF\n"); foreach (string fn in Directory.GetFiles(tempdir + "\\YYCCache\\" + ProjectName + "\\Default\\Scripts\\PSVitaSolution\\PSVita_Release")) { if (Path.GetExtension(fn) == ".self") { GmacOut.AppendText("Moving " + fn + " to " + tempdir + "\\eboot.bin\n"); File.Delete(tempdir + "\\eboot.bin"); File.Move(fn, tempdir + "\\eboot.bin"); break; } } Directory.Delete(tempdir + "\\YYCCache", true); } else { CreateVPK.Enabled = true; return; } } else { CreateVPK.Enabled = false; HasShaders = File.ReadAllText(ProjectPath.Text).Contains("</shaders>"); //Too lazy to parse XML properly. if (HasShaders) { if (!Directory.Exists(@"psvitasdk")) { DialogResult msgResult = MessageBox.Show("It's been detected that you are using Shaders in your GM Project\nHowever no copy of the Vita Shader Compiler (psp2cgc.exe) was found.\nBrowse to psp2cgc.exe?", "Shader Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (msgResult == DialogResult.Yes) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "psp2cgc.exe|psp2cgc.exe"; openFileDialog.Title = "Browse to Vita Shader Compiler."; if (openFileDialog.ShowDialog() == DialogResult.OK) { if (!Directory.Exists(@"psvitasdk")) { GmacOut.AppendText("Creating PSP2SDK Directory Structure"); Directory.CreateDirectory("psvitasdk"); Directory.CreateDirectory("psvitasdk/host_tools"); Directory.CreateDirectory("psvitasdk/host_tools/bin"); } File.Copy(openFileDialog.FileName, @"psvitasdk/host_tools/bin/psp2cgc.exe"); } else { CreateVPK.Enabled = true; return; } } else { CreateVPK.Enabled = true; return; } } } if (saveFileDialog1.ShowDialog() == DialogResult.OK) { string GMVer = GMVersion.SelectedItem.ToString(); tempdir = Path.GetDirectoryName(saveFileDialog1.FileName) + "\\_temp"; if (Directory.Exists(tempdir)) { Directory.Delete(tempdir, true); } Directory.CreateDirectory(tempdir); if (GMVer == "1.4.9999") { CopyDir(@"Runner", tempdir); } else { CopyDir("versions\\" + GMVer + "\\Runner", tempdir); } Make8Bit(IconPath.Text, tempdir + "\\sce_sys\\icon0.png"); Make8Bit(PicPath.Text, tempdir + "\\sce_sys\\pic0.png"); Make8Bit(BgPath.Text, tempdir + "\\sce_sys\\livearea\\contents\\bg0.png"); Make8Bit(GatePath.Text, tempdir + "\\sce_sys\\livearea\\contents\\startup.png"); if (!CompileProject(ProjectPath.Text, tempdir + "\\games")) { Directory.Delete(tempdir, true); CreateVPK.Enabled = true; return; } } else { CreateVPK.Enabled = true; return; } } FileStream fd = File.Open(tempdir + "\\sce_sys\\param.sfo", FileMode.OpenOrCreate, FileAccess.ReadWrite); GmacOut.AppendText("Writing " + AppName.Text + " to TITLE of param.sfo\n"); fd.Seek(0x2C8, SeekOrigin.Begin); foreach (Byte by in ASCIIEncoding.ASCII.GetBytes(AppName.Text)) { fd.WriteByte(by); } fd.Seek(0x2FC, SeekOrigin.Begin); foreach (Byte by in ASCIIEncoding.ASCII.GetBytes(AppName.Text)) { fd.WriteByte(by); } if (GdbCategory.Checked) { GmacOut.AppendText("Writing gdb to CATEGORY of param.sfo\n"); fd.Seek(0x266, SeekOrigin.Begin); fd.WriteByte(0x62); //ASCII 'b' } GmacOut.AppendText("Writing " + TitleIdBox.Text + " to TITLE_ID of param.sfo\n"); fd.Seek(0x37C, SeekOrigin.Begin); foreach (Byte by in ASCIIEncoding.ASCII.GetBytes(TitleIdBox.Text)) { fd.WriteByte(by); } GmacOut.AppendText("Writing " + (DownloadMoreRAM.SelectedIndex * 4).ToString() + " to ATTRIBUTE2 of param.sfo!\n"); fd.Seek(0x23C, SeekOrigin.Begin); fd.WriteByte(Convert.ToByte(DownloadMoreRAM.SelectedIndex * 4)); fd.Close(); if (LeftGate.Checked) { GmacOut.AppendText("Writing #LeftGate template.xml\n"); File.WriteAllText(tempdir + "\\sce_sys\\livearea\\contents\\template.xml", Properties.Resources.gdbTemplate); } GmacOut.AppendText("Creating VPK ..."); if (File.Exists(saveFileDialog1.FileName)) //Fix Issue #1 { File.Delete(saveFileDialog1.FileName); } ZipFile.CreateFromDirectory(tempdir, saveFileDialog1.FileName); GmacOut.AppendText("OK\n"); GmacOut.AppendText("Deleting " + tempdir + " ..."); Directory.Delete(tempdir, true); GmacOut.AppendText("OK!\n"); GmacOut.AppendText("Done!\n"); CreateVPK.Enabled = true; MessageBox.Show("VPK Created!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private bool CompileProject(string Src, string Dst, bool YYC = false) { string GMVer = GMVersion.SelectedItem.ToString(); XmlDocument DefaultConfig = new XmlDocument(); DefaultConfig.Load(Path.GetDirectoryName(ProjectPath.Text) + "\\Configs\\Default.config.gmx"); XmlNode TP = DefaultConfig.GetElementsByTagName("option_psvita_texture_page")[0]; // Issue #5 Fixed! XmlNode SH = DefaultConfig.GetElementsByTagName("option_shortcircuit")[0]; String versionBit = GMVer.Split('.')[2]; string args; if (HasShaders && !YYC) { args = "/c /m=psvita /config=\"Default\" /tgt=2147483648 /obob=True /obpp=False /obru=True /obes=False /i=3 /cvm /tp=" + TP.InnerText + " /mv=1 /iv=0 /rv=0 /bv=" + versionBit + " /sh=" + SH.InnerText + " / psvitasdk=\"" + Directory.GetCurrentDirectory() + "\\psvitasdk\" /gn=\"" + AppName.Text + "\" /o=\"" + Dst + "\" \"" + Src + "\""; } else { args = "/c /m=psvita /config=\"Default\" /tgt=2147483648 /obob=True /obpp=False /obru=True /obes=False /i=3 /cvm /tp=" + TP.InnerText + " /mv=1 /iv=0 /rv=0 /bv=" + versionBit + " /sh=" + SH.InnerText + " / gn=\"" + AppName.Text + "\" /o=\"" + Dst + "\" \"" + Src + "\""; } if (YYC) { string YYCDIR = ""; if (GMVer == "1.4.9999") { YYCDIR = Directory.GetCurrentDirectory() + "\\YYC"; } else { YYCDIR = Directory.GetCurrentDirectory() + "\\versions\\" + GMVer + "\\YYC"; } if (!Directory.Exists(YYCDIR)) { MessageBox.Show("YYC Files NOT downloaded for Version " + GMVer + " Please re-download it in Version Manager."); this.Enabled = false; versionManager VM = new versionManager(); VM.ShowDialog(); return(false); } args = "/c /m=llvm-psvita /llvmSource=\"" + YYCDIR + "\" /config=\"Default\" /tgt=2147483648 /obob=True /obpp=False /obru=True /obes=False /i=3 /j=4 /tp=" + TP.InnerText + " /psvitasdk=\"" + ReadSetting("SDKPath") + "\" /mv=1 /iv=0 /rv=0 /bv=" + versionBit + " /gn=\"" + AppName.Text + "\" /cd=\"" + Path.GetDirectoryName(Dst) + "/YYCCache\" /o=\"" + Dst + "\" \"" + Src + "\" "; } GmacOut.AppendText("-- GMASSETCOMPILER BEGIN --\n"); GmacOut.AppendText("GMAssetCompiler.exe " + args + "\n"); Process gmac = new Process(); if (GMVer == "1.4.9999") { gmac.StartInfo.FileName = AppDomain.CurrentDomain.BaseDirectory + "GMAssetCompiler.exe"; gmac.StartInfo.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory; } else { gmac.StartInfo.FileName = AppDomain.CurrentDomain.BaseDirectory + "versions\\" + GMVer + "\\GMAssetCompiler.exe"; gmac.StartInfo.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory + "versions\\" + GMVer; } gmac.StartInfo.Arguments = args; gmac.StartInfo.UseShellExecute = false; gmac.StartInfo.CreateNoWindow = true; gmac.StartInfo.RedirectStandardOutput = true; gmac.StartInfo.RedirectStandardError = true; gmac.ErrorDataReceived += new DataReceivedEventHandler(gmacError); gmac.OutputDataReceived += new DataReceivedEventHandler(gmacWrite); GMAC.GetPermissionToExecute(); //Resolve issue #7 gmac.Start(); gmac.BeginOutputReadLine(); gmac.BeginErrorReadLine(); while (!gmac.HasExited) { Application.DoEvents(); } if (gmac.ExitCode != 0) { MessageBox.Show("GMAssetCompiler.exe Returned Error Code: " + gmac.ExitCode.ToString() + "\n\n" + stderr, "GMAC Error", MessageBoxButtons.OK, MessageBoxIcon.Error); stderr = ""; Directory.Delete(Dst, true); return(false); } gmac.Dispose(); GmacOut.AppendText("-- GMASSETCOMPILER FINISHED! --\n"); GmacOut.AppendText("Renaming to game.win..."); foreach (String file in Directory.GetFiles(Dst)) { if (file.EndsWith(".win")) { File.Move(file, Dst + "\\game.win"); } if (file.EndsWith(".yydebug")) { File.Delete(file); } } GmacOut.AppendText("OK!\n"); return(true); }
private void CreatePKG_Click(object sender, EventArgs e) { string GMVer = VersionSelect.SelectedItem.ToString(); if (Path.GetExtension(projectPath.Text).ToLower() == ".yyp" && GMVer.StartsWith("1.")) { MessageBox.Show("Cannot build GMS2 Project using GMS1.4", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else if (Path.GetExtension(projectPath.Text).ToLower() == ".gmx" && GMVer.StartsWith("2.")) { MessageBox.Show("Cannot build GMS1.4 Project using GMS2", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string tempdir = ""; SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.Filter = "PS4 Packages|*.PKG"; saveFileDialog1.Title = "Save PKG File"; saveFileDialog1.FileName = contentID.Text; CreatePKG.Enabled = false; if (GMVer.StartsWith("1.")) { HasShaders = File.ReadAllText(projectPath.Text).Contains("</shaders>"); //Too lazy to parse XML properly. } else if (GMVer.StartsWith("2.")) { HasShaders = File.ReadAllText(projectPath.Text).Contains("GMShader"); //Too lazy to parse XML properly. } if (HasShaders) { if (!Directory.Exists(@"ps4sdk")) { DialogResult msgResult = MessageBox.Show("It's been detected that you are using Shaders in your GM Project\nHowever no copy of the PS4 Shader Compiler (orbis-wave-psslc.exe) was found.\nBrowse to orbis-wave-psslc.exe?", "Shader Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (msgResult == DialogResult.Yes) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "orbis-wave-psslc.exe|orbis-wave-psslc.exe"; openFileDialog.Title = "Browse to PS4 Shader Compiler."; if (openFileDialog.ShowDialog() == DialogResult.OK) { if (!Directory.Exists(@"ps4sdk")) { GmacOut.AppendText("Creating PS4SDK Directory Structure\n"); Directory.CreateDirectory("ps4sdk"); Directory.CreateDirectory("ps4sdk/host_tools"); Directory.CreateDirectory("ps4sdk/host_tools/bin"); } File.Copy(openFileDialog.FileName, @"ps4sdk/host_tools/bin/orbis-wave-psslc.exe"); } else { CreatePKG.Enabled = true; return; } } else { CreatePKG.Enabled = true; return; } } } if (saveFileDialog1.ShowDialog() == DialogResult.OK) { tempdir = Path.GetDirectoryName(saveFileDialog1.FileName) + "\\_temp"; if (Directory.Exists(tempdir)) { Directory.Delete(tempdir, true); } Directory.CreateDirectory(tempdir); if (GMVer == "1.4.9999") { CopyDir(@"Runner", tempdir); } else { CopyDir("versions\\" + GMVer + "\\Runner", tempdir); } Make24Bit(iconPath.Text, tempdir + "\\sce_sys\\icon0.png"); Make24Bit(picPath.Text, tempdir + "\\sce_sys\\pic1.png"); if (!CompileProject(projectPath.Text, tempdir + "\\games")) { Directory.Delete(tempdir, true); CreatePKG.Enabled = true; return; } } else { CreatePKG.Enabled = true; return; } FileStream fd = File.Open(tempdir + "\\sce_sys\\param.sfo", FileMode.OpenOrCreate, FileAccess.ReadWrite); GmacOut.AppendText("Writing " + titleName.Text + " to TITLE of param.sfo\n"); fd.Seek(0x350, SeekOrigin.Begin); foreach (Byte by in ASCIIEncoding.ASCII.GetBytes(titleName.Text)) { fd.WriteByte(by); } GmacOut.AppendText("Writing " + titleID.Text + " to TITLE_ID of param.sfo\n"); fd.Seek(0x3D0, SeekOrigin.Begin); foreach (Byte by in ASCIIEncoding.ASCII.GetBytes(titleID.Text)) { fd.WriteByte(by); } GmacOut.AppendText("Writing " + contentID.Text + " to CONTENT_ID of param.sfo!\n"); fd.Seek(0x284, SeekOrigin.Begin); foreach (Byte by in ASCIIEncoding.ASCII.GetBytes(contentID.Text)) { fd.WriteByte(by); } fd.Close(); GmacOut.AppendText("Creating GP4 ..."); Gp4Project proj = Gp4Project.Create(VolumeType.pkg_ps4_app); Dir root = null; foreach (var file in Directory.GetFileSystemEntries(tempdir)) { if (File.Exists(file)) { AddFile(proj, "", file); } else if (Directory.Exists(file)) { AddFileTree(proj, root, file); } } proj.volume.Package.ContentId = contentID.Text; proj.volume.Package.Passcode = "00000000000000000000000000000000"; GmacOut.AppendText("OK!\n"); if (File.Exists(saveFileDialog1.FileName)) { File.Delete(saveFileDialog1.FileName); } GmacOut.AppendText("Building PKG ..."); Thread thr = new Thread(() => { PkgBuilder pkg = new PkgBuilder(PkgProperties.FromGp4(proj, "")); pkg.Write(saveFileDialog1.FileName); }); thr.Start(); while (thr.IsAlive) { Application.DoEvents(); } GmacOut.AppendText("OK!\n"); GmacOut.AppendText("Deleting " + tempdir + " ..."); Directory.Delete(tempdir, true); GmacOut.AppendText("OK!\n"); GmacOut.AppendText("Done!\n"); CreatePKG.Enabled = true; MessageBox.Show("PKG Created!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private bool CompileProject(string Src, string Dst) { string GMVer = VersionSelect.SelectedItem.ToString(); String TexturePageSize = "1028"; String SHEnabled = "False"; if (GMVer.StartsWith("1.")) { XmlDocument DefaultConfig = new XmlDocument(); DefaultConfig.Load(Path.GetDirectoryName(projectPath.Text) + "\\Configs\\Default.config.gmx"); TexturePageSize = DefaultConfig.GetElementsByTagName("option_ps4_texture_page")[0].InnerText; SHEnabled = DefaultConfig.GetElementsByTagName("option_shortcircuit")[0].InnerText; } string versionBit = GMVer.Split('.')[2]; if (GMVer.StartsWith("2.")) { GmacOut.AppendText("Creating license.plist...\n"); String LicenseFile = GMLicense.LicenseFormat.CreateLicense("ps4", GMLicense.Keys.GetPrivateKey()); if (!Directory.Exists(Dst + "\\GameMakerLicense")) { Directory.CreateDirectory(Dst + "\\GameMakerLicense"); } File.WriteAllText(Dst + "\\GameMakerLicense\\licence.plist", LicenseFile); GmacOut.AppendText("Written license file to: " + Dst + "\\GameMakerLicense\\license.plist\n"); } string args; if (HasShaders && GMVer.StartsWith("1.")) { args = "/c /m=ps4 /config=\"Default\" /tgt=4294967296 /obob=True /obpp=False /obru=True /obes=False /i=3 /j=4 /cvm /tp=" + TexturePageSize + " /mv=1 /iv=0 /rv=0 /bv=" + versionBit + " /sh=" + SHEnabled + " / ps4sdk=\"" + Directory.GetCurrentDirectory() + "\\ps4sdk\" /gn=\"" + titleName.Text + "\" /o=\"" + Dst + "\" \"" + Src + "\""; } else if (GMVer.StartsWith("1.")) { args = "/c /m=ps4 /config=\"Default\" /tgt=4294967296 /obob=True /obpp=False /obru=True /obes=False /i=3 /j=4 /cvm /tp=" + TexturePageSize + " /mv=1 /iv=0 /rv=0 /bv=" + versionBit + " /sh=" + SHEnabled + " /gn=\"" + titleName.Text + "\" /o=\"" + Dst + "\" \"" + Src + "\""; } else if (HasShaders && GMVer.StartsWith("2.")) { args = "/c /zpex /zpuf=\"" + Dst + "\\GameMakerLicense\" /baseproject=\"" + Directory.GetCurrentDirectory() + "\\versions\\" + GMVer + "\\BaseProject\\BaseProject.yyp\" /m=PS4 /config=\"default\" /tgt=4294967296 /obob=True /obpp=False /obru=True /obes=False /i=3 /j=4 /cvm /mv=1 /iv=0 /rv=0 /bv=0 /sh=False /ps4sdk=\"" + Directory.GetCurrentDirectory() + "\\ps4sdk\" /gn=\"" + titleName.Text + "\" /o=\"" + Dst + "\" \"" + Src + "\""; } else { args = "/c /zpex /zpuf=\"" + Dst + "\\GameMakerLicense\" /baseproject=\"" + Directory.GetCurrentDirectory() + "\\versions\\" + GMVer + "\\BaseProject\\BaseProject.yyp\" /m=PS4 /config=\"default\" /tgt=4294967296 /obob=True /obpp=False /obru=True /obes=False /i=3 /j=4 /cvm /mv=1 /iv=0 /rv=0 /bv=0 /sh=False /gn=\"" + titleName.Text + "\" /o=\"" + Dst + "\" \"" + Src + "\""; } GmacOut.AppendText("-- GMASSETCOMPILER BEGIN --\n"); GmacOut.AppendText("GMAssetCompiler.exe " + args + "\n"); Process gmac = new Process(); if (GMVer == "1.4.9999") { gmac.StartInfo.FileName = "GMAssetCompiler.exe"; } else { gmac.StartInfo.FileName = "versions\\" + GMVer + "\\GMAssetCompiler.exe"; gmac.StartInfo.WorkingDirectory = "versions\\" + GMVer; } gmac.StartInfo.Arguments = args; gmac.StartInfo.UseShellExecute = false; gmac.StartInfo.CreateNoWindow = true; gmac.StartInfo.RedirectStandardOutput = true; gmac.StartInfo.RedirectStandardError = true; gmac.ErrorDataReceived += new DataReceivedEventHandler(gmacWrite); gmac.OutputDataReceived += new DataReceivedEventHandler(gmacWrite); GMAC.GetPermissionToExecute(); gmac.Start(); gmac.BeginOutputReadLine(); gmac.BeginErrorReadLine(); while (!gmac.HasExited) { Application.DoEvents(); } if (gmac.ExitCode != 0) { MessageBox.Show("GMAssetCompiler.exe Error Code: " + gmac.ExitCode.ToString(), "GMAC Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Directory.Delete(Dst, true); return(false); } gmac.Dispose(); GmacOut.AppendText("-- GMASSETCOMPILER FINISHED! --\n"); if (GMVer.StartsWith("2.")) { GmacOut.AppendText("Removing license.plist..."); File.Delete(Dst + "\\GameMakerLicense\\license.plist"); Directory.Delete(Dst + "\\GameMakerLicense", true); GmacOut.AppendText("OK!\n"); } GmacOut.AppendText("Renaming to game.win..."); foreach (String file in Directory.GetFiles(Dst)) { if (file.EndsWith(".win")) { File.Move(file, Dst + "\\game.win"); } if (file.EndsWith(".yydebug")) { File.Delete(file); } } GmacOut.AppendText("OK!\n"); return(true); }