RSP HLE plugin. Compile and run on the OpenPandora
[mupen64plus-pandora.git] / source / mupen64plus-rsp-hle / src / cicx105.c
CommitLineData
d9e74a6f 1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2 * Mupen64plus-rsp-hle - cicx105.c *
3 * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
4 * Copyright (C) 2012 Bobby Smiles *
5 * Copyright (C) 2009 Richard Goedeken *
6 * Copyright (C) 2002 Hacktarux *
7 * *
8 * This program is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation; either version 2 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program; if not, write to the *
20 * Free Software Foundation, Inc., *
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
22 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
23
24#include <string.h>
25
26#include "hle.h"
27
28/**
29 * During IPL3 stage of CIC x105 games, the RSP performs some checks and transactions
30 * necessary for booting the game.
31 *
32 * We only implement the needed DMA transactions for booting.
33 *
34 * Found in Banjo-Tooie, Zelda, Perfect Dark, ...)
35 **/
36void cicx105_ucode()
37{
38 // memcpy is okay to use because access constrains are met (alignment, size)
39 unsigned int i;
40 unsigned char * dst = rsp.RDRAM + 0x2fb1f0;
41 unsigned char * src = rsp.IMEM + 0x120;
42
43 /* dma_read(0x1120, 0x1e8, 0x1e8) */
44 memcpy(rsp.IMEM + 0x120, rsp.RDRAM + 0x1e8, 0x1f0);
45
46 /* dma_write(0x1120, 0x2fb1f0, 0xfe817000) */
47 for (i = 0; i < 24; ++i)
48 {
49 memcpy(dst, src, 8);
50 dst += 0xff0;
51 src += 0x8;
52
53 }
54}
55