aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/service
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/service')
-rw-r--r--src/core/hle/service/apt_u.cpp4
-rw-r--r--src/core/hle/service/cfg/cfg.cpp4
-rw-r--r--src/core/hle/service/fs/archive.cpp26
-rw-r--r--src/core/hle/service/fs/archive.h5
-rw-r--r--src/core/hle/service/fs/fs_user.cpp10
-rw-r--r--src/core/hle/service/gsp_gpu.cpp8
-rw-r--r--src/core/hle/service/hid_user.cpp3
-rw-r--r--src/core/hle/service/ptm_u.cpp8
-rw-r--r--src/core/hle/service/service.cpp17
-rw-r--r--src/core/hle/service/service.h46
-rw-r--r--src/core/hle/service/srv.cpp4
-rw-r--r--src/core/hle/service/y2r_u.cpp17
12 files changed, 73 insertions, 79 deletions
diff --git a/src/core/hle/service/apt_u.cpp b/src/core/hle/service/apt_u.cpp
index d8b261ba7..d0ff4e585 100644
--- a/src/core/hle/service/apt_u.cpp
+++ b/src/core/hle/service/apt_u.cpp
@@ -52,8 +52,6 @@ void Initialize(Service::Interface* self) {
Kernel::ReleaseMutex(lock_handle);
cmd_buff[1] = 0; // No error
-
- LOG_DEBUG(Service_APT, "called");
}
void GetLockHandle(Service::Interface* self) {
@@ -194,8 +192,6 @@ void AppletUtility(Service::Interface* self) {
* 4 : Handle to shared font memory
*/
void GetSharedFont(Service::Interface* self) {
- LOG_TRACE(Kernel_SVC, "called");
-
u32* cmd_buff = Kernel::GetCommandBuffer();
if (!shared_font.empty()) {
diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp
index 161aa8531..8812c49ef 100644
--- a/src/core/hle/service/cfg/cfg.cpp
+++ b/src/core/hle/service/cfg/cfg.cpp
@@ -161,9 +161,9 @@ ResultCode FormatConfig() {
void CFGInit() {
// TODO(Subv): In the future we should use the FS service to query this archive,
// currently it is not possible because you can only have one open archive of the same type at any time
- std::string syssavedata_directory = FileUtil::GetUserPath(D_SYSSAVEDATA_IDX);
+ std::string nand_directory = FileUtil::GetUserPath(D_NAND_IDX);
cfg_system_save_data = Common::make_unique<FileSys::Archive_SystemSaveData>(
- syssavedata_directory, CFG_SAVE_ID);
+ nand_directory, CFG_SAVE_ID);
if (!cfg_system_save_data->Initialize()) {
LOG_CRITICAL(Service_CFG, "Could not initialize SystemSaveData archive for the CFG:U service");
return;
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp
index f761c6ab9..958dd9344 100644
--- a/src/core/hle/service/fs/archive.cpp
+++ b/src/core/hle/service/fs/archive.cpp
@@ -36,6 +36,10 @@ namespace std {
};
}
+/// TODO(Subv): Confirm length of these strings
+const std::string SYSTEM_ID = "00000000000000000000000000000000";
+const std::string SDCARD_ID = "00000000000000000000000000000000";
+
namespace Service {
namespace FS {
@@ -432,11 +436,11 @@ ResultCode FormatSaveData() {
void ArchiveInit() {
next_handle = 1;
- // TODO(Link Mauve): Add the other archive types (see here for the known types:
- // http://3dbrew.org/wiki/FS:OpenArchive#Archive_idcodes). Currently the only half-finished
- // archive type is SDMC, so it is the only one getting exposed.
+ // TODO(Subv): Add the other archive types (see here for the known types:
+ // http://3dbrew.org/wiki/FS:OpenArchive#Archive_idcodes).
std::string sdmc_directory = FileUtil::GetUserPath(D_SDMC_IDX);
+ std::string nand_directory = FileUtil::GetUserPath(D_NAND_IDX);
auto sdmc_archive = Common::make_unique<FileSys::Archive_SDMC>(sdmc_directory);
if (sdmc_archive->Initialize())
CreateArchive(std::move(sdmc_archive), ArchiveIdCode::SDMC);
@@ -444,28 +448,24 @@ void ArchiveInit() {
LOG_ERROR(Service_FS, "Can't instantiate SDMC archive with path %s", sdmc_directory.c_str());
// Create the SaveData archive
- std::string savedata_directory = FileUtil::GetUserPath(D_SAVEDATA_IDX);
- auto savedata_archive = Common::make_unique<FileSys::Archive_SaveData>(savedata_directory);
+ auto savedata_archive = Common::make_unique<FileSys::Archive_SaveData>(sdmc_directory);
CreateArchive(std::move(savedata_archive), ArchiveIdCode::SaveData);
- std::string extsavedata_directory = FileUtil::GetUserPath(D_EXTSAVEDATA);
- auto extsavedata_archive = Common::make_unique<FileSys::Archive_ExtSaveData>(extsavedata_directory);
+ auto extsavedata_archive = Common::make_unique<FileSys::Archive_ExtSaveData>(sdmc_directory, false);
if (extsavedata_archive->Initialize())
CreateArchive(std::move(extsavedata_archive), ArchiveIdCode::ExtSaveData);
else
- LOG_ERROR(Service_FS, "Can't instantiate ExtSaveData archive with path %s", extsavedata_directory.c_str());
+ LOG_ERROR(Service_FS, "Can't instantiate ExtSaveData archive with path %s", extsavedata_archive->GetMountPoint().c_str());
- std::string sharedextsavedata_directory = FileUtil::GetUserPath(D_EXTSAVEDATA);
- auto sharedextsavedata_archive = Common::make_unique<FileSys::Archive_ExtSaveData>(sharedextsavedata_directory);
+ auto sharedextsavedata_archive = Common::make_unique<FileSys::Archive_ExtSaveData>(nand_directory, true);
if (sharedextsavedata_archive->Initialize())
CreateArchive(std::move(sharedextsavedata_archive), ArchiveIdCode::SharedExtSaveData);
else
LOG_ERROR(Service_FS, "Can't instantiate SharedExtSaveData archive with path %s",
- sharedextsavedata_directory.c_str());
+ sharedextsavedata_archive->GetMountPoint().c_str());
// Create the SaveDataCheck archive, basically a small variation of the RomFS archive
- std::string savedatacheck_directory = FileUtil::GetUserPath(D_SAVEDATACHECK_IDX);
- auto savedatacheck_archive = Common::make_unique<FileSys::Archive_SaveDataCheck>(savedatacheck_directory);
+ auto savedatacheck_archive = Common::make_unique<FileSys::Archive_SaveDataCheck>(nand_directory);
CreateArchive(std::move(savedatacheck_archive), ArchiveIdCode::SaveDataCheck);
}
diff --git a/src/core/hle/service/fs/archive.h b/src/core/hle/service/fs/archive.h
index 9e9efa019..b3f2134f2 100644
--- a/src/core/hle/service/fs/archive.h
+++ b/src/core/hle/service/fs/archive.h
@@ -10,6 +10,11 @@
#include "core/hle/kernel/kernel.h"
#include "core/hle/result.h"
+/// The unique system identifier hash, also known as ID0
+extern const std::string SYSTEM_ID;
+/// The scrambled SD card CID, also known as ID1
+extern const std::string SDCARD_ID;
+
namespace Service {
namespace FS {
diff --git a/src/core/hle/service/fs/fs_user.cpp b/src/core/hle/service/fs/fs_user.cpp
index 7eb32146d..56f3117f4 100644
--- a/src/core/hle/service/fs/fs_user.cpp
+++ b/src/core/hle/service/fs/fs_user.cpp
@@ -27,8 +27,6 @@ static void Initialize(Service::Interface* self) {
// TODO(Link Mauve): check the behavior when cmd_buff[1] isn't 32, as per
// http://3dbrew.org/wiki/FS:Initialize#Request
cmd_buff[1] = RESULT_SUCCESS.raw;
-
- LOG_DEBUG(Service_FS, "called");
}
/**
@@ -104,8 +102,8 @@ static void OpenFileDirectly(Service::Interface* self) {
FileSys::Path archive_path(archivename_type, archivename_size, archivename_ptr);
FileSys::Path file_path(filename_type, filename_size, filename_ptr);
- LOG_DEBUG(Service_FS, "archive_path=%s file_path=%s, mode=%u attributes=%d",
- archive_path.DebugStr().c_str(), file_path.DebugStr().c_str(), mode.hex, attributes);
+ LOG_DEBUG(Service_FS, "archive_id=0x%08X archive_path=%s file_path=%s, mode=%u attributes=%d",
+ archive_id, archive_path.DebugStr().c_str(), file_path.DebugStr().c_str(), mode.hex, attributes);
ResultVal<ArchiveHandle> archive_handle = OpenArchive(archive_id, archive_path);
if (archive_handle.Failed()) {
@@ -367,7 +365,7 @@ static void OpenArchive(Service::Interface* self) {
u32 archivename_ptr = cmd_buff[5];
FileSys::Path archive_path(archivename_type, archivename_size, archivename_ptr);
- LOG_DEBUG(Service_FS, "archive_path=%s", archive_path.DebugStr().c_str());
+ LOG_DEBUG(Service_FS, "archive_id=0x%08X archive_path=%s", archive_id, archive_path.DebugStr().c_str());
ResultVal<ArchiveHandle> handle = OpenArchive(archive_id, archive_path);
cmd_buff[1] = handle.Code().raw;
@@ -408,8 +406,6 @@ static void IsSdmcDetected(Service::Interface* self) {
cmd_buff[1] = 0;
cmd_buff[2] = Settings::values.use_virtual_sd ? 1 : 0;
-
- LOG_DEBUG(Service_FS, "called");
}
/**
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp
index 0127d4ee5..2b115240f 100644
--- a/src/core/hle/service/gsp_gpu.cpp
+++ b/src/core/hle/service/gsp_gpu.cpp
@@ -291,8 +291,11 @@ static void ExecuteCommand(const Command& command, u32 thread_id) {
// Update framebuffer information if requested
for (int screen_id = 0; screen_id < 2; ++screen_id) {
FrameBufferUpdate* info = GetFrameBufferInfo(thread_id, screen_id);
- if (info->is_dirty)
+
+ if (info->is_dirty) {
SetBufferSwap(screen_id, info->framebuffer_info[info->index]);
+ info->framebuffer_info->active_fb = info->framebuffer_info->active_fb ^ 1;
+ }
info->is_dirty = false;
}
@@ -328,9 +331,6 @@ static void ExecuteCommand(const Command& command, u32 thread_id) {
/// This triggers handling of the GX command written to the command buffer in shared memory.
static void TriggerCmdReqQueue(Service::Interface* self) {
-
- LOG_TRACE(Service_GSP, "called");
-
// Iterate through each thread's command queue...
for (unsigned thread_id = 0; thread_id < 0x4; ++thread_id) {
CommandBuffer* command_buffer = (CommandBuffer*)GetCommandBuffer(thread_id);
diff --git a/src/core/hle/service/hid_user.cpp b/src/core/hle/service/hid_user.cpp
index 99b0ea5a0..1403b1de9 100644
--- a/src/core/hle/service/hid_user.cpp
+++ b/src/core/hle/service/hid_user.cpp
@@ -4,6 +4,7 @@
#include "common/log.h"
+#include "core/arm/arm_interface.h"
#include "core/hle/hle.h"
#include "core/hle/kernel/event.h"
#include "core/hle/kernel/shared_memory.h"
@@ -162,8 +163,6 @@ static void GetIPCHandles(Service::Interface* self) {
cmd_buff[6] = event_accelerometer;
cmd_buff[7] = event_gyroscope;
cmd_buff[8] = event_debug_pad;
-
- LOG_TRACE(Service_HID, "called");
}
const Interface::FunctionInfo FunctionTable[] = {
diff --git a/src/core/hle/service/ptm_u.cpp b/src/core/hle/service/ptm_u.cpp
index 9cc700c46..753180add 100644
--- a/src/core/hle/service/ptm_u.cpp
+++ b/src/core/hle/service/ptm_u.cpp
@@ -76,8 +76,6 @@ static void GetShellState(Service::Interface* self) {
cmd_buff[1] = 0;
cmd_buff[2] = shell_open ? 1 : 0;
-
- LOG_TRACE(Service_PTM, "PTM_U::GetShellState called");
}
/**
@@ -142,10 +140,10 @@ Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
// Create the SharedExtSaveData archive 0xF000000B and the gamecoin.dat file
// TODO(Subv): In the future we should use the FS service to query this archive
- std::string extsavedata_directory = FileUtil::GetUserPath(D_EXTSAVEDATA);
- ptm_shared_extsavedata = Common::make_unique<FileSys::Archive_ExtSaveData>(extsavedata_directory);
+ std::string nand_directory = FileUtil::GetUserPath(D_NAND_IDX);
+ ptm_shared_extsavedata = Common::make_unique<FileSys::Archive_ExtSaveData>(nand_directory, true);
if (!ptm_shared_extsavedata->Initialize()) {
- LOG_CRITICAL(Service_PTM, "Could not initialize ExtSaveData archive for the PTM:U service");
+ LOG_CRITICAL(Service_PTM, "Could not initialize SharedExtSaveData archive for the PTM:U service");
return;
}
FileSys::Path archive_path(ptm_shared_extdata_id);
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index c5233e687..33c29a4a0 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -46,36 +46,23 @@ Manager* g_manager = nullptr; ///< Service manager
////////////////////////////////////////////////////////////////////////////////////////////////////
// Service Manager class
-Manager::Manager() {
-}
-
-Manager::~Manager() {
- for(Interface* service : m_services) {
- DeleteService(service->GetPortName());
- }
-}
-
-/// Add a service to the manager (does not create it though)
void Manager::AddService(Interface* service) {
// TOOD(yuriks): Fix error reporting
m_port_map[service->GetPortName()] = Kernel::g_handle_table.Create(service).ValueOr(INVALID_HANDLE);
m_services.push_back(service);
}
-/// Removes a service from the manager, also frees memory
void Manager::DeleteService(const std::string& port_name) {
Interface* service = FetchFromPortName(port_name);
m_services.erase(std::remove(m_services.begin(), m_services.end(), service), m_services.end());
m_port_map.erase(port_name);
- delete service;
}
-/// Get a Service Interface from its Handle
Interface* Manager::FetchFromHandle(Handle handle) {
- return Kernel::g_handle_table.Get<Interface>(handle);
+ // TODO(yuriks): This function is very suspicious and should probably be exterminated.
+ return Kernel::g_handle_table.Get<Interface>(handle).get();
}
-/// Get a Service Interface from its port
Interface* Manager::FetchFromPortName(const std::string& port_name) {
auto itr = m_port_map.find(port_name);
if (itr == m_port_map.end()) {
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index 28b4ccd17..e75d5008b 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -33,6 +33,22 @@ class Interface : public Kernel::Session {
// processes.
friend class Manager;
+
+ /**
+ * Creates a function string for logging, complete with the name (or header code, depending
+ * on what's passed in) the port name, and all the cmd_buff arguments.
+ */
+ std::string MakeFunctionString(const std::string& name, const std::string& port_name, const u32* cmd_buff) {
+ // Number of params == bits 0-5 + bits 6-11
+ int num_params = (cmd_buff[0] & 0x3F) + ((cmd_buff[0] >> 6) & 0x3F);
+
+ std::string function_string = Common::StringFromFormat("function '%s': port=%s", name.c_str(), port_name.c_str());
+ for (int i = 1; i <= num_params; ++i) {
+ function_string += Common::StringFromFormat(", cmd_buff[%i]=%u", i, cmd_buff[i]);
+ }
+ return function_string;
+ }
+
public:
std::string GetName() const override { return GetPortName(); }
@@ -72,21 +88,14 @@ public:
auto itr = m_functions.find(cmd_buff[0]);
if (itr == m_functions.end() || itr->second.func == nullptr) {
- // Number of params == bits 0-5 + bits 6-11
- int num_params = (cmd_buff[0] & 0x3F) + ((cmd_buff[0] >> 6) & 0x3F);
-
- std::string error = "unknown/unimplemented function '%s': port=%s";
- for (int i = 1; i <= num_params; ++i) {
- error += Common::StringFromFormat(", cmd_buff[%i]=%u", i, cmd_buff[i]);
- }
-
- std::string name = (itr == m_functions.end()) ? Common::StringFromFormat("0x%08X", cmd_buff[0]) : itr->second.name;
-
- LOG_ERROR(Service, error.c_str(), name.c_str(), GetPortName().c_str());
+ std::string function_name = (itr == m_functions.end()) ? Common::StringFromFormat("0x%08X", cmd_buff[0]) : itr->second.name;
+ LOG_ERROR(Service, "%s %s", "unknown/unimplemented", MakeFunctionString(function_name, GetPortName(), cmd_buff).c_str());
// TODO(bunnei): Hack - ignore error
cmd_buff[1] = 0;
return MakeResult<bool>(false);
+ } else {
+ LOG_TRACE(Service, "%s", MakeFunctionString(itr->second.name, GetPortName(), cmd_buff).c_str());
}
itr->second.func(this);
@@ -114,29 +123,22 @@ private:
/// Simple class to manage accessing services from ports and UID handles
class Manager {
-
public:
- Manager();
-
- ~Manager();
-
- /// Add a service to the manager (does not create it though)
+ /// Add a service to the manager
void AddService(Interface* service);
- /// Removes a service from the manager (does not delete it though)
+ /// Removes a service from the manager
void DeleteService(const std::string& port_name);
- /// Get a Service Interface from its UID
- Interface* FetchFromHandle(u32 uid);
+ /// Get a Service Interface from its Handle
+ Interface* FetchFromHandle(Handle handle);
/// Get a Service Interface from its port
Interface* FetchFromPortName(const std::string& port_name);
private:
-
std::vector<Interface*> m_services;
std::map<std::string, u32> m_port_map;
-
};
/// Initialize ServiceManager
diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp
index 912b52adf..ac5f30a28 100644
--- a/src/core/hle/service/srv.cpp
+++ b/src/core/hle/service/srv.cpp
@@ -14,16 +14,12 @@ namespace SRV {
static Handle g_event_handle = 0;
static void Initialize(Service::Interface* self) {
- LOG_DEBUG(Service_SRV, "called");
-
u32* cmd_buff = Kernel::GetCommandBuffer();
cmd_buff[1] = 0; // No error
}
static void GetProcSemaphore(Service::Interface* self) {
- LOG_TRACE(Service_SRV, "called");
-
u32* cmd_buff = Kernel::GetCommandBuffer();
// TODO(bunnei): Change to a semaphore once these have been implemented
diff --git a/src/core/hle/service/y2r_u.cpp b/src/core/hle/service/y2r_u.cpp
index f9e3619dd..b3d873ef0 100644
--- a/src/core/hle/service/y2r_u.cpp
+++ b/src/core/hle/service/y2r_u.cpp
@@ -12,6 +12,21 @@
namespace Y2R_U {
+/**
+ * Y2R_U::IsBusyConversion service function
+ * Outputs:
+ * 1 : Result of function, 0 on success, otherwise error code
+ * 2 : Whether the current conversion is of type busy conversion (?)
+ */
+static void IsBusyConversion(Service::Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ cmd_buff[1] = RESULT_SUCCESS.raw;;
+ cmd_buff[2] = 0;
+
+ LOG_WARNING(Service, "(STUBBED) called");
+}
+
const Interface::FunctionInfo FunctionTable[] = {
{0x00010040, nullptr, "SetInputFormat"},
{0x00030040, nullptr, "SetOutputFormat"},
@@ -29,7 +44,7 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x00220040, nullptr, "SetAlpha"},
{0x00260000, nullptr, "StartConversion"},
{0x00270000, nullptr, "StopConversion"},
- {0x00280000, nullptr, "IsBusyConversion"},
+ {0x00280000, IsBusyConversion, "IsBusyConversion"},
{0x002A0000, nullptr, "PingProcess"},
{0x002B0000, nullptr, "DriverInitialize"},
{0x002C0000, nullptr, "DriverFinalize"}