mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-28 19:07:47 -04:00
7c40d33db3
Phase 1a (boot slice): 30 instructions at 0xBFC00000, compiles clean. Phase 1b (instruction coverage): 54 opcodes implemented in strict_translator, 44,629 walker-reachable instructions covered, 0 missing. Phase 1c (function discovery): 76 functions from 2 seeds, 2,988 instructions, 199 call edges, 27 indirect jumps. All validated through StrictTranslator. Phase 1d (indirect control flow): 27 sites classified — 21 A0/B0/C0 dispatch stubs, 4 computed calls, 2 computed tail calls. Ghidra cross-referenced with 0 disagreements. Phase 1e (relocation): ROM-to-RAM copy at FUN_bfc00420 proven with both Ghidra (static) and DuckStation (runtime). 69 address aliases, 68/69 function entries match byte-for-byte in RAM. Normalization rule documented. Includes PRINCIPLES.md and DEBUG.md adapted from recomp-template. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
47 lines
1.1 KiB
C++
47 lines
1.1 KiB
C++
// Formatting library for C++ - test utilities
|
|
//
|
|
// Copyright (c) 2012 - present, Victor Zverovich
|
|
// All rights reserved.
|
|
//
|
|
// For the license information refer to format.h.
|
|
|
|
#include "util.h"
|
|
|
|
#include <cstring>
|
|
|
|
const char* const file_content = "Don't panic!";
|
|
|
|
fmt::buffered_file open_buffered_file(FILE** fp) {
|
|
#if FMT_USE_FCNTL
|
|
fmt::file read_end, write_end;
|
|
fmt::file::pipe(read_end, write_end);
|
|
write_end.write(file_content, std::strlen(file_content));
|
|
write_end.close();
|
|
fmt::buffered_file f = read_end.fdopen("r");
|
|
if (fp) *fp = f.get();
|
|
#else
|
|
fmt::buffered_file f("test-file", "w");
|
|
fputs(file_content, f.get());
|
|
if (fp) *fp = f.get();
|
|
#endif
|
|
return f;
|
|
}
|
|
|
|
std::locale do_get_locale(const char* name) {
|
|
try {
|
|
return std::locale(name);
|
|
} catch (const std::runtime_error&) {
|
|
}
|
|
return std::locale::classic();
|
|
}
|
|
|
|
std::locale get_locale(const char* name, const char* alt_name) {
|
|
auto loc = do_get_locale(name);
|
|
if (loc == std::locale::classic() && alt_name) {
|
|
loc = do_get_locale(alt_name);
|
|
}
|
|
if (loc == std::locale::classic())
|
|
fmt::print(stderr, "{} locale is missing.\n", name);
|
|
return loc;
|
|
}
|