Merge pull request #6949 from daniel229/func_replace_soranokiseki

Functions replace in Sora no Kiseki FC, SC ,and Boku no Natsuyasumi 2 and 4
This commit is contained in:
Henrik Rydgård 2014-10-02 15:48:28 +02:00
commit c2a462ceb2
2 changed files with 46 additions and 1 deletions

View File

@ -690,6 +690,45 @@ static int Hook_kagaku_no_ensemble_download_frame() {
return 0;
}
static int Hook_soranokiseki_fc_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_A2];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00044000);
CBreakPoints::ExecMemCheck(fb_address, true, 0x00044000, currentMIPS->pc);
}
return 0;
}
static int Hook_soranokiseki_sc_download_frame() {
u32 fb_infoaddr;
if (!GetMIPSStaticAddress(fb_infoaddr, 0x28, 0x2C)) {
return 0;
}
const u32 fb_info = Memory::Read_U32(fb_infoaddr);
const MIPSOpcode fb_index_load = Memory::Read_Instruction(currentMIPS->pc + 0x34, true);
if (fb_index_load != MIPS_MAKE_LW(MIPS_GET_RT(fb_index_load), MIPS_GET_RS(fb_index_load), fb_index_load & 0xffff)) {
return 0;
}
const int fb_index_offset = (s16)(fb_index_load & 0xffff);
const u32 fb_index = (Memory::Read_U32(fb_info + fb_index_offset) + 1) & 1;
const u32 fb_address = 0x4000000 + (0x44000 * fb_index);
const u32 dest_address = currentMIPS->r[MIPS_REG_A1];
if (Memory::IsRAMAddress(dest_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00044000);
CBreakPoints::ExecMemCheck(fb_address, true, 0x00044000, currentMIPS->pc);
}
return 0;
}
static int Hook_bokunonatsuyasumi4_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_A3];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00044000);
CBreakPoints::ExecMemCheck(fb_address, true, 0x00044000, currentMIPS->pc);
}
return 0;
}
// Can either replace with C functions or functions emitted in Asm/ArmAsm.
static const ReplacementTableEntry entries[] = {
// TODO: I think some games can be helped quite a bit by implementing the
@ -747,6 +786,9 @@ static const ReplacementTableEntry entries[] = {
{ "suikoden1_and_2_download_frame_2", &Hook_suikoden1_and_2_download_frame_2, 0, REPFLAG_HOOKENTER, 0x48 },
{ "rezel_cross_download_frame", &Hook_rezel_cross_download_frame, 0, REPFLAG_HOOKENTER, 0x54 },
{ "kagaku_no_ensemble_download_frame", &Hook_kagaku_no_ensemble_download_frame, 0, REPFLAG_HOOKENTER, 0x38 },
{ "soranokiseki_fc_download_frame", &Hook_soranokiseki_fc_download_frame, 0, REPFLAG_HOOKENTER, 0x180 },
{ "soranokiseki_sc_download_frame", &Hook_soranokiseki_sc_download_frame, 0, REPFLAG_HOOKENTER, },
{ "bokunonatsuyasumi4_download_frame", &Hook_bokunonatsuyasumi4_download_frame, 0, REPFLAG_HOOKENTER, 0x8C },
{}
};

View File

@ -326,7 +326,7 @@ static const HardHashTableEntry hardcodedHashes[] = {
{ 0xafb2c7e56c04c8e9, 48, "vtfm_q", },
{ 0xafc9968e7d246a5e, 1588, "atan", },
{ 0xafcb7dfbc4d72588, 44, "vector_transform_3x4", },
{ 0xb07f9d82d79deea9, 536, "brandish_download_frame", }, // Brandish
{ 0xb07f9d82d79deea9, 536, "brandish_download_frame", }, // Brandish, and Sora no kiseki 3rd
{ 0xb0db731f27d3aa1b, 40, "vmax_s", },
{ 0xb0ef265e87899f0a, 32, "vector_divide_t_s", },
{ 0xb183a37baa12607b, 32, "vscl_t", },
@ -344,6 +344,7 @@ static const HardHashTableEntry hardcodedHashes[] = {
{ 0xb8bd1f0e02e9ad87, 156, "dl_write_light_dir", },
{ 0xb8cfaeebfeb2de20, 7548, "_vfprintf_r", },
{ 0xb97f352e85661af6, 32, "finitef", },
{ 0xba76a8e853426baa, 544, "soranokiseki_fc_download_frame", }, // Sora no kiseki FC
{ 0xbb3c6592ed319ba4, 132, "dl_write_fog_params", },
{ 0xbb7d7c93e4c08577, 124, "__truncdfsf2", },
{ 0xbdf54d66079afb96, 200, "dl_write_bone_matrix_3", },
@ -353,6 +354,7 @@ static const HardHashTableEntry hardcodedHashes[] = {
{ 0xbfa8c16038b7753d, 868, "sakurasou_download_frame", }, // Sakurasou No Pet Na Kanojo
{ 0xc062f2545ef5dc39, 1076, "kirameki_school_life_download_frame", },// Kirameki School Life SP,and Boku wa Tomodati ga Sukunai
{ 0xc0feb88cc04a1dc7, 48, "vector_negate_t", },
{ 0xc1220040b0599a75, 472, "soranokiseki_sc_download_frame", }, // Sora no kiseki SC
{ 0xc1f34599d0b9146b, 116, "__subdf3", },
{ 0xc3089f66ee6f0a24, 464, "growlanser_create_saveicon", }, // Growlanswer IV
{ 0xc319f0d107dd2f45, 888, "__muldf3", },
@ -389,6 +391,7 @@ static const HardHashTableEntry hardcodedHashes[] = {
{ 0xddfa5a85937aa581, 32, "vdot_q", },
{ 0xe0214719d8a0aa4e, 104, "strstr", },
{ 0xe029f0699ca3a886, 76, "matrix300_transform_by", },
{ 0xe086d5c9ce89148f, 212, "bokunonatsuyasumi4_download_frame", }, // Boku no Natsuyasumi 2 and 4,
{ 0xe093c2b0194d52b3, 820, "ff1_battle_effect", }, // Final Fantasy 1
{ 0xe1107cf3892724a0, 460, "_memalign_r", },
{ 0xe1724e6e29209d97, 24, "vector_length_t_2", },