feat: added missing v0 instructions

feat: added threads inplementation on ps2 syscalls
feat: patch entrypoint on recompiler
feat: ps2 macros now is part of the runtime
feat: use thread to hold game loop
feat: sanitize functions like point out by chrisking1981
fix: fix old instructions cast
fix: fix missing patch for opcode j
This commit is contained in:
Ran-j
2025-12-27 11:33:24 -03:00
parent 409570c709
commit 2d1f7ec07f
12 changed files with 777 additions and 57 deletions
@@ -10,6 +10,7 @@
namespace ps2recomp
{
extern const std::unordered_set<std::string> kKeywords;
class CodeGenerator
{
@@ -17,6 +18,15 @@ namespace ps2recomp
CodeGenerator(const std::vector<Symbol> &symbols);
~CodeGenerator();
struct BootstrapInfo
{
bool valid = false;
uint32_t entry = 0;
uint32_t bssStart = 0;
uint32_t bssEnd = 0;
uint32_t gp = 0;
};
std::string generateFunction(const Function &function, const std::vector<Instruction> &instructions, const bool &useHeaders);
std::string generateFunctionRegistration(const std::vector<Function> &functions, const std::map<uint32_t, std::string> &stubs);
std::string generateMacroHeader();
@@ -24,12 +34,14 @@ namespace ps2recomp
const Function &function, const std::unordered_set<uint32_t> &internalTargets);
void setRenamedFunctions(const std::unordered_map<uint32_t, std::string> &renames);
void setBootstrapInfo(const BootstrapInfo &info);
std::unordered_set<uint32_t> collectInternalBranchTargets(const Function &function,
const std::vector<Instruction> &instructions);
public:
std::vector<Symbol> m_symbols;
std::unordered_map<uint32_t, std::string> m_renamedFunctions;
BootstrapInfo m_bootstrapInfo;
std::string translateInstruction(const Instruction &inst);
std::string translateMMIInstruction(const Instruction &inst);
@@ -104,9 +116,11 @@ namespace ps2recomp
// Jump Table Generation
std::string generateJumpTableSwitch(const Instruction &inst, uint32_t tableAddress,
const std::vector<JumpTableEntry> &entries);
std::string generateBootstrapFunction() const;
Symbol *findSymbolByAddress(uint32_t address);
std::string getFunctionName(uint32_t address);
std::string getGeneratedFunctionName(const Function &function);
};
}