[kernel] Refactor uses of attribute names
This commit is contained in:
parent
38d589d1e0
commit
91f4954967
|
@ -7,6 +7,7 @@
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "xenia/base/assert.h"
|
||||||
#include "xenia/base/logging.h"
|
#include "xenia/base/logging.h"
|
||||||
#include "xenia/kernel/kernel_state.h"
|
#include "xenia/kernel/kernel_state.h"
|
||||||
#include "xenia/kernel/util/shim_utils.h"
|
#include "xenia/kernel/util/shim_utils.h"
|
||||||
|
@ -31,10 +32,15 @@ dword_result_t ObOpenObjectByName_entry(lpunknown_t obj_attributes_ptr,
|
||||||
// r5 = 0
|
// r5 = 0
|
||||||
// r6 = out_ptr (handle?)
|
// r6 = out_ptr (handle?)
|
||||||
|
|
||||||
auto name = util::TranslateAnsiStringAddress(
|
if (!obj_attributes_ptr) {
|
||||||
kernel_memory(),
|
return X_STATUS_INVALID_PARAMETER;
|
||||||
xe::load_and_swap<uint32_t>(kernel_memory()->TranslateVirtual(
|
}
|
||||||
obj_attributes_ptr.guest_address() + 4)));
|
|
||||||
|
auto obj_attributes = kernel_memory()->TranslateVirtual<X_OBJECT_ATTRIBUTES*>(
|
||||||
|
obj_attributes_ptr);
|
||||||
|
assert_true(obj_attributes->name_ptr != 0);
|
||||||
|
auto name = util::TranslateAnsiStringAddress(kernel_memory(),
|
||||||
|
obj_attributes->name_ptr);
|
||||||
|
|
||||||
X_HANDLE handle = X_INVALID_HANDLE_VALUE;
|
X_HANDLE handle = X_INVALID_HANDLE_VALUE;
|
||||||
X_STATUS result =
|
X_STATUS result =
|
||||||
|
|
|
@ -74,10 +74,12 @@ object_ref<T> LookupNamedObject(KernelState* kernel_state,
|
||||||
if (!obj_attributes_ptr) {
|
if (!obj_attributes_ptr) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
auto name = util::TranslateAnsiStringAddress(
|
auto obj_attributes =
|
||||||
kernel_state->memory(),
|
kernel_state->memory()->TranslateVirtual<X_OBJECT_ATTRIBUTES*>(
|
||||||
xe::load_and_swap<uint32_t>(
|
obj_attributes_ptr);
|
||||||
kernel_state->memory()->TranslateVirtual(obj_attributes_ptr + 4)));
|
assert_true(obj_attributes->name_ptr != 0);
|
||||||
|
auto name = util::TranslateAnsiStringAddress(kernel_state->memory(),
|
||||||
|
obj_attributes->name_ptr);
|
||||||
if (!name.empty()) {
|
if (!name.empty()) {
|
||||||
X_HANDLE handle = X_INVALID_HANDLE_VALUE;
|
X_HANDLE handle = X_INVALID_HANDLE_VALUE;
|
||||||
X_RESULT result =
|
X_RESULT result =
|
||||||
|
|
Loading…
Reference in New Issue