diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/citra_qt/CMakeLists.txt | 32 | ||||
-rw-r--r-- | src/citra_qt/bootmanager.cpp | 17 | ||||
-rw-r--r-- | src/common/symbols.h | 2 | ||||
-rw-r--r-- | src/core/arm/interpreter/vfp/vfpdouble.cpp | 2 | ||||
-rw-r--r-- | src/core/arm/interpreter/vfp/vfpsingle.cpp | 2 | ||||
-rw-r--r-- | src/core/hle/function_wrappers.h | 60 | ||||
-rw-r--r-- | src/core/hle/kernel/address_arbiter.cpp | 4 | ||||
-rw-r--r-- | src/core/hle/kernel/archive.cpp | 6 | ||||
-rw-r--r-- | src/core/hle/kernel/event.cpp | 4 | ||||
-rw-r--r-- | src/core/hle/kernel/kernel.cpp | 7 | ||||
-rw-r--r-- | src/core/hle/kernel/kernel.h | 13 | ||||
-rw-r--r-- | src/core/hle/kernel/mutex.cpp | 4 | ||||
-rw-r--r-- | src/core/hle/kernel/shared_memory.cpp | 2 | ||||
-rw-r--r-- | src/core/hle/kernel/thread.cpp | 17 | ||||
-rw-r--r-- | src/core/hle/service/apt.h | 2 | ||||
-rw-r--r-- | src/core/hle/service/fs.h | 2 | ||||
-rw-r--r-- | src/core/hle/service/gsp.h | 2 | ||||
-rw-r--r-- | src/core/hle/service/hid.h | 2 | ||||
-rw-r--r-- | src/core/hle/service/ndm.h | 2 | ||||
-rw-r--r-- | src/core/hle/service/service.h | 10 | ||||
-rw-r--r-- | src/core/hle/service/srv.h | 2 | ||||
-rw-r--r-- | src/core/hle/svc.cpp | 17 |
22 files changed, 122 insertions, 89 deletions
diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index 5ce4e3f16..ff1fbc460 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt @@ -14,7 +14,7 @@ set(SRCS config/controller_config.cpp config/controller_config_util.cpp) -set (HEADERS +set(HEADERS bootmanager.hxx debugger/callstack.hxx debugger/disassembler.hxx @@ -26,24 +26,30 @@ set (HEADERS config/controller_config.hxx config/controller_config_util.hxx) -qt4_wrap_ui(UI_HDRS - debugger/callstack.ui - debugger/disassembler.ui - debugger/registers.ui - hotkeys.ui - main.ui - config/controller_config.ui) +set(UIS + debugger/callstack.ui + debugger/disassembler.ui + debugger/registers.ui + hotkeys.ui + main.ui + config/controller_config.ui) -# add uic results to include directories -include_directories(${CMAKE_CURRENT_BINARY_DIR}) +if(USE_QT5) + qt5_wrap_ui(UI_HDRS ${UIS}) +else() + qt4_wrap_ui(UI_HDRS ${UIS}) +endif() -add_executable(citra-qt ${SRCS} ${UI_HDRS}) -if (APPLE) +add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS}) +if(APPLE) set(ICONV_LIBRARY iconv) else() set(RT_LIBRARY rt) endif() -target_link_libraries(citra-qt core common video_core qhexedit ${ICONV_LIBRARY} ${COREFOUNDATION_LIBRARY} ${QT_LIBRARIES} ${OPENGL_LIBRARIES} ${RT_LIBRARY} ${GLEW_LIBRARY} ${GLFW_LIBRARIES}) +target_link_libraries(citra-qt core common video_core qhexedit ${ICONV_LIBRARY} ${COREFOUNDATION_LIBRARY} ${QT_LIBRARIES} ${OPENGL_LIBRARIES} ${RT_LIBRARY} ${GLEW_LIBRARY}) +if(USE_QT5) + target_link_libraries(citra-qt Qt5::Gui Qt5::Widgets Qt5::OpenGL) +endif() #install(TARGETS citra-qt RUNTIME DESTINATION ${bindir}) diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index 250df59f8..b0aa1e561 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -32,14 +32,17 @@ void EmuThread::run() { while (true) { - if (cpu_running || exec_cpu_step) + for (int tight_loop = 0; tight_loop < 10000; ++tight_loop) { - if (exec_cpu_step) - exec_cpu_step = false; - - Core::SingleStep(); - if (!cpu_running) - emit CPUStepped(); + if (cpu_running || exec_cpu_step) + { + if (exec_cpu_step) + exec_cpu_step = false; + + Core::SingleStep(); + if (!cpu_running) + emit CPUStepped(); + } } } diff --git a/src/common/symbols.h b/src/common/symbols.h index e59bc5dd4..b13a8001a 100644 --- a/src/common/symbols.h +++ b/src/common/symbols.h @@ -8,8 +8,6 @@ #include "common/common.h" -class DebugInterface; - struct TSymbol { TSymbol() : diff --git a/src/core/arm/interpreter/vfp/vfpdouble.cpp b/src/core/arm/interpreter/vfp/vfpdouble.cpp index 7f975cbeb..5ae99b88a 100644 --- a/src/core/arm/interpreter/vfp/vfpdouble.cpp +++ b/src/core/arm/interpreter/vfp/vfpdouble.cpp @@ -895,7 +895,7 @@ vfp_double_multiply(struct vfp_double *vdd, struct vfp_double *vdn, #define NEG_SUBTRACT (1 << 1) static u32 -vfp_double_multiply_accumulate(ARMul_State* state, int dd, int dn, int dm, u32 fpscr, u32 negate, char *func) +vfp_double_multiply_accumulate(ARMul_State* state, int dd, int dn, int dm, u32 fpscr, u32 negate, const char *func) { struct vfp_double vdd, vdp, vdn, vdm; u32 exceptions; diff --git a/src/core/arm/interpreter/vfp/vfpsingle.cpp b/src/core/arm/interpreter/vfp/vfpsingle.cpp index 602713cff..0fcc85266 100644 --- a/src/core/arm/interpreter/vfp/vfpsingle.cpp +++ b/src/core/arm/interpreter/vfp/vfpsingle.cpp @@ -917,7 +917,7 @@ vfp_single_multiply(struct vfp_single *vsd, struct vfp_single *vsn, struct vfp_s #define NEG_SUBTRACT (1 << 1) static u32 -vfp_single_multiply_accumulate(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr, u32 negate, char *func) +vfp_single_multiply_accumulate(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr, u32 negate, const char *func) { struct vfp_single vsd, vsp, vsn, vsm; u32 exceptions; diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h index ea603a1bb..55eaf0621 100644 --- a/src/core/hle/function_wrappers.h +++ b/src/core/hle/function_wrappers.h @@ -11,24 +11,41 @@ namespace HLE { #define PARAM(n) Core::g_app_core->GetReg(n) -#define RETURN(n) Core::g_app_core->SetReg(0, n) + +/** + * HLE a function return from the current ARM11 userland process + * @param res Result to return + */ +static inline void FuncReturn(u32 res) { + Core::g_app_core->SetReg(0, res); +} + +/** + * HLE a function return (64-bit) from the current ARM11 userland process + * @param res Result to return (64-bit) + * @todo Verify that this function is correct + */ +static inline void FuncReturn64(u64 res) { + Core::g_app_core->SetReg(0, (u32)(res & 0xFFFFFFFF)); + Core::g_app_core->SetReg(1, (u32)((res >> 32) & 0xFFFFFFFF)); +} //////////////////////////////////////////////////////////////////////////////////////////////////// // Function wrappers that return type s32 template<s32 func(u32, u32, u32, u32)> void Wrap() { - RETURN(func(PARAM(0), PARAM(1), PARAM(2), PARAM(3))); + FuncReturn(func(PARAM(0), PARAM(1), PARAM(2), PARAM(3))); } template<s32 func(u32, u32, u32, u32, u32)> void Wrap() { - RETURN(func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4))); + FuncReturn(func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4))); } template<s32 func(u32*, u32, u32, u32, u32, u32)> void Wrap(){ u32 param_1 = 0; u32 retval = func(¶m_1, PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); Core::g_app_core->SetReg(1, param_1); - RETURN(retval); + FuncReturn(retval); } template<s32 func(s32*, u32*, s32, bool, s64)> void Wrap() { @@ -36,57 +53,57 @@ template<s32 func(s32*, u32*, s32, bool, s64)> void Wrap() { s32 retval = func(¶m_1, (Handle*)Memory::GetPointer(PARAM(1)), (s32)PARAM(2), (PARAM(3) != 0), (((s64)PARAM(4) << 32) | PARAM(0))); Core::g_app_core->SetReg(1, (u32)param_1); - RETURN(retval); + FuncReturn(retval); } // TODO(bunnei): Is this correct? Probably not - Last parameter looks wrong for ArbitrateAddress template<s32 func(u32, u32, u32, u32, s64)> void Wrap() { - RETURN(func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), (((s64)PARAM(5) << 32) | PARAM(4)))); + FuncReturn(func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), (((s64)PARAM(5) << 32) | PARAM(4)))); } template<s32 func(u32*)> void Wrap(){ u32 param_1 = 0; u32 retval = func(¶m_1); Core::g_app_core->SetReg(1, param_1); - RETURN(retval); + FuncReturn(retval); } template<s32 func(u32, s64)> void Wrap() { - RETURN(func(PARAM(0), (((s64)PARAM(3) << 32) | PARAM(2)))); + FuncReturn(func(PARAM(0), (((s64)PARAM(3) << 32) | PARAM(2)))); } template<s32 func(void*, void*, u32)> void Wrap(){ - RETURN(func(Memory::GetPointer(PARAM(0)), Memory::GetPointer(PARAM(1)), PARAM(2))); + FuncReturn(func(Memory::GetPointer(PARAM(0)), Memory::GetPointer(PARAM(1)), PARAM(2))); } template<s32 func(s32*, u32)> void Wrap(){ s32 param_1 = 0; u32 retval = func(¶m_1, PARAM(1)); Core::g_app_core->SetReg(1, param_1); - RETURN(retval); + FuncReturn(retval); } template<s32 func(u32, s32)> void Wrap() { - RETURN(func(PARAM(0), (s32)PARAM(1))); + FuncReturn(func(PARAM(0), (s32)PARAM(1))); } template<s32 func(u32*, u32)> void Wrap(){ u32 param_1 = 0; u32 retval = func(¶m_1, PARAM(1)); Core::g_app_core->SetReg(1, param_1); - RETURN(retval); + FuncReturn(retval); } template<s32 func(u32)> void Wrap() { - RETURN(func(PARAM(0))); + FuncReturn(func(PARAM(0))); } template<s32 func(void*)> void Wrap() { - RETURN(func(Memory::GetPointer(PARAM(0)))); + FuncReturn(func(Memory::GetPointer(PARAM(0)))); } template<s32 func(s64*, u32, void*, s32)> void Wrap(){ - RETURN(func((s64*)Memory::GetPointer(PARAM(0)), PARAM(1), Memory::GetPointer(PARAM(2)), + FuncReturn(func((s64*)Memory::GetPointer(PARAM(0)), PARAM(1), Memory::GetPointer(PARAM(2)), (s32)PARAM(3))); } @@ -94,14 +111,21 @@ template<s32 func(u32*, const char*)> void Wrap() { u32 param_1 = 0; u32 retval = func(¶m_1, Memory::GetCharPointer(PARAM(1))); Core::g_app_core->SetReg(1, param_1); - RETURN(retval); + FuncReturn(retval); } //////////////////////////////////////////////////////////////////////////////////////////////////// // Function wrappers that return type u32 template<u32 func()> void Wrap() { - RETURN(func()); + FuncReturn(func()); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Function wrappers that return type s64 + +template<s64 func()> void Wrap() { + FuncReturn64(func()); } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -116,6 +140,6 @@ template<void func(const char*)> void Wrap() { } #undef PARAM -#undef RETURN +#undef FuncReturn } // namespace HLE diff --git a/src/core/hle/kernel/address_arbiter.cpp b/src/core/hle/kernel/address_arbiter.cpp index bdf76e0c2..174d4cd6e 100644 --- a/src/core/hle/kernel/address_arbiter.cpp +++ b/src/core/hle/kernel/address_arbiter.cpp @@ -17,8 +17,8 @@ namespace Kernel { class AddressArbiter : public Object { public: - const char* GetTypeName() const { return "Arbiter"; } - const char* GetName() const { return name.c_str(); } + std::string GetTypeName() const { return "Arbiter"; } + std::string GetName() const { return name; } static Kernel::HandleType GetStaticHandleType() { return HandleType::AddressArbiter; } Kernel::HandleType GetHandleType() const { return HandleType::AddressArbiter; } diff --git a/src/core/hle/kernel/archive.cpp b/src/core/hle/kernel/archive.cpp index 76b2520da..5079fcb84 100644 --- a/src/core/hle/kernel/archive.cpp +++ b/src/core/hle/kernel/archive.cpp @@ -31,8 +31,8 @@ enum class FileCommand : u32 { class Archive : public Object { public: - const char* GetTypeName() const { return "Archive"; } - const char* GetName() const { return name.c_str(); } + std::string GetTypeName() const { return "Archive"; } + std::string GetName() const { return name; } static Kernel::HandleType GetStaticHandleType() { return HandleType::Archive; } Kernel::HandleType GetHandleType() const { return HandleType::Archive; } @@ -110,7 +110,7 @@ Result MountArchive(Archive* archive) { return -1; } g_archive_map[id_code] = archive->GetHandle(); - INFO_LOG(KERNEL, "Mounted archive %s", archive->GetName()); + INFO_LOG(KERNEL, "Mounted archive %s", archive->GetName().c_str()); return 0; } diff --git a/src/core/hle/kernel/event.cpp b/src/core/hle/kernel/event.cpp index 1e417e09c..64f6a9649 100644 --- a/src/core/hle/kernel/event.cpp +++ b/src/core/hle/kernel/event.cpp @@ -16,8 +16,8 @@ namespace Kernel { class Event : public Object { public: - const char* GetTypeName() const { return "Event"; } - const char* GetName() const { return name.c_str(); } + std::string GetTypeName() const { return "Event"; } + std::string GetName() const { return name; } static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Event; } Kernel::HandleType GetHandleType() const { return Kernel::HandleType::Event; } diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 7d9bd261e..a4a258875 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -17,7 +17,6 @@ Handle g_main_thread = 0; ObjectPool g_object_pool; ObjectPool::ObjectPool() { - memset(occupied, 0, sizeof(bool) * MAX_COUNT); next_id = INITIAL_NEXT_ID; } @@ -57,7 +56,7 @@ void ObjectPool::Clear() { delete pool[i]; occupied[i] = false; } - memset(pool, 0, sizeof(Object*)*MAX_COUNT); + pool.fill(nullptr); next_id = INITIAL_NEXT_ID; } @@ -71,8 +70,8 @@ void ObjectPool::List() { for (int i = 0; i < MAX_COUNT; i++) { if (occupied[i]) { if (pool[i]) { - INFO_LOG(KERNEL, "KO %i: %s \"%s\"", i + HANDLE_OFFSET, pool[i]->GetTypeName(), - pool[i]->GetName()); + INFO_LOG(KERNEL, "KO %i: %s \"%s\"", i + HANDLE_OFFSET, pool[i]->GetTypeName().c_str(), + pool[i]->GetName().c_str()); } } } diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index d9afcdd25..0e7e5ff68 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h @@ -4,6 +4,8 @@ #pragma once +#include <array> +#include <string> #include "common/common.h" typedef u32 Handle; @@ -33,7 +35,6 @@ enum class HandleType : u32 { }; enum { - MAX_NAME_LENGTH = 0x100, DEFAULT_STACK_SIZE = 0x4000, }; @@ -45,8 +46,8 @@ class Object : NonCopyable { public: virtual ~Object() {} Handle GetHandle() const { return handle; } - virtual const char* GetTypeName() const { return "[BAD KERNEL OBJECT TYPE]"; } - virtual const char* GetName() const { return "[UNKNOWN KERNEL OBJECT]"; } + virtual std::string GetTypeName() const { return "[BAD KERNEL OBJECT TYPE]"; } + virtual std::string GetName() const { return "[UNKNOWN KERNEL OBJECT]"; } virtual Kernel::HandleType GetHandleType() const = 0; /** @@ -160,9 +161,9 @@ private: INITIAL_NEXT_ID = 0x10, }; - Object* pool[MAX_COUNT]; - bool occupied[MAX_COUNT]; - int next_id; + std::array<Object*, MAX_COUNT> pool; + std::array<bool, MAX_COUNT> occupied; + int next_id; }; extern ObjectPool g_object_pool; diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index 055f503f9..5d7d65dd9 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp @@ -15,8 +15,8 @@ namespace Kernel { class Mutex : public Object { public: - const char* GetTypeName() const { return "Mutex"; } - const char* GetName() const { return name.c_str(); } + std::string GetTypeName() const { return "Mutex"; } + std::string GetName() const { return name; } static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Mutex; } Kernel::HandleType GetHandleType() const { return Kernel::HandleType::Mutex; } diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp index 52823048f..2a6a483a1 100644 --- a/src/core/hle/kernel/shared_memory.cpp +++ b/src/core/hle/kernel/shared_memory.cpp @@ -11,7 +11,7 @@ namespace Kernel { class SharedMemory : public Object { public: - const char* GetTypeName() const { return "SharedMemory"; } + std::string GetTypeName() const { return "SharedMemory"; } static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::SharedMemory; } Kernel::HandleType GetHandleType() const { return Kernel::HandleType::SharedMemory; } diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 1d7ded6f6..554ec9756 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -2,13 +2,12 @@ // Licensed under GPLv2 // Refer to the license.txt file included. -#include <stdio.h> - -#include <list> #include <algorithm> -#include <vector> +#include <cstdio> +#include <list> #include <map> #include <string> +#include <vector> #include "common/common.h" #include "common/thread_queue_list.h" @@ -25,8 +24,8 @@ namespace Kernel { class Thread : public Kernel::Object { public: - const char* GetName() const { return name; } - const char* GetTypeName() const { return "Thread"; } + std::string GetName() const { return name; } + std::string GetTypeName() const { return "Thread"; } static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Thread; } Kernel::HandleType GetHandleType() const { return Kernel::HandleType::Thread; } @@ -71,7 +70,7 @@ public: std::vector<Handle> waiting_threads; - char name[Kernel::MAX_NAME_LENGTH + 1]; + std::string name; }; // Lists all thread ids that aren't deleted/etc. @@ -336,9 +335,7 @@ Thread* CreateThread(Handle& handle, const char* name, u32 entry_point, s32 prio thread->processor_id = processor_id; thread->wait_type = WAITTYPE_NONE; thread->wait_handle = 0; - - strncpy(thread->name, name, Kernel::MAX_NAME_LENGTH); - thread->name[Kernel::MAX_NAME_LENGTH] = '\0'; + thread->name = name; return thread; } diff --git a/src/core/hle/service/apt.h b/src/core/hle/service/apt.h index dca3097ed..4c7dd07e7 100644 --- a/src/core/hle/service/apt.h +++ b/src/core/hle/service/apt.h @@ -29,7 +29,7 @@ public: * Gets the string port name used by CTROS for the service * @return Port name of service */ - const char *GetPortName() const { + std::string GetPortName() const { return "APT:U"; } }; diff --git a/src/core/hle/service/fs.h b/src/core/hle/service/fs.h index fabf5ac7e..36f3697d3 100644 --- a/src/core/hle/service/fs.h +++ b/src/core/hle/service/fs.h @@ -23,7 +23,7 @@ public: * Gets the string port name used by CTROS for the service * @return Port name of service */ - const char *GetPortName() const { + std::string GetPortName() const { return "fs:USER"; } }; diff --git a/src/core/hle/service/gsp.h b/src/core/hle/service/gsp.h index fccebef7e..b25dbb7bc 100644 --- a/src/core/hle/service/gsp.h +++ b/src/core/hle/service/gsp.h @@ -137,7 +137,7 @@ public: * Gets the string port name used by CTROS for the service * @return Port name of service */ - const char *GetPortName() const { + std::string GetPortName() const { return "gsp::Gpu"; } diff --git a/src/core/hle/service/hid.h b/src/core/hle/service/hid.h index 81c29eb2e..b17fcfa86 100644 --- a/src/core/hle/service/hid.h +++ b/src/core/hle/service/hid.h @@ -25,7 +25,7 @@ public: * Gets the string port name used by CTROS for the service * @return Port name of service */ - const char *GetPortName() const { + std::string GetPortName() const { return "hid:USER"; } diff --git a/src/core/hle/service/ndm.h b/src/core/hle/service/ndm.h index fbe88fb8f..d5ec28f5b 100644 --- a/src/core/hle/service/ndm.h +++ b/src/core/hle/service/ndm.h @@ -24,7 +24,7 @@ public: * Gets the string port name used by CTROS for the service * @return Port name of service */ - const char *GetPortName() const { + std::string GetPortName() const { return "ndm:u"; } diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index dcd525727..cb1ecde31 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -39,8 +39,8 @@ class Interface : public Kernel::Object { friend class Manager; public: - const char *GetName() const { return GetPortName(); } - const char *GetTypeName() const { return GetPortName(); } + std::string GetName() const { return GetPortName(); } + std::string GetTypeName() const { return GetPortName(); } static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Service; } Kernel::HandleType GetHandleType() const { return Kernel::HandleType::Service; } @@ -57,7 +57,7 @@ public: * Gets the string name used by CTROS for a service * @return Port name of service */ - virtual const char *GetPortName() const { + virtual std::string GetPortName() const { return "[UNKNOWN SERVICE PORT]"; } @@ -86,7 +86,7 @@ public: if (itr == m_functions.end()) { ERROR_LOG(OSHLE, "unknown/unimplemented function: port=%s, command=0x%08X", - GetPortName(), cmd_buff[0]); + GetPortName().c_str(), cmd_buff[0]); // TODO(bunnei): Hack - ignore error u32* cmd_buff = Service::GetCommandBuffer(); @@ -95,7 +95,7 @@ public: } if (itr->second.func == nullptr) { ERROR_LOG(OSHLE, "unimplemented function: port=%s, name=%s", - GetPortName(), itr->second.name.c_str()); + GetPortName().c_str(), itr->second.name.c_str()); // TODO(bunnei): Hack - ignore error u32* cmd_buff = Service::GetCommandBuffer(); diff --git a/src/core/hle/service/srv.h b/src/core/hle/service/srv.h index 81109a2a8..9451472de 100644 --- a/src/core/hle/service/srv.h +++ b/src/core/hle/service/srv.h @@ -22,7 +22,7 @@ public: * Gets the string name used by CTROS for the service * @return Port name of service */ - const char *GetPortName() const { + std::string GetPortName() const { return "srv:"; } diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index 8720bed31..bdcfae6f5 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp @@ -92,7 +92,7 @@ Result SendSyncRequest(Handle handle) { Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handle); _assert_msg_(KERNEL, (object != nullptr), "called, but kernel object is nullptr!"); - DEBUG_LOG(SVC, "called handle=0x%08X(%s)", handle, object->GetTypeName()); + DEBUG_LOG(SVC, "called handle=0x%08X(%s)", handle, object->GetTypeName().c_str()); bool wait = false; Result res = object->SyncRequest(&wait); @@ -118,8 +118,8 @@ Result WaitSynchronization1(Handle handle, s64 nano_seconds) { Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handle); - DEBUG_LOG(SVC, "called handle=0x%08X(%s:%s), nanoseconds=%d", handle, object->GetTypeName(), - object->GetName(), nano_seconds); + DEBUG_LOG(SVC, "called handle=0x%08X(%s:%s), nanoseconds=%d", handle, object->GetTypeName().c_str(), + object->GetName().c_str(), nano_seconds); _assert_msg_(KERNEL, (object != nullptr), "called, but kernel object is nullptr!"); @@ -152,8 +152,8 @@ Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count, bool wa _assert_msg_(KERNEL, (object != nullptr), "called handle=0x%08X, but kernel object " "is nullptr!", handles[i]); - DEBUG_LOG(SVC, "\thandle[%d] = 0x%08X(%s:%s)", i, handles[i], object->GetTypeName(), - object->GetName()); + DEBUG_LOG(SVC, "\thandle[%d] = 0x%08X(%s:%s)", i, handles[i], object->GetTypeName().c_str(), + object->GetName().c_str()); Result res = object->WaitSynchronization(&wait); @@ -330,6 +330,11 @@ void SleepThread(s64 nanoseconds) { DEBUG_LOG(SVC, "called nanoseconds=%d", nanoseconds); } +/// This returns the total CPU ticks elapsed since the CPU was powered-on +s64 GetSystemTick() { + return (s64)Core::g_app_core->GetTicks(); +} + const HLE::FunctionDef SVC_Table[] = { {0x00, nullptr, "Unknown"}, {0x01, HLE::Wrap<ControlMemory>, "ControlMemory"}, @@ -371,7 +376,7 @@ const HLE::FunctionDef SVC_Table[] = { {0x25, HLE::Wrap<WaitSynchronizationN>, "WaitSynchronizationN"}, {0x26, nullptr, "SignalAndWait"}, {0x27, HLE::Wrap<DuplicateHandle>, "DuplicateHandle"}, - {0x28, nullptr, "GetSystemTick"}, + {0x28, HLE::Wrap<GetSystemTick>, "GetSystemTick"}, {0x29, nullptr, "GetHandleInfo"}, {0x2A, nullptr, "GetSystemInfo"}, {0x2B, nullptr, "GetProcessInfo"}, |