RSP: Added musyx ucode suport to HLE from mupen64plus-ae
[mupen64plus-pandora.git] / source / mupen64plus-rsp-hle / src / hle.h
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"
27 #include <stdint.h>
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
42 static 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;
46
47     return x;
48 }
49
50 extern RSP_INFO rsp;
51
52 typedef struct {
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
78 static inline const OSTask_t *const get_task(void)
79 {
80     return (OSTask_t *)(rsp.DMEM + 0xfc0);
81 }
82
83 void DebugMessage(int level, const char *message, ...);
84
85 extern uint8_t BufferSpace[0x10000];
86
87 extern uint16_t AudioInBuffer;   /* 0x0000(T8) */
88 extern uint16_t AudioOutBuffer;  /* 0x0002(T8) */
89 extern uint16_t AudioCount;      /* 0x0004(T8) */
90 extern uint32_t loopval;         /* 0x0010(T8) */
91 extern int16_t Env_Dry;
92 extern int16_t Env_Wet;
93 extern int16_t Vol_Left;
94 extern int16_t Vol_Right;
95 extern int16_t VolTrg_Left;
96 extern int32_t VolRamp_Left;
97 extern int16_t VolTrg_Right;
98 extern int32_t VolRamp_Right;
99
100 extern uint16_t adpcmtable[0x88];
101 extern const uint16_t ResampleLUT [0x200];
102 extern short hleMixerWorkArea[256];
103
104 void MP3(uint32_t inst1, uint32_t inst2);
105
106 #endif