Added microcode tomls for RSPRecomp

This commit is contained in:
Mr-Wiseguy 2024-05-12 20:35:54 -04:00
parent a72f4d6072
commit d5fb5f50c1
3 changed files with 55 additions and 10 deletions

11
aspMain.us.rev1.toml Normal file
View File

@ -0,0 +1,11 @@
text_offset = 0xC40FF0
text_size = 0x1000
text_address = 0x04001000
rom_file_path = "mm.us.rev1_uncompressed.z64"
output_file_path = "rsp/aspMain.cpp"
output_function_name = "aspMain"
extra_indirect_branch_targets = [
0x1F80, 0x1250, 0x1154, 0x1094, 0x1E0C, 0x1514, 0x1E7C, 0x1C90,
0x1180, 0x1808, 0x11E8, 0x1ADC, 0x1B6C, 0x1194, 0x1EF8, 0x1240,
0x17C0, 0x186C, 0x1A58, 0x18BC, 0x1ABC, 0x1ACC, 0x1A80, 0x1BD4
]

View File

@ -3,6 +3,7 @@
#include "rsp_vu.h"
#include "recomp.h"
#include <cstdio>
enum class RspExitReason {
Invalid,
@ -16,21 +17,48 @@ extern uint8_t dmem[];
extern uint16_t rspReciprocals[512];
extern uint16_t rspInverseSquareRoots[512];
#define RSP_MEM_W(offset, addr) \
(*reinterpret_cast<uint32_t*>(dmem + (0xFFF & ((offset) + (addr)))))
#define RSP_MEM_H(offset, addr) \
(*reinterpret_cast<int16_t*>(dmem + (0xFFF & (((offset) + (addr)) ^ 2))))
#define RSP_MEM_HU(offset, addr) \
(*reinterpret_cast<uint16_t*>(dmem + (0xFFF & (((offset) + (addr)) ^ 2))))
#define RSP_MEM_B(offset, addr) \
(*reinterpret_cast<int8_t*>(dmem + (0xFFF & (((offset) + (addr)) ^ 3))))
#define RSP_MEM_BU(offset, addr) \
(*reinterpret_cast<uint8_t*>(dmem + (0xFFF & (((offset) + (addr)) ^ 3))))
static inline uint32_t RSP_MEM_W_LOAD(uint32_t offset, uint32_t addr) {
uint32_t out;
for (int i = 0; i < 4; i++) {
reinterpret_cast<uint8_t*>(&out)[i ^ 3] = RSP_MEM_BU(offset + i, addr);
}
return out;
}
static inline void RSP_MEM_W_STORE(uint32_t offset, uint32_t addr, uint32_t val) {
for (int i = 0; i < 4; i++) {
RSP_MEM_BU(offset + i, addr) = reinterpret_cast<uint8_t*>(&val)[i ^ 3];
}
}
static inline uint32_t RSP_MEM_HU_LOAD(uint32_t offset, uint32_t addr) {
uint16_t out;
for (int i = 0; i < 2; i++) {
reinterpret_cast<uint8_t*>(&out)[(i + 2) ^ 3] = RSP_MEM_BU(offset + i, addr);
}
return out;
}
static inline uint32_t RSP_MEM_H_LOAD(uint32_t offset, uint32_t addr) {
int16_t out;
for (int i = 0; i < 2; i++) {
reinterpret_cast<uint8_t*>(&out)[(i + 2) ^ 3] = RSP_MEM_BU(offset + i, addr);
}
return out;
}
static inline void RSP_MEM_H_STORE(uint32_t offset, uint32_t addr, uint32_t val) {
for (int i = 0; i < 2; i++) {
RSP_MEM_BU(offset + i, addr) = reinterpret_cast<uint8_t*>(&val)[(i + 2) ^ 3];
}
}
#define RSP_ADD32(a, b) \
((int32_t)((a) + (b)))

6
njpgdspMain.us.rev1.toml Normal file
View File

@ -0,0 +1,6 @@
text_offset = 0xC438B0
text_size = 0xAF0
text_address = 0x04001080
rom_file_path = "mm.us.rev1_uncompressed.z64"
output_file_path = "rsp/njpgdspMain.cpp"
output_function_name = "njpgdspMain"