Templated XUserModule::GetOptHeader
This commit is contained in:
parent
82ec1c345d
commit
a25090f3ca
|
@ -123,7 +123,7 @@ uint32_t KernelState::title_id() const {
|
||||||
|
|
||||||
xex2_opt_execution_info* exec_info = 0;
|
xex2_opt_execution_info* exec_info = 0;
|
||||||
executable_module_->GetOptHeader(XEX_HEADER_EXECUTION_INFO,
|
executable_module_->GetOptHeader(XEX_HEADER_EXECUTION_INFO,
|
||||||
(void**)&exec_info);
|
&exec_info);
|
||||||
|
|
||||||
if (exec_info) {
|
if (exec_info) {
|
||||||
return exec_info->title_id;
|
return exec_info->title_id;
|
||||||
|
@ -202,7 +202,7 @@ void KernelState::SetExecutableModule(object_ref<XUserModule> module) {
|
||||||
}
|
}
|
||||||
|
|
||||||
xex2_opt_tls_info* tls_header = nullptr;
|
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) {
|
if (tls_header) {
|
||||||
auto pib = memory_->TranslateVirtual<ProcessInfoBlock*>(
|
auto pib = memory_->TranslateVirtual<ProcessInfoBlock*>(
|
||||||
process_info_block_address_);
|
process_info_block_address_);
|
||||||
|
|
|
@ -166,7 +166,7 @@ X_STATUS XThread::Create() {
|
||||||
// Games will specify a certain number of 4b slots that each thread will get.
|
// Games will specify a certain number of 4b slots that each thread will get.
|
||||||
xex2_opt_tls_info* tls_header = nullptr;
|
xex2_opt_tls_info* tls_header = nullptr;
|
||||||
if (module) {
|
if (module) {
|
||||||
module->GetOptHeader(XEX_HEADER_TLS_INFO, (void**)&tls_header);
|
module->GetOptHeader(XEX_HEADER_TLS_INFO, &tls_header);
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint32_t kDefaultTlsSlotCount = 32;
|
const uint32_t kDefaultTlsSlotCount = 32;
|
||||||
|
|
|
@ -47,6 +47,12 @@ class XUserModule : public XModule {
|
||||||
// Get optional header - FOR HOST USE ONLY!
|
// Get optional header - FOR HOST USE ONLY!
|
||||||
X_STATUS GetOptHeader(xe_xex2_header_keys key, void** out_ptr);
|
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.
|
// Get optional header that can safely be returned to guest code.
|
||||||
X_STATUS GetOptHeader(xe_xex2_header_keys key,
|
X_STATUS GetOptHeader(xe_xex2_header_keys key,
|
||||||
uint32_t* out_header_guest_ptr);
|
uint32_t* out_header_guest_ptr);
|
||||||
|
|
|
@ -143,7 +143,7 @@ SHIM_CALL XexCheckExecutablePrivilege_shim(PPCContext* ppc_context,
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t flags = 0;
|
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);
|
SHIM_SET_RETURN_32((flags & mask) > 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue