Compare commits

..

167 Commits

Author SHA1 Message Date
dependabot[bot]
0127237c37 build(deps): bump deps/fmt from e8259c5 to f575089
Bumps [deps/fmt](https://github.com/fmtlib/fmt) from `e8259c5` to `f575089`.
- [Release notes](https://github.com/fmtlib/fmt/releases)
- [Commits](e8259c5298...f575089243)

---
updated-dependencies:
- dependency-name: deps/fmt
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-01 18:53:40 +00:00
Edo
0ff101d2b9 build(ci): update workflow (#160) 2023-12-01 15:49:41 +01:00
Edo
5ac36a1ad5 build(std): fix compilation (#159) 2023-12-01 15:48:33 +01:00
INeedGames
0c19a9ac12 fix(arc): assembler label collision (#158) 2023-12-01 00:00:40 +01:00
Xenxo Espasandín
7dafeb2ba7 fix(gsc): file expr paths (#156) 2023-10-24 22:14:44 +02:00
INeedGames
4262836191 feat(arc): add optional arg for filename in gscobj header (#153) 2023-10-02 23:42:14 +02:00
Xenxo Espasandín
2fcbdadc89 build(deps): track zlib master (#154) 2023-10-02 22:43:19 +02:00
Xenxo Espasandín
891d3e32a3 feat(gsc): string literal sizeof (#150) 2023-09-24 14:36:27 +02:00
Xenxo Espasandín
aa2a2d36d9 feat(arc): waittill undefined param (#149) 2023-09-24 14:36:08 +02:00
dependabot[bot]
4a75b5daf2 build(deps): bump deps/zlib from 04f42ce to 79a0e44 (#147)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-04 09:17:57 +02:00
dependabot[bot]
1885928a90 build(deps): bump deps/fmt from 8a4bec5 to e8259c5 (#148)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-04 09:17:43 +02:00
quaK
9e14e72fc9 feature(iw6): add all iw6 tokens (#146) 2023-08-16 09:44:17 +02:00
dependabot[bot]
e87d2de342 build(deps): bump deps/fmt from de4705f to 8a4bec5 (#142)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-11 08:55:19 +02:00
Edo
d67f277a74 build: update (#145) 2023-08-11 08:54:57 +02:00
Edo
32b74d95c5 feat(arc): update t6 hash list (#144) 2023-08-11 08:53:59 +02:00
Edo
654ffb2a55 fix(arc): address compiler regression (#141) 2023-07-28 08:22:33 +02:00
dependabot[bot]
91adc1a764 build(deps): bump deps/fmt from 686b335 to de4705f (#140)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-28 08:22:03 +02:00
Edo
db02851040 build(ci): turn off symbols to save space (#139) 2023-07-01 14:26:49 +02:00
Edo
280b4a4670 build(linux): arm64 - remove mold linker (#137) 2023-06-29 22:11:49 +02:00
Edo
a385156f8a refactor(asset): Use the proper STL function to 0-fill vector (#138) 2023-06-29 20:47:24 +02:00
Edo
ecb9574fc3 fix(h1): swap sayteam and sayall methods (#136) 2023-06-29 17:49:07 +02:00
Edo
5c5c4a32db build(ci): macos arm64 (#134)
Co-authored-by: xensik <xensik@pm.me>
2023-06-25 16:48:45 +02:00
Xenxo Espasandín
b7abc97c06 fix(build): branch name (#131) 2023-06-15 00:02:48 +02:00
Xenxo Espasandín
bc966e5a89 maint(build): github actions deploy (#130) 2023-06-14 23:12:51 +02:00
Xenxo Espasandín
1641e4c1e1 maint(build): new version system (#129) 2023-06-13 15:40:54 +02:00
Xenxo Espasandín
ec340df654 maint(build): use premake actions (#128) 2023-06-12 23:21:43 +02:00
quaK
73e6f83ad1 fix(s1): mislabeled method (#127) 2023-06-11 16:31:17 +02:00
dependabot[bot]
1b923784fc build(deps): bump deps/fmt from 2c991e1 to 686b335 (#126)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-01 23:08:31 +02:00
Xenxo Espasandín
c4dcd0165e fix(arc): assembler use after free (#125) 2023-05-19 13:02:07 +02:00
Xenxo Espasandín
908564a182 fix(arc): refactor regressions & func objects (#123) 2023-05-15 17:33:52 +02:00
Xenxo Espasandín
c1eb9b0c9b fix(t6): assemble hash & endswitch (#122) 2023-05-15 13:08:21 +02:00
Xenxo Espasandín
900fe95462 fix(arc): handle namespaces & hashes (#121) 2023-05-14 17:41:06 +02:00
xensik
40f9e5a4b2 build(ci): only prod for appveyor 2023-05-13 19:46:03 +02:00
Xenxo Espasandín
1b72759cf5 refactor(arc): treyarch games & minor fixes (#119) 2023-05-13 19:24:57 +02:00
dependabot[bot]
5b0867f218 build(deps): bump deps/fmt from e7f6888 to 2c991e1 (#115)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-09 22:34:44 +02:00
dependabot[bot]
a433dda772 build(deps): bump deps/fmt from 4e3f381 to e7f6888 (#114)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-08 22:29:45 +02:00
Xenxo Espasandín
f85be26ba9 refactor(gsc): simplify and clean ast (#99) 2023-04-05 17:09:21 +02:00
dependabot[bot]
1a127eb342 build(deps): bump deps/fmt from 9869971 to 4e3f381 (#98)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-04 22:00:16 +02:00
Edo
d3690ff006 fix(preprocessor): initialize tm structure (#96) 2023-04-02 21:24:56 +02:00
Edo
cb339d6ae3 feat(preprocessor): date & time macro (#92) 2023-03-29 15:45:50 +02:00
Edo
68ff757f96 maint(cpp): use correct macro detection for format feature (#87) 2023-03-06 12:34:13 +01:00
Xenxo Espasandín
e0dacaab85 refactor(global): headers & arc module (#86) 2023-03-02 16:41:32 +01:00
dependabot[bot]
d27653ad9c build(deps): bump deps/fmt from 3a69529 to 9869971 (#84)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-28 21:42:57 +01:00
Xenxo Espasandín
456258604e refactor(headers): cleanup (#83) 2023-02-28 16:32:53 +01:00
Edo
d62f9e2c8a maint(api): add iw6 & s1 (#82) 2023-02-28 13:02:29 +01:00
Edo
89a6429913 feat(github): CI linux build (#81) 2023-02-27 23:14:27 +01:00
Xenxo Espasandín
fc1ddeb4e7 refactor(std): use format on windows (#80) 2023-02-27 20:09:31 +01:00
dependabot[bot]
b81f96d209 build(deps): bump deps/fmt from d646fd0 to 3a69529 (#77)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-24 22:24:19 +01:00
Xenxo Espasandín
e69ab1ae9f fix(api): relative paths (#78) 2023-02-24 20:05:21 +01:00
Xenxo Espasandín
a599f04ea7 new(api): include header (#76) 2023-02-24 17:45:56 +01:00
Xenxo Espasandín
164b125bf2 feature(gsc): instance & iw9 path (#73) 2023-02-19 17:57:25 +01:00
dependabot[bot]
8423d296ad build(deps): bump deps/fmt from e03753c to d646fd0 (#72)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-17 21:08:32 +01:00
Xenxo Espasandín
8e7170d058 feature(iw9): compiler builtins (#71) 2023-02-17 18:56:19 +01:00
Xenxo Espasandín
99fb7f24ba feature(preprocessor): function-like macros (#70) 2023-02-17 16:44:38 +01:00
Xenxo Espasandín
4f83e351d8 feature(parser): empty decl (#69) 2023-02-14 20:53:53 +01:00
Xenxo Espasandín
8ccd22131a fix(gsc): wait dump (#68) 2023-02-13 22:48:10 +01:00
dependabot[bot]
6ce07d7ff3 Bump deps/fmt from 655046d to e03753c (#66)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-13 21:54:05 +01:00
Xenxo Espasandín
576b613188 update(github): funding (#67) 2023-02-13 21:53:04 +01:00
Xenxo Espasandín
1c31089351 fix(gsc): cleanup (#65) 2023-02-12 17:21:58 +01:00
Xenxo Espasandín
f99a56542a fix(gsc): use vector for rawfile (#64) 2023-02-12 15:58:24 +01:00
Xenxo Espasandín
817c07dabf refactor(gsc): remove static allocations (#63) 2023-02-12 12:56:27 +01:00
Xenxo Espasandín
18d2b89358 fix(writer): reset buffer pointer (#62) 2023-02-11 23:52:40 +01:00
Xenxo Espasandín
a05cadf843 fix(compiler): reset scopes (#61) 2023-02-11 22:43:21 +01:00
dependabot[bot]
e108b537e0 Bump deps/fmt from 581c629 to 655046d (#59)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-11 13:26:01 +01:00
Xenxo Espasandín
ed35ad9c73 fix(iw5): console reference opcodes (#60) 2023-02-11 00:16:00 +01:00
dependabot[bot]
db0bf9af24 Bump deps/fmt from 05e3a92 to 581c629 (#58)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-10 12:46:51 +01:00
simon
ccdf404feb feature(iw7): builtins & tokens additions (#47) 2023-02-10 12:45:52 +01:00
Xenxo Espasandín
1307897a1f fix(s1): mislabeled function (#56) 2023-02-04 17:07:26 +01:00
quaK
b2d5efad0b feature(s1): method and function additions/fixes (#55) 2023-02-03 00:49:09 +01:00
Xenxo Espasandín
1dac9413ac feature(tool): rename command (#54) 2023-02-03 00:16:25 +01:00
m
742a7bf2e9 feature(s1): token changes and fixes (#53)
Co-authored-by: quaK <Joel.rautavuori@gmail.com>
2023-02-02 22:28:15 +01:00
m
1581bac571 feature(s1): token list update (#51) 2023-02-01 18:41:26 +01:00
Xenxo Espasandín
5693d3fcd0 feature(parser): deprecate constants & add asserts (#52) 2023-02-01 16:39:46 +01:00
Xenxo Espasandín
bf92756d2b feature(xlabs): export builtin maps (#50) 2023-01-31 14:53:49 +01:00
dependabot[bot]
f7f3a33d0e Bump deps/fmt from 70db193 to 05e3a92 (#49)
Bumps [deps/fmt](https://github.com/fmtlib/fmt) from `70db193` to `05e3a92`.
- [Release notes](https://github.com/fmtlib/fmt/releases)
- [Commits](70db193f09...05e3a9233a)

---
updated-dependencies:
- dependency-name: deps/fmt
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-31 12:26:32 +01:00
xensik
5297742d6a fix deploy 2023-01-30 16:05:26 +01:00
dependabot[bot]
b844c7154b Bump deps/fmt from a337011 to 70db193 (#46)
Bumps [deps/fmt](https://github.com/fmtlib/fmt) from `a337011` to `70db193`.
- [Release notes](https://github.com/fmtlib/fmt/releases)
- [Commits](a33701196a...70db193f09)

---
updated-dependencies:
- dependency-name: deps/fmt
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-30 13:49:35 +01:00
Xenxo Espasandín
8d9bb51039 feature(preprocessor): implement preprocessor & parse command (#48) 2023-01-30 13:48:27 +01:00
xensik
9059f3b04f slash paths and compound stmt 2023-01-24 12:53:39 +01:00
Xenxo Espasandín
b6f089d115 feature(refactor): big update (#41) 2023-01-23 23:31:08 +01:00
xensik
8643771f66 fix workflow 2023-01-16 19:11:45 +01:00
Edo
d755f7788b feature(github): add workflow (#40)
feature(workflow): add GitHub actions
2023-01-10 12:49:05 +01:00
xensik
105297aeaa feat(iw9): file hashes 2022-11-18 15:58:14 +01:00
xensik
0682199e84 feat(iw9): reverse hash generator 2022-11-18 15:57:13 +01:00
xensik
87a36d75a6 fix(iw9): foreach with index 2022-11-18 12:31:30 +01:00
xensik
492c5e7347 fix(iw9): default case & gen hash map 2022-11-17 16:17:22 +01:00
xensik
7357fef577 fix(iw9): new xhash opcodes & thread calls 2022-11-16 23:44:32 +01:00
xensik
bff02e6a75 update readme 2022-11-16 23:42:58 +01:00
xensik
ce69051956 iw9: impl hashing & missing opcodes 2022-11-16 18:23:30 +01:00
xensik
ad29da7bf3 iw9: disassembler & decompiler 2022-11-16 13:52:26 +01:00
xensik
17a0b789c4 iw9: opcode reversing 2022-11-14 16:06:50 +01:00
xensik
57ef733af4 feat(iw9): template 2022-11-14 11:06:41 +01:00
xensik
996aebef38 fix(t6): allow expr for default params 2022-11-10 19:32:57 +01:00
xensik
6986b49547 update h1 data 2022-11-10 19:26:11 +01:00
dependabot[bot]
92dd3eaec4 Bump deps/zlib from 21767c6 to 04f42ce (#35)
Bumps [deps/zlib](https://github.com/madler/zlib) from `21767c6` to `04f42ce`.
- [Release notes](https://github.com/madler/zlib/releases)
- [Commits](21767c654d...04f42ceca4)

---
updated-dependencies:
- dependency-name: deps/zlib
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-01 21:45:31 +01:00
Alex
14b9b4c4da add s1 built-ins and tokens (#37)
* add s1 builtins and tokens
2022-11-01 21:37:18 +01:00
xensik
c285027144 more IW6 tokens 2022-11-01 21:13:35 +01:00
xensik
3e4818c026 add missing flags & keywords 2022-10-21 20:49:27 +02:00
xensik
e9245fdb79 fix t6 export flags 2022-10-21 19:18:07 +02:00
xensik
bf169d78fd add treyarch const locals 2022-10-20 17:19:34 +02:00
xensik
04684d4324 add treyarch visibility flags 2022-10-15 16:20:48 +02:00
xensik
fe1889b243 add treyarch default parameters 2022-10-15 14:49:29 +02:00
xensik
d433fd7d7b add treyarch animtrees & fix nested switches 2022-10-14 19:05:35 +02:00
xensik
5093173549 fix compiler animtree bug 2022-10-04 22:35:56 +02:00
xensik
caef54f50d update h2 symbols 2022-10-04 22:35:24 +02:00
xensik
d59404b67c update iw6 symbols 2022-10-03 20:17:02 +02:00
xensik
92ad066565 fix T6 vectors 2022-10-03 12:46:34 +02:00
xensik
a42c4fa625 fix bugs for PS3 & Xbox 360 games 2022-09-30 19:40:20 +02:00
xensik
7c07251b8c added console string id count 2022-09-28 13:24:59 +02:00
xensik
fba2b92bda console support for iw6 & s1 (need fixes) 2022-09-22 12:57:11 +02:00
xensik
3c57eb9e2e update readme 2022-09-20 17:05:59 +02:00
xensik
2b870a9791 iw5 console symbols 2022-09-19 16:54:22 +02:00
xensik
49c770414a cleanup 2022-09-16 18:05:58 +02:00
xensik
79016a997e update resolvers 2022-09-13 16:22:14 +02:00
Diavolo
089895281f add some tokens to s1 2022-09-13 14:58:36 +02:00
xensik
a286f52fed t6 clean code 2022-09-09 22:56:57 +02:00
xensik
71818f0aa3 h1 methods fix & add builtins 2022-08-30 19:18:21 +02:00
xensik
d8a651a844 fix waitframe opcodes 2022-08-26 00:19:22 +02:00
xensik
f3c707a769 h1 all tokens and meth fixes 2022-08-25 23:48:08 +02:00
xensik
508e0b769f 10k more symbols 2022-08-25 18:30:58 +02:00
xensik
34f530b7ab more h1 symbols 2022-08-25 14:10:33 +02:00
xensik
080a87ba6e h1 func list fixes 2022-08-24 22:13:44 +02:00
xensik
53824824c0 more h1 symbols 2022-08-24 18:43:58 +02:00
xensik
5ab159d5f6 update h1 symbols 2022-08-24 18:15:31 +02:00
xensik
f1d75f329c update supported platforms 2022-08-23 15:59:29 +02:00
xensik
04d9e4848f update README 2022-08-23 14:10:07 +02:00
xensik
b04434a3cb iw5 console interface 2022-08-23 14:07:32 +02:00
xensik
3b53157c6d update build script 2022-08-23 13:49:51 +02:00
xensik
828bce678a rename module 2022-08-23 13:48:57 +02:00
xensik
475c0c323c update gen scripts 2022-08-23 13:47:49 +02:00
xensik
71a3e25be4 ps3 & xbox360 support for iw5 2022-08-22 12:03:44 +02:00
xensik
9f465644d4 fix warning 2022-08-22 12:02:59 +02:00
xensik
baf3f227f1 update iw5 data 2022-08-11 12:45:35 +02:00
xensik
ed6137a7d7 optimize compiler test jumps 2022-08-08 11:55:33 +02:00
xensik
c9986cc25a iw8 compiler encrypted strings support 2022-08-07 22:36:38 +02:00
xensik
7b1fdea6b7 rework endswitch disassemble 2022-08-06 15:53:03 +02:00
xensik
c0580ef14a change float and default case dissasemble 2022-08-06 14:12:29 +02:00
xensik
f197fb160d fix iw8 encrypted switch string 2022-08-05 20:05:40 +02:00
xensik
d8498adbc2 hotfix iw8 encrypted strings 2022-08-03 17:21:34 +02:00
xensik
ec4c23cc7b update iw8 id count 2022-08-03 17:18:04 +02:00
xensik
7d79fa1d91 fix decompiler empty switch cases 2022-07-29 11:43:07 +02:00
xensik
55021cb3ec cleanup + compiler tuple syntax 2022-07-22 20:33:10 +02:00
xensik
628749631b finish decompiler loop statements 2022-07-19 13:50:12 +02:00
xensik
18db7e071a kekw 2022-07-19 13:49:13 +02:00
xensik
15f76542b1 add h2 foreach tokens 2022-07-19 13:49:05 +02:00
xensik
73ed709fed fix h2 jump offsets 2022-07-19 13:48:08 +02:00
xensik
4fec6cda20 h1 files mapped 2022-07-18 18:13:57 +02:00
xensik
66b5c82840 more iw5 symbols 2022-07-17 20:13:28 +02:00
xensik
a16c70bd54 decompiler support for tuples 2022-07-17 13:49:31 +02:00
xensik
328961ee83 improve decompiler empty blocks & do-while bug 2022-07-16 20:58:59 +02:00
xensik
8e5cea1af7 update h2 symbols 2022-07-16 19:57:50 +02:00
xensik
4d6d9916bf update README 2022-07-16 19:55:31 +02:00
xensik
1a5e39fa0e more functions mapping 2022-07-16 10:44:31 +02:00
xensik
de254a1293 update h1 symbols 2022-07-16 09:21:11 +02:00
xensik
dcff855efb more iw5 sp symbols 2022-07-15 16:32:40 +02:00
xensik
bbce74f47a improve decompiler last stmt detection, loop locals 2022-07-15 16:31:05 +02:00
xensik
2c0a5dce18 update gitignore 2022-07-15 16:16:01 +02:00
xensik
89e34cd3a1 fix warnings 2022-07-14 21:23:29 +02:00
xensik
7eed6f45f8 fix decompiler bugs (inf loops, waittillmatch) 2022-07-14 21:17:59 +02:00
xensik
5eb63e3284 improve iw5 decompilation 2022-07-14 19:04:16 +02:00
xensik
05fc8a7421 prepare iw5 sp/so symbols 2022-07-14 15:31:58 +02:00
xensik
ec91109cc3 impl negate expression properly 2022-06-15 17:06:58 +02:00
xensik
0ec0b4d6f5 [IW] added negative variable expression 2022-06-08 12:05:16 +02:00
xensik
6a0419b5bf [T6] added negative variable expression 2022-06-06 15:32:01 +02:00
xensik
f53fb4fe47 t6: fix decompiler loop bug 2022-05-24 20:11:47 +02:00
dependabot[bot]
b6777295a1 Bump deps/zlib from 53ce271 to 21767c6
Bumps [deps/zlib](https://github.com/madler/zlib) from `53ce271` to `21767c6`.
- [Release notes](https://github.com/madler/zlib/releases)
- [Commits](53ce271311...21767c654d)

---
updated-dependencies:
- dependency-name: deps/zlib
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-24 16:48:57 +02:00
Xenxo Espasandín
b1ad170030 Create dependabot.yml 2022-05-24 16:40:24 +02:00
219 changed files with 3445 additions and 3962 deletions

7
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: "gitsubmodule"
directory: "/"
schedule:
interval: "monthly"
open-pull-requests-limit: 10

View File

@ -1,4 +1,4 @@
name: Main
name: Build
on:
push:
@ -69,7 +69,7 @@ jobs:
build-macos:
name: Build macOS
runs-on: macos-13
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
@ -86,16 +86,6 @@ jobs:
fetch-depth: 0
lfs: false
- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Install LLVM
run: brew install llvm
- name: Add LLVM to PATH
run: |
echo "/usr/local/opt/llvm/bin" >> $GITHUB_PATH
- name: Add premake5 to PATH
uses: abel0b/setup-premake@v2.3
with:
@ -129,7 +119,7 @@ jobs:
- release
arch:
- x64
# - arm64
- arm64
steps:
- name: Check out files
uses: actions/checkout@v4
@ -138,15 +128,11 @@ jobs:
fetch-depth: 0
lfs: false
- name: Install LLVM
- name: Install dependencies (arm64)
if: matrix.arch == 'arm64'
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 17
# - name: Install dependencies (arm64)
# if: matrix.arch == 'arm64'
# run: sudo apt-get install crossbuild-essential-arm64 -y
sudo apt-get update
sudo apt-get install crossbuild-essential-arm64 -y
- name: Add premake5 to PATH
uses: abel0b/setup-premake@v2.3
@ -164,8 +150,8 @@ jobs:
pushd build
make config=${{matrix.config}}_${{matrix.arch}} -j$(nproc)
env:
CC: clang-17
CXX: clang++-17
CC: clang
CXX: clang++
- name: Upload ${{matrix.arch}} ${{matrix.config}} binaries
uses: actions/upload-artifact@v3.1.3
@ -178,28 +164,15 @@ jobs:
name: Deploy Release
runs-on: ubuntu-latest
needs: [ build-windows, build-macos, build-linux ]
if: startsWith(github.ref, 'refs/tags/')
if: startsWith(github.ref, 'refs/tags/') && (github.event.base_ref == 'refs/heads/prod' || github.event.base_ref == 'refs/heads/dev')
steps:
- name: Checkout Source
- name: Check out files
uses: actions/checkout@v4
with:
sparse-checkout: |
Dockerfile
sparse-checkout-cone-mode: false
- name: Download Binaries
uses: actions/download-artifact@v3
- name: Compress Binaries
run: |
for dir in */; do
if [[ $dir == *"windows"* ]]; then
cd "$dir" && zip -r "../${dir%/}.zip" . && cd ..
else
tar -czvf "${dir%/}.tar.gz" -C "$dir" .
fi
done
shell: bash
uses: actions/download-artifact@v3.0.2
with:
name: windows-x64-release
- name: Create Release
uses: "marvinpinto/action-automatic-releases@latest"
@ -208,13 +181,4 @@ jobs:
prerelease: false
draft: true
files: |
*.zip
*.tar.gz
- name: Build and Publish Docker Image
uses: VaultVulp/gp-docker-action@1.6.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
image-name: gsc-tool
extract-git-tag: true
additional-image-tags: latest
gsc-tool.exe

6
.gitmodules vendored
View File

@ -2,6 +2,6 @@
path = deps/zlib
url = https://github.com/madler/zlib
branch = master
[submodule "deps/cxxopts"]
path = deps/cxxopts
url = https://github.com/jarro2783/cxxopts.git
[submodule "deps/fmt"]
path = deps/fmt
url = https://github.com/fmtlib/fmt

View File

@ -1,10 +0,0 @@
FROM alpine:3.19
RUN apk add --no-cache gcompat libstdc++
COPY --chmod=755 ./linux-x64-release/gsc-tool /usr/local/bin/
RUN addgroup -S gsc-tool && adduser -S gsc-tool -G gsc-tool
USER gsc-tool
ENTRYPOINT ["/usr/local/bin/gsc-tool"]

View File

@ -1,7 +1,6 @@
[![sonar](https://sonarcloud.io/api/project_badges/measure?project=xensik_gsc-tool&metric=alert_status)](https://sonarcloud.io/summary/overall?id=xensik_gsc-tool)
[![build](https://github.com/xensik/gsc-tool/workflows/Build/badge.svg)](https://github.com/xensik/gsc-tool/actions)
![license](https://img.shields.io/github/license/xensik/gsc-tool.svg)
[![issues](https://img.shields.io/github/issues/xensik/gsc-tool)](https://github.com/xensik/gsc-tool/issues)
[![license](https://img.shields.io/github/license/xensik/gsc-tool.svg)](https://github.com/xensik/gsc-tool/blob/dev/LICENSE)
[![releases](https://img.shields.io/github/v/release/xensik/gsc-tool)](https://github.com/xensik/gsc-tool/releases)
[![paypal](https://img.shields.io/badge/PayPal-support-blue.svg?logo=paypal)](https://www.paypal.me/xensik)
@ -23,30 +22,20 @@ A utility to compile & decompile IW engine game scripts.
- **T7** *(Call of Duty: Black Ops III)* `PC` *(Decompiler)*
- **T8** *(Call of Duty: Black Ops 4)* ***\*WIP\****
- **T9** *(Call of Duty: Black Ops Cold War)* ***\*WIP\****
- **JUP** *(Call of Duty: Modern Warfare III (2023)* ***\*WIP\****
## Usage
``gsc-tool [OPTIONS..] <path>``
``./gsc-tool.exe <mode> <game> <system> <path>``
- **path**: file or directory to process
**mode**: `asm`, `disasm`, `comp`, `decomp`, `parse`
- *note:* zonetool files (*.cgsc*, *.cgsc.stack*) use: `zasm`, `zdisasm`, `zcomp`, `zdecomp` modes
- **options:**
**game**: `iw5`, `iw6`, `iw7`, `iw8`, `iw9`, `s1`, `s2`, `s4`, `h1`, `h2`, `t6` `t7` `t8` `t9`
``-m, --mode <mode>`` [REQUIRED] one of: `asm`, `disasm`, `comp`, `decomp`, `parse`
**system**: `pc`, `ps3`, `ps4`, `ps5`, `xb2` (*360*), `xb3` (*One*), `xb4` (*Series X|S*), `wiiu`
``-g, --game <game>`` [REQUIRED] one of: `iw5`, `iw6`, `iw7`, `iw8`, `iw9`, `s1`, `s2`, `s4`, `h1`, `h2`, `t6` `t7` `t8` `t9` `jup`
**path**: `file` or `directory` (recursive process all files inside the directory)
``-s, --system <system>`` [REQUIRED] one of: `pc`, `ps3`, `ps4`, `ps5`, `xb2` (*360*), `xb3` (*One*), `xb4` (*Series X|S*), `wiiu`
``-d, --dev`` Enable developer mode (dev blocks & generate bytecode map).
``-z, --zonetool`` Enable zonetool mode (use .cgsc files).
``-h, --help`` Display help.
``-v, --version`` Display version.
Example: ``gsc-tool -m comp -g iw5 -s pc ./data/iw5/my_fancy_script.gsc``
Example: ``./gsc-tool.exe comp iw5 pc ./data/iw5/my_fancy_script.gsc``
| Mode |Description | Output |
|:---------|:--------------------------|:------------|
@ -59,14 +48,13 @@ Example: ``gsc-tool -m comp -g iw5 -s pc ./data/iw5/my_fancy_script.gsc``
## File Format
If you need to extract scripts from fastfiles or game memory, use [Zonetool](https://github.com/ZoneTool/zonetool) or [Jekyll](https://github.com/EthanC/Jekyll).
- gsc-tool `.gscbin` binary format is a serialized ScriptFile struct: <br/>
- ***magic***: `"GSC\0"` 4 byte <br/>
- ***compressedLen***: 4 byte usigned integer <br/>
- ***len***: 4 byte usigned integer <br/>
- ***bytecodeLen***: 4 byte usigned integer <br/>
- ***buffer***: byte array[compressedLen] <br/>
- ***bytecode***: byte array[bytecodeLen] <br/>
- gsc-tool `.gscbin` format is a serialized ScriptFile struct: <br/>
***name***: null-terminated string <br/>
***compressedLen***: 4 byte uint <br/>
***len***: 4 byte uint <br/>
***bytecodeLen***: 4 byte uint <br/>
***buffer***: byte array[compressedLen] <br/>
***bytecode***: byte array[bytecodeLen] <br/>
note: for PS3 & Xbox 360 `.gscbin` files *(compressedLen, len, bytecodeLen)* are saved as little-endian!!

1
deps/cxxopts vendored

@ -1 +0,0 @@
Subproject commit eb787304d67ec22f7c3a184ee8b4c481d04357fd

11
deps/cxxopts.lua vendored
View File

@ -1,11 +0,0 @@
cxxopts = { base = path.join(dependencies.base, "cxxopts") }
function cxxopts:include()
includedirs { path.join(cxxopts.base, "include") }
end
function cxxopts:link()
self:include()
end
table.insert(dependencies, cxxopts)

1
deps/fmt vendored Submodule

@ -0,0 +1 @@
Subproject commit f5750892436a667fe622e5ecc8a02c15a5d9bc88

31
deps/fmt.lua vendored Normal file
View File

@ -0,0 +1,31 @@
fmt = { base = path.join(dependencies.base, "fmt") }
function fmt:include()
includedirs { path.join(fmt.base, "include") }
end
function fmt:link()
links { "fmt" }
self:include()
end
function fmt:project()
project "fmt"
kind "StaticLib"
language "C++"
self:include()
files
{
path.join(fmt.base, "include/fmt/*.h"),
path.join(fmt.base, "src/*.cc")
}
removefiles
{
path.join(fmt.base, "src/fmt.cc")
}
end
table.insert(dependencies, fmt)

26
deps/zlib.lua vendored
View File

@ -15,24 +15,24 @@ function zlib:project()
language "C"
warnings "off"
if os.istarget("linux") or os.istarget("macosx") then
defines {
"HAVE_UNISTD_H"
}
elseif os.istarget("windows") then
defines {
"_CRT_SECURE_NO_WARNINGS",
"_CRT_NONSTDC_NO_DEPRECATE",
"_CRT_SECURE_NO_DEPRECATE",
}
end
self:include()
files {
files
{
path.join(zlib.base, "*.h"),
path.join(zlib.base, "*.c")
}
defines
{
"_CRT_SECURE_NO_WARNINGS",
"_CRT_NONSTDC_NO_DEPRECATE",
"_CRT_SECURE_NO_DEPRECATE",
}
if os.istarget("darwin") then
defines "HAVE_UNISTD_H"
end
end
table.insert(dependencies, zlib)

View File

@ -1,4 +1,4 @@
/* Copyright 2024 xensik. All rights reserved.
/* Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -63,7 +63,6 @@ namespace xsk::arc
%token ENDON "endon"
%token NOTIFY "notify"
%token WAIT "wait"
%token WAITREALTIME "waitrealtime"
%token WAITTILL "waittill"
%token WAITTILLMATCH "waittillmatch"
%token WAITTILLFRAMEEND "waittillframeend"
@ -184,7 +183,6 @@ namespace xsk::arc
%type <stmt_endon::ptr> stmt_endon
%type <stmt_notify::ptr> stmt_notify
%type <stmt_wait::ptr> stmt_wait
%type <stmt_waitrealtime::ptr> stmt_waitrealtime
%type <stmt_waittill::ptr> stmt_waittill
%type <stmt_waittillmatch::ptr> stmt_waittillmatch
%type <stmt_waittillframeend::ptr> stmt_waittillframeend
@ -359,7 +357,6 @@ stmt
| stmt_endon { $$ = std::move($1); }
| stmt_notify { $$ = std::move($1); }
| stmt_wait { $$ = std::move($1); }
| stmt_waitrealtime { $$ = std::move($1); }
| stmt_waittill { $$ = std::move($1); }
| stmt_waittillmatch { $$ = std::move($1); }
| stmt_waittillframeend { $$ = std::move($1); }
@ -465,11 +462,6 @@ stmt_wait
{ $$ = stmt_wait::make(@$, std::move($2)); }
;
stmt_waitrealtime
: WAITREALTIME expr SEMICOLON
{ $$ = stmt_waitrealtime::make(@$, std::move($2)); }
;
stmt_waittill
: expr_object WAITTILL LPAREN expr COMMA expr_arguments_no_empty RPAREN SEMICOLON
{ $$ = stmt_waittill::make(@$, std::move($1), std::move($4), std::move($6)); }
@ -517,13 +509,13 @@ stmt_for
stmt_foreach
: FOREACH LPAREN expr_identifier IN expr RPAREN stmt
{
auto array = expr_identifier::make(@$, std::format("_a{}", ++index));
auto key = expr_identifier::make(@$, std::format("_k{}", ++index));
auto array = expr_identifier::make(@$, fmt::format("_a{}", ++index));
auto key = expr_identifier::make(@$, fmt::format("_k{}", ++index));
$$ = stmt_foreach::make(@$, std::move($5), std::move($3), std::move(array), std::move(key), std::move($7), false);
}
| FOREACH LPAREN expr_identifier COMMA expr_identifier IN expr RPAREN stmt
{
auto array = expr_identifier::make(@$, std::format("_a{}", ++index));
auto array = expr_identifier::make(@$, fmt::format("_a{}", ++index));
$$ = stmt_foreach::make(@$, std::move($7), std::move($5), std::move(array), std::move($3), std::move($9), true);
}
;
@ -1161,7 +1153,7 @@ auto map_token(context const* ctx_, token& tok) -> parser::symbol_type
}
}
throw error(std::format("unmapped token! {}", (u8)tok.type));
throw error(fmt::format("unmapped token! {}", (u8)tok.type));
}
auto ARClex(context const* ctx_, preprocessor& ppr) -> parser::symbol_type
@ -1238,7 +1230,6 @@ std::unordered_map<token::kind, parser::token::token_kind_type> const tok_to_par
{ token::ENDON, parser::token::ENDON },
{ token::NOTIFY, parser::token::NOTIFY },
{ token::WAIT, parser::token::WAIT },
{ token::WAITREALTIME, parser::token::WAITREALTIME },
{ token::WAITTILL, parser::token::WAITTILL },
{ token::WAITTILLMATCH, parser::token::WAITTILLMATCH },
{ token::WAITTILLFRAMEEND, parser::token::WAITTILLFRAMEEND },
@ -1298,7 +1289,6 @@ std::unordered_map<std::string_view, parser::token::token_kind_type> const keywo
{ "endon", parser::token::ENDON },
{ "notify", parser::token::NOTIFY },
{ "wait", parser::token::WAIT },
{ "waitrealtime", parser::token::WAITREALTIME},
{ "waittill", parser::token::WAITTILL },
{ "waittillmatch", parser::token::WAITTILLMATCH },
{ "waittillframeend", parser::token::WAITTILLFRAMEEND },

View File

@ -1,4 +1,4 @@
/* Copyright 2024 xensik. All rights reserved.
/* Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -321,7 +321,7 @@ decl_constant
: expr_identifier ASSIGN expr SEMICOLON
{
ppr.ban_header(@$); $$ = decl_constant::make(@$, std::move($1), std::move($3));
printf("%s" , std::format("{}: constants deprecated, use #define instead\n", @$.print()).data());
printf("%s" , fmt::format("{}: constants deprecated, use #define instead\n", @$.print()).data());
}
;
@ -496,14 +496,14 @@ stmt_for
stmt_foreach
: FOREACH LPAREN expr_identifier IN expr RPAREN stmt
{
auto array = expr_identifier::make(@$, std::format("_temp_{}", ++index));
auto key = expr_identifier::make(@$, std::format("_temp_{}", ++index));
auto array = expr_identifier::make(@$, fmt::format("_temp_{}", ++index));
auto key = expr_identifier::make(@$, fmt::format("_temp_{}", ++index));
$$ = stmt_foreach::make(@$, std::move($5), std::move($3), expr_empty::make(@$), std::move(array), std::move(key), std::move($7), false);
}
| FOREACH LPAREN expr_identifier COMMA expr_identifier IN expr RPAREN stmt
{
auto array = expr_identifier::make(@$, std::format("_temp_{}", ++index));
expr::ptr key = (ctx_->props() & props::foreach) ? expr_identifier::make(@$, std::format("_temp_{}", ++index)) : std::move($3);
auto array = expr_identifier::make(@$, fmt::format("_temp_{}", ++index));
expr::ptr key = (ctx_->props() & props::foreach) ? expr_identifier::make(@$, fmt::format("_temp_{}", ++index)) : std::move($3);
$$ = stmt_foreach::make(@$, std::move($7), std::move($5), (ctx_->props() & props::foreach) ? std::move($3) : (expr::ptr)expr_empty::make(@$), std::move(array), std::move(key), std::move($9), true);
}
;
@ -821,7 +821,7 @@ expr_tuple
: LBRACKET expr_tuple_arguments RBRACKET
{
$$ = std::move($2);
$$->as<expr_tuple>().temp = expr_identifier::make($$->loc(), std::format("_temp_{}", ++index));
$$->as<expr_tuple>().temp = expr_identifier::make($$->loc(), fmt::format("_temp_{}", ++index));
}
;
@ -1088,7 +1088,7 @@ auto map_token(context const* ctx_, token& tok) -> parser::symbol_type
}
}
throw error(std::format("unmapped token! {}", (u8)tok.type));
throw error(fmt::format("unmapped token! {}", (u8)tok.type));
}
auto GSClex(context const* ctx_, preprocessor& ppr) -> parser::symbol_type

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -17,17 +17,15 @@ class assembler
function const* func_;
assembly const* assembly_;
utils::writer script_;
utils::writer devmap_;
std::unordered_map<std::string, u16> strpool_;
std::vector<export_ref> exports_;
std::vector<import_ref> imports_;
std::vector<string_ref> strings_;
std::vector<animtree_ref> anims_;
u32 devmap_count_;
public:
assembler(context const* ctx);
auto assemble(assembly const& data, std::string const& name = {}) -> std::pair<buffer, buffer>;
auto assemble(assembly const& data, std::string const& name = {}) -> buffer;
private:
auto assemble_function(function& func) -> void;

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -158,19 +158,12 @@ enum class opcode : u8
OP_Count,
};
struct sourcepos
{
u16 line;
u16 column;
};
struct instruction
{
using ptr = std::unique_ptr<instruction>;
u32 index;
u32 size;
sourcepos pos;
opcode opcode;
std::vector<std::string> data;

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -88,10 +88,10 @@ struct node
stmt_endon,
stmt_notify,
stmt_wait,
stmt_waitrealtime,
stmt_waittill,
stmt_waittillmatch,
stmt_waittillframeend,
stmt_waitrealtime,
stmt_if,
stmt_ifelse,
stmt_while,
@ -1001,16 +1001,6 @@ struct stmt_wait : public stmt
XSK_ARC_AST_MAKE(stmt_wait)
};
struct stmt_waitrealtime : public stmt
{
using ptr = std::unique_ptr<stmt_waitrealtime>;
expr::ptr time;
stmt_waitrealtime(location const& loc, expr::ptr time);
XSK_ARC_AST_MAKE(stmt_waitrealtime)
};
struct stmt_waittill : public stmt
{
using ptr = std::unique_ptr<stmt_waittill>;
@ -1043,6 +1033,16 @@ struct stmt_waittillframeend : public stmt
XSK_ARC_AST_MAKE(stmt_waittillframeend)
};
struct stmt_waitrealtime : public stmt
{
using ptr = std::unique_ptr<stmt_waitrealtime>;
expr::ptr time;
stmt_waitrealtime(location const& loc, expr::ptr time);
XSK_ARC_AST_MAKE(stmt_waitrealtime)
};
struct stmt_if : public stmt
{
using ptr = std::unique_ptr<stmt_if>;

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -14,7 +14,6 @@ struct directive
kind type;
bool skip;
bool exec;
};
} // namespace xsk::arc

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -12,7 +12,7 @@ class position
{
public:
typedef const std::string filename_type;
typedef u16 counter_type;
typedef int counter_type;
filename_type *filename;
counter_type line;
@ -119,12 +119,12 @@ public:
auto print() const -> std::string
{
return std::format("{}:{}:{}", *begin.filename, begin.line, begin.column);
return fmt::format("{}:{}:{}", *begin.filename, begin.line, begin.column);
}
auto label() const -> std::string
{
return std::format("loc_{:X}", begin.line);
return fmt::format("loc_{:X}", begin.line);
}
};

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -20,9 +20,9 @@ struct token
NAME, PATH, STRING, ISTRING, HASHSTR, INT, FLT,
DEVBEGIN, DEVEND, INLINE, INCLUDE, USINGTREE, ANIMTREE, AUTOEXEC, CODECALL, PRIVATE,
ENDON, NOTIFY, WAIT, WAITREALTIME, WAITTILL, WAITTILLMATCH, WAITTILLFRAMEEND, IF, ELSE,
DO, WHILE, FOR, FOREACH, IN, SWITCH, CASE, DEFAULT, BREAK, CONTINUE, RETURN, PROFBEGIN,
PROFEND, THREAD, TRUE, FALSE, UNDEFINED, SIZE, GAME, SELF, ANIM, LEVEL,
ENDON, NOTIFY, WAIT, WAITTILL, WAITTILLMATCH, WAITTILLFRAMEEND, IF, ELSE, DO, WHILE,
FOR, FOREACH, IN, SWITCH, CASE, DEFAULT, BREAK, CONTINUE, RETURN, PROFBEGIN, PROFEND,
THREAD, TRUE, FALSE, UNDEFINED, SIZE, GAME, SELF, ANIM, LEVEL,
CONST, ISDEFINED, VECTORSCALE, ANGLESTOUP, ANGLESTORIGHT, ANGLESTOFORWARD, ANGLECLAMP180,
VECTORTOANGLES, ABS, GETTIME, GETDVAR, GETDVARINT, GETDVARFLOAT, GETDVARVECTOR, GETDVARCOLORRED,
GETDVARCOLORGREEN, GETDVARCOLORBLUE, GETDVARCOLORALPHA, GETFIRSTARRAYKEY, GETNEXTARRAYKEY,

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -29,17 +29,10 @@ enum class instance : u8
enum class build : u8
{
prod = 0,
dev_blocks = 1 << 0,
dev_maps = 1 << 1,
dev = dev_blocks | dev_maps,
dev,
prod,
};
inline build operator&(build lhs, build rhs)
{
return static_cast<build>(static_cast<std::underlying_type<build>::type>(lhs) & static_cast<std::underlying_type<build>::type>(rhs));
}
enum class endian : u8
{
little,
@ -64,14 +57,13 @@ enum class engine : u8
t7,
t8,
t9,
jup
};
struct props
{
enum values : u32
{
none = 0,
none = 0 << 0,
v2 = 1 << 0,
v3 = 1 << 1,
header64 = 1 << 2,

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -20,7 +20,6 @@ class compiler
std::vector<scope> scopes_;
std::unordered_map<std::string, expr const*> constants_;
std::string animtree_;
sourcepos debug_pos_;
u32 index_;
u32 label_idx_;
bool can_break_;
@ -46,7 +45,6 @@ private:
auto emit_stmt_endon(stmt_endon const& stm) -> void;
auto emit_stmt_notify(stmt_notify const& stm) -> void;
auto emit_stmt_wait(stmt_wait const& stm) -> void;
auto emit_stmt_waitrealtime(stmt_waitrealtime const& stm) -> void;
auto emit_stmt_waittill(stmt_waittill const& stm) -> void;
auto emit_stmt_waittillmatch(stmt_waittillmatch const& stm) -> void;
auto emit_stmt_waittillframeend(stmt_waittillframeend const& stm) -> void;

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -65,9 +65,9 @@ private:
auto process_stmt_endon(stmt_endon& stm) -> void;
auto process_stmt_notify(stmt_notify& stm) -> void;
auto process_stmt_wait(stmt_wait& stm) -> void;
auto process_stmt_waitrealtime(stmt_waitrealtime& stm) -> void;
auto process_stmt_waittill(stmt_waittill& stm) -> void;
auto process_stmt_waittillmatch(stmt_waittillmatch& stm) -> void;
auto process_stmt_waitrealtime(stmt_waitrealtime& stm) -> void;
auto process_stmt_if(stmt_if& stm) -> void;
auto process_stmt_ifelse(stmt_ifelse& stm) -> void;
auto process_stmt_while(stmt_while& stm) -> void;

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,24 +0,0 @@
// Copyright 2024 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
#pragma once
#include "xsk/stdinc.hpp"
#include "xsk/arc/context.hpp"
namespace xsk::arc::jup
{
constexpr usize code_count = 0;
constexpr usize hash_count = 0;
constexpr u64 header_magic = 0x38000A0D43534780;
class context : public arc::context
{
public:
context();
};
} // namespace xsk::arc::jup

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -679,20 +679,17 @@ namespace xsk { namespace arc {
// stmt_wait
char dummy78[sizeof (stmt_wait::ptr)];
// stmt_waitrealtime
char dummy79[sizeof (stmt_waitrealtime::ptr)];
// stmt_waittill
char dummy80[sizeof (stmt_waittill::ptr)];
char dummy79[sizeof (stmt_waittill::ptr)];
// stmt_waittillframeend
char dummy81[sizeof (stmt_waittillframeend::ptr)];
char dummy80[sizeof (stmt_waittillframeend::ptr)];
// stmt_waittillmatch
char dummy82[sizeof (stmt_waittillmatch::ptr)];
char dummy81[sizeof (stmt_waittillmatch::ptr)];
// stmt_while
char dummy83[sizeof (stmt_while::ptr)];
char dummy82[sizeof (stmt_while::ptr)];
};
/// The size of the largest semantic type.
@ -758,117 +755,116 @@ namespace xsk { namespace arc {
ENDON = 13, // "endon"
NOTIFY = 14, // "notify"
WAIT = 15, // "wait"
WAITREALTIME = 16, // "waitrealtime"
WAITTILL = 17, // "waittill"
WAITTILLMATCH = 18, // "waittillmatch"
WAITTILLFRAMEEND = 19, // "waittillframeend"
IF = 20, // "if"
ELSE = 21, // "else"
DO = 22, // "do"
WHILE = 23, // "while"
FOR = 24, // "for"
FOREACH = 25, // "foreach"
IN = 26, // "in"
SWITCH = 27, // "switch"
CASE = 28, // "case"
DEFAULT = 29, // "default"
BREAK = 30, // "break"
CONTINUE = 31, // "continue"
RETURN = 32, // "return"
PROFBEGIN = 33, // "prof_begin"
PROFEND = 34, // "prof_end"
THREAD = 35, // "thread"
TRUE = 36, // "true"
FALSE = 37, // "false"
UNDEFINED = 38, // "undefined"
SIZE = 39, // "size"
GAME = 40, // "game"
SELF = 41, // "self"
ANIM = 42, // "anim"
LEVEL = 43, // "level"
CONST = 44, // "const"
GETNEXTARRAYKEY = 45, // "getnextarraykey"
GETFIRSTARRAYKEY = 46, // "getfirstarraykey"
GETDVARCOLORALPHA = 47, // "getdvarcoloralpha"
GETDVARCOLORBLUE = 48, // "getdvarcolorblue"
GETDVARCOLORGREEN = 49, // "getdvarcolorgreen"
GETDVARCOLORRED = 50, // "getdvarcolorred"
GETDVARVECTOR = 51, // "getdvarvector"
GETDVARFLOAT = 52, // "getdvarfloat"
GETDVARINT = 53, // "getdvarint"
GETDVAR = 54, // "getdvar"
GETTIME = 55, // "gettime"
ABS = 56, // "abs"
VECTORTOANGLES = 57, // "vectortoangles"
ANGLECLAMP180 = 58, // "angleclamp180"
ANGLESTOFORWARD = 59, // "anglestoforward"
ANGLESTORIGHT = 60, // "anglestoright"
ANGLESTOUP = 61, // "anglestoup"
VECTORSCALE = 62, // "vectorscale"
ISDEFINED = 63, // "isdefined"
LPAREN = 64, // "("
RPAREN = 65, // ")"
LBRACE = 66, // "{"
RBRACE = 67, // "}"
LBRACKET = 68, // "["
RBRACKET = 69, // "]"
COMMA = 70, // ","
DOT = 71, // "."
DOUBLEDOT = 72, // ".."
ELLIPSIS = 73, // "..."
DOUBLECOLON = 74, // "::"
COLON = 75, // ":"
SEMICOLON = 76, // ";"
QMARK = 77, // "?"
INCREMENT = 78, // "++"
DECREMENT = 79, // "--"
LSHIFT = 80, // "<<"
RSHIFT = 81, // ">>"
OR = 82, // "||"
AND = 83, // "&&"
EQUALITY = 84, // "=="
INEQUALITY = 85, // "!="
LESS_EQUAL = 86, // "<="
GREATER_EQUAL = 87, // ">="
LESS = 88, // "<"
GREATER = 89, // ">"
NOT = 90, // "!"
COMPLEMENT = 91, // "~"
ASSIGN = 92, // "="
ASSIGN_ADD = 93, // "+="
ASSIGN_SUB = 94, // "-="
ASSIGN_MUL = 95, // "*="
ASSIGN_DIV = 96, // "/="
ASSIGN_MOD = 97, // "%="
ASSIGN_BW_OR = 98, // "|="
ASSIGN_BW_AND = 99, // "&="
ASSIGN_BW_EXOR = 100, // "^="
ASSIGN_RSHIFT = 101, // ">>="
ASSIGN_LSHIFT = 102, // "<<="
BITWISE_OR = 103, // "|"
BITWISE_AND = 104, // "&"
BITWISE_EXOR = 105, // "^"
ADD = 106, // "+"
SUB = 107, // "-"
MUL = 108, // "*"
DIV = 109, // "/"
MOD = 110, // "%"
PATH = 111, // "path"
IDENTIFIER = 112, // "identifier"
STRING = 113, // "string literal"
ISTRING = 114, // "localized string"
HASHSTR = 115, // "hash string"
FLOAT = 116, // "float"
INTEGER = 117, // "integer"
SIZEOF = 118, // SIZEOF
THEN = 119, // THEN
TERN = 120, // TERN
NEG = 121, // NEG
ANIMREF = 122, // ANIMREF
PREINC = 123, // PREINC
PREDEC = 124, // PREDEC
POSTINC = 125, // POSTINC
POSTDEC = 126 // POSTDEC
WAITTILL = 16, // "waittill"
WAITTILLMATCH = 17, // "waittillmatch"
WAITTILLFRAMEEND = 18, // "waittillframeend"
IF = 19, // "if"
ELSE = 20, // "else"
DO = 21, // "do"
WHILE = 22, // "while"
FOR = 23, // "for"
FOREACH = 24, // "foreach"
IN = 25, // "in"
SWITCH = 26, // "switch"
CASE = 27, // "case"
DEFAULT = 28, // "default"
BREAK = 29, // "break"
CONTINUE = 30, // "continue"
RETURN = 31, // "return"
PROFBEGIN = 32, // "prof_begin"
PROFEND = 33, // "prof_end"
THREAD = 34, // "thread"
TRUE = 35, // "true"
FALSE = 36, // "false"
UNDEFINED = 37, // "undefined"
SIZE = 38, // "size"
GAME = 39, // "game"
SELF = 40, // "self"
ANIM = 41, // "anim"
LEVEL = 42, // "level"
CONST = 43, // "const"
GETNEXTARRAYKEY = 44, // "getnextarraykey"
GETFIRSTARRAYKEY = 45, // "getfirstarraykey"
GETDVARCOLORALPHA = 46, // "getdvarcoloralpha"
GETDVARCOLORBLUE = 47, // "getdvarcolorblue"
GETDVARCOLORGREEN = 48, // "getdvarcolorgreen"
GETDVARCOLORRED = 49, // "getdvarcolorred"
GETDVARVECTOR = 50, // "getdvarvector"
GETDVARFLOAT = 51, // "getdvarfloat"
GETDVARINT = 52, // "getdvarint"
GETDVAR = 53, // "getdvar"
GETTIME = 54, // "gettime"
ABS = 55, // "abs"
VECTORTOANGLES = 56, // "vectortoangles"
ANGLECLAMP180 = 57, // "angleclamp180"
ANGLESTOFORWARD = 58, // "anglestoforward"
ANGLESTORIGHT = 59, // "anglestoright"
ANGLESTOUP = 60, // "anglestoup"
VECTORSCALE = 61, // "vectorscale"
ISDEFINED = 62, // "isdefined"
LPAREN = 63, // "("
RPAREN = 64, // ")"
LBRACE = 65, // "{"
RBRACE = 66, // "}"
LBRACKET = 67, // "["
RBRACKET = 68, // "]"
COMMA = 69, // ","
DOT = 70, // "."
DOUBLEDOT = 71, // ".."
ELLIPSIS = 72, // "..."
DOUBLECOLON = 73, // "::"
COLON = 74, // ":"
SEMICOLON = 75, // ";"
QMARK = 76, // "?"
INCREMENT = 77, // "++"
DECREMENT = 78, // "--"
LSHIFT = 79, // "<<"
RSHIFT = 80, // ">>"
OR = 81, // "||"
AND = 82, // "&&"
EQUALITY = 83, // "=="
INEQUALITY = 84, // "!="
LESS_EQUAL = 85, // "<="
GREATER_EQUAL = 86, // ">="
LESS = 87, // "<"
GREATER = 88, // ">"
NOT = 89, // "!"
COMPLEMENT = 90, // "~"
ASSIGN = 91, // "="
ASSIGN_ADD = 92, // "+="
ASSIGN_SUB = 93, // "-="
ASSIGN_MUL = 94, // "*="
ASSIGN_DIV = 95, // "/="
ASSIGN_MOD = 96, // "%="
ASSIGN_BW_OR = 97, // "|="
ASSIGN_BW_AND = 98, // "&="
ASSIGN_BW_EXOR = 99, // "^="
ASSIGN_RSHIFT = 100, // ">>="
ASSIGN_LSHIFT = 101, // "<<="
BITWISE_OR = 102, // "|"
BITWISE_AND = 103, // "&"
BITWISE_EXOR = 104, // "^"
ADD = 105, // "+"
SUB = 106, // "-"
MUL = 107, // "*"
DIV = 108, // "/"
MOD = 109, // "%"
PATH = 110, // "path"
IDENTIFIER = 111, // "identifier"
STRING = 112, // "string literal"
ISTRING = 113, // "localized string"
HASHSTR = 114, // "hash string"
FLOAT = 115, // "float"
INTEGER = 116, // "integer"
SIZEOF = 117, // SIZEOF
THEN = 118, // THEN
TERN = 119, // TERN
NEG = 120, // NEG
ANIMREF = 121, // ANIMREF
PREINC = 122, // PREINC
PREDEC = 123, // PREDEC
POSTINC = 124, // POSTINC
POSTDEC = 125 // POSTDEC
};
/// Backward compatibility alias (Bison 3.6).
typedef token_kind_type yytokentype;
@ -885,7 +881,7 @@ namespace xsk { namespace arc {
{
enum symbol_kind_type
{
YYNTOKENS = 127, ///< Number of tokens.
YYNTOKENS = 126, ///< Number of tokens.
S_YYEMPTY = -2,
S_YYEOF = 0, // "end of file"
S_YYerror = 1, // error
@ -903,219 +899,217 @@ namespace xsk { namespace arc {
S_ENDON = 13, // "endon"
S_NOTIFY = 14, // "notify"
S_WAIT = 15, // "wait"
S_WAITREALTIME = 16, // "waitrealtime"
S_WAITTILL = 17, // "waittill"
S_WAITTILLMATCH = 18, // "waittillmatch"
S_WAITTILLFRAMEEND = 19, // "waittillframeend"
S_IF = 20, // "if"
S_ELSE = 21, // "else"
S_DO = 22, // "do"
S_WHILE = 23, // "while"
S_FOR = 24, // "for"
S_FOREACH = 25, // "foreach"
S_IN = 26, // "in"
S_SWITCH = 27, // "switch"
S_CASE = 28, // "case"
S_DEFAULT = 29, // "default"
S_BREAK = 30, // "break"
S_CONTINUE = 31, // "continue"
S_RETURN = 32, // "return"
S_PROFBEGIN = 33, // "prof_begin"
S_PROFEND = 34, // "prof_end"
S_THREAD = 35, // "thread"
S_TRUE = 36, // "true"
S_FALSE = 37, // "false"
S_UNDEFINED = 38, // "undefined"
S_SIZE = 39, // "size"
S_GAME = 40, // "game"
S_SELF = 41, // "self"
S_ANIM = 42, // "anim"
S_LEVEL = 43, // "level"
S_CONST = 44, // "const"
S_GETNEXTARRAYKEY = 45, // "getnextarraykey"
S_GETFIRSTARRAYKEY = 46, // "getfirstarraykey"
S_GETDVARCOLORALPHA = 47, // "getdvarcoloralpha"
S_GETDVARCOLORBLUE = 48, // "getdvarcolorblue"
S_GETDVARCOLORGREEN = 49, // "getdvarcolorgreen"
S_GETDVARCOLORRED = 50, // "getdvarcolorred"
S_GETDVARVECTOR = 51, // "getdvarvector"
S_GETDVARFLOAT = 52, // "getdvarfloat"
S_GETDVARINT = 53, // "getdvarint"
S_GETDVAR = 54, // "getdvar"
S_GETTIME = 55, // "gettime"
S_ABS = 56, // "abs"
S_VECTORTOANGLES = 57, // "vectortoangles"
S_ANGLECLAMP180 = 58, // "angleclamp180"
S_ANGLESTOFORWARD = 59, // "anglestoforward"
S_ANGLESTORIGHT = 60, // "anglestoright"
S_ANGLESTOUP = 61, // "anglestoup"
S_VECTORSCALE = 62, // "vectorscale"
S_ISDEFINED = 63, // "isdefined"
S_LPAREN = 64, // "("
S_RPAREN = 65, // ")"
S_LBRACE = 66, // "{"
S_RBRACE = 67, // "}"
S_LBRACKET = 68, // "["
S_RBRACKET = 69, // "]"
S_COMMA = 70, // ","
S_DOT = 71, // "."
S_DOUBLEDOT = 72, // ".."
S_ELLIPSIS = 73, // "..."
S_DOUBLECOLON = 74, // "::"
S_COLON = 75, // ":"
S_SEMICOLON = 76, // ";"
S_QMARK = 77, // "?"
S_INCREMENT = 78, // "++"
S_DECREMENT = 79, // "--"
S_LSHIFT = 80, // "<<"
S_RSHIFT = 81, // ">>"
S_OR = 82, // "||"
S_AND = 83, // "&&"
S_EQUALITY = 84, // "=="
S_INEQUALITY = 85, // "!="
S_LESS_EQUAL = 86, // "<="
S_GREATER_EQUAL = 87, // ">="
S_LESS = 88, // "<"
S_GREATER = 89, // ">"
S_NOT = 90, // "!"
S_COMPLEMENT = 91, // "~"
S_ASSIGN = 92, // "="
S_ASSIGN_ADD = 93, // "+="
S_ASSIGN_SUB = 94, // "-="
S_ASSIGN_MUL = 95, // "*="
S_ASSIGN_DIV = 96, // "/="
S_ASSIGN_MOD = 97, // "%="
S_ASSIGN_BW_OR = 98, // "|="
S_ASSIGN_BW_AND = 99, // "&="
S_ASSIGN_BW_EXOR = 100, // "^="
S_ASSIGN_RSHIFT = 101, // ">>="
S_ASSIGN_LSHIFT = 102, // "<<="
S_BITWISE_OR = 103, // "|"
S_BITWISE_AND = 104, // "&"
S_BITWISE_EXOR = 105, // "^"
S_ADD = 106, // "+"
S_SUB = 107, // "-"
S_MUL = 108, // "*"
S_DIV = 109, // "/"
S_MOD = 110, // "%"
S_PATH = 111, // "path"
S_IDENTIFIER = 112, // "identifier"
S_STRING = 113, // "string literal"
S_ISTRING = 114, // "localized string"
S_HASHSTR = 115, // "hash string"
S_FLOAT = 116, // "float"
S_INTEGER = 117, // "integer"
S_SIZEOF = 118, // SIZEOF
S_THEN = 119, // THEN
S_TERN = 120, // TERN
S_NEG = 121, // NEG
S_ANIMREF = 122, // ANIMREF
S_PREINC = 123, // PREINC
S_PREDEC = 124, // PREDEC
S_POSTINC = 125, // POSTINC
S_POSTDEC = 126, // POSTDEC
S_YYACCEPT = 127, // $accept
S_root = 128, // root
S_program = 129, // program
S_inline = 130, // inline
S_include = 131, // include
S_declaration = 132, // declaration
S_decl_usingtree = 133, // decl_usingtree
S_decl_function = 134, // decl_function
S_stmt = 135, // stmt
S_stmt_or_dev = 136, // stmt_or_dev
S_stmt_list = 137, // stmt_list
S_stmt_or_dev_list = 138, // stmt_or_dev_list
S_stmt_dev = 139, // stmt_dev
S_stmt_comp = 140, // stmt_comp
S_stmt_expr = 141, // stmt_expr
S_stmt_call = 142, // stmt_call
S_stmt_const = 143, // stmt_const
S_stmt_assign = 144, // stmt_assign
S_stmt_endon = 145, // stmt_endon
S_stmt_notify = 146, // stmt_notify
S_stmt_wait = 147, // stmt_wait
S_stmt_waitrealtime = 148, // stmt_waitrealtime
S_stmt_waittill = 149, // stmt_waittill
S_stmt_waittillmatch = 150, // stmt_waittillmatch
S_stmt_waittillframeend = 151, // stmt_waittillframeend
S_stmt_if = 152, // stmt_if
S_stmt_ifelse = 153, // stmt_ifelse
S_stmt_while = 154, // stmt_while
S_stmt_dowhile = 155, // stmt_dowhile
S_stmt_for = 156, // stmt_for
S_stmt_foreach = 157, // stmt_foreach
S_stmt_switch = 158, // stmt_switch
S_stmt_case = 159, // stmt_case
S_stmt_default = 160, // stmt_default
S_stmt_break = 161, // stmt_break
S_stmt_continue = 162, // stmt_continue
S_stmt_return = 163, // stmt_return
S_stmt_prof_begin = 164, // stmt_prof_begin
S_stmt_prof_end = 165, // stmt_prof_end
S_expr = 166, // expr
S_expr_or_empty = 167, // expr_or_empty
S_expr_increment = 168, // expr_increment
S_expr_decrement = 169, // expr_decrement
S_expr_assign = 170, // expr_assign
S_expr_ternary = 171, // expr_ternary
S_expr_binary = 172, // expr_binary
S_expr_primitive = 173, // expr_primitive
S_expr_complement = 174, // expr_complement
S_expr_negate = 175, // expr_negate
S_expr_not = 176, // expr_not
S_expr_call = 177, // expr_call
S_expr_method = 178, // expr_method
S_expr_function = 179, // expr_function
S_expr_pointer = 180, // expr_pointer
S_expr_parameters = 181, // expr_parameters
S_expr_parameters_default = 182, // expr_parameters_default
S_expr_arguments = 183, // expr_arguments
S_expr_arguments_no_empty = 184, // expr_arguments_no_empty
S_expr_getnextarraykey = 185, // expr_getnextarraykey
S_expr_getfirstarraykey = 186, // expr_getfirstarraykey
S_expr_getdvarcoloralpha = 187, // expr_getdvarcoloralpha
S_expr_getdvarcolorblue = 188, // expr_getdvarcolorblue
S_expr_getdvarcolorgreen = 189, // expr_getdvarcolorgreen
S_expr_getdvarcolorred = 190, // expr_getdvarcolorred
S_expr_getdvarvector = 191, // expr_getdvarvector
S_expr_getdvarfloat = 192, // expr_getdvarfloat
S_expr_getdvarint = 193, // expr_getdvarint
S_expr_getdvar = 194, // expr_getdvar
S_expr_gettime = 195, // expr_gettime
S_expr_abs = 196, // expr_abs
S_expr_vectortoangles = 197, // expr_vectortoangles
S_expr_angleclamp180 = 198, // expr_angleclamp180
S_expr_anglestoforward = 199, // expr_anglestoforward
S_expr_anglestoright = 200, // expr_anglestoright
S_expr_anglestoup = 201, // expr_anglestoup
S_expr_vectorscale = 202, // expr_vectorscale
S_expr_isdefined = 203, // expr_isdefined
S_expr_reference = 204, // expr_reference
S_expr_array = 205, // expr_array
S_expr_field = 206, // expr_field
S_expr_size = 207, // expr_size
S_expr_paren = 208, // expr_paren
S_expr_object = 209, // expr_object
S_expr_empty_array = 210, // expr_empty_array
S_expr_undefined = 211, // expr_undefined
S_expr_game = 212, // expr_game
S_expr_self = 213, // expr_self
S_expr_anim = 214, // expr_anim
S_expr_level = 215, // expr_level
S_expr_animation = 216, // expr_animation
S_expr_animtree = 217, // expr_animtree
S_expr_identifier_nosize = 218, // expr_identifier_nosize
S_expr_identifier = 219, // expr_identifier
S_expr_path = 220, // expr_path
S_expr_istring = 221, // expr_istring
S_expr_string = 222, // expr_string
S_expr_vector = 223, // expr_vector
S_expr_hash = 224, // expr_hash
S_expr_float = 225, // expr_float
S_expr_integer = 226, // expr_integer
S_expr_false = 227, // expr_false
S_expr_true = 228 // expr_true
S_WAITTILL = 16, // "waittill"
S_WAITTILLMATCH = 17, // "waittillmatch"
S_WAITTILLFRAMEEND = 18, // "waittillframeend"
S_IF = 19, // "if"
S_ELSE = 20, // "else"
S_DO = 21, // "do"
S_WHILE = 22, // "while"
S_FOR = 23, // "for"
S_FOREACH = 24, // "foreach"
S_IN = 25, // "in"
S_SWITCH = 26, // "switch"
S_CASE = 27, // "case"
S_DEFAULT = 28, // "default"
S_BREAK = 29, // "break"
S_CONTINUE = 30, // "continue"
S_RETURN = 31, // "return"
S_PROFBEGIN = 32, // "prof_begin"
S_PROFEND = 33, // "prof_end"
S_THREAD = 34, // "thread"
S_TRUE = 35, // "true"
S_FALSE = 36, // "false"
S_UNDEFINED = 37, // "undefined"
S_SIZE = 38, // "size"
S_GAME = 39, // "game"
S_SELF = 40, // "self"
S_ANIM = 41, // "anim"
S_LEVEL = 42, // "level"
S_CONST = 43, // "const"
S_GETNEXTARRAYKEY = 44, // "getnextarraykey"
S_GETFIRSTARRAYKEY = 45, // "getfirstarraykey"
S_GETDVARCOLORALPHA = 46, // "getdvarcoloralpha"
S_GETDVARCOLORBLUE = 47, // "getdvarcolorblue"
S_GETDVARCOLORGREEN = 48, // "getdvarcolorgreen"
S_GETDVARCOLORRED = 49, // "getdvarcolorred"
S_GETDVARVECTOR = 50, // "getdvarvector"
S_GETDVARFLOAT = 51, // "getdvarfloat"
S_GETDVARINT = 52, // "getdvarint"
S_GETDVAR = 53, // "getdvar"
S_GETTIME = 54, // "gettime"
S_ABS = 55, // "abs"
S_VECTORTOANGLES = 56, // "vectortoangles"
S_ANGLECLAMP180 = 57, // "angleclamp180"
S_ANGLESTOFORWARD = 58, // "anglestoforward"
S_ANGLESTORIGHT = 59, // "anglestoright"
S_ANGLESTOUP = 60, // "anglestoup"
S_VECTORSCALE = 61, // "vectorscale"
S_ISDEFINED = 62, // "isdefined"
S_LPAREN = 63, // "("
S_RPAREN = 64, // ")"
S_LBRACE = 65, // "{"
S_RBRACE = 66, // "}"
S_LBRACKET = 67, // "["
S_RBRACKET = 68, // "]"
S_COMMA = 69, // ","
S_DOT = 70, // "."
S_DOUBLEDOT = 71, // ".."
S_ELLIPSIS = 72, // "..."
S_DOUBLECOLON = 73, // "::"
S_COLON = 74, // ":"
S_SEMICOLON = 75, // ";"
S_QMARK = 76, // "?"
S_INCREMENT = 77, // "++"
S_DECREMENT = 78, // "--"
S_LSHIFT = 79, // "<<"
S_RSHIFT = 80, // ">>"
S_OR = 81, // "||"
S_AND = 82, // "&&"
S_EQUALITY = 83, // "=="
S_INEQUALITY = 84, // "!="
S_LESS_EQUAL = 85, // "<="
S_GREATER_EQUAL = 86, // ">="
S_LESS = 87, // "<"
S_GREATER = 88, // ">"
S_NOT = 89, // "!"
S_COMPLEMENT = 90, // "~"
S_ASSIGN = 91, // "="
S_ASSIGN_ADD = 92, // "+="
S_ASSIGN_SUB = 93, // "-="
S_ASSIGN_MUL = 94, // "*="
S_ASSIGN_DIV = 95, // "/="
S_ASSIGN_MOD = 96, // "%="
S_ASSIGN_BW_OR = 97, // "|="
S_ASSIGN_BW_AND = 98, // "&="
S_ASSIGN_BW_EXOR = 99, // "^="
S_ASSIGN_RSHIFT = 100, // ">>="
S_ASSIGN_LSHIFT = 101, // "<<="
S_BITWISE_OR = 102, // "|"
S_BITWISE_AND = 103, // "&"
S_BITWISE_EXOR = 104, // "^"
S_ADD = 105, // "+"
S_SUB = 106, // "-"
S_MUL = 107, // "*"
S_DIV = 108, // "/"
S_MOD = 109, // "%"
S_PATH = 110, // "path"
S_IDENTIFIER = 111, // "identifier"
S_STRING = 112, // "string literal"
S_ISTRING = 113, // "localized string"
S_HASHSTR = 114, // "hash string"
S_FLOAT = 115, // "float"
S_INTEGER = 116, // "integer"
S_SIZEOF = 117, // SIZEOF
S_THEN = 118, // THEN
S_TERN = 119, // TERN
S_NEG = 120, // NEG
S_ANIMREF = 121, // ANIMREF
S_PREINC = 122, // PREINC
S_PREDEC = 123, // PREDEC
S_POSTINC = 124, // POSTINC
S_POSTDEC = 125, // POSTDEC
S_YYACCEPT = 126, // $accept
S_root = 127, // root
S_program = 128, // program
S_inline = 129, // inline
S_include = 130, // include
S_declaration = 131, // declaration
S_decl_usingtree = 132, // decl_usingtree
S_decl_function = 133, // decl_function
S_stmt = 134, // stmt
S_stmt_or_dev = 135, // stmt_or_dev
S_stmt_list = 136, // stmt_list
S_stmt_or_dev_list = 137, // stmt_or_dev_list
S_stmt_dev = 138, // stmt_dev
S_stmt_comp = 139, // stmt_comp
S_stmt_expr = 140, // stmt_expr
S_stmt_call = 141, // stmt_call
S_stmt_const = 142, // stmt_const
S_stmt_assign = 143, // stmt_assign
S_stmt_endon = 144, // stmt_endon
S_stmt_notify = 145, // stmt_notify
S_stmt_wait = 146, // stmt_wait
S_stmt_waittill = 147, // stmt_waittill
S_stmt_waittillmatch = 148, // stmt_waittillmatch
S_stmt_waittillframeend = 149, // stmt_waittillframeend
S_stmt_if = 150, // stmt_if
S_stmt_ifelse = 151, // stmt_ifelse
S_stmt_while = 152, // stmt_while
S_stmt_dowhile = 153, // stmt_dowhile
S_stmt_for = 154, // stmt_for
S_stmt_foreach = 155, // stmt_foreach
S_stmt_switch = 156, // stmt_switch
S_stmt_case = 157, // stmt_case
S_stmt_default = 158, // stmt_default
S_stmt_break = 159, // stmt_break
S_stmt_continue = 160, // stmt_continue
S_stmt_return = 161, // stmt_return
S_stmt_prof_begin = 162, // stmt_prof_begin
S_stmt_prof_end = 163, // stmt_prof_end
S_expr = 164, // expr
S_expr_or_empty = 165, // expr_or_empty
S_expr_increment = 166, // expr_increment
S_expr_decrement = 167, // expr_decrement
S_expr_assign = 168, // expr_assign
S_expr_ternary = 169, // expr_ternary
S_expr_binary = 170, // expr_binary
S_expr_primitive = 171, // expr_primitive
S_expr_complement = 172, // expr_complement
S_expr_negate = 173, // expr_negate
S_expr_not = 174, // expr_not
S_expr_call = 175, // expr_call
S_expr_method = 176, // expr_method
S_expr_function = 177, // expr_function
S_expr_pointer = 178, // expr_pointer
S_expr_parameters = 179, // expr_parameters
S_expr_parameters_default = 180, // expr_parameters_default
S_expr_arguments = 181, // expr_arguments
S_expr_arguments_no_empty = 182, // expr_arguments_no_empty
S_expr_getnextarraykey = 183, // expr_getnextarraykey
S_expr_getfirstarraykey = 184, // expr_getfirstarraykey
S_expr_getdvarcoloralpha = 185, // expr_getdvarcoloralpha
S_expr_getdvarcolorblue = 186, // expr_getdvarcolorblue
S_expr_getdvarcolorgreen = 187, // expr_getdvarcolorgreen
S_expr_getdvarcolorred = 188, // expr_getdvarcolorred
S_expr_getdvarvector = 189, // expr_getdvarvector
S_expr_getdvarfloat = 190, // expr_getdvarfloat
S_expr_getdvarint = 191, // expr_getdvarint
S_expr_getdvar = 192, // expr_getdvar
S_expr_gettime = 193, // expr_gettime
S_expr_abs = 194, // expr_abs
S_expr_vectortoangles = 195, // expr_vectortoangles
S_expr_angleclamp180 = 196, // expr_angleclamp180
S_expr_anglestoforward = 197, // expr_anglestoforward
S_expr_anglestoright = 198, // expr_anglestoright
S_expr_anglestoup = 199, // expr_anglestoup
S_expr_vectorscale = 200, // expr_vectorscale
S_expr_isdefined = 201, // expr_isdefined
S_expr_reference = 202, // expr_reference
S_expr_array = 203, // expr_array
S_expr_field = 204, // expr_field
S_expr_size = 205, // expr_size
S_expr_paren = 206, // expr_paren
S_expr_object = 207, // expr_object
S_expr_empty_array = 208, // expr_empty_array
S_expr_undefined = 209, // expr_undefined
S_expr_game = 210, // expr_game
S_expr_self = 211, // expr_self
S_expr_anim = 212, // expr_anim
S_expr_level = 213, // expr_level
S_expr_animation = 214, // expr_animation
S_expr_animtree = 215, // expr_animtree
S_expr_identifier_nosize = 216, // expr_identifier_nosize
S_expr_identifier = 217, // expr_identifier
S_expr_path = 218, // expr_path
S_expr_istring = 219, // expr_istring
S_expr_string = 220, // expr_string
S_expr_vector = 221, // expr_vector
S_expr_hash = 222, // expr_hash
S_expr_float = 223, // expr_float
S_expr_integer = 224, // expr_integer
S_expr_false = 225, // expr_false
S_expr_true = 226 // expr_true
};
};
@ -1487,10 +1481,6 @@ namespace xsk { namespace arc {
value.move< stmt_wait::ptr > (std::move (that.value));
break;
case symbol_kind::S_stmt_waitrealtime: // stmt_waitrealtime
value.move< stmt_waitrealtime::ptr > (std::move (that.value));
break;
case symbol_kind::S_stmt_waittill: // stmt_waittill
value.move< stmt_waittill::ptr > (std::move (that.value));
break;
@ -2622,20 +2612,6 @@ namespace xsk { namespace arc {
{}
#endif
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, stmt_waitrealtime::ptr&& v, location_type&& l)
: Base (t)
, value (std::move (v))
, location (std::move (l))
{}
#else
basic_symbol (typename Base::kind_type t, const stmt_waitrealtime::ptr& v, const location_type& l)
: Base (t)
, value (v)
, location (l)
{}
#endif
#if 201103L <= YY_CPLUSPLUS
basic_symbol (typename Base::kind_type t, stmt_waittill::ptr&& v, location_type&& l)
: Base (t)
@ -3051,10 +3027,6 @@ switch (yykind)
value.template destroy< stmt_wait::ptr > ();
break;
case symbol_kind::S_stmt_waitrealtime: // stmt_waitrealtime
value.template destroy< stmt_waitrealtime::ptr > ();
break;
case symbol_kind::S_stmt_waittill: // stmt_waittill
value.template destroy< stmt_waittill::ptr > ();
break;
@ -3473,21 +3445,6 @@ switch (yykind)
return symbol_type (token::WAIT, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_WAITREALTIME (location_type l)
{
return symbol_type (token::WAITREALTIME, std::move (l));
}
#else
static
symbol_type
make_WAITREALTIME (const location_type& l)
{
return symbol_type (token::WAITREALTIME, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
@ -5482,8 +5439,8 @@ switch (yykind)
/// Constants.
enum
{
yylast_ = 3307, ///< Last index in yytable_.
yynnts_ = 102, ///< Number of nonterminal symbols.
yylast_ = 3330, ///< Last index in yytable_.
yynnts_ = 101, ///< Number of nonterminal symbols.
yyfinal_ = 28 ///< Termination state number.
};
@ -5847,10 +5804,6 @@ switch (yykind)
value.copy< stmt_wait::ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_stmt_waitrealtime: // stmt_waitrealtime
value.copy< stmt_waitrealtime::ptr > (YY_MOVE (that.value));
break;
case symbol_kind::S_stmt_waittill: // stmt_waittill
value.copy< stmt_waittill::ptr > (YY_MOVE (that.value));
break;
@ -6233,10 +6186,6 @@ switch (yykind)
value.move< stmt_wait::ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_stmt_waitrealtime: // stmt_waitrealtime
value.move< stmt_waitrealtime::ptr > (YY_MOVE (s.value));
break;
case symbol_kind::S_stmt_waittill: // stmt_waittill
value.move< stmt_waittill::ptr > (YY_MOVE (s.value));
break;
@ -6320,7 +6269,7 @@ switch (yykind)
#line 13 "parser.ypp"
} } // xsk::arc
#line 6324 "parser.hpp"
#line 6273 "parser.hpp"

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -49,10 +49,10 @@ private:
auto dump_stmt_endon(stmt_endon const& stm) -> void;
auto dump_stmt_notify(stmt_notify const& stm) -> void;
auto dump_stmt_wait(stmt_wait const& stm) -> void;
auto dump_stmt_waitrealtime(stmt_waitrealtime const& stm) -> void;
auto dump_stmt_waittill(stmt_waittill const& stm) -> void;
auto dump_stmt_waittillmatch(stmt_waittillmatch const& stm) -> void;
auto dump_stmt_waittillframeend(stmt_waittillframeend const& stm) -> void;
auto dump_stmt_waitrealtime(stmt_waitrealtime const& stm) -> void;
auto dump_stmt_if(stmt_if const& stm) -> void;
auto dump_stmt_ifelse(stmt_ifelse const& stm) -> void;
auto dump_stmt_while(stmt_while const& stm) -> void;

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -18,12 +18,10 @@ class assembler
assembly const* assembly_;
utils::writer script_;
utils::writer stack_;
utils::writer devmap_;
u32 devmap_count_;
public:
assembler(context const* ctx);
auto assemble(assembly const& data) -> std::tuple<buffer, buffer, buffer>;
auto assemble(assembly const& data) -> std::pair<buffer, buffer>;
private:
auto assemble_function(function const& func) -> void;

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -220,19 +220,12 @@ enum class opcode : u8
OP_count,
};
struct sourcepos
{
u16 line;
u16 column;
};
struct instruction
{
using ptr = std::unique_ptr<instruction>;
u32 index;
u32 size;
sourcepos pos;
opcode opcode;
std::vector<std::string> data;

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -14,7 +14,6 @@ struct directive
kind type;
bool skip;
bool exec;
};
} // namespace xsk::gsc

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -12,7 +12,7 @@ class position
{
public:
typedef const std::string filename_type;
typedef u16 counter_type;
typedef int counter_type;
filename_type *filename;
counter_type line;
@ -119,12 +119,12 @@ public:
auto print() const -> std::string
{
return std::format("{}:{}:{}", *begin.filename, begin.line, begin.column);
return fmt::format("{}:{}:{}", *begin.filename, begin.line, begin.column);
}
auto label() const -> std::string
{
return std::format("loc_{:X}", begin.line);
return fmt::format("loc_{:X}", begin.line);
}
};

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -29,17 +29,10 @@ enum class instance : u8
enum class build : u8
{
prod = 0,
dev_blocks = 1 << 0,
dev_maps = 1 << 1,
dev = dev_blocks | dev_maps,
dev,
prod,
};
inline build operator&(build lhs, build rhs)
{
return static_cast<build>(static_cast<std::underlying_type<build>::type>(lhs) & static_cast<std::underlying_type<build>::type>(rhs));
}
enum class endian : u8
{
little,
@ -71,7 +64,7 @@ struct props
{
enum values : u32
{
none = 0,
none = 0 << 0,
str4 = 1 << 0, // strings size 4
tok4 = 1 << 1, // tokenid size 4
waitframe = 1 << 2, // waitframe opcode

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -22,7 +22,6 @@ class compiler
std::vector<scope*> break_blks_;
std::vector<scope*> continue_blks_;
std::string animname_;
sourcepos debug_pos_;
u32 index_;
u32 label_idx_;
bool can_break_;

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -18,7 +18,7 @@ namespace xsk::gsc
class context
{
public:
using fs_callback = std::function<std::pair<buffer, std::vector<u8>>(context const*, std::string const&)>;
using fs_callback = std::function<std::pair<buffer, std::vector<u8>>(std::string const&)>;
context(props props, engine engine, endian endian, system system, u32 str_count);

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -13,7 +13,6 @@
#include <array>
#include <deque>
#include <filesystem>
#include <format>
#include <fstream>
#include <functional>
#include <iostream>
@ -32,6 +31,13 @@
#include <vector>
#include <version>
#ifdef __cpp_lib_format
#include <format>
namespace fmt = std;
#else
#include <fmt/core.h>
#endif
#ifdef _WINDOWS_
#undef ERROR
#undef IN

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -84,7 +84,7 @@ workspace "gsc-tool"
configurations { "debug", "release" }
if os.istarget("linux") or os.istarget("macosx") then
if os.istarget("linux") or os.istarget("darwin") then
platforms { "x64", "arm64" }
else
platforms { "x86", "x64", "arm64" }
@ -119,18 +119,23 @@ workspace "gsc-tool"
staticruntime "On"
warnings "Extra"
filter "system:linux"
linkoptions "-fuse-ld=lld"
filter { "system:linux", "system:macosx" }
buildoptions "-pthread"
linkoptions "-pthread"
filter {}
filter { "system:linux", "platforms:arm64" }
buildoptions "--target=arm64-linux-gnu"
linkoptions "--target=arm64-linux-gnu"
filter {}
if os.istarget("linux") then
filter { "platforms:arm64" }
buildoptions "--target=arm64-linux-gnu"
linkoptions "--target=arm64-linux-gnu"
filter {}
linkoptions "-fuse-ld=lld"
end
filter { "system:macosx", "platforms:arm64" }
buildoptions "-arch arm64"
linkoptions "-arch arm64"
buildoptions "-arch arm64"
linkoptions "-arch arm64"
filter {}
filter "configurations:release"
@ -156,7 +161,6 @@ project "xsk-tool"
dependson "xsk-gsc"
files {
"./include/*.hpp",
"./src/tool/**.h",
"./src/tool/**.hpp",
"./src/tool/**.cpp"
@ -172,7 +176,7 @@ project "xsk-tool"
"./include",
}
cxxopts:link()
fmt:link()
zlib:link()
project "xsk-utils"
@ -189,6 +193,7 @@ project "xsk-utils"
"./include",
}
fmt:include()
zlib:include()
project "xsk-arc"
@ -205,6 +210,8 @@ project "xsk-arc"
"./include",
}
fmt:include()
project "xsk-gsc"
kind "StaticLib"
language "C++"
@ -219,5 +226,8 @@ project "xsk-gsc"
"./include",
}
fmt:include()
group "Dependencies"
zlib:project()
fmt:project()

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -14,20 +14,17 @@ assembler::assembler(context const* ctx) : ctx_{ ctx }, script_{ ctx->endian() =
{
}
auto assembler::assemble(assembly const& data, std::string const& name) -> std::pair<buffer, buffer>
auto assembler::assemble(assembly const& data, std::string const& name) -> buffer
{
assembly_ = &data;
script_.clear();
devmap_.clear();
strpool_.clear();
exports_.clear();
imports_.clear();
strings_.clear();
anims_.clear();
devmap_count_ = 0;
auto head = header{};
devmap_.pos(sizeof(u32));
script_.pos((ctx_->props() & props::headerxx) ? 0 : (ctx_->props() & props::header72) ? 72 : 64);
process_string(name);
@ -188,7 +185,7 @@ auto assembler::assemble(assembly const& data, std::string const& name) -> std::
head.flags = 0;
head.name = resolve_string(name);
auto const endpos = script_.pos();
auto endpos = script_.pos();
script_.pos(0);
script_.write<u64>(ctx_->magic());
@ -226,12 +223,7 @@ auto assembler::assemble(assembly const& data, std::string const& name) -> std::
script_.write<u8>(head.flags);
script_.pos(endpos);
auto const dev_endpos = devmap_.pos();
devmap_.pos(0);
devmap_.write<u32>(devmap_count_);
devmap_.pos(dev_endpos);
return { buffer{ script_.data(), script_.pos() }, buffer{ devmap_.data(), devmap_.pos() } };
return buffer{ script_.data(), script_.pos() };
}
auto assembler::assemble_function(function& func) -> void
@ -280,14 +272,6 @@ auto assembler::assemble_instruction(instruction const& inst) -> void
{
script_.write<u8>(static_cast<u8>(ctx_->opcode_id(inst.opcode)));
if ((ctx_->build() & build::dev_maps) != build::prod)
{
devmap_.write<u32>(script_.pos());
devmap_.write<u16>(inst.pos.line);
devmap_.write<u16>(inst.pos.column);
devmap_count_++;
}
switch (inst.opcode)
{
case opcode::OP_End:
@ -467,7 +451,7 @@ auto assembler::assemble_instruction(instruction const& inst) -> void
assemble_end_switch(inst);
break;
default:
throw asm_error(std::format("unhandled opcode {} at index {:04X}", ctx_->opcode_name(inst.opcode), inst.index));
throw asm_error(fmt::format("unhandled opcode {} at index {:04X}", ctx_->opcode_name(inst.opcode), inst.index));
}
}
@ -533,7 +517,7 @@ auto assembler::assemble_end_switch(instruction const& inst) -> void
}
else
{
throw asm_error(std::format("invalid switch case {}", inst.data[1 + (3 * i)]));
throw asm_error(fmt::format("invalid switch case {}", inst.data[1 + (3 * i)]));
}
}
}
@ -846,7 +830,7 @@ auto assembler::align_instruction(instruction& inst) -> void
break;
}
default:
throw asm_error(std::format("unhandled opcode {} at index {:04X}", ctx_->opcode_name(inst.opcode), inst.index));
throw asm_error(fmt::format("unhandled opcode {} at index {:04X}", ctx_->opcode_name(inst.opcode), inst.index));
}
}
@ -860,7 +844,7 @@ auto assembler::resolve_label(std::string const& name) -> i32
}
}
throw asm_error(std::format("couldn't resolve label address of {}", name));
throw asm_error(fmt::format("couldn't resolve label address of {}", name));
}
auto assembler::resolve_string(std::string const& name) -> u16
@ -872,7 +856,7 @@ auto assembler::resolve_string(std::string const& name) -> u16
return itr->second;
}
throw asm_error(std::format("couldn't resolve string address of {}", name));
throw asm_error(fmt::format("couldn't resolve string address of {}", name));
}
void assembler::add_stringref(std::string const& str, string_type type, u32 ref)

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -104,6 +104,7 @@ auto node::is_boolean() -> bool
default:
return false;
}
return false;
default:
return false;
}
@ -410,10 +411,10 @@ XSK_ARC_STMT_IS(stmt_expr)
XSK_ARC_STMT_IS(stmt_endon)
XSK_ARC_STMT_IS(stmt_notify)
XSK_ARC_STMT_IS(stmt_wait)
XSK_ARC_STMT_IS(stmt_waitrealtime)
XSK_ARC_STMT_IS(stmt_waittill)
XSK_ARC_STMT_IS(stmt_waittillmatch)
XSK_ARC_STMT_IS(stmt_waittillframeend)
XSK_ARC_STMT_IS(stmt_waitrealtime)
XSK_ARC_STMT_IS(stmt_if)
XSK_ARC_STMT_IS(stmt_ifelse)
XSK_ARC_STMT_IS(stmt_while)
@ -741,10 +742,6 @@ stmt_wait::stmt_wait(location const& loc, expr::ptr time) : stmt{ type::stmt_wai
{
}
stmt_waitrealtime::stmt_waitrealtime(location const& loc, expr::ptr time) : stmt{ type::stmt_waitrealtime, loc }, time{ std::move(time) }
{
}
stmt_waittill::stmt_waittill(location const& loc, expr::ptr obj, expr::ptr event, expr_arguments::ptr args) : stmt{ type::stmt_waittill, loc }, obj{ std::move(obj) }, event{ std::move(event) }, args{ std::move(args) }
{
}
@ -757,6 +754,10 @@ stmt_waittillframeend::stmt_waittillframeend(location const& loc) : stmt{ type::
{
}
stmt_waitrealtime::stmt_waitrealtime(location const& loc, expr::ptr time) : stmt{ type::stmt_waitrealtime, loc }, time{ std::move(time) }
{
}
stmt_if::stmt_if(location const& loc, expr::ptr test, stmt::ptr body) : stmt{ type::stmt_if, loc }, test{ std::move(test) }, body{ std::move(body) }
{
}

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -10,27 +10,27 @@
namespace xsk::arc
{
error::error(std::string const& what) : std::runtime_error(std::format("[ERROR]: {}", what))
error::error(std::string const& what) : std::runtime_error(fmt::format("[ERROR]: {}", what))
{
}
asm_error::asm_error(std::string const& what) : std::runtime_error(std::format("[ERROR]:assembler: {}", what))
asm_error::asm_error(std::string const& what) : std::runtime_error(fmt::format("[ERROR]:assembler: {}", what))
{
}
disasm_error::disasm_error(std::string const& what) : std::runtime_error(std::format("[ERROR]:disassembler: {}", what))
disasm_error::disasm_error(std::string const& what) : std::runtime_error(fmt::format("[ERROR]:disassembler: {}", what))
{
}
ppr_error::ppr_error(location const& loc, std::string const& what) : std::runtime_error(std::format("[ERROR]:preprocessor:{}: {}", loc.print(), what))
ppr_error::ppr_error(location const& loc, std::string const& what) : std::runtime_error(fmt::format("[ERROR]:preprocessor:{}: {}", loc.print(), what))
{
}
comp_error::comp_error(location const& loc, std::string const& what) : std::runtime_error(std::format("[ERROR]:compiler:{}: {}", loc.print(), what))
comp_error::comp_error(location const& loc, std::string const& what) : std::runtime_error(fmt::format("[ERROR]:compiler:{}: {}", loc.print(), what))
{
}
decomp_error::decomp_error(std::string const& what) : std::runtime_error(std::format("[ERROR]:decompiler: {}", what))
decomp_error::decomp_error(std::string const& what) : std::runtime_error(fmt::format("[ERROR]:decompiler: {}", what))
{
}

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -83,7 +83,6 @@ auto token::to_string() -> std::string
case token::ENDON: return "endon";
case token::NOTIFY: return "notify";
case token::WAIT: return "wait";
case token::WAITREALTIME: return "waitrealtime";
case token::WAITTILL: return "waittill";
case token::WAITTILLMATCH: return "waittillmatch";
case token::WAITTILLFRAMEEND: return "waittillframeend";

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -33,7 +33,6 @@ auto compiler::emit_program(program const& prog) -> void
developer_thread_ = false;
animtree_ = {};
index_ = 0;
debug_pos_ = { 0, 0 };
for (auto const& include : prog.includes)
{
@ -49,7 +48,7 @@ auto compiler::emit_program(program const& prog) -> void
for (auto const& entry : localfuncs_)
{
if (entry == name)
throw comp_error(dec->loc(), std::format("function name '{}' already defined as local function", name));
throw comp_error(dec->loc(), fmt::format("function name '{}' already defined as local function", name));
}
localfuncs_.push_back(dec->as<decl_function>().name->value);
@ -70,7 +69,7 @@ auto compiler::emit_include(include const& inc) -> void
{
if (entry == path)
{
throw comp_error(inc.loc(), std::format("duplicated include file {}", path));
throw comp_error(inc.loc(), fmt::format("duplicated include file {}", path));
}
}
@ -139,8 +138,6 @@ auto compiler::emit_decl_function(decl_function const& func) -> void
auto compiler::emit_stmt(stmt const& stm) -> void
{
debug_pos_ = { stm.loc().begin.line, stm.loc().begin.column };
switch (stm.kind())
{
case node::stmt_list:
@ -164,9 +161,6 @@ auto compiler::emit_stmt(stmt const& stm) -> void
case node::stmt_wait:
emit_stmt_wait(stm.as<stmt_wait>());
break;
case node::stmt_waitrealtime:
emit_stmt_waitrealtime(stm.as<stmt_waitrealtime>());
break;
case node::stmt_waittill:
emit_stmt_waittill(stm.as<stmt_waittill>());
break;
@ -241,17 +235,7 @@ auto compiler::emit_stmt_comp(stmt_comp const& stm) -> void
auto compiler::emit_stmt_dev(stmt_dev const& stm) -> void
{
auto end = create_label();
developer_thread_ = true;
emit_opcode(opcode::OP_DevblockBegin, end);
auto& paren = scopes_.back();
scopes_.push_back(scope(paren.brk, paren.cnt));
emit_stmt_list(*stm.block);
scopes_.pop_back();
insert_label(end);
developer_thread_ = false;
}
auto compiler::emit_stmt_expr(stmt_expr const& stm) -> void
@ -310,12 +294,6 @@ auto compiler::emit_stmt_wait(stmt_wait const& stm) -> void
emit_opcode(opcode::OP_Wait);
}
auto compiler::emit_stmt_waitrealtime(stmt_waitrealtime const& stm) -> void
{
emit_expr(*stm.time);
emit_opcode(opcode::OP_RealWait);
}
auto compiler::emit_stmt_waittill(stmt_waittill const& stm) -> void
{
emit_expr(*stm.event);
@ -327,7 +305,7 @@ auto compiler::emit_stmt_waittill(stmt_waittill const& stm) -> void
if (entry->is<expr_undefined>())
emit_opcode(opcode::OP_SafeDecTop);
else
emit_opcode(opcode::OP_SafeSetWaittillVariableFieldCached, std::format("{}", variable_access(entry->as<expr_identifier>())));
emit_opcode(opcode::OP_SafeSetWaittillVariableFieldCached, fmt::format("{}", variable_access(entry->as<expr_identifier>())));
}
emit_opcode(opcode::OP_ClearParams);
@ -338,7 +316,7 @@ auto compiler::emit_stmt_waittillmatch(stmt_waittillmatch const& stm) -> void
emit_expr_arguments(*stm.args);
emit_expr(*stm.event);
emit_expr(*stm.obj);
emit_opcode(opcode::OP_WaitTillMatch, std::format("{}", stm.args->list.size()));
emit_opcode(opcode::OP_WaitTillMatch, fmt::format("{}", stm.args->list.size()));
emit_opcode(opcode::OP_ClearParams);
}
@ -532,7 +510,7 @@ auto compiler::emit_stmt_foreach(stmt_foreach const& stm) -> void
can_continue_ = true;
emit_expr_variable(*stm.key);
emit_opcode(opcode::OP_EvalLocalVariableCached, std::format("{}", variable_access(stm.array->as<expr_identifier>())));
emit_opcode(opcode::OP_EvalLocalVariableCached, fmt::format("{}", variable_access(stm.array->as<expr_identifier>())));
emit_opcode(opcode::OP_EvalArray);
emit_expr_variable_ref(*stm.value, true);
@ -570,7 +548,7 @@ auto compiler::emit_stmt_switch(stmt_switch const& stm) -> void
can_break_ = true;
auto data = std::vector<std::string>{};
data.push_back(std::format("{}", stm.body->block->list.size()));
data.push_back(fmt::format("{}", stm.body->block->list.size()));
auto type = switch_type::none;
auto loc_default = std::string{};
@ -640,7 +618,7 @@ auto compiler::emit_stmt_switch(stmt_switch const& stm) -> void
data.push_back(loc_default);
}
data.push_back(std::format("{}", static_cast<std::underlying_type_t<switch_type>>(type)));
data.push_back(fmt::format("{}", static_cast<std::underlying_type_t<switch_type>>(type)));
insert_label(table_loc);
emit_opcode(opcode::OP_EndSwitch, data);
@ -708,8 +686,6 @@ auto compiler::emit_stmt_prof_end(stmt_prof_end const&) -> void
auto compiler::emit_expr(expr const& exp) -> void
{
debug_pos_ = { exp.loc().begin.line, exp.loc().begin.column };
switch (exp.kind())
{
case node::expr_paren:
@ -868,10 +844,10 @@ auto compiler::emit_expr_const(expr_const const& exp) -> void
auto const itr = constants_.find(exp.lvalue->value);
if (itr != constants_.end())
throw comp_error(exp.loc(), std::format("duplicated constant '{}'", exp.lvalue->value));
throw comp_error(exp.loc(), fmt::format("duplicated constant '{}'", exp.lvalue->value));
if (std::find(stackframe_.begin(), stackframe_.end(), exp.lvalue->value) != stackframe_.end())
throw comp_error(exp.loc(), std::format("constant already defined as local variable '{}'", exp.lvalue->value));
throw comp_error(exp.loc(), fmt::format("constant already defined as local variable '{}'", exp.lvalue->value));
constants_.insert({ exp.lvalue->value, exp.rvalue.get() });
}
@ -1125,7 +1101,7 @@ auto compiler::emit_expr_call_pointer(expr_pointer const& exp, bool is_stmt) ->
emit_expr_arguments(*exp.args);
emit_expr(*exp.func);
auto argcount = std::format("{}", exp.args->list.size());
auto argcount = fmt::format("{}", exp.args->list.size());
switch (exp.mode)
{
@ -1178,18 +1154,18 @@ auto compiler::emit_expr_call_function(expr_function const& exp, bool is_stmt) -
emit_opcode(opcode::OP_PreScriptCall);
emit_expr_arguments(*exp.args);
auto argcount = std::format("{}", exp.args->list.size());
auto argcount = fmt::format("{}", exp.args->list.size());
auto flags = developer_thread_ ? static_cast<u8>(import_flags::developer) : 0;
switch (exp.mode)
{
case call::mode::normal:
flags |= static_cast<u8>(import_flags::func_call);
emit_opcode(opcode::OP_ScriptFunctionCall, { exp.path->value, exp.name->value, argcount, std::format("{}", flags) });
emit_opcode(opcode::OP_ScriptFunctionCall, { exp.path->value, exp.name->value, argcount, fmt::format("{}", flags) });
break;
case call::mode::thread:
flags |= static_cast<u8>(import_flags::func_call_thread);
emit_opcode(opcode::OP_ScriptThreadCall, { exp.path->value, exp.name->value, argcount, std::format("{}", flags) });
emit_opcode(opcode::OP_ScriptThreadCall, { exp.path->value, exp.name->value, argcount, fmt::format("{}", flags) });
break;
default:
break;
@ -1222,7 +1198,7 @@ auto compiler::emit_expr_method_pointer(expr_pointer const& exp, expr const& obj
emit_expr(obj);
emit_expr(*exp.func);
auto argcount = std::format("{}", exp.args->list.size());
auto argcount = fmt::format("{}", exp.args->list.size());
switch (exp.mode)
{
@ -1265,18 +1241,18 @@ auto compiler::emit_expr_method_function(expr_function const& exp, expr const& o
emit_expr_arguments(*exp.args);
emit_expr(obj);
auto argcount = std::format("{}", exp.args->list.size());
auto argcount = fmt::format("{}", exp.args->list.size());
auto flags = developer_thread_ ? static_cast<u8>(import_flags::developer) : 0;
switch (exp.mode)
{
case call::mode::normal:
flags |= static_cast<u8>(import_flags::meth_call);
emit_opcode(opcode::OP_ScriptMethodCall, { exp.path->value, exp.name->value, argcount, std::format("{}", flags) });
emit_opcode(opcode::OP_ScriptMethodCall, { exp.path->value, exp.name->value, argcount, fmt::format("{}", flags) });
break;
case call::mode::thread:
flags |= static_cast<u8>(import_flags::meth_call_thread);
emit_opcode(opcode::OP_ScriptMethodThreadCall, { exp.path->value, exp.name->value, argcount, std::format("{}", flags) });
emit_opcode(opcode::OP_ScriptMethodThreadCall, { exp.path->value, exp.name->value, argcount, fmt::format("{}", flags) });
break;
default:
break;
@ -1461,7 +1437,7 @@ auto compiler::emit_expr_reference(expr_reference const& exp) -> void
auto flags = developer_thread_ ? static_cast<u8>(import_flags::developer) : 0;
flags |= static_cast<u8>(import_flags::func_reference);
emit_opcode(opcode::OP_GetFunction, { exp.path->value, exp.name->value, "0", std::format("{}", flags) });
emit_opcode(opcode::OP_GetFunction, { exp.path->value, exp.name->value, "0", fmt::format("{}", flags) });
}
auto compiler::emit_expr_size(expr_size const& exp) -> void
@ -1547,7 +1523,7 @@ auto compiler::emit_expr_field_ref(expr_field const& exp, bool set) -> void
if (set) emit_opcode(opcode::OP_SetVariableField);
break;
case node::expr_identifier:
emit_opcode(opcode::OP_EvalLocalVariableCached, std::format("{}", variable_access(exp.obj->as<expr_identifier>())));
emit_opcode(opcode::OP_EvalLocalVariableCached, fmt::format("{}", variable_access(exp.obj->as<expr_identifier>())));
emit_opcode(opcode::OP_CastFieldObject);
emit_opcode(opcode::OP_EvalFieldVariableRef, field);
if (set) emit_opcode(opcode::OP_SetVariableField);
@ -1575,10 +1551,10 @@ auto compiler::emit_expr_local_ref(expr_identifier const& exp, bool set) -> void
if (it != constants_.end())
{
throw comp_error(exp.loc(), std::format("variable name already defined as constant '{}'", exp.value));
throw comp_error(exp.loc(), fmt::format("variable name already defined as constant '{}'", exp.value));
}
emit_opcode(opcode::OP_EvalLocalVariableRefCached, std::format("{}", variable_access(exp)));
emit_opcode(opcode::OP_EvalLocalVariableRefCached, fmt::format("{}", variable_access(exp)));
if (set)
{
@ -1650,7 +1626,7 @@ auto compiler::emit_expr_field(expr_field const& exp) -> void
emit_opcode(opcode::OP_EvalFieldVariable, field);
break;
case node::expr_identifier:
emit_opcode(opcode::OP_EvalLocalVariableCached, std::format("{}", variable_access(exp.obj->as<expr_identifier>())));
emit_opcode(opcode::OP_EvalLocalVariableCached, fmt::format("{}", variable_access(exp.obj->as<expr_identifier>())));
emit_opcode(opcode::OP_CastFieldObject);
emit_opcode(opcode::OP_EvalFieldVariable, field);
break;
@ -1666,7 +1642,7 @@ auto compiler::emit_expr_local(expr_identifier const& exp) -> void
if (it != constants_.end())
emit_expr(*it->second);
else
emit_opcode(opcode::OP_EvalLocalVariableCached, std::format("{}", variable_access(exp)));
emit_opcode(opcode::OP_EvalLocalVariableCached, fmt::format("{}", variable_access(exp)));
}
auto compiler::emit_expr_object(expr const& exp) -> void
@ -1699,7 +1675,7 @@ auto compiler::emit_expr_object(expr const& exp) -> void
emit_opcode(opcode::OP_CastFieldObject);
break;
case node::expr_identifier:
emit_opcode(opcode::OP_EvalLocalVariableCached, std::format("{}", variable_access(exp.as<expr_identifier>())));
emit_opcode(opcode::OP_EvalLocalVariableCached, fmt::format("{}", variable_access(exp.as<expr_identifier>())));
emit_opcode(opcode::OP_CastFieldObject);
break;
default:
@ -1790,7 +1766,7 @@ auto compiler::emit_expr_vector(expr_vector const& exp) -> void
if (isconst)
{
emit_opcode(opcode::OP_VectorConstant, std::format("{}", flags));
emit_opcode(opcode::OP_VectorConstant, fmt::format("{}", flags));
}
else
{
@ -1890,7 +1866,6 @@ auto compiler::emit_opcode(opcode op) -> void
inst->opcode = op;
inst->size = ctx_->opcode_size(op);
inst->index = index_;
inst->pos = debug_pos_;
index_ += inst->size;
}
@ -1904,7 +1879,6 @@ auto compiler::emit_opcode(opcode op, std::string const& data) -> void
inst->size = ctx_->opcode_size(op);
inst->index = index_;
inst->data.push_back(data);
inst->pos = debug_pos_;
index_ += inst->size;
}
@ -1918,7 +1892,6 @@ auto compiler::emit_opcode(opcode op, std::vector<std::string> const& data) -> v
inst->size = ctx_->opcode_size(op);
inst->index = index_;
inst->data = data;
inst->pos = debug_pos_;
index_ += inst->size;
}
@ -1972,7 +1945,6 @@ auto compiler::process_stmt(stmt const& stm) -> void
case node::stmt_endon:
case node::stmt_notify:
case node::stmt_wait:
case node::stmt_waitrealtime:
case node::stmt_waittillmatch:
case node::stmt_waittillframeend:
case node::stmt_case:
@ -2161,7 +2133,7 @@ auto compiler::variable_access(expr_identifier const& exp) -> u8
}
}
throw comp_error(exp.loc(), std::format("local variable '{}' not found", exp.value));
throw comp_error(exp.loc(), fmt::format("local variable '{}' not found", exp.value));
}
auto compiler::is_constant_condition(expr const& exp) -> bool
@ -2232,7 +2204,7 @@ auto compiler::insert_label() -> std::string
else
{
label_idx_++;
auto name = std::format("loc_{}", label_idx_);
auto name = fmt::format("loc_{}", label_idx_);
function_->labels.insert({ index_, name });
return name;
}
@ -2241,7 +2213,7 @@ auto compiler::insert_label() -> std::string
auto compiler::create_label() -> std::string
{
label_idx_++;
return std::format("loc_{}", label_idx_);
return fmt::format("loc_{}", label_idx_);
}
} // namespace xsk::arc

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -206,7 +206,7 @@ auto context::opcode_size(opcode op) const -> u32
case opcode::OP_GetVector:
return (props_ & props::size64) ? 14 : 13;
default:
throw error(std::format("couldn't resolve instruction size for '{}'", opcode_name(op)));
throw error(fmt::format("couldn't resolve instruction size for '{}'", opcode_name(op)));
}
}
@ -219,7 +219,7 @@ auto context::opcode_id(opcode op) const -> u16
return itr->second;
}
throw error(std::format("couldn't resolve opcode id for '{}'", opcode_name(op)));
throw error(fmt::format("couldn't resolve opcode id for '{}'", opcode_name(op)));
}
auto context::opcode_name(opcode op) const -> std::string
@ -231,7 +231,7 @@ auto context::opcode_name(opcode op) const -> std::string
return std::string{ itr->second };
}
throw std::runtime_error(std::format("couldn't resolve opcode string for enum '{}'", static_cast<std::underlying_type_t<opcode>>(op)));
throw std::runtime_error(fmt::format("couldn't resolve opcode string for enum '{}'", static_cast<std::underlying_type_t<opcode>>(op)));
}
auto context::opcode_enum(std::string const& name) const -> opcode
@ -243,7 +243,7 @@ auto context::opcode_enum(std::string const& name) const -> opcode
return itr->second;
}
throw std::runtime_error(std::format("couldn't resolve opcode enum for name '{}'", name));
throw std::runtime_error(fmt::format("couldn't resolve opcode enum for name '{}'", name));
}
auto context::opcode_enum(u16 id) const -> opcode
@ -302,7 +302,7 @@ auto context::hash_name(u32 id) const -> std::string
return std::string(itr->second);
}
return std::format("_id_{:08X}", id);
return fmt::format("_id_{:08X}", id);
}
auto context::make_token(std::string_view str) const -> std::string
@ -344,7 +344,7 @@ auto context::load_header(std::string const& name) -> std::tuple<std::string con
}
}
throw error(std::format("couldn't open gsh file '{}'", name));
throw error(fmt::format("couldn't open gsh file '{}'", name));
}
extern std::array<std::pair<opcode, std::string_view>, opcode_count> const opcode_list

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -86,7 +86,7 @@ auto decompiler::decompile_function(function const& func) -> void
}
auto& list = func_->body->block->list;
locs_.end = std::format("loc_{:X}", list.back()->loc().begin.line + 1);
locs_.end = fmt::format("loc_{:X}", list.back()->loc().begin.line + 1);
decompile_statements(*func_->body->block);
@ -1137,7 +1137,7 @@ auto decompiler::decompile_instruction(instruction const& inst, bool last) -> vo
case opcode::OP_EvalLocalVariableCachedDebug:
case opcode::OP_EvalLocalVariableRefCachedDebug:
default:
throw decomp_error(std::format("unhandled opcode {}", ctx_->opcode_name(inst.opcode)));
throw decomp_error(fmt::format("unhandled opcode {}", ctx_->opcode_name(inst.opcode)));
}
}
@ -1933,7 +1933,7 @@ auto decompiler::find_location_index(stmt_list const& stm, std::string const& lo
index++;
}
throw decomp_error(std::format("location '{}' not found", loc));
throw decomp_error(fmt::format("location '{}' not found", loc));
}
auto decompiler::last_location_index(stmt_list const& stm, usize index) -> bool
@ -1992,7 +1992,7 @@ auto decompiler::resolve_label(std::string const& name) -> u32
}
}
throw decomp_error(std::format("couldn't resolve label address of '{}'", name));
throw decomp_error(fmt::format("couldn't resolve label address of '{}'", name));
}
auto decompiler::process_function(decl_function& func) -> void
@ -2037,15 +2037,15 @@ auto decompiler::process_stmt(stmt& stm) -> void
case node::stmt_wait:
process_stmt_wait(stm.as<stmt_wait>());
break;
case node::stmt_waitrealtime:
process_stmt_waitrealtime(stm.as<stmt_waitrealtime>());
break;
case node::stmt_waittill:
process_stmt_waittill(stm.as<stmt_waittill>());
break;
case node::stmt_waittillmatch:
process_stmt_waittillmatch(stm.as<stmt_waittillmatch>());
break;
case node::stmt_waitrealtime:
process_stmt_waitrealtime(stm.as<stmt_waitrealtime>());
break;
case node::stmt_if:
process_stmt_if(stm.as<stmt_if>());
break;
@ -2135,11 +2135,6 @@ auto decompiler::process_stmt_wait(stmt_wait& stm) -> void
process_expr(stm.time);
}
auto decompiler::process_stmt_waitrealtime(stmt_waitrealtime& stm) -> void
{
process_expr(stm.time);
}
auto decompiler::process_stmt_waittill(stmt_waittill& stm) -> void
{
process_expr(stm.event);
@ -2158,6 +2153,11 @@ auto decompiler::process_stmt_waittillmatch(stmt_waittillmatch& stm) -> void
process_expr(stm.obj);
}
auto decompiler::process_stmt_waitrealtime(stmt_waitrealtime& stm) -> void
{
process_expr(stm.time);
}
auto decompiler::process_stmt_if(stmt_if& stm) -> void
{
process_expr(stm.test);

View File

@ -1,4 +1,4 @@
// Copyright 2024 xensik. All rights reserved.
// Copyright 2023 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
@ -476,17 +476,17 @@ auto disassembler::disassemble_instruction(instruction& inst) -> void
break;
case opcode::OP_GetByte:
case opcode::OP_GetNegByte:
inst.data.push_back(std::format("{}", script_.read<u8>()));
inst.data.push_back(fmt::format("{}", script_.read<u8>()));
break;
case opcode::OP_GetUnsignedShort:
case opcode::OP_GetNegUnsignedShort:
inst.size += script_.align(2);
inst.data.push_back(std::format("{}", script_.read<u16>()));
inst.data.push_back(fmt::format("{}", script_.read<u16>()));
break;
case opcode::OP_GetInteger:
inst.size += script_.align(4);
disassemble_animtree(inst);
inst.data.push_back(std::format("{}", script_.read<i32>()));
inst.data.push_back(fmt::format("{}", script_.read<i32>()));
break;
case opcode::OP_GetFloat:
inst.size += script_.align(4);
@ -496,7 +496,7 @@ auto disassembler::disassemble_instruction(instruction& inst) -> void
//case opcode::OP_ProfileStart:
case opcode::OP_GetAPIFunction:
inst.size += script_.align(8);
inst.data.push_back(std::format("0x{:016X}", script_.read<u64>()));
inst.data.push_back(fmt::format("0x{:016X}", script_.read<u64>()));
break;
case opcode::OP_GetVector:
inst.size += script_.align(4);
@ -512,10 +512,10 @@ auto disassembler::disassemble_instruction(instruction& inst) -> void
disassemble_animation(inst);
break;
case opcode::OP_WaitTillMatch:
inst.data.push_back(std::format("{}", script_.read<u8>()));
inst.data.push_back(fmt::format("{}", script_.read<u8>()));
break;
case opcode::OP_VectorConstant:
inst.data.push_back(std::format("{}", script_.read<u8>()));
inst.data.push_back(fmt::format("{}", script_.read<u8>()));
break;
case opcode::OP_GetHash:
inst.size += script_.align(4);
@ -535,7 +535,7 @@ auto disassembler::disassemble_instruction(instruction& inst) -> void
case opcode::OP_EvalLocalArrayRefCached:
case opcode::OP_SafeSetWaittillVariableFieldCached:
case opcode::OP_EvalLocalVariableRefCached:
inst.data.push_back(std::format("{}", script_.read<u8>()));
inst.data.push_back(fmt::format("{}", script_.read<u8>()));
break;
case opcode::OP_EvalFieldVariable:
case opcode::OP_EvalFieldVariableRef:
@ -553,7 +553,7 @@ auto disassembler::disassemble_instruction(instruction& inst) -> void
case opcode::OP_ScriptMethodCallPointer:
case opcode::OP_ScriptThreadCallPointer:
case opcode::OP_ScriptMethodThreadCallPointer:
inst.data.push_back(std::format("{}", script_.read<u8>()));
inst.data.push_back(fmt::format("{}", script_.read<u8>()));
break;
case opcode::OP_GetFunction:
disassemble_import(inst);
@ -583,7 +583,7 @@ auto disassembler::disassemble_instruction(instruction& inst) -> void
disassemble_end_switch(inst);
break;
default:
throw disasm_error(std::format("unhandled opcode {} at index {:04X}", ctx_->opcode_name(inst.opcode), inst.index));
throw disasm_error(fmt::format("unhandled opcode {} at index {:04X}", ctx_->opcode_name(inst.opcode), inst.index));
}
}
@ -606,7 +606,7 @@ auto disassembler::disassemble_name(instruction& inst) -> void
return;
}
throw disasm_error(std::format("string reference not found at index {:04X}", inst.index));
throw disasm_error(fmt::format("string reference not found at index {:04X}", inst.index));
}
}
@ -620,7 +620,7 @@ auto disassembler::disassemble_params(instruction& inst) -> void
{
inst.size += script_.align(4) + 5;
inst.data.push_back(ctx_->hash_name(script_.read<u32>()));
inst.data.push_back(std::format("{}", script_.read<u8>()));
inst.data.push_back(fmt::format("{}", script_.read<u8>()));
}
else
{
@ -644,7 +644,7 @@ auto disassembler::disassemble_import(instruction& inst) -> void
return;
}
throw disasm_error(std::format("import reference not found at index {:04X}", inst.index));
throw disasm_error(fmt::format("import reference not found at index {:04X}", inst.index));
}
auto disassembler::disassemble_string(instruction& inst) -> void
@ -660,7 +660,7 @@ auto disassembler::disassemble_string(instruction& inst) -> void
return;
}
throw disasm_error(std::format("string reference not found at index {:04X}", inst.index));
throw disasm_error(fmt::format("string reference not found at index {:04X}", inst.index));
}
auto disassembler::disassemble_animtree(instruction& inst) -> void
@ -695,7 +695,7 @@ auto disassembler::disassemble_animation(instruction& inst) -> void
}
}
throw disasm_error(std::format("animation reference not found at index {:04X}", inst.index));
throw disasm_error(fmt::format("animation reference not found at index {:04X}", inst.index));
}
auto disassembler::disassemble_jump(instruction& inst) -> void
@ -709,7 +709,7 @@ auto disassembler::disassemble_jump(instruction& inst) -> void
else
addr = script_.read<i16>() + script_.pos();
auto const label = std::format("loc_{:X}", addr);
auto const label = fmt::format("loc_{:X}", addr);
inst.data.push_back(label);
func_->labels.insert({ addr, label });
@ -720,7 +720,7 @@ auto disassembler::disassemble_switch(instruction& inst) -> void
inst.size += script_.align(4);
auto const addr = script_.read<i32>() + script_.pos();
auto const label = std::format("loc_{:X}", addr);
auto const label = fmt::format("loc_{:X}", addr);
inst.data.push_back(label);
func_->labels.insert({ addr, label });
@ -738,7 +738,7 @@ auto disassembler::disassemble_end_switch(instruction& inst) -> void
{
if (entry->opcode == opcode::OP_Switch && entry->data[0] == itr->second)
{
auto const label = std::format("loc_{:X}", inst.index);
auto const label = fmt::format("loc_{:X}", inst.index);
entry->data[0] = label;
func_->labels.erase(script_.pos());
@ -754,7 +754,7 @@ auto disassembler::disassemble_end_switch(instruction& inst) -> void
auto type = switch_type::none;
auto const count = script_.read<u32>();
inst.data.push_back(std::format("{}", count));
inst.data.push_back(fmt::format("{}", count));
for (auto i = 0u; i < count; i++)
{
@ -777,7 +777,7 @@ auto disassembler::disassemble_end_switch(instruction& inst) -> void
{
type = switch_type::integer;
inst.data.push_back("case");
inst.data.push_back(std::format("{}", value));
inst.data.push_back(fmt::format("{}", value));
}
}
else
@ -798,12 +798,12 @@ auto disassembler::disassemble_end_switch(instruction& inst) -> void
{
type = switch_type::integer;
inst.data.push_back("case");
inst.data.push_back(std::format("{}", (value - 0x800000) & 0xFFFFFF));
inst.data.push_back(fmt::format("{}", (value - 0x800000) & 0xFFFFFF));
}
}
auto const addr = script_.read<i32>() + script_.pos();
auto const label = std::format("loc_{:X}", addr);
auto const label = fmt::format("loc_{:X}", addr);
inst.data.push_back(label);
func_->labels.insert({ addr, label });
@ -811,7 +811,7 @@ auto disassembler::disassemble_end_switch(instruction& inst) -> void
inst.size += 8;
}
inst.data.push_back(std::format("{}", static_cast<std::underlying_type_t<switch_type>>(type)));
inst.data.push_back(fmt::format("{}", static_cast<std::underlying_type_t<switch_type>>(type)));
}
} // namespace xsk::arc

View File

@ -1,32 +0,0 @@
// Copyright 2024 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
#include "xsk/arc/engine/jup.hpp"
namespace xsk::arc::jup
{
extern std::array<std::pair<u16, opcode>, code_count> const code_list;
// extern std::array<std::pair<u32, char const*>, hash_count> const hash_list;
context::context() : arc::context(props::v3, engine::jup, endian::little, system::pc, header_magic)
{
code_map_.reserve(code_list.size());
code_map_rev_.reserve(code_list.size());
// hash_map_.reserve(hash_list.size());
for (auto const& entry : code_list)
{
code_map_.insert({ entry.first, entry.second });
code_map_rev_.insert({ entry.second, entry.first });
}
// for (auto const& entry : hash_list)
// {
// hash_map_.insert({ entry.first, entry.second });
// }
}
} // namespace xsk::arc::jup

View File

@ -1,15 +0,0 @@
// Copyright 2024 xensik. All rights reserved.
//
// Use of this source code is governed by a GNU GPLv3 license
// that can be found in the LICENSE file.
#include "xsk/arc/engine/jup.hpp"
namespace xsk::arc::jup
{
extern std::array<std::pair<u16, opcode>, code_count> const code_list
{{
}};
} // namespace xsk::arc::jup

Some files were not shown because too many files have changed in this diff Show More