4cade/bin/buildfx.js

52 lines
1.2 KiB
JavaScript
Raw Normal View History

2021-10-08 06:28:11 +00:00
a = new ActiveXObject("scripting.filesystemobject")
2021-10-16 05:34:00 +00:00
x = new ActiveXObject("wscript.shell")
2021-10-19 01:34:27 +00:00
fx_off = a.fileexists(WScript.Arguments(2)) ? a.getFile(WScript.Arguments(2)).size : 0
2021-10-16 05:34:00 +00:00
x.run('cmd /c bin\\buildfxful.bat ' + WScript.Arguments(0) + ' ' + WScript.Arguments(2) + ' ' + WScript.Arguments(3), 0, 1)
2021-10-08 06:28:11 +00:00
b = a.opentextfile(WScript.Arguments(0))
entries = []
while (!b.atendofstream)
{
c = b.readline()
d = c.indexOf("#")
if (d >= 0)
{
c = c.substr(0, d)
}
d = c.indexOf("=")
if (d >= 0)
{
c = c.substr(0, d)
}
2021-10-25 00:09:29 +00:00
if (c.indexOf("[eof]") >= 0)
2021-10-08 06:28:11 +00:00
{
break
}
if (c.length > 0)
{
entries.push(c)
}
}
groups = "*=0\n" + "!le16 " + entries.length.toString() + ", 0\n"
for (i = 0; i < entries.length; i++)
{
2021-10-13 06:05:41 +00:00
groups += "!byte " + (1 + 1 + entries[i].length + 5).toString() + "\n" + "!byte " + entries[i].length.toString() + "\n" + "!text \"" + entries[i] + "\"\n" + "!be24 " + fx_off.toString() + "\n"
2021-10-16 05:34:00 +00:00
size = a.getfile(WScript.Arguments(3) + "\\" + entries[i]).size
2024-05-29 01:11:42 +00:00
groups += "!le16 " + size + "\n"
2021-10-13 06:05:41 +00:00
fx_off += size
2021-10-08 06:28:11 +00:00
}
2021-10-16 05:34:00 +00:00
f = a.createtextfile("build\\fx.tmp")
2021-10-08 06:28:11 +00:00
f.write(groups)
f.close()
2021-10-16 05:34:00 +00:00
x.run('cmd /c %acme% -o ' + WScript.Arguments(1) + ' build\\fx.tmp', 0, 1)