2024-02-23 21:32:32 +00:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
2023-06-26 15:12:19 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <unordered_map>
|
2024-02-23 20:57:57 +00:00
|
|
|
#include <vector>
|
2023-11-05 11:41:10 +00:00
|
|
|
#include "common/types.h"
|
2023-06-26 15:12:19 +00:00
|
|
|
|
2023-11-05 23:11:54 +00:00
|
|
|
namespace Core::Loader {
|
|
|
|
|
|
|
|
struct SymbolRecord {
|
|
|
|
std::string name;
|
2024-02-23 20:57:57 +00:00
|
|
|
u64 virtual_address;
|
2023-06-26 15:12:19 +00:00
|
|
|
};
|
|
|
|
|
2023-11-05 23:11:54 +00:00
|
|
|
struct SymbolRes {
|
|
|
|
std::string name;
|
|
|
|
std::string nidName;
|
|
|
|
std::string library;
|
|
|
|
u16 library_version;
|
|
|
|
std::string module;
|
2024-02-23 21:32:32 +00:00
|
|
|
u8 module_version_major;
|
|
|
|
u8 module_version_minor;
|
2023-11-05 23:11:54 +00:00
|
|
|
u32 type;
|
2023-06-26 15:12:19 +00:00
|
|
|
};
|
|
|
|
|
2023-11-05 23:11:54 +00:00
|
|
|
class SymbolsResolver {
|
2023-06-26 15:12:19 +00:00
|
|
|
public:
|
2024-02-23 20:57:57 +00:00
|
|
|
SymbolsResolver() = default;
|
|
|
|
virtual ~SymbolsResolver() = default;
|
2023-06-26 15:12:19 +00:00
|
|
|
|
2024-02-23 20:57:57 +00:00
|
|
|
void AddSymbol(const SymbolRes& s, u64 virtual_addr);
|
2023-07-11 15:50:29 +00:00
|
|
|
const SymbolRecord* FindSymbol(const SymbolRes& s) const;
|
|
|
|
|
|
|
|
static std::string GenerateName(const SymbolRes& s);
|
2023-06-26 15:12:19 +00:00
|
|
|
|
|
|
|
private:
|
2023-11-05 23:11:54 +00:00
|
|
|
std::vector<SymbolRecord> m_symbols;
|
2023-11-05 11:41:10 +00:00
|
|
|
};
|
2023-11-05 23:11:54 +00:00
|
|
|
|
|
|
|
} // namespace Core::Loader
|