diff --git a/.onedev-buildspec.yml b/.onedev-buildspec.yml index fb5a208..0543956 100644 --- a/.onedev-buildspec.yml +++ b/.onedev-buildspec.yml @@ -51,6 +51,16 @@ jobs: name: Publish CrossLang Artifact artifacts: crosslang-x86_64.tar.gz condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + - !CommandStep + name: Wii Build + runInContainer: true + image: onedev.site.tesses.net/dependencies/wiidev:latest + interpreter: !DefaultInterpreter + commands: | + cd Packaging + bash wiibuild.sh + useTTY: true + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL - !CommandStep name: Build and Publish Deb Package runInContainer: true @@ -78,12 +88,7 @@ jobs: runInContainer: true image: onedev.site.tesses.net/dependencies/debbuilder/plucky:latest interpreter: !DefaultInterpreter - commands: | - apt update -y - apt install -y pkg-config - cd Packaging/Linux - bash build-ubuntu-plucky.sh - bash push-ubuntu-plucky.sh + commands: "apt update -y\napt install -y pkg-config \ncd Packaging/Linux\nbash build-ubuntu-plucky.sh\nbash push-ubuntu-plucky.sh\n" envVars: - name: GITEA_AUTH value: '@secret:GITEA_AUTH@' diff --git a/Packaging/CPKG/Wii/CMakeLists.txt b/Packaging/CPKG/Wii/CMakeLists.txt index 2faa465..83ebc58 100644 --- a/Packaging/CPKG/Wii/CMakeLists.txt +++ b/Packaging/CPKG/Wii/CMakeLists.txt @@ -24,3 +24,4 @@ FetchContent_MakeAvailable(TessesCrossLang) add_executable(boot main.cpp) target_link_libraries(boot PUBLIC crosslang_static) +ogc_create_dol(boot) diff --git a/Packaging/CPKG/pack.tcross b/Packaging/CPKG/pack.tcross index 15ec727..6279973 100644 --- a/Packaging/CPKG/pack.tcross +++ b/Packaging/CPKG/pack.tcross @@ -88,7 +88,8 @@ func BuildConsoleOrServerLinuxStatic(dir,cmake_toolchain) homepage = "https://crosslang.tesseslanguage.com/", executable_name = "crossapp", executable_can_be_renamed = true, - executable_runtime = $"linux-{dir}-static" + executable_runtime = $"linux-{dir}-static", + description = $"Runtime files for linux-{dir}-static", }; var name = $"Tesses.CrossLang.Runtime.linux-{dir}-static"; @@ -170,6 +171,7 @@ func BuildConsoleOrServerLinuxShared(dir,$cmake_toolchain) maintainer = "Mike Nolan", repo = "https://onedev.site.tesses.net/crosslang", homepage = "https://crosslang.tesseslanguage.com/", + description = $"Runtime files for linux-{dir}", executable_name = "crossapp", executable_can_be_renamed = true, executable_runtime = $"linux-{dir}" @@ -203,4 +205,22 @@ func main(args) BuildConsoleOrServerLinuxStaticBasedOnTarget(static.target,static.cpu); } + var info = { + type = "archive", + maintainer = "Mike Nolan", + repo = "https://onedev.site.tesses.net/crosslang", + homepage = "https://crosslang.tesseslanguage.com/", + executable_name = "boot.dol", + executable_can_be_renamed = false, + executable_runtime = "wii", + description = $"Runtime files for wii", + }; + + var name = $"Tesses.CrossLang.Runtime.wii"; + + var subDir = new SubdirFilesystem(FS.Local,"publish"/"wii"); + var pkgStrm = FS.Local.OpenFile("publish"/$"{name}-{VERSION}.crvm","wb"); + FS.CreateArchive(subDir,pkgStrm, name ,VERSION, Json.Encode(info)); + pkgStrm.Close(); + } \ No newline at end of file diff --git a/Packaging/CPKG/wiibuild.sh b/Packaging/CPKG/wiibuild.sh new file mode 100644 index 0000000..00b25f6 --- /dev/null +++ b/Packaging/CPKG/wiibuild.sh @@ -0,0 +1,8 @@ +#!/bin/bash +mkdir -p publish/wii +cd Wii +mkdir build +cd build +cmake -S .. -B . -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Wii.cmake +make -j`nproc` +mv boot.dol ../../publish/wii/boot.dol \ No newline at end of file diff --git a/include/CrossLang.hpp b/include/CrossLang.hpp index 290c3b5..aa2b0a1 100644 --- a/include/CrossLang.hpp +++ b/include/CrossLang.hpp @@ -2023,6 +2023,8 @@ class GC { Tesses::Framework::Filesystem::VFSPath SystemToVFSPath(std::string path); void GetDate(Tesses::Framework::Filesystem::VFSPath path, Tesses::Framework::Date::DateTime& lastWrite, Tesses::Framework::Date::DateTime& lastAccess); void SetDate(Tesses::Framework::Filesystem::VFSPath path, Tesses::Framework::Date::DateTime lastWrite, Tesses::Framework::Date::DateTime lastAccess); + void Chmod(Tesses::Framework::Filesystem::VFSPath path, uint32_t mode); + bool StatVFS(Tesses::Framework::Filesystem::VFSPath path, Tesses::Framework::Filesystem::StatVFSData& data); void Close(); ~TObjectVFS(); }; diff --git a/src/types/vfsheapobject.cpp b/src/types/vfsheapobject.cpp index a4a3ca6..32e4c02 100644 --- a/src/types/vfsheapobject.cpp +++ b/src/types/vfsheapobject.cpp @@ -501,6 +501,67 @@ namespace Tesses::CrossLang { } } + void TObjectVFS::Chmod(Tesses::Framework::Filesystem::VFSPath path, uint32_t mode) + { + TDictionary* dict; + + if(GetObjectHeap(this->obj, dict)) + { + GCList ls(this->ls->GetGC()); + dict->CallMethod(ls, "Chmod",{path,(int64_t)mode}); + + } + } + bool TObjectVFS::StatVFS(Tesses::Framework::Filesystem::VFSPath path, Tesses::Framework::Filesystem::StatVFSData& data) + { + TDictionary* dict; + + if(GetObjectHeap(this->obj, dict)) + { + GCList ls(this->ls->GetGC()); + auto res = dict->CallMethod(ls, "StatVFS",{path}); + int64_t _num; + TDictionary* _dict; + TObject _o; + if(GetObjectHeap(res,_dict)) + { + this->ls->GetGC()->BarrierBegin(); + _o = dict->GetValue("BlockSize"); + if(GetObject(_o,_num)) data.BlockSize = (uint64_t)_num; + + _o = dict->GetValue("FragmentSize"); + if(GetObject(_o,_num)) data.FragmentSize = (uint64_t)_num; + _o = dict->GetValue("Blocks"); + if(GetObject(_o,_num)) data.Blocks = (uint64_t)_num; + _o = dict->GetValue("BlocksFree"); + if(GetObject(_o,_num)) data.BlocksFree = (uint64_t)_num; + _o = dict->GetValue("BlocksAvailable"); + if(GetObject(_o,_num)) data.BlocksAvailable = (uint64_t)_num; + _o = dict->GetValue("TotalInodes"); + if(GetObject(_o,_num)) data.TotalInodes = (uint64_t)_num; + _o = dict->GetValue("FreeInodes"); + if(GetObject(_o,_num)) data.FreeInodes = (uint64_t)_num; + _o = dict->GetValue("AvailableInodes"); + if(GetObject(_o,_num)) data.AvailableInodes = (uint64_t)_num; + _o = dict->GetValue("Id"); + if(GetObject(_o,_num)) data.Id = (uint64_t)_num; + _o = dict->GetValue("Flags"); + if(GetObject(_o,_num)) data.Flags = (uint64_t)_num; + _o = dict->GetValue("MaxNameLength"); + if(GetObject(_o,_num)) data.MaxNameLength = (uint64_t)_num; + + + + + + + this->ls->GetGC()->BarrierEnd(); + return true; + } + } + + return false; + } void TObjectVFS::Close() { TDictionary* dict; diff --git a/src/vm/vm.cpp b/src/vm/vm.cpp index 801f0bb..67767df 100644 --- a/src/vm/vm.cpp +++ b/src/vm/vm.cpp @@ -3900,7 +3900,47 @@ namespace Tesses::CrossLang { cse.back()->Push(gc, nullptr); return false; } - + if(key == "Chmod") + { + Tesses::Framework::Filesystem::VFSPath path; + int64_t mode; + if(GetArgumentAsPath(args,0,path) && GetArgument(args,0,mode)) + { + vfs->Chmod(path,(uint32_t)mode); + } + + cse.back()->Push(gc, nullptr); + return false; + } + if(key == "StatVFS") + { + Tesses::Framework::Filesystem::VFSPath path; + + if(GetArgumentAsPath(args,0,path)) + { + Tesses::Framework::Filesystem::StatVFSData data; + if(vfs->StatVFS(path,data)) + { + cse.back()->Push(gc, TDictionary::Create(ls,{ + TDItem("BlockSize", (int64_t)data.BlockSize), + TDItem("FragmentSize",(int64_t)data.FragmentSize), + TDItem("Blocks",(int64_t)data.Blocks), + TDItem("BlocksFree",(int64_t)data.BlocksFree), + TDItem("BlocksAvailable", (int64_t)data.BlocksAvailable), + TDItem("TotalInodes", (int64_t)data.TotalInodes), + TDItem("FreeInodes",(int64_t)data.FreeInodes), + TDItem("AvailableInodes",(int64_t)data.AvailableInodes), + TDItem("Id",(int64_t)data.Id), + TDItem("Flags",(int64_t)data.Flags), + TDItem("MaxNameLength",(int64_t)data.MaxNameLength) + })); + return false; + } + } + + cse.back()->Push(gc, nullptr); + return false; + } cse.back()->Push(gc, nullptr); return false; }