| 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 "m64p_plugin.h" |
| 27 | #include "hle.h" |
| 28 | #include "cicx105.h" |
| 29 | |
| 30 | /** |
| 31 | * During IPL3 stage of CIC x105 games, the RSP performs some checks and transactions |
| 32 | * necessary for booting the game. |
| 33 | * |
| 34 | * We only implement the needed DMA transactions for booting. |
| 35 | * |
| 36 | * Found in Banjo-Tooie, Zelda, Perfect Dark, ...) |
| 37 | **/ |
| 38 | void cicx105_ucode(void) |
| 39 | { |
| 40 | /* memcpy is okay to use because access constrains are met (alignment, size) */ |
| 41 | unsigned int i; |
| 42 | unsigned char *dst = rsp.RDRAM + 0x2fb1f0; |
| 43 | unsigned char *src = rsp.IMEM + 0x120; |
| 44 | |
| 45 | /* dma_read(0x1120, 0x1e8, 0x1e8) */ |
| 46 | memcpy(rsp.IMEM + 0x120, rsp.RDRAM + 0x1e8, 0x1f0); |
| 47 | |
| 48 | /* dma_write(0x1120, 0x2fb1f0, 0xfe817000) */ |
| 49 | for (i = 0; i < 24; ++i) { |
| 50 | memcpy(dst, src, 8); |
| 51 | dst += 0xff0; |
| 52 | src += 0x8; |
| 53 | |
| 54 | } |
| 55 | } |