Compare commits

...

7 Commits

Author SHA1 Message Date
cy33hc ce71f5af9a fix version 2026-05-02 22:24:18 -07:00
cy33hc cd42afcb6b fix random crash when installing with disk cache or pkgs in zip files 2026-05-02 22:22:20 -07:00
cy33hc b6eaef82fd fix edit files from Edit menu 2026-03-29 17:15:02 -07:00
cy33hc 9d0790fccc minor improvement to cut/paste files 2026-03-27 01:27:02 -07:00
Chee Yee bfe2505efc fix installing pkg via RPI 2025-03-17 00:28:16 -07:00
Chee Yee 749a79d8b9 Merge branch 'master' of github.com:cy33hc/ps4-ezremote-client 2025-03-05 11:53:48 -08:00
Chee Yee c03201c040 update version 2025-03-05 11:53:42 -08:00
10 changed files with 676 additions and 1435 deletions
+1 -1
View File
@@ -70,7 +70,7 @@ add_executable(ezremote_client
add_self(ezremote_client)
add_pkg(ezremote_client ${CMAKE_SOURCE_DIR}/data "RMTC00001" "ezRemote Client" "01.35" 32 0)
add_pkg(ezremote_client ${CMAKE_SOURCE_DIR}/data "RMTC00001" "ezRemote Client" "01.39" 32 0)
target_link_libraries(ezremote_client
c
+18 -2
View File
@@ -1470,6 +1470,16 @@ namespace Actions
if (src.isDir)
{
int err;
if (!isCopy && !FS::FolderExists(dest))
{
errno = 0;
int ret = rename(src.path, dest);
if (ret != 0 && errno != EXDEV && errno != EEXIST)
{
return 0;
}
}
std::vector<DirEntry> entries = FS::ListDir(src.path, &err);
FS::MkDirs(dest);
for (int i = 0; i < entries.size(); i++)
@@ -1484,9 +1494,11 @@ namespace Actions
if (entries[i].isDir)
{
if (strcmp(entries[i].name, "..") == 0)
{
free(new_path);
continue;
}
FS::MkDirs(new_path);
ret = CopyOrMove(entries[i], new_path, isCopy);
if (ret <= 0)
{
@@ -1510,6 +1522,11 @@ namespace Actions
}
free(new_path);
}
if (!isCopy && FS::FolderExists(src.path))
{
FS::RmDir(src.path);
}
}
else
{
@@ -1551,7 +1568,6 @@ namespace Actions
char new_dir[512];
sprintf(new_dir, "%s%s%s", local_directory, FS::hasEndSlash(local_directory) ? "" : "/", it->name);
CopyOrMove(*it, new_dir, false);
FS::RmRecursive(it->path);
}
else
{
+1 -1
View File
@@ -138,7 +138,7 @@ int BaseClient::Size(const std::string &path, int64_t *size)
}
else
{
sprintf(this->response, "%d - %s", res->status, http_status_message(res->status));
sprintf(this->response, "%d - %s", res->status, detail::status_message(res->status));
}
}
else
+4 -1
View File
@@ -223,7 +223,10 @@ std::vector<DirEntry> MyrientClient::ListDir(const std::string &path)
}
lxb_dom_collection_destroy(td_collection, true);
out.push_back(entry);
if (strcmp(entry.name, "..") != 0 && strcmp(entry.name, ".") != 0)
{
out.push_back(entry);
}
}
lxb_dom_collection_destroy(tr_collection, true);
+14 -6
View File
@@ -50,7 +50,7 @@ namespace FS
void RmDir(const std::string &path)
{
remove(path.c_str());
rmdir(path.c_str());
}
int64_t GetSize(const std::string &path)
@@ -85,6 +85,7 @@ namespace FS
return 1;
return 0;
}
void Rename(const std::string &from, const std::string &to)
{
int res = rename(from.c_str(), to.c_str());
@@ -269,6 +270,7 @@ namespace FS
if (dirent == NULL)
{
closedir(fd);
fd = NULL;
return out;
}
else
@@ -344,6 +346,7 @@ namespace FS
}
}
closedir(fd);
fd = NULL;
return out;
}
@@ -549,11 +552,16 @@ namespace FS
if (from.compare(to) == 0)
return true;
bool res = Copy(from, to);
if (res)
Rm(from);
else
return res;
errno = 0;
int ret = rename(from.c_str(), to.c_str());
if (ret != 0 && (errno == EXDEV || errno == EEXIST))
{
bool res = Copy(from, to);
if (res)
Rm(from);
else
return res;
}
return true;
}
+476 -976
View File
File diff suppressed because it is too large Load Diff
+84 -402
View File
File diff suppressed because it is too large Load Diff
+38 -6
View File
@@ -56,7 +56,10 @@ size_t SplitFile::Read(char *buf, size_t buf_size, size_t offset)
while ((block_num >= this->file_blocks.size() && !this->complete) ||
(block_num < this->file_blocks.size() && this->file_blocks[block_num]->status == BLOCK_STATUS_NOT_EXISTS))
{
sem_wait(&this->block_ready);
struct timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
ts.tv_sec += 2;
sem_timedwait(&this->block_ready, &ts);
}
block = this->file_blocks[block_num];
@@ -120,7 +123,10 @@ size_t SplitFile::Read(char *buf, size_t buf_size, size_t offset)
while ((block_num > this->file_blocks.size() - 1 && !this->complete) ||
this->file_blocks[block_num]->status == BLOCK_STATUS_NOT_EXISTS)
{
sem_wait(&this->block_ready);
struct timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
ts.tv_sec += 2;
sem_timedwait(&this->block_ready, &ts);
}
block = this->file_blocks[block_num];
@@ -128,7 +134,7 @@ size_t SplitFile::Read(char *buf, size_t buf_size, size_t offset)
// delete blocks before the first read offset block. Assumuption, that reads are always
// forward and won't read previously already read blocks. For safety, keeping only current block and 2 previous blocks
for (int j=0; j < first_block_num - 2; j++)
for (int j=0; j < first_block_num - 13; j++)
{
if (this->file_blocks[j]->status == BLOCK_STATUS_CREATED)
{
@@ -142,12 +148,13 @@ size_t SplitFile::Read(char *buf, size_t buf_size, size_t offset)
}
}
this->read_offset = offset + total_bytes_read;
return total_bytes_read;
}
size_t SplitFile::Write(char *buf, size_t buf_size)
{
size_t bytes_written;
size_t bytes_written = 0;
size_t block_space_remaining;
size_t bytes_to_write;
@@ -155,6 +162,9 @@ size_t SplitFile::Write(char *buf, size_t buf_size)
size_t total_bytes_written = 0;
size_t remaining_to_write = buf_size;
if (this->IsClosed())
return -1;
while (remaining_to_write > 0 && !this->complete)
{
block_space_remaining = this->block_size - block_in_progress->size;
@@ -186,6 +196,7 @@ size_t SplitFile::Write(char *buf, size_t buf_size)
block_in_progress = NewBlock();
}
}
this->write_offset += total_bytes_written;
return total_bytes_written;
}
@@ -195,6 +206,8 @@ int SplitFile::Close()
if (this->complete)
return 0;
this->complete = true;
if (block_in_progress->fd != nullptr)
{
fflush(block_in_progress->fd);
@@ -204,9 +217,28 @@ int SplitFile::Close()
block_in_progress->status = BLOCK_STATUS_CREATED;
block_in_progress->is_last = true;
this->file_blocks.push_back(block_in_progress);
this->complete = true;
sem_post(&this->block_ready);
// Wait until file is fully read, if file isn't full read
// in 5 mins then go ahead and delete all file chunks
int retries = 10;
size_t prev_read_offset = 0;
while (this->read_offset != this->write_offset && retries > 0)
{
if (prev_read_offset == this->read_offset)
retries--;
prev_read_offset = this->read_offset;
sceKernelUsleep(1000000);
}
sceKernelUsleep(5000000);
for (size_t j = 0; j < this->file_blocks.size(); j++)
{
if (this->file_blocks[j] != nullptr && this->file_blocks[j]->status == BLOCK_STATUS_CREATED)
{
remove(this->file_blocks[j]->block_file.c_str());
}
}
return 0;
}
@@ -226,4 +258,4 @@ FileBlock *SplitFile::NewBlock()
block->fd = fopen(block->block_file.c_str(), "w");
return block;
}
}
+4 -2
View File
@@ -4,6 +4,7 @@
#include <string>
#include <vector>
#include <mutex>
#include <semaphore.h>
#include <pthread.h>
enum FileBlockStatus
@@ -35,8 +36,9 @@ public:
private:
std::vector<FileBlock*> file_blocks;
size_t write_offset;
size_t write_offset = 0;
size_t block_size;
size_t read_offset;
std::string path;
int write_error;
bool complete;
@@ -46,4 +48,4 @@ private:
FileBlock *NewBlock();
};
#endif
#endif
+36 -38
View File
@@ -439,45 +439,42 @@ namespace Windows
}
}
if (strcmp(remote_settings->http_server_type, HTTP_SERVER_GITHUB) != 0)
ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5);
ImGui::TextColored(colors[ImGuiCol_ButtonHovered], "%s:", lang_strings[STR_ENABLE_RPI]);
ImGui::SameLine();
if (ImGui::Checkbox("###enable_rpi", &remote_settings->enable_rpi))
{
ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5);
ImGui::TextColored(colors[ImGuiCol_ButtonHovered], "%s:", lang_strings[STR_ENABLE_RPI]);
ImGui::SameLine();
CONFIG::SaveConfig();
}
if (ImGui::IsItemHovered())
{
ImGui::SetNextWindowSize(ImVec2(450, 110));
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + 440);
ImGui::Text("%s", lang_strings[STR_ENABLE_RPI_FTP_SMB_MSG]);
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}
if (ImGui::Checkbox("###enable_rpi", &remote_settings->enable_rpi))
{
CONFIG::SaveConfig();
}
if (ImGui::IsItemHovered())
{
ImGui::SetNextWindowSize(ImVec2(450, 110));
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + 440);
ImGui::Text("%s", lang_strings[STR_ENABLE_RPI_FTP_SMB_MSG]);
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}
ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5);
ImGui::TextColored(colors[ImGuiCol_ButtonHovered], "%s:", lang_strings[STR_ENABLE_DISK_CACHE]);
ImGui::SameLine();
ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5);
ImGui::TextColored(colors[ImGuiCol_ButtonHovered], "%s:", lang_strings[STR_ENABLE_DISK_CACHE]);
ImGui::SameLine();
if (ImGui::Checkbox("###enable_disk_cache", &remote_settings->enable_disk_cache))
{
CONFIG::SaveConfig();
}
if (ImGui::IsItemHovered())
{
ImGui::SetNextWindowSize(ImVec2(550, 110));
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + 540);
ImGui::Text("%s", lang_strings[STR_ENABLE_DISC_CACHE_MSG]);
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}
if (ImGui::Checkbox("###enable_disk_cache", &remote_settings->enable_disk_cache))
{
CONFIG::SaveConfig();
}
if (ImGui::IsItemHovered())
{
ImGui::SetNextWindowSize(ImVec2(550, 110));
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + 540);
ImGui::Text("%s", lang_strings[STR_ENABLE_DISC_CACHE_MSG]);
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}
ImGui::PopStyleVar();
@@ -1621,6 +1618,9 @@ namespace Windows
void ShowEditorDialog()
{
if (!paused)
saved_selected_browser = selected_browser;
if (editor_inprogress)
{
ImGuiIO &io = ImGui::GetIO();
@@ -2653,8 +2653,6 @@ namespace Windows
else if (strncasecmp(remote_settings->server, "https://github.com/", 19) == 0)
{
snprintf(remote_settings->http_server_type, 24, "%s", HTTP_SERVER_GITHUB);
remote_settings->enable_rpi = false;
remote_settings->enable_disk_cache = false;
}
}
}