MCPcopy Create free account
hub / github.com/devkitPro/libctru / DSP_LoadComponent

Function DSP_LoadComponent

libctru/source/services/dsp.c:184–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182}
183
184Result DSP_LoadComponent(const void* component, u32 size, u16 prog_mask, u16 data_mask, bool* is_loaded)
185{
186 if (dspComponentLoaded)
187 {
188 if (is_loaded) *is_loaded = dspComponentLoaded;
189 return 0;
190 }
191
192 dspSavedCompBin = component;
193 dspSavedCompSize = size;
194 dspSavedCompProgMask = prog_mask;
195 dspSavedCompDataMask = data_mask;
196
197 Result ret = 0;
198 u32* cmdbuf = getThreadCommandBuffer();
199 cmdbuf[0] = IPC_MakeHeader(0x11,3,2);
200 cmdbuf[1] = size;
201 cmdbuf[2] = prog_mask;
202 cmdbuf[3] = data_mask;
203 cmdbuf[4] = IPC_Desc_Buffer(size,IPC_BUFFER_R);
204 cmdbuf[5] = (u32) component;
205 if (R_FAILED(ret = svcSendSyncRequest(dspHandle))) return ret;
206 dspComponentLoaded = cmdbuf[2] & 0xFF;
207 if (is_loaded) *is_loaded = dspComponentLoaded;
208 return cmdbuf[1];
209}
210
211Result DSP_UnloadComponent(void)
212{

Callers 2

ndspInitFunction · 0.85
aptDspWakeupFunction · 0.85

Calls 3

getThreadCommandBufferFunction · 0.85
IPC_MakeHeaderFunction · 0.85
IPC_Desc_BufferFunction · 0.85

Tested by

no test coverage detected