mirror of
https://onedev.site.tesses.net/crosslang
synced 2026-02-08 17:15:45 +00:00
Fix crosslang issues with tooling and update crossvm binary for webapp
This commit is contained in:
@@ -45,6 +45,16 @@ int main(int argc, char** argv)
|
||||
Tesses::Framework::Http::HttpServer svr(port,svr2);
|
||||
svr.StartAccepting();
|
||||
TF_RunEventLoop();
|
||||
TDictionary* _dict;
|
||||
TClassObject* _co;
|
||||
if(GetObjectHeap(res,_dict))
|
||||
{
|
||||
_dict->CallMethod(ls,"Close",{});
|
||||
}
|
||||
if(GetObjectHeap(res,_co))
|
||||
{
|
||||
_co->CallMethod(ls,"","Close",{});
|
||||
}
|
||||
TF_Quit();
|
||||
}
|
||||
else {
|
||||
|
||||
26
Packaging/CPKG/Wii/CMakeLists.txt
Normal file
26
Packaging/CPKG/Wii/CMakeLists.txt
Normal file
@@ -0,0 +1,26 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(CrossLangWii)
|
||||
|
||||
|
||||
set(TESSESFRAMEWORK_ENABLE_RPATH OFF CACHE INTERNAL "For TessesFramework" FORCE)
|
||||
set(TESSESFRAMEWORK_ENABLE_STATIC ON CACHE INTERNAL "For TessesFramework" FORCE)
|
||||
set(TESSESFRAMEWORK_ENABLE_EXAMPLES OFF CACHE INTERNAL "For TessesFramework" FORCE)
|
||||
set(TESSESFRAMEWORK_ENABLE_APPS OFF CACHE INTERNAL "For TessesFramework" FORCE)
|
||||
set(TESSESFRAMEWORK_ENABLE_SHARED OFF CACHE INTERNAL "For TessesFramework" FORCE)
|
||||
set(CROSSLANG_ENABLE_BINARIES OFF CACHE INTERNAL "For CrossLang" FORCE)
|
||||
set(MBEDTLS_DIR "/opt/devkitpro/portlibs/wii" CACHE INTERNAL "For TessesFramework" FORCE)
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
FetchContent_Declare(
|
||||
TessesCrossLang
|
||||
GIT_REPOSITORY https://onedev.site.tesses.net/crosslang.git
|
||||
)
|
||||
|
||||
FetchContent_MakeAvailable(TessesCrossLang)
|
||||
|
||||
|
||||
|
||||
add_executable(boot main.cpp)
|
||||
target_link_libraries(boot PUBLIC crosslang_static)
|
||||
78
Packaging/CPKG/Wii/main.cpp
Normal file
78
Packaging/CPKG/Wii/main.cpp
Normal file
@@ -0,0 +1,78 @@
|
||||
#include <CrossLang.hpp>
|
||||
using namespace Tesses::Framework;
|
||||
using namespace Tesses::CrossLang;
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
TF_InitWithConsole();
|
||||
std::string name = "boot.dol";
|
||||
Tesses::Framework::Filesystem::VFSPath exePath=Tesses::Framework::Filesystem::LocalFS->SystemToVFSPath(name);
|
||||
exePath.MakeAbsolute();
|
||||
exePath.ChangeExtension(".crvm");
|
||||
|
||||
|
||||
|
||||
|
||||
GC gc;
|
||||
gc.Start();
|
||||
GCList ls(gc);
|
||||
TRootEnvironment* env = TRootEnvironment::Create(ls, TDictionary::Create(ls));
|
||||
|
||||
TStd::RegisterStd(&gc,env);
|
||||
env->LoadFileWithDependencies(&gc, Tesses::Framework::Filesystem::LocalFS, exePath);
|
||||
|
||||
|
||||
|
||||
if(env->HasVariable("WebAppMain"))
|
||||
{
|
||||
std::vector<std::string> argsls={"boot.dol"};
|
||||
for(int i = 0; i < argc; i++)
|
||||
{
|
||||
argsls.push_back(argv[i]);
|
||||
}
|
||||
|
||||
Args args(argsls);
|
||||
int port = 4206;
|
||||
for(auto& item : args.options)
|
||||
{
|
||||
if(item.first == "port")
|
||||
{
|
||||
port = std::stoi(item.second);
|
||||
}
|
||||
}
|
||||
TList* args2 = TList::Create(ls);
|
||||
args2->Add(exePath.ToString());
|
||||
for(auto& item : args.positional)
|
||||
{
|
||||
args2->Add(item);
|
||||
}
|
||||
|
||||
auto res = env->CallFunction(ls, "WebAppMain", {args2});
|
||||
auto svr2 = Tesses::CrossLang::ToHttpServer(&gc,res);
|
||||
if(svr2 == nullptr) return 1;
|
||||
Tesses::Framework::Http::HttpServer svr(port,svr2);
|
||||
svr.StartAccepting();
|
||||
TF_RunEventLoop();
|
||||
TDictionary* _dict;
|
||||
TClassObject* _co;
|
||||
if(GetObjectHeap(res,_dict))
|
||||
{
|
||||
_dict->CallMethod(ls,"Close",{});
|
||||
}
|
||||
if(GetObjectHeap(res,_co))
|
||||
{
|
||||
_co->CallMethod(ls,"","Close",{});
|
||||
}
|
||||
TF_Quit();
|
||||
}
|
||||
else {
|
||||
TList* args = TList::Create(ls);
|
||||
args->Add(exePath.ToString());
|
||||
for(int arg=0;arg<argc;arg++)
|
||||
args->Add(argv[arg]);
|
||||
auto res = env->CallFunction(ls,"main",{args});
|
||||
int64_t iresult;
|
||||
if(GetObject(res,iresult))
|
||||
return (int)iresult;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -17,6 +17,7 @@ void Help(const char* filename)
|
||||
}
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
Tesses::Framework::TF_Init();
|
||||
std::string name="out";
|
||||
std::string info="{}";
|
||||
TVMVersion version;
|
||||
|
||||
@@ -6,6 +6,7 @@ using namespace Tesses::Framework::Streams;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
Tesses::Framework::TF_Init();
|
||||
if(argc < 3)
|
||||
{
|
||||
printf("USAGE: %s <archive.crvm> <dirasroot>\n", argv[0]);
|
||||
|
||||
@@ -6,6 +6,7 @@ int main(int argc, char** argv)
|
||||
using namespace Tesses::Framework::Streams;
|
||||
using namespace Tesses::Framework::Filesystem;
|
||||
using namespace Tesses::CrossLang;
|
||||
TF_Init();
|
||||
if(argc > 1 && strcmp(argv[1],"--help"))
|
||||
{
|
||||
std::cout << "Run this command in directory you want to assemble (with the crossasm.json)" << std::endl;
|
||||
|
||||
@@ -12,10 +12,12 @@ void help(char* program)
|
||||
}
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
||||
using namespace Tesses::Framework;
|
||||
using namespace Tesses::Framework::Streams;
|
||||
using namespace Tesses::Framework::Filesystem;
|
||||
using namespace Tesses::CrossLang;
|
||||
TF_Init();
|
||||
|
||||
std::string file;
|
||||
Tesses::Framework::Filesystem::VFSPath path = VFSPath::GetAbsoluteCurrentDirectory();
|
||||
|
||||
@@ -265,6 +265,7 @@ void DumpFile(std::filesystem::path p)
|
||||
}
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
Tesses::Framework::TF_Init();
|
||||
for(int i = 1; i < argc; i++)
|
||||
{
|
||||
DumpFile(argv[i]);
|
||||
|
||||
@@ -18,6 +18,42 @@ int main(int argc, char** argv)
|
||||
TStd::RegisterStd(&gc,env);
|
||||
env->LoadFileWithDependencies(&gc, Tesses::Framework::Filesystem::LocalFS, Tesses::Framework::Filesystem::LocalFS->SystemToVFSPath(argv[1]));
|
||||
|
||||
if(env->HasVariable("WebAppMain"))
|
||||
{
|
||||
Args args(argc, argv);
|
||||
int port = 4206;
|
||||
for(auto& item : args.options)
|
||||
{
|
||||
if(item.first == "port")
|
||||
{
|
||||
port = std::stoi(item.second);
|
||||
}
|
||||
}
|
||||
TList* args2 = TList::Create(ls);
|
||||
for(auto& item : args.positional)
|
||||
{
|
||||
args2->Add(item);
|
||||
}
|
||||
|
||||
auto res = env->CallFunction(ls, "WebAppMain", {args2});
|
||||
auto svr2 = Tesses::CrossLang::ToHttpServer(&gc,res);
|
||||
if(svr2 == nullptr) return 1;
|
||||
Tesses::Framework::Http::HttpServer svr(port,svr2);
|
||||
svr.StartAccepting();
|
||||
TF_RunEventLoop();
|
||||
TDictionary* _dict;
|
||||
TClassObject* _co;
|
||||
if(GetObjectHeap(res,_dict))
|
||||
{
|
||||
_dict->CallMethod(ls,"Close",{});
|
||||
}
|
||||
if(GetObjectHeap(res,_co))
|
||||
{
|
||||
_co->CallMethod(ls,"","Close",{});
|
||||
}
|
||||
TF_Quit();
|
||||
}
|
||||
else {
|
||||
TList* args = TList::Create(ls);
|
||||
for(int arg=1;arg<argc;arg++)
|
||||
args->Add(std::string(argv[arg]));
|
||||
@@ -26,5 +62,6 @@ int main(int argc, char** argv)
|
||||
int64_t iresult;
|
||||
if(GetObject(res,iresult))
|
||||
return (int)iresult;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -11,6 +11,7 @@ int main(int argc, char** argv)
|
||||
using namespace Tesses::Framework::Streams;
|
||||
using namespace Tesses::Framework::Filesystem;
|
||||
using namespace Tesses::CrossLang;
|
||||
TF_Init();
|
||||
|
||||
if(argc < 3)
|
||||
{
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <fstream>
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
Tesses::Framework::TF_Init();
|
||||
std::string p = argv[0];
|
||||
auto emptyThumb =Tesses::Framework::Platform::Environment::GetRealExecutablePath(p).GetParent().GetParent() / "share" / "icons" / "crosslang.png";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user