/*
patches_cm.cpp
Copyright (C) 2008 somebody
Copyright (C) 2009 yellow wood goblin
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
void CDsPatcher::FixBugs(void)
{
//"3908 - Catan (Europe) (En,De)"
if(0x50374e43==GameCode()&&0==__NDSHeader->romversion)
{
//bug in ai? vector[vector.size()-1] cause crash on empty vector.
const u32 patch[]=
{
0xe3540000, // cmp r4, #0
0x12441001, // subne r1, r4, #1
0x112fff1e, // bxne lr
0xe28dd070, // add sp, sp, #0x70
0xe3a00000, // mov r0, #0
0xe8bd8ff8 // ldmfd sp!, {r3-r11, pc}
};
memcpy((void*)0x2000bc0,patch,sizeof(patch));
PatchMem(KArm9,0x0207a9f0,0xebfe1872);
}
//"0735 - Castlevania - Portrait of Ruin (USA)"
else if(0x45424341==GameCode())
{
PatchMem(KArm9,0x02007910,0xeb02508e);
PatchMem(KArm9,0x02007918,0xea000004);
PatchMem(KArm9,0x02007a00,0xeb025052);
PatchMem(KArm9,0x02007a08,0xe59f1030);
PatchMem(KArm9,0x02007a0c,0xe59f0028);
PatchMem(KArm9,0x02007a10,0xe0281097);
PatchMem(KArm9,0x02007a14,0xea000003);
}
//"0676 - Akumajou Dracula - Gallery of Labyrinth (Japan)"
else if(0x4a424341==GameCode())
{
PatchMem(KArm9,0x02007910,0xeb0250b0);
PatchMem(KArm9,0x02007918,0xea000004);
PatchMem(KArm9,0x02007a00,0xeb025074);
PatchMem(KArm9,0x02007a08,0xe59f1030);
PatchMem(KArm9,0x02007a0c,0xe59f0028);
PatchMem(KArm9,0x02007a10,0xe0281097);
PatchMem(KArm9,0x02007a14,0xea000003);
}
//"0881 - Castlevania - Portrait of Ruin (Europe) (En,Fr,De,Es,It)"
else if(0x50424341==GameCode())
{
PatchMem(KArm9,0x02007b00,0xeb025370);
PatchMem(KArm9,0x02007b08,0xea000004);
PatchMem(KArm9,0x02007bf0,0xeb025334);
PatchMem(KArm9,0x02007bf8,0xe59f1030);
PatchMem(KArm9,0x02007bfc,0xe59f0028);
PatchMem(KArm9,0x02007c00,0xe0281097);
PatchMem(KArm9,0x02007c04,0xea000003);
}
else if(0x50474942==GameCode()) //4800 - Combat of Giants - Mutant Insects (Europe) (En,Fr,De,Es,It,Nl,Sv,No,Da)
{
if(IsCommon()||IsDMA()||IsSDSave()) PatchCoG3();
}
}