summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/service/cfg/cfg_u.cpp66
-rw-r--r--src/core/hle/service/dsp_dsp.cpp66
-rw-r--r--src/core/hle/service/ldr_ro.cpp64
-rw-r--r--src/core/settings.h3
4 files changed, 191 insertions, 8 deletions
diff --git a/src/core/hle/service/cfg/cfg_u.cpp b/src/core/hle/service/cfg/cfg_u.cpp
index 835620909..5d212a9a2 100644
--- a/src/core/hle/service/cfg/cfg_u.cpp
+++ b/src/core/hle/service/cfg/cfg_u.cpp
@@ -5,6 +5,7 @@
5#include "common/file_util.h" 5#include "common/file_util.h"
6#include "common/log.h" 6#include "common/log.h"
7#include "common/string_util.h" 7#include "common/string_util.h"
8#include "core/settings.h"
8#include "core/file_sys/archive_systemsavedata.h" 9#include "core/file_sys/archive_systemsavedata.h"
9#include "core/hle/hle.h" 10#include "core/hle/hle.h"
10#include "core/hle/service/cfg/cfg.h" 11#include "core/hle/service/cfg/cfg.h"
@@ -129,6 +130,65 @@ static void GetConfigInfoBlk2(Service::Interface* self) {
129} 130}
130 131
131/** 132/**
133 * CFG_User::SecureInfoGetRegion service function
134 * Inputs:
135 * 1 : None
136 * Outputs:
137 * 0 : Result Header code
138 * 1 : Result of function, 0 on success, otherwise error code
139 * 2 : Region value loaded from SecureInfo offset 0x100
140 */
141static void SecureInfoGetRegion(Service::Interface* self) {
142 u32* cmd_buffer = Kernel::GetCommandBuffer();
143
144 cmd_buffer[1] = RESULT_SUCCESS.raw; // No Error
145 cmd_buffer[2] = Settings::values.region_value;
146}
147
148/**
149 * CFG_User::GenHashConsoleUnique service function
150 * Inputs:
151 * 1 : 20 bit application ID salt
152 * Outputs:
153 * 0 : Result Header code
154 * 1 : Result of function, 0 on success, otherwise error code
155 * 2 : Hash/"ID" lower word
156 * 3 : Hash/"ID" upper word
157 */
158static void GenHashConsoleUnique(Service::Interface* self) {
159 u32* cmd_buffer = Kernel::GetCommandBuffer();
160 u32 app_id_salt = cmd_buffer[1];
161
162 cmd_buffer[1] = RESULT_SUCCESS.raw; // No Error
163 cmd_buffer[2] = 0x33646D6F ^ (app_id_salt & 0xFFFFF); // 3dmoo hash
164 cmd_buffer[3] = 0x6F534841 ^ (app_id_salt & 0xFFFFF);
165
166 LOG_WARNING(Service_CFG, "(STUBBED) called app_id_salt=0x%08X", app_id_salt);
167}
168
169/**
170 * CFG_User::GetRegionCanadaUSA service function
171 * Inputs:
172 * 1 : None
173 * Outputs:
174 * 0 : Result Header code
175 * 1 : Result of function, 0 on success, otherwise error code
176 * 2 : Output value
177 */
178static void GetRegionCanadaUSA(Service::Interface* self) {
179 u32* cmd_buffer = Kernel::GetCommandBuffer();
180
181 cmd_buffer[1] = RESULT_SUCCESS.raw; // No Error
182
183 u8 canada_or_usa = 1;
184 if (canada_or_usa == Settings::values.region_value) {
185 cmd_buffer[2] = 1;
186 } else {
187 cmd_buffer[2] = 0;
188 }
189}
190
191/**
132 * CFG_User::GetSystemModel service function 192 * CFG_User::GetSystemModel service function
133 * Inputs: 193 * Inputs:
134 * 0 : 0x00050000 194 * 0 : 0x00050000
@@ -171,9 +231,9 @@ static void GetModelNintendo2DS(Service::Interface* self) {
171 231
172const Interface::FunctionInfo FunctionTable[] = { 232const Interface::FunctionInfo FunctionTable[] = {
173 {0x00010082, GetConfigInfoBlk2, "GetConfigInfoBlk2"}, 233 {0x00010082, GetConfigInfoBlk2, "GetConfigInfoBlk2"},
174 {0x00020000, nullptr, "SecureInfoGetRegion"}, 234 {0x00020000, SecureInfoGetRegion, "SecureInfoGetRegion"},
175 {0x00030040, nullptr, "GenHashConsoleUnique"}, 235 {0x00030040, GenHashConsoleUnique, "GenHashConsoleUnique"},
176 {0x00040000, nullptr, "GetRegionCanadaUSA"}, 236 {0x00040000, GetRegionCanadaUSA, "GetRegionCanadaUSA"},
177 {0x00050000, GetSystemModel, "GetSystemModel"}, 237 {0x00050000, GetSystemModel, "GetSystemModel"},
178 {0x00060000, GetModelNintendo2DS, "GetModelNintendo2DS"}, 238 {0x00060000, GetModelNintendo2DS, "GetModelNintendo2DS"},
179 {0x00070040, nullptr, "WriteToFirstByteCfgSavegame"}, 239 {0x00070040, nullptr, "WriteToFirstByteCfgSavegame"},
diff --git a/src/core/hle/service/dsp_dsp.cpp b/src/core/hle/service/dsp_dsp.cpp
index 9a38be393..f413c6f54 100644
--- a/src/core/hle/service/dsp_dsp.cpp
+++ b/src/core/hle/service/dsp_dsp.cpp
@@ -128,6 +128,31 @@ void WriteReg0x10(Service::Interface* self) {
128} 128}
129 129
130/** 130/**
131 * DSP_DSP::WriteProcessPipe service function
132 * Inputs:
133 * 1 : Number
134 * 2 : Size
135 * 3 : (size <<14) | 0x402
136 * 4 : Buffer
137 * Outputs:
138 * 0 : Return header
139 * 1 : Result of function, 0 on success, otherwise error code
140 */
141void WriteProcessPipe(Service::Interface* self) {
142 u32* cmd_buff = Kernel::GetCommandBuffer();
143
144 u32 number = cmd_buff[1];
145 u32 size = cmd_buff[2];
146 u32 new_size = cmd_buff[3];
147 u32 buffer = cmd_buff[4];
148
149 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
150
151 LOG_WARNING(Service_DSP, "(STUBBED) called number=%u, size=0x%08X, new_size=0x%08X, buffer=0x%08X",
152 number, size, new_size, buffer);
153}
154
155/**
131 * DSP_DSP::ReadPipeIfPossible service function 156 * DSP_DSP::ReadPipeIfPossible service function
132 * Inputs: 157 * Inputs:
133 * 1 : Unknown 158 * 1 : Unknown
@@ -169,6 +194,41 @@ void ReadPipeIfPossible(Service::Interface* self) {
169 LOG_WARNING(Service_DSP, "(STUBBED) called size=0x%08X, buffer=0x%08X", size, addr); 194 LOG_WARNING(Service_DSP, "(STUBBED) called size=0x%08X, buffer=0x%08X", size, addr);
170} 195}
171 196
197/**
198 * DSP_DSP::SetSemaphoreMask service function
199 * Inputs:
200 * 1 : Mask
201 * Outputs:
202 * 1 : Result of function, 0 on success, otherwise error code
203 */
204void SetSemaphoreMask(Service::Interface* self) {
205 u32* cmd_buff = Kernel::GetCommandBuffer();
206
207 u32 mask = cmd_buff[1];
208
209 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
210
211 LOG_WARNING(Service_DSP, "(STUBBED) called mask=0x%08X", mask);
212}
213
214/**
215 * DSP_DSP::GetHeadphoneStatus service function
216 * Inputs:
217 * 1 : None
218 * Outputs:
219 * 1 : Result of function, 0 on success, otherwise error code
220 * 2 : The headphone status response, 0 = Not using headphones?,
221 * 1 = using headphones?
222 */
223void GetHeadphoneStatus(Service::Interface* self) {
224 u32* cmd_buff = Kernel::GetCommandBuffer();
225
226 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
227 cmd_buff[2] = 0; // Not using headphones?
228
229 LOG_WARNING(Service_DSP, "(STUBBED) called");
230}
231
172const Interface::FunctionInfo FunctionTable[] = { 232const Interface::FunctionInfo FunctionTable[] = {
173 {0x00010040, nullptr, "RecvData"}, 233 {0x00010040, nullptr, "RecvData"},
174 {0x00020040, nullptr, "RecvDataIsReady"}, 234 {0x00020040, nullptr, "RecvDataIsReady"},
@@ -179,7 +239,7 @@ const Interface::FunctionInfo FunctionTable[] = {
179 {0x00090040, nullptr, "ClearSemaphore"}, 239 {0x00090040, nullptr, "ClearSemaphore"},
180 {0x000B0000, nullptr, "CheckSemaphoreRequest"}, 240 {0x000B0000, nullptr, "CheckSemaphoreRequest"},
181 {0x000C0040, ConvertProcessAddressFromDspDram, "ConvertProcessAddressFromDspDram"}, 241 {0x000C0040, ConvertProcessAddressFromDspDram, "ConvertProcessAddressFromDspDram"},
182 {0x000D0082, nullptr, "WriteProcessPipe"}, 242 {0x000D0082, WriteProcessPipe, "WriteProcessPipe"},
183 {0x001000C0, ReadPipeIfPossible, "ReadPipeIfPossible"}, 243 {0x001000C0, ReadPipeIfPossible, "ReadPipeIfPossible"},
184 {0x001100C2, LoadComponent, "LoadComponent"}, 244 {0x001100C2, LoadComponent, "LoadComponent"},
185 {0x00120000, nullptr, "UnloadComponent"}, 245 {0x00120000, nullptr, "UnloadComponent"},
@@ -187,13 +247,13 @@ const Interface::FunctionInfo FunctionTable[] = {
187 {0x00140082, nullptr, "InvalidateDCache"}, 247 {0x00140082, nullptr, "InvalidateDCache"},
188 {0x00150082, RegisterInterruptEvents, "RegisterInterruptEvents"}, 248 {0x00150082, RegisterInterruptEvents, "RegisterInterruptEvents"},
189 {0x00160000, GetSemaphoreEventHandle, "GetSemaphoreEventHandle"}, 249 {0x00160000, GetSemaphoreEventHandle, "GetSemaphoreEventHandle"},
190 {0x00170040, nullptr, "SetSemaphoreMask"}, 250 {0x00170040, SetSemaphoreMask, "SetSemaphoreMask"},
191 {0x00180040, nullptr, "GetPhysicalAddress"}, 251 {0x00180040, nullptr, "GetPhysicalAddress"},
192 {0x00190040, nullptr, "GetVirtualAddress"}, 252 {0x00190040, nullptr, "GetVirtualAddress"},
193 {0x001A0042, nullptr, "SetIirFilterI2S1_cmd1"}, 253 {0x001A0042, nullptr, "SetIirFilterI2S1_cmd1"},
194 {0x001B0042, nullptr, "SetIirFilterI2S1_cmd2"}, 254 {0x001B0042, nullptr, "SetIirFilterI2S1_cmd2"},
195 {0x001C0082, nullptr, "SetIirFilterEQ"}, 255 {0x001C0082, nullptr, "SetIirFilterEQ"},
196 {0x001F0000, nullptr, "GetHeadphoneStatus"}, 256 {0x001F0000, GetHeadphoneStatus, "GetHeadphoneStatus"},
197 {0x00210000, nullptr, "GetIsDspOccupied"}, 257 {0x00210000, nullptr, "GetIsDspOccupied"},
198}; 258};
199 259
diff --git a/src/core/hle/service/ldr_ro.cpp b/src/core/hle/service/ldr_ro.cpp
index 7d6e2e8e8..83bb9eabe 100644
--- a/src/core/hle/service/ldr_ro.cpp
+++ b/src/core/hle/service/ldr_ro.cpp
@@ -11,9 +11,69 @@
11 11
12namespace LDR_RO { 12namespace LDR_RO {
13 13
14/**
15 * LDR_RO::Initialize service function
16 * Inputs:
17 * 1 : CRS buffer pointer
18 * 2 : CRS Size
19 * 3 : Process memory address where the CRS will be mapped
20 * 4 : Value, must be zero
21 * 5 : KProcess handle
22 * Outputs:
23 * 0 : Return header
24 * 1 : Result of function, 0 on success, otherwise error code
25 */
26static void Initialize(Service::Interface* self) {
27 u32* cmd_buff = Kernel::GetCommandBuffer();
28 u32 crs_buffer_ptr = cmd_buff[1];
29 u32 crs_size = cmd_buff[2];
30 u32 address = cmd_buff[3];
31 u32 value = cmd_buff[4];
32 u32 process = cmd_buff[5];
33
34 if (value != 0) {
35 LOG_ERROR(Service_LDR, "This value should be zero, but is actually %u!", value);
36 }
37
38 // TODO(purpasmart96): Verify return header on HW
39
40 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
41
42 LOG_WARNING(Service_LDR, "(STUBBED) called");
43}
44
45/**
46 * LDR_RO::LoadCRR service function
47 * Inputs:
48 * 1 : CRS buffer pointer
49 * 2 : CRS Size
50 * 3 : Value, must be zero
51 * 4 : KProcess handle
52 * Outputs:
53 * 0 : Return header
54 * 1 : Result of function, 0 on success, otherwise error code
55 */
56static void LoadCRR(Service::Interface* self) {
57 u32* cmd_buff = Kernel::GetCommandBuffer();
58 u32 crs_buffer_ptr = cmd_buff[1];
59 u32 crs_size = cmd_buff[2];
60 u32 value = cmd_buff[3];
61 u32 process = cmd_buff[4];
62
63 if (value != 0) {
64 LOG_ERROR(Service_LDR, "This value should be zero, but is actually %u!", value);
65 }
66
67 // TODO(purpasmart96): Verify return header on HW
68
69 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
70
71 LOG_WARNING(Service_LDR, "(STUBBED) called");
72}
73
14const Interface::FunctionInfo FunctionTable[] = { 74const Interface::FunctionInfo FunctionTable[] = {
15 {0x000100C2, nullptr, "Initialize"}, 75 {0x000100C2, Initialize, "Initialize"},
16 {0x00020082, nullptr, "LoadCRR"}, 76 {0x00020082, LoadCRR, "LoadCRR"},
17 {0x00030042, nullptr, "UnloadCCR"}, 77 {0x00030042, nullptr, "UnloadCCR"},
18 {0x000402C2, nullptr, "LoadExeCRO"}, 78 {0x000402C2, nullptr, "LoadExeCRO"},
19 {0x000500C2, nullptr, "LoadCROSymbols"}, 79 {0x000500C2, nullptr, "LoadCROSymbols"},
diff --git a/src/core/settings.h b/src/core/settings.h
index 4b8928847..9b52be259 100644
--- a/src/core/settings.h
+++ b/src/core/settings.h
@@ -36,6 +36,9 @@ struct Values {
36 // Data Storage 36 // Data Storage
37 bool use_virtual_sd; 37 bool use_virtual_sd;
38 38
39 // System Region
40 int region_value;
41
39 std::string log_filter; 42 std::string log_filter;
40} extern values; 43} extern values;
41 44