mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-24 20:21:04 +00:00
Correct some variables and comment in dsp_dsp
Align some code Implement function GetOutputFormat and GetInputFormat Signed-off-by: JamePeng <jame_peng@sina.com>
This commit is contained in:
parent
5ed3824d40
commit
539b072abf
@ -145,7 +145,7 @@ void IsRegistered(Service::Interface* self) {
|
||||
// handle this properly once we implement multiprocess support.
|
||||
cmd_buff[2] = 0; // Set to not registered by default
|
||||
|
||||
if (app_id == static_cast<u32>(AppletId::AnyLibraryApplet)) {
|
||||
if (app_id == static_cast<u32>(AppletId::AnyLibrary)) {
|
||||
cmd_buff[2] = HLE::Applets::IsLibraryAppletRunning() ? 1 : 0;
|
||||
} else if (auto applet = HLE::Applets::Applet::Get(static_cast<AppletId>(app_id))) {
|
||||
cmd_buff[2] = 1; // Set to registered
|
||||
|
@ -46,14 +46,14 @@ enum class SignalType : u32 {
|
||||
enum class AppletId : u32 {
|
||||
HomeMenu = 0x101,
|
||||
AlternateMenu = 0x103,
|
||||
CameraApplet = 0x110,
|
||||
FriendsListApplet = 0x112,
|
||||
GameNotesApplet = 0x113,
|
||||
Camera = 0x110,
|
||||
FriendsList = 0x112,
|
||||
GameNotes = 0x113,
|
||||
InternetBrowser = 0x114,
|
||||
InstructionManual = 0x115,
|
||||
Notifications = 0x116,
|
||||
MiiverseApplet = 0x117,
|
||||
MiiversePostingApplet = 0x118,
|
||||
Miiverse = 0x117,
|
||||
MiiversePosting = 0x118,
|
||||
AmiiboSettings = 0x119,
|
||||
SoftwareKeyboard1 = 0x201,
|
||||
MiiSelectorEd1 = 0x202,
|
||||
@ -65,7 +65,7 @@ enum class AppletId : u32 {
|
||||
Notepad1 = 0x209,
|
||||
Application = 0x300,
|
||||
EShopTiger = 0x301,
|
||||
AnyLibraryApplet = 0x400,
|
||||
AnyLibrary = 0x400,
|
||||
SoftwareKeyboard2 = 0x401,
|
||||
MiiSelectorEd2 = 0x402,
|
||||
PhotoSelector2 = 0x404,
|
||||
|
@ -24,79 +24,79 @@ const Interface::FunctionInfo FunctionTable[] = {
|
||||
{0x000D0080, ReceiveParameter, "ReceiveParameter" },
|
||||
{0x000E0080, GlanceParameter, "GlanceParameter" },
|
||||
{0x000F0100, CancelParameter, "CancelParameter" },
|
||||
{0x001000C2, nullptr, "DebugFunc" },
|
||||
{0x001100C0, nullptr, "MapProgramIdForDebug" },
|
||||
{0x00120040, nullptr, "SetHomeMenuAppletIdForDebug" },
|
||||
{0x00130000, nullptr, "GetPreparationState" },
|
||||
{0x00140040, nullptr, "SetPreparationState" },
|
||||
{0x00150140, nullptr, "PrepareToStartApplication" },
|
||||
{0x001000C2, nullptr, "DebugFunc" },
|
||||
{0x001100C0, nullptr, "MapProgramIdForDebug" },
|
||||
{0x00120040, nullptr, "SetHomeMenuAppletIdForDebug" },
|
||||
{0x00130000, nullptr, "GetPreparationState" },
|
||||
{0x00140040, nullptr, "SetPreparationState" },
|
||||
{0x00150140, nullptr, "PrepareToStartApplication" },
|
||||
{0x00160040, PreloadLibraryApplet, "PreloadLibraryApplet" },
|
||||
{0x00170040, nullptr, "FinishPreloadingLibraryApplet" },
|
||||
{0x00180040, PrepareToStartLibraryApplet, "PrepareToStartLibraryApplet" },
|
||||
{0x00190040, nullptr, "PrepareToStartSystemApplet" },
|
||||
{0x001A0000, nullptr, "PrepareToStartNewestHomeMenu" },
|
||||
{0x001B00C4, nullptr, "StartApplication" },
|
||||
{0x001C0000, nullptr, "WakeupApplication" },
|
||||
{0x001D0000, nullptr, "CancelApplication" },
|
||||
{0x001E0084, nullptr, "StartLibraryApplet" },
|
||||
{0x001F0084, StartLibraryApplet, "StartSystemApplet" },
|
||||
{0x00200044, nullptr, "StartNewestHomeMenu" },
|
||||
{0x00210000, nullptr, "OrderToCloseApplication" },
|
||||
{0x00220040, nullptr, "PrepareToCloseApplication" },
|
||||
{0x00230040, nullptr, "PrepareToJumpToApplication" },
|
||||
{0x00240044, nullptr, "JumpToApplication" },
|
||||
{0x002500C0, nullptr, "PrepareToCloseLibraryApplet" },
|
||||
{0x00260000, nullptr, "PrepareToCloseSystemApplet" },
|
||||
{0x00270044, nullptr, "CloseApplication" },
|
||||
{0x00280044, nullptr, "CloseLibraryApplet" },
|
||||
{0x00290044, nullptr, "CloseSystemApplet" },
|
||||
{0x002A0000, nullptr, "OrderToCloseSystemApplet" },
|
||||
{0x002B0000, nullptr, "PrepareToJumpToHomeMenu" },
|
||||
{0x002C0044, nullptr, "JumpToHomeMenu" },
|
||||
{0x002D0000, nullptr, "PrepareToLeaveHomeMenu" },
|
||||
{0x002E0044, nullptr, "LeaveHomeMenu" },
|
||||
{0x002F0040, nullptr, "PrepareToLeaveResidentApplet" },
|
||||
{0x00300044, nullptr, "LeaveResidentApplet" },
|
||||
{0x00310100, nullptr, "PrepareToDoApplicationJump" },
|
||||
{0x00320084, nullptr, "DoApplicationJump" },
|
||||
{0x00330000, nullptr, "GetProgramIdOnApplicationJump" },
|
||||
{0x00340084, nullptr, "SendDeliverArg" },
|
||||
{0x00350080, nullptr, "ReceiveDeliverArg" },
|
||||
{0x00360040, nullptr, "LoadSysMenuArg" },
|
||||
{0x00370042, nullptr, "StoreSysMenuArg" },
|
||||
{0x00380040, nullptr, "PreloadResidentApplet" },
|
||||
{0x00390040, nullptr, "PrepareToStartResidentApplet" },
|
||||
{0x003A0044, nullptr, "StartResidentApplet" },
|
||||
{0x003B0040, nullptr, "CancelLibraryApplet" },
|
||||
{0x003C0042, nullptr, "SendDspSleep" },
|
||||
{0x003D0042, nullptr, "SendDspWakeUp" },
|
||||
{0x003E0080, nullptr, "ReplySleepQuery" },
|
||||
{0x003F0040, nullptr, "ReplySleepNotificationComplete" },
|
||||
{0x00400042, nullptr, "SendCaptureBufferInfo" },
|
||||
{0x00410040, nullptr, "ReceiveCaptureBufferInfo" },
|
||||
{0x00420080, nullptr, "SleepSystem" },
|
||||
{0x00430040, NotifyToWait, "NotifyToWait" },
|
||||
{0x00440000, GetSharedFont, "GetSharedFont" },
|
||||
{0x00450040, nullptr, "GetWirelessRebootInfo" },
|
||||
{0x00460104, nullptr, "Wrap" },
|
||||
{0x00470104, nullptr, "Unwrap" },
|
||||
{0x00480100, nullptr, "GetProgramInfo" },
|
||||
{0x00490180, nullptr, "Reboot" },
|
||||
{0x004A0040, nullptr, "GetCaptureInfo" },
|
||||
{0x004B00C2, AppletUtility, "AppletUtility" },
|
||||
{0x004C0000, nullptr, "SetFatalErrDispMode" },
|
||||
{0x004D0080, nullptr, "GetAppletProgramInfo" },
|
||||
{0x004E0000, nullptr, "HardwareResetAsync" },
|
||||
{0x004F0080, SetAppCpuTimeLimit, "SetAppCpuTimeLimit" },
|
||||
{0x00500040, GetAppCpuTimeLimit, "GetAppCpuTimeLimit" },
|
||||
{0x00510080, nullptr, "GetStartupArgument" },
|
||||
{0x00520104, nullptr, "Wrap1" },
|
||||
{0x00530104, nullptr, "Unwrap1" },
|
||||
{0x00580002, nullptr, "GetProgramID" },
|
||||
{0x01010000, nullptr, "CheckNew3DSApp" },
|
||||
{0x01020000, nullptr, "CheckNew3DS" },
|
||||
{0x01040000, nullptr, "IsStandardMemoryLayout" },
|
||||
{0x01050100, nullptr, "IsTitleAllowed" }
|
||||
{0x00180040, PrepareToStartLibraryApplet, "PrepareToStartLibraryApplet" },
|
||||
{0x00190040, nullptr, "PrepareToStartSystemApplet" },
|
||||
{0x001A0000, nullptr, "PrepareToStartNewestHomeMenu" },
|
||||
{0x001B00C4, nullptr, "StartApplication" },
|
||||
{0x001C0000, nullptr, "WakeupApplication" },
|
||||
{0x001D0000, nullptr, "CancelApplication" },
|
||||
{0x001E0084, nullptr, "StartLibraryApplet" },
|
||||
{0x001F0084, StartLibraryApplet, "StartSystemApplet" },
|
||||
{0x00200044, nullptr, "StartNewestHomeMenu" },
|
||||
{0x00210000, nullptr, "OrderToCloseApplication" },
|
||||
{0x00220040, nullptr, "PrepareToCloseApplication" },
|
||||
{0x00230040, nullptr, "PrepareToJumpToApplication" },
|
||||
{0x00240044, nullptr, "JumpToApplication" },
|
||||
{0x002500C0, nullptr, "PrepareToCloseLibraryApplet" },
|
||||
{0x00260000, nullptr, "PrepareToCloseSystemApplet" },
|
||||
{0x00270044, nullptr, "CloseApplication" },
|
||||
{0x00280044, nullptr, "CloseLibraryApplet" },
|
||||
{0x00290044, nullptr, "CloseSystemApplet" },
|
||||
{0x002A0000, nullptr, "OrderToCloseSystemApplet" },
|
||||
{0x002B0000, nullptr, "PrepareToJumpToHomeMenu" },
|
||||
{0x002C0044, nullptr, "JumpToHomeMenu" },
|
||||
{0x002D0000, nullptr, "PrepareToLeaveHomeMenu" },
|
||||
{0x002E0044, nullptr, "LeaveHomeMenu" },
|
||||
{0x002F0040, nullptr, "PrepareToLeaveResidentApplet" },
|
||||
{0x00300044, nullptr, "LeaveResidentApplet" },
|
||||
{0x00310100, nullptr, "PrepareToDoApplicationJump" },
|
||||
{0x00320084, nullptr, "DoApplicationJump" },
|
||||
{0x00330000, nullptr, "GetProgramIdOnApplicationJump" },
|
||||
{0x00340084, nullptr, "SendDeliverArg" },
|
||||
{0x00350080, nullptr, "ReceiveDeliverArg" },
|
||||
{0x00360040, nullptr, "LoadSysMenuArg" },
|
||||
{0x00370042, nullptr, "StoreSysMenuArg" },
|
||||
{0x00380040, nullptr, "PreloadResidentApplet" },
|
||||
{0x00390040, nullptr, "PrepareToStartResidentApplet" },
|
||||
{0x003A0044, nullptr, "StartResidentApplet" },
|
||||
{0x003B0040, nullptr, "CancelLibraryApplet" },
|
||||
{0x003C0042, nullptr, "SendDspSleep" },
|
||||
{0x003D0042, nullptr, "SendDspWakeUp" },
|
||||
{0x003E0080, nullptr, "ReplySleepQuery" },
|
||||
{0x003F0040, nullptr, "ReplySleepNotificationComplete" },
|
||||
{0x00400042, nullptr, "SendCaptureBufferInfo" },
|
||||
{0x00410040, nullptr, "ReceiveCaptureBufferInfo" },
|
||||
{0x00420080, nullptr, "SleepSystem" },
|
||||
{0x00430040, NotifyToWait, "NotifyToWait" },
|
||||
{0x00440000, GetSharedFont, "GetSharedFont" },
|
||||
{0x00450040, nullptr, "GetWirelessRebootInfo" },
|
||||
{0x00460104, nullptr, "Wrap" },
|
||||
{0x00470104, nullptr, "Unwrap" },
|
||||
{0x00480100, nullptr, "GetProgramInfo" },
|
||||
{0x00490180, nullptr, "Reboot" },
|
||||
{0x004A0040, nullptr, "GetCaptureInfo" },
|
||||
{0x004B00C2, AppletUtility, "AppletUtility" },
|
||||
{0x004C0000, nullptr, "SetFatalErrDispMode" },
|
||||
{0x004D0080, nullptr, "GetAppletProgramInfo" },
|
||||
{0x004E0000, nullptr, "HardwareResetAsync" },
|
||||
{0x004F0080, SetAppCpuTimeLimit, "SetAppCpuTimeLimit" },
|
||||
{0x00500040, GetAppCpuTimeLimit, "GetAppCpuTimeLimit" },
|
||||
{0x00510080, nullptr, "GetStartupArgument" },
|
||||
{0x00520104, nullptr, "Wrap1" },
|
||||
{0x00530104, nullptr, "Unwrap1" },
|
||||
{0x00580002, nullptr, "GetProgramID" },
|
||||
{0x01010000, nullptr, "CheckNew3DSApp" },
|
||||
{0x01020000, nullptr, "CheckNew3DS" },
|
||||
{0x01040000, nullptr, "IsStandardMemoryLayout" },
|
||||
{0x01050100, nullptr, "IsTitleAllowed" }
|
||||
|
||||
};
|
||||
|
||||
|
@ -50,10 +50,10 @@ static void ConvertProcessAddressFromDspDram(Service::Interface* self) {
|
||||
* DSP_DSP::LoadComponent service function
|
||||
* Inputs:
|
||||
* 1 : Size
|
||||
* 2 : Unknown (observed only half word used)
|
||||
* 3 : Unknown (observed only half word used)
|
||||
* 2 : Program Mask (observed only half word used) (Program ram blocks the component should be loaded into)
|
||||
* 3 : Data Mask (observed only half word used) (Data ram blocks the component should be loaded into)
|
||||
* 4 : (size << 4) | 0xA
|
||||
* 5 : Buffer address
|
||||
* 5 : Component Buffer address
|
||||
* Outputs:
|
||||
* 1 : Result of function, 0 on success, otherwise error code
|
||||
* 2 : Component loaded, 0 on not loaded, 1 on loaded
|
||||
@ -62,8 +62,8 @@ static void LoadComponent(Service::Interface* self) {
|
||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
||||
|
||||
u32 size = cmd_buff[1];
|
||||
u32 unk1 = cmd_buff[2];
|
||||
u32 unk2 = cmd_buff[3];
|
||||
u32 pmask = cmd_buff[2];
|
||||
u32 dmask = cmd_buff[3];
|
||||
u32 new_size = cmd_buff[4];
|
||||
u32 buffer = cmd_buff[5];
|
||||
|
||||
@ -72,8 +72,8 @@ static void LoadComponent(Service::Interface* self) {
|
||||
|
||||
// TODO(bunnei): Implement real DSP firmware loading
|
||||
|
||||
LOG_WARNING(Service_DSP, "(STUBBED) called size=0x%X, unk1=0x%08X, unk2=0x%08X, new_size=0x%X, buffer=0x%08X",
|
||||
size, unk1, unk2, new_size, buffer);
|
||||
LOG_WARNING(Service_DSP, "(STUBBED) called size=0x%X, Program_Mask=0x%08X, Data_Mask=0x%08X, new_size=0x%X, buffer=0x%08X",
|
||||
size, pmask, dmask, new_size, buffer);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -121,17 +121,18 @@ static void FlushDataCache(Service::Interface* self) {
|
||||
/**
|
||||
* DSP_DSP::RegisterInterruptEvents service function
|
||||
* Inputs:
|
||||
* 1 : Parameter 0 (purpose unknown)
|
||||
* 2 : Parameter 1 (purpose unknown)
|
||||
* 4 : Interrupt event handle
|
||||
* 1 : Interrupt
|
||||
* 2 : Channel
|
||||
* 3 : 0x0
|
||||
* 4 : Interrupt event handle (0 = unregister the event that was previous registered)
|
||||
* Outputs:
|
||||
* 1 : Result of function, 0 on success, otherwise error code
|
||||
*/
|
||||
static void RegisterInterruptEvents(Service::Interface* self) {
|
||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
||||
|
||||
u32 param0 = cmd_buff[1];
|
||||
u32 param1 = cmd_buff[2];
|
||||
u32 interrupt = cmd_buff[1];
|
||||
u32 channel = cmd_buff[2];
|
||||
u32 event_handle = cmd_buff[4];
|
||||
|
||||
auto evt = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[4]);
|
||||
@ -145,13 +146,13 @@ static void RegisterInterruptEvents(Service::Interface* self) {
|
||||
cmd_buff[1] = -1;
|
||||
}
|
||||
|
||||
LOG_WARNING(Service_DSP, "(STUBBED) called param0=%u, param1=%u, event_handle=0x%08X", param0, param1, event_handle);
|
||||
LOG_WARNING(Service_DSP, "(STUBBED) called Interrupt=%u, Channel=%u, event_handle=0x%08X", interrupt, channel, event_handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* DSP_DSP::SetSemaphore service function
|
||||
* Inputs:
|
||||
* 1 : Unknown (observed only half word used)
|
||||
* 1 : Semaphore value (observed only half word used)
|
||||
* Outputs:
|
||||
* 1 : Result of function, 0 on success, otherwise error code
|
||||
*/
|
||||
@ -193,8 +194,8 @@ static void WriteProcessPipe(Service::Interface* self) {
|
||||
/**
|
||||
* DSP_DSP::ReadPipeIfPossible service function
|
||||
* Inputs:
|
||||
* 1 : Unknown
|
||||
* 2 : Unknown
|
||||
* 1 : Channel (0 - 7 0:Debug from DSP 1:P-DMA 2:audio 3:binary 4-7: free ?)
|
||||
* 2 : Peer (0 = from DSP, 1 = from ARM)
|
||||
* 3 : Size in bytes of read (observed only lower half word used)
|
||||
* 0x41 : Virtual address to read from DSP pipe to in memory
|
||||
* Outputs:
|
||||
@ -204,23 +205,26 @@ static void WriteProcessPipe(Service::Interface* self) {
|
||||
static void ReadPipeIfPossible(Service::Interface* self) {
|
||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
||||
|
||||
u32 unk1 = cmd_buff[1];
|
||||
u32 unk2 = cmd_buff[2];
|
||||
u32 channel = cmd_buff[1];
|
||||
u32 peer = cmd_buff[2];
|
||||
u32 size = cmd_buff[3] & 0xFFFF;// Lower 16 bits are size
|
||||
VAddr addr = cmd_buff[0x41];
|
||||
|
||||
VAddr buffer = cmd_buff[0x41];
|
||||
|
||||
// Canned DSP responses that games expect. These were taken from HW by 3dmoo team.
|
||||
// TODO: Remove this hack :)
|
||||
// JamePeng:With the log colletion display, the variable "size" will be 0x20 sometime.
|
||||
// Maybe this canned_read_pipe array was imperfect
|
||||
static const std::array<u16, 16> canned_read_pipe = {{
|
||||
0x000F, 0xBFFF, 0x9E8E, 0x8680, 0xA78E, 0x9430, 0x8400, 0x8540,
|
||||
0x948E, 0x8710, 0x8410, 0xA90E, 0xAA0E, 0xAACE, 0xAC4E, 0xAC58
|
||||
}};
|
||||
|
||||
u32 initial_size = read_pipe_count;
|
||||
u16 initial_size = read_pipe_count;
|
||||
|
||||
for (unsigned offset = 0; offset < size; offset += sizeof(u16)) {
|
||||
for (u16 offset = 0; offset < size; offset += sizeof(u16)) {
|
||||
if (read_pipe_count < canned_read_pipe.size()) {
|
||||
Memory::Write16(addr + offset, canned_read_pipe[read_pipe_count]);
|
||||
Memory::Write16(buffer + offset, canned_read_pipe[read_pipe_count]);
|
||||
read_pipe_count++;
|
||||
} else {
|
||||
LOG_ERROR(Service_DSP, "canned read pipe log exceeded!");
|
||||
@ -231,8 +235,8 @@ static void ReadPipeIfPossible(Service::Interface* self) {
|
||||
cmd_buff[1] = 0; // No error
|
||||
cmd_buff[2] = (read_pipe_count - initial_size) * sizeof(u16);
|
||||
|
||||
LOG_WARNING(Service_DSP, "(STUBBED) called unk1=0x%08X, unk2=0x%08X, size=0x%X, buffer=0x%08X",
|
||||
unk1, unk2, size, addr);
|
||||
LOG_WARNING(Service_DSP, "(STUBBED) called channel=0x%08X, peer=0x%08X, size=0x%X, buffer=0x%08X",
|
||||
channel, peer, size, buffer);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,13 +84,22 @@ ResultCode ConversionConfiguration::SetStandardCoefficient(StandardCoefficient s
|
||||
|
||||
static void SetInputFormat(Service::Interface* self) {
|
||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
||||
|
||||
conversion.input_format = static_cast<InputFormat>(cmd_buff[1]);
|
||||
LOG_DEBUG(Service_Y2R, "called input_format=%hhu", conversion.input_format);
|
||||
|
||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||
}
|
||||
|
||||
static void GetInputFormat(Service::Interface* self) {
|
||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
||||
|
||||
InputFormat inf = conversion.input_format;
|
||||
LOG_DEBUG(Service_Y2R, "Get input_format=%hhu", inf);
|
||||
|
||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||
cmd_buff[2] = static_cast<u32>(inf);
|
||||
}
|
||||
|
||||
static void SetOutputFormat(Service::Interface* self) {
|
||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
||||
|
||||
@ -100,6 +109,16 @@ static void SetOutputFormat(Service::Interface* self) {
|
||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||
}
|
||||
|
||||
static void GetOutputFormat(Service::Interface* self) {
|
||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
||||
|
||||
OutputFormat opf = conversion.output_format;
|
||||
LOG_DEBUG(Service_Y2R, "Get output_format=%hhu", opf);
|
||||
|
||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||
cmd_buff[2] = static_cast<u32>(opf);
|
||||
}
|
||||
|
||||
static void SetRotation(Service::Interface* self) {
|
||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
||||
|
||||
@ -375,9 +394,9 @@ static void DriverFinalize(Service::Interface* self) {
|
||||
|
||||
const Interface::FunctionInfo FunctionTable[] = {
|
||||
{0x00010040, SetInputFormat, "SetInputFormat"},
|
||||
{0x00020000, nullptr, "GetInputFormat"},
|
||||
{0x00020000, GetInputFormat, "GetInputFormat"},
|
||||
{0x00030040, SetOutputFormat, "SetOutputFormat"},
|
||||
{0x00040000, nullptr, "GetOutputFormat"},
|
||||
{0x00040000, SetOutputFormat, "GetOutputFormat"},
|
||||
{0x00050040, SetRotation, "SetRotation"},
|
||||
{0x00060000, nullptr, "GetRotation"},
|
||||
{0x00070040, SetBlockAlignment, "SetBlockAlignment"},
|
||||
|
Loading…
Reference in New Issue
Block a user