1 // Copyright (c) 2012- PPSSPP Project.
2 
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, version 2.0 or later versions.
6 
7 // This program is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10 // GNU General Public License 2.0 for more details.
11 
12 // A copy of the GPL 2.0 should have been included with the program.
13 // If not, see http://www.gnu.org/licenses/
14 
15 // Official git repository and contact information can be found at
16 // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
17 
18 #include "Core/HLE/HLE.h"
19 #include "Core/HLE/FunctionWrappers.h"
20 #include "Core/HLE/sceAudiocodec.h"
21 
22 enum {
23 	AUDIO_ROUTING_SPEAKER_OFF = 0,
24 	AUDIO_ROUTING_SPEAKER_ON = 1,
25 };
26 
27 u32 audioRoutingMode = AUDIO_ROUTING_SPEAKER_ON;
28 u32 audioRoutineVolumeMode = AUDIO_ROUTING_SPEAKER_ON;
29 
sceAudioRoutingGetMode()30 static int sceAudioRoutingGetMode() {
31 	INFO_LOG(SCEAUDIO, "sceAudioRoutingGetMode");
32 	return 0;
33 }
34 
sceAudioRoutingSetVolumeMode(int mode)35 static int sceAudioRoutingSetVolumeMode(int mode) {
36 	INFO_LOG(SCEAUDIO, "sceAudioRoutingSetVolumeMode %d", mode);
37 	int previousMode = audioRoutineVolumeMode;
38 	audioRoutineVolumeMode = audioRoutingMode;
39 	return previousMode;
40 }
41 
sceAudioRoutingGetVolumeMode()42 static int sceAudioRoutingGetVolumeMode() {
43 	INFO_LOG(SCEAUDIO, "sceAudioRoutingGetMode");
44 	return 0;
45 }
46 
sceAudioRoutingSetMode(int mode)47 static int sceAudioRoutingSetMode(int mode) {
48 	INFO_LOG(SCEAUDIO, "sceAudioRoutingSetMode %d", mode);
49 	int previousMode = audioRoutingMode;
50 	audioRoutingMode = mode;
51 	return previousMode;
52 }
53 
54 const HLEFunction sceAudioRouting[] =
55 {
56 	{0X39240E7D, &WrapI_V<sceAudioRoutingGetMode>,       "sceAudioRoutingGetMode",       'i', "" },
57 	{0X28235C56, &WrapI_V<sceAudioRoutingGetVolumeMode>, "sceAudioRoutingGetVolumeMode", 'i', "" },
58 	{0X36FD8AA9, &WrapI_I<sceAudioRoutingSetMode>,       "sceAudioRoutingSetMode",       'i', "i"},
59 	{0XBB548475, &WrapI_I<sceAudioRoutingSetVolumeMode>, "sceAudioRoutingSetVolumeMode", 'i', "i"},
60 };
61 
Register_sceAudioRouting()62 void Register_sceAudioRouting()
63 {
64 	RegisterModule("sceAudioRouting", ARRAY_SIZE(sceAudioRouting), sceAudioRouting);
65 }
66