Various fiddlings.

This commit is contained in:
Ben Vanik 2014-06-22 19:41:26 -07:00
parent a5448b1296
commit 71eb408d67
9 changed files with 77 additions and 8 deletions

View File

@ -163,8 +163,10 @@ int D3D11ShaderTranslator::TranslateVertexShader(
" VS_OUTPUT o;\n"); " VS_OUTPUT o;\n");
// Always write position, as some shaders seem to only write certain values. // Always write position, as some shaders seem to only write certain values.
if (alloc_counts.positions) {
append( append(
" o.oPos = float4(0.0, 0.0, 0.0, 0.0);\n"); " o.oPos = float4(0.0, 0.0, 0.0, 0.0);\n");
}
if (alloc_counts.point_size) { if (alloc_counts.point_size) {
append( append(
" o.oPointSize = float4(1.0, 0.0, 0.0, 0.0);\n"); " o.oPointSize = float4(1.0, 0.0, 0.0, 0.0);\n");
@ -198,8 +200,11 @@ int D3D11ShaderTranslator::TranslateVertexShader(
} }
// main footer. // main footer.
if (alloc_counts.positions) {
append(
" o.oPos = applyViewport(o.oPos);\n");
}
append( append(
" o.oPos = applyViewport(o.oPos);\n"
" return o;\n" " return o;\n"
"};\n"); "};\n");

View File

@ -16,6 +16,7 @@
#include <xenia/kernel/xboxkrnl_private.h> #include <xenia/kernel/xboxkrnl_private.h>
#include <xenia/kernel/xobject.h> #include <xenia/kernel/xobject.h>
#include <xenia/kernel/objects/xmodule.h> #include <xenia/kernel/objects/xmodule.h>
#include <xenia/kernel/objects/xnotify_listener.h>
#include <xenia/kernel/objects/xthread.h> #include <xenia/kernel/objects/xthread.h>
#include <xenia/kernel/objects/xuser_module.h> #include <xenia/kernel/objects/xuser_module.h>
@ -135,3 +136,30 @@ XThread* KernelState::GetThreadByID(uint32_t thread_id) {
xe_mutex_unlock(object_mutex_); xe_mutex_unlock(object_mutex_);
return thread; return thread;
} }
void KernelState::RegisterNotifyListener(XNotifyListener* listener) {
xe_mutex_lock(object_mutex_);
notify_listeners_.push_back(listener);
xe_mutex_unlock(object_mutex_);
}
void KernelState::UnregisterNotifyListener(XNotifyListener* listener) {
xe_mutex_lock(object_mutex_);
for (auto it = notify_listeners_.begin(); it != notify_listeners_.end();
++it) {
if (*it == listener) {
notify_listeners_.erase(it);
break;
}
}
xe_mutex_unlock(object_mutex_);
}
void KernelState::BroadcastNotification(XNotificationID id, uint32_t data) {
xe_mutex_lock(object_mutex_);
for (auto it = notify_listeners_.begin(); it != notify_listeners_.end();
++it) {
(*it)->EnqueueNotification(id, data);
}
xe_mutex_unlock(object_mutex_);
}

View File

@ -23,6 +23,7 @@ XEDECLARECLASS1(xe, Emulator);
XEDECLARECLASS2(xe, cpu, Processor); XEDECLARECLASS2(xe, cpu, Processor);
XEDECLARECLASS2(xe, kernel, Dispatcher); XEDECLARECLASS2(xe, kernel, Dispatcher);
XEDECLARECLASS2(xe, kernel, XModule); XEDECLARECLASS2(xe, kernel, XModule);
XEDECLARECLASS2(xe, kernel, XNotifyListener);
XEDECLARECLASS2(xe, kernel, XThread); XEDECLARECLASS2(xe, kernel, XThread);
XEDECLARECLASS2(xe, kernel, XUserModule); XEDECLARECLASS2(xe, kernel, XUserModule);
XEDECLARECLASS3(xe, kernel, fs, FileSystem); XEDECLARECLASS3(xe, kernel, fs, FileSystem);
@ -56,6 +57,10 @@ public:
void UnregisterThread(XThread* thread); void UnregisterThread(XThread* thread);
XThread* GetThreadByID(uint32_t thread_id); XThread* GetThreadByID(uint32_t thread_id);
void RegisterNotifyListener(XNotifyListener* listener);
void UnregisterNotifyListener(XNotifyListener* listener);
void BroadcastNotification(XNotificationID id, uint32_t data);
private: private:
Emulator* emulator_; Emulator* emulator_;
Memory* memory_; Memory* memory_;
@ -67,6 +72,7 @@ private:
ObjectTable* object_table_; ObjectTable* object_table_;
xe_mutex_t* object_mutex_; xe_mutex_t* object_mutex_;
std::unordered_map<uint32_t, XThread*> threads_by_id_; std::unordered_map<uint32_t, XThread*> threads_by_id_;
std::vector<XNotifyListener*> notify_listeners_;
XUserModule* executable_module_; XUserModule* executable_module_;

View File

@ -20,6 +20,7 @@ XNotifyListener::XNotifyListener(KernelState* kernel_state) :
} }
XNotifyListener::~XNotifyListener() { XNotifyListener::~XNotifyListener() {
kernel_state_->UnregisterNotifyListener(this);
xe_mutex_free(lock_); xe_mutex_free(lock_);
if (wait_handle_) { if (wait_handle_) {
CloseHandle(wait_handle_); CloseHandle(wait_handle_);
@ -32,9 +33,16 @@ void XNotifyListener::Initialize(uint64_t mask) {
lock_ = xe_mutex_alloc(); lock_ = xe_mutex_alloc();
wait_handle_ = CreateEvent(NULL, TRUE, FALSE, NULL); wait_handle_ = CreateEvent(NULL, TRUE, FALSE, NULL);
mask_ = mask; mask_ = mask;
kernel_state_->RegisterNotifyListener(this);
} }
void XNotifyListener::EnqueueNotification(XNotificationID id, uint32_t data) { void XNotifyListener::EnqueueNotification(XNotificationID id, uint32_t data) {
// Ignore if the notification doesn't match our mask.
if ((mask_ & uint64_t(1 << ((id >> 25) + 1))) == 0) {
return;
}
xe_mutex_lock(lock_); xe_mutex_lock(lock_);
auto existing = notifications_.find(id); auto existing = notifications_.find(id);
if (existing != notifications_.end()) { if (existing != notifications_.end()) {

View File

@ -21,9 +21,6 @@
namespace xe { namespace xe {
namespace kernel { namespace kernel {
// Values seem to be all over the place - GUIDs?
typedef uint32_t XNotificationID;
class XNotifyListener : public XObject { class XNotifyListener : public XObject {
public: public:

View File

@ -11,6 +11,7 @@
#include <vector> #include <vector>
#include <gflags/gflags.h>
#include <third_party/crypto/rijndael-alg-fst.h> #include <third_party/crypto/rijndael-alg-fst.h>
#include <third_party/crypto/rijndael-alg-fst.c> #include <third_party/crypto/rijndael-alg-fst.c>
#include <third_party/mspack/lzx.h> #include <third_party/mspack/lzx.h>
@ -20,6 +21,8 @@
using namespace alloy; using namespace alloy;
DEFINE_bool(xex_dev_key, false, "Use the devkit key.");
typedef struct xe_xex2 { typedef struct xe_xex2 {
xe_ref_t ref; xe_ref_t ref;
@ -434,7 +437,7 @@ int xe_xex2_decrypt_key(xe_xex2_header_t *header) {
// Guess key based on file info. // Guess key based on file info.
// TODO: better way to finding out which key to use? // TODO: better way to finding out which key to use?
const uint8_t *xexkey; const uint8_t *xexkey;
if (header->execution_info.title_id) { if (header->execution_info.title_id && !FLAGS_xex_dev_key) {
xexkey = xe_xex2_retail_key; xexkey = xe_xex2_retail_key;
} else { } else {
xexkey = xe_xex2_devkit_key; xexkey = xe_xex2_devkit_key;

View File

@ -174,6 +174,23 @@ SHIM_CALL XamUserReadProfileSettings_shim(
} }
SHIM_CALL XamShowSigninUI_shim(
PPCContext* ppc_state, KernelState* state) {
uint32_t unk_0 = SHIM_GET_ARG_32(0);
uint32_t unk_mask = SHIM_GET_ARG_32(1);
XELOGD(
"XamShowSigninUI(%d, %.8X)",
unk_0, unk_mask);
// Mask values vary. Probably matching user types? Local/remote?
// Games seem to sit and loop until we trigger this notification.
state->BroadcastNotification(0x00000009, 0);
SHIM_SET_RETURN_32(X_ERROR_SUCCESS);
}
} // namespace kernel } // namespace kernel
} // namespace xe } // namespace xe
@ -185,4 +202,5 @@ void xe::kernel::xam::RegisterUserExports(
SHIM_SET_MAPPING("xam.xex", XamUserGetSigninInfo, state); SHIM_SET_MAPPING("xam.xex", XamUserGetSigninInfo, state);
SHIM_SET_MAPPING("xam.xex", XamUserGetName, state); SHIM_SET_MAPPING("xam.xex", XamUserGetName, state);
SHIM_SET_MAPPING("xam.xex", XamUserReadProfileSettings, state); SHIM_SET_MAPPING("xam.xex", XamUserReadProfileSettings, state);
SHIM_SET_MAPPING("xam.xex", XamShowSigninUI, state);
} }

View File

@ -254,6 +254,10 @@ public:
}; };
// Values seem to be all over the place - GUIDs?
typedef uint32_t XNotificationID;
typedef enum _X_INPUT_FLAG { typedef enum _X_INPUT_FLAG {
X_INPUT_FLAG_GAMEPAD = 0x00000001, X_INPUT_FLAG_GAMEPAD = 0x00000001,
} X_INPUT_FLAG; } X_INPUT_FLAG;