commit what I have so far
This commit is contained in:
@@ -11,3 +11,4 @@ CTestTestfile.cmake
|
||||
_deps
|
||||
.vscode
|
||||
build
|
||||
data/daemon
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
[submodule "ps4-ezremote-server"]
|
||||
path = ps4-ezremote-server
|
||||
url = git@github.com:cy33hc/ps4-ezremote-server.git
|
||||
+12
-4
@@ -50,6 +50,7 @@ add_executable(ezremote_client
|
||||
source/actions.cpp
|
||||
source/config.cpp
|
||||
source/crypt.c
|
||||
source/daemon.cpp
|
||||
source/fs.cpp
|
||||
source/gui.cpp
|
||||
source/getentropy.c
|
||||
@@ -68,10 +69,6 @@ add_executable(ezremote_client
|
||||
source/mem_file.cpp
|
||||
)
|
||||
|
||||
add_self(ezremote_client)
|
||||
|
||||
add_pkg(ezremote_client ${CMAKE_SOURCE_DIR}/data "RMTC00001" "ezRemote Client" "01.40" 32 0)
|
||||
|
||||
target_link_libraries(ezremote_client
|
||||
dbglogger
|
||||
c
|
||||
@@ -116,4 +113,15 @@ target_link_libraries(ezremote_client
|
||||
SceNet
|
||||
SceBgft
|
||||
SceAppInstUtil
|
||||
SceLncUtil
|
||||
)
|
||||
|
||||
add_self(ezremote_client)
|
||||
add_pkg(ezremote_client ${CMAKE_SOURCE_DIR}/data "RMTC00001" "ezRemote Client" "01.40" 32 0)
|
||||
|
||||
add_custom_target(package
|
||||
COMMAND mkdir -p ${PROJECT_SOURCE_DIR}/data/daemon
|
||||
COMMAND cp ${PROJECT_SOURCE_DIR}/ps4-ezremote-server/data/eboot.bin ${PROJECT_SOURCE_DIR}/data/daemon/daemon.self
|
||||
COMMAND cp ${PROJECT_SOURCE_DIR}/ps4-ezremote-server/data/eboot.md5 ${PROJECT_SOURCE_DIR}/data/daemon/daemon.md5
|
||||
COMMAND cp ${PROJECT_SOURCE_DIR}/ps4-ezremote-server/data/sce_sys/param.sfo ${PROJECT_SOURCE_DIR}/data/daemon/param
|
||||
)
|
||||
Submodule
+1
Submodule ps4-ezremote-server added at 4212e37168
@@ -0,0 +1,139 @@
|
||||
#include <orbis/SystemService.h>
|
||||
#include "system.h"
|
||||
#include "fs.h"
|
||||
#include "dbglogger.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "orbis_jbc.h"
|
||||
int sceLncUtilGetAppId(const char *tid);
|
||||
}
|
||||
|
||||
#define EZREMOTE_SERVER_TITLEID "EZSR00001"
|
||||
#define EZREMOTE_CLIENT_TITLEID "RMTC00001"
|
||||
|
||||
#define DAEMON_PATH "/system/vsh/app/" EZREMOTE_SERVER_TITLEID
|
||||
#define DAEMON_SRC_PATH "/mnt/sandbox/pfsmnt/" EZREMOTE_CLIENT_TITLEID "-app0/daemon"
|
||||
|
||||
namespace Daemon
|
||||
{
|
||||
int copyFile(const char *sourcefile, const char *destfile)
|
||||
{
|
||||
int src = sceKernelOpen(sourcefile, 0x0000, 0);
|
||||
if (src > 0)
|
||||
{
|
||||
int out = sceKernelOpen(destfile, 0x0001 | 0x0200 | 0x0400, 0777);
|
||||
if (out > 0)
|
||||
{
|
||||
size_t bytes;
|
||||
char *buffer = (char *)malloc(65536);
|
||||
if (buffer != NULL)
|
||||
{
|
||||
while (0 < (bytes = sceKernelRead(src, buffer, 65536)))
|
||||
sceKernelWrite(out, buffer, bytes);
|
||||
free(buffer);
|
||||
}
|
||||
sceKernelClose(out);
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
|
||||
sceKernelClose(src);
|
||||
return 0;
|
||||
}
|
||||
|
||||
dbglogger_log("[ELFLOADER] fuxking error");
|
||||
dbglogger_log("[Itemz-loader:%s:%i] ----- src fd = %i---", __FUNCTION__, __LINE__, src);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int MD5_hash_compare(const std::string &file1, const std::string &file2)
|
||||
{
|
||||
std::vector<char> file1_content = FS::Load(file1);
|
||||
std::vector<char> file2_content = FS::Load(file2);
|
||||
|
||||
std::string str1 = std::string(file1_content.data(), file1_content.size());
|
||||
std::string str2 = std::string(file1_content.data(), file1_content.size());
|
||||
|
||||
return str1.compare(str2);
|
||||
}
|
||||
|
||||
bool IsDaemonOutdated(void)
|
||||
{
|
||||
bool res = true;
|
||||
if (FS::FileExists(DAEMON_PATH "/eboot.md5"))
|
||||
{
|
||||
res = MD5_hash_compare(DAEMON_PATH "/daemon.md5", DAEMON_SRC_PATH "/deamon.md5");
|
||||
dbglogger_log("Daemon Is Outdated?: %s", res ? "Yes" : "No");
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
uint32_t LaunchDaemon(const char *TITLE_ID)
|
||||
{
|
||||
uint32_t userId = -1;
|
||||
|
||||
LncAppParam param;
|
||||
param.size = sizeof(LncAppParam);
|
||||
param.user_id = userId;
|
||||
param.app_opt = 0;
|
||||
param.crash_report = 0;
|
||||
param.LaunchAppCheck_flag = LaunchApp_SkipSystemUpdate;
|
||||
|
||||
return sceLncUtilLaunchApp(TITLE_ID, NULL, ¶m);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool BootDaemonServices()
|
||||
{
|
||||
dbglogger_log("Booting Daemon Services");
|
||||
|
||||
if (!FS::FolderExists(DAEMON_PATH) || IsDaemonOutdated())
|
||||
{
|
||||
if (mount_large_fs("/dev/da0x4.crypt", "/system", "exfatfs", "511", MNT_UPDATE) != 0)
|
||||
{
|
||||
dbglogger_log("mounting /system failed with %s.", strerror(errno));
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
dbglogger_log("Remount Successful");
|
||||
// Delete the folder and all its files
|
||||
FS::RmRecursive(DAEMON_PATH);
|
||||
FS::MkDirs(DAEMON_PATH);
|
||||
FS::MkDirs(DAEMON_PATH "/sce_sys");
|
||||
|
||||
if (copyFile(DAEMON_SRC_PATH "/param", DAEMON_PATH "/sce_sys/param.sfo") != -1)
|
||||
{
|
||||
if (copyFile(DAEMON_SRC_PATH "/daemon.self", DAEMON_PATH "/eboot.bin") != 0 ||
|
||||
copyFile(DAEMON_SRC_PATH "/daemon.md5", DAEMON_PATH "/daemon.md5") != 0)
|
||||
{
|
||||
dbglogger_log("Creating the Daemon eboot failed to create: %s", strerror(errno));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dbglogger_log("Copying Daemon files failed");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int32_t appid = sceLncUtilGetAppId(EZREMOTE_SERVER_TITLEID);
|
||||
// Launch Daemon with silent
|
||||
if ((appid & ~0xFFFFFF) != 0x60000000)
|
||||
{
|
||||
appid = LaunchDaemon(EZREMOTE_SERVER_TITLEID);
|
||||
dbglogger_log("Launched Daemon AppId: %x", appid);
|
||||
}
|
||||
else
|
||||
dbglogger_log("Found Daemon AppId: %x", appid);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef EZ_DAEMON_H
|
||||
#define EZ_DAEMON_H
|
||||
|
||||
namespace Daemon
|
||||
{
|
||||
bool BootDaemonServices();
|
||||
}
|
||||
|
||||
#endif
|
||||
+36
-1
@@ -5,6 +5,7 @@
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <json-c/json.h>
|
||||
#include <orbis/libkernel.h>
|
||||
#include <orbis/Bgft.h>
|
||||
#include <orbis/AppInstUtil.h>
|
||||
@@ -219,6 +220,40 @@ namespace INSTALLER
|
||||
return title;
|
||||
}
|
||||
|
||||
std::string StoreBgInstallHostData(RemoteSettings *settings, const std::string &path)
|
||||
{
|
||||
std::string hash = Util::UrlHash(settings->server + path + settings->username + settings->password + std::to_string(settings->type));
|
||||
json_object *history_item_obj = json_object_new_object();
|
||||
json_object_object_add(history_item_obj, "hash", json_object_new_string(hash.c_str()));
|
||||
json_object_object_add(history_item_obj, "url", json_object_new_string(settings->server));
|
||||
json_object_object_add(history_item_obj, "path", json_object_new_string(path.c_str()));
|
||||
json_object_object_add(history_item_obj, "username", json_object_new_string(settings->username));
|
||||
json_object_object_add(history_item_obj, "password", json_object_new_string(settings->password));
|
||||
json_object_object_add(history_item_obj, "type", json_object_new_int(settings->type));
|
||||
|
||||
if (settings->type == CLIENT_TYPE_HTTP_SERVER)
|
||||
{
|
||||
json_object_object_add(history_item_obj, "http_server_type", json_object_new_string(settings->http_server_type));
|
||||
}
|
||||
|
||||
const char *params_str = json_object_to_json_string(history_item_obj);
|
||||
|
||||
httplib::Client client = httplib::Client(std::string("http://localhost:") + std::to_string(http_int_server_port));
|
||||
client.set_connection_timeout(1);
|
||||
|
||||
if (auto res = client.Post("/store_bg_install_data", params_str, "application/json"))
|
||||
{
|
||||
if (HTTP_SUCCESS(res->status))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
std::string getRemoteUrl(const std::string path, bool encodeUrl)
|
||||
{
|
||||
if (strlen(remote_settings->username) == 0 && strlen(remote_settings->password) == 0 &&
|
||||
@@ -1195,6 +1230,7 @@ namespace INSTALLER
|
||||
std::string EzRemoteServerVersion()
|
||||
{
|
||||
httplib::Client client = httplib::Client(std::string("http://localhost:") + std::to_string(http_int_server_port));
|
||||
client.set_connection_timeout(1);
|
||||
|
||||
if (auto res = client.Get("/version"))
|
||||
{
|
||||
@@ -1290,7 +1326,6 @@ namespace INSTALLER
|
||||
RemoteClient *GetRemoteClient(RemoteSettings *settings)
|
||||
{
|
||||
RemoteClient *tmp_client = nullptr;
|
||||
;
|
||||
|
||||
if (settings->type == CLIENT_TYPE_HTTP_SERVER)
|
||||
{
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "server/http_server.h"
|
||||
#include "clients/gdrive.h"
|
||||
#include "config.h"
|
||||
#include "daemon.h"
|
||||
#include "lang.h"
|
||||
#include "gui.h"
|
||||
#include "util.h"
|
||||
@@ -324,6 +325,8 @@ int main()
|
||||
terminate();
|
||||
}
|
||||
|
||||
Daemon::BootDaemonServices();
|
||||
|
||||
if (load_sys_modules() != 0)
|
||||
return 0;
|
||||
|
||||
|
||||
+12
-3
@@ -47,8 +47,7 @@ int mount_large_fs(const char* device, const char* mountpoint, const char* fstyp
|
||||
{
|
||||
struct iovec* iov = NULL;
|
||||
int iovlen = 0;
|
||||
|
||||
unmount(mountpoint, 0);
|
||||
int ret;
|
||||
|
||||
build_iovec(&iov, &iovlen, "fstype", fstype, -1);
|
||||
build_iovec(&iov, &iovlen, "fspath", mountpoint, -1);
|
||||
@@ -63,7 +62,17 @@ int mount_large_fs(const char* device, const char* mountpoint, const char* fstyp
|
||||
build_iovec(&iov, &iovlen, "mask", mode, -1);
|
||||
}
|
||||
|
||||
return nmount(iov, iovlen, flags);
|
||||
dbglogger_log("##^ [I] Mounting %s \"%s\" to \"%s\"", fstype, device, mountpoint);
|
||||
ret = nmount(iov, iovlen, flags);
|
||||
if (ret < 0) {
|
||||
goto error;
|
||||
}
|
||||
else {
|
||||
dbglogger_log("##^ [I] Success.");
|
||||
}
|
||||
|
||||
error:
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Variables for (un)jailbreaking
|
||||
|
||||
@@ -14,6 +14,7 @@ int (*sceRtcFormatRFC3339LocalTime)(char *pszDateTime, const OrbisTick *tick);
|
||||
unsigned int (*sceRtcGetTickResolution)();
|
||||
int (*sceShellUIUtilLaunchByUri)(const char *uri, SceShellUIUtilLaunchByUriParam *param);
|
||||
int (*sceShellUIUtilInitialize)();
|
||||
// int (*sceLncUtilGetAppId)(const char* tid);
|
||||
|
||||
void convertUtcToLocalTime(const OrbisDateTime *utc, OrbisDateTime *local_time)
|
||||
{
|
||||
@@ -107,6 +108,20 @@ int load_sys_modules()
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
handle = sceKernelLoadStartModule("/system/common/lib/libSceSystemService.sprx", 0, NULL, 0, 0, 0);
|
||||
if (handle == 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
sceKernelDlsym(handle, "sceLncUtilGetAppId", (void **)&sceLncUtilGetAppId);
|
||||
if (sceLncUtilGetAppId == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
*/
|
||||
|
||||
if (sceShellUIUtilInitialize() < 0) return -1;
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -37,6 +37,7 @@ extern int (*sceRtcFormatRFC3339LocalTime)(char *pszDateTime, const OrbisTick *t
|
||||
extern unsigned int (*sceRtcGetTickResolution)();
|
||||
extern int (*sceShellUIUtilLaunchByUri)(const char *uri, SceShellUIUtilLaunchByUriParam *param);
|
||||
extern int (*sceShellUIUtilInitialize)();
|
||||
// extern int (*sceLncUtilGetAppId)(const char* tid);
|
||||
|
||||
int load_sys_modules();
|
||||
void convertUtcToLocalTime(const OrbisDateTime *utc, OrbisDateTime *local_time);
|
||||
|
||||
+6
-5
@@ -139,10 +139,10 @@ namespace Windows
|
||||
overwrite_type = OVERWRITE_PROMPT;
|
||||
local_paste_files.clear();
|
||||
remote_paste_files.clear();
|
||||
//std::string cur_version = INSTALLER::EzRemoteServerVersion();
|
||||
//ezremote_server_version_match = cur_version.empty() || (cur_version.compare(EZREMOTE_SERVER_REQUIRED_VERSION) == 0);
|
||||
show_ezremote_server_warning = false; //!ezremote_server_version_match;
|
||||
//dbglogger_log("verion=%s, show_warning=%d", cur_version.c_str(), show_ezremote_server_warning);
|
||||
std::string cur_version = INSTALLER::EzRemoteServerVersion();
|
||||
ezremote_server_version_match = cur_version.empty() || (cur_version.compare(EZREMOTE_SERVER_REQUIRED_VERSION) == 0);
|
||||
show_ezremote_server_warning = !ezremote_server_version_match;
|
||||
dbglogger_log("verion=%s, show_warning=%d", cur_version.c_str(), show_ezremote_server_warning);
|
||||
|
||||
Actions::RefreshLocalFiles(false);
|
||||
}
|
||||
@@ -1878,6 +1878,7 @@ namespace Windows
|
||||
{
|
||||
show_bg_download_progress = false;
|
||||
SetModalMode(false);
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
|
||||
if (ImGui::IsWindowAppearing())
|
||||
@@ -1918,7 +1919,7 @@ namespace Windows
|
||||
ImGui::OpenPopup(lang_strings[STR_SETTINGS]);
|
||||
|
||||
ImGui::SetNextWindowPos(ImVec2(1050, 80));
|
||||
ImGui::SetNextWindowSizeConstraints(ImVec2(850, 80), ImVec2(850, 750), NULL, NULL);
|
||||
ImGui::SetNextWindowSizeConstraints(ImVec2(850, 80), ImVec2(850, 850), NULL, NULL);
|
||||
if (ImGui::BeginPopupModal(lang_strings[STR_SETTINGS], NULL, ImGuiWindowFlags_AlwaysAutoResize))
|
||||
{
|
||||
char id[192];
|
||||
|
||||
Reference in New Issue
Block a user