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

@ -123,7 +123,7 @@ uint32_t KernelState::title_id() const {
xex2_opt_execution_info* exec_info = 0;
executable_module_->GetOptHeader(XEX_HEADER_EXECUTION_INFO,
(void**)&exec_info);
&exec_info);
if (exec_info) {
return exec_info->title_id;
@ -202,7 +202,7 @@ void KernelState::SetExecutableModule(object_ref<XUserModule> module) {
}
xex2_opt_tls_info* tls_header = nullptr;
executable_module_->GetOptHeader(XEX_HEADER_TLS_INFO, (void**)&tls_header);
executable_module_->GetOptHeader(XEX_HEADER_TLS_INFO, &tls_header);
if (tls_header) {
auto pib = memory_->TranslateVirtual<ProcessInfoBlock*>(
process_info_block_address_);

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);

View File

@ -143,7 +143,7 @@ SHIM_CALL XexCheckExecutablePrivilege_shim(PPCContext* ppc_context,
}
uint32_t flags = 0;
module->GetOptHeader(XEX_HEADER_SYSTEM_FLAGS, (void **)&flags);
module->GetOptHeader<uint32_t>(XEX_HEADER_SYSTEM_FLAGS, &flags);
SHIM_SET_RETURN_32((flags & mask) > 0);
}