11#!/usr/bin/env node
22
33const Util = require ( "./Util" ) ;
4- // TODO: this needs to be moved into desktop
5- const prepareDesktopShaders = require ( "../scripts/PrepareDesktopShaders" ) ;
64
75const { program } = require ( 'commander' ) ;
86const rimraf = require ( "rimraf" ) ;
@@ -16,12 +14,13 @@ const path = require("path");
1614 * @param assetDirectory the root path of the folder containing all assets
1715 * @param platform the platform that is currently being built
1816 * @param platformBuildDirectory the root build directory for this platform
19- * @param gameBuildDirectory the path to the directory where all compiled code will be built to
20- * @param gameBinDirectory the output directory for this game's binary files
17+ * @param outputDirectory the output directory for this game's assets
2118 * @param pluginManifest the path pointing to the plugin manifest for this build
2219 */
23- async function prepareAssets ( manifestFile , assetDirectory , platform , gameBuildDirectory , gameBinDirectory , pluginManifest ) {
24- const outputDirectory = path . join ( gameBinDirectory , "assets" ) ;
20+ async function prepareAssets ( manifestFile , assetDirectory , platform , outputDirectory , pluginManifest ) {
21+ if ( ! fse . existsSync ( manifestFile ) ) {
22+ throw new Error ( `Manifest file does not exist: ${ manifestFile } ` ) ;
23+ }
2524
2625 if ( fse . existsSync ( outputDirectory ) ) {
2726 rimraf . sync ( outputDirectory ) ;
@@ -37,37 +36,19 @@ async function prepareAssets(manifestFile, assetDirectory, platform, gameBuildDi
3736
3837 switch ( platform ) {
3938 case "n64_libultra" :
40- purgeCompiledAssetData ( gameBuildDirectory )
39+ // purgeCompiledAssetData(gameBuildDirectory)
4140 const processN64 = require ( "./n64_libultra/Process" ) ;
4241 await processN64 ( manifestFile , assetDirectory , outputDirectory , pluginMap ) ;
43- break ;
42+ break ;
4443
4544 case "desktop" :
4645 const processDesktop = require ( "./desktop/Process" ) ;
4746 await processDesktop ( manifestFile , assetDirectory , outputDirectory , pluginMap ) ;
48-
49- /// TODO: This should be moved into the desktop processing directory
50- const shaderDestDir = path . join ( gameBinDirectory , "glsl" ) ;
51- prepareDesktopShaders ( shaderDestDir ) ;
52- break ;
47+ break ;
5348
5449 default :
55- throw new Error ( `Unsupported platform: ${ manifest . platform } ` ) ;
56- }
57- }
58-
59- /**
60- * This function is needed because the compiler will need to regenerate the packed asset data when there is a change.
61- * TODO: this should be moved into n64_libulta directory
62- */
63- function purgeCompiledAssetData ( gameBuildDirectory ) {
64- const compiledDataPath = path . join ( gameBuildDirectory , "asm" , "asset_data.s.obj" ) ;
65-
66- if ( fse . existsSync ( compiledDataPath ) ) {
67- console . log ( `Purging compiled asset data file: ${ compiledDataPath } ` ) ;
68- fse . unlinkSync ( compiledDataPath )
50+ throw new Error ( `Unsupported platform: ${ platform } ` ) ;
6951 }
70-
7152}
7253
7354function loadPlugins ( pluginManifestPath ) {
@@ -130,9 +111,4 @@ function loadPlugins(pluginManifestPath) {
130111
131112module . exports = {
132113 prepareAssets : prepareAssets
133- } ;
134-
135- if ( require . main === module ) {
136- require ( "../scripts/RunPipeline" ) ( ) ;
137- main ( ) ;
138- }
114+ } ;
0 commit comments