mirror of
https://onedev.site.tesses.net/tesses-framework
synced 2026-02-08 07:45:46 +00:00
Fix switch
This commit is contained in:
@@ -61,6 +61,7 @@ option(TESSESFRAMEWORK_ENABLE_NETWORKING "Enable Networking" ON)
|
||||
option(TESSESFRAMEWORK_ENABLE_THREADING "Enable Threading" ON)
|
||||
option(TESSESFRAMEWORK_ENABLE_SQLITE "Enable sqlite (embedded in source)" ON)
|
||||
option(TESSESFRAMEWORK_ENABLE_PLATFORMFOLDERS "Enable sago platformfolders (embedded in source)" ON)
|
||||
option(TESSESFRAMEWORK_ENABLE_PROCESS "Enable process api" ON)
|
||||
|
||||
if(TESSESFRAMEWORK_DEFINE_SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS)
|
||||
add_definitions(-DSDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS=1)
|
||||
@@ -144,6 +145,10 @@ target_compile_definitions(${TessesFramework_TARGET} PUBLIC TESSESFRAMEWORK_ENAB
|
||||
endif()
|
||||
if(TESSESFRAMEWORK_ENABLE_PLATFORMFOLDERS)
|
||||
target_compile_definitions(${TessesFramework_TARGET} PUBLIC TESSESFRAMEWORK_ENABLE_PLATFORMFOLDERS)
|
||||
endif()
|
||||
if(TESSESFRAMEWORK_ENABLE_PROCESS)
|
||||
target_compile_definitions(${TessesFramework_TARGET} PUBLIC TESSESFRAMEWORK_ENABLE_PROCESS)
|
||||
|
||||
endif()
|
||||
target_include_directories(${TessesFramework_TARGET}
|
||||
PUBLIC
|
||||
|
||||
@@ -18,6 +18,8 @@ sudo make install
|
||||
|
||||
## What libraries have I embeded from other people
|
||||
- [HodwardHinnart's date](https://github.com/HowardHinnant/date) (in folder src/HodwardHinnart_date, modified tz.cpp to point to correct header)
|
||||
- [PlatformFolders](https://github.com/sago007/PlatformFolders) (in folder src/Platform/sago, modified to conditionally disable for GEKKO, NX etc)
|
||||
- [Sqlite 3](https://www.sqlite.org/) (in folder src/Serialization/sqlite, modified for GEKKO, NX etc, uses the amalgamation)
|
||||
|
||||
## Dependencies
|
||||
- [mbedtls](https://github.com/Mbed-TLS/mbedtls)
|
||||
@@ -27,4 +29,3 @@ sudo make install
|
||||
|
||||
## Resources used from others
|
||||
- [ca-certificate.crt (from ubuntu)](ca-certificate.crt)
|
||||
- [TanoheSans-Regular.ttf (license OFL)](font/License-OFL.txt)
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
#if defined(TESSES_FRAMEWORK_FLAG_@TESSESFRAMEWORK_LOGTOFILE@) && !defined(TESSESFRAMEWORK_LOGTOFILE)
|
||||
#define TESSESFRAMEWORK_LOGTOFILE
|
||||
#endif
|
||||
#if defined(TESSES_FRAMEWORK_FLAG_@TESSESFRAMEWORK_ENABLE_PROCESS@) && !defined(TESSESFRAMEWORK_ENABLE_PROCESS)
|
||||
#define TESSESFRAMEWORK_ENABLE_PROCESS
|
||||
#endif
|
||||
|
||||
#undef TESSES_FRAMEWORK_FLAG_OFF
|
||||
#undef TESSES_FRAMEWORK_FLAG_ON
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace Tesses::Framework::Platform {
|
||||
}
|
||||
|
||||
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__)
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__) || !defined(TESSESFRAMEWORK_ENABLE_PROCESS)
|
||||
#else
|
||||
int stdin_strm;
|
||||
int stdout_strm;
|
||||
@@ -91,7 +91,7 @@ namespace Tesses::Framework::Platform {
|
||||
|
||||
|
||||
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__)
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__) || !defined(TESSESFRAMEWORK_ENABLE_PROCESS)
|
||||
|
||||
#else
|
||||
this->stdin_strm=-1;
|
||||
@@ -105,7 +105,7 @@ namespace Tesses::Framework::Platform {
|
||||
HANDLE strm;
|
||||
bool writing;
|
||||
bool eos;
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__)
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__) || !defined(TESSESFRAMEWORK_ENABLE_PROCESS)
|
||||
#else
|
||||
int strm;
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace Tesses::Framework::Platform {
|
||||
this->writing = writing;
|
||||
this->eos = false;
|
||||
}
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__)
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__) || !defined(TESSESFRAMEWORK_ENABLE_PROCESS)
|
||||
#else
|
||||
ProcessStream(int strm, bool writing)
|
||||
{
|
||||
@@ -134,7 +134,7 @@ namespace Tesses::Framework::Platform {
|
||||
//TODO: Implement for WIN32
|
||||
#if defined(_WIN32)
|
||||
return this->strm == NULL || eos;
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__)
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__) || !defined(TESSESFRAMEWORK_ENABLE_PROCESS)
|
||||
return true;
|
||||
#else
|
||||
return this->strm < 0 || eos;
|
||||
@@ -145,7 +145,7 @@ namespace Tesses::Framework::Platform {
|
||||
//TODO: Implement for WIN32
|
||||
#if defined(_WIN32)
|
||||
return !writing && this->strm != NULL;
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__)
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__) || !defined(TESSESFRAMEWORK_ENABLE_PROCESS)
|
||||
return false;
|
||||
#else
|
||||
return !writing && this->strm > -1;
|
||||
@@ -157,7 +157,7 @@ namespace Tesses::Framework::Platform {
|
||||
#if defined(_WIN32)
|
||||
|
||||
return writing && this->strm != NULL;
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__)
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__) || !defined(TESSESFRAMEWORK_ENABLE_PROCESS)
|
||||
return false;
|
||||
#else
|
||||
return writing && this->strm > -1;
|
||||
@@ -177,7 +177,7 @@ namespace Tesses::Framework::Platform {
|
||||
this->eos = true;
|
||||
}
|
||||
return (size_t)dataR;
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__)
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__) || !defined(TESSESFRAMEWORK_ENABLE_PROCESS)
|
||||
return 0;
|
||||
#else
|
||||
if(this->strm < 0 || this->eos && writing) return 0;
|
||||
@@ -199,7 +199,7 @@ namespace Tesses::Framework::Platform {
|
||||
return 0;
|
||||
|
||||
return (size_t)dataW;
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__)
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__) || !defined(TESSESFRAMEWORK_ENABLE_PROCESS)
|
||||
return 0;
|
||||
#else
|
||||
if(this->strm < 0 || !writing) return 0;
|
||||
@@ -242,7 +242,9 @@ namespace Tesses::Framework::Platform {
|
||||
this->exited = true;
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__) || !defined(TESSESFRAMEWORK_ENABLE_PROCESS)
|
||||
return true;
|
||||
#else
|
||||
int r;
|
||||
if (waitpid(this->hidden.GetField<ProcessData*>()->pid, &r, WNOHANG) != -1)
|
||||
{
|
||||
@@ -282,7 +284,7 @@ namespace Tesses::Framework::Platform {
|
||||
CloseHandle(p->stdin_strm);
|
||||
p->stdin_strm = NULL;
|
||||
}
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__)
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__) || !defined(TESSESFRAMEWORK_ENABLE_PROCESS)
|
||||
|
||||
#else
|
||||
if (p->stdin_strm > -1)
|
||||
@@ -313,7 +315,7 @@ namespace Tesses::Framework::Platform {
|
||||
|
||||
CloseHandle(p->pi.hProcess);
|
||||
CloseHandle(p->pi.hThread);
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__)
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__) || !defined(TESSESFRAMEWORK_ENABLE_PROCESS)
|
||||
|
||||
#else
|
||||
if (!this->exited)
|
||||
@@ -496,7 +498,8 @@ CreateProcessW(
|
||||
);
|
||||
*/
|
||||
return true;
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__)
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__) || !defined(TESSESFRAMEWORK_ENABLE_PROCESS)
|
||||
|
||||
return false;
|
||||
#else
|
||||
|
||||
@@ -646,7 +649,8 @@ CreateProcessW(
|
||||
else
|
||||
TerminateProcess(this->hidden.GetField<ProcessData*>()->pi.hProcess,-1);
|
||||
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__)
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__) || !defined(TESSESFRAMEWORK_ENABLE_PROCESS)
|
||||
|
||||
#else
|
||||
kill(this->hidden.GetField<ProcessData*>()->pid,signal);
|
||||
#endif
|
||||
@@ -664,7 +668,8 @@ CreateProcessW(
|
||||
this->exited = true;
|
||||
return (int)ret;
|
||||
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__)
|
||||
#elif defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__) || !defined(TESSESFRAMEWORK_ENABLE_PROCESS)
|
||||
|
||||
return -1;
|
||||
#else
|
||||
int r;
|
||||
@@ -681,7 +686,8 @@ CreateProcessW(
|
||||
Tesses::Framework::Streams::Stream* Process::GetStdinStream()
|
||||
{
|
||||
if (this->exited) return nullptr;
|
||||
#if defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__)
|
||||
#if defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__) || !defined(TESSESFRAMEWORK_ENABLE_PROCESS)
|
||||
|
||||
return nullptr;
|
||||
#else
|
||||
return new ProcessStream(this->hidden.GetField<ProcessData*>()->stdin_strm,true);
|
||||
@@ -691,8 +697,8 @@ CreateProcessW(
|
||||
{
|
||||
|
||||
if (this->exited) return nullptr;
|
||||
#if defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__)
|
||||
return nullptr;
|
||||
#if defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__) || !defined(TESSESFRAMEWORK_ENABLE_PROCESS)
|
||||
return nullptr;
|
||||
#else
|
||||
return new ProcessStream(this->hidden.GetField<ProcessData*>()->stdout_strm,false);
|
||||
#endif
|
||||
@@ -701,7 +707,7 @@ CreateProcessW(
|
||||
{
|
||||
|
||||
if (this->exited) return nullptr;
|
||||
#if defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__)
|
||||
#if defined(GEKKO) || defined(__PS2__) || defined(__SWITCH__) || !defined(TESSESFRAMEWORK_ENABLE_PROCESS)
|
||||
return nullptr;
|
||||
#else
|
||||
return new ProcessStream(this->hidden.GetField<ProcessData*>()->stderr_strm,false);
|
||||
|
||||
@@ -30,9 +30,9 @@ SOFTWARE.
|
||||
Modified by Mike Nolan for this project
|
||||
I modified it to return home directory and conditionally compile for systems that are not GEKKO / NX etc
|
||||
*/
|
||||
|
||||
#if !defined(SAGO_DISABLE)
|
||||
#include "platform_folders.h"
|
||||
#if !defined(SAGO_DISABLE)
|
||||
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include <cstdio>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "TessesFramework/Streams/PtyStream.hpp"
|
||||
#if !defined(GEKKO) && !defined(__PS2__) && !defined(_WIN32) && !defined(__SWITCH__) && !defined(__FreeBSD__)
|
||||
#if !defined(GEKKO) && !defined(__PS2__) && !defined(_WIN32) && !defined(__SWITCH__) && !defined(__FreeBSD__) && defined(TESSESFRAMEWORK_ENABLE_PROCESS)
|
||||
#include <pty.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
@@ -10,7 +10,7 @@
|
||||
namespace Tesses::Framework::Streams {
|
||||
PtyStream::PtyStream(WindowSize windowSize,std::string filename, std::vector<std::string> args, std::vector<std::string> env)
|
||||
{
|
||||
#if !defined(GEKKO) && !defined(__PS2__) && !defined(_WIN32) && !defined(__SWITCH__) && !defined(__FreeBSD__)
|
||||
#if !defined(GEKKO) && !defined(__PS2__) && !defined(_WIN32) && !defined(__SWITCH__) && !defined(__FreeBSD__) && defined(TESSESFRAMEWORK_ENABLE_PROCESS)
|
||||
this->wS = windowSize;
|
||||
this->eos=false;
|
||||
winsize sz;
|
||||
@@ -80,7 +80,7 @@ namespace Tesses::Framework::Streams {
|
||||
size_t PtyStream::Read(uint8_t* buff, size_t sz)
|
||||
{
|
||||
if(this->eos) return 0;
|
||||
#if !defined(GEKKO) && !defined(__PS2__) && !defined(_WIN32) && !defined(__SWITCH__) && !defined(__FreeBSD__)
|
||||
#if !defined(GEKKO) && !defined(__PS2__) && !defined(_WIN32) && !defined(__SWITCH__) && !defined(__FreeBSD__) && defined(TESSESFRAMEWORK_ENABLE_PROCESS)
|
||||
auto res = read(this->socket, buff,sz);
|
||||
|
||||
if(res == -1)
|
||||
@@ -96,7 +96,7 @@ namespace Tesses::Framework::Streams {
|
||||
}
|
||||
size_t PtyStream::Write(const uint8_t* buff, size_t sz)
|
||||
{
|
||||
#if !defined(GEKKO) && !defined(__PS2__) && !defined(_WIN32) && !defined(__SWITCH__) && !defined(__FreeBSD__)
|
||||
#if !defined(GEKKO) && !defined(__PS2__) && !defined(_WIN32) && !defined(__SWITCH__) && !defined(__FreeBSD__) && defined(TESSESFRAMEWORK_ENABLE_PROCESS)
|
||||
auto res = write(this->socket, buff,sz);
|
||||
return res;
|
||||
#else
|
||||
@@ -109,7 +109,7 @@ namespace Tesses::Framework::Streams {
|
||||
}
|
||||
void PtyStream::Resize(WindowSize windowSize)
|
||||
{
|
||||
#if !defined(GEKKO) && !defined(__PS2__) && !defined(_WIN32) && !defined(__SWITCH__) && !defined(__FreeBSD__)
|
||||
#if !defined(GEKKO) && !defined(__PS2__) && !defined(_WIN32) && !defined(__SWITCH__) && !defined(__FreeBSD__) && defined(TESSESFRAMEWORK_ENABLE_PROCESS)
|
||||
this->wS = windowSize;
|
||||
winsize sz;
|
||||
sz.ws_col =(unsigned short)windowSize.Columns;
|
||||
@@ -123,7 +123,7 @@ namespace Tesses::Framework::Streams {
|
||||
PtyStream::~PtyStream()
|
||||
{
|
||||
this->eos=true;
|
||||
#if !defined(GEKKO) && !defined(__PS2__) && !defined(_WIN32) && !defined(__SWITCH__) && !defined(__FreeBSD__)
|
||||
#if !defined(GEKKO) && !defined(__PS2__) && !defined(_WIN32) && !defined(__SWITCH__) && !defined(__FreeBSD__) && defined(TESSESFRAMEWORK_ENABLE_PROCESS)
|
||||
close(this->socket);
|
||||
|
||||
kill((pid_t)this->pid,SIGHUP);
|
||||
|
||||
Reference in New Issue
Block a user