Stubbed out enumeration.
This commit is contained in:
parent
f04c7b8661
commit
19149bbba6
|
@ -1,6 +1,8 @@
|
|||
# Copyright 2013 Ben Vanik. All Rights Reserved.
|
||||
{
|
||||
'sources': [
|
||||
'xenumerator.cc',
|
||||
'xenumerator.h',
|
||||
'xevent.cc',
|
||||
'xevent.h',
|
||||
'xfile.cc',
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* Xenia : Xbox 360 Emulator Research Project *
|
||||
******************************************************************************
|
||||
* Copyright 2014 Ben Vanik. All rights reserved. *
|
||||
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include <xenia/kernel/objects/xenumerator.h>
|
||||
|
||||
|
||||
using namespace xe;
|
||||
using namespace xe::kernel;
|
||||
|
||||
|
||||
XEnumerator::XEnumerator(KernelState* kernel_state) :
|
||||
XObject(kernel_state, kTypeEnumerator) {
|
||||
}
|
||||
|
||||
XEnumerator::~XEnumerator() {
|
||||
}
|
||||
|
||||
void XEnumerator::Initialize() {
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* Xenia : Xbox 360 Emulator Research Project *
|
||||
******************************************************************************
|
||||
* Copyright 2014 Ben Vanik. All rights reserved. *
|
||||
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_XENUMERATOR_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_XENUMERATOR_H_
|
||||
|
||||
#include <xenia/kernel/xobject.h>
|
||||
|
||||
#include <xenia/xbox.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
||||
|
||||
class XEnumerator : public XObject {
|
||||
public:
|
||||
XEnumerator(KernelState* kernel_state);
|
||||
virtual ~XEnumerator();
|
||||
|
||||
void Initialize();
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_XENUMERATOR_H_
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <xenia/kernel/kernel_state.h>
|
||||
#include <xenia/kernel/xam_private.h>
|
||||
#include <xenia/kernel/objects/xenumerator.h>
|
||||
#include <xenia/kernel/util/shim_utils.h>
|
||||
#include <xenia/kernel/util/xex2.h>
|
||||
|
||||
|
@ -102,6 +103,42 @@ SHIM_CALL XamLoaderGetLaunchData_shim(
|
|||
}
|
||||
|
||||
|
||||
SHIM_CALL XamEnumerate_shim(
|
||||
PPCContext* ppc_state, KernelState* state) {
|
||||
uint32_t handle = SHIM_GET_ARG_32(0);
|
||||
uint32_t zero = SHIM_GET_ARG_32(1);
|
||||
uint32_t buffer_ptr = SHIM_GET_ARG_32(2);
|
||||
uint32_t buffer_length = SHIM_GET_ARG_32(3);
|
||||
uint32_t item_count_ptr = SHIM_GET_ARG_32(4);
|
||||
uint32_t overlapped_ptr = SHIM_GET_ARG_32(5);
|
||||
|
||||
XELOGD(
|
||||
"XamEnumerate(%.8X, %d, %d, %.8X, %d, %.8X, %.8X)",
|
||||
handle, zero, buffer_ptr, buffer_length, item_count_ptr,
|
||||
overlapped_ptr);
|
||||
|
||||
XEnumerator* e = nullptr;
|
||||
if (XFAILED(state->object_table()->GetObject(
|
||||
handle, (XObject**)&e))) {
|
||||
SHIM_SET_RETURN_64(X_ERROR_INVALID_HANDLE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item_count_ptr) {
|
||||
SHIM_SET_MEM_32(item_count_ptr, 0);
|
||||
} else if (overlapped_ptr) {
|
||||
// TODO(benvanik): overlapped IO.
|
||||
assert_zero(overlapped_ptr);
|
||||
} else {
|
||||
assert_always();
|
||||
}
|
||||
|
||||
e->Release();
|
||||
|
||||
SHIM_SET_RETURN_64(0);
|
||||
}
|
||||
|
||||
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
|
@ -115,4 +152,6 @@ void xe::kernel::xam::RegisterInfoExports(
|
|||
|
||||
SHIM_SET_MAPPING("xam.xex", XamLoaderGetLaunchDataSize, state);
|
||||
SHIM_SET_MAPPING("xam.xex", XamLoaderGetLaunchData, state);
|
||||
|
||||
SHIM_SET_MAPPING("xam.xex", XamEnumerate, state);
|
||||
}
|
||||
|
|
|
@ -74,6 +74,46 @@ SHIM_CALL XMsgInProcessCall_shim(
|
|||
}
|
||||
|
||||
|
||||
SHIM_CALL XMsgStartIORequest_shim(
|
||||
PPCContext* ppc_state, KernelState* state) {
|
||||
uint32_t app = SHIM_GET_ARG_32(0);
|
||||
uint32_t message = SHIM_GET_ARG_32(1);
|
||||
uint32_t overlapped_ptr = SHIM_GET_ARG_32(2);
|
||||
uint32_t buffer = SHIM_GET_ARG_32(3);
|
||||
uint32_t buffer_length = SHIM_GET_ARG_32(4);
|
||||
|
||||
XELOGD(
|
||||
"XMsgStartIORequest(%.8X, %.8X, %.8X, %.8X, %d)",
|
||||
app, message, overlapped_ptr, buffer, buffer_length);
|
||||
|
||||
bool handled = false;
|
||||
|
||||
assert_zero(overlapped_ptr);
|
||||
|
||||
// TODO(benvanik): build XMsg pump? async/sync/etc
|
||||
if (app == 0xFA) {
|
||||
// XMP = music
|
||||
// http://freestyledash.googlecode.com/svn-history/r1/trunk/Freestyle/Scenes/Media/Music/ScnMusic.cpp
|
||||
if (message == 0x00070009) {
|
||||
assert(buffer_length == 8);
|
||||
uint32_t a = SHIM_MEM_32(buffer + 0); // 0x00000002
|
||||
uint32_t b = SHIM_MEM_32(buffer + 4); // out ptr to 4b - expect 0
|
||||
XELOGD("XMPGetStatusEx(%.8X, %.8X)", a, b);
|
||||
assert_true(a == 2);
|
||||
SHIM_SET_MEM_32(b, 0);
|
||||
Sleep(1);
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!handled) {
|
||||
XELOGE("Unimplemented XMsgStartIORequest message!");
|
||||
}
|
||||
|
||||
SHIM_SET_RETURN_32(handled ? X_ERROR_SUCCESS : X_ERROR_NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
SHIM_CALL XMsgCancelIORequest_shim(
|
||||
PPCContext* ppc_state, KernelState* state) {
|
||||
uint32_t overlapped_ptr = SHIM_GET_ARG_32(0);
|
||||
|
@ -97,5 +137,6 @@ SHIM_CALL XMsgCancelIORequest_shim(
|
|||
void xe::kernel::xam::RegisterMsgExports(
|
||||
ExportResolver* export_resolver, KernelState* state) {
|
||||
SHIM_SET_MAPPING("xam.xex", XMsgInProcessCall, state);
|
||||
SHIM_SET_MAPPING("xam.xex", XMsgStartIORequest, state);
|
||||
SHIM_SET_MAPPING("xam.xex", XMsgCancelIORequest, state);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <xenia/kernel/kernel_state.h>
|
||||
#include <xenia/kernel/xam_private.h>
|
||||
#include <xenia/kernel/objects/xenumerator.h>
|
||||
#include <xenia/kernel/util/shim_utils.h>
|
||||
|
||||
|
||||
|
@ -191,6 +192,30 @@ SHIM_CALL XamShowSigninUI_shim(
|
|||
}
|
||||
|
||||
|
||||
SHIM_CALL XamUserCreateAchievementEnumerator_shim(
|
||||
PPCContext* ppc_state, KernelState* state) {
|
||||
uint32_t title_id = SHIM_GET_ARG_32(0);
|
||||
uint32_t user_index = SHIM_GET_ARG_32(1);
|
||||
uint32_t xuid = SHIM_GET_ARG_32(2);
|
||||
uint32_t flags = SHIM_GET_ARG_32(3);
|
||||
uint32_t offset = SHIM_GET_ARG_32(4);
|
||||
uint32_t count = SHIM_GET_ARG_32(5);
|
||||
uint32_t buffer = SHIM_GET_ARG_32(6);
|
||||
uint32_t handle_ptr = SHIM_GET_ARG_32(7);
|
||||
|
||||
XELOGD(
|
||||
"XamUserCreateAchievementEnumerator(%.8X, %d, %.8X, %.8X, %d, %d, %.8X, %.8X)",
|
||||
title_id, user_index, xuid, flags, offset, count, buffer, handle_ptr);
|
||||
|
||||
XEnumerator* e = new XEnumerator(state);
|
||||
e->Initialize();
|
||||
|
||||
SHIM_SET_MEM_32(handle_ptr, e->handle());
|
||||
|
||||
SHIM_SET_RETURN_32(X_ERROR_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
|
@ -203,4 +228,5 @@ void xe::kernel::xam::RegisterUserExports(
|
|||
SHIM_SET_MAPPING("xam.xex", XamUserGetName, state);
|
||||
SHIM_SET_MAPPING("xam.xex", XamUserReadProfileSettings, state);
|
||||
SHIM_SET_MAPPING("xam.xex", XamShowSigninUI, state);
|
||||
SHIM_SET_MAPPING("xam.xex", XamUserCreateAchievementEnumerator, state);
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ public:
|
|||
kTypeNotifyListener,
|
||||
kTypeMutant,
|
||||
kTypeTimer,
|
||||
kTypeEnumerator,
|
||||
};
|
||||
|
||||
XObject(KernelState* kernel_state, Type type);
|
||||
|
|
|
@ -63,6 +63,7 @@ typedef uint32_t X_RESULT;
|
|||
#define X_HRESULT_FROM_WIN32(x) ((X_RESULT)(x) <= 0 ? ((X_RESULT)(x)) : ((X_RESULT) (((x) & 0x0000FFFF) | (X_FACILITY_WIN32 << 16) | 0x80000000)))
|
||||
#define X_ERROR_SUCCESS X_HRESULT_FROM_WIN32(0x00000000L)
|
||||
#define X_ERROR_ACCESS_DENIED X_HRESULT_FROM_WIN32(0x00000005L)
|
||||
#define X_ERROR_INVALID_HANDLE X_HRESULT_FROM_WIN32(0x00000006L)
|
||||
#define X_ERROR_NO_MORE_FILES X_HRESULT_FROM_WIN32(0x00000018L)
|
||||
#define X_ERROR_INSUFFICIENT_BUFFER X_HRESULT_FROM_WIN32(0x0000007AL)
|
||||
#define X_ERROR_BAD_ARGUMENTS X_HRESULT_FROM_WIN32(0x000000A0L)
|
||||
|
@ -191,6 +192,35 @@ typedef enum _X_FILE_INFORMATION_CLASS {
|
|||
} X_FILE_INFORMATION_CLASS;
|
||||
|
||||
|
||||
inline void XOverlappedSetResult(void* ptr, uint32_t value) {
|
||||
auto p = reinterpret_cast<uint32_t*>(ptr);
|
||||
p[0] = value;
|
||||
}
|
||||
inline void XOverlappedSetLength(void* ptr, uint32_t value) {
|
||||
auto p = reinterpret_cast<uint32_t*>(ptr);
|
||||
p[1] = value;
|
||||
}
|
||||
inline void XOverlappedSetContext(void* ptr, uint32_t value) {
|
||||
auto p = reinterpret_cast<uint32_t*>(ptr);
|
||||
p[2] = value;
|
||||
}
|
||||
inline void XOverlappedSetExtendedError(void* ptr, uint32_t value) {
|
||||
auto p = reinterpret_cast<uint32_t*>(ptr);
|
||||
p[7] = value;
|
||||
}
|
||||
inline X_HANDLE XOverlappedGetEvent(void* ptr) {
|
||||
auto p = reinterpret_cast<uint32_t*>(ptr);
|
||||
return p[4];
|
||||
}
|
||||
inline uint32_t XOverlappedGetCompletionRoutine(void* ptr) {
|
||||
auto p = reinterpret_cast<uint32_t*>(ptr);
|
||||
return p[5];
|
||||
}
|
||||
inline uint32_t XOverlappedGetCompletionContext(void* ptr) {
|
||||
auto p = reinterpret_cast<uint32_t*>(ptr);
|
||||
return p[6];
|
||||
}
|
||||
|
||||
class X_ANSI_STRING {
|
||||
private:
|
||||
uint16_t length;
|
||||
|
|
Loading…
Reference in New Issue