mirror of
https://github.com/pound-emu/pound.git
synced 2025-12-12 10:37:00 +00:00
waiter! waiter! more imports please!!!
This commit is contained in:
parent
84b86ac270
commit
45f1594d91
5 changed files with 135 additions and 15 deletions
|
|
@ -3,9 +3,9 @@
|
||||||
|
|
||||||
#include <fmt/format.h> //can't find that yet (ownedbywuigi)
|
#include <fmt/format.h> //can't find that yet (ownedbywuigi)
|
||||||
#include "import/common/fs/path_util.h"
|
#include "import/common/fs/path_util.h"
|
||||||
#include "core/file_sys/bis_factory.h"
|
#include "core/fs/bis_factory.h"
|
||||||
#include "core/file_sys/registered_cache.h"
|
#include "core/fs/registered_cache.h"
|
||||||
#include "core/file_sys/vfs/vfs.h"
|
#include "core/fs/vfs/vfs.h"
|
||||||
|
|
||||||
namespace FileSys {
|
namespace FileSys {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "import/common/common_types.h"
|
||||||
#include "core/file_sys/vfs/vfs_types.h"
|
#include "core/fs/vfs/vfs_types.h"
|
||||||
|
|
||||||
namespace FileSys {
|
namespace FileSys {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,17 +4,17 @@
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <fmt/ostream.h>
|
#include <fmt/ostream.h> //can't find that yet (ownedbywuigi)
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
#include "import/common/logging/log.h"
|
||||||
#include "core/crypto/key_manager.h"
|
#include "import/core/crypto/key_manager.h"
|
||||||
#include "core/file_sys/card_image.h"
|
#include "core/fs/card_image.h"
|
||||||
#include "core/file_sys/content_archive.h"
|
#include "core/fs/content_archive.h"
|
||||||
#include "core/file_sys/nca_metadata.h"
|
#include "core/fs/nca_metadata.h"
|
||||||
#include "core/file_sys/partition_filesystem.h"
|
#include "core/fs/partition_filesystem.h"
|
||||||
#include "core/file_sys/submission_package.h"
|
#include "core/fs/submission_package.h"
|
||||||
#include "core/file_sys/vfs/vfs_offset.h"
|
#include "core/fs/vfs/vfs_offset.h"
|
||||||
#include "core/file_sys/vfs/vfs_vector.h"
|
#include "core/fs/vfs/vfs_vector.h"
|
||||||
#include "core/loader/loader.h"
|
#include "core/loader/loader.h"
|
||||||
|
|
||||||
namespace FileSys {
|
namespace FileSys {
|
||||||
|
|
|
||||||
53
import/common/fs/common_types.h
Normal file
53
import/common/fs/common_types.h
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
// SPDX-FileCopyrightText: 2012 Gekko Emulator
|
||||||
|
// SPDX-FileContributor: ShizZy <shizzy247@gmail.com>
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (C) 2005-2012 Gekko Emulator
|
||||||
|
*
|
||||||
|
* @file common_types.h
|
||||||
|
* @author ShizZy <shizzy247@gmail.com>
|
||||||
|
* @date 2012-02-11
|
||||||
|
* @brief Common types used throughout the project
|
||||||
|
*
|
||||||
|
* @section LICENSE
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details at
|
||||||
|
* http://www.gnu.org/copyleft/gpl.html
|
||||||
|
*
|
||||||
|
* Official project repository can be found at:
|
||||||
|
* http://code.google.com/p/gekko-gc-emu/
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
using u8 = std::uint8_t; ///< 8-bit unsigned byte
|
||||||
|
using u16 = std::uint16_t; ///< 16-bit unsigned short
|
||||||
|
using u32 = std::uint32_t; ///< 32-bit unsigned word
|
||||||
|
using u64 = std::uint64_t; ///< 64-bit unsigned int
|
||||||
|
|
||||||
|
using s8 = std::int8_t; ///< 8-bit signed byte
|
||||||
|
using s16 = std::int16_t; ///< 16-bit signed short
|
||||||
|
using s32 = std::int32_t; ///< 32-bit signed word
|
||||||
|
using s64 = std::int64_t; ///< 64-bit signed int
|
||||||
|
|
||||||
|
using f32 = float; ///< 32-bit floating point
|
||||||
|
using f64 = double; ///< 64-bit floating point
|
||||||
|
|
||||||
|
using VAddr = u64; ///< Represents a pointer in the userspace virtual address space.
|
||||||
|
using DAddr = u64; ///< Represents a pointer in the device specific virtual address space.
|
||||||
|
using PAddr = u64; ///< Represents a pointer in the ARM11 physical address space.
|
||||||
|
using GPUVAddr = u64; ///< Represents a pointer in the GPU virtual address space.
|
||||||
|
|
||||||
|
using u128 = std::array<std::uint64_t, 2>;
|
||||||
|
static_assert(sizeof(u128) == 16, "u128 must be 128 bits wide");
|
||||||
67
import/common/logging/log.h
Normal file
67
import/common/logging/log.h
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
// SPDX-FileCopyrightText: 2014 Citra Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
|
#include "common/logging/formatter.h"
|
||||||
|
#include "common/logging/types.h"
|
||||||
|
|
||||||
|
namespace Common::Log {
|
||||||
|
|
||||||
|
// trims up to and including the last of ../, ..\, src/, src\ in a string
|
||||||
|
constexpr const char* TrimSourcePath(std::string_view source) {
|
||||||
|
const auto rfind = [source](const std::string_view match) {
|
||||||
|
return source.rfind(match) == source.npos ? 0 : (source.rfind(match) + match.size());
|
||||||
|
};
|
||||||
|
auto idx = std::max({rfind("src/"), rfind("src\\"), rfind("../"), rfind("..\\")});
|
||||||
|
return source.data() + idx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Logs a message to the global logger, using fmt
|
||||||
|
void FmtLogMessageImpl(Class log_class, Level log_level, const char* filename,
|
||||||
|
unsigned int line_num, const char* function, const char* format,
|
||||||
|
const fmt::format_args& args);
|
||||||
|
|
||||||
|
template <typename... Args>
|
||||||
|
void FmtLogMessage(Class log_class, Level log_level, const char* filename, unsigned int line_num,
|
||||||
|
const char* function, const char* format, const Args&... args) {
|
||||||
|
FmtLogMessageImpl(log_class, log_level, filename, line_num, function, format,
|
||||||
|
fmt::make_format_args(args...));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Common::Log
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define LOG_TRACE(log_class, ...) \
|
||||||
|
Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Trace, \
|
||||||
|
Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \
|
||||||
|
__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define LOG_TRACE(log_class, fmt, ...) (void(0))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define LOG_DEBUG(log_class, ...) \
|
||||||
|
Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Debug, \
|
||||||
|
Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \
|
||||||
|
__VA_ARGS__)
|
||||||
|
#define LOG_INFO(log_class, ...) \
|
||||||
|
Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Info, \
|
||||||
|
Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \
|
||||||
|
__VA_ARGS__)
|
||||||
|
#define LOG_WARNING(log_class, ...) \
|
||||||
|
Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Warning, \
|
||||||
|
Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \
|
||||||
|
__VA_ARGS__)
|
||||||
|
#define LOG_ERROR(log_class, ...) \
|
||||||
|
Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Error, \
|
||||||
|
Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \
|
||||||
|
__VA_ARGS__)
|
||||||
|
#define LOG_CRITICAL(log_class, ...) \
|
||||||
|
Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Critical, \
|
||||||
|
Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \
|
||||||
|
__VA_ARGS__)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue