mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-23 00:53:02 -05:00
renameat (2a8e7452) calls rename_nid_postfix when both paths are
AT_FDCWD-relative or absolute. Rename.cpp is built into both libc and
libkernel, and on Windows libkernel_sys bound that import to libkernel,
which comes first on its link line. The NID patcher then rewrote the
import to rename's NID, which only libc exports, as libkernel keeps its
copy under the plain name. So libkernel_sys.prx fails to load with error
127 on Windows, and with it every title that imports it. Linux resolves
the symbol globally and was not affected.
rename's body is now RenameGuestPath_nid_no_patch, which both libraries
export under that name, and renameat calls it, the way libkernel_sys
already reaches libkernel's other helpers. rename_nid_postfix forwards
to it, so its behaviour is unchanged.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
48 lines
2.1 KiB
C++
48 lines
2.1 KiB
C++
#ifndef CORE_LIBS_PRX_LIBC_INCLUDE_GENERAL_HPP
|
|
#define CORE_LIBS_PRX_LIBC_INCLUDE_GENERAL_HPP
|
|
|
|
#include <stdexcept>
|
|
#include <filesystem>
|
|
#include <vector>
|
|
|
|
#include "general/LogMacros.hpp"
|
|
#include "general/VabiMacros.hpp"
|
|
#include "general/ExportMacros.hpp"
|
|
|
|
extern "C" void NotImplemented_nid_no_patch(const char* funcName);
|
|
extern "C" void CxaFinalize_nid_no_patch(void* dsoHandle);
|
|
extern "C" bool StopAtPrefixLetter_nid_no_patch(const char* str, char** endptr, int base);
|
|
#ifndef _WIN32
|
|
extern "C" int KeepHostStandardError_nid_no_patch();
|
|
extern "C" int HostStandardError_nid_no_patch();
|
|
#endif
|
|
|
|
extern "C" std::filesystem::path ResolvePath_nid_no_patch(const char* path);
|
|
extern "C" std::filesystem::path RelinkedModulePath_nid_no_patch(const std::filesystem::path& path);
|
|
extern "C" int SetWorkingDirectory_nid_no_patch(const char* resolved);
|
|
extern "C" bool FinalPathComponentIsDot_nid_no_patch(const char* path);
|
|
extern "C" int RenameGuestPath_nid_no_patch(const char* from, const char* to);
|
|
// Guest path aliases: a guest prefix such as "/savedata0" (a save-data mount point) resolves to a host
|
|
// directory instead of the run directory; the prefix matches whole path components only.
|
|
extern "C" void AddPathAlias_nid_no_patch(const char* guestPrefix, const char* hostPath);
|
|
extern "C" void RemovePathAlias_nid_no_patch(const char* guestPrefix);
|
|
extern "C" void RecordWrittenPath_nid_no_patch(const std::filesystem::path& path);
|
|
extern "C" std::vector<std::filesystem::path> WrittenPaths_nid_no_patch();
|
|
extern "C" void SyncWrittenPaths_nid_no_patch();
|
|
extern "C" void BlockPathAlias_nid_no_patch(const char* guestPrefix);
|
|
#ifdef _WIN32
|
|
extern "C" int WindowsOpenError_nid_no_patch(unsigned long error);
|
|
extern "C" void* HostStandardHandle_nid_no_patch(int descriptor);
|
|
extern "C" void KeepStandardHandle_nid_no_patch(int descriptor, void* handle);
|
|
#endif
|
|
|
|
#define APS5_INVALID_ARG_EX throw std::invalid_argument(std::string(__func__) + ": invalid argument")
|
|
|
|
#define APS5_DUMMY_FUN \
|
|
int DummyFunction_nid_no_patch() { \
|
|
NotImplemented_nid_no_patch(__func__); \
|
|
return 0; \
|
|
}
|
|
|
|
#endif
|