summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/function_wrappers.h8
-rw-r--r--src/core/hle/kernel/address_arbiter.cpp25
-rw-r--r--src/core/hle/kernel/memory.cpp2
-rw-r--r--src/core/hle/kernel/memory.h1
-rw-r--r--src/core/hle/kernel/process.cpp6
-rw-r--r--src/core/hle/kernel/thread.cpp5
-rw-r--r--src/core/hle/kernel/timer.cpp6
-rw-r--r--src/core/hle/service/act_u.cpp7
-rw-r--r--src/core/hle/service/am/am_net.cpp30
-rw-r--r--src/core/hle/service/am/am_sys.cpp15
-rw-r--r--src/core/hle/service/am/am_u.cpp28
-rw-r--r--src/core/hle/service/apt/apt_s.cpp6
-rw-r--r--src/core/hle/service/apt/apt_u.cpp6
-rw-r--r--src/core/hle/service/boss/boss_u.cpp3
-rw-r--r--src/core/hle/service/cam/cam.h156
-rw-r--r--src/core/hle/service/cam/cam_u.cpp5
-rw-r--r--src/core/hle/service/csnd_snd.cpp65
-rw-r--r--src/core/hle/service/csnd_snd.h13
-rw-r--r--src/core/hle/service/dsp_dsp.cpp14
-rw-r--r--src/core/hle/service/frd/frd_u.cpp43
-rw-r--r--src/core/hle/service/fs/archive.cpp7
-rw-r--r--src/core/hle/service/fs/archive.h7
-rw-r--r--src/core/hle/service/fs/fs_user.cpp223
-rw-r--r--src/core/hle/service/gsp_gpu.cpp8
-rw-r--r--src/core/hle/service/gsp_lcd.cpp10
-rw-r--r--src/core/hle/service/hid/hid_user.cpp2
-rw-r--r--src/core/hle/service/http_c.cpp10
-rw-r--r--src/core/hle/service/mic_u.cpp10
-rw-r--r--src/core/hle/service/ndm_u.cpp16
-rw-r--r--src/core/hle/service/news/news_s.cpp12
-rw-r--r--src/core/hle/service/nim/nim_s.cpp3
-rw-r--r--src/core/hle/service/ns_s.cpp9
-rw-r--r--src/core/hle/service/nwm_uds.cpp18
-rw-r--r--src/core/hle/service/pm_app.cpp4
-rw-r--r--src/core/hle/service/ptm/ptm.cpp12
-rw-r--r--src/core/hle/service/ptm/ptm.h8
-rw-r--r--src/core/hle/service/ptm/ptm_sysm.cpp3
-rw-r--r--src/core/hle/service/ptm/ptm_u.cpp2
-rw-r--r--src/core/hle/service/soc_u.cpp16
-rw-r--r--src/core/hle/service/ssl_c.cpp55
-rw-r--r--src/core/hle/service/y2r_u.cpp23
-rw-r--r--src/core/hle/svc.cpp47
-rw-r--r--src/core/hle/svc.h29
43 files changed, 839 insertions, 139 deletions
diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h
index 5846a161b..3501e45db 100644
--- a/src/core/hle/function_wrappers.h
+++ b/src/core/hle/function_wrappers.h
@@ -159,6 +159,14 @@ template<ResultCode func(s32*, u32, s32)> void Wrap() {
FuncReturn(retval);
}
+template<ResultCode func(s64*, u32, s32)> void Wrap() {
+ s64 param_1 = 0;
+ u32 retval = func(&param_1, PARAM(1), PARAM(2)).raw;
+ Core::g_app_core->SetReg(1, (u32)param_1);
+ Core::g_app_core->SetReg(2, (u32)(param_1 >> 32));
+ FuncReturn(retval);
+}
+
template<ResultCode func(u32*, u32, u32, u32, u32)> void Wrap() {
u32 param_1 = 0;
u32 retval = func(&param_1, PARAM(1), PARAM(2), PARAM(3), PARAM(4)).raw;
diff --git a/src/core/hle/kernel/address_arbiter.cpp b/src/core/hle/kernel/address_arbiter.cpp
index 195286422..5c3c47acf 100644
--- a/src/core/hle/kernel/address_arbiter.cpp
+++ b/src/core/hle/kernel/address_arbiter.cpp
@@ -45,30 +45,32 @@ ResultCode AddressArbiter::ArbitrateAddress(ArbitrationType type, VAddr address,
// Wait current thread (acquire the arbiter)...
case ArbitrationType::WaitIfLessThan:
- if ((s32)Memory::Read32(address) <= value) {
+ if ((s32)Memory::Read32(address) < value) {
Kernel::WaitCurrentThread_ArbitrateAddress(address);
}
break;
case ArbitrationType::WaitIfLessThanWithTimeout:
- if ((s32)Memory::Read32(address) <= value) {
+ if ((s32)Memory::Read32(address) < value) {
Kernel::WaitCurrentThread_ArbitrateAddress(address);
GetCurrentThread()->WakeAfterDelay(nanoseconds);
}
break;
case ArbitrationType::DecrementAndWaitIfLessThan:
{
- s32 memory_value = Memory::Read32(address) - 1;
- Memory::Write32(address, memory_value);
- if (memory_value <= value) {
+ s32 memory_value = Memory::Read32(address);
+ if (memory_value < value) {
+ // Only change the memory value if the thread should wait
+ Memory::Write32(address, (s32)memory_value - 1);
Kernel::WaitCurrentThread_ArbitrateAddress(address);
}
break;
}
case ArbitrationType::DecrementAndWaitIfLessThanWithTimeout:
{
- s32 memory_value = Memory::Read32(address) - 1;
- Memory::Write32(address, memory_value);
- if (memory_value <= value) {
+ s32 memory_value = Memory::Read32(address);
+ if (memory_value < value) {
+ // Only change the memory value if the thread should wait
+ Memory::Write32(address, (s32)memory_value - 1);
Kernel::WaitCurrentThread_ArbitrateAddress(address);
GetCurrentThread()->WakeAfterDelay(nanoseconds);
}
@@ -82,6 +84,13 @@ ResultCode AddressArbiter::ArbitrateAddress(ArbitrationType type, VAddr address,
HLE::Reschedule(__func__);
+ // The calls that use a timeout seem to always return a Timeout error even if they did not put the thread to sleep
+ if (type == ArbitrationType::WaitIfLessThanWithTimeout ||
+ type == ArbitrationType::DecrementAndWaitIfLessThanWithTimeout) {
+
+ return ResultCode(ErrorDescription::Timeout, ErrorModule::OS,
+ ErrorSummary::StatusChanged, ErrorLevel::Info);
+ }
return RESULT_SUCCESS;
}
diff --git a/src/core/hle/kernel/memory.cpp b/src/core/hle/kernel/memory.cpp
index e4fc5f3c4..0cfb43fc7 100644
--- a/src/core/hle/kernel/memory.cpp
+++ b/src/core/hle/kernel/memory.cpp
@@ -51,6 +51,7 @@ void MemoryInit(u32 mem_type) {
for (int i = 0; i < 3; ++i) {
memory_regions[i].base = base;
memory_regions[i].size = memory_region_sizes[mem_type][i];
+ memory_regions[i].used = 0;
memory_regions[i].linear_heap_memory = std::make_shared<std::vector<u8>>();
base += memory_regions[i].size;
@@ -72,6 +73,7 @@ void MemoryShutdown() {
for (auto& region : memory_regions) {
region.base = 0;
region.size = 0;
+ region.used = 0;
region.linear_heap_memory = nullptr;
}
}
diff --git a/src/core/hle/kernel/memory.h b/src/core/hle/kernel/memory.h
index 36690b091..091c1f89f 100644
--- a/src/core/hle/kernel/memory.h
+++ b/src/core/hle/kernel/memory.h
@@ -17,6 +17,7 @@ class VMManager;
struct MemoryRegionInfo {
u32 base; // Not an address, but offset from start of FCRAM
u32 size;
+ u32 used;
std::shared_ptr<std::vector<u8>> linear_heap_memory;
};
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp
index c2b4963d4..d148efde2 100644
--- a/src/core/hle/kernel/process.cpp
+++ b/src/core/hle/kernel/process.cpp
@@ -111,6 +111,7 @@ void Process::Run(s32 main_thread_priority, u32 stack_size) {
segment.offset, segment.size, memory_state).Unwrap();
vm_manager.Reprotect(vma, permissions);
misc_memory_used += segment.size;
+ memory_region->used += segment.size;
};
// Map CodeSet segments
@@ -123,6 +124,7 @@ void Process::Run(s32 main_thread_priority, u32 stack_size) {
std::make_shared<std::vector<u8>>(stack_size, 0), 0, stack_size, MemoryState::Locked
).Unwrap();
misc_memory_used += stack_size;
+ memory_region->used += stack_size;
vm_manager.LogLayout(Log::Level::Debug);
Kernel::SetupMainThread(codeset->entrypoint, main_thread_priority);
@@ -165,6 +167,7 @@ ResultVal<VAddr> Process::HeapAllocate(VAddr target, u32 size, VMAPermission per
vm_manager.Reprotect(vma, perms);
heap_used += size;
+ memory_region->used += size;
return MakeResult<VAddr>(heap_end - size);
}
@@ -182,6 +185,7 @@ ResultCode Process::HeapFree(VAddr target, u32 size) {
if (result.IsError()) return result;
heap_used -= size;
+ memory_region->used -= size;
return RESULT_SUCCESS;
}
@@ -217,6 +221,7 @@ ResultVal<VAddr> Process::LinearAllocate(VAddr target, u32 size, VMAPermission p
vm_manager.Reprotect(vma, perms);
linear_heap_used += size;
+ memory_region->used += size;
return MakeResult<VAddr>(target);
}
@@ -243,6 +248,7 @@ ResultCode Process::LinearFree(VAddr target, u32 size) {
if (result.IsError()) return result;
linear_heap_used -= size;
+ memory_region->used -= size;
if (target + size == heap_end) {
// End of linear heap has been freed, so check what's the last allocated block in it and
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index 00fa995f6..bf32f653d 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -20,6 +20,7 @@
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/process.h"
#include "core/hle/kernel/thread.h"
+#include "core/hle/kernel/memory.h"
#include "core/hle/kernel/mutex.h"
#include "core/hle/result.h"
#include "core/memory.h"
@@ -118,6 +119,7 @@ void Thread::Stop() {
Kernel::g_current_process->used_tls_slots[tls_index] = false;
g_current_process->misc_memory_used -= Memory::TLS_ENTRY_SIZE;
+ g_current_process->memory_region->used -= Memory::TLS_ENTRY_SIZE;
HLE::Reschedule(__func__);
}
@@ -298,7 +300,7 @@ static void ThreadWakeupCallback(u64 thread_handle, int cycles_late) {
thread->waitsynch_waited = false;
- if (thread->status == THREADSTATUS_WAIT_SYNCH) {
+ if (thread->status == THREADSTATUS_WAIT_SYNCH || thread->status == THREADSTATUS_WAIT_ARB) {
thread->SetWaitSynchronizationResult(ResultCode(ErrorDescription::Timeout, ErrorModule::OS,
ErrorSummary::StatusChanged, ErrorLevel::Info));
@@ -416,6 +418,7 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point,
ASSERT_MSG(thread->tls_index != -1, "Out of TLS space");
g_current_process->misc_memory_used += Memory::TLS_ENTRY_SIZE;
+ g_current_process->memory_region->used += Memory::TLS_ENTRY_SIZE;
// TODO(peachum): move to ScheduleThread() when scheduler is added so selected core is used
// to initialize the context
diff --git a/src/core/hle/kernel/timer.cpp b/src/core/hle/kernel/timer.cpp
index 08b3ea8c0..ce6bbd719 100644
--- a/src/core/hle/kernel/timer.cpp
+++ b/src/core/hle/kernel/timer.cpp
@@ -42,6 +42,9 @@ bool Timer::ShouldWait() {
void Timer::Acquire() {
ASSERT_MSG( !ShouldWait(), "object unavailable!");
+
+ if (reset_type == RESETTYPE_ONESHOT)
+ signaled = false;
}
void Timer::Set(s64 initial, s64 interval) {
@@ -84,9 +87,6 @@ static void TimerCallback(u64 timer_handle, int cycles_late) {
// Resume all waiting threads
timer->WakeupAllWaitingThreads();
- if (timer->reset_type == RESETTYPE_ONESHOT)
- timer->signaled = false;
-
if (timer->interval_delay != 0) {
// Reschedule the timer with the interval delay
u64 interval_microseconds = timer->interval_delay / 1000;
diff --git a/src/core/hle/service/act_u.cpp b/src/core/hle/service/act_u.cpp
index 57f49c91f..bbe8e1625 100644
--- a/src/core/hle/service/act_u.cpp
+++ b/src/core/hle/service/act_u.cpp
@@ -10,14 +10,15 @@
namespace ACT_U {
-// Empty arrays are illegal -- commented out until an entry is added.
-//const Interface::FunctionInfo FunctionTable[] = { };
+const Interface::FunctionInfo FunctionTable[] = {
+ {0x000600C2, nullptr, "GetAccountDataBlock"},
+};
////////////////////////////////////////////////////////////////////////////////////////////////////
// Interface class
Interface::Interface() {
- //Register(FunctionTable);
+ Register(FunctionTable);
}
} // namespace
diff --git a/src/core/hle/service/am/am_net.cpp b/src/core/hle/service/am/am_net.cpp
index aa391f3b2..7515a4e6e 100644
--- a/src/core/hle/service/am/am_net.cpp
+++ b/src/core/hle/service/am/am_net.cpp
@@ -10,6 +10,36 @@ namespace Service {
namespace AM {
const Interface::FunctionInfo FunctionTable[] = {
+ {0x00010040, TitleIDListGetTotal, "TitleIDListGetTotal"},
+ {0x00020082, GetTitleIDList, "GetTitleIDList"},
+ {0x00030084, nullptr, "ListTitles"},
+ {0x000400C0, nullptr, "DeleteApplicationTitle"},
+ {0x000500C0, nullptr, "GetTitleProductCode"},
+ {0x00080000, nullptr, "TitleIDListGetTotal3"},
+ {0x00090082, nullptr, "GetTitleIDList3"},
+ {0x000A0000, nullptr, "GetDeviceID"},
+ {0x000D0084, nullptr, "ListTitles2"},
+ {0x00140040, nullptr, "FinishInstallToMedia"},
+ {0x00180080, nullptr, "InitializeTitleDatabase"},
+ {0x00190040, nullptr, "ReloadDBS"},
+ {0x001A00C0, nullptr, "GetDSiWareExportSize"},
+ {0x001B0144, nullptr, "ExportDSiWare"},
+ {0x001C0084, nullptr, "ImportDSiWare"},
+ {0x00230080, nullptr, "TitleIDListGetTotal2"},
+ {0x002400C2, nullptr, "GetTitleIDList2"},
+ {0x04010080, nullptr, "InstallFIRM"},
+ {0x04020040, nullptr, "StartInstallCIADB0"},
+ {0x04030000, nullptr, "StartInstallCIADB1"},
+ {0x04040002, nullptr, "AbortCIAInstall"},
+ {0x04050002, nullptr, "CloseCIAFinalizeInstall"},
+ {0x04060002, nullptr, "CloseCIA"},
+ {0x040700C2, nullptr, "FinalizeTitlesInstall"},
+ {0x04080042, nullptr, "GetCiaFileInfo"},
+ {0x040E00C2, nullptr, "InstallTitlesFinish"},
+ {0x040F0000, nullptr, "InstallNATIVEFIRM"},
+ {0x041000C0, nullptr, "DeleteTitle"},
+ {0x04120000, nullptr, "Initialize"},
+ {0x041700C0, nullptr, "MigrateAGBtoSAV"},
{0x08010000, nullptr, "OpenTicket"},
{0x08020002, nullptr, "TicketAbortInstall"},
{0x08030002, nullptr, "TicketFinalizeInstall"},
diff --git a/src/core/hle/service/am/am_sys.cpp b/src/core/hle/service/am/am_sys.cpp
index 864fc14df..715b7b55d 100644
--- a/src/core/hle/service/am/am_sys.cpp
+++ b/src/core/hle/service/am/am_sys.cpp
@@ -12,6 +12,21 @@ namespace AM {
const Interface::FunctionInfo FunctionTable[] = {
{0x00010040, TitleIDListGetTotal, "TitleIDListGetTotal"},
{0x00020082, GetTitleIDList, "GetTitleIDList"},
+ {0x00030084, nullptr, "ListTitles"},
+ {0x000400C0, nullptr, "DeleteApplicationTitle"},
+ {0x000500C0, nullptr, "GetTitleProductCode"},
+ {0x00080000, nullptr, "TitleIDListGetTotal3"},
+ {0x00090082, nullptr, "GetTitleIDList3"},
+ {0x000A0000, nullptr, "GetDeviceID"},
+ {0x000D0084, nullptr, "ListTitles2"},
+ {0x00140040, nullptr, "FinishInstallToMedia"},
+ {0x00180080, nullptr, "InitializeTitleDatabase"},
+ {0x00190040, nullptr, "ReloadDBS"},
+ {0x001A00C0, nullptr, "GetDSiWareExportSize"},
+ {0x001B0144, nullptr, "ExportDSiWare"},
+ {0x001C0084, nullptr, "ImportDSiWare"},
+ {0x00230080, nullptr, "TitleIDListGetTotal2"},
+ {0x002400C2, nullptr, "GetTitleIDList2"}
};
AM_SYS_Interface::AM_SYS_Interface() {
diff --git a/src/core/hle/service/am/am_u.cpp b/src/core/hle/service/am/am_u.cpp
index 6bf84b36b..b1e1ea5e4 100644
--- a/src/core/hle/service/am/am_u.cpp
+++ b/src/core/hle/service/am/am_u.cpp
@@ -12,6 +12,34 @@ namespace AM {
const Interface::FunctionInfo FunctionTable[] = {
{0x00010040, TitleIDListGetTotal, "TitleIDListGetTotal"},
{0x00020082, GetTitleIDList, "GetTitleIDList"},
+ {0x00030084, nullptr, "ListTitles"},
+ {0x000400C0, nullptr, "DeleteApplicationTitle"},
+ {0x000500C0, nullptr, "GetTitleProductCode"},
+ {0x00080000, nullptr, "TitleIDListGetTotal3"},
+ {0x00090082, nullptr, "GetTitleIDList3"},
+ {0x000A0000, nullptr, "GetDeviceID"},
+ {0x000D0084, nullptr, "ListTitles2"},
+ {0x00140040, nullptr, "FinishInstallToMedia"},
+ {0x00180080, nullptr, "InitializeTitleDatabase"},
+ {0x00190040, nullptr, "ReloadDBS"},
+ {0x001A00C0, nullptr, "GetDSiWareExportSize"},
+ {0x001B0144, nullptr, "ExportDSiWare"},
+ {0x001C0084, nullptr, "ImportDSiWare"},
+ {0x00230080, nullptr, "TitleIDListGetTotal2"},
+ {0x002400C2, nullptr, "GetTitleIDList2"},
+ {0x04010080, nullptr, "InstallFIRM"},
+ {0x04020040, nullptr, "StartInstallCIADB0"},
+ {0x04030000, nullptr, "StartInstallCIADB1"},
+ {0x04040002, nullptr, "AbortCIAInstall"},
+ {0x04050002, nullptr, "CloseCIAFinalizeInstall"},
+ {0x04060002, nullptr, "CloseCIA"},
+ {0x040700C2, nullptr, "FinalizeTitlesInstall"},
+ {0x04080042, nullptr, "GetCiaFileInfo"},
+ {0x040E00C2, nullptr, "InstallTitlesFinish"},
+ {0x040F0000, nullptr, "InstallNATIVEFIRM"},
+ {0x041000C0, nullptr, "DeleteTitle"},
+ {0x04120000, nullptr, "Initialize"},
+ {0x041700C0, nullptr, "MigrateAGBtoSAV"}
};
AM_U_Interface::AM_U_Interface() {
diff --git a/src/core/hle/service/apt/apt_s.cpp b/src/core/hle/service/apt/apt_s.cpp
index 3ac6ff94f..e5fd9165c 100644
--- a/src/core/hle/service/apt/apt_s.cpp
+++ b/src/core/hle/service/apt/apt_s.cpp
@@ -91,6 +91,12 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x004E0000, nullptr, "HardwareResetAsync"},
{0x004F0080, nullptr, "SetApplicationCpuTimeLimit"},
{0x00500040, nullptr, "GetApplicationCpuTimeLimit"},
+ {0x00510080, nullptr, "GetStartupArgument"},
+ {0x00520104, nullptr, "Wrap1"},
+ {0x00530104, nullptr, "Unwrap1"},
+ {0x00580002, nullptr, "GetProgramID"},
+ {0x01010000, nullptr, "CheckNew3DSApp"},
+ {0x01020000, nullptr, "CheckNew3DS"}
};
APT_S_Interface::APT_S_Interface() {
diff --git a/src/core/hle/service/apt/apt_u.cpp b/src/core/hle/service/apt/apt_u.cpp
index 146bfd595..aba627f54 100644
--- a/src/core/hle/service/apt/apt_u.cpp
+++ b/src/core/hle/service/apt/apt_u.cpp
@@ -92,6 +92,12 @@ const Interface::FunctionInfo FunctionTable[] = {
{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"}
};
APT_U_Interface::APT_U_Interface() {
diff --git a/src/core/hle/service/boss/boss_u.cpp b/src/core/hle/service/boss/boss_u.cpp
index ed978b963..9f17711bb 100644
--- a/src/core/hle/service/boss/boss_u.cpp
+++ b/src/core/hle/service/boss/boss_u.cpp
@@ -11,6 +11,9 @@ namespace BOSS {
const Interface::FunctionInfo FunctionTable[] = {
{0x00020100, nullptr, "GetStorageInfo"},
+ {0x000C0082, nullptr, "UnregisterTask"},
+ {0x001E0042, nullptr, "CancelTask"},
+ {0x00330042, nullptr, "StartBgImmediate"},
};
BOSS_U_Interface::BOSS_U_Interface() {
diff --git a/src/core/hle/service/cam/cam.h b/src/core/hle/service/cam/cam.h
index edd524841..e9abdcb1f 100644
--- a/src/core/hle/service/cam/cam.h
+++ b/src/core/hle/service/cam/cam.h
@@ -10,6 +10,162 @@
namespace Service {
namespace CAM {
+enum class Port : u8 {
+ None = 0,
+ Cam1 = 1,
+ Cam2 = 2,
+ Both = Cam1 | Cam2
+};
+
+enum class CameraSelect : u8 {
+ None = 0,
+ Out1 = 1,
+ In1 = 2,
+ Out2 = 4,
+ In1Out1 = Out1 | In1,
+ Out1Out2 = Out1 | Out2,
+ In1Out2 = In1 | Out2,
+ All = Out1 | In1 | Out2
+};
+
+enum class Effect : u8 {
+ None = 0,
+ Mono = 1,
+ Sepia = 2,
+ Negative = 3,
+ Negafilm = 4,
+ Sepia01 = 5
+};
+
+enum class Context : u8 {
+ None = 0,
+ A = 1,
+ B = 2,
+ Both = A | B
+};
+
+enum class Flip : u8 {
+ None = 0,
+ Horizontal = 1,
+ Vertical = 2,
+ Reverse = 3
+};
+
+enum class Size : u8 {
+ VGA = 0,
+ QVGA = 1,
+ QQVGA = 2,
+ CIF = 3,
+ QCIF = 4,
+ DS_LCD = 5,
+ DS_LCDx4 = 6,
+ CTR_TOP_LCD = 7,
+ CTR_BOTTOM_LCD = QVGA
+};
+
+enum class FrameRate : u8 {
+ Rate_15 = 0,
+ Rate_15_To_5 = 1,
+ Rate_15_To_2 = 2,
+ Rate_10 = 3,
+ Rate_8_5 = 4,
+ Rate_5 = 5,
+ Rate_20 = 6,
+ Rate_20_To_5 = 7,
+ Rate_30 = 8,
+ Rate_30_To_5 = 9,
+ Rate_15_To_10 = 10,
+ Rate_20_To_10 = 11,
+ Rate_30_To_10 = 12
+};
+
+enum class ShutterSoundType : u8 {
+ Normal = 0,
+ Movie = 1,
+ MovieEnd = 2
+};
+
+enum class WhiteBalance : u8 {
+ BalanceAuto = 0,
+ Balance3200K = 1,
+ Balance4150K = 2,
+ Balance5200K = 3,
+ Balance6000K = 4,
+ Balance7000K = 5,
+ BalanceMax = 6,
+ BalanceNormal = BalanceAuto,
+ BalanceTungsten = Balance3200K,
+ BalanceWhiteFluorescentLight = Balance4150K,
+ BalanceDaylight = Balance5200K,
+ BalanceCloudy = Balance6000K,
+ BalanceHorizon = Balance6000K,
+ BalanceShade = Balance7000K
+};
+
+enum class PhotoMode : u8 {
+ Normal = 0,
+ Portrait = 1,
+ Landscape = 2,
+ Nightview = 3,
+ Letter0 = 4
+};
+
+enum class LensCorrection : u8 {
+ Off = 0,
+ On70 = 1,
+ On90 = 2,
+ Dark = Off,
+ Normal = On70,
+ Bright = On90
+};
+
+enum class Contrast : u8 {
+ Pattern01 = 1,
+ Pattern02 = 2,
+ Pattern03 = 3,
+ Pattern04 = 4,
+ Pattern05 = 5,
+ Pattern06 = 6,
+ Pattern07 = 7,
+ Pattern08 = 8,
+ Pattern09 = 9,
+ Pattern10 = 10,
+ Pattern11 = 11,
+ Low = Pattern05,
+ Normal = Pattern06,
+ High = Pattern07
+};
+
+enum class OutputFormat : u8 {
+ YUV422 = 0,
+ RGB565 = 1
+};
+
+struct PackageParameterCameraSelect {
+ CameraSelect camera;
+ s8 exposure;
+ WhiteBalance white_balance;
+ s8 sharpness;
+ bool auto_exposure;
+ bool auto_white_balance;
+ FrameRate frame_rate;
+ PhotoMode photo_mode;
+ Contrast contrast;
+ LensCorrection lens_correction;
+ bool noise_filter;
+ u8 padding;
+ s16 auto_exposure_window_x;
+ s16 auto_exposure_window_y;
+ s16 auto_exposure_window_width;
+ s16 auto_exposure_window_height;
+ s16 auto_white_balance_window_x;
+ s16 auto_white_balance_window_y;
+ s16 auto_white_balance_window_width;
+ s16 auto_white_balance_window_height;
+};
+
+static_assert(sizeof(PackageParameterCameraSelect) == 28, "PackageParameterCameraSelect structure size is wrong");
+
/// Initialize CAM service(s)
void Init();
diff --git a/src/core/hle/service/cam/cam_u.cpp b/src/core/hle/service/cam/cam_u.cpp
index 55083e0c7..1c292ea23 100644
--- a/src/core/hle/service/cam/cam_u.cpp
+++ b/src/core/hle/service/cam/cam_u.cpp
@@ -54,12 +54,17 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x002A0080, nullptr, "GetLatestVsyncTiming"},
{0x002B0000, nullptr, "GetStereoCameraCalibrationData"},
{0x002C0400, nullptr, "SetStereoCameraCalibrationData"},
+ {0x002D00C0, nullptr, "WriteRegisterI2c"},
+ {0x002E00C0, nullptr, "WriteMcuVariableI2c"},
+ {0x002F0080, nullptr, "ReadRegisterI2cExclusive"},
+ {0x00300080, nullptr, "ReadMcuVariableI2cExclusive"},
{0x00310180, nullptr, "SetImageQualityCalibrationData"},
{0x00320000, nullptr, "GetImageQualityCalibrationData"},
{0x003302C0, nullptr, "SetPackageParameterWithoutContext"},
{0x00340140, nullptr, "SetPackageParameterWithContext"},
{0x003501C0, nullptr, "SetPackageParameterWithContextDetail"},
{0x00360000, nullptr, "GetSuitableY2rStandardCoefficient"},
+ {0x00370202, nullptr, "PlayShutterSoundWithWave"},
{0x00380040, nullptr, "PlayShutterSound"},
{0x00390000, nullptr, "DriverInitialize"},
{0x003A0000, nullptr, "DriverFinalize"},
diff --git a/src/core/hle/service/csnd_snd.cpp b/src/core/hle/service/csnd_snd.cpp
index 6a1d961ac..6318bf2a7 100644
--- a/src/core/hle/service/csnd_snd.cpp
+++ b/src/core/hle/service/csnd_snd.cpp
@@ -2,7 +2,10 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include <cstring>
#include "core/hle/hle.h"
+#include "core/hle/kernel/mutex.h"
+#include "core/hle/kernel/shared_memory.h"
#include "core/hle/service/csnd_snd.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -11,17 +14,18 @@
namespace CSND_SND {
const Interface::FunctionInfo FunctionTable[] = {
- {0x00010140, nullptr, "Initialize"},
- {0x00020000, nullptr, "Shutdown"},
- {0x00030040, nullptr, "ExecuteType0Commands"},
+ {0x00010140, Initialize, "Initialize"},
+ {0x00020000, Shutdown, "Shutdown"},
+ {0x00030040, ExecuteType0Commands, "ExecuteType0Commands"},
{0x00040080, nullptr, "ExecuteType1Commands"},
- {0x00050000, nullptr, "AcquireSoundChannels"},
+ {0x00050000, AcquireSoundChannels, "AcquireSoundChannels"},
{0x00060000, nullptr, "ReleaseSoundChannels"},
{0x00070000, nullptr, "AcquireCaptureDevice"},
{0x00080040, nullptr, "ReleaseCaptureDevice"},
- {0x00090082, nullptr, "FlushDCache"},
- {0x000A0082, nullptr, "StoreDCache"},
- {0x000B0082, nullptr, "InvalidateDCache"},
+ {0x00090082, nullptr, "FlushDataCache"},
+ {0x000A0082, nullptr, "StoreDataCache"},
+ {0x000B0082, nullptr, "InvalidateDataCache"},
+ {0x000C0000, nullptr, "Reset"},
};
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -31,4 +35,51 @@ Interface::Interface() {
Register(FunctionTable);
}
+static Kernel::SharedPtr<Kernel::SharedMemory> shared_memory = nullptr;
+static Kernel::SharedPtr<Kernel::Mutex> mutex = nullptr;
+
+void Initialize(Service::Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ shared_memory = Kernel::SharedMemory::Create(cmd_buff[1],
+ Kernel::MemoryPermission::ReadWrite,
+ Kernel::MemoryPermission::ReadWrite, "CSNDSharedMem");
+
+ mutex = Kernel::Mutex::Create(false);
+
+ cmd_buff[1] = 0;
+ cmd_buff[2] = 0x4000000;
+ cmd_buff[3] = Kernel::g_handle_table.Create(mutex).MoveFrom();
+ cmd_buff[4] = Kernel::g_handle_table.Create(shared_memory).MoveFrom();
+}
+
+void ExecuteType0Commands(Service::Interface* self) {
+ u32* const cmd_buff = Kernel::GetCommandBuffer();
+ u8* const ptr = shared_memory->GetPointer(cmd_buff[1]);
+
+ if (shared_memory != nullptr && ptr != nullptr) {
+ Type0Command command;
+ std::memcpy(&command, ptr, sizeof(Type0Command));
+
+ LOG_WARNING(Service, "(STUBBED) CSND_SND::ExecuteType0Commands");
+ command.finished |= 1;
+ cmd_buff[1] = 0;
+
+ std::memcpy(ptr, &command, sizeof(Type0Command));
+ } else {
+ cmd_buff[1] = 1;
+ }
+}
+
+void AcquireSoundChannels(Service::Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+ cmd_buff[1] = 0;
+ cmd_buff[2] = 0xFFFFFF00;
+}
+
+void Shutdown(Service::Interface* self) {
+ shared_memory = nullptr;
+ mutex = nullptr;
+}
+
} // namespace
diff --git a/src/core/hle/service/csnd_snd.h b/src/core/hle/service/csnd_snd.h
index a84752473..e861f3327 100644
--- a/src/core/hle/service/csnd_snd.h
+++ b/src/core/hle/service/csnd_snd.h
@@ -20,4 +20,17 @@ public:
}
};
+struct Type0Command {
+ // command id and next command offset
+ u32 command_id;
+ u32 finished;
+ u32 flags;
+ u8 parameters[20];
+};
+
+void Initialize(Service::Interface* self);
+void ExecuteType0Commands(Service::Interface* self);
+void AcquireSoundChannels(Service::Interface* self);
+void Shutdown(Service::Interface* self);
+
} // namespace
diff --git a/src/core/hle/service/dsp_dsp.cpp b/src/core/hle/service/dsp_dsp.cpp
index ce5619069..d6b8d1318 100644
--- a/src/core/hle/service/dsp_dsp.cpp
+++ b/src/core/hle/service/dsp_dsp.cpp
@@ -150,13 +150,13 @@ static void RegisterInterruptEvents(Service::Interface* self) {
}
/**
- * DSP_DSP::WriteReg0x10 service function
+ * DSP_DSP::SetSemaphore service function
* Inputs:
* 1 : Unknown (observed only half word used)
* Outputs:
* 1 : Result of function, 0 on success, otherwise error code
*/
-static void WriteReg0x10(Service::Interface* self) {
+static void SetSemaphore(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
SignalInterrupt();
@@ -276,12 +276,17 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x00020040, nullptr, "RecvDataIsReady"},
{0x00030080, nullptr, "SendData"},
{0x00040040, nullptr, "SendDataIsEmpty"},
- {0x00070040, WriteReg0x10, "WriteReg0x10"},
+ {0x000500C2, nullptr, "SendFifoEx"},
+ {0x000600C0, nullptr, "RecvFifoEx"},
+ {0x00070040, SetSemaphore, "SetSemaphore"},
{0x00080000, nullptr, "GetSemaphore"},
{0x00090040, nullptr, "ClearSemaphore"},
+ {0x000A0040, nullptr, "MaskSemaphore"},
{0x000B0000, nullptr, "CheckSemaphoreRequest"},
{0x000C0040, ConvertProcessAddressFromDspDram, "ConvertProcessAddressFromDspDram"},
{0x000D0082, WriteProcessPipe, "WriteProcessPipe"},
+ {0x000E00C0, nullptr, "ReadPipe"},
+ {0x000F0080, nullptr, "GetPipeReadableSize"},
{0x001000C0, ReadPipeIfPossible, "ReadPipeIfPossible"},
{0x001100C2, LoadComponent, "LoadComponent"},
{0x00120000, nullptr, "UnloadComponent"},
@@ -295,7 +300,10 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x001A0042, nullptr, "SetIirFilterI2S1_cmd1"},
{0x001B0042, nullptr, "SetIirFilterI2S1_cmd2"},
{0x001C0082, nullptr, "SetIirFilterEQ"},
+ {0x001D00C0, nullptr, "ReadMultiEx_SPI2"},
+ {0x001E00C2, nullptr, "WriteMultiEx_SPI2"},
{0x001F0000, GetHeadphoneStatus, "GetHeadphoneStatus"},
+ {0x00200040, nullptr, "ForceHeadphoneOut"},
{0x00210000, nullptr, "GetIsDspOccupied"},
};
diff --git a/src/core/hle/service/frd/frd_u.cpp b/src/core/hle/service/frd/frd_u.cpp
index 3a5897d06..9e70ec901 100644
--- a/src/core/hle/service/frd/frd_u.cpp
+++ b/src/core/hle/service/frd/frd_u.cpp
@@ -11,25 +11,58 @@ namespace FRD {
const Interface::FunctionInfo FunctionTable[] = {
{0x00010000, nullptr, "HasLoggedIn"},
+ {0x00020000, nullptr, "IsOnline"},
{0x00030000, nullptr, "Login"},
{0x00040000, nullptr, "Logout"},
- {0x00050000, nullptr, "GetFriendKey"},
+ {0x00050000, nullptr, "GetMyFriendKey"},
+ {0x00060000, nullptr, "GetMyPreference"},
+ {0x00070000, nullptr, "GetMyProfile"},
{0x00080000, nullptr, "GetMyPresence"},
{0x00090000, nullptr, "GetMyScreenName"},
- {0x00100040, nullptr, "GetPassword"},
+ {0x000A0000, nullptr, "GetMyMii"},
+ {0x000B0000, nullptr, "GetMyLocalAccountId"},
+ {0x000C0000, nullptr, "GetMyPlayingGame"},
+ {0x000D0000, nullptr, "GetMyFavoriteGame"},
+ {0x000E0000, nullptr, "GetMyNcPrincipalId"},
+ {0x000F0000, nullptr, "GetMyComment"},
+ {0x00100040, nullptr, "GetMyPassword"},
{0x00110080, nullptr, "GetFriendKeyList"},
+ {0x00120042, nullptr, "GetFriendPresence"},
+ {0x00130142, nullptr, "GetFriendScreenName"},
+ {0x00140044, nullptr, "GetFriendMii"},
+ {0x00150042, nullptr, "GetFriendProfile"},
+ {0x00160042, nullptr, "GetFriendRelationship"},
+ {0x00170042, nullptr, "GetFriendAttributeFlags"},
+ {0x00180044, nullptr, "GetFriendPlayingGame"},
{0x00190042, nullptr, "GetFriendFavoriteGame"},
{0x001A00C4, nullptr, "GetFriendInfo"},
- {0x001B0080, nullptr, "IsOnFriendList"},
- {0x001C0042, nullptr, "DecodeLocalFriendCode"},
- {0x001D0002, nullptr, "SetCurrentlyPlayingText"},
+ {0x001B0080, nullptr, "IsIncludedInFriendList"},
+ {0x001C0042, nullptr, "UnscrambleLocalFriendCode"},
+ {0x001D0002, nullptr, "UpdateGameModeDescription"},
+ {0x001E02C2, nullptr, "UpdateGameMode"},
+ {0x001F0042, nullptr, "SendInvitation"},
+ {0x00200002, nullptr, "AttachToEventNotification"},
+ {0x00210040, nullptr, "SetNotificationMask"},
+ {0x00220040, nullptr, "GetEventNotification"},
{0x00230000, nullptr, "GetLastResponseResult"},
+ {0x00240040, nullptr, "PrincipalIdToFriendCode"},
+ {0x00250080, nullptr, "FriendCodeToPrincipalId"},
+ {0x00260080, nullptr, "IsValidFriendCode"},
{0x00270040, nullptr, "ResultToErrorCode"},
{0x00280244, nullptr, "RequestGameAuthentication"},
{0x00290000, nullptr, "GetGameAuthenticationData"},
{0x002A0204, nullptr, "RequestServiceLocator"},
{0x002B0000, nullptr, "GetServiceLocatorData"},
+ {0x002C0002, nullptr, "DetectNatProperties"},
+ {0x002D0000, nullptr, "GetNatProperties"},
+ {0x002E0000, nullptr, "GetServerTimeInterval"},
+ {0x002F0040, nullptr, "AllowHalfAwake"},
+ {0x00300000, nullptr, "GetServerTypes"},
+ {0x00310082, nullptr, "GetFriendComment"},
{0x00320042, nullptr, "SetClientSdkVersion"},
+ {0x00330000, nullptr, "GetMyApproachContext"},
+ {0x00340046, nullptr, "AddFriendWithApproach"},
+ {0x00350082, nullptr, "DecryptApproachContext"},
};
FRD_U_Interface::FRD_U_Interface() {
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp
index 6c0df67c3..d64b3656a 100644
--- a/src/core/hle/service/fs/archive.cpp
+++ b/src/core/hle/service/fs/archive.cpp
@@ -403,6 +403,13 @@ ResultVal<Kernel::SharedPtr<Directory>> OpenDirectoryFromArchive(ArchiveHandle a
return MakeResult<Kernel::SharedPtr<Directory>>(std::move(directory));
}
+ResultVal<u64> GetFreeBytesInArchive(ArchiveHandle archive_handle) {
+ ArchiveBackend* archive = GetArchive(archive_handle);
+ if (archive == nullptr)
+ return ERR_INVALID_HANDLE;
+ return MakeResult<u64>(archive->GetFreeBytes());
+}
+
ResultCode FormatArchive(ArchiveIdCode id_code, const FileSys::Path& path) {
auto archive_itr = id_code_map.find(id_code);
if (archive_itr == id_code_map.end()) {
diff --git a/src/core/hle/service/fs/archive.h b/src/core/hle/service/fs/archive.h
index 6f7048710..952deb4d4 100644
--- a/src/core/hle/service/fs/archive.h
+++ b/src/core/hle/service/fs/archive.h
@@ -167,6 +167,13 @@ ResultVal<Kernel::SharedPtr<Directory>> OpenDirectoryFromArchive(ArchiveHandle a
const FileSys::Path& path);
/**
+ * Get the free space in an Archive
+ * @param archive_handle Handle to an open Archive object
+ * @return The number of free bytes in the archive
+ */
+ResultVal<u64> GetFreeBytesInArchive(ArchiveHandle archive_handle);
+
+/**
* Erases the contents of the physical folder that contains the archive
* identified by the specified id code and path
* @param id_code The id of the archive to format
diff --git a/src/core/hle/service/fs/fs_user.cpp b/src/core/hle/service/fs/fs_user.cpp
index ae52083f9..632620a56 100644
--- a/src/core/hle/service/fs/fs_user.cpp
+++ b/src/core/hle/service/fs/fs_user.cpp
@@ -497,6 +497,33 @@ static void FormatThisUserSaveData(Service::Interface* self) {
}
/**
+ * FS_User::GetFreeBytes service function
+ * Inputs:
+ * 0: 0x08120080
+ * 1: Archive handle low word
+ * 2: Archive handle high word
+ * Outputs:
+ * 1: Result of function, 0 on success, otherwise error code
+ * 2: Free byte count low word
+ * 3: Free byte count high word
+ */
+static void GetFreeBytes(Service::Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ ArchiveHandle archive_handle = MakeArchiveHandle(cmd_buff[1], cmd_buff[2]);
+ ResultVal<u64> bytes_res = GetFreeBytesInArchive(archive_handle);
+
+ cmd_buff[1] = bytes_res.Code().raw;
+ if (bytes_res.Succeeded()) {
+ cmd_buff[2] = (u32)*bytes_res;
+ cmd_buff[3] = *bytes_res >> 32;
+ } else {
+ cmd_buff[2] = 0;
+ cmd_buff[3] = 0;
+ }
+}
+
+/**
* FS_User::CreateExtSaveData service function
* Inputs:
* 0 : 0x08510242
@@ -681,96 +708,114 @@ static void GetPriority(Service::Interface* self) {
}
const Interface::FunctionInfo FunctionTable[] = {
- {0x000100C6, nullptr, "Dummy1"},
- {0x040100C4, nullptr, "Control"},
- {0x08010002, Initialize, "Initialize"},
- {0x080201C2, OpenFile, "OpenFile"},
- {0x08030204, OpenFileDirectly, "OpenFileDirectly"},
- {0x08040142, DeleteFile, "DeleteFile"},
- {0x08050244, RenameFile, "RenameFile"},
- {0x08060142, DeleteDirectory, "DeleteDirectory"},
- {0x08070142, nullptr, "DeleteDirectoryRecursively"},
- {0x08080202, CreateFile, "CreateFile"},
- {0x08090182, CreateDirectory, "CreateDirectory"},
- {0x080A0244, RenameDirectory, "RenameDirectory"},
- {0x080B0102, OpenDirectory, "OpenDirectory"},
- {0x080C00C2, OpenArchive, "OpenArchive"},
- {0x080D0144, nullptr, "ControlArchive"},
- {0x080E0080, CloseArchive, "CloseArchive"},
- {0x080F0180, FormatThisUserSaveData,"FormatThisUserSaveData"},
- {0x08100200, nullptr, "CreateSystemSaveData"},
- {0x08110040, nullptr, "DeleteSystemSaveData"},
- {0x08120080, nullptr, "GetFreeBytes"},
- {0x08130000, nullptr, "GetCardType"},
- {0x08140000, nullptr, "GetSdmcArchiveResource"},
- {0x08150000, nullptr, "GetNandArchiveResource"},
- {0x08160000, nullptr, "GetSdmcFatfsErro"},
- {0x08170000, IsSdmcDetected, "IsSdmcDetected"},
- {0x08180000, IsSdmcWriteable, "IsSdmcWritable"},
- {0x08190042, nullptr, "GetSdmcCid"},
- {0x081A0042, nullptr, "GetNandCid"},
- {0x081B0000, nullptr, "GetSdmcSpeedInfo"},
- {0x081C0000, nullptr, "GetNandSpeedInfo"},
- {0x081D0042, nullptr, "GetSdmcLog"},
- {0x081E0042, nullptr, "GetNandLog"},
- {0x081F0000, nullptr, "ClearSdmcLog"},
- {0x08200000, nullptr, "ClearNandLog"},
- {0x08210000, CardSlotIsInserted, "CardSlotIsInserted"},
- {0x08220000, nullptr, "CardSlotPowerOn"},
- {0x08230000, nullptr, "CardSlotPowerOff"},
- {0x08240000, nullptr, "CardSlotGetCardIFPowerStatus"},
- {0x08250040, nullptr, "CardNorDirectCommand"},
- {0x08260080, nullptr, "CardNorDirectCommandWithAddress"},
- {0x08270082, nullptr, "CardNorDirectRead"},
- {0x082800C2, nullptr, "CardNorDirectReadWithAddress"},
- {0x08290082, nullptr, "CardNorDirectWrite"},
- {0x082A00C2, nullptr, "CardNorDirectWriteWithAddress"},
- {0x082B00C2, nullptr, "CardNorDirectRead_4xIO"},
- {0x082C0082, nullptr, "CardNorDirectCpuWriteWithoutVerify"},
- {0x082D0040, nullptr, "CardNorDirectSectorEraseWithoutVerify"},
- {0x082E0040, nullptr, "GetProductInfo"},
- {0x082F0040, nullptr, "GetProgramLaunchInfo"},
- {0x08300182, nullptr, "CreateExtSaveData"},
- {0x08310180, nullptr, "CreateSharedExtSaveData"},
- {0x08320102, nullptr, "ReadExtSaveDataIcon"},
- {0x08330082, nullptr, "EnumerateExtSaveData"},
- {0x08340082, nullptr, "EnumerateSharedExtSaveData"},
- {0x08350080, nullptr, "DeleteExtSaveData"},
- {0x08360080, nullptr, "DeleteSharedExtSaveData"},
- {0x08370040, nullptr, "SetCardSpiBaudRate"},
- {0x08380040, nullptr, "SetCardSpiBusMode"},
- {0x08390000, nullptr, "SendInitializeInfoTo9"},
- {0x083A0100, nullptr, "GetSpecialContentIndex"},
- {0x083B00C2, nullptr, "GetLegacyRomHeader"},
- {0x083C00C2, nullptr, "GetLegacyBannerData"},
- {0x083D0100, nullptr, "CheckAuthorityToAccessExtSaveData"},
- {0x083E00C2, nullptr, "QueryTotalQuotaSize"},
- {0x083F00C0, nullptr, "GetExtDataBlockSize"},
- {0x08400040, nullptr, "AbnegateAccessRight"},
- {0x08410000, nullptr, "DeleteSdmcRoot"},
- {0x08420040, nullptr, "DeleteAllExtSaveDataOnNand"},
- {0x08430000, nullptr, "InitializeCtrFileSystem"},
- {0x08440000, nullptr, "CreateSeed"},
- {0x084500C2, nullptr, "GetFormatInfo"},
- {0x08460102, nullptr, "GetLegacyRomHeader2"},
- {0x08470180, nullptr, "FormatCtrCardUserSaveData"},
- {0x08480042, nullptr, "GetSdmcCtrRootPath"},
- {0x08490040, nullptr, "GetArchiveResource"},
- {0x084A0002, nullptr, "ExportIntegrityVerificationSeed"},
- {0x084B0002, nullptr, "ImportIntegrityVerificationSeed"},
- {0x084C0242, FormatSaveData, "FormatSaveData"},
- {0x084D0102, nullptr, "GetLegacySubBannerData"},
- {0x084E0342, nullptr, "UpdateSha256Context"},
- {0x084F0102, nullptr, "ReadSpecialFile"},
- {0x08500040, nullptr, "GetSpecialFileSize"},
- {0x08510242, CreateExtSaveData, "CreateExtSaveData"},
- {0x08520100, DeleteExtSaveData, "DeleteExtSaveData"},
- {0x08560240, CreateSystemSaveData, "CreateSystemSaveData"},
- {0x08570080, DeleteSystemSaveData, "DeleteSystemSaveData"},
- {0x08580000, nullptr, "GetMovableSedHashedKeyYRandomData"},
+ {0x000100C6, nullptr, "Dummy1"},
+ {0x040100C4, nullptr, "Control"},
+ {0x08010002, Initialize, "Initialize"},
+ {0x080201C2, OpenFile, "OpenFile"},
+ {0x08030204, OpenFileDirectly, "OpenFileDirectly"},
+ {0x08040142, DeleteFile, "DeleteFile"},
+ {0x08050244, RenameFile, "RenameFile"},
+ {0x08060142, DeleteDirectory, "DeleteDirectory"},
+ {0x08070142, nullptr, "DeleteDirectoryRecursively"},
+ {0x08080202, CreateFile, "CreateFile"},
+ {0x08090182, CreateDirectory, "CreateDirectory"},
+ {0x080A0244, RenameDirectory, "RenameDirectory"},
+ {0x080B0102, OpenDirectory, "OpenDirectory"},
+ {0x080C00C2, OpenArchive, "OpenArchive"},
+ {0x080D0144, nullptr, "ControlArchive"},
+ {0x080E0080, CloseArchive, "CloseArchive"},
+ {0x080F0180, FormatThisUserSaveData, "FormatThisUserSaveData"},
+ {0x08100200, nullptr, "CreateSystemSaveData"},
+ {0x08110040, nullptr, "DeleteSystemSaveData"},
+ {0x08120080, GetFreeBytes, "GetFreeBytes"},
+ {0x08130000, nullptr, "GetCardType"},
+ {0x08140000, nullptr, "GetSdmcArchiveResource"},
+ {0x08150000, nullptr, "GetNandArchiveResource"},
+ {0x08160000, nullptr, "GetSdmcFatfsError"},
+ {0x08170000, IsSdmcDetected, "IsSdmcDetected"},
+ {0x08180000, IsSdmcWriteable, "IsSdmcWritable"},
+ {0x08190042, nullptr, "GetSdmcCid"},
+ {0x081A0042, nullptr, "GetNandCid"},
+ {0x081B0000, nullptr, "GetSdmcSpeedInfo"},
+ {0x081C0000, nullptr, "GetNandSpeedInfo"},
+ {0x081D0042, nullptr, "GetSdmcLog"},
+ {0x081E0042, nullptr, "GetNandLog"},
+ {0x081F0000, nullptr, "ClearSdmcLog"},
+ {0x08200000, nullptr, "ClearNandLog"},
+ {0x08210000, CardSlotIsInserted, "CardSlotIsInserted"},
+ {0x08220000, nullptr, "CardSlotPowerOn"},
+ {0x08230000, nullptr, "CardSlotPowerOff"},
+ {0x08240000, nullptr, "CardSlotGetCardIFPowerStatus"},
+ {0x08250040, nullptr, "CardNorDirectCommand"},
+ {0x08260080, nullptr, "CardNorDirectCommandWithAddress"},
+ {0x08270082, nullptr, "CardNorDirectRead"},
+ {0x082800C2, nullptr, "CardNorDirectReadWithAddress"},
+ {0x08290082, nullptr, "CardNorDirectWrite"},
+ {0x082A00C2, nullptr, "CardNorDirectWriteWithAddress"},
+ {0x082B00C2, nullptr, "CardNorDirectRead_4xIO"},
+ {0x082C0082, nullptr, "CardNorDirectCpuWriteWithoutVerify"},
+ {0x082D0040, nullptr, "CardNorDirectSectorEraseWithoutVerify"},
+ {0x082E0040, nullptr, "GetProductInfo"},
+ {0x082F0040, nullptr, "GetProgramLaunchInfo"},
+ {0x08300182, nullptr, "CreateExtSaveData"},
+ {0x08310180, nullptr, "CreateSharedExtSaveData"},
+ {0x08320102, nullptr, "ReadExtSaveDataIcon"},
+ {0x08330082, nullptr, "EnumerateExtSaveData"},
+ {0x08340082, nullptr, "EnumerateSharedExtSaveData"},
+ {0x08350080, nullptr, "DeleteExtSaveData"},
+ {0x08360080, nullptr, "DeleteSharedExtSaveData"},
+ {0x08370040, nullptr, "SetCardSpiBaudRate"},
+ {0x08380040, nullptr, "SetCardSpiBusMode"},
+ {0x08390000, nullptr, "SendInitializeInfoTo9"},
+ {0x083A0100, nullptr, "GetSpecialContentIndex"},
+ {0x083B00C2, nullptr, "GetLegacyRomHeader"},
+ {0x083C00C2, nullptr, "GetLegacyBannerData"},
+ {0x083D0100, nullptr, "CheckAuthorityToAccessExtSaveData"},
+ {0x083E00C2, nullptr, "QueryTotalQuotaSize"},
+ {0x083F00C0, nullptr, "GetExtDataBlockSize"},
+ {0x08400040, nullptr, "AbnegateAccessRight"},
+ {0x08410000, nullptr, "DeleteSdmcRoot"},
+ {0x08420040, nullptr, "DeleteAllExtSaveDataOnNand"},
+ {0x08430000, nullptr, "InitializeCtrFileSystem"},
+ {0x08440000, nullptr, "CreateSeed"},
+ {0x084500C2, nullptr, "GetFormatInfo"},
+ {0x08460102, nullptr, "GetLegacyRomHeader2"},
+ {0x08470180, nullptr, "FormatCtrCardUserSaveData"},
+ {0x08480042, nullptr, "GetSdmcCtrRootPath"},
+ {0x08490040, nullptr, "GetArchiveResource"},
+ {0x084A0002, nullptr, "ExportIntegrityVerificationSeed"},
+ {0x084B0002, nullptr, "ImportIntegrityVerificationSeed"},
+ {0x084C0242, FormatSaveData, "FormatSaveData"},
+ {0x084D0102, nullptr, "GetLegacySubBannerData"},
+ {0x084E0342, nullptr, "UpdateSha256Context"},
+ {0x084F0102, nullptr, "ReadSpecialFile"},
+ {0x08500040, nullptr, "GetSpecialFileSize"},
+ {0x08510242, CreateExtSaveData, "CreateExtSaveData"},
+ {0x08520100, DeleteExtSaveData, "DeleteExtSaveData"},
+ {0x08530142, nullptr, "ReadExtSaveDataIcon"},
+ {0x085400C0, nullptr, "GetExtDataBlockSize"},
+ {0x08550102, nullptr, "EnumerateExtSaveData"},
+ {0x08560240, CreateSystemSaveData, "CreateSystemSaveData"},
+ {0x08570080, DeleteSystemSaveData, "DeleteSystemSaveData"},
+ {0x08580000, nullptr, "StartDeviceMoveAsSource"},
+ {0x08590200, nullptr, "StartDeviceMoveAsDestination"},
+ {0x085A00C0, nullptr, "SetArchivePriority"},
+ {0x085B0080, nullptr, "GetArchivePriority"},
+ {0x085C00C0, nullptr, "SetCtrCardLatencyParameter"},
+ {0x085D01C0, nullptr, "SetFsCompatibilityInfo"},
+ {0x085E0040, nullptr, "ResetCardCompatibilityParameter"},
+ {0x085F0040, nullptr, "SwitchCleanupInvalidSaveData"},
+ {0x08600042, nullptr, "EnumerateSystemSaveData"},
{0x08610042, InitializeWithSdkVersion, "InitializeWithSdkVersion"},
- {0x08620040, SetPriority, "SetPriority"},
- {0x08630000, GetPriority, "GetPriority"},
+ {0x08620040, SetPriority, "SetPriority"},
+ {0x08630000, GetPriority, "GetPriority"},
+ {0x08640000, nullptr, "GetNandInfo"},
+ {0x08650140, nullptr, "SetSaveDataSecureValue"},
+ {0x086600C0, nullptr, "GetSaveDataSecureValue"},
+ {0x086700C4, nullptr, "ControlSecureSave"},
+ {0x08680000, nullptr, "GetMediaType"},
+ {0x08690000, nullptr, "GetNandEraseCount"},
+ {0x086A0082, nullptr, "ReadNandReport"}
};
////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp
index 481da0c9f..98b11c798 100644
--- a/src/core/hle/service/gsp_gpu.cpp
+++ b/src/core/hle/service/gsp_gpu.cpp
@@ -275,7 +275,7 @@ static void FlushDataCache(Service::Interface* self) {
u32 size = cmd_buff[2];
u32 process = cmd_buff[4];
- VideoCore::g_renderer->hw_rasterizer->NotifyFlush(Memory::VirtualToPhysicalAddress(address), size);
+ VideoCore::g_renderer->rasterizer->InvalidateRegion(Memory::VirtualToPhysicalAddress(address), size);
// TODO(purpasmart96): Verify return header on HW
@@ -365,7 +365,7 @@ static void ExecuteCommand(const Command& command, u32 thread_id) {
// GX request DMA - typically used for copying memory from GSP heap to VRAM
case CommandId::REQUEST_DMA:
- VideoCore::g_renderer->hw_rasterizer->NotifyPreRead(Memory::VirtualToPhysicalAddress(command.dma_request.source_address),
+ VideoCore::g_renderer->rasterizer->FlushRegion(Memory::VirtualToPhysicalAddress(command.dma_request.source_address),
command.dma_request.size);
memcpy(Memory::GetPointer(command.dma_request.dest_address),
@@ -373,7 +373,7 @@ static void ExecuteCommand(const Command& command, u32 thread_id) {
command.dma_request.size);
SignalInterrupt(InterruptId::DMA);
- VideoCore::g_renderer->hw_rasterizer->NotifyFlush(Memory::VirtualToPhysicalAddress(command.dma_request.dest_address),
+ VideoCore::g_renderer->rasterizer->InvalidateRegion(Memory::VirtualToPhysicalAddress(command.dma_request.dest_address),
command.dma_request.size);
break;
@@ -467,7 +467,7 @@ static void ExecuteCommand(const Command& command, u32 thread_id) {
if (region.size == 0)
break;
- VideoCore::g_renderer->hw_rasterizer->NotifyFlush(
+ VideoCore::g_renderer->rasterizer->InvalidateRegion(
Memory::VirtualToPhysicalAddress(region.address), region.size);
}
break;
diff --git a/src/core/hle/service/gsp_lcd.cpp b/src/core/hle/service/gsp_lcd.cpp
index 9e36732b4..59ee9b73c 100644
--- a/src/core/hle/service/gsp_lcd.cpp
+++ b/src/core/hle/service/gsp_lcd.cpp
@@ -11,14 +11,18 @@
namespace GSP_LCD {
-/*const Interface::FunctionInfo FunctionTable[] = {
-};*/
+const Interface::FunctionInfo FunctionTable[] = {
+ {0x000F0000, nullptr, "PowerOnAllBacklights"},
+ {0x00100000, nullptr, "PowerOffAllBacklights"},
+ {0x00110040, nullptr, "PowerOnBacklight"},
+ {0x00120040, nullptr, "PowerOffBacklight"},
+};
////////////////////////////////////////////////////////////////////////////////////////////////////
// Interface class
Interface::Interface() {
- //Register(FunctionTable);
+ Register(FunctionTable);
}
} // namespace
diff --git a/src/core/hle/service/hid/hid_user.cpp b/src/core/hle/service/hid/hid_user.cpp
index fbfb9e885..e103881b1 100644
--- a/src/core/hle/service/hid/hid_user.cpp
+++ b/src/core/hle/service/hid/hid_user.cpp
@@ -11,6 +11,8 @@ namespace HID {
const Interface::FunctionInfo FunctionTable[] = {
{0x000A0000, GetIPCHandles, "GetIPCHandles"},
+ {0x000B0000, nullptr, "StartAnalogStickCalibration"},
+ {0x000E0000, nullptr, "GetAnalogStickCalibrateParam"},
{0x00110000, EnableAccelerometer, "EnableAccelerometer"},
{0x00120000, DisableAccelerometer, "DisableAccelerometer"},
{0x00130000, EnableGyroscopeLow, "EnableGyroscopeLow"},
diff --git a/src/core/hle/service/http_c.cpp b/src/core/hle/service/http_c.cpp
index 0a3aba0a0..43d8a3b85 100644
--- a/src/core/hle/service/http_c.cpp
+++ b/src/core/hle/service/http_c.cpp
@@ -47,10 +47,18 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x00220040, nullptr, "GetResponseStatusCode"},
{0x002300C0, nullptr, "GetResponseStatusCodeTimeout"},
{0x00240082, nullptr, "AddTrustedRootCA"},
+ {0x00250080, nullptr, "AddDefaultCert"},
+ {0x00260080, nullptr, "SelectRootCertChain"},
+ {0x002700C4, nullptr, "SetClientCert"},
+ {0x002D0000, nullptr, "CreateRootCertChain"},
+ {0x002E0040, nullptr, "DestroyRootCertChain"},
+ {0x002F0082, nullptr, "RootCertChainAddCert"},
+ {0x00300080, nullptr, "RootCertChainAddDefaultCert"},
{0x00350186, nullptr, "SetDefaultProxy"},
{0x00360000, nullptr, "ClearDNSCache"},
{0x00370080, nullptr, "SetKeepAlive"},
- {0x003800C0, nullptr, "Finalize"},
+ {0x003800C0, nullptr, "SetPostDataTypeSize"},
+ {0x00390000, nullptr, "Finalize"},
};
////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/hle/service/mic_u.cpp b/src/core/hle/service/mic_u.cpp
index 25e70d321..1f27e9c1f 100644
--- a/src/core/hle/service/mic_u.cpp
+++ b/src/core/hle/service/mic_u.cpp
@@ -18,14 +18,14 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x00050000, nullptr, "StopSampling"},
{0x00060000, nullptr, "IsSampling"},
{0x00070000, nullptr, "GetEventHandle"},
- {0x00080040, nullptr, "SetControl"},
- {0x00090000, nullptr, "GetControl"},
- {0x000A0040, nullptr, "SetBias"},
- {0x000B0000, nullptr, "GetBias"},
+ {0x00080040, nullptr, "SetGain"},
+ {0x00090000, nullptr, "GetGain"},
+ {0x000A0040, nullptr, "SetPower"},
+ {0x000B0000, nullptr, "GetPower"},
{0x000C0042, nullptr, "size"},
{0x000D0040, nullptr, "SetClamp"},
{0x000E0000, nullptr, "GetClamp"},
- {0x000F0040, nullptr, "unknown_input1"},
+ {0x000F0040, nullptr, "SetAllowShellClosed"},
{0x00100040, nullptr, "unknown_input2"},
};
diff --git a/src/core/hle/service/ndm_u.cpp b/src/core/hle/service/ndm_u.cpp
index df3c97193..ad247fd1f 100644
--- a/src/core/hle/service/ndm_u.cpp
+++ b/src/core/hle/service/ndm_u.cpp
@@ -14,10 +14,26 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x00010042, nullptr, "EnterExclusiveState"},
{0x00020002, nullptr, "LeaveExclusiveState"},
{0x00030000, nullptr, "QueryExclusiveMode"},
+ {0x00040002, nullptr, "LockState"},
+ {0x00050002, nullptr, "UnlockState"},
{0x00060040, nullptr, "SuspendDaemons"},
+ {0x00070040, nullptr, "ResumeDaemons"},
{0x00080040, nullptr, "DisableWifiUsage"},
{0x00090000, nullptr, "EnableWifiUsage"},
+ {0x000A0000, nullptr, "GetCurrentState"},
+ {0x000B0000, nullptr, "GetTargetState"},
+ {0x000C0000, nullptr, "<Stubbed>"},
+ {0x000D0040, nullptr, "QueryStatus"},
+ {0x000E0040, nullptr, "GetDaemonDisableCount"},
+ {0x000F0000, nullptr, "GetSchedulerDisableCount"},
+ {0x00100040, nullptr, "SetScanInterval"},
+ {0x00110000, nullptr, "GetScanInterval"},
+ {0x00120040, nullptr, "SetRetryInterval"},
+ {0x00130000, nullptr, "GetRetryInterval"},
{0x00140040, nullptr, "OverrideDefaultDaemons"},
+ {0x00150000, nullptr, "ResetDefaultDaemons"},
+ {0x00160000, nullptr, "GetDefaultDaemons"},
+ {0x00170000, nullptr, "ClearHalfAwakeMacFilter"},
};
////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/hle/service/news/news_s.cpp b/src/core/hle/service/news/news_s.cpp
index 2f8c37d9e..5b8db3288 100644
--- a/src/core/hle/service/news/news_s.cpp
+++ b/src/core/hle/service/news/news_s.cpp
@@ -11,6 +11,18 @@ namespace NEWS {
const Interface::FunctionInfo FunctionTable[] = {
{0x000100C6, nullptr, "AddNotification"},
+ {0x00050000, nullptr, "GetTotalNotifications"},
+ {0x00060042, nullptr, "SetNewsDBHeader"},
+ {0x00070082, nullptr, "SetNotificationHeader"},
+ {0x00080082, nullptr, "SetNotificationMessage"},
+ {0x00090082, nullptr, "SetNotificationImage"},
+ {0x000A0042, nullptr, "GetNewsDBHeader"},
+ {0x000B0082, nullptr, "GetNotificationHeader"},
+ {0x000C0082, nullptr, "GetNotificationMessage"},
+ {0x000D0082, nullptr, "GetNotificationImage"},
+ {0x000E0040, nullptr, "SetInfoLEDPattern"},
+ {0x00120082, nullptr, "GetNotificationHeaderOther"},
+ {0x00130000, nullptr, "WriteNewsDBSavedata"},
};
NEWS_S_Interface::NEWS_S_Interface() {
diff --git a/src/core/hle/service/nim/nim_s.cpp b/src/core/hle/service/nim/nim_s.cpp
index 5d8bc059f..1172770ac 100644
--- a/src/core/hle/service/nim/nim_s.cpp
+++ b/src/core/hle/service/nim/nim_s.cpp
@@ -11,6 +11,9 @@ namespace NIM {
const Interface::FunctionInfo FunctionTable[] = {
{0x000A0000, nullptr, "CheckSysupdateAvailableSOAP"},
+ {0x0016020A, nullptr, "ListTitles"},
+ {0x002D0042, nullptr, "DownloadTickets"},
+ {0x00420240, nullptr, "StartDownload"},
};
NIM_S_Interface::NIM_S_Interface() {
diff --git a/src/core/hle/service/ns_s.cpp b/src/core/hle/service/ns_s.cpp
index 6b3ef6ece..99e8e0880 100644
--- a/src/core/hle/service/ns_s.cpp
+++ b/src/core/hle/service/ns_s.cpp
@@ -12,7 +12,16 @@
namespace NS_S {
const Interface::FunctionInfo FunctionTable[] = {
+ {0x000100C0, nullptr, "LaunchFIRM"},
{0x000200C0, nullptr, "LaunchTitle"},
+ {0x000500C0, nullptr, "LaunchApplicationFIRM"},
+ {0x00060042, nullptr, "SetFIRMParams4A0"},
+ {0x00070042, nullptr, "CardUpdateInitialize"},
+ {0x000D0140, nullptr, "SetFIRMParams4B0"},
+ {0x000E0000, nullptr, "ShutdownAsync"},
+ {0x00100180, nullptr, "RebootSystem"},
+ {0x00150140, nullptr, "LaunchApplication"},
+ {0x00160000, nullptr, "HardRebootSystem"},
};
////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/hle/service/nwm_uds.cpp b/src/core/hle/service/nwm_uds.cpp
index 18b22956f..adca64a3a 100644
--- a/src/core/hle/service/nwm_uds.cpp
+++ b/src/core/hle/service/nwm_uds.cpp
@@ -106,14 +106,32 @@ static void Initialize(Service::Interface* self) {
}
const Interface::FunctionInfo FunctionTable[] = {
+ {0x00020000, nullptr, "Scrap"},
{0x00030000, Shutdown, "Shutdown"},
+ {0x00040402, nullptr, "CreateNetwork"},
+ {0x00050040, nullptr, "EjectClient"},
+ {0x00060000, nullptr, "EjectSpectator"},
+ {0x00070080, nullptr, "UpdateNetworkAttribute"},
+ {0x00080000, nullptr, "DestroyNetwork"},
+ {0x000A0000, nullptr, "DisconnectNetwork"},
+ {0x000B0000, nullptr, "GetConnectionStatus"},
+ {0x000D0040, nullptr, "GetNodeInformation"},
{0x000F0404, RecvBeaconBroadcastData, "RecvBeaconBroadcastData"},
{0x00100042, nullptr, "SetBeaconAdditionalData"},
+ {0x00110040, nullptr, "GetApplicationData"},
+ {0x00120100, nullptr, "Bind"},
+ {0x00130040, nullptr, "Unbind"},
{0x001400C0, nullptr, "RecvBroadcastDataFrame"},
+ {0x00150080, nullptr, "SetMaxSendDelay"},
+ {0x00170182, nullptr, "SendTo"},
+ {0x001A0000, nullptr, "GetChannel"},
{0x001B0302, Initialize, "Initialize"},
{0x001D0044, nullptr, "BeginHostingNetwork"},
{0x001E0084, nullptr, "ConnectToNetwork"},
{0x001F0006, nullptr, "DecryptBeaconData"},
+ {0x00200040, nullptr, "Flush"},
+ {0x00210080, nullptr, "SetProbeResponseParam"},
+ {0x00220402, nullptr, "ScanOnConnection"},
};
////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/hle/service/pm_app.cpp b/src/core/hle/service/pm_app.cpp
index 7420a62f4..48646ed72 100644
--- a/src/core/hle/service/pm_app.cpp
+++ b/src/core/hle/service/pm_app.cpp
@@ -19,6 +19,10 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x00070042, nullptr, "GetFIRMLaunchParams"},
{0x00080100, nullptr, "GetTitleExheaderFlags"},
{0x00090042, nullptr, "SetFIRMLaunchParams"},
+ {0x000A0140, nullptr, "SetResourceLimit"},
+ {0x000B0140, nullptr, "GetResourceLimitMax"},
+ {0x000C0080, nullptr, "UnregisterProcess"},
+ {0x000D0240, nullptr, "LaunchTitleUpdate"},
};
////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/hle/service/ptm/ptm.cpp b/src/core/hle/service/ptm/ptm.cpp
index 2c7d49c9f..22c1093ff 100644
--- a/src/core/hle/service/ptm/ptm.cpp
+++ b/src/core/hle/service/ptm/ptm.cpp
@@ -68,6 +68,18 @@ void GetBatteryChargeState(Service::Interface* self) {
LOG_WARNING(Service_PTM, "(STUBBED) called");
}
+void GetTotalStepCount(Service::Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ // TODO: This function is only a stub,
+ // it returns 0 as the total step count
+
+ cmd_buff[1] = RESULT_SUCCESS.raw;
+ cmd_buff[2] = 0;
+
+ LOG_WARNING(Service_PTM, "(STUBBED) called");
+}
+
void IsLegacyPowerOff(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
diff --git a/src/core/hle/service/ptm/ptm.h b/src/core/hle/service/ptm/ptm.h
index b690003cb..f2e76441f 100644
--- a/src/core/hle/service/ptm/ptm.h
+++ b/src/core/hle/service/ptm/ptm.h
@@ -72,6 +72,14 @@ void GetBatteryLevel(Interface* self);
void GetBatteryChargeState(Interface* self);
/**
+ * PTM::GetTotalStepCount service function
+ * Outputs:
+ * 1 : Result of function, 0 on success, otherwise error code
+ * 2 : Output of function, * = total step count
+ */
+void GetTotalStepCount(Interface* self);
+
+/**
* PTM::IsLegacyPowerOff service function
* Outputs:
* 1: Result code, 0 on success, otherwise error code
diff --git a/src/core/hle/service/ptm/ptm_sysm.cpp b/src/core/hle/service/ptm/ptm_sysm.cpp
index 655658f3b..3ecfab05c 100644
--- a/src/core/hle/service/ptm/ptm_sysm.cpp
+++ b/src/core/hle/service/ptm/ptm_sysm.cpp
@@ -39,7 +39,8 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x08110000, nullptr, "GetShellStatus"},
{0x08120000, nullptr, "IsShutdownByBatteryEmpty"},
{0x08130000, nullptr, "FormatSavedata"},
- {0x08140000, nullptr, "GetLegacyJumpProhibitedFlag"}
+ {0x08140000, nullptr, "GetLegacyJumpProhibitedFlag"},
+ {0x08180040, nullptr, "ConfigureNew3DSCPU"},
};
PTM_Sysm_Interface::PTM_Sysm_Interface() {
diff --git a/src/core/hle/service/ptm/ptm_u.cpp b/src/core/hle/service/ptm/ptm_u.cpp
index 3f5e9c7c1..09dc38c3e 100644
--- a/src/core/hle/service/ptm/ptm_u.cpp
+++ b/src/core/hle/service/ptm/ptm_u.cpp
@@ -23,7 +23,7 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x00090000, nullptr, "GetPedometerState"},
{0x000A0042, nullptr, "GetStepHistoryEntry"},
{0x000B00C2, nullptr, "GetStepHistory"},
- {0x000C0000, nullptr, "GetTotalStepCount"},
+ {0x000C0000, GetTotalStepCount, "GetTotalStepCount"},
{0x000D0040, nullptr, "SetPedometerRecordingMode"},
{0x000E0000, nullptr, "GetPedometerRecordingMode"},
{0x000F0084, nullptr, "GetStepHistoryAll"},
diff --git a/src/core/hle/service/soc_u.cpp b/src/core/hle/service/soc_u.cpp
index 633b66fe2..822b093f4 100644
--- a/src/core/hle/service/soc_u.cpp
+++ b/src/core/hle/service/soc_u.cpp
@@ -552,13 +552,23 @@ static void RecvFrom(Service::Interface* self) {
u32 flags = cmd_buffer[3];
socklen_t addr_len = static_cast<socklen_t>(cmd_buffer[4]);
- u8* output_buff = Memory::GetPointer(cmd_buffer[0x104 >> 2]);
+ struct
+ {
+ u32 output_buffer_descriptor;
+ u32 output_buffer_addr;
+ u32 address_buffer_descriptor;
+ u32 output_src_address_buffer;
+ } buffer_parameters;
+
+ std::memcpy(&buffer_parameters, &cmd_buffer[64], sizeof(buffer_parameters));
+
+ u8* output_buff = Memory::GetPointer(buffer_parameters.output_buffer_addr);
sockaddr src_addr;
socklen_t src_addr_len = sizeof(src_addr);
int ret = ::recvfrom(socket_handle, (char*)output_buff, len, flags, &src_addr, &src_addr_len);
- if (cmd_buffer[0x1A0 >> 2] != 0) {
- CTRSockAddr* ctr_src_addr = reinterpret_cast<CTRSockAddr*>(Memory::GetPointer(cmd_buffer[0x1A0 >> 2]));
+ if (buffer_parameters.output_src_address_buffer != 0) {
+ CTRSockAddr* ctr_src_addr = reinterpret_cast<CTRSockAddr*>(Memory::GetPointer(buffer_parameters.output_src_address_buffer));
*ctr_src_addr = CTRSockAddr::FromPlatform(src_addr);
}
diff --git a/src/core/hle/service/ssl_c.cpp b/src/core/hle/service/ssl_c.cpp
index e634276fc..9ecb72c77 100644
--- a/src/core/hle/service/ssl_c.cpp
+++ b/src/core/hle/service/ssl_c.cpp
@@ -2,6 +2,8 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include <random>
+
#include "core/hle/hle.h"
#include "core/hle/service/ssl_c.h"
@@ -10,11 +12,64 @@
namespace SSL_C {
+// TODO: Implement a proper CSPRNG in the future when actual security is needed
+static std::mt19937 rand_gen;
+
+static void Initialize(Service::Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ // Seed random number generator when the SSL service is initialized
+ std::random_device rand_device;
+ rand_gen.seed(rand_device());
+
+ // Stub, return success
+ cmd_buff[1] = RESULT_SUCCESS.raw;
+}
+
+static void GenerateRandomData(Service::Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ u32 size = cmd_buff[1];
+ VAddr address = cmd_buff[3];
+ u8* output_buff = Memory::GetPointer(address);
+
+ // Fill the output buffer with random data.
+ u32 data = 0;
+ u32 i = 0;
+ while (i < size) {
+ if ((i % 4) == 0) {
+ // The random number generator returns 4 bytes worth of data, so generate new random data when i == 0 and when i is divisible by 4
+ data = rand_gen();
+ }
+
+ if (size > 4) {
+ // Use up the entire 4 bytes of the random data for as long as possible
+ *(u32*)(output_buff + i) = data;
+ i += 4;
+ } else if (size == 2) {
+ *(u16*)(output_buff + i) = (u16)(data & 0xffff);
+ i += 2;
+ } else {
+ *(u8*)(output_buff + i) = (u8)(data & 0xff);
+ i++;
+ }
+ }
+
+ // Stub, return success
+ cmd_buff[1] = RESULT_SUCCESS.raw;
+}
+
const Interface::FunctionInfo FunctionTable[] = {
+ {0x00010002, Initialize, "Initialize"},
{0x000200C2, nullptr, "CreateContext"},
+ {0x00030000, nullptr, "CreateRootCertChain"},
+ {0x00040040, nullptr, "DestroyRootCertChain"},
{0x00050082, nullptr, "AddTrustedRootCA"},
+ {0x00060080, nullptr, "RootCertChainAddDefaultCert"},
+ {0x00110042, GenerateRandomData, "GenerateRandomData"},
{0x00150082, nullptr, "Read"},
{0x00170082, nullptr, "Write"},
+ {0x00180080, nullptr, "ContextSetRootCertChain"},
};
////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/hle/service/y2r_u.cpp b/src/core/hle/service/y2r_u.cpp
index 6b1b71fe4..69d0bf4a3 100644
--- a/src/core/hle/service/y2r_u.cpp
+++ b/src/core/hle/service/y2r_u.cpp
@@ -267,7 +267,7 @@ static void StartConversion(Service::Interface* self) {
// dst_image_size would seem to be perfect for this, but it doesn't include the gap :(
u32 total_output_size = conversion.input_lines *
(conversion.dst.transfer_unit + conversion.dst.gap);
- VideoCore::g_renderer->hw_rasterizer->NotifyFlush(
+ VideoCore::g_renderer->rasterizer->InvalidateRegion(
Memory::VirtualToPhysicalAddress(conversion.dst.address), total_output_size);
LOG_DEBUG(Service_Y2R, "called");
@@ -375,21 +375,41 @@ static void DriverFinalize(Service::Interface* self) {
const Interface::FunctionInfo FunctionTable[] = {
{0x00010040, SetInputFormat, "SetInputFormat"},
+ {0x00020000, nullptr, "GetInputFormat"},
{0x00030040, SetOutputFormat, "SetOutputFormat"},
+ {0x00040000, nullptr, "GetOutputFormat"},
{0x00050040, SetRotation, "SetRotation"},
+ {0x00060000, nullptr, "GetRotation"},
{0x00070040, SetBlockAlignment, "SetBlockAlignment"},
+ {0x00080000, nullptr, "GetBlockAlignment"},
+ {0x00090040, nullptr, "SetSpacialDithering"},
+ {0x000A0000, nullptr, "GetSpacialDithering"},
+ {0x000B0040, nullptr, "SetTemporalDithering"},
+ {0x000C0000, nullptr, "GetTemporalDithering"},
{0x000D0040, SetTransferEndInterrupt, "SetTransferEndInterrupt"},
{0x000F0000, GetTransferEndEvent, "GetTransferEndEvent"},
{0x00100102, SetSendingY, "SetSendingY"},
{0x00110102, SetSendingU, "SetSendingU"},
{0x00120102, SetSendingV, "SetSendingV"},
{0x00130102, SetSendingYUYV, "SetSendingYUYV"},
+ {0x00140000, nullptr, "IsFinishedSendingYuv"},
+ {0x00150000, nullptr, "IsFinishedSendingY"},
+ {0x00160000, nullptr, "IsFinishedSendingU"},
+ {0x00170000, nullptr, "IsFinishedSendingV"},
{0x00180102, SetReceiving, "SetReceiving"},
+ {0x00190000, nullptr, "IsFinishedReceiving"},
{0x001A0040, SetInputLineWidth, "SetInputLineWidth"},
+ {0x001B0000, nullptr, "GetInputLineWidth"},
{0x001C0040, SetInputLines, "SetInputLines"},
+ {0x001D0000, nullptr, "GetInputLines"},
{0x001E0100, SetCoefficient, "SetCoefficient"},
+ {0x001F0000, nullptr, "GetCoefficient"},
{0x00200040, SetStandardCoefficient, "SetStandardCoefficient"},
+ {0x00210040, nullptr, "GetStandardCoefficientParams"},
{0x00220040, SetAlpha, "SetAlpha"},
+ {0x00230000, nullptr, "GetAlpha"},
+ {0x00240200, nullptr, "SetDitheringWeightParams"},
+ {0x00250000, nullptr, "GetDitheringWeightParams"},
{0x00260000, StartConversion, "StartConversion"},
{0x00270000, StopConversion, "StopConversion"},
{0x00280000, IsBusyConversion, "IsBusyConversion"},
@@ -397,6 +417,7 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x002A0000, PingProcess, "PingProcess"},
{0x002B0000, DriverInitialize, "DriverInitialize"},
{0x002C0000, DriverFinalize, "DriverFinalize"},
+ {0x002D0000, nullptr, "GetPackageParameter"},
};
////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index 45d5f3c5d..e39edcc16 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -778,6 +778,51 @@ static ResultCode CreateMemoryBlock(Handle* out_handle, u32 addr, u32 size, u32
return RESULT_SUCCESS;
}
+static ResultCode GetSystemInfo(s64* out, u32 type, s32 param) {
+ using Kernel::MemoryRegion;
+
+ LOG_TRACE(Kernel_SVC, "called type=%u param=%d", type, param);
+
+ switch ((SystemInfoType)type) {
+ case SystemInfoType::REGION_MEMORY_USAGE:
+ switch ((SystemInfoMemUsageRegion)param) {
+ case SystemInfoMemUsageRegion::ALL:
+ *out = Kernel::GetMemoryRegion(Kernel::MemoryRegion::APPLICATION)->used
+ + Kernel::GetMemoryRegion(Kernel::MemoryRegion::SYSTEM)->used
+ + Kernel::GetMemoryRegion(Kernel::MemoryRegion::BASE)->used;
+ break;
+ case SystemInfoMemUsageRegion::APPLICATION:
+ *out = Kernel::GetMemoryRegion(Kernel::MemoryRegion::APPLICATION)->used;
+ break;
+ case SystemInfoMemUsageRegion::SYSTEM:
+ *out = Kernel::GetMemoryRegion(Kernel::MemoryRegion::SYSTEM)->used;
+ break;
+ case SystemInfoMemUsageRegion::BASE:
+ *out = Kernel::GetMemoryRegion(Kernel::MemoryRegion::BASE)->used;
+ break;
+ default:
+ LOG_ERROR(Kernel_SVC, "unknown GetSystemInfo type=0 region: param=%d", param);
+ *out = 0;
+ break;
+ }
+ break;
+ case SystemInfoType::KERNEL_ALLOCATED_PAGES:
+ LOG_ERROR(Kernel_SVC, "unimplemented GetSystemInfo type=2 param=%d", param);
+ *out = 0;
+ break;
+ case SystemInfoType::KERNEL_SPAWNED_PIDS:
+ *out = 5;
+ break;
+ default:
+ LOG_ERROR(Kernel_SVC, "unknown GetSystemInfo type=%u param=%d", type, param);
+ *out = 0;
+ break;
+ }
+
+ // This function never returns an error, even if invalid parameters were passed.
+ return RESULT_SUCCESS;
+}
+
static ResultCode GetProcessInfo(s64* out, Handle process_handle, u32 type) {
LOG_TRACE(Kernel_SVC, "called process=0x%08X type=%u", process_handle, type);
@@ -877,7 +922,7 @@ static const FunctionDef SVC_Table[] = {
{0x27, HLE::Wrap<DuplicateHandle>, "DuplicateHandle"},
{0x28, HLE::Wrap<GetSystemTick>, "GetSystemTick"},
{0x29, nullptr, "GetHandleInfo"},
- {0x2A, nullptr, "GetSystemInfo"},
+ {0x2A, HLE::Wrap<GetSystemInfo>, "GetSystemInfo"},
{0x2B, HLE::Wrap<GetProcessInfo>, "GetProcessInfo"},
{0x2C, nullptr, "GetThreadInfo"},
{0x2D, HLE::Wrap<ConnectToPort>, "ConnectToPort"},
diff --git a/src/core/hle/svc.h b/src/core/hle/svc.h
index 12de9ffbe..4b9c71e06 100644
--- a/src/core/hle/svc.h
+++ b/src/core/hle/svc.h
@@ -41,6 +41,35 @@ enum ArbitrationType {
namespace SVC {
+/// Values accepted by svcGetSystemInfo's type parameter.
+enum class SystemInfoType {
+ /**
+ * Reports total used memory for all regions or a specific one, according to the extra
+ * parameter. See `SystemInfoMemUsageRegion`.
+ */
+ REGION_MEMORY_USAGE = 0,
+ /**
+ * Returns the memory usage for certain allocations done internally by the kernel.
+ */
+ KERNEL_ALLOCATED_PAGES = 2,
+ /**
+ * "This returns the total number of processes which were launched directly by the kernel.
+ * For the ARM11 NATIVE_FIRM kernel, this is 5, for processes sm, fs, pm, loader, and pxi."
+ */
+ KERNEL_SPAWNED_PIDS = 26,
+};
+
+/**
+ * Accepted by svcGetSystemInfo param with REGION_MEMORY_USAGE type. Selects a region to query
+ * memory usage of.
+ */
+enum class SystemInfoMemUsageRegion {
+ ALL = 0,
+ APPLICATION = 1,
+ SYSTEM = 2,
+ BASE = 3,
+};
+
void CallSVC(u32 immediate);
} // namespace