ticbuild 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.attachments/support_me_on_kofi_beige.png +0 -0
- package/.env.example +3 -0
- package/.prettierignore +10 -0
- package/LICENSE +15 -0
- package/README.md +429 -0
- package/debug/obj/resolvedManifest.ticbuild.jsonc +108 -0
- package/dist/backend/ImportedResource.d.ts +11 -0
- package/dist/backend/ImportedResource.d.ts.map +1 -0
- package/dist/backend/ImportedResource.js +53 -0
- package/dist/backend/ImportedResource.js.map +1 -0
- package/dist/backend/ImportedResourceTypes.d.ts +24 -0
- package/dist/backend/ImportedResourceTypes.d.ts.map +1 -0
- package/dist/backend/ImportedResourceTypes.js +35 -0
- package/dist/backend/ImportedResourceTypes.js.map +1 -0
- package/dist/backend/codeBanking.test.d.ts +2 -0
- package/dist/backend/codeBanking.test.d.ts.map +1 -0
- package/dist/backend/codeBanking.test.js.map +1 -0
- package/dist/backend/importResources.d.ts +4 -0
- package/dist/backend/importResources.d.ts.map +1 -0
- package/dist/backend/importResources.js +58 -0
- package/dist/backend/importResources.js.map +1 -0
- package/dist/backend/importUtils.d.ts +14 -0
- package/dist/backend/importUtils.d.ts.map +1 -0
- package/dist/backend/importUtils.js +77 -0
- package/dist/backend/importUtils.js.map +1 -0
- package/dist/backend/importers/LuaCodeImporter.d.ts +47 -0
- package/dist/backend/importers/LuaCodeImporter.d.ts.map +1 -0
- package/dist/backend/importers/LuaCodeImporter.js +196 -0
- package/dist/backend/importers/LuaCodeImporter.js.map +1 -0
- package/dist/backend/importers/LuaCodeImporter.test.d.ts +2 -0
- package/dist/backend/importers/LuaCodeImporter.test.d.ts.map +1 -0
- package/dist/backend/importers/LuaCodeImporter.test.js.map +1 -0
- package/dist/backend/importers/binaryResourceImporter.d.ts +22 -0
- package/dist/backend/importers/binaryResourceImporter.d.ts.map +1 -0
- package/dist/backend/importers/binaryResourceImporter.js +53 -0
- package/dist/backend/importers/binaryResourceImporter.js.map +1 -0
- package/dist/backend/importers/luaImporter.d.ts +1 -0
- package/dist/backend/importers/luaImporter.d.ts.map +1 -0
- package/dist/backend/importers/luaImporter.js +3 -0
- package/dist/backend/importers/luaImporter.js.map +1 -0
- package/dist/backend/importers/textResourceImporter.d.ts +23 -0
- package/dist/backend/importers/textResourceImporter.d.ts.map +1 -0
- package/dist/backend/importers/textResourceImporter.js +55 -0
- package/dist/backend/importers/textResourceImporter.js.map +1 -0
- package/dist/backend/importers/tic80CartImporter.d.ts +21 -0
- package/dist/backend/importers/tic80CartImporter.d.ts.map +1 -0
- package/dist/backend/importers/tic80CartImporter.js +96 -0
- package/dist/backend/importers/tic80CartImporter.js.map +1 -0
- package/dist/backend/loadAllImports.d.ts +1 -0
- package/dist/backend/loadAllImports.d.ts.map +1 -0
- package/dist/backend/loadAllImports.js +3 -0
- package/dist/backend/loadAllImports.js.map +1 -0
- package/dist/backend/luaBinaryEncoding.d.ts +6 -0
- package/dist/backend/luaBinaryEncoding.d.ts.map +1 -0
- package/dist/backend/luaBinaryEncoding.js +94 -0
- package/dist/backend/luaBinaryEncoding.js.map +1 -0
- package/dist/backend/luaPreprocessor.d.ts +8 -0
- package/dist/backend/luaPreprocessor.d.ts.map +1 -0
- package/dist/backend/luaPreprocessor.js +862 -0
- package/dist/backend/luaPreprocessor.js.map +1 -0
- package/dist/backend/luaPreprocessor.test.d.ts +2 -0
- package/dist/backend/luaPreprocessor.test.d.ts.map +1 -0
- package/dist/backend/luaPreprocessor.test.js.map +1 -0
- package/dist/backend/manifestLoader.d.ts +19 -0
- package/dist/backend/manifestLoader.d.ts.map +1 -0
- package/dist/backend/manifestLoader.js +142 -0
- package/dist/backend/manifestLoader.js.map +1 -0
- package/dist/backend/manifestLoader.test.d.ts +2 -0
- package/dist/backend/manifestLoader.test.d.ts.map +1 -0
- package/dist/backend/manifestLoader.test.js.map +1 -0
- package/dist/backend/manifestTypes.d.ts +454 -0
- package/dist/backend/manifestTypes.d.ts.map +1 -0
- package/dist/backend/manifestTypes.js +28 -0
- package/dist/backend/manifestTypes.js.map +1 -0
- package/dist/backend/project.d.ts +24 -0
- package/dist/backend/project.d.ts.map +1 -0
- package/dist/backend/project.js +159 -0
- package/dist/backend/project.js.map +1 -0
- package/dist/backend/projectCore.d.ts +34 -0
- package/dist/backend/projectCore.d.ts.map +1 -0
- package/dist/backend/projectCore.js +226 -0
- package/dist/backend/projectCore.js.map +1 -0
- package/dist/backend/tic80Resolver.d.ts +6 -0
- package/dist/backend/tic80Resolver.d.ts.map +1 -0
- package/dist/backend/tic80Resolver.js +66 -0
- package/dist/backend/tic80Resolver.js.map +1 -0
- package/dist/buildInfo.d.ts +9 -0
- package/dist/buildInfo.d.ts.map +1 -0
- package/dist/buildInfo.js +13 -0
- package/dist/buildInfo.js.map +1 -0
- package/dist/frontend/build.d.ts +3 -0
- package/dist/frontend/build.d.ts.map +1 -0
- package/dist/frontend/build.js +8 -0
- package/dist/frontend/build.js.map +1 -0
- package/dist/frontend/codeBankWarnings.test.d.ts +2 -0
- package/dist/frontend/codeBankWarnings.test.d.ts.map +1 -0
- package/dist/frontend/codeBankWarnings.test.js.map +1 -0
- package/dist/frontend/core.d.ts +3 -0
- package/dist/frontend/core.d.ts.map +1 -0
- package/dist/frontend/core.js +259 -0
- package/dist/frontend/core.js.map +1 -0
- package/dist/frontend/init.d.ts +7 -0
- package/dist/frontend/init.d.ts.map +1 -0
- package/dist/frontend/init.js +95 -0
- package/dist/frontend/init.js.map +1 -0
- package/dist/frontend/parseOptions.d.ts +7 -0
- package/dist/frontend/parseOptions.d.ts.map +1 -0
- package/dist/frontend/parseOptions.js +68 -0
- package/dist/frontend/parseOptions.js.map +1 -0
- package/dist/frontend/run.d.ts +3 -0
- package/dist/frontend/run.d.ts.map +1 -0
- package/dist/frontend/run.js +63 -0
- package/dist/frontend/run.js.map +1 -0
- package/dist/frontend/watch.d.ts +3 -0
- package/dist/frontend/watch.d.ts.map +1 -0
- package/dist/frontend/watch.js +208 -0
- package/dist/frontend/watch.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +191 -0
- package/dist/index.js.map +1 -0
- package/dist/obj/resolvedManifest.ticbuild.jsonc +110 -0
- package/dist/obj/variables.json +19 -0
- package/dist/utils/algorithms.d.ts +4 -0
- package/dist/utils/algorithms.d.ts.map +1 -0
- package/dist/utils/algorithms.js +15 -0
- package/dist/utils/algorithms.js.map +1 -0
- package/dist/utils/algorithms.test.d.ts +2 -0
- package/dist/utils/algorithms.test.d.ts.map +1 -0
- package/dist/utils/algorithms.test.js.map +1 -0
- package/dist/utils/bin.d.ts +4 -0
- package/dist/utils/bin.d.ts.map +1 -0
- package/dist/utils/bin.js +16 -0
- package/dist/utils/bin.js.map +1 -0
- package/dist/utils/charMap.d.ts +28 -0
- package/dist/utils/charMap.d.ts.map +1 -0
- package/dist/utils/charMap.js +31 -0
- package/dist/utils/charMap.js.map +1 -0
- package/dist/utils/console.d.ts +10 -0
- package/dist/utils/console.d.ts.map +1 -0
- package/dist/utils/console.js +66 -0
- package/dist/utils/console.js.map +1 -0
- package/dist/utils/encoding/b85.d.ts +5 -0
- package/dist/utils/encoding/b85.d.ts.map +1 -0
- package/dist/utils/encoding/b85.js +136 -0
- package/dist/utils/encoding/b85.js.map +1 -0
- package/dist/utils/encoding/codecRegistry.d.ts +333 -0
- package/dist/utils/encoding/codecRegistry.d.ts.map +1 -0
- package/dist/utils/encoding/codecRegistry.js +81 -0
- package/dist/utils/encoding/codecRegistry.js.map +1 -0
- package/dist/utils/encoding/hex.d.ts +3 -0
- package/dist/utils/encoding/hex.d.ts.map +1 -0
- package/dist/utils/encoding/hex.js +30 -0
- package/dist/utils/encoding/hex.js.map +1 -0
- package/dist/utils/encoding/lz.d.ts +12 -0
- package/dist/utils/encoding/lz.d.ts.map +1 -0
- package/dist/utils/encoding/lz.js +271 -0
- package/dist/utils/encoding/lz.js.map +1 -0
- package/dist/utils/enum.d.ts +45 -0
- package/dist/utils/enum.d.ts.map +1 -0
- package/dist/utils/enum.js +135 -0
- package/dist/utils/enum.js.map +1 -0
- package/dist/utils/errorHandling.d.ts +13 -0
- package/dist/utils/errorHandling.d.ts.map +1 -0
- package/dist/utils/errorHandling.js +18 -0
- package/dist/utils/errorHandling.js.map +1 -0
- package/dist/utils/fileSystem.d.ts +16 -0
- package/dist/utils/fileSystem.d.ts.map +1 -0
- package/dist/utils/fileSystem.js +161 -0
- package/dist/utils/fileSystem.js.map +1 -0
- package/dist/utils/help.d.ts +7 -0
- package/dist/utils/help.d.ts.map +1 -0
- package/dist/utils/help.js +87 -0
- package/dist/utils/help.js.map +1 -0
- package/dist/utils/lua/luaUtils.d.ts +1 -0
- package/dist/utils/lua/luaUtils.d.ts.map +1 -0
- package/dist/utils/lua/luaUtils.js +3 -0
- package/dist/utils/lua/luaUtils.js.map +1 -0
- package/dist/utils/lua/lua_alias_expressions.d.ts +20 -0
- package/dist/utils/lua/lua_alias_expressions.d.ts.map +1 -0
- package/dist/utils/lua/lua_alias_expressions.js +233 -0
- package/dist/utils/lua/lua_alias_expressions.js.map +1 -0
- package/dist/utils/lua/lua_alias_literals.d.ts +20 -0
- package/dist/utils/lua/lua_alias_literals.d.ts.map +1 -0
- package/dist/utils/lua/lua_alias_literals.js +165 -0
- package/dist/utils/lua/lua_alias_literals.js.map +1 -0
- package/dist/utils/lua/lua_alias_shared.d.ts +31 -0
- package/dist/utils/lua/lua_alias_shared.d.ts.map +1 -0
- package/dist/utils/lua/lua_alias_shared.js +415 -0
- package/dist/utils/lua/lua_alias_shared.js.map +1 -0
- package/dist/utils/lua/lua_ast.d.ts +9 -0
- package/dist/utils/lua/lua_ast.d.ts.map +1 -0
- package/dist/utils/lua/lua_ast.js +90 -0
- package/dist/utils/lua/lua_ast.js.map +1 -0
- package/dist/utils/lua/lua_fundamentals.d.ts +14 -0
- package/dist/utils/lua/lua_fundamentals.d.ts.map +1 -0
- package/dist/utils/lua/lua_fundamentals.js +93 -0
- package/dist/utils/lua/lua_fundamentals.js.map +1 -0
- package/dist/utils/lua/lua_pack_locals.d.ts +3 -0
- package/dist/utils/lua/lua_pack_locals.d.ts.map +1 -0
- package/dist/utils/lua/lua_pack_locals.js +206 -0
- package/dist/utils/lua/lua_pack_locals.js.map +1 -0
- package/dist/utils/lua/lua_processor.d.ts +65 -0
- package/dist/utils/lua/lua_processor.d.ts.map +1 -0
- package/dist/utils/lua/lua_processor.js +1153 -0
- package/dist/utils/lua/lua_processor.js.map +1 -0
- package/dist/utils/lua/lua_processor.test.d.ts +2 -0
- package/dist/utils/lua/lua_processor.test.d.ts.map +1 -0
- package/dist/utils/lua/lua_processor.test.js.map +1 -0
- package/dist/utils/lua/lua_remove_unused_functions.d.ts +6 -0
- package/dist/utils/lua/lua_remove_unused_functions.d.ts.map +1 -0
- package/dist/utils/lua/lua_remove_unused_functions.js +474 -0
- package/dist/utils/lua/lua_remove_unused_functions.js.map +1 -0
- package/dist/utils/lua/lua_remove_unused_locals.d.ts +3 -0
- package/dist/utils/lua/lua_remove_unused_locals.d.ts.map +1 -0
- package/dist/utils/lua/lua_remove_unused_locals.js +303 -0
- package/dist/utils/lua/lua_remove_unused_locals.js.map +1 -0
- package/dist/utils/lua/lua_rename_allowed_table_keys.d.ts +3 -0
- package/dist/utils/lua/lua_rename_allowed_table_keys.d.ts.map +1 -0
- package/dist/utils/lua/lua_rename_allowed_table_keys.js +157 -0
- package/dist/utils/lua/lua_rename_allowed_table_keys.js.map +1 -0
- package/dist/utils/lua/lua_rename_table_fields.d.ts +3 -0
- package/dist/utils/lua/lua_rename_table_fields.d.ts.map +1 -0
- package/dist/utils/lua/lua_rename_table_fields.js +427 -0
- package/dist/utils/lua/lua_rename_table_fields.js.map +1 -0
- package/dist/utils/lua/lua_renamer.d.ts +3 -0
- package/dist/utils/lua/lua_renamer.d.ts.map +1 -0
- package/dist/utils/lua/lua_renamer.js +229 -0
- package/dist/utils/lua/lua_renamer.js.map +1 -0
- package/dist/utils/lua/lua_simplify.d.ts +3 -0
- package/dist/utils/lua/lua_simplify.d.ts.map +1 -0
- package/dist/utils/lua/lua_simplify.js +541 -0
- package/dist/utils/lua/lua_simplify.js.map +1 -0
- package/dist/utils/lua/lua_utils.d.ts +13 -0
- package/dist/utils/lua/lua_utils.d.ts.map +1 -0
- package/dist/utils/lua/lua_utils.js +58 -0
- package/dist/utils/lua/lua_utils.js.map +1 -0
- package/dist/utils/math.d.ts +2 -0
- package/dist/utils/math.d.ts.map +1 -0
- package/dist/utils/math.js +7 -0
- package/dist/utils/math.js.map +1 -0
- package/dist/utils/math.test.d.ts +2 -0
- package/dist/utils/math.test.d.ts.map +1 -0
- package/dist/utils/math.test.js.map +1 -0
- package/dist/utils/templates.d.ts +3 -0
- package/dist/utils/templates.d.ts.map +1 -0
- package/dist/utils/templates.js +57 -0
- package/dist/utils/templates.js.map +1 -0
- package/dist/utils/tic80/bankSupport.test.d.ts +2 -0
- package/dist/utils/tic80/bankSupport.test.d.ts.map +1 -0
- package/dist/utils/tic80/bankSupport.test.js.map +1 -0
- package/dist/utils/tic80/cartLoader.d.ts +3 -0
- package/dist/utils/tic80/cartLoader.d.ts.map +1 -0
- package/dist/utils/tic80/cartLoader.js +54 -0
- package/dist/utils/tic80/cartLoader.js.map +1 -0
- package/dist/utils/tic80/cartWriter.d.ts +5 -0
- package/dist/utils/tic80/cartWriter.d.ts.map +1 -0
- package/dist/utils/tic80/cartWriter.js +95 -0
- package/dist/utils/tic80/cartWriter.js.map +1 -0
- package/dist/utils/tic80/launch.d.ts +4 -0
- package/dist/utils/tic80/launch.d.ts.map +1 -0
- package/dist/utils/tic80/launch.js +36 -0
- package/dist/utils/tic80/launch.js.map +1 -0
- package/dist/utils/tic80/tic80.d.ts +1149 -0
- package/dist/utils/tic80/tic80.d.ts.map +1 -0
- package/dist/utils/tic80/tic80.js +114 -0
- package/dist/utils/tic80/tic80.js.map +1 -0
- package/dist/utils/utils.d.ts +13 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/utils/utils.js +109 -0
- package/dist/utils/utils.js.map +1 -0
- package/dist/utils/versionString.d.ts +12 -0
- package/dist/utils/versionString.d.ts.map +1 -0
- package/dist/utils/versionString.js +33 -0
- package/dist/utils/versionString.js.map +1 -0
- package/dist/utils/windowPosition.d.ts +10 -0
- package/dist/utils/windowPosition.d.ts.map +1 -0
- package/dist/utils/windowPosition.js +222 -0
- package/dist/utils/windowPosition.js.map +1 -0
- package/example.ticbuild.jsonc +94 -0
- package/package.json +51 -0
- package/templates/help/build.txt +23 -0
- package/templates/help/init.txt +23 -0
- package/templates/help/main.txt +41 -0
- package/templates/help/run.txt +22 -0
- package/templates/help/tic80.txt +8 -0
- package/templates/help/watch.txt +24 -0
- package/templates/minimal/project.ticbuild.jsonc +43 -0
- package/ticbuild-1.0.0.tgz +0 -0
- package/ticbuild.schema.json +327 -0
|
Binary file
|
package/.env.example
ADDED
package/.prettierignore
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Carl Corcoran
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
|
|
2
|
+
# ticbuild
|
|
3
|
+
|
|
4
|
+
A build & watch system for TIC-80 cart development.
|
|
5
|
+
|
|
6
|
+
* Multi-file Lua dev system
|
|
7
|
+
* Watch system: live-update a running tic80 when dependent files are updated.
|
|
8
|
+
* Import data from existing carts
|
|
9
|
+
* Rich Lua preprocessing
|
|
10
|
+
* Code size up to 512kb
|
|
11
|
+
* Arbitrary binary & text importing, decoding, encoding.
|
|
12
|
+
|
|
13
|
+
## Links
|
|
14
|
+
|
|
15
|
+
* [TIC-80 homepage](https://tic80.com/)
|
|
16
|
+
* [Github](https://github.com/thenfour/ticbuild)
|
|
17
|
+
* [Discord](https://discord.gg/kkf9gQfKAd)
|
|
18
|
+
* [Somatic - web-based TIC-80 music tracker](https://somatic.tenfourmusic.net/)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
Somatic is free, a labor of love; if you find it useful, please support by spreading the word or,
|
|
22
|
+
|
|
23
|
+
[](https://ko-fi.com/E1E71QVJ5Z)
|
|
24
|
+
|
|
25
|
+
# Installation
|
|
26
|
+
|
|
27
|
+
Install ticbuild globally using npm:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install -g ticbuild
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Lua preprocessor + syntax highlighting
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
code --install-extension ./ticbuild-preproc-highlight-0.0.1.vsix --force
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
This will add basic syntax highlighting to the extensions to Lua.
|
|
40
|
+
|
|
41
|
+
## Prerequisites
|
|
42
|
+
|
|
43
|
+
- Windows (most is cross-platform however launching is strictly windows)
|
|
44
|
+
- Node.js (v16 or higher)
|
|
45
|
+
- TIC-80 installed and available in your PATH, or configured via `.env` file
|
|
46
|
+
|
|
47
|
+
# How to use: overview
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
|
|
51
|
+
# see detailed help
|
|
52
|
+
ticbuild help
|
|
53
|
+
|
|
54
|
+
# see help for a specific command
|
|
55
|
+
ticbuild help build
|
|
56
|
+
|
|
57
|
+
# build from manifest -> .tic cart
|
|
58
|
+
ticbuild build
|
|
59
|
+
|
|
60
|
+
# build and launch in a tic80
|
|
61
|
+
ticbuild run
|
|
62
|
+
|
|
63
|
+
# build and live-update with changes in a tic80
|
|
64
|
+
ticbuild watch
|
|
65
|
+
|
|
66
|
+
# create a new empty project
|
|
67
|
+
ticbuild init
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## TIC-80 binary location
|
|
72
|
+
|
|
73
|
+
The TIC-80 location is searched in the `%PATH%`, but otherwise it can be overridden
|
|
74
|
+
via `.env` and `.env.local` in the project directory, with the key `TIC80_LOCATION`,
|
|
75
|
+
as a full path to `tic80.exe`.
|
|
76
|
+
|
|
77
|
+
# Project manifest
|
|
78
|
+
|
|
79
|
+
The manifest file is canonically `*.ticbuild.jsonc`. Its location defines the project root.
|
|
80
|
+
|
|
81
|
+
```jsonc
|
|
82
|
+
// paths are always relative to the manifest file's dir (which defines the project root dir)
|
|
83
|
+
// fyi, reference: https://github.com/nesbox/TIC-80/wiki/.tic-File-Format
|
|
84
|
+
{
|
|
85
|
+
"$schema": "./ticbuild.schema.json",
|
|
86
|
+
"project": {
|
|
87
|
+
"name": "my demo",
|
|
88
|
+
"includeDirs": ["./src", "./include"], // includes these dirs in source file lookup
|
|
89
|
+
"importDirs": ["./assets", "./images"], // include these dirs in resource import lookup
|
|
90
|
+
"binDir": "./dist/bin",
|
|
91
|
+
"objDir": "./dist/obj",
|
|
92
|
+
"outputCartName": "$(project.name).tic", // leaf name only
|
|
93
|
+
},
|
|
94
|
+
"variables": {
|
|
95
|
+
"anything": "here", // variables can be referred to in values via $(variablename)
|
|
96
|
+
},
|
|
97
|
+
"imports": [
|
|
98
|
+
{
|
|
99
|
+
"name": "maincode", // symbolic identifier
|
|
100
|
+
"path": "main.lua",
|
|
101
|
+
"kind": "LuaCode", // defines the type of importer to handle this.
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"name": "twilight_bog_palette", // https://lospec.com/palette-list/twilight-bog
|
|
105
|
+
"kind": "binary", // the imported resource is treated as binary data.
|
|
106
|
+
|
|
107
|
+
// the way it's represented in its source may not be a binary file; we can decode the source data.
|
|
108
|
+
// see below for detailed info about encoding types
|
|
109
|
+
"sourceEncoding": "hex",
|
|
110
|
+
// like other resources, loading from file is fine:
|
|
111
|
+
// "path": "path_to_file.bin"
|
|
112
|
+
|
|
113
|
+
// but you can also just specify the value here.
|
|
114
|
+
// NOTE: as with all (most?) manifest values, string substitions are performed so variables
|
|
115
|
+
// can be used.
|
|
116
|
+
"value": "1f17143439434e5a6d5d8da289baabb8cfb9839c77727546383f38704b63a66470b8948ec8bfbfe1e6eaa48db6785a96",
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"name": "scroll_text",
|
|
120
|
+
"kind": "text", // the imported resource is treated as plain text
|
|
121
|
+
// like other resources, loading from file is fine:
|
|
122
|
+
// "path": "path_to_file.txt"
|
|
123
|
+
// but you can also just specify the value here. Again, string substitution is supported.
|
|
124
|
+
"value": "greetz to everyone at the party coding is omg so beer fartschnapps",
|
|
125
|
+
},
|
|
126
|
+
// it is not necessary to specify all source files here; main.lua can import
|
|
127
|
+
// files directly by relative path.
|
|
128
|
+
{
|
|
129
|
+
"name": "myGraphics",
|
|
130
|
+
"path": "./carts/sprites.tic", // imports from some other cartridge
|
|
131
|
+
// you can specify which chunks to bring in. The chunk types are hard-coded
|
|
132
|
+
// corresponding to the TIC-80 cart chunks.
|
|
133
|
+
// Bringing in multiple chunks though means that 1 import can have multiple
|
|
134
|
+
// sub-assets. In this case, "myGraphics" contains tiles and sprites.
|
|
135
|
+
// asset types are so far just mapped directly to tic80 cart chunk types.
|
|
136
|
+
// but in the future it could be that we support our own types of imports
|
|
137
|
+
// for example a .MOD, or a .TTF or graphics.
|
|
138
|
+
//
|
|
139
|
+
// It means when you refer to an import ("myGraphics") you need to specify
|
|
140
|
+
// which sub asset you actually want. Scenarios:
|
|
141
|
+
// 1. the requseted chunks matches exactly the asset chunks: e.g. for cart
|
|
142
|
+
// assembly, you specify blockTypes:["TILES", "SPRITES"], and asset "myGraphics",
|
|
143
|
+
// it will just both sub-assets without needing to specify.
|
|
144
|
+
// 2. if you don't specify the chunks desired, all will be used. Errors would
|
|
145
|
+
// be produced if the destination doesn't support that chunk type.
|
|
146
|
+
// 3. if the requested chunks don't match the available, this is an error.
|
|
147
|
+
// In this case you must be explicit about what you want to import.
|
|
148
|
+
// (that's the idea...)
|
|
149
|
+
//
|
|
150
|
+
// if import.chunks is omitted, extract all chunks from source.
|
|
151
|
+
// if block.chunks is omitted, use all chunks the asset provides.
|
|
152
|
+
"chunks": ["TILES", "SPRITES"],
|
|
153
|
+
"kind": "Tic80Cartridge", // again this could be deduced.
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"name": "music-imported-cart",
|
|
157
|
+
"path": "./carts/song.tic",
|
|
158
|
+
// you can also omit the chunks and we'll just import all available from a cart.
|
|
159
|
+
"chunks": [
|
|
160
|
+
"CODE",
|
|
161
|
+
"MUSIC_WAVEFORMS",
|
|
162
|
+
"MUSIC_PATTERNS",
|
|
163
|
+
"MUSIC_SFX",
|
|
164
|
+
"MUSIC_SONG",
|
|
165
|
+
],
|
|
166
|
+
// MAYBE in the future we can add other ways to query like to pull in a specific sprite.
|
|
167
|
+
// but for now not necessary.
|
|
168
|
+
|
|
169
|
+
// Note: the code that's imported from a cart can contain ticbuild preprocessing directives.
|
|
170
|
+
// this could be useful for example in Somatic, to wrap TIC() with a --#if false --#endif
|
|
171
|
+
// which would basically remove the entrypoint
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
"assembly": {
|
|
175
|
+
"lua": {
|
|
176
|
+
"minify": true,
|
|
177
|
+
"minification": {
|
|
178
|
+
// options here are exactly those of OptimizationRuleOptions
|
|
179
|
+
// these are all the default values if not specified.
|
|
180
|
+
"stripComments": true,
|
|
181
|
+
"maxIndentLevel": 1,
|
|
182
|
+
"lineBehavior": "tight", // "pretty" | "tight" | "single-line-blocks";
|
|
183
|
+
"maxLineLength": 180,
|
|
184
|
+
"aliasRepeatedExpressions": true,
|
|
185
|
+
"renameLocalVariables": true,
|
|
186
|
+
"aliasLiterals": true,
|
|
187
|
+
"packLocalDeclarations": true,
|
|
188
|
+
"simplifyExpressions": true,
|
|
189
|
+
"removeUnusedLocals": true,
|
|
190
|
+
"removeUnusedFunctions": false,
|
|
191
|
+
"functionNamesToKeep": ["TIC", "BDR", "SCN"], // TIC-80 constants by default
|
|
192
|
+
"renameTableFields": false,
|
|
193
|
+
"tableEntryKeysToRename": [],
|
|
194
|
+
},
|
|
195
|
+
|
|
196
|
+
// optional global variables to emit in lua code.
|
|
197
|
+
// they are written out as `local variableName = xyz` at the top of the code.
|
|
198
|
+
// you cannot specify where it gets emitted.
|
|
199
|
+
// what datatype though? string, number, or boolean?
|
|
200
|
+
"globals": {
|
|
201
|
+
"PROJECT_NAME": "$(project.name)", // by default everything is a string.
|
|
202
|
+
"ENABLE_HUD": true, // this can be a boolean to emit as boolean.
|
|
203
|
+
"PI": 3.14159, // emits as a number.
|
|
204
|
+
// no way currently to emit substituted variables as anything but strings.
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
"blocks": [
|
|
208
|
+
{
|
|
209
|
+
// error if overlapping chunks.
|
|
210
|
+
// this chunk type "CODE" is technically redundant because the asset already has the chunk type attached.
|
|
211
|
+
// you can specify CODE_COMPRESSED for the ZLIB compressed version.
|
|
212
|
+
"chunks": ["CODE"],
|
|
213
|
+
"bank": 0,
|
|
214
|
+
"asset": "maincode",
|
|
215
|
+
"code": { // optional code assemblyl options
|
|
216
|
+
// if true, emits the globals defined in assembly.lua.globals.
|
|
217
|
+
"emitGlobals": true,
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
// Note: Binary resources can be output to any chunk type. they just get placed there
|
|
222
|
+
// with no regards of format / packing. Often you want to store custom resources in places like
|
|
223
|
+
// the large MAP area.
|
|
224
|
+
"chunks": ["MAP"],
|
|
225
|
+
"asset": "some_binary_file"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
// produces a view of the import with just the 1 MUSIC_WAVEFORMS sub-asset
|
|
229
|
+
// Without specifying the chunks to produce, this automatically implies chunks: ["MUSIC_WAVEFORMS"].
|
|
230
|
+
// if you explicitly specify "chunks":["TILES"], this would binary copy the waveforms to the tiles.
|
|
231
|
+
|
|
232
|
+
// canonical form:
|
|
233
|
+
"asset": { "import": "music-imported-cart", "chunks": ["MUSIC_WAVEFORMS"] },
|
|
234
|
+
|
|
235
|
+
// optional sugar method that resembles how Lua includes assets.
|
|
236
|
+
//asset: "import:music-imported-cart:MUSIC_WAVEFORMS",
|
|
237
|
+
},
|
|
238
|
+
],
|
|
239
|
+
},
|
|
240
|
+
|
|
241
|
+
"buildConfigurations": {
|
|
242
|
+
// build configurations allow overriding things in the base config above.
|
|
243
|
+
// you cannot override individual elements of arrays. for example, `assembly.blocks`
|
|
244
|
+
// if you override that, you must overwrite the whole value.
|
|
245
|
+
// similar with includeDirs, you can't "add 1" or so; you have to replace the whole array.
|
|
246
|
+
"debug": {
|
|
247
|
+
"project": {
|
|
248
|
+
"binDir": "./debug/bin",
|
|
249
|
+
"objDir": "./debug/obj",
|
|
250
|
+
},
|
|
251
|
+
"variables": {
|
|
252
|
+
"anything": "overridden",
|
|
253
|
+
},
|
|
254
|
+
"assembly": {
|
|
255
|
+
"lua": {
|
|
256
|
+
"minify": false, // overrides
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
};
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
# Lua preprocessor
|
|
265
|
+
|
|
266
|
+
ticbuild supports a fairly sophisticated Lua preprocessor, so you can have interaction
|
|
267
|
+
between files, inline macros, access project variables, import assets, conditionally branch,
|
|
268
|
+
and even import binaries with various encodings.
|
|
269
|
+
|
|
270
|
+
```lua
|
|
271
|
+
-- Simple text-based Lua preprocessor.
|
|
272
|
+
-- we want to support a few preprocessor features, and make the syntax not totally
|
|
273
|
+
-- break the language syntax. therefore, we will put it in comments.
|
|
274
|
+
-- Expressions and syntax should feel Lua-ish (not C++-ish, despite the preprocessor
|
|
275
|
+
-- directive set being C++-like).
|
|
276
|
+
|
|
277
|
+
--#pragma once -- useful for utils that will get included by multiple things.
|
|
278
|
+
|
|
279
|
+
--#define DEBUG 1
|
|
280
|
+
--#define SHOW_HUD -- bool-ish evals to true.
|
|
281
|
+
--#define PI 3.14
|
|
282
|
+
|
|
283
|
+
-- Expressions are Lua, and are evaluated immediately on parse.
|
|
284
|
+
--#define TAU PI*2
|
|
285
|
+
print() --#define XYZ -- note that here #define will not be processed.
|
|
286
|
+
--#define XYZ -- but here it will be (whitespace allowed before)
|
|
287
|
+
|
|
288
|
+
-- Note that #defines do NOT result in Lua symbols or text replacement; they are
|
|
289
|
+
-- not macros, they are only recognized in other preprocessor directives.
|
|
290
|
+
|
|
291
|
+
--#include "utils/math.lua" -- extra comments are allowed in directive lines.
|
|
292
|
+
--#include "import:music-imported-cart:CODE" -- includes the imported code sub-asset from that cart
|
|
293
|
+
--#include "import:cart-with-only-code-chunk" -- implicit code-only import. If that cart contains more than CODE chunks, then you MUST specify ":CODE".
|
|
294
|
+
|
|
295
|
+
-- you can set variables that the included file can read
|
|
296
|
+
-- note that #pragma once will key against the filename AND its input variables.
|
|
297
|
+
-- the key/value style is Lua.
|
|
298
|
+
--#include "bayerKernel.lua" with { BAYER_SIZE = 4, DEBUG = true }
|
|
299
|
+
|
|
300
|
+
--#if DEBUG
|
|
301
|
+
print("debug")
|
|
302
|
+
--#else
|
|
303
|
+
-- something
|
|
304
|
+
--#endif -- DEBUG
|
|
305
|
+
|
|
306
|
+
--#if BAYER_SIZE == 4
|
|
307
|
+
-- ...
|
|
308
|
+
--#endif
|
|
309
|
+
|
|
310
|
+
--#if not defined(MAX_VOICES)
|
|
311
|
+
--#define MAX_VOICES 8
|
|
312
|
+
--#endif
|
|
313
|
+
|
|
314
|
+
-- Undefined preproc symbols shall not be `nil` even if that might feel natural.
|
|
315
|
+
-- using them in an expression shall be an error. Testing existence must be done
|
|
316
|
+
-- via `defined()`.
|
|
317
|
+
|
|
318
|
+
-- To be as "lua" as possible, `then` may feel natural at the end of that line,
|
|
319
|
+
--#if (MAX_VOICES < 4) then
|
|
320
|
+
--...
|
|
321
|
+
-- but don't support this. doesn't add anything and making it optional is unnecessary
|
|
322
|
+
-- complexity.
|
|
323
|
+
|
|
324
|
+
-- undefine:
|
|
325
|
+
--#undef MAX_VOICES
|
|
326
|
+
|
|
327
|
+
-- Access build system variables through a special function-like symbol
|
|
328
|
+
-- this will perform string substitutions and return the string. It will be done
|
|
329
|
+
-- at the preprocessor level though, and emitted as a string literal.
|
|
330
|
+
local s = __EXPAND("the project name is: $(project.name)")
|
|
331
|
+
|
|
332
|
+
-- Import binary data with various encodings, emits as lua literal.
|
|
333
|
+
-- this is for kind=binary imports.
|
|
334
|
+
-- first arg is the *output* encoding.
|
|
335
|
+
-- second arg is an import reference, same syntax as #include
|
|
336
|
+
local paletteString = __IMPORTBIN("hex", "import:twilight_bog_palette")
|
|
337
|
+
-- generates:
|
|
338
|
+
local paletteString = "1f17143439434e5a6d5d8da289baabb8cfb9839c77727546383f38704b63a66470b8948ec8bfbfe1e6eaa48db6785a96"
|
|
339
|
+
|
|
340
|
+
-- U8, S8, U16, S16, U32, S32 output tables of numbers from the binary input
|
|
341
|
+
local paletteString = __IMPORTBIN("s32", "import:twilight_bog_palette")
|
|
342
|
+
-- generates:
|
|
343
|
+
local paletteString = {873731871,1515078457,-1567793811,-1196705143,-1669088817,1182102135,1882734392,1688625995,-1902856080,-507527224,-1918571802,-1772455754}
|
|
344
|
+
|
|
345
|
+
-- base85+1 is base85 encoding with a prefix char describing the length remainder.
|
|
346
|
+
local paletteString = __IMPORTBIN("b85+1", "import:twilight_bog_palette")
|
|
347
|
+
-- generates:
|
|
348
|
+
local paletteString = "!*u>VJ3C?PFD-`-qM7Tatcae[uGB.gq3'TBA94Oi0E4D-maM5LKk3Ab%[WkuA"
|
|
349
|
+
|
|
350
|
+
-- LZ compression possible. The payload is compressed, then encoded with base85+1.
|
|
351
|
+
local paletteString = __IMPORTBIN("lz85+1", "import:twilight_bog_palette") -- LZ compressed binary + base 85 encoding
|
|
352
|
+
-- generates:
|
|
353
|
+
local paletteString = "#!&,K2'Jqg;:0ML?NM;9@X16KdK:I.+F[e>T3,hN#VIXYUP`Ei\"^Z\">?UlDg->*]-g"
|
|
354
|
+
|
|
355
|
+
-- while it seems like "import:" is redundant, it's necessary because
|
|
356
|
+
-- it stays consistent with #include syntax and allows shared parsing/handling of import reference spec strings.
|
|
357
|
+
|
|
358
|
+
-- Literals are not supported and should error. Reasoning:
|
|
359
|
+
-- 1. we don't know the source encoding
|
|
360
|
+
-- 2. we don't want to create another weird syntax like "hex:123456"
|
|
361
|
+
-- 3. we don't want to make overloads of this function just for literals.
|
|
362
|
+
|
|
363
|
+
-- ...So we make another function: __ENCODE where you must specify the input encoding,
|
|
364
|
+
-- output encoding, and the literal source value.
|
|
365
|
+
-- only string-based source encoding types are supported (so no LZ for example, but lz85+1 is ok)
|
|
366
|
+
local paletteString = __ENCODE("hex", "b85+1", "1f17143439434e5a6d5d8da289baabb8cfb9839c77727546383f38704b63a66470b8948ec8bfbfe1e6eaa48db6785a96")
|
|
367
|
+
-- generates:
|
|
368
|
+
local paletteString = "!*u>VJ3C?PFD-`-qM7Tatcae[uGB.gq3'TBA94Oi0E4D-maM5LKk3Ab%[WkuA"
|
|
369
|
+
-- ...without requiring an import at all to perform the encoding.
|
|
370
|
+
-- note the extra param. This version of __IMPORTBIN is (sourceEncoding, destEncoding, value)
|
|
371
|
+
-- where the value is processed the same as if it was in the manifest "value" key.
|
|
372
|
+
|
|
373
|
+
-- NOTE: both parameters support $(variables). string substitution is performed.
|
|
374
|
+
|
|
375
|
+
-- allows emitting a string literal from an imported text resource.
|
|
376
|
+
local scrollText = __IMPORTTEXT("import:scroll_text")
|
|
377
|
+
|
|
378
|
+
-- once again, "import:" is required for consistency, and to allow literals (though it's not much
|
|
379
|
+
-- value but there for completeness.)
|
|
380
|
+
-- string substitution is performed.
|
|
381
|
+
local s = __IMPORTTEXT("the project name is: $(project.name)") -- effectively the same as __EXPAND
|
|
382
|
+
|
|
383
|
+
-- macros are handy esp for writing optimized code (avoid symbol lookups, plus give
|
|
384
|
+
-- the minifier the chance to simplify / reduce expressions.
|
|
385
|
+
-- note that the macro call site should still be valid lua. similar reasoning
|
|
386
|
+
-- as preprocessor directives, and for example if the call site is `@clamp`,
|
|
387
|
+
-- things like autocomplete & formatting just won't work.
|
|
388
|
+
-- so like C, just blend in as a normal symbol and it's up to developers to avoid
|
|
389
|
+
-- conflicts.
|
|
390
|
+
-- by convention i'm guessing best to go all upper-case, and/or double-underscore prefix.
|
|
391
|
+
--#macro CLAMP(x, lo, hi) -- or __CLAMP
|
|
392
|
+
((x) < (lo) and (lo) or (x) > (hi) and (hi) or (x))
|
|
393
|
+
--#endmacro
|
|
394
|
+
|
|
395
|
+
-- example usage
|
|
396
|
+
local y = CLAMP(x + blah(y),
|
|
397
|
+
0,
|
|
398
|
+
1)
|
|
399
|
+
|
|
400
|
+
-- single-line macro syntax uses the arrow operator.
|
|
401
|
+
--#macro ADD(a, b) => ((a) + (b))
|
|
402
|
+
|
|
403
|
+
-- parameterless syntax is possible
|
|
404
|
+
--#macro PROJECT_NAME => __EXPAND("the project name is: $(project.name)")
|
|
405
|
+
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
# Code chunk behavior
|
|
409
|
+
|
|
410
|
+
Code chunk banks on cart are semantically slightly different than other chunk
|
|
411
|
+
types. Most of the time it's the simple, independent banks.
|
|
412
|
+
|
|
413
|
+
But when code is loaded by TIC-80, all code banks are concatenated in sequence.
|
|
414
|
+
|
|
415
|
+
Therefore, it's a warning to specify the bank explicitly for code chunks. But still
|
|
416
|
+
allowed as long as there's no conflict.
|
|
417
|
+
|
|
418
|
+
But if code wants to span multiple banks (larger than 1 bank), then no specified code banks should be
|
|
419
|
+
allowed (this is an error).
|
|
420
|
+
|
|
421
|
+
And for the code chunk alone, if code is larger than 1 bank, it gets automatically
|
|
422
|
+
split across multiple banks.
|
|
423
|
+
|
|
424
|
+
# FAQ / troubleshooting
|
|
425
|
+
|
|
426
|
+
## during build i see `fatal: No names found, cannot describe anything.`
|
|
427
|
+
|
|
428
|
+
Occurs when there are no git tags defined.
|
|
429
|
+
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./ticbuild.schema.json",
|
|
3
|
+
"project": {
|
|
4
|
+
"name": "example-game",
|
|
5
|
+
"includeDirs": [
|
|
6
|
+
"./src",
|
|
7
|
+
"./include"
|
|
8
|
+
],
|
|
9
|
+
"binDir": "./debug/bin",
|
|
10
|
+
"objDir": "./debug/obj",
|
|
11
|
+
"outputCartName": "example-game.tic"
|
|
12
|
+
},
|
|
13
|
+
"variables": {
|
|
14
|
+
"version": "3.0.0",
|
|
15
|
+
"author": "Example Developer",
|
|
16
|
+
"$schema": "./ticbuild.schema.json",
|
|
17
|
+
"project.name": "example-game",
|
|
18
|
+
"project.binDir": "./debug/bin",
|
|
19
|
+
"project.objDir": "./debug/obj",
|
|
20
|
+
"project.outputCartName": "example-game.tic",
|
|
21
|
+
"variables.version": "3.0.0",
|
|
22
|
+
"variables.author": "Example Developer",
|
|
23
|
+
"assembly.lua.minify": "false",
|
|
24
|
+
"buildConfigurations.debug.project.binDir": "./debug/bin",
|
|
25
|
+
"buildConfigurations.debug.project.objDir": "./debug/obj",
|
|
26
|
+
"buildConfigurations.debug.variables.version": "3.0.0",
|
|
27
|
+
"buildConfigurations.debug.assembly.lua.minify": "false"
|
|
28
|
+
},
|
|
29
|
+
"imports": [
|
|
30
|
+
{
|
|
31
|
+
"name": "maincode",
|
|
32
|
+
"path": "main.lua",
|
|
33
|
+
"kind": "LuaCode"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "graphics",
|
|
37
|
+
"path": "./assets/sprites.tic",
|
|
38
|
+
"kind": "Tic80Cartridge",
|
|
39
|
+
"chunks": [
|
|
40
|
+
"TILES",
|
|
41
|
+
"SPRITES"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "music",
|
|
46
|
+
"path": "./assets/song.tic",
|
|
47
|
+
"kind": "Tic80Cartridge",
|
|
48
|
+
"chunks": [
|
|
49
|
+
"MUSIC_WAVEFORMS",
|
|
50
|
+
"MUSIC_PATTERNS",
|
|
51
|
+
"MUSIC_SFX",
|
|
52
|
+
"MUSIC_SONG"
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"assembly": {
|
|
57
|
+
"lua": {
|
|
58
|
+
"minify": false
|
|
59
|
+
},
|
|
60
|
+
"blocks": [
|
|
61
|
+
{
|
|
62
|
+
"chunks": [
|
|
63
|
+
"CODE"
|
|
64
|
+
],
|
|
65
|
+
"asset": {
|
|
66
|
+
"import": "maincode"
|
|
67
|
+
},
|
|
68
|
+
"assembler": "LuaCode"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"asset": {
|
|
72
|
+
"import": "graphics",
|
|
73
|
+
"chunks": [
|
|
74
|
+
"TILES",
|
|
75
|
+
"SPRITES"
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"asset": {
|
|
81
|
+
"import": "music",
|
|
82
|
+
"chunks": [
|
|
83
|
+
"MUSIC_WAVEFORMS",
|
|
84
|
+
"MUSIC_PATTERNS",
|
|
85
|
+
"MUSIC_SFX",
|
|
86
|
+
"MUSIC_SONG"
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
"buildConfigurations": {
|
|
93
|
+
"debug": {
|
|
94
|
+
"project": {
|
|
95
|
+
"binDir": "./debug/bin",
|
|
96
|
+
"objDir": "./debug/obj"
|
|
97
|
+
},
|
|
98
|
+
"variables": {
|
|
99
|
+
"version": "3.0.0"
|
|
100
|
+
},
|
|
101
|
+
"assembly": {
|
|
102
|
+
"lua": {
|
|
103
|
+
"minify": false
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ResolvedManifest } from "./manifestTypes";
|
|
2
|
+
export declare class SubAsset {
|
|
3
|
+
}
|
|
4
|
+
export declare class ImportedResourceBase {
|
|
5
|
+
}
|
|
6
|
+
export declare class ResourceManager {
|
|
7
|
+
items: Map<string, ImportedResourceBase>;
|
|
8
|
+
constructor(items: Map<string, ImportedResourceBase>);
|
|
9
|
+
}
|
|
10
|
+
export declare function loadAllImports(project: ResolvedManifest): Promise<ResourceManager>;
|
|
11
|
+
//# sourceMappingURL=ImportedResource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImportedResource.d.ts","sourceRoot":"","sources":["../../src/backend/ImportedResource.ts"],"names":[],"mappings":"AAIA,OAAO,EAAe,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGhE,qBAAa,QAAQ;CAEpB;AAED,qBAAa,oBAAoB;CAGhC;AAED,qBAAa,eAAe;IAC1B,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;gBAE7B,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC;CAGrD;AAED,wBAAsB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CA+BxF"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// importing -> ImportedResource -> assembly
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ResourceManager = exports.ImportedResourceBase = exports.SubAsset = void 0;
|
|
5
|
+
exports.loadAllImports = loadAllImports;
|
|
6
|
+
const errorHandling_1 = require("../utils/errorHandling");
|
|
7
|
+
const tic80CartImporter_1 = require("./importers/tic80CartImporter");
|
|
8
|
+
const manifestTypes_1 = require("./manifestTypes");
|
|
9
|
+
//
|
|
10
|
+
class SubAsset {
|
|
11
|
+
}
|
|
12
|
+
exports.SubAsset = SubAsset;
|
|
13
|
+
class ImportedResourceBase {
|
|
14
|
+
}
|
|
15
|
+
exports.ImportedResourceBase = ImportedResourceBase;
|
|
16
|
+
class ResourceManager {
|
|
17
|
+
// resource manager holds all the imported root resources (code files, imported carts.)
|
|
18
|
+
constructor(items) {
|
|
19
|
+
this.items = items;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.ResourceManager = ResourceManager;
|
|
23
|
+
async function loadAllImports(project) {
|
|
24
|
+
// scan imports, select appropriate importer for each import,
|
|
25
|
+
// invoke importer to get ImportedResourceBase
|
|
26
|
+
// store in map of identifier -> ImportedResourceBase
|
|
27
|
+
const tasks = [];
|
|
28
|
+
for (const importDef of project.manifest.imports) {
|
|
29
|
+
(0, errorHandling_1.assert)(importDef.kind in manifestTypes_1.kImportKind.key);
|
|
30
|
+
const key = importDef.name;
|
|
31
|
+
switch (importDef.kind) {
|
|
32
|
+
case manifestTypes_1.kImportKind.key.Tic80Cartridge:
|
|
33
|
+
// invoke tic80 cart importer
|
|
34
|
+
const task = (0, tic80CartImporter_1.importTic80Cart)(project, importDef);
|
|
35
|
+
tasks.push(task);
|
|
36
|
+
break;
|
|
37
|
+
case manifestTypes_1.kImportKind.key.LuaCode:
|
|
38
|
+
// invoke lua code importer
|
|
39
|
+
throw new Error("LuaCode importer not implemented yet");
|
|
40
|
+
default:
|
|
41
|
+
throw new Error(`Unsupported import kind: ${importDef.kind}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const importedResources = await Promise.all(tasks);
|
|
45
|
+
const items = new Map();
|
|
46
|
+
for (let i = 0; i < importedResources.length; i++) {
|
|
47
|
+
const importDef = project.manifest.imports[i];
|
|
48
|
+
const resource = importedResources[i];
|
|
49
|
+
items.set(importDef.name, resource);
|
|
50
|
+
}
|
|
51
|
+
return new ResourceManager(items);
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=ImportedResource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImportedResource.js","sourceRoot":"","sources":["../../src/backend/ImportedResource.ts"],"names":[],"mappings":";AAAA,4CAA4C;;;AAwB5C,wCA+BC;AArDD,0DAAgD;AAChD,qEAAgE;AAChE,mDAAgE;AAEhE,EAAE;AACF,MAAa,QAAQ;CAEpB;AAFD,4BAEC;AAED,MAAa,oBAAoB;CAGhC;AAHD,oDAGC;AAED,MAAa,eAAe;IAE1B,uFAAuF;IACvF,YAAY,KAAwC;QAClD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AAND,0CAMC;AAEM,KAAK,UAAU,cAAc,CAAC,OAAyB;IAC5D,8DAA8D;IAC9D,+CAA+C;IAC/C,sDAAsD;IACtD,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,KAAK,MAAM,SAAS,IAAI,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACjD,IAAA,sBAAM,EAAC,SAAS,CAAC,IAAI,IAAI,2BAAW,CAAC,GAAG,CAAC,CAAC;QAC1C,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC;QAC3B,QAAQ,SAAS,CAAC,IAAI,EAAE,CAAC;YACvB,KAAK,2BAAW,CAAC,GAAG,CAAC,cAAc;gBACjC,6BAA6B;gBAC7B,MAAM,IAAI,GAAG,IAAA,mCAAe,EAAC,OAAO,EAAE,SAAS,CAAC,CAAC;gBACjD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACjB,MAAM;YACR,KAAK,2BAAW,CAAC,GAAG,CAAC,OAAO;gBAC1B,2BAA2B;gBAC3B,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;YAC1D;gBACE,MAAM,IAAI,KAAK,CAAC,4BAA4B,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;QAClE,CAAC;IACH,CAAC;IAED,MAAM,iBAAiB,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAgC,CAAC;IACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,iBAAiB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAClD,MAAM,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC9C,MAAM,QAAQ,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;QACtC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Tic80CartChunkTypeKey } from "../utils/tic80/tic80";
|
|
2
|
+
import { AssetReference, CodeAssemblyOptions } from "./manifestTypes";
|
|
3
|
+
import { TicbuildProjectCore } from "./projectCore";
|
|
4
|
+
export type ExternalDependency = {
|
|
5
|
+
path: string;
|
|
6
|
+
reason: string;
|
|
7
|
+
};
|
|
8
|
+
export declare abstract class ResourceViewBase {
|
|
9
|
+
abstract getDataForChunk(project: TicbuildProjectCore, chunkType: Tic80CartChunkTypeKey, options?: CodeAssemblyOptions): Uint8Array;
|
|
10
|
+
abstract getSupportedChunkTypes(): Tic80CartChunkTypeKey[];
|
|
11
|
+
abstract getParallelChunkTypes(): Tic80CartChunkTypeKey[];
|
|
12
|
+
}
|
|
13
|
+
export declare abstract class ImportedResourceBase {
|
|
14
|
+
abstract dump(): void;
|
|
15
|
+
abstract getView(project: TicbuildProjectCore, chunks?: Tic80CartChunkTypeKey[]): ResourceViewBase;
|
|
16
|
+
abstract getDependencyList(): ExternalDependency[];
|
|
17
|
+
}
|
|
18
|
+
export declare class ResourceManager {
|
|
19
|
+
items: Map<string, ImportedResourceBase>;
|
|
20
|
+
constructor(items: Map<string, ImportedResourceBase>);
|
|
21
|
+
getResourceView(project: TicbuildProjectCore, spec: AssetReference): ResourceViewBase;
|
|
22
|
+
getDependencyList(): ExternalDependency[];
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=ImportedResourceTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImportedResourceTypes.d.ts","sourceRoot":"","sources":["../../src/backend/ImportedResourceTypes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAGF,8BAAsB,gBAAgB;IACpC,QAAQ,CAAC,eAAe,CACtB,OAAO,EAAE,mBAAmB,EAC5B,SAAS,EAAE,qBAAqB,EAChC,OAAO,CAAC,EAAE,mBAAmB,GAC5B,UAAU;IACb,QAAQ,CAAC,sBAAsB,IAAI,qBAAqB,EAAE;IAC1D,QAAQ,CAAC,qBAAqB,IAAI,qBAAqB,EAAE;CAC1D;AAGD,8BAAsB,oBAAoB;IACxC,QAAQ,CAAC,IAAI,IAAI,IAAI;IAGrB,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,mBAAmB,EAAE,MAAM,CAAC,EAAE,qBAAqB,EAAE,GAAG,gBAAgB;IAElG,QAAQ,CAAC,iBAAiB,IAAI,kBAAkB,EAAE;CACnD;AAGD,qBAAa,eAAe;IAC1B,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;gBAE7B,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAIpD,eAAe,CAAC,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,cAAc,GAAG,gBAAgB;IAQrF,iBAAiB,IAAI,kBAAkB,EAAE;CAO1C"}
|