diff options
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | externals/qhexedit/CMakeLists.txt | 10 | ||||
-rw-r--r-- | src/citra_qt/CMakeLists.txt | 32 | ||||
-rw-r--r-- | src/common/symbols.cpp | 2 | ||||
-rw-r--r-- | src/common/symbols.h | 2 | ||||
-rw-r--r-- | src/core/hle/function_wrappers.h | 60 | ||||
-rw-r--r-- | src/core/hle/svc.cpp | 7 |
7 files changed, 66 insertions, 49 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c7d98347..ed790adf7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 2.8.6) project(citra) diff --git a/externals/qhexedit/CMakeLists.txt b/externals/qhexedit/CMakeLists.txt index cfe168ef3..29ed5d2ba 100644 --- a/externals/qhexedit/CMakeLists.txt +++ b/externals/qhexedit/CMakeLists.txt @@ -1,13 +1,15 @@ +set(CMAKE_AUTOMOC ON) + set(SRCS commands.cpp qhexedit.cpp qhexedit_p.cpp xbytearray.cpp) -qt4_wrap_cpp(MOC_SRCS - qhexedit.h - qhexedit_p.h) +set(HEADERS + qhexedit.h + qhexedit_p.h) include_directories(${CMAKE_CURRENT_BINARY_DIR}) -add_library(qhexedit STATIC ${SRCS} ${MOC_SRCS}) +add_library(qhexedit STATIC ${SRCS} ${HEADERS}) diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index 7f880df8b..5ce4e3f16 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt @@ -1,3 +1,6 @@ +set(CMAKE_AUTOMOC ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + set(SRCS bootmanager.cpp debugger/callstack.cpp @@ -10,6 +13,7 @@ set(SRCS main.cpp config/controller_config.cpp config/controller_config_util.cpp) + set (HEADERS bootmanager.hxx debugger/callstack.hxx @@ -18,12 +22,6 @@ set (HEADERS debugger/registers.hxx hotkeys.hxx main.hxx - ui_callstack.h - ui_controller_config.h - ui_disassembler.h - ui_hotkeys.h - ui_main.h - ui_registers.h version.h config/controller_config.hxx config/controller_config_util.hxx) @@ -36,28 +34,16 @@ qt4_wrap_ui(UI_HDRS main.ui config/controller_config.ui) -qt4_wrap_cpp(MOC_SRCS - bootmanager.hxx - debugger/callstack.hxx - debugger/disassembler.hxx - debugger/graphics.hxx - debugger/graphics_cmdlists.hxx - debugger/registers.hxx - debugger/ramview.hxx - hotkeys.hxx - main.hxx - config/controller_config.hxx - config/controller_config_util.hxx) - # add uic results to include directories include_directories(${CMAKE_CURRENT_BINARY_DIR}) -include_directories(./) -add_executable(citra-qt ${SRCS} ${HEADERS} ${MOC_SRCS} ${UI_HDRS}) +add_executable(citra-qt ${SRCS} ${UI_HDRS}) if (APPLE) - target_link_libraries(citra-qt core common video_core qhexedit iconv ${COREFOUNDATION_LIBRARY} ${QT_LIBRARIES} ${GLEW_LIBRARY} ${OPENGL_LIBRARIES}) + set(ICONV_LIBRARY iconv) else() - target_link_libraries(citra-qt core common video_core qhexedit ${QT_LIBRARIES} ${OPENGL_LIBRARIES} ${SDL2_LIBRARY} rt GLEW ${GLFW_LIBRARIES}) + 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}) + #install(TARGETS citra-qt RUNTIME DESTINATION ${bindir}) diff --git a/src/common/symbols.cpp b/src/common/symbols.cpp index dcc9eeac5..d61f4c0c6 100644 --- a/src/common/symbols.cpp +++ b/src/common/symbols.cpp @@ -40,7 +40,7 @@ namespace Symbols return symbol; } - const std::string& GetName(u32 _address) + const std::string GetName(u32 _address) { return GetSymbol(_address).name; } diff --git a/src/common/symbols.h b/src/common/symbols.h index b76749654..e59bc5dd4 100644 --- a/src/common/symbols.h +++ b/src/common/symbols.h @@ -32,7 +32,7 @@ namespace Symbols void Add(u32 _address, const std::string& _name, u32 _size, u32 _type); TSymbol GetSymbol(u32 _address); - const std::string& GetName(u32 _address); + const std::string GetName(u32 _address); void Remove(u32 _address); void Clear(); }; 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/svc.cpp b/src/core/hle/svc.cpp index 28f2844eb..bdcfae6f5 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp @@ -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"}, |