RSP: Added musyx ucode suport to HLE from mupen64plus-ae
[mupen64plus-pandora.git] / source / mupen64plus-rsp-hle / src / hle.h
CommitLineData
d9e74a6f 1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2 * Mupen64plus-rsp-hle - hle.h *
3 * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
4 * Copyright (C) 2002 Hacktarux *
5 * *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the *
18 * Free Software Foundation, Inc., *
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
20 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
21
22#ifndef HLE_H
23#define HLE_H
24
25#define M64P_PLUGIN_PROTOTYPES 1
26#include "m64p_plugin.h"
0a8a0368 27#include <stdint.h>
d9e74a6f 28
29#define RSP_HLE_VERSION 0x020000
30#define RSP_PLUGIN_API_VERSION 0x020000
31
32#ifdef M64P_BIG_ENDIAN
33#define S 0
34#define S16 0
35#define S8 0
36#else
37#define S 1
38#define S16 2
39#define S8 3
40#endif
41
0a8a0368 42static inline int16_t clamp_s16(int_fast32_t x)
43{
44 x = (x < INT16_MIN) ? INT16_MIN: x;
45 x = (x > INT16_MAX) ? INT16_MAX: x;
d9e74a6f 46
0a8a0368 47 return x;
48}
d9e74a6f 49
50extern RSP_INFO rsp;
51
0a8a0368 52typedef struct {
d9e74a6f 53 unsigned int type;
54 unsigned int flags;
55
56 unsigned int ucode_boot;
57 unsigned int ucode_boot_size;
58
59 unsigned int ucode;
60 unsigned int ucode_size;
61
62 unsigned int ucode_data;
63 unsigned int ucode_data_size;
64
65 unsigned int dram_stack;
66 unsigned int dram_stack_size;
67
68 unsigned int output_buff;
69 unsigned int output_buff_size;
70
71 unsigned int data_ptr;
72 unsigned int data_size;
73
74 unsigned int yield_data_ptr;
75 unsigned int yield_data_size;
76} OSTask_t;
77
0a8a0368 78static inline const OSTask_t *const get_task(void)
d9e74a6f 79{
0a8a0368 80 return (OSTask_t *)(rsp.DMEM + 0xfc0);
d9e74a6f 81}
82
83void DebugMessage(int level, const char *message, ...);
84
0a8a0368 85extern uint8_t BufferSpace[0x10000];
d9e74a6f 86
0a8a0368 87extern uint16_t AudioInBuffer; /* 0x0000(T8) */
88extern uint16_t AudioOutBuffer; /* 0x0002(T8) */
89extern uint16_t AudioCount; /* 0x0004(T8) */
90extern uint32_t loopval; /* 0x0010(T8) */
91extern int16_t Env_Dry;
92extern int16_t Env_Wet;
93extern int16_t Vol_Left;
94extern int16_t Vol_Right;
95extern int16_t VolTrg_Left;
96extern int32_t VolRamp_Left;
97extern int16_t VolTrg_Right;
98extern int32_t VolRamp_Right;
99
100extern uint16_t adpcmtable[0x88];
101extern const uint16_t ResampleLUT [0x200];
102extern short hleMixerWorkArea[256];
103
104void MP3(uint32_t inst1, uint32_t inst2);
105
106#endif