Skip to content

Commit 573784c

Browse files
authored
Merge pull request #44 from gusmanb/features/graphics_rework
Features/graphics rework
2 parents b886d80 + 7c74ddf commit 573784c

1 file changed

Lines changed: 25 additions & 5 deletions

File tree

ZXBStudio/BuildSystem/ZXProjectBuilder.cs

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public class ZXProjectBuilder
6666
OutputLogWritter.WriteLine("Project path: " + project.ProjectPath);
6767
OutputLogWritter.WriteLine("Building program " + mainFile);
6868
OutputLogWritter.WriteLine("Building starts at " + startTime);
69-
69+
7070
var proc = Process.Start(new ProcessStartInfo(Path.GetFullPath(ZXOptions.Current.ZxbcPath), $"\"{mainFile}\" " + args) { WorkingDirectory = project.ProjectPath, RedirectStandardError = true, CreateNoWindow = true });
7171

7272
string logOutput;
@@ -131,6 +131,7 @@ private static bool BuildNexFile(byte[] binary, ZXBuildSettings settings, ZXProj
131131

132132
// Create .bin file
133133
{
134+
outputLogWritter.WriteLine("Creating .bin file...");
134135
binFile = Path.Combine(project.ProjectPath, Path.GetFileNameWithoutExtension(settings.MainFile) + ".bin");
135136
if (File.Exists(binFile))
136137
{
@@ -161,9 +162,9 @@ private static bool BuildNexFile(byte[] binary, ZXBuildSettings settings, ZXProj
161162
// Main file
162163
{
163164
int[] nextBank16K = { 255, 5, 2, 0 };
164-
int bank = org/16384;
165-
int offset = org-(bank * 16384);
166-
if(bank<0 || bank > 3)
165+
int bank = org / 16384;
166+
int offset = org - (bank * 16384);
167+
if (bank < 0 || bank > 3)
167168
{
168169
outputLogWritter.WriteLine("Error: Invalid ORG direction, must be >0 and <65535");
169170
return false;
@@ -210,7 +211,8 @@ private static bool BuildNexFile(byte[] binary, ZXBuildSettings settings, ZXProj
210211
Process process = new Process();
211212
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
212213
{
213-
process.StartInfo.FileName = "python";
214+
CheckNextCreator();
215+
process.StartInfo.FileName = Path.Combine(Path.GetDirectoryName(ZXOptions.Current.ZxbcPath), "python", "python.exe");
214216
process.StartInfo.Arguments = string.Format("{0} nex.cfg {1}",
215217
Path.Combine(Path.GetDirectoryName(ZXOptions.Current.ZxbcPath), "tools", "nextcreator.py"),
216218
Path.GetFileNameWithoutExtension(settings.MainFile) + ".nex");
@@ -228,12 +230,17 @@ private static bool BuildNexFile(byte[] binary, ZXBuildSettings settings, ZXProj
228230
process.StartInfo.CreateNoWindow = true;
229231
process.StartInfo.RedirectStandardOutput = true;
230232
}
233+
outputLogWritter.WriteLine(string.Format("{0} {1}",
234+
process.StartInfo.FileName,
235+
process.StartInfo.Arguments));
231236
process.Start();
232237
process.WaitForExit();
233238

234239
if (!File.Exists(nexFile))
235240
{
236241
outputLogWritter.WriteLine("Error building .nex file");
242+
outputLogWritter.WriteLine(process.StartInfo.WorkingDirectory);
243+
237244
using (StreamReader reader = process.StandardOutput)
238245
{
239246
string output = reader.ReadToEnd();
@@ -256,6 +263,19 @@ private static bool BuildNexFile(byte[] binary, ZXBuildSettings settings, ZXProj
256263
}
257264

258265

266+
private static void CheckNextCreator()
267+
{
268+
var fNCexe = Path.Combine(Path.GetDirectoryName(ZXOptions.Current.ZxbcPath), "tools", "nextcreator.exe");
269+
if (File.Exists(fNCexe))
270+
{
271+
return;
272+
}
273+
274+
File.Copy(ZXOptions.Current.ZxbcPath, fNCexe);
275+
return;
276+
}
277+
278+
259279
public static ZXProgram? BuildDebug(TextWriter OutputLogWritter)
260280
{
261281
try

0 commit comments

Comments
 (0)