mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-24 23:01: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.
|
// handle this properly once we implement multiprocess support.
|
||||||
cmd_buff[2] = 0; // Set to not registered by default
|
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;
|
cmd_buff[2] = HLE::Applets::IsLibraryAppletRunning() ? 1 : 0;
|
||||||
} else if (auto applet = HLE::Applets::Applet::Get(static_cast<AppletId>(app_id))) {
|
} else if (auto applet = HLE::Applets::Applet::Get(static_cast<AppletId>(app_id))) {
|
||||||
cmd_buff[2] = 1; // Set to registered
|
cmd_buff[2] = 1; // Set to registered
|
||||||
|
@ -46,14 +46,14 @@ enum class SignalType : u32 {
|
|||||||
enum class AppletId : u32 {
|
enum class AppletId : u32 {
|
||||||
HomeMenu = 0x101,
|
HomeMenu = 0x101,
|
||||||
AlternateMenu = 0x103,
|
AlternateMenu = 0x103,
|
||||||
CameraApplet = 0x110,
|
Camera = 0x110,
|
||||||
FriendsListApplet = 0x112,
|
FriendsList = 0x112,
|
||||||
GameNotesApplet = 0x113,
|
GameNotes = 0x113,
|
||||||
InternetBrowser = 0x114,
|
InternetBrowser = 0x114,
|
||||||
InstructionManual = 0x115,
|
InstructionManual = 0x115,
|
||||||
Notifications = 0x116,
|
Notifications = 0x116,
|
||||||
MiiverseApplet = 0x117,
|
Miiverse = 0x117,
|
||||||
MiiversePostingApplet = 0x118,
|
MiiversePosting = 0x118,
|
||||||
AmiiboSettings = 0x119,
|
AmiiboSettings = 0x119,
|
||||||
SoftwareKeyboard1 = 0x201,
|
SoftwareKeyboard1 = 0x201,
|
||||||
MiiSelectorEd1 = 0x202,
|
MiiSelectorEd1 = 0x202,
|
||||||
@ -65,7 +65,7 @@ enum class AppletId : u32 {
|
|||||||
Notepad1 = 0x209,
|
Notepad1 = 0x209,
|
||||||
Application = 0x300,
|
Application = 0x300,
|
||||||
EShopTiger = 0x301,
|
EShopTiger = 0x301,
|
||||||
AnyLibraryApplet = 0x400,
|
AnyLibrary = 0x400,
|
||||||
SoftwareKeyboard2 = 0x401,
|
SoftwareKeyboard2 = 0x401,
|
||||||
MiiSelectorEd2 = 0x402,
|
MiiSelectorEd2 = 0x402,
|
||||||
PhotoSelector2 = 0x404,
|
PhotoSelector2 = 0x404,
|
||||||
|
@ -50,10 +50,10 @@ static void ConvertProcessAddressFromDspDram(Service::Interface* self) {
|
|||||||
* DSP_DSP::LoadComponent service function
|
* DSP_DSP::LoadComponent service function
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* 1 : Size
|
* 1 : Size
|
||||||
* 2 : Unknown (observed only half word used)
|
* 2 : Program Mask (observed only half word used) (Program ram blocks the component should be loaded into)
|
||||||
* 3 : Unknown (observed only half word used)
|
* 3 : Data Mask (observed only half word used) (Data ram blocks the component should be loaded into)
|
||||||
* 4 : (size << 4) | 0xA
|
* 4 : (size << 4) | 0xA
|
||||||
* 5 : Buffer address
|
* 5 : Component Buffer address
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
* 2 : Component loaded, 0 on not loaded, 1 on loaded
|
* 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* cmd_buff = Kernel::GetCommandBuffer();
|
||||||
|
|
||||||
u32 size = cmd_buff[1];
|
u32 size = cmd_buff[1];
|
||||||
u32 unk1 = cmd_buff[2];
|
u32 pmask = cmd_buff[2];
|
||||||
u32 unk2 = cmd_buff[3];
|
u32 dmask = cmd_buff[3];
|
||||||
u32 new_size = cmd_buff[4];
|
u32 new_size = cmd_buff[4];
|
||||||
u32 buffer = cmd_buff[5];
|
u32 buffer = cmd_buff[5];
|
||||||
|
|
||||||
@ -72,8 +72,8 @@ static void LoadComponent(Service::Interface* self) {
|
|||||||
|
|
||||||
// TODO(bunnei): Implement real DSP firmware loading
|
// 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",
|
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, unk1, unk2, new_size, buffer);
|
size, pmask, dmask, new_size, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -121,17 +121,18 @@ static void FlushDataCache(Service::Interface* self) {
|
|||||||
/**
|
/**
|
||||||
* DSP_DSP::RegisterInterruptEvents service function
|
* DSP_DSP::RegisterInterruptEvents service function
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* 1 : Parameter 0 (purpose unknown)
|
* 1 : Interrupt
|
||||||
* 2 : Parameter 1 (purpose unknown)
|
* 2 : Channel
|
||||||
* 4 : Interrupt event handle
|
* 3 : 0x0
|
||||||
|
* 4 : Interrupt event handle (0 = unregister the event that was previous registered)
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
*/
|
*/
|
||||||
static void RegisterInterruptEvents(Service::Interface* self) {
|
static void RegisterInterruptEvents(Service::Interface* self) {
|
||||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
u32* cmd_buff = Kernel::GetCommandBuffer();
|
||||||
|
|
||||||
u32 param0 = cmd_buff[1];
|
u32 interrupt = cmd_buff[1];
|
||||||
u32 param1 = cmd_buff[2];
|
u32 channel = cmd_buff[2];
|
||||||
u32 event_handle = cmd_buff[4];
|
u32 event_handle = cmd_buff[4];
|
||||||
|
|
||||||
auto evt = Kernel::g_handle_table.Get<Kernel::Event>(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;
|
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
|
* DSP_DSP::SetSemaphore service function
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* 1 : Unknown (observed only half word used)
|
* 1 : Semaphore value (observed only half word used)
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 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
|
* DSP_DSP::ReadPipeIfPossible service function
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* 1 : Unknown
|
* 1 : Channel (0 - 7 0:Debug from DSP 1:P-DMA 2:audio 3:binary 4-7: free ?)
|
||||||
* 2 : Unknown
|
* 2 : Peer (0 = from DSP, 1 = from ARM)
|
||||||
* 3 : Size in bytes of read (observed only lower half word used)
|
* 3 : Size in bytes of read (observed only lower half word used)
|
||||||
* 0x41 : Virtual address to read from DSP pipe to in memory
|
* 0x41 : Virtual address to read from DSP pipe to in memory
|
||||||
* Outputs:
|
* Outputs:
|
||||||
@ -204,23 +205,26 @@ static void WriteProcessPipe(Service::Interface* self) {
|
|||||||
static void ReadPipeIfPossible(Service::Interface* self) {
|
static void ReadPipeIfPossible(Service::Interface* self) {
|
||||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
u32* cmd_buff = Kernel::GetCommandBuffer();
|
||||||
|
|
||||||
u32 unk1 = cmd_buff[1];
|
u32 channel = cmd_buff[1];
|
||||||
u32 unk2 = cmd_buff[2];
|
u32 peer = cmd_buff[2];
|
||||||
u32 size = cmd_buff[3] & 0xFFFF;// Lower 16 bits are size
|
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.
|
// Canned DSP responses that games expect. These were taken from HW by 3dmoo team.
|
||||||
// TODO: Remove this hack :)
|
// 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 = {{
|
static const std::array<u16, 16> canned_read_pipe = {{
|
||||||
0x000F, 0xBFFF, 0x9E8E, 0x8680, 0xA78E, 0x9430, 0x8400, 0x8540,
|
0x000F, 0xBFFF, 0x9E8E, 0x8680, 0xA78E, 0x9430, 0x8400, 0x8540,
|
||||||
0x948E, 0x8710, 0x8410, 0xA90E, 0xAA0E, 0xAACE, 0xAC4E, 0xAC58
|
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()) {
|
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++;
|
read_pipe_count++;
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR(Service_DSP, "canned read pipe log exceeded!");
|
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[1] = 0; // No error
|
||||||
cmd_buff[2] = (read_pipe_count - initial_size) * sizeof(u16);
|
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",
|
LOG_WARNING(Service_DSP, "(STUBBED) called channel=0x%08X, peer=0x%08X, size=0x%X, buffer=0x%08X",
|
||||||
unk1, unk2, size, addr);
|
channel, peer, size, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,13 +84,22 @@ ResultCode ConversionConfiguration::SetStandardCoefficient(StandardCoefficient s
|
|||||||
|
|
||||||
static void SetInputFormat(Service::Interface* self) {
|
static void SetInputFormat(Service::Interface* self) {
|
||||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
u32* cmd_buff = Kernel::GetCommandBuffer();
|
||||||
|
|
||||||
conversion.input_format = static_cast<InputFormat>(cmd_buff[1]);
|
conversion.input_format = static_cast<InputFormat>(cmd_buff[1]);
|
||||||
LOG_DEBUG(Service_Y2R, "called input_format=%hhu", conversion.input_format);
|
LOG_DEBUG(Service_Y2R, "called input_format=%hhu", conversion.input_format);
|
||||||
|
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
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) {
|
static void SetOutputFormat(Service::Interface* self) {
|
||||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
u32* cmd_buff = Kernel::GetCommandBuffer();
|
||||||
|
|
||||||
@ -100,6 +109,16 @@ static void SetOutputFormat(Service::Interface* self) {
|
|||||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
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) {
|
static void SetRotation(Service::Interface* self) {
|
||||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
u32* cmd_buff = Kernel::GetCommandBuffer();
|
||||||
|
|
||||||
@ -375,9 +394,9 @@ static void DriverFinalize(Service::Interface* self) {
|
|||||||
|
|
||||||
const Interface::FunctionInfo FunctionTable[] = {
|
const Interface::FunctionInfo FunctionTable[] = {
|
||||||
{0x00010040, SetInputFormat, "SetInputFormat"},
|
{0x00010040, SetInputFormat, "SetInputFormat"},
|
||||||
{0x00020000, nullptr, "GetInputFormat"},
|
{0x00020000, GetInputFormat, "GetInputFormat"},
|
||||||
{0x00030040, SetOutputFormat, "SetOutputFormat"},
|
{0x00030040, SetOutputFormat, "SetOutputFormat"},
|
||||||
{0x00040000, nullptr, "GetOutputFormat"},
|
{0x00040000, SetOutputFormat, "GetOutputFormat"},
|
||||||
{0x00050040, SetRotation, "SetRotation"},
|
{0x00050040, SetRotation, "SetRotation"},
|
||||||
{0x00060000, nullptr, "GetRotation"},
|
{0x00060000, nullptr, "GetRotation"},
|
||||||
{0x00070040, SetBlockAlignment, "SetBlockAlignment"},
|
{0x00070040, SetBlockAlignment, "SetBlockAlignment"},
|
||||||
|
Loading…
Reference in New Issue
Block a user