mirror of
https://github.com/N64Recomp/N64Recomp.git
synced 2026-05-08 09:51:47 +00:00
Remove reference context from parse_mod_symbols argument
This commit is contained in:
parent
5b17bf8bb5
commit
0aacb52e75
3 changed files with 5 additions and 5 deletions
|
|
@ -73,12 +73,14 @@ int main(int argc, const char** argv) {
|
||||||
|
|
||||||
N64Recomp::Context mod_context;
|
N64Recomp::Context mod_context;
|
||||||
|
|
||||||
N64Recomp::ModSymbolsError error = N64Recomp::parse_mod_symbols(symbol_data_span, rom_data, sections_by_vrom, reference_context, mod_context);
|
N64Recomp::ModSymbolsError error = N64Recomp::parse_mod_symbols(symbol_data_span, rom_data, sections_by_vrom, mod_context);
|
||||||
if (error != N64Recomp::ModSymbolsError::Good) {
|
if (error != N64Recomp::ModSymbolsError::Good) {
|
||||||
fprintf(stderr, "Error parsing mod symbols: %d\n", (int)error);
|
fprintf(stderr, "Error parsing mod symbols: %d\n", (int)error);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mod_context.import_reference_context(reference_context);
|
||||||
|
|
||||||
// Populate R_MIPS_26 reloc symbol indices. Start by building a map of vram address to matching reference symbols.
|
// Populate R_MIPS_26 reloc symbol indices. Start by building a map of vram address to matching reference symbols.
|
||||||
std::unordered_map<uint32_t, std::vector<size_t>> reference_symbols_by_vram{};
|
std::unordered_map<uint32_t, std::vector<size_t>> reference_symbols_by_vram{};
|
||||||
for (size_t reference_symbol_index = 0; reference_symbol_index < mod_context.num_regular_reference_symbols(); reference_symbol_index++) {
|
for (size_t reference_symbol_index = 0; reference_symbol_index < mod_context.num_regular_reference_symbols(); reference_symbol_index++) {
|
||||||
|
|
|
||||||
|
|
@ -535,7 +535,7 @@ namespace N64Recomp {
|
||||||
FunctionOutOfBounds,
|
FunctionOutOfBounds,
|
||||||
};
|
};
|
||||||
|
|
||||||
ModSymbolsError parse_mod_symbols(std::span<const char> data, std::span<const uint8_t> binary, const std::unordered_map<uint32_t, uint16_t>& sections_by_vrom, const Context& reference_context, Context& context_out);
|
ModSymbolsError parse_mod_symbols(std::span<const char> data, std::span<const uint8_t> binary, const std::unordered_map<uint32_t, uint16_t>& sections_by_vrom, Context& context_out);
|
||||||
std::vector<uint8_t> symbols_to_bin_v1(const Context& mod_context);
|
std::vector<uint8_t> symbols_to_bin_v1(const Context& mod_context);
|
||||||
|
|
||||||
inline bool validate_mod_name(std::string_view str) {
|
inline bool validate_mod_name(std::string_view str) {
|
||||||
|
|
|
||||||
|
|
@ -416,13 +416,11 @@ bool parse_v1(std::span<const char> data, const std::unordered_map<uint32_t, uin
|
||||||
return offset == data.size();
|
return offset == data.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
N64Recomp::ModSymbolsError N64Recomp::parse_mod_symbols(std::span<const char> data, std::span<const uint8_t> binary, const std::unordered_map<uint32_t, uint16_t>& sections_by_vrom, const Context& reference_context, Context& mod_context_out) {
|
N64Recomp::ModSymbolsError N64Recomp::parse_mod_symbols(std::span<const char> data, std::span<const uint8_t> binary, const std::unordered_map<uint32_t, uint16_t>& sections_by_vrom, Context& mod_context_out) {
|
||||||
size_t offset = 0;
|
size_t offset = 0;
|
||||||
mod_context_out = {};
|
mod_context_out = {};
|
||||||
const FileHeader* header = reinterpret_data<FileHeader>(data, offset);
|
const FileHeader* header = reinterpret_data<FileHeader>(data, offset);
|
||||||
|
|
||||||
mod_context_out.import_reference_context(reference_context);
|
|
||||||
|
|
||||||
if (header == nullptr) {
|
if (header == nullptr) {
|
||||||
return ModSymbolsError::NotASymbolFile;
|
return ModSymbolsError::NotASymbolFile;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue