Templated XUserModule::GetOptHeader

This commit is contained in:
Dr. Chat
2015-07-03 10:24:11 -05:00
parent 82ec1c345d
commit a25090f3ca
4 changed files with 10 additions and 4 deletions

View File

@@ -166,7 +166,7 @@ X_STATUS XThread::Create() {
// Games will specify a certain number of 4b slots that each thread will get.
xex2_opt_tls_info* tls_header = nullptr;
if (module) {
module->GetOptHeader(XEX_HEADER_TLS_INFO, (void**)&tls_header);
module->GetOptHeader(XEX_HEADER_TLS_INFO, &tls_header);
}
const uint32_t kDefaultTlsSlotCount = 32;

View File

@@ -47,6 +47,12 @@ class XUserModule : public XModule {
// Get optional header - FOR HOST USE ONLY!
X_STATUS GetOptHeader(xe_xex2_header_keys key, void** out_ptr);
// Get optional header - FOR HOST USE ONLY!
template <typename T>
X_STATUS GetOptHeader(xe_xex2_header_keys key, T* out_ptr) {
return GetOptHeader(key, reinterpret_cast<void**>(out_ptr));
}
// Get optional header that can safely be returned to guest code.
X_STATUS GetOptHeader(xe_xex2_header_keys key,
uint32_t* out_header_guest_ptr);