common: Rewrite logging based on cut down citra logger (#86)

* common: Rewrite logging based on cut down Citra logger

* code: Misc fixes

* core: Bring back tls handler

* linker: Cleanup

* config: Remove log level

* logging: Enable console output by default

* core: Fix windows build
This commit is contained in:
GPUCode 2024-02-28 00:10:34 +02:00 committed by GitHub
parent b3084646a8
commit 79d6c8a377
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
70 changed files with 3212 additions and 1541 deletions

View file

@ -8,21 +8,24 @@ namespace Core::FileSys {
constexpr int RESERVED_HANDLES = 3; // First 3 handles are stdin,stdout,stderr
void MntPoints::mount(const std::string& host_folder, const std::string& guest_folder) {
void MntPoints::Mount(const std::filesystem::path& host_folder, const std::string& guest_folder) {
std::scoped_lock lock{m_mutex};
MntPair pair;
pair.host_path = host_folder;
pair.host_path = host_folder.string();
pair.guest_path = guest_folder;
m_mnt_pairs.push_back(pair);
}
void MntPoints::unmount(const std::string& path) {} // TODO!
void MntPoints::unmountAll() {
void MntPoints::Unmount(const std::string& path) {} // TODO!
void MntPoints::UnmountAll() {
std::scoped_lock lock{m_mutex};
m_mnt_pairs.clear();
}
std::string MntPoints::getHostDirectory(const std::string& guest_directory) {
std::string MntPoints::GetHostDirectory(const std::string& guest_directory) {
std::scoped_lock lock{m_mutex};
for (auto& pair : m_mnt_pairs) {
if (pair.guest_path.starts_with(guest_directory)) {
@ -38,7 +41,8 @@ std::string MntPoints::getHostDirectory(const std::string& guest_directory) {
}
return "";
}
std::string MntPoints::getHostFile(const std::string& guest_file) {
std::string MntPoints::GetHostFile(const std::string& guest_file) {
std::scoped_lock lock{m_mutex};
for (auto& pair : m_mnt_pairs) {
@ -52,11 +56,13 @@ std::string MntPoints::getHostFile(const std::string& guest_file) {
}
return "";
}
int HandleTable::createHandle() {
int HandleTable::CreateHandle() {
std::scoped_lock lock{m_mutex};
auto* file = new File{};
file->isDirectory = false;
file->isOpened = false;
file->is_directory = false;
file->is_opened = false;
int existingFilesNum = m_files.size();
@ -68,19 +74,20 @@ int HandleTable::createHandle() {
}
m_files.push_back(file);
return m_files.size() + RESERVED_HANDLES - 1;
}
void HandleTable::deleteHandle(int d) {
void HandleTable::DeleteHandle(int d) {
std::scoped_lock lock{m_mutex};
delete m_files.at(d - RESERVED_HANDLES);
m_files[d - RESERVED_HANDLES] = nullptr;
}
File* HandleTable::getFile(int d) {
File* HandleTable::GetFile(int d) {
std::scoped_lock lock{m_mutex};
return m_files.at(d - RESERVED_HANDLES);
}
File* HandleTable::getFile(const std::string& host_name) {
std::scoped_lock lock{m_mutex};
for (auto* file : m_files) {