From 22b5fd581ace0ab00e54a2d89609d6ba9efe5cc1 Mon Sep 17 00:00:00 2001 From: sup39 Date: Wed, 23 Feb 2022 09:32:28 +0900 Subject: [PATCH] fix premake5.lua; add stdlib-sup39 --- .gitignore | 3 +++ premake5.lua | 33 +++++++++++++++++++++++++++------ stdlib-sup39/common.sun | 2 ++ stdlib-sup39/draw-lite.sun | 2 ++ stdlib-sup39/input.sun | 20 ++++++++++++++++++++ stdlib-sup39/ram.sun | 25 +++++++++++++++++++++++++ 6 files changed, 79 insertions(+), 6 deletions(-) create mode 100644 stdlib-sup39/common.sun create mode 100644 stdlib-sup39/draw-lite.sun create mode 100644 stdlib-sup39/input.sun create mode 100644 stdlib-sup39/ram.sun diff --git a/.gitignore b/.gitignore index 53c1020..8f941a5 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,6 @@ bin/ # generated types generated/ + +# build +Makefile diff --git a/premake5.lua b/premake5.lua index a5e0fe0..b249aab 100644 --- a/premake5.lua +++ b/premake5.lua @@ -19,6 +19,20 @@ if not _OPTIONS["lib-dir"] then _OPTIONS["lib-dir"] = "lib" end +-- clean +newaction { + trigger = "clean", + description = "clean the software", + execute = function () + print("Clean the build...") + os.rmdir("./bin") + os.rmdir("./ssc/obj") + os.rmdir("./frontend/obj") + os.rmdir("./sbdump/obj") + print("Done.") + end +} + -- main workspace workspace "ssc" configurations { "Debug", "Release" } @@ -29,7 +43,7 @@ workspace "ssc" filter "configurations:Debug" defines { "DEBUG" } - flags { "Symbols" } + flags { symbols "On" } filter "configurations:Release" defines { "RELEASE" } @@ -42,7 +56,7 @@ workspace "ssc" namespace "arookas" location "ssc" - links { "System", "arookas", "grammatica-1.6" } + links { "System.dll", "System.Core.dll", "arookas.dll", "grammatica-1.6.dll" } -- apply options if _OPTIONS["clean-functions"] then @@ -77,7 +91,8 @@ workspace "ssc" namespace "arookas" location "frontend" - links { "System", "arookas", "SSC" } + libdirs { "$(TARGETDIR)" } + links { "System.dll", "System.Core.dll", "arookas.dll", "ssc.dll" } files { "frontend/**.cs", @@ -90,8 +105,14 @@ workspace "ssc" postbuildcommands { -- copy stdlib to frontend output so users can import the scripts - '{RMDIR} "%{cfg.buildtarget.directory}ssc"', - '{COPY} "%{wks.location}stdlib" "%{cfg.buildtarget.directory}ssc"', + '{MKDIR} "%{cfg.buildtarget.directory}/ssc"', + '{RMDIR} "%{cfg.buildtarget.directory}/ssc"', + '{MKDIR} "%{cfg.buildtarget.directory}/ssc-sup39"', + '{RMDIR} "%{cfg.buildtarget.directory}/ssc-sup39"', + '{COPY} "%{wks.location}/stdlib" "%{cfg.buildtarget.directory}/ssc"', + '{COPY} "%{wks.location}/stdlib-sup39" "%{cfg.buildtarget.directory}/ssc-sup39"', + '{COPY} "%{wks.location}/lib/*.dll" "%{cfg.buildtarget.directory}/"', + '{COPY} "%{wks.location}/utils/*" "%{cfg.buildtarget.directory}/"', } -- sbdump utility @@ -102,7 +123,7 @@ workspace "ssc" namespace "arookas" location "sbdump" - links { "System", "arookas" } + links { "System.dll", "System.Core.dll", "arookas.dll" } files { "sbdump/**.cs", diff --git a/stdlib-sup39/common.sun b/stdlib-sup39/common.sun new file mode 100644 index 0000000..2d89b59 --- /dev/null +++ b/stdlib-sup39/common.sun @@ -0,0 +1,2 @@ +import "./ram.sun"; +import "./input.sun"; diff --git a/stdlib-sup39/draw-lite.sun b/stdlib-sup39/draw-lite.sun new file mode 100644 index 0000000..0cde7f5 --- /dev/null +++ b/stdlib-sup39/draw-lite.sun @@ -0,0 +1,2 @@ +builtin drawText(x, y, fontSize, colorTop, colorBot, fmt, ...); +builtin drawRect(fill, stroke, x0, y0, x1, y1); diff --git a/stdlib-sup39/input.sun b/stdlib-sup39/input.sun new file mode 100644 index 0000000..4fc57b9 --- /dev/null +++ b/stdlib-sup39/input.sun @@ -0,0 +1,20 @@ +var const addrButton = $80400D50; +var const PRESS_S = 0x1000; +var const PRESS_B = 0x0200; +var const PRESS_A = 0x0100; +var const PRESS_Z = 0x0010; +var const PRESS_X = 0x0400; +var const PRESS_Y = 0x0800; +var const PRESS_DU = 0x0008; +var const PRESS_DD = 0x0004; +var const PRESS_DL = 0x0001; +var const PRESS_DR = 0x0002; +var const PRESS_L = 0x0040; +var const PRESS_R = 0x0020; + +var const addrLTrig = $80400D90; +var const addrRTrig = $80400D94; +var const addrMStickX = $80400E40; +var const addrMStickY = $80400E44; +var const addrCStickX = $80400E80; +var const addrCStickY = $80400E84; diff --git a/stdlib-sup39/ram.sun b/stdlib-sup39/ram.sun new file mode 100644 index 0000000..575b139 --- /dev/null +++ b/stdlib-sup39/ram.sun @@ -0,0 +1,25 @@ +builtin readRAM(addr, ...); +builtin writeRAM(addr, value, ...); +builtin memcpy(dst, src, count); + +/* https://docs.google.com/spreadsheets/d/1ElTW-akaTUF9OC2pIFR9-7aVPwpJ54AdEVJyJ_jvg0E/edit#gid=1727422135 */ +var const gpApplication = $803E6000; +var const addrRand = $80408CF0; +var const addrFlagManager = $8040A290; +var const gpMarDirector = $8040A2A8; +var const gpCardManager = $8040A2B4; +var const gpMarioOriginal = $8040A378; +var const gpMarioAddress = $8040A398; +var const gpMarioPos = $8040A39C; +var const gpMarioAngleX = $8040A3A0; +var const gpMarioAngleY = $8040A3A4; +var const gpMarioAngleZ = $8040A3A8; +var const gpMarioSpeedX = $8040A3AC; +var const gpMarioSpeedY = $8040A3B0; +var const gpMarioSpeedZ = $8040A3B4; +var const gpItemManager = $8040A4D8; +var const gpMap = $8040A570; +var const gpBeamManager = $8040AEB0; +var const gpCamera = $8040B370; +var const gpCameraMario = $8040B378; +var const gpCameraShake = $8040B380;