summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/common.h7
-rw-r--r--src/common/log.h2
-rw-r--r--src/common/logging/log.h23
-rw-r--r--src/core/hle/result.h4
-rw-r--r--src/core/hle/service/apt_u.cpp4
-rw-r--r--src/core/hle/service/fs/fs_user.cpp10
-rw-r--r--src/core/hle/service/gsp_gpu.cpp3
-rw-r--r--src/core/hle/service/hid_user.cpp2
-rw-r--r--src/core/hle/service/ptm_u.cpp2
-rw-r--r--src/core/hle/service/service.h31
-rw-r--r--src/core/hle/service/srv.cpp4
-rw-r--r--src/core/hle/svc.cpp1
12 files changed, 33 insertions, 60 deletions
diff --git a/src/common/common.h b/src/common/common.h
index bf48ae667..3246c7797 100644
--- a/src/common/common.h
+++ b/src/common/common.h
@@ -11,13 +11,6 @@
11#include <cstdio> 11#include <cstdio>
12#include <cstring> 12#include <cstring>
13 13
14// Force enable logging in the right modes. For some reason, something had changed
15// so that debugfast no longer logged.
16#if defined(_DEBUG) || defined(DEBUGFAST)
17#undef LOGGING
18#define LOGGING 1
19#endif
20
21#define STACKALIGN 14#define STACKALIGN
22 15
23// An inheritable class to disallow the copy constructor and operator= functions 16// An inheritable class to disallow the copy constructor and operator= functions
diff --git a/src/common/log.h b/src/common/log.h
index 667f2fbb9..b397cf14d 100644
--- a/src/common/log.h
+++ b/src/common/log.h
@@ -14,7 +14,7 @@
14#endif 14#endif
15#endif 15#endif
16 16
17#if _DEBUG 17#ifdef _DEBUG
18#define _dbg_assert_(_t_, _a_) \ 18#define _dbg_assert_(_t_, _a_) \
19 if (!(_a_)) {\ 19 if (!(_a_)) {\
20 LOG_CRITICAL(_t_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \ 20 LOG_CRITICAL(_t_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \
diff --git a/src/common/logging/log.h b/src/common/logging/log.h
index bda3d633a..3d94bf0d9 100644
--- a/src/common/logging/log.h
+++ b/src/common/logging/log.h
@@ -74,17 +74,6 @@ enum class Class : ClassType {
74}; 74};
75 75
76/** 76/**
77 * Level below which messages are simply discarded without buffering regardless of the display
78 * settings.
79 */
80const Level MINIMUM_LEVEL =
81#ifdef _DEBUG
82 Level::Trace;
83#else
84 Level::Debug;
85#endif
86
87/**
88 * Logs a message to the global logger. This proxy exists to avoid exposing the details of the 77 * Logs a message to the global logger. This proxy exists to avoid exposing the details of the
89 * Logger class, including the ConcurrentRingBuffer template, to all files that desire to log 78 * Logger class, including the ConcurrentRingBuffer template, to all files that desire to log
90 * messages, reducing unecessary recompilations. 79 * messages, reducing unecessary recompilations.
@@ -103,13 +92,15 @@ void LogMessage(Class log_class, Level log_level,
103} // namespace Log 92} // namespace Log
104 93
105#define LOG_GENERIC(log_class, log_level, ...) \ 94#define LOG_GENERIC(log_class, log_level, ...) \
106 do { \ 95 ::Log::LogMessage(::Log::Class::log_class, ::Log::Level::log_level, \
107 if (::Log::Level::log_level >= ::Log::MINIMUM_LEVEL) \ 96 __FILE__, __LINE__, __func__, __VA_ARGS__)
108 ::Log::LogMessage(::Log::Class::log_class, ::Log::Level::log_level, \
109 __FILE__, __LINE__, __func__, __VA_ARGS__); \
110 } while (0)
111 97
98#ifdef _DEBUG
112#define LOG_TRACE( log_class, ...) LOG_GENERIC(log_class, Trace, __VA_ARGS__) 99#define LOG_TRACE( log_class, ...) LOG_GENERIC(log_class, Trace, __VA_ARGS__)
100#else
101#define LOG_TRACE( log_class, ...) (void(0))
102#endif
103
113#define LOG_DEBUG( log_class, ...) LOG_GENERIC(log_class, Debug, __VA_ARGS__) 104#define LOG_DEBUG( log_class, ...) LOG_GENERIC(log_class, Debug, __VA_ARGS__)
114#define LOG_INFO( log_class, ...) LOG_GENERIC(log_class, Info, __VA_ARGS__) 105#define LOG_INFO( log_class, ...) LOG_GENERIC(log_class, Info, __VA_ARGS__)
115#define LOG_WARNING( log_class, ...) LOG_GENERIC(log_class, Warning, __VA_ARGS__) 106#define LOG_WARNING( log_class, ...) LOG_GENERIC(log_class, Warning, __VA_ARGS__)
diff --git a/src/core/hle/result.h b/src/core/hle/result.h
index 0e9c213e0..82dcf5bba 100644
--- a/src/core/hle/result.h
+++ b/src/core/hle/result.h
@@ -369,14 +369,14 @@ private:
369 369
370 StorageType storage; 370 StorageType storage;
371 ResultCode result_code; 371 ResultCode result_code;
372#if _DEBUG 372#ifdef _DEBUG
373 // The purpose of this pointer is to aid inspecting the type with a debugger, eliminating the 373 // The purpose of this pointer is to aid inspecting the type with a debugger, eliminating the
374 // need to cast `storage` to a pointer or pay attention to `result_code`. 374 // need to cast `storage` to a pointer or pay attention to `result_code`.
375 const T* debug_ptr; 375 const T* debug_ptr;
376#endif 376#endif
377 377
378 void UpdateDebugPtr() { 378 void UpdateDebugPtr() {
379#if _DEBUG 379#ifdef _DEBUG
380 debug_ptr = empty() ? nullptr : static_cast<const T*>(static_cast<const void*>(&storage)); 380 debug_ptr = empty() ? nullptr : static_cast<const T*>(static_cast<const void*>(&storage));
381#endif 381#endif
382 } 382 }
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) {
52 Kernel::ReleaseMutex(lock_handle); 52 Kernel::ReleaseMutex(lock_handle);
53 53
54 cmd_buff[1] = 0; // No error 54 cmd_buff[1] = 0; // No error
55
56 LOG_DEBUG(Service_APT, "called");
57} 55}
58 56
59void GetLockHandle(Service::Interface* self) { 57void GetLockHandle(Service::Interface* self) {
@@ -194,8 +192,6 @@ void AppletUtility(Service::Interface* self) {
194 * 4 : Handle to shared font memory 192 * 4 : Handle to shared font memory
195 */ 193 */
196void GetSharedFont(Service::Interface* self) { 194void GetSharedFont(Service::Interface* self) {
197 LOG_TRACE(Kernel_SVC, "called");
198
199 u32* cmd_buff = Kernel::GetCommandBuffer(); 195 u32* cmd_buff = Kernel::GetCommandBuffer();
200 196
201 if (!shared_font.empty()) { 197 if (!shared_font.empty()) {
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) {
27 // TODO(Link Mauve): check the behavior when cmd_buff[1] isn't 32, as per 27 // TODO(Link Mauve): check the behavior when cmd_buff[1] isn't 32, as per
28 // http://3dbrew.org/wiki/FS:Initialize#Request 28 // http://3dbrew.org/wiki/FS:Initialize#Request
29 cmd_buff[1] = RESULT_SUCCESS.raw; 29 cmd_buff[1] = RESULT_SUCCESS.raw;
30
31 LOG_DEBUG(Service_FS, "called");
32} 30}
33 31
34/** 32/**
@@ -104,8 +102,8 @@ static void OpenFileDirectly(Service::Interface* self) {
104 FileSys::Path archive_path(archivename_type, archivename_size, archivename_ptr); 102 FileSys::Path archive_path(archivename_type, archivename_size, archivename_ptr);
105 FileSys::Path file_path(filename_type, filename_size, filename_ptr); 103 FileSys::Path file_path(filename_type, filename_size, filename_ptr);
106 104
107 LOG_DEBUG(Service_FS, "archive_path=%s file_path=%s, mode=%u attributes=%d", 105 LOG_DEBUG(Service_FS, "archive_id=0x%08X archive_path=%s file_path=%s, mode=%u attributes=%d",
108 archive_path.DebugStr().c_str(), file_path.DebugStr().c_str(), mode.hex, attributes); 106 archive_id, archive_path.DebugStr().c_str(), file_path.DebugStr().c_str(), mode.hex, attributes);
109 107
110 ResultVal<ArchiveHandle> archive_handle = OpenArchive(archive_id, archive_path); 108 ResultVal<ArchiveHandle> archive_handle = OpenArchive(archive_id, archive_path);
111 if (archive_handle.Failed()) { 109 if (archive_handle.Failed()) {
@@ -367,7 +365,7 @@ static void OpenArchive(Service::Interface* self) {
367 u32 archivename_ptr = cmd_buff[5]; 365 u32 archivename_ptr = cmd_buff[5];
368 FileSys::Path archive_path(archivename_type, archivename_size, archivename_ptr); 366 FileSys::Path archive_path(archivename_type, archivename_size, archivename_ptr);
369 367
370 LOG_DEBUG(Service_FS, "archive_path=%s", archive_path.DebugStr().c_str()); 368 LOG_DEBUG(Service_FS, "archive_id=0x%08X archive_path=%s", archive_id, archive_path.DebugStr().c_str());
371 369
372 ResultVal<ArchiveHandle> handle = OpenArchive(archive_id, archive_path); 370 ResultVal<ArchiveHandle> handle = OpenArchive(archive_id, archive_path);
373 cmd_buff[1] = handle.Code().raw; 371 cmd_buff[1] = handle.Code().raw;
@@ -408,8 +406,6 @@ static void IsSdmcDetected(Service::Interface* self) {
408 406
409 cmd_buff[1] = 0; 407 cmd_buff[1] = 0;
410 cmd_buff[2] = Settings::values.use_virtual_sd ? 1 : 0; 408 cmd_buff[2] = Settings::values.use_virtual_sd ? 1 : 0;
411
412 LOG_DEBUG(Service_FS, "called");
413} 409}
414 410
415/** 411/**
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp
index 26a43217e..2b115240f 100644
--- a/src/core/hle/service/gsp_gpu.cpp
+++ b/src/core/hle/service/gsp_gpu.cpp
@@ -331,9 +331,6 @@ static void ExecuteCommand(const Command& command, u32 thread_id) {
331 331
332/// This triggers handling of the GX command written to the command buffer in shared memory. 332/// This triggers handling of the GX command written to the command buffer in shared memory.
333static void TriggerCmdReqQueue(Service::Interface* self) { 333static void TriggerCmdReqQueue(Service::Interface* self) {
334
335 LOG_TRACE(Service_GSP, "called");
336
337 // Iterate through each thread's command queue... 334 // Iterate through each thread's command queue...
338 for (unsigned thread_id = 0; thread_id < 0x4; ++thread_id) { 335 for (unsigned thread_id = 0; thread_id < 0x4; ++thread_id) {
339 CommandBuffer* command_buffer = (CommandBuffer*)GetCommandBuffer(thread_id); 336 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 8ef9af9d2..1403b1de9 100644
--- a/src/core/hle/service/hid_user.cpp
+++ b/src/core/hle/service/hid_user.cpp
@@ -163,8 +163,6 @@ static void GetIPCHandles(Service::Interface* self) {
163 cmd_buff[6] = event_accelerometer; 163 cmd_buff[6] = event_accelerometer;
164 cmd_buff[7] = event_gyroscope; 164 cmd_buff[7] = event_gyroscope;
165 cmd_buff[8] = event_debug_pad; 165 cmd_buff[8] = event_debug_pad;
166
167 LOG_TRACE(Service_HID, "called");
168} 166}
169 167
170const Interface::FunctionInfo FunctionTable[] = { 168const Interface::FunctionInfo FunctionTable[] = {
diff --git a/src/core/hle/service/ptm_u.cpp b/src/core/hle/service/ptm_u.cpp
index fd79cd8ab..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) {
76 76
77 cmd_buff[1] = 0; 77 cmd_buff[1] = 0;
78 cmd_buff[2] = shell_open ? 1 : 0; 78 cmd_buff[2] = shell_open ? 1 : 0;
79
80 LOG_TRACE(Service_PTM, "PTM_U::GetShellState called");
81} 79}
82 80
83/** 81/**
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index 41ba1e554..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 {
33 // processes. 33 // processes.
34 34
35 friend class Manager; 35 friend class Manager;
36
37 /**
38 * Creates a function string for logging, complete with the name (or header code, depending
39 * on what's passed in) the port name, and all the cmd_buff arguments.
40 */
41 std::string MakeFunctionString(const std::string& name, const std::string& port_name, const u32* cmd_buff) {
42 // Number of params == bits 0-5 + bits 6-11
43 int num_params = (cmd_buff[0] & 0x3F) + ((cmd_buff[0] >> 6) & 0x3F);
44
45 std::string function_string = Common::StringFromFormat("function '%s': port=%s", name.c_str(), port_name.c_str());
46 for (int i = 1; i <= num_params; ++i) {
47 function_string += Common::StringFromFormat(", cmd_buff[%i]=%u", i, cmd_buff[i]);
48 }
49 return function_string;
50 }
51
36public: 52public:
37 std::string GetName() const override { return GetPortName(); } 53 std::string GetName() const override { return GetPortName(); }
38 54
@@ -72,21 +88,14 @@ public:
72 auto itr = m_functions.find(cmd_buff[0]); 88 auto itr = m_functions.find(cmd_buff[0]);
73 89
74 if (itr == m_functions.end() || itr->second.func == nullptr) { 90 if (itr == m_functions.end() || itr->second.func == nullptr) {
75 // Number of params == bits 0-5 + bits 6-11 91 std::string function_name = (itr == m_functions.end()) ? Common::StringFromFormat("0x%08X", cmd_buff[0]) : itr->second.name;
76 int num_params = (cmd_buff[0] & 0x3F) + ((cmd_buff[0] >> 6) & 0x3F); 92 LOG_ERROR(Service, "%s %s", "unknown/unimplemented", MakeFunctionString(function_name, GetPortName(), cmd_buff).c_str());
77
78 std::string error = "unknown/unimplemented function '%s': port=%s";
79 for (int i = 1; i <= num_params; ++i) {
80 error += Common::StringFromFormat(", cmd_buff[%i]=%u", i, cmd_buff[i]);
81 }
82
83 std::string name = (itr == m_functions.end()) ? Common::StringFromFormat("0x%08X", cmd_buff[0]) : itr->second.name;
84
85 LOG_ERROR(Service, error.c_str(), name.c_str(), GetPortName().c_str());
86 93
87 // TODO(bunnei): Hack - ignore error 94 // TODO(bunnei): Hack - ignore error
88 cmd_buff[1] = 0; 95 cmd_buff[1] = 0;
89 return MakeResult<bool>(false); 96 return MakeResult<bool>(false);
97 } else {
98 LOG_TRACE(Service, "%s", MakeFunctionString(itr->second.name, GetPortName(), cmd_buff).c_str());
90 } 99 }
91 100
92 itr->second.func(this); 101 itr->second.func(this);
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 {
14static Handle g_event_handle = 0; 14static Handle g_event_handle = 0;
15 15
16static void Initialize(Service::Interface* self) { 16static void Initialize(Service::Interface* self) {
17 LOG_DEBUG(Service_SRV, "called");
18
19 u32* cmd_buff = Kernel::GetCommandBuffer(); 17 u32* cmd_buff = Kernel::GetCommandBuffer();
20 18
21 cmd_buff[1] = 0; // No error 19 cmd_buff[1] = 0; // No error
22} 20}
23 21
24static void GetProcSemaphore(Service::Interface* self) { 22static void GetProcSemaphore(Service::Interface* self) {
25 LOG_TRACE(Service_SRV, "called");
26
27 u32* cmd_buff = Kernel::GetCommandBuffer(); 23 u32* cmd_buff = Kernel::GetCommandBuffer();
28 24
29 // TODO(bunnei): Change to a semaphore once these have been implemented 25 // TODO(bunnei): Change to a semaphore once these have been implemented
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index ba620bd0f..d3b4483ca 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -185,7 +185,6 @@ static Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count,
185 185
186/// Create an address arbiter (to allocate access to shared resources) 186/// Create an address arbiter (to allocate access to shared resources)
187static Result CreateAddressArbiter(u32* arbiter) { 187static Result CreateAddressArbiter(u32* arbiter) {
188 LOG_TRACE(Kernel_SVC, "called");
189 Handle handle = Kernel::CreateAddressArbiter(); 188 Handle handle = Kernel::CreateAddressArbiter();
190 *arbiter = handle; 189 *arbiter = handle;
191 return 0; 190 return 0;