Path: blob/master/libmupen64plus/mupen64plus-rsp-hle/src/alist.c
2 views
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *1* Mupen64plus-rsp-hle - alist.c *2* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *3* Copyright (C) 2012 Bobby Smiles *4* Copyright (C) 2009 Richard Goedeken *5* Copyright (C) 2002 Hacktarux *6* *7* This program is free software; you can redistribute it and/or modify *8* it under the terms of the GNU General Public License as published by *9* the Free Software Foundation; either version 2 of the License, or *10* (at your option) any later version. *11* *12* This program is distributed in the hope that it will be useful, *13* but WITHOUT ANY WARRANTY; without even the implied warranty of *14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *15* GNU General Public License for more details. *16* *17* You should have received a copy of the GNU General Public License *18* along with this program; if not, write to the *19* Free Software Foundation, Inc., *20* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *21* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */2223#include "hle.h"24#include "alist_internal.h"2526// FIXME: this decomposition into 3 ABI is not accurate,27// there are a least 9 or 10 different ABI, each with one or a few revisions28// for a total of almost 16 differents audio ucode.29//30// ABI2 in fact is a mix of at least 7 differents ABI which are mostly compatible31// but not totally, that's why there is a isZeldaABI/isMKABI workaround.32//33extern const acmd_callback_t ABI1[0x10];34extern const acmd_callback_t ABI2[0x20];35extern const acmd_callback_t ABI3[0x10];3637/* local functions */38static void alist_process(const acmd_callback_t abi[], unsigned int abi_size)39{40u32 inst1, inst2;41unsigned int acmd;42const OSTask_t * const task = get_task();4344const unsigned int *alist = (unsigned int*)(rsp.RDRAM + task->data_ptr);45const unsigned int * const alist_end = alist + (task->data_size >> 2);4647while (alist != alist_end)48{49inst1 = *(alist++);50inst2 = *(alist++);5152acmd = inst1 >> 24;5354if (acmd < abi_size)55{56(*abi[acmd])(inst1, inst2);57}58else59{60DebugMessage(M64MSG_WARNING, "Invalid ABI command %u", acmd);61}62}63}6465/* global functions */66void alist_process_ABI1()67{68alist_process(ABI1, 0x10);69}7071void alist_process_ABI2()72{73alist_process(ABI2, 0x20);74}7576void alist_process_ABI3()77{78alist_process(ABI3, 0x10);79}8081828384