Starting to reverse XGI app.

This commit is contained in:
Ben Vanik 2015-02-01 17:25:18 -08:00
parent 5f3ab7979f
commit 5b759d387c
6 changed files with 126 additions and 5 deletions

View File

@ -105,7 +105,8 @@ bool GL4Shader::PrepareVertexArrayObject() {
: GL_UNSIGNED_INT_2_10_10_10_REV; : GL_UNSIGNED_INT_2_10_10_10_REV;
break; break;
case VertexFormat::k_10_11_11: case VertexFormat::k_10_11_11:
assert_false(el.is_signed); // assert_false(el.is_signed);
XELOGW("Signed k_10_11_11 vertex format not supported by GL");
comp_type = GL_UNSIGNED_INT_10F_11F_11F_REV; comp_type = GL_UNSIGNED_INT_10F_11F_11F_REV;
break; break;
/*case VertexFormat::k_11_11_10: /*case VertexFormat::k_11_11_10:

View File

@ -9,6 +9,7 @@
#include "xenia/kernel/apps/apps.h" #include "xenia/kernel/apps/apps.h"
#include "xenia/kernel/apps/xgi_app.h"
#include "xenia/kernel/apps/xmp_app.h" #include "xenia/kernel/apps/xmp_app.h"
namespace xe { namespace xe {
@ -16,6 +17,7 @@ namespace kernel {
namespace apps { namespace apps {
void RegisterApps(KernelState* kernel_state, XAppManager* manager) { void RegisterApps(KernelState* kernel_state, XAppManager* manager) {
manager->RegisterApp(std::make_unique<XXGIApp>(kernel_state));
manager->RegisterApp(std::make_unique<XXMPApp>(kernel_state)); manager->RegisterApp(std::make_unique<XXMPApp>(kernel_state));
} }

View File

@ -3,6 +3,8 @@
'sources': [ 'sources': [
'apps.cc', 'apps.cc',
'apps.h', 'apps.h',
'xgi_app.cc',
'xgi_app.h',
'xmp_app.cc', 'xmp_app.cc',
'xmp_app.h', 'xmp_app.h',
], ],

View File

@ -0,0 +1,77 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2015 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include "xenia/kernel/apps/xgi_app.h"
#include "poly/threading.h"
namespace xe {
namespace kernel {
namespace apps {
XXGIApp::XXGIApp(KernelState* kernel_state) : XApp(kernel_state, 0xFB) {}
// http://mb.mirage.org/bugzilla/xliveless/main.c
X_RESULT XXGIApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
uint32_t buffer_length) {
// NOTE: buffer_length may be zero or valid.
switch (message) {
case 0x000B0006: {
assert_true(!buffer_length || buffer_length == 24);
// dword r3 user index
// dword (unwritten?)
// qword 0
// dword r4 context enum
// dword r5 value
uint32_t user_index =
poly::load_and_swap<uint32_t>(membase_ + buffer_ptr + 0);
uint32_t context_id =
poly::load_and_swap<uint32_t>(membase_ + buffer_ptr + 16);
uint32_t context_value =
poly::load_and_swap<uint32_t>(membase_ + buffer_ptr + 20);
XELOGD("XUserSetContextEx(%.8X, %.8X, %.8X)", user_index, context_id,
context_value);
return X_ERROR_SUCCESS;
}
case 0x000B0007: {
// TODO(benvanik): reverse.
assert_always();
XELOGD("XUserSetPropertyEx(...) - XGI 0x000B0007, unimplemented");
return X_ERROR_SUCCESS;
}
case 0x000B0008: {
assert_true(!buffer_length || buffer_length == 8);
uint32_t achievement_count =
poly::load_and_swap<uint32_t>(membase_ + buffer_ptr + 0);
uint32_t achievements_ptr =
poly::load_and_swap<uint32_t>(membase_ + buffer_ptr + 4);
XELOGD("XUserWriteAchievements(%.8X, %.8X)", achievement_count,
achievements_ptr);
return X_ERROR_SUCCESS;
}
case 0x000B0041: {
// TODO(benvanik): reverse.
assert_always();
XELOGD("XUserGetContext(...) - XGI 0x000B0041, unimplemented");
return X_ERROR_SUCCESS;
}
case 0x000B0071: {
XELOGD("XGI 0x000B0071, unimplemented");
return X_ERROR_SUCCESS;
}
}
XELOGE("Unimplemented XMsg message app=%.8X, msg=%.8X, arg1=%.8X, arg2=%.8X",
app_id(), message, buffer_ptr, buffer_length);
return X_ERROR_NOT_FOUND;
}
} // namespace apps
} // namespace kernel
} // namespace xe

View File

@ -0,0 +1,35 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2015 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_KERNEL_XBOXKRNL_APPS_XGI_APP_H_
#define XENIA_KERNEL_XBOXKRNL_APPS_XGI_APP_H_
#include "xenia/common.h"
#include "xenia/kernel/app.h"
#include "xenia/kernel/kernel_state.h"
namespace xe {
namespace kernel {
namespace apps {
class XXGIApp : public XApp {
public:
XXGIApp(KernelState* kernel_state);
X_RESULT DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
uint32_t buffer_length) override;
private:
};
} // namespace apps
} // namespace kernel
} // namespace xe
#endif // XENIA_KERNEL_XBOXKRNL_APPS_XGI_APP_H_

View File

@ -43,13 +43,15 @@ SHIM_CALL XMsgStartIORequest_shim(PPCContext* ppc_state, KernelState* state) {
XELOGD("XMsgStartIORequest(%.8X, %.8X, %.8X, %.8X, %d)", app, message, XELOGD("XMsgStartIORequest(%.8X, %.8X, %.8X, %.8X, %d)", app, message,
overlapped_ptr, buffer, buffer_length); overlapped_ptr, buffer, buffer_length);
assert_zero(overlapped_ptr);
auto result = state->app_manager()->DispatchMessageAsync(app, message, buffer, auto result = state->app_manager()->DispatchMessageAsync(app, message, buffer,
buffer_length); buffer_length);
if (result == X_ERROR_NOT_FOUND) { if (result == X_ERROR_NOT_FOUND) {
XELOGE("XMsgStartIORequest: app %.8X undefined", app); XELOGE("XMsgStartIORequest: app %.8X undefined", app);
} }
if (overlapped_ptr) {
state->CompleteOverlappedImmediate(overlapped_ptr, result);
result = X_ERROR_IO_PENDING;
}
SHIM_SET_RETURN_32(result); SHIM_SET_RETURN_32(result);
} }
@ -64,13 +66,15 @@ SHIM_CALL XMsgStartIORequestEx_shim(PPCContext* ppc_state, KernelState* state) {
XELOGD("XMsgStartIORequestEx(%.8X, %.8X, %.8X, %.8X, %d, %.8X)", app, message, XELOGD("XMsgStartIORequestEx(%.8X, %.8X, %.8X, %.8X, %d, %.8X)", app, message,
overlapped_ptr, buffer, buffer_length, unknown_ptr); overlapped_ptr, buffer, buffer_length, unknown_ptr);
assert_zero(overlapped_ptr);
auto result = state->app_manager()->DispatchMessageAsync(app, message, buffer, auto result = state->app_manager()->DispatchMessageAsync(app, message, buffer,
buffer_length); buffer_length);
if (result == X_ERROR_NOT_FOUND) { if (result == X_ERROR_NOT_FOUND) {
XELOGE("XMsgStartIORequestEx: app %.8X undefined", app); XELOGE("XMsgStartIORequestEx: app %.8X undefined", app);
} }
if (overlapped_ptr) {
state->CompleteOverlappedImmediate(overlapped_ptr, result);
result = X_ERROR_IO_PENDING;
}
SHIM_SET_RETURN_32(result); SHIM_SET_RETURN_32(result);
} }