mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-10-28 20:48:42 +01:00
* p2p crypto schema * adding p2p keyring * p2p framing and testing * fixups * test fix * missing definations * implementation of host functions * tcp/transport of p2p packets * improvements in binding * guest_net ,improvements and test cases * all mighty clang * fixing macOS tests failures * misc * net_rewrite : net_errors , types and translation schemas * updated fixed chunks transfer on windows * bye bye old net * small updates for the new net * settings and tests * net lib first draft * allow more than 1 P2P instances on from same pc * improved shadnet replies * possible fix for jojo * cleanup * move net files to libaries/net * fixed macOS tests * mighty clang * fixed cmakelists * don't cosume inviation event on client (test code) * fix macOS tests * Large multi-file rework for Signaling and Matching2 network handling / optimization. Consolidates Matching2-signaling and signaling to one process (signaling_handler) General cleanup and consolidation of matching2 context management > nphandler Removal of a lot SIgnaling overall structure cleanup. Matching2: added get and set roommemberdatainternal and the proper type / shadnet call / request / reply. Consolidated signaling/matching2 typedefs to np_types2 Utilized Codex as a reviewer and for general cleanup. * all mighty clang * fixed member attributes * fixed MAPPED address for matching signaling * Fixed sceNpMatching2SignalingGetLocalNetInfo * fixups on net core/library based on fw * improved errno * spilt p2p to net_p2p * some cleanups * fix for localinfo * clang * fix up * cleanups * cleanups * added KernelFstat * fixed fstat * one more fix for fstat... * cleanup old deprecated code * cleanup * General logging cleanup across NP changes. Thanks Stephen! * cleanup based on stephen's suggestions * fixup * fixing tests * blah * fixup * improve memory pools * cleaunp * force https disable option * clang * @stephen's fixes * added network field in settings and ported old network ones --------- Co-authored-by: Metr1k <blackkn1ght1991@gmail.com>
62 lines
1.6 KiB
C++
62 lines
1.6 KiB
C++
// SPDX-FileCopyrightText: Copyright 2026 shadPS4 Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
// What the net kernel glue (src/core/libraries/net/net_kernel.cpp) needs from the kernel,
|
|
// without the kernel: its errno and its file table. The table follows fs.cpp (lowest free
|
|
// slot first, entries deleted on release); the rest of fs.cpp needs the whole file system.
|
|
|
|
#include <mutex>
|
|
|
|
#include "core/file_sys/fs.h"
|
|
#include "core/libraries/kernel/kernel.h"
|
|
|
|
namespace Libraries::Kernel {
|
|
|
|
s32* PS4_SYSV_ABI __Error() {
|
|
thread_local s32 error = 0;
|
|
return &error;
|
|
}
|
|
|
|
} // namespace Libraries::Kernel
|
|
|
|
namespace Core::FileSys {
|
|
|
|
int HandleTable::CreateHandle() {
|
|
std::scoped_lock lock{m_mutex};
|
|
auto* file = new File{};
|
|
for (size_t index = 0; index < m_files.size(); ++index) {
|
|
if (m_files[index] == nullptr) {
|
|
m_files[index] = file;
|
|
return static_cast<int>(index);
|
|
}
|
|
}
|
|
m_files.push_back(file);
|
|
return static_cast<int>(m_files.size() - 1);
|
|
}
|
|
|
|
void HandleTable::DeleteHandle(int d) {
|
|
std::scoped_lock lock{m_mutex};
|
|
delete m_files.at(d);
|
|
m_files[d] = nullptr;
|
|
}
|
|
|
|
File* HandleTable::GetFile(int d) {
|
|
std::scoped_lock lock{m_mutex};
|
|
if (d < 0 || static_cast<size_t>(d) >= m_files.size()) {
|
|
return nullptr;
|
|
}
|
|
return m_files[d];
|
|
}
|
|
|
|
void HandleTable::CreateStdHandles() {
|
|
// Descriptors 0-2, so net objects start at 3 as in the emulator.
|
|
for (int i = 0; i < 3; ++i) {
|
|
const int fd = CreateHandle();
|
|
auto* file = GetFile(fd);
|
|
file->type = FileType::Device;
|
|
file->is_opened = true;
|
|
}
|
|
}
|
|
|
|
} // namespace Core::FileSys
|