Shuffling kernel/.
This commit is contained in:
parent
494cba7131
commit
e5fbf840d2
|
@ -45,9 +45,11 @@ before_script:
|
|||
script:
|
||||
# Run linter.
|
||||
- ./xenia-build lint --all
|
||||
# Run style checker.
|
||||
#- ./xenia-build style
|
||||
# Build all of xenia.
|
||||
- ./xenia-build build --config=debug
|
||||
#- ./xenia-build build --config=debug
|
||||
# All tests (without haswell support).
|
||||
- ./xenia-build test --config=debug --no-build -- --enable_haswell_instructions=false
|
||||
#- ./xenia-build test --config=debug --no-build -- --enable_haswell_instructions=false
|
||||
# All tests (with haswell support).
|
||||
- ./xenia-build test --config=debug --no-build -- --enable_haswell_instructions=true
|
||||
#- ./xenia-build test --config=debug --no-build -- --enable_haswell_instructions=true
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/platform.h"
|
||||
#include "xenia/base/threading.h"
|
||||
#include "xenia/gpu/graphics_system.h"
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/gpu/graphics_system.h"
|
||||
#include "xenia/profiling.h"
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "xenia/base/mutex.h"
|
||||
#include "xenia/base/threading.h"
|
||||
#include "xenia/cpu/processor.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
#include "xenia/memory.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <atomic>
|
||||
#include <mutex>
|
||||
#include <queue>
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/memory.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "xenia/base/string_buffer.h"
|
||||
#include "xenia/cpu/processor.h"
|
||||
#include "xenia/cpu/thread_state.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
#include "xenia/profiling.h"
|
||||
|
||||
extern "C" {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include <queue>
|
||||
|
||||
#include "xenia/apu/xma_context.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -15,10 +15,11 @@
|
|||
#include "xenia/base/byte_order.h"
|
||||
|
||||
namespace xe {
|
||||
|
||||
BitStream::BitStream(uint8_t* buffer, size_t size_in_bits)
|
||||
: buffer_(buffer), size_bits_(size_in_bits) {}
|
||||
|
||||
BitStream::~BitStream() {}
|
||||
BitStream::~BitStream() = default;
|
||||
|
||||
void BitStream::SetOffset(size_t offset_bits) {
|
||||
assert_false(offset_bits > size_bits_);
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <cstdint>
|
||||
|
||||
namespace xe {
|
||||
|
||||
class BitStream {
|
||||
public:
|
||||
BitStream(uint8_t* buffer, size_t size_in_bits);
|
||||
|
@ -30,7 +31,7 @@ class BitStream {
|
|||
// Note: num_bits MUST be in the range 0-57 (inclusive)
|
||||
uint64_t Peek(size_t num_bits);
|
||||
uint64_t Read(size_t num_bits);
|
||||
bool Write(uint64_t val, size_t num_bits); // TODO: Not tested!
|
||||
bool Write(uint64_t val, size_t num_bits); // TODO(DrChat): Not tested!
|
||||
|
||||
size_t Copy(uint8_t* dest_buffer, size_t num_bits);
|
||||
|
||||
|
@ -39,6 +40,7 @@ class BitStream {
|
|||
size_t offset_bits_ = 0;
|
||||
size_t size_bits_ = 0;
|
||||
};
|
||||
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_BASE_BIT_STREAM_H_
|
|
@ -42,7 +42,7 @@ thread_local std::vector<char> log_format_buffer_(64 * 1024);
|
|||
|
||||
class Logger {
|
||||
public:
|
||||
Logger(const std::wstring& app_name)
|
||||
explicit Logger(const std::wstring& app_name)
|
||||
: ring_buffer_(buffer_, kBufferSize), running_(true) {
|
||||
if (!FLAGS_log_file.empty()) {
|
||||
auto file_path = xe::to_wstring(FLAGS_log_file.c_str());
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
|
||||
#include "xenia/cpu/elf_module.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
#include "xenia/base/byte_order.h"
|
||||
#include "xenia/base/logging.h"
|
||||
|
||||
#include "xenia/cpu/processor.h"
|
||||
|
||||
namespace xe {
|
||||
|
@ -22,7 +22,7 @@ namespace cpu {
|
|||
ElfModule::ElfModule(Processor* processor, kernel::KernelState* kernel_state)
|
||||
: Module(processor), kernel_state_(kernel_state) {}
|
||||
|
||||
ElfModule::~ElfModule() {}
|
||||
ElfModule::~ElfModule() = default;
|
||||
|
||||
// ELF structures
|
||||
struct elf32_ehdr {
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#ifndef XENIA_CPU_ELF_MODULE_H_
|
||||
#define XENIA_CPU_ELF_MODULE_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/cpu/module.h"
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
#define XENIA_CPU_FRONTEND_PPC_HIR_BUILDER_H_
|
||||
|
||||
#include "xenia/base/string_buffer.h"
|
||||
#include "xenia/cpu/hir/hir_builder.h"
|
||||
#include "xenia/cpu/function.h"
|
||||
#include "xenia/cpu/hir/hir_builder.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "xenia/cpu/export_resolver.h"
|
||||
#include "xenia/cpu/processor.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/objects/xmodule.h"
|
||||
#include "xenia/kernel/xmodule.h"
|
||||
|
||||
#include "third_party/crypto/rijndael-alg-fst.h"
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
#include "xenia/debug/debugger.h"
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/objects/xmodule.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/xmodule.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
|
||||
DEFINE_int32(debug_server_port, 9002, "Debugger XDP server TCP port.");
|
||||
|
||||
|
|
|
@ -23,10 +23,10 @@
|
|||
#include "xenia/cpu/stack_walker.h"
|
||||
#include "xenia/debug/debug_server.h"
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/kernel/objects/xkernel_module.h"
|
||||
#include "xenia/kernel/objects/xmodule.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/objects/xuser_module.h"
|
||||
#include "xenia/kernel/kernel_module.h"
|
||||
#include "xenia/kernel/user_module.h"
|
||||
#include "xenia/kernel/xmodule.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
|
||||
#if 0 && DEBUG
|
||||
#define DEFAULT_DEBUG_FLAG true
|
||||
|
|
|
@ -27,7 +27,7 @@ class Thread {
|
|||
public:
|
||||
using Frame = proto::ThreadCallStackFrame;
|
||||
|
||||
Thread(System* system);
|
||||
explicit Thread(System* system);
|
||||
~Thread();
|
||||
|
||||
bool is_dead() const { return is_dead_; }
|
||||
|
|
|
@ -32,7 +32,7 @@ enum class RegisterSet {
|
|||
|
||||
class RegisterListControl : public Control {
|
||||
public:
|
||||
RegisterListControl(RegisterSet set);
|
||||
explicit RegisterListControl(RegisterSet set);
|
||||
~RegisterListControl() override;
|
||||
|
||||
el::Element* BuildUI() override;
|
||||
|
|
|
@ -19,12 +19,13 @@
|
|||
#include "xenia/gpu/graphics_system.h"
|
||||
#include "xenia/hid/input_system.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/modules.h"
|
||||
#include "xenia/kernel/xam/xam_module.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_module.h"
|
||||
#include "xenia/memory.h"
|
||||
#include "xenia/vfs/virtual_file_system.h"
|
||||
#include "xenia/vfs/devices/disc_image_device.h"
|
||||
#include "xenia/vfs/devices/host_path_device.h"
|
||||
#include "xenia/vfs/devices/stfs_container_device.h"
|
||||
#include "xenia/vfs/virtual_file_system.h"
|
||||
|
||||
DEFINE_double(time_scalar, 1.0,
|
||||
"Scalar used to speed or slow time (1x, 2x, 1/2x, etc).");
|
||||
|
@ -148,8 +149,8 @@ X_STATUS Emulator::Setup(ui::Window* display_window) {
|
|||
}
|
||||
|
||||
// HLE kernel modules.
|
||||
kernel_state_->LoadKernelModule<kernel::XboxkrnlModule>();
|
||||
kernel_state_->LoadKernelModule<kernel::XamModule>();
|
||||
kernel_state_->LoadKernelModule<kernel::xboxkrnl::XboxkrnlModule>();
|
||||
kernel_state_->LoadKernelModule<kernel::xam::XamModule>();
|
||||
|
||||
// Finish initializing the display.
|
||||
display_window_->loop()->PostSynchronous([this]() {
|
||||
|
@ -268,9 +269,10 @@ X_STATUS Emulator::LaunchStfsContainer(std::wstring path) {
|
|||
X_STATUS Emulator::CompleteLaunch(const std::wstring& path,
|
||||
const std::string& module_path) {
|
||||
// Allow xam to request module loads.
|
||||
auto xam = kernel_state()->GetKernelModule<kernel::XamModule>("xam.xex");
|
||||
auto xam = kernel_state()->GetKernelModule<kernel::xam::XamModule>("xam.xex");
|
||||
auto xboxkrnl =
|
||||
kernel_state()->GetKernelModule<kernel::XboxkrnlModule>("xboxkrnl.exe");
|
||||
kernel_state()->GetKernelModule<kernel::xboxkrnl::XboxkrnlModule>(
|
||||
"xboxkrnl.exe");
|
||||
|
||||
int result = 0;
|
||||
auto next_module = module_path;
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/gpu/gl4/gl4_gpu_flags.h"
|
||||
#include "xenia/gpu/gl4/gl4_graphics_system.h"
|
||||
#include "xenia/gpu/gpu_flags.h"
|
||||
#include "xenia/gpu/sampler_info.h"
|
||||
#include "xenia/gpu/texture_info.h"
|
||||
#include "xenia/gpu/xenos.h"
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/profiling.h"
|
||||
|
||||
#include "third_party/xxhash/xxhash.h"
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "xenia/gpu/register_file.h"
|
||||
#include "xenia/gpu/tracing.h"
|
||||
#include "xenia/gpu/xenos.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
#include "xenia/memory.h"
|
||||
#include "xenia/ui/gl/circular_buffer.h"
|
||||
#include "xenia/ui/gl/gl_context.h"
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "xenia/gpu/gl4/command_processor.h"
|
||||
#include "xenia/gpu/graphics_system.h"
|
||||
#include "xenia/gpu/register_file.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
#include "xenia/ui/gl/gl_context.h"
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "xenia/base/math.h"
|
||||
#include "xenia/cpu/processor.h"
|
||||
#include "xenia/gpu/gpu_flags.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
|
|
|
@ -32,10 +32,10 @@
|
|||
|
||||
#include "xenia/gpu/ucode_disassembler.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/string_buffer.h"
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
#include "xenia/hid/input_system.h"
|
||||
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/cpu/processor.h"
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/hid/hid_flags.h"
|
||||
#include "xenia/hid/input_driver.h"
|
||||
#include "xenia/profiling.h"
|
||||
|
|
|
@ -221,7 +221,7 @@ X_RESULT WinKeyInputDriver::GetKeystroke(uint32_t user_index, uint32_t flags,
|
|||
key_events_.pop();
|
||||
}
|
||||
|
||||
// TODO: Some other way to toggle this...
|
||||
// TODO(DrChat): Some other way to toggle this...
|
||||
if (IS_KEY_TOGGLED(VK_CAPITAL)) {
|
||||
// dpad toggled
|
||||
if (evt.vkey == (0x41)) {
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* 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/apps/apps.h"
|
||||
|
||||
#include "xenia/kernel/apps/xgi_app.h"
|
||||
#include "xenia/kernel/apps/xlivebase_app.h"
|
||||
#include "xenia/kernel/apps/xmp_app.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace apps {
|
||||
|
||||
void RegisterApps(KernelState* kernel_state, XAppManager* manager) {
|
||||
manager->RegisterApp(std::make_unique<XXGIApp>(kernel_state));
|
||||
manager->RegisterApp(std::make_unique<XXLiveBaseApp>(kernel_state));
|
||||
manager->RegisterApp(std::make_unique<XXMPApp>(kernel_state));
|
||||
}
|
||||
|
||||
} // namespace apps
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -7,16 +7,16 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/kernel/objects/xkernel_module.h"
|
||||
#include "xenia/kernel/kernel_module.h"
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
||||
XKernelModule::XKernelModule(KernelState* kernel_state, const char* path)
|
||||
KernelModule::KernelModule(KernelState* kernel_state, const char* path)
|
||||
: XModule(kernel_state, ModuleType::kKernelModule, path) {
|
||||
emulator_ = kernel_state->emulator();
|
||||
memory_ = emulator_->memory();
|
||||
|
@ -25,9 +25,9 @@ XKernelModule::XKernelModule(KernelState* kernel_state, const char* path)
|
|||
OnLoad();
|
||||
}
|
||||
|
||||
XKernelModule::~XKernelModule() {}
|
||||
KernelModule::~KernelModule() {}
|
||||
|
||||
uint32_t XKernelModule::GetProcAddressByOrdinal(uint16_t ordinal) {
|
||||
uint32_t KernelModule::GetProcAddressByOrdinal(uint16_t ordinal) {
|
||||
auto export_entry = export_resolver_->GetExportByOrdinal(name(), ordinal);
|
||||
if (!export_entry) {
|
||||
// Export (or its parent library) not found.
|
||||
|
@ -59,7 +59,7 @@ uint32_t XKernelModule::GetProcAddressByOrdinal(uint16_t ordinal) {
|
|||
}
|
||||
}
|
||||
|
||||
uint32_t XKernelModule::GetProcAddressByName(const char* name) {
|
||||
uint32_t KernelModule::GetProcAddressByName(const char* name) {
|
||||
XELOGE("GetProcAddressByName not implemented");
|
||||
return 0;
|
||||
}
|
|
@ -7,21 +7,21 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_OBJECTS_XKERNEL_MODULE_H_
|
||||
#define XENIA_KERNEL_OBJECTS_XKERNEL_MODULE_H_
|
||||
#ifndef XENIA_KERNEL_KERNEL_MODULE_H_
|
||||
#define XENIA_KERNEL_KERNEL_MODULE_H_
|
||||
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/kernel/objects/xmodule.h"
|
||||
#include "xenia/kernel/xmodule.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
||||
class KernelState;
|
||||
|
||||
class XKernelModule : public XModule {
|
||||
class KernelModule : public XModule {
|
||||
public:
|
||||
XKernelModule(KernelState* kernel_state, const char* path);
|
||||
~XKernelModule() override;
|
||||
KernelModule(KernelState* kernel_state, const char* path);
|
||||
~KernelModule() override;
|
||||
|
||||
uint32_t GetProcAddressByOrdinal(uint16_t ordinal) override;
|
||||
uint32_t GetProcAddressByName(const char* name) override;
|
||||
|
@ -35,4 +35,4 @@ class XKernelModule : public XModule {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_OBJECTS_XKERNEL_MODULE_H_
|
||||
#endif // XENIA_KERNEL_KERNEL_MODULE_H_
|
|
@ -17,17 +17,15 @@
|
|||
#include "xenia/base/string.h"
|
||||
#include "xenia/cpu/processor.h"
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/kernel/apps/apps.h"
|
||||
#include "xenia/kernel/objects/xevent.h"
|
||||
#include "xenia/kernel/objects/xmodule.h"
|
||||
#include "xenia/kernel/objects/xnotify_listener.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/objects/xuser_module.h"
|
||||
#include "xenia/kernel/notify_listener.h"
|
||||
#include "xenia/kernel/user_module.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xam_module.h"
|
||||
#include "xenia/kernel/xboxkrnl_module.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/xam/xam_module.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_module.h"
|
||||
#include "xenia/kernel/xevent.h"
|
||||
#include "xenia/kernel/xmodule.h"
|
||||
#include "xenia/kernel/xobject.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
|
||||
DEFINE_bool(headless, false,
|
||||
"Don't display any UI, using defaults for prompts as needed.");
|
||||
|
@ -54,12 +52,12 @@ KernelState::KernelState(Emulator* emulator)
|
|||
processor_ = emulator->processor();
|
||||
file_system_ = emulator->file_system();
|
||||
|
||||
app_manager_ = std::make_unique<XAppManager>();
|
||||
user_profile_ = std::make_unique<UserProfile>();
|
||||
app_manager_ = std::make_unique<xam::AppManager>();
|
||||
user_profile_ = std::make_unique<xam::UserProfile>();
|
||||
|
||||
auto content_root = xe::to_wstring(FLAGS_content_root);
|
||||
content_root = xe::to_absolute_path(content_root);
|
||||
content_manager_ = std::make_unique<ContentManager>(this, content_root);
|
||||
content_manager_ = std::make_unique<xam::ContentManager>(this, content_root);
|
||||
|
||||
assert_null(shared_kernel_state_);
|
||||
shared_kernel_state_ = this;
|
||||
|
@ -79,7 +77,7 @@ KernelState::KernelState(Emulator* emulator)
|
|||
// TODO(benvanik): figure out what this list is.
|
||||
pib->unk_54 = pib->unk_58 = 0;
|
||||
|
||||
apps::RegisterApps(this, app_manager_.get());
|
||||
xam::AppManager::RegisterApps(this, app_manager_.get());
|
||||
}
|
||||
|
||||
KernelState::~KernelState() {
|
||||
|
@ -173,7 +171,7 @@ bool KernelState::IsKernelModule(const char* name) {
|
|||
return false;
|
||||
}
|
||||
|
||||
object_ref<XKernelModule> KernelState::GetKernelModule(const char* name) {
|
||||
object_ref<KernelModule> KernelState::GetKernelModule(const char* name) {
|
||||
assert_true(IsKernelModule(name));
|
||||
|
||||
for (auto kernel_module : kernel_modules_) {
|
||||
|
@ -208,14 +206,14 @@ object_ref<XModule> KernelState::GetModule(const char* name) {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
object_ref<XUserModule> KernelState::GetExecutableModule() {
|
||||
object_ref<UserModule> KernelState::GetExecutableModule() {
|
||||
if (!executable_module_) {
|
||||
return nullptr;
|
||||
}
|
||||
return executable_module_;
|
||||
}
|
||||
|
||||
void KernelState::SetExecutableModule(object_ref<XUserModule> module) {
|
||||
void KernelState::SetExecutableModule(object_ref<UserModule> module) {
|
||||
if (module.get() == executable_module_.get()) {
|
||||
return;
|
||||
}
|
||||
|
@ -270,12 +268,12 @@ void KernelState::SetExecutableModule(object_ref<XUserModule> module) {
|
|||
}
|
||||
}
|
||||
|
||||
void KernelState::LoadKernelModule(object_ref<XKernelModule> kernel_module) {
|
||||
void KernelState::LoadKernelModule(object_ref<KernelModule> kernel_module) {
|
||||
auto global_lock = global_critical_region_.Acquire();
|
||||
kernel_modules_.push_back(std::move(kernel_module));
|
||||
}
|
||||
|
||||
object_ref<XUserModule> KernelState::LoadUserModule(const char* raw_name) {
|
||||
object_ref<UserModule> KernelState::LoadUserModule(const char* raw_name) {
|
||||
// Some games try to load relative to launch module, others specify full path.
|
||||
std::string name = xe::find_name_from_path(raw_name);
|
||||
std::string path(raw_name);
|
||||
|
@ -284,7 +282,7 @@ object_ref<XUserModule> KernelState::LoadUserModule(const char* raw_name) {
|
|||
path = xe::join_paths(xe::find_base_path(executable_module_->path()), name);
|
||||
}
|
||||
|
||||
object_ref<XUserModule> module;
|
||||
object_ref<UserModule> module;
|
||||
{
|
||||
auto global_lock = global_critical_region_.Acquire();
|
||||
|
||||
|
@ -297,7 +295,7 @@ object_ref<XUserModule> KernelState::LoadUserModule(const char* raw_name) {
|
|||
}
|
||||
|
||||
// Module wasn't loaded, so load it.
|
||||
module = object_ref<XUserModule>(new XUserModule(this, path.c_str()));
|
||||
module = object_ref<UserModule>(new UserModule(this, path.c_str()));
|
||||
X_STATUS status = module->LoadFromFile(path);
|
||||
if (XFAILED(status)) {
|
||||
return nullptr;
|
||||
|
@ -465,7 +463,7 @@ object_ref<XThread> KernelState::GetThreadByID(uint32_t thread_id) {
|
|||
return retain_object(thread);
|
||||
}
|
||||
|
||||
void KernelState::RegisterNotifyListener(XNotifyListener* listener) {
|
||||
void KernelState::RegisterNotifyListener(NotifyListener* listener) {
|
||||
auto global_lock = global_critical_region_.Acquire();
|
||||
notify_listeners_.push_back(retain_object(listener));
|
||||
|
||||
|
@ -489,7 +487,7 @@ void KernelState::RegisterNotifyListener(XNotifyListener* listener) {
|
|||
}
|
||||
}
|
||||
|
||||
void KernelState::UnregisterNotifyListener(XNotifyListener* listener) {
|
||||
void KernelState::UnregisterNotifyListener(NotifyListener* listener) {
|
||||
auto global_lock = global_critical_region_.Acquire();
|
||||
for (auto it = notify_listeners_.begin(); it != notify_listeners_.end();
|
||||
++it) {
|
||||
|
|
|
@ -21,11 +21,11 @@
|
|||
|
||||
#include "xenia/base/mutex.h"
|
||||
#include "xenia/cpu/export_resolver.h"
|
||||
#include "xenia/kernel/app.h"
|
||||
#include "xenia/kernel/content_manager.h"
|
||||
#include "xenia/kernel/user_profile.h"
|
||||
#include "xenia/kernel/util/native_list.h"
|
||||
#include "xenia/kernel/util/object_table.h"
|
||||
#include "xenia/kernel/xam/app_manager.h"
|
||||
#include "xenia/kernel/xam/content_manager.h"
|
||||
#include "xenia/kernel/xam/user_profile.h"
|
||||
#include "xenia/memory.h"
|
||||
#include "xenia/vfs/virtual_file_system.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
@ -44,11 +44,11 @@ namespace kernel {
|
|||
|
||||
class Dispatcher;
|
||||
class XHostThread;
|
||||
class XKernelModule;
|
||||
class KernelModule;
|
||||
class XModule;
|
||||
class XNotifyListener;
|
||||
class NotifyListener;
|
||||
class XThread;
|
||||
class XUserModule;
|
||||
class UserModule;
|
||||
|
||||
// (?), used by KeGetCurrentProcessType
|
||||
constexpr uint32_t X_PROCTYPE_IDLE = 0;
|
||||
|
@ -99,9 +99,11 @@ class KernelState {
|
|||
|
||||
uint32_t title_id() const;
|
||||
|
||||
XAppManager* app_manager() const { return app_manager_.get(); }
|
||||
UserProfile* user_profile() const { return user_profile_.get(); }
|
||||
ContentManager* content_manager() const { return content_manager_.get(); }
|
||||
xam::AppManager* app_manager() const { return app_manager_.get(); }
|
||||
xam::ContentManager* content_manager() const {
|
||||
return content_manager_.get();
|
||||
}
|
||||
xam::UserProfile* user_profile() const { return user_profile_.get(); }
|
||||
|
||||
// Access must be guarded by the global critical region.
|
||||
util::ObjectTable* object_table() { return &object_table_; }
|
||||
|
@ -120,14 +122,14 @@ class KernelState {
|
|||
bool IsKernelModule(const char* name);
|
||||
object_ref<XModule> GetModule(const char* name);
|
||||
|
||||
object_ref<XUserModule> GetExecutableModule();
|
||||
void SetExecutableModule(object_ref<XUserModule> module);
|
||||
object_ref<XUserModule> LoadUserModule(const char* name);
|
||||
object_ref<UserModule> GetExecutableModule();
|
||||
void SetExecutableModule(object_ref<UserModule> module);
|
||||
object_ref<UserModule> LoadUserModule(const char* name);
|
||||
|
||||
object_ref<XKernelModule> GetKernelModule(const char* name);
|
||||
object_ref<KernelModule> GetKernelModule(const char* name);
|
||||
template <typename T>
|
||||
object_ref<XKernelModule> LoadKernelModule() {
|
||||
auto kernel_module = object_ref<XKernelModule>(new T(emulator_, this));
|
||||
object_ref<KernelModule> LoadKernelModule() {
|
||||
auto kernel_module = object_ref<KernelModule>(new T(emulator_, this));
|
||||
LoadKernelModule(kernel_module);
|
||||
return kernel_module;
|
||||
}
|
||||
|
@ -146,8 +148,8 @@ class KernelState {
|
|||
void OnThreadExit(XThread* thread);
|
||||
object_ref<XThread> GetThreadByID(uint32_t thread_id);
|
||||
|
||||
void RegisterNotifyListener(XNotifyListener* listener);
|
||||
void UnregisterNotifyListener(XNotifyListener* listener);
|
||||
void RegisterNotifyListener(NotifyListener* listener);
|
||||
void UnregisterNotifyListener(NotifyListener* listener);
|
||||
void BroadcastNotification(XNotificationID id, uint32_t data);
|
||||
|
||||
util::NativeList* dpc_list() { return &dpc_list_; }
|
||||
|
@ -165,29 +167,29 @@ class KernelState {
|
|||
uint32_t extended_error, uint32_t length);
|
||||
|
||||
private:
|
||||
void LoadKernelModule(object_ref<XKernelModule> kernel_module);
|
||||
void LoadKernelModule(object_ref<KernelModule> kernel_module);
|
||||
|
||||
Emulator* emulator_;
|
||||
Memory* memory_;
|
||||
cpu::Processor* processor_;
|
||||
vfs::VirtualFileSystem* file_system_;
|
||||
|
||||
std::unique_ptr<XAppManager> app_manager_;
|
||||
std::unique_ptr<UserProfile> user_profile_;
|
||||
std::unique_ptr<ContentManager> content_manager_;
|
||||
std::unique_ptr<xam::AppManager> app_manager_;
|
||||
std::unique_ptr<xam::ContentManager> content_manager_;
|
||||
std::unique_ptr<xam::UserProfile> user_profile_;
|
||||
|
||||
xe::global_critical_region global_critical_region_;
|
||||
|
||||
// Must be guarded by the global critical region.
|
||||
util::ObjectTable object_table_;
|
||||
std::unordered_map<uint32_t, XThread*> threads_by_id_;
|
||||
std::vector<object_ref<XNotifyListener>> notify_listeners_;
|
||||
std::vector<object_ref<NotifyListener>> notify_listeners_;
|
||||
bool has_notified_startup_ = false;
|
||||
|
||||
uint32_t process_type_ = X_PROCTYPE_USER;
|
||||
object_ref<XUserModule> executable_module_;
|
||||
std::vector<object_ref<XKernelModule>> kernel_modules_;
|
||||
std::vector<object_ref<XUserModule>> user_modules_;
|
||||
object_ref<UserModule> executable_module_;
|
||||
std::vector<object_ref<KernelModule>> kernel_modules_;
|
||||
std::vector<object_ref<UserModule>> user_modules_;
|
||||
std::vector<TerminateNotification> terminate_notifications;
|
||||
|
||||
uint32_t process_info_block_address_ = 0;
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* Xenia : Xbox 360 Emulator Research Project *
|
||||
******************************************************************************
|
||||
* Copyright 2013 Ben Vanik. All rights reserved. *
|
||||
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_MODULES_H_
|
||||
#define XENIA_KERNEL_MODULES_H_
|
||||
|
||||
#include "xenia/kernel/xam_module.h"
|
||||
#include "xenia/kernel/xboxkrnl_module.h"
|
||||
|
||||
#endif // XENIA_KERNEL_MODULES_H_
|
|
@ -7,21 +7,21 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/kernel/objects/xnotify_listener.h"
|
||||
#include "xenia/kernel/notify_listener.h"
|
||||
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
||||
XNotifyListener::XNotifyListener(KernelState* kernel_state)
|
||||
NotifyListener::NotifyListener(KernelState* kernel_state)
|
||||
: XObject(kernel_state, kTypeNotifyListener) {}
|
||||
|
||||
XNotifyListener::~XNotifyListener() {
|
||||
NotifyListener::~NotifyListener() {
|
||||
kernel_state_->UnregisterNotifyListener(this);
|
||||
}
|
||||
|
||||
void XNotifyListener::Initialize(uint64_t mask) {
|
||||
void NotifyListener::Initialize(uint64_t mask) {
|
||||
assert_false(wait_handle_);
|
||||
|
||||
wait_handle_ = xe::threading::Event::CreateManualResetEvent(false);
|
||||
|
@ -30,7 +30,7 @@ void XNotifyListener::Initialize(uint64_t mask) {
|
|||
kernel_state_->RegisterNotifyListener(this);
|
||||
}
|
||||
|
||||
void XNotifyListener::EnqueueNotification(XNotificationID id, uint32_t data) {
|
||||
void NotifyListener::EnqueueNotification(XNotificationID id, uint32_t data) {
|
||||
// Ignore if the notification doesn't match our mask.
|
||||
if ((mask_ & uint64_t(1 << (id >> 25))) == 0) {
|
||||
return;
|
||||
|
@ -48,7 +48,7 @@ void XNotifyListener::EnqueueNotification(XNotificationID id, uint32_t data) {
|
|||
wait_handle_->Set();
|
||||
}
|
||||
|
||||
bool XNotifyListener::DequeueNotification(XNotificationID* out_id,
|
||||
bool NotifyListener::DequeueNotification(XNotificationID* out_id,
|
||||
uint32_t* out_data) {
|
||||
auto global_lock = global_critical_region_.Acquire();
|
||||
bool dequeued = false;
|
||||
|
@ -66,7 +66,7 @@ bool XNotifyListener::DequeueNotification(XNotificationID* out_id,
|
|||
return dequeued;
|
||||
}
|
||||
|
||||
bool XNotifyListener::DequeueNotification(XNotificationID id,
|
||||
bool NotifyListener::DequeueNotification(XNotificationID id,
|
||||
uint32_t* out_data) {
|
||||
auto global_lock = global_critical_region_.Acquire();
|
||||
bool dequeued = false;
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_OBJECTS_XNOTIFY_LISTENER_H_
|
||||
#define XENIA_KERNEL_OBJECTS_XNOTIFY_LISTENER_H_
|
||||
#ifndef XENIA_KERNEL_NOTIFY_LISTENER_H_
|
||||
#define XENIA_KERNEL_NOTIFY_LISTENER_H_
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
@ -21,10 +21,10 @@
|
|||
namespace xe {
|
||||
namespace kernel {
|
||||
|
||||
class XNotifyListener : public XObject {
|
||||
class NotifyListener : public XObject {
|
||||
public:
|
||||
explicit XNotifyListener(KernelState* kernel_state);
|
||||
~XNotifyListener() override;
|
||||
explicit NotifyListener(KernelState* kernel_state);
|
||||
~NotifyListener() override;
|
||||
|
||||
uint64_t mask() const { return mask_; }
|
||||
|
||||
|
@ -49,4 +49,4 @@ class XNotifyListener : public XObject {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_OBJECTS_XNOTIFY_LISTENER_H_
|
||||
#endif // XENIA_KERNEL_NOTIFY_LISTENER_H_
|
|
@ -7,7 +7,7 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/kernel/objects/xuser_module.h"
|
||||
#include "xenia/kernel/user_module.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
@ -16,18 +16,18 @@
|
|||
#include "xenia/cpu/processor.h"
|
||||
#include "xenia/cpu/xex_module.h"
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/kernel/objects/xfile.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/xfile.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
||||
XUserModule::XUserModule(KernelState* kernel_state, const char* path)
|
||||
UserModule::UserModule(KernelState* kernel_state, const char* path)
|
||||
: XModule(kernel_state, ModuleType::kUserModule, path) {}
|
||||
|
||||
XUserModule::~XUserModule() { Unload(); }
|
||||
UserModule::~UserModule() { Unload(); }
|
||||
|
||||
X_STATUS XUserModule::LoadFromFile(std::string path) {
|
||||
X_STATUS UserModule::LoadFromFile(std::string path) {
|
||||
X_STATUS result = X_STATUS_UNSUCCESSFUL;
|
||||
|
||||
// Resolve the file to open.
|
||||
|
@ -74,7 +74,7 @@ X_STATUS XUserModule::LoadFromFile(std::string path) {
|
|||
return result;
|
||||
}
|
||||
|
||||
X_STATUS XUserModule::LoadFromMemory(const void* addr, const size_t length) {
|
||||
X_STATUS UserModule::LoadFromMemory(const void* addr, const size_t length) {
|
||||
auto processor = kernel_state()->processor();
|
||||
|
||||
auto magic = xe::load_and_swap<uint32_t>(addr);
|
||||
|
@ -141,7 +141,7 @@ X_STATUS XUserModule::LoadFromMemory(const void* addr, const size_t length) {
|
|||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
X_STATUS XUserModule::Unload() {
|
||||
X_STATUS UserModule::Unload() {
|
||||
if (!xex_module()->loaded()) {
|
||||
// Quick abort.
|
||||
return X_STATUS_SUCCESS;
|
||||
|
@ -155,15 +155,15 @@ X_STATUS XUserModule::Unload() {
|
|||
return X_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
uint32_t XUserModule::GetProcAddressByOrdinal(uint16_t ordinal) {
|
||||
uint32_t UserModule::GetProcAddressByOrdinal(uint16_t ordinal) {
|
||||
return xex_module()->GetProcAddress(ordinal);
|
||||
}
|
||||
|
||||
uint32_t XUserModule::GetProcAddressByName(const char* name) {
|
||||
uint32_t UserModule::GetProcAddressByName(const char* name) {
|
||||
return xex_module()->GetProcAddress(name);
|
||||
}
|
||||
|
||||
X_STATUS XUserModule::GetSection(const char* name, uint32_t* out_section_data,
|
||||
X_STATUS UserModule::GetSection(const char* name, uint32_t* out_section_data,
|
||||
uint32_t* out_section_size) {
|
||||
xex2_opt_resource_info* resource_header = nullptr;
|
||||
if (!cpu::XexModule::GetOptHeader(xex_header(), XEX_HEADER_RESOURCE_INFO,
|
||||
|
@ -187,7 +187,7 @@ X_STATUS XUserModule::GetSection(const char* name, uint32_t* out_section_data,
|
|||
return X_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
X_STATUS XUserModule::GetOptHeader(xe_xex2_header_keys key, void** out_ptr) {
|
||||
X_STATUS UserModule::GetOptHeader(xe_xex2_header_keys key, void** out_ptr) {
|
||||
assert_not_null(out_ptr);
|
||||
|
||||
if (module_format_ == kModuleFormatElf) {
|
||||
|
@ -203,7 +203,7 @@ X_STATUS XUserModule::GetOptHeader(xe_xex2_header_keys key, void** out_ptr) {
|
|||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
X_STATUS XUserModule::GetOptHeader(xe_xex2_header_keys key,
|
||||
X_STATUS UserModule::GetOptHeader(xe_xex2_header_keys key,
|
||||
uint32_t* out_header_guest_ptr) {
|
||||
if (module_format_ == kModuleFormatElf) {
|
||||
// Quick die.
|
||||
|
@ -219,7 +219,7 @@ X_STATUS XUserModule::GetOptHeader(xe_xex2_header_keys key,
|
|||
out_header_guest_ptr);
|
||||
}
|
||||
|
||||
X_STATUS XUserModule::GetOptHeader(uint8_t* membase, const xex2_header* header,
|
||||
X_STATUS UserModule::GetOptHeader(uint8_t* membase, const xex2_header* header,
|
||||
xe_xex2_header_keys key,
|
||||
uint32_t* out_header_guest_ptr) {
|
||||
assert_not_null(out_header_guest_ptr);
|
||||
|
@ -257,7 +257,7 @@ X_STATUS XUserModule::GetOptHeader(uint8_t* membase, const xex2_header* header,
|
|||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
X_STATUS XUserModule::Launch(uint32_t flags) {
|
||||
X_STATUS UserModule::Launch(uint32_t flags) {
|
||||
XELOGI("Launching module...");
|
||||
|
||||
// Create a thread to run in.
|
||||
|
@ -294,7 +294,7 @@ X_STATUS XUserModule::Launch(uint32_t flags) {
|
|||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
void XUserModule::Dump() {
|
||||
void UserModule::Dump() {
|
||||
if (module_format_ == kModuleFormatElf) {
|
||||
// Quick die.
|
||||
return;
|
|
@ -7,15 +7,15 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_OBJECTS_XUSER_MODULE_H_
|
||||
#define XENIA_KERNEL_OBJECTS_XUSER_MODULE_H_
|
||||
#ifndef XENIA_KERNEL_USER_MODULE_H_
|
||||
#define XENIA_KERNEL_USER_MODULE_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "xenia/cpu/export_resolver.h"
|
||||
#include "xenia/cpu/xex_module.h"
|
||||
#include "xenia/kernel/objects/xmodule.h"
|
||||
#include "xenia/kernel/util/xex2_info.h"
|
||||
#include "xenia/kernel/xmodule.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
|
@ -23,13 +23,15 @@ namespace cpu {
|
|||
class XexModule;
|
||||
class ElfModule;
|
||||
} // namespace cpu
|
||||
} // namespace xe
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
||||
class XUserModule : public XModule {
|
||||
class UserModule : public XModule {
|
||||
public:
|
||||
XUserModule(KernelState* kernel_state, const char* path);
|
||||
~XUserModule() override;
|
||||
UserModule(KernelState* kernel_state, const char* path);
|
||||
~UserModule() override;
|
||||
|
||||
enum ModuleFormat {
|
||||
kModuleFormatUndefined = 0,
|
||||
|
@ -86,12 +88,12 @@ class XUserModule : public XModule {
|
|||
uint32_t guest_xex_header_ = 0;
|
||||
ModuleFormat module_format_ = kModuleFormatUndefined;
|
||||
|
||||
bool dll_module_;
|
||||
uint32_t entry_point_;
|
||||
uint32_t stack_size_;
|
||||
bool dll_module_ = false;
|
||||
uint32_t entry_point_ = 0;
|
||||
uint32_t stack_size_ = 0;
|
||||
};
|
||||
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_OBJECTS_XUSER_MODULE_H_
|
||||
#endif // XENIA_KERNEL_USER_MODULE_H_
|
|
@ -13,7 +13,7 @@
|
|||
#include <cstring>
|
||||
|
||||
#include "xenia/kernel/xobject.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
|
|
@ -7,25 +7,35 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/kernel/app.h"
|
||||
#include "xenia/kernel/xam/app_manager.h"
|
||||
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/xam/apps/xgi_app.h"
|
||||
#include "xenia/kernel/xam/apps/xlivebase_app.h"
|
||||
#include "xenia/kernel/xam/apps/xmp_app.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xam {
|
||||
|
||||
XApp::XApp(KernelState* kernel_state, uint32_t app_id)
|
||||
App::App(KernelState* kernel_state, uint32_t app_id)
|
||||
: kernel_state_(kernel_state),
|
||||
memory_(kernel_state->memory()),
|
||||
app_id_(app_id) {}
|
||||
|
||||
void XAppManager::RegisterApp(std::unique_ptr<XApp> app) {
|
||||
void AppManager::RegisterApps(KernelState* kernel_state, AppManager* manager) {
|
||||
manager->RegisterApp(std::make_unique<apps::XgiApp>(kernel_state));
|
||||
manager->RegisterApp(std::make_unique<apps::XLiveBaseApp>(kernel_state));
|
||||
manager->RegisterApp(std::make_unique<apps::XmpApp>(kernel_state));
|
||||
}
|
||||
|
||||
void AppManager::RegisterApp(std::unique_ptr<App> app) {
|
||||
assert_zero(app_lookup_.count(app->app_id()));
|
||||
app_lookup_.insert({app->app_id(), app.get()});
|
||||
apps_.push_back(std::move(app));
|
||||
}
|
||||
|
||||
X_RESULT XAppManager::DispatchMessageSync(uint32_t app_id, uint32_t message,
|
||||
X_RESULT AppManager::DispatchMessageSync(uint32_t app_id, uint32_t message,
|
||||
uint32_t buffer_ptr,
|
||||
uint32_t buffer_length) {
|
||||
const auto& it = app_lookup_.find(app_id);
|
||||
|
@ -35,7 +45,7 @@ X_RESULT XAppManager::DispatchMessageSync(uint32_t app_id, uint32_t message,
|
|||
return it->second->DispatchMessageSync(message, buffer_ptr, buffer_length);
|
||||
}
|
||||
|
||||
X_RESULT XAppManager::DispatchMessageAsync(uint32_t app_id, uint32_t message,
|
||||
X_RESULT AppManager::DispatchMessageAsync(uint32_t app_id, uint32_t message,
|
||||
uint32_t buffer_ptr,
|
||||
uint32_t buffer_length) {
|
||||
const auto& it = app_lookup_.find(app_id);
|
||||
|
@ -45,5 +55,6 @@ X_RESULT XAppManager::DispatchMessageAsync(uint32_t app_id, uint32_t message,
|
|||
return it->second->DispatchMessageSync(message, buffer_ptr, buffer_length);
|
||||
}
|
||||
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -7,9 +7,11 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_APP_H_
|
||||
#define XENIA_KERNEL_APP_H_
|
||||
#ifndef XENIA_KERNEL_XAM_APP_MANAGER_H_
|
||||
#define XENIA_KERNEL_XAM_APP_MANAGER_H_
|
||||
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
|
@ -18,10 +20,15 @@
|
|||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
||||
class KernelState;
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
class XApp {
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xam {
|
||||
|
||||
class App {
|
||||
public:
|
||||
uint32_t app_id() const { return app_id_; }
|
||||
|
||||
|
@ -29,16 +36,18 @@ class XApp {
|
|||
uint32_t buffer_length) = 0;
|
||||
|
||||
protected:
|
||||
XApp(KernelState* kernel_state, uint32_t app_id);
|
||||
App(KernelState* kernel_state, uint32_t app_id);
|
||||
|
||||
KernelState* kernel_state_;
|
||||
Memory* memory_;
|
||||
uint32_t app_id_;
|
||||
};
|
||||
|
||||
class XAppManager {
|
||||
class AppManager {
|
||||
public:
|
||||
void RegisterApp(std::unique_ptr<XApp> app);
|
||||
static void RegisterApps(KernelState* kernel_state, AppManager* manager);
|
||||
|
||||
void RegisterApp(std::unique_ptr<App> app);
|
||||
|
||||
X_RESULT DispatchMessageSync(uint32_t app_id, uint32_t message,
|
||||
uint32_t buffer_ptr, uint32_t buffer_length);
|
||||
|
@ -46,11 +55,12 @@ class XAppManager {
|
|||
uint32_t buffer_ptr, uint32_t buffer_length);
|
||||
|
||||
private:
|
||||
std::vector<std::unique_ptr<XApp>> apps_;
|
||||
std::unordered_map<uint32_t, XApp*> app_lookup_;
|
||||
std::vector<std::unique_ptr<App>> apps_;
|
||||
std::unordered_map<uint32_t, App*> app_lookup_;
|
||||
};
|
||||
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_APP_H_
|
||||
#endif // XENIA_KERNEL_XAM_APP_MANAGER_H_
|
|
@ -7,20 +7,21 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/kernel/apps/xgi_app.h"
|
||||
#include "xenia/kernel/xam/apps/xgi_app.h"
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/threading.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xam {
|
||||
namespace apps {
|
||||
|
||||
XXGIApp::XXGIApp(KernelState* kernel_state) : XApp(kernel_state, 0xFB) {}
|
||||
XgiApp::XgiApp(KernelState* kernel_state) : App(kernel_state, 0xFB) {}
|
||||
|
||||
// http://mb.mirage.org/bugzilla/xliveless/main.c
|
||||
|
||||
X_RESULT XXGIApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
|
||||
X_RESULT XgiApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
|
||||
uint32_t buffer_length) {
|
||||
// NOTE: buffer_length may be zero or valid.
|
||||
auto buffer = memory_->TranslateVirtual(buffer_ptr);
|
||||
|
@ -94,5 +95,6 @@ X_RESULT XXGIApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
|
|||
}
|
||||
|
||||
} // namespace apps
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -7,28 +7,28 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_APPS_XGI_APP_H_
|
||||
#define XENIA_KERNEL_APPS_XGI_APP_H_
|
||||
#ifndef XENIA_KERNEL_XAM_APPS_XGI_APP_H_
|
||||
#define XENIA_KERNEL_XAM_APPS_XGI_APP_H_
|
||||
|
||||
#include "xenia/kernel/app.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/xam/app_manager.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xam {
|
||||
namespace apps {
|
||||
|
||||
class XXGIApp : public XApp {
|
||||
class XgiApp : public App {
|
||||
public:
|
||||
explicit XXGIApp(KernelState* kernel_state);
|
||||
explicit XgiApp(KernelState* kernel_state);
|
||||
|
||||
X_RESULT DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
|
||||
uint32_t buffer_length) override;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
} // namespace apps
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_APPS_XGI_APP_H_
|
||||
#endif // XENIA_KERNEL_XAM_APPS_XGI_APP_H_
|
|
@ -7,21 +7,22 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/kernel/apps/xlivebase_app.h"
|
||||
#include "xenia/kernel/xam/apps/xlivebase_app.h"
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/threading.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xam {
|
||||
namespace apps {
|
||||
|
||||
XXLiveBaseApp::XXLiveBaseApp(KernelState* kernel_state)
|
||||
: XApp(kernel_state, 0xFC) {}
|
||||
XLiveBaseApp::XLiveBaseApp(KernelState* kernel_state)
|
||||
: App(kernel_state, 0xFC) {}
|
||||
|
||||
// http://mb.mirage.org/bugzilla/xliveless/main.c
|
||||
|
||||
X_RESULT XXLiveBaseApp::DispatchMessageSync(uint32_t message,
|
||||
X_RESULT XLiveBaseApp::DispatchMessageSync(uint32_t message,
|
||||
uint32_t buffer_ptr,
|
||||
uint32_t buffer_length) {
|
||||
// NOTE: buffer_length may be zero or valid.
|
||||
|
@ -57,5 +58,6 @@ X_RESULT XXLiveBaseApp::DispatchMessageSync(uint32_t message,
|
|||
}
|
||||
|
||||
} // namespace apps
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -7,28 +7,28 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_APPS_XLIVEBASE_APP_H_
|
||||
#define XENIA_KERNEL_APPS_XLIVEBASE_APP_H_
|
||||
#ifndef XENIA_KERNEL_XAM_APPS_XLIVEBASE_APP_H_
|
||||
#define XENIA_KERNEL_XAM_APPS_XLIVEBASE_APP_H_
|
||||
|
||||
#include "xenia/kernel/app.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/xam/app_manager.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xam {
|
||||
namespace apps {
|
||||
|
||||
class XXLiveBaseApp : public XApp {
|
||||
class XLiveBaseApp : public App {
|
||||
public:
|
||||
explicit XXLiveBaseApp(KernelState* kernel_state);
|
||||
explicit XLiveBaseApp(KernelState* kernel_state);
|
||||
|
||||
X_RESULT DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
|
||||
uint32_t buffer_length) override;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
} // namespace apps
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_APPS_XLIVEBASE_APP_H_
|
||||
#endif // XENIA_KERNEL_XAM_APPS_XLIVEBASE_APP_H_
|
|
@ -7,17 +7,18 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/kernel/apps/xmp_app.h"
|
||||
#include "xenia/kernel/xam/apps/xmp_app.h"
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/threading.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xam {
|
||||
namespace apps {
|
||||
|
||||
XXMPApp::XXMPApp(KernelState* kernel_state)
|
||||
: XApp(kernel_state, 0xFA),
|
||||
XmpApp::XmpApp(KernelState* kernel_state)
|
||||
: App(kernel_state, 0xFA),
|
||||
state_(State::kIdle),
|
||||
disabled_(0),
|
||||
playback_mode_(PlaybackMode::kUnknown),
|
||||
|
@ -29,7 +30,7 @@ XXMPApp::XXMPApp(KernelState* kernel_state)
|
|||
next_playlist_handle_(1),
|
||||
next_song_handle_(1) {}
|
||||
|
||||
X_RESULT XXMPApp::XMPGetStatus(uint32_t state_ptr) {
|
||||
X_RESULT XmpApp::XMPGetStatus(uint32_t state_ptr) {
|
||||
// Some stupid games will hammer this on a thread - induce a delay
|
||||
// here to keep from starving real threads.
|
||||
xe::threading::Sleep(std::chrono::milliseconds(1));
|
||||
|
@ -40,9 +41,11 @@ X_RESULT XXMPApp::XMPGetStatus(uint32_t state_ptr) {
|
|||
return X_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
X_RESULT XXMPApp::XMPCreateTitlePlaylist(
|
||||
uint32_t songs_ptr, uint32_t song_count, uint32_t playlist_name_ptr,
|
||||
std::wstring playlist_name, uint32_t flags, uint32_t out_song_handles,
|
||||
X_RESULT XmpApp::XMPCreateTitlePlaylist(uint32_t songs_ptr, uint32_t song_count,
|
||||
uint32_t playlist_name_ptr,
|
||||
std::wstring playlist_name,
|
||||
uint32_t flags,
|
||||
uint32_t out_song_handles,
|
||||
uint32_t out_playlist_handle) {
|
||||
XELOGD("XMPCreateTitlePlaylist(%.8X, %.8X, %.8X(%s), %.8X, %.8X, %.8X)",
|
||||
songs_ptr, song_count, playlist_name_ptr,
|
||||
|
@ -87,7 +90,7 @@ X_RESULT XXMPApp::XMPCreateTitlePlaylist(
|
|||
return X_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
X_RESULT XXMPApp::XMPDeleteTitlePlaylist(uint32_t playlist_handle) {
|
||||
X_RESULT XmpApp::XMPDeleteTitlePlaylist(uint32_t playlist_handle) {
|
||||
XELOGD("XMPDeleteTitlePlaylist(%.8X)", playlist_handle);
|
||||
auto global_lock = global_critical_region_.Acquire();
|
||||
auto it = playlists_.find(playlist_handle);
|
||||
|
@ -104,7 +107,7 @@ X_RESULT XXMPApp::XMPDeleteTitlePlaylist(uint32_t playlist_handle) {
|
|||
return X_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
X_RESULT XXMPApp::XMPPlayTitlePlaylist(uint32_t playlist_handle,
|
||||
X_RESULT XmpApp::XMPPlayTitlePlaylist(uint32_t playlist_handle,
|
||||
uint32_t song_handle) {
|
||||
XELOGD("XMPPlayTitlePlaylist(%.8X, %.8X)", playlist_handle, song_handle);
|
||||
Playlist* playlist = nullptr;
|
||||
|
@ -134,7 +137,7 @@ X_RESULT XXMPApp::XMPPlayTitlePlaylist(uint32_t playlist_handle,
|
|||
return X_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
X_RESULT XXMPApp::XMPContinue() {
|
||||
X_RESULT XmpApp::XMPContinue() {
|
||||
XELOGD("XMPContinue()");
|
||||
if (state_ == State::kPaused) {
|
||||
state_ = State::kPlaying;
|
||||
|
@ -143,7 +146,7 @@ X_RESULT XXMPApp::XMPContinue() {
|
|||
return X_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
X_RESULT XXMPApp::XMPStop(uint32_t unk) {
|
||||
X_RESULT XmpApp::XMPStop(uint32_t unk) {
|
||||
assert_zero(unk);
|
||||
XELOGD("XMPStop(%.8X)", unk);
|
||||
active_playlist_ = nullptr; // ?
|
||||
|
@ -153,7 +156,7 @@ X_RESULT XXMPApp::XMPStop(uint32_t unk) {
|
|||
return X_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
X_RESULT XXMPApp::XMPPause() {
|
||||
X_RESULT XmpApp::XMPPause() {
|
||||
XELOGD("XMPPause()");
|
||||
if (state_ == State::kPlaying) {
|
||||
state_ = State::kPaused;
|
||||
|
@ -162,7 +165,7 @@ X_RESULT XXMPApp::XMPPause() {
|
|||
return X_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
X_RESULT XXMPApp::XMPNext() {
|
||||
X_RESULT XmpApp::XMPNext() {
|
||||
XELOGD("XMPNext()");
|
||||
if (!active_playlist_) {
|
||||
return X_ERROR_NOT_FOUND;
|
||||
|
@ -174,7 +177,7 @@ X_RESULT XXMPApp::XMPNext() {
|
|||
return X_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
X_RESULT XXMPApp::XMPPrevious() {
|
||||
X_RESULT XmpApp::XMPPrevious() {
|
||||
XELOGD("XMPPrevious()");
|
||||
if (!active_playlist_) {
|
||||
return X_ERROR_NOT_FOUND;
|
||||
|
@ -189,12 +192,12 @@ X_RESULT XXMPApp::XMPPrevious() {
|
|||
return X_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
void XXMPApp::OnStateChanged() {
|
||||
void XmpApp::OnStateChanged() {
|
||||
kernel_state_->BroadcastNotification(kMsgStateChanged,
|
||||
static_cast<uint32_t>(state_));
|
||||
}
|
||||
|
||||
X_RESULT XXMPApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
|
||||
X_RESULT XmpApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
|
||||
uint32_t buffer_length) {
|
||||
// NOTE: buffer_length may be zero or valid.
|
||||
auto buffer = memory_->TranslateVirtual(buffer_ptr);
|
||||
|
@ -419,5 +422,6 @@ X_RESULT XXMPApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
|
|||
}
|
||||
|
||||
} // namespace apps
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_APPS_XMP_APP_H_
|
||||
#define XENIA_KERNEL_APPS_XMP_APP_H_
|
||||
#ifndef XENIA_KERNEL_XAM_APPS_XMP_APP_H_
|
||||
#define XENIA_KERNEL_XAM_APPS_XMP_APP_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
@ -16,17 +16,18 @@
|
|||
#include <vector>
|
||||
|
||||
#include "xenia/base/mutex.h"
|
||||
#include "xenia/kernel/app.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/xam/app_manager.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xam {
|
||||
namespace apps {
|
||||
|
||||
// Only source of docs for a lot of these functions:
|
||||
// http://freestyledash.googlecode.com/svn-history/r1/trunk/Freestyle/Scenes/Media/Music/ScnMusic.cpp
|
||||
|
||||
class XXMPApp : public XApp {
|
||||
class XmpApp : public App {
|
||||
public:
|
||||
enum class State : uint32_t {
|
||||
kIdle = 0,
|
||||
|
@ -65,7 +66,7 @@ class XXMPApp : public XApp {
|
|||
std::vector<std::unique_ptr<Song>> songs;
|
||||
};
|
||||
|
||||
explicit XXMPApp(KernelState* kernel_state);
|
||||
explicit XmpApp(KernelState* kernel_state);
|
||||
|
||||
X_RESULT XMPGetStatus(uint32_t status_ptr);
|
||||
|
||||
|
@ -108,7 +109,8 @@ class XXMPApp : public XApp {
|
|||
};
|
||||
|
||||
} // namespace apps
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_APPS_XMP_APP_H_
|
||||
#endif // XENIA_KERNEL_XAM_APPS_XMP_APP_H_
|
|
@ -7,7 +7,7 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/kernel/content_manager.h"
|
||||
#include "xenia/kernel/xam/content_manager.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
|||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xam {
|
||||
|
||||
static const wchar_t* kThumbnailFileName = L"__thumbnail.png";
|
||||
|
||||
|
@ -250,5 +251,6 @@ X_RESULT ContentManager::DeleteContent(const XCONTENT_DATA& data) {
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_CONTENT_MANAGER_H_
|
||||
#define XENIA_KERNEL_CONTENT_MANAGER_H_
|
||||
#ifndef XENIA_KERNEL_XAM_CONTENT_MANAGER_H_
|
||||
#define XENIA_KERNEL_XAM_CONTENT_MANAGER_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
@ -21,8 +21,13 @@
|
|||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
||||
class KernelState;
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xam {
|
||||
|
||||
struct XCONTENT_DATA {
|
||||
static const size_t kSize = 4 + 4 + 128 * 2 + 42 + 2; // = 306 + 2b padding
|
||||
|
@ -92,7 +97,8 @@ class ContentManager {
|
|||
std::unordered_map<std::string, ContentPackage*> open_packages_;
|
||||
};
|
||||
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_CONTENT_MANAGER_H_
|
||||
#endif // XENIA_KERNEL_XAM_CONTENT_MANAGER_H_
|
|
@ -7,10 +7,11 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/kernel/user_profile.h"
|
||||
#include "xenia/kernel/xam/user_profile.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xam {
|
||||
|
||||
UserProfile::UserProfile() {
|
||||
xuid_ = 0xBABEBABEBABEBABE;
|
||||
|
@ -97,5 +98,6 @@ UserProfile::Setting* UserProfile::GetSetting(uint32_t setting_id) {
|
|||
return it->second;
|
||||
}
|
||||
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_USER_PROFILE_H_
|
||||
#define XENIA_KERNEL_USER_PROFILE_H_
|
||||
#ifndef XENIA_KERNEL_XAM_USER_PROFILE_H_
|
||||
#define XENIA_KERNEL_XAM_USER_PROFILE_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
@ -19,6 +19,7 @@
|
|||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xam {
|
||||
|
||||
class UserProfile {
|
||||
public:
|
||||
|
@ -193,7 +194,8 @@ class UserProfile {
|
|||
std::unordered_map<uint32_t, Setting*> settings_;
|
||||
};
|
||||
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_USER_PROFILE_H_
|
||||
#endif // XENIA_KERNEL_XAM_USER_PROFILE_H_
|
|
@ -10,11 +10,12 @@
|
|||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xam_private.h"
|
||||
#include "xenia/kernel/xam/xam_private.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xam {
|
||||
|
||||
dword_result_t XamAvatarInitialize(
|
||||
dword_t unk1, // 1, 4, etc
|
||||
|
@ -34,8 +35,9 @@ void XamAvatarShutdown() {
|
|||
}
|
||||
DECLARE_XAM_EXPORT(XamAvatarShutdown, ExportTag::kStub);
|
||||
|
||||
void RegisterAvatarExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state) {}
|
||||
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
void xe::kernel::xam::RegisterAvatarExports(
|
||||
xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {}
|
|
@ -9,13 +9,14 @@
|
|||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/objects/xenumerator.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xam_private.h"
|
||||
#include "xenia/kernel/xam/xam_private.h"
|
||||
#include "xenia/kernel/xenumerator.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xam {
|
||||
|
||||
struct DeviceInfo {
|
||||
uint32_t device_id;
|
||||
|
@ -501,11 +502,8 @@ SHIM_CALL XamContentDelete_shim(PPCContext* ppc_context,
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
void xe::kernel::xam::RegisterContentExports(
|
||||
xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {
|
||||
void RegisterContentExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state) {
|
||||
SHIM_SET_MAPPING("xam.xex", XamContentGetLicenseMask, state);
|
||||
SHIM_SET_MAPPING("xam.xex", XamContentGetDeviceName, state);
|
||||
SHIM_SET_MAPPING("xam.xex", XamContentGetDeviceState, state);
|
||||
|
@ -520,3 +518,7 @@ void xe::kernel::xam::RegisterContentExports(
|
|||
SHIM_SET_MAPPING("xam.xex", XamContentSetThumbnail, state);
|
||||
SHIM_SET_MAPPING("xam.xex", XamContentDelete, state);
|
||||
}
|
||||
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -9,17 +9,18 @@
|
|||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/objects/xenumerator.h"
|
||||
#include "xenia/kernel/objects/xuser_module.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/user_module.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/util/xex2.h"
|
||||
#include "xenia/kernel/xam_module.h"
|
||||
#include "xenia/kernel/xam_private.h"
|
||||
#include "xenia/kernel/xam/xam_module.h"
|
||||
#include "xenia/kernel/xam/xam_private.h"
|
||||
#include "xenia/kernel/xenumerator.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xam {
|
||||
|
||||
constexpr uint32_t X_LANGUAGE_ENGLISH = 1;
|
||||
constexpr uint32_t X_LANGUAGE_JAPANESE = 2;
|
||||
|
@ -93,7 +94,7 @@ SHIM_CALL XamGetExecutionId_shim(PPCContext* ppc_context,
|
|||
}
|
||||
|
||||
dword_result_t XamLoaderSetLaunchData(lpvoid_t data, dword_t size) {
|
||||
auto xam = kernel_state()->GetKernelModule<kernel::XamModule>("xam.xex");
|
||||
auto xam = kernel_state()->GetKernelModule<XamModule>("xam.xex");
|
||||
|
||||
auto& loader_data = xam->loader_data();
|
||||
if (loader_data.launch_data_ptr) {
|
||||
|
@ -112,7 +113,7 @@ dword_result_t XamLoaderSetLaunchData(lpvoid_t data, dword_t size) {
|
|||
DECLARE_XAM_EXPORT(XamLoaderSetLaunchData, ExportTag::kSketchy);
|
||||
|
||||
dword_result_t XamLoaderGetLaunchDataSize(lpdword_t size_ptr) {
|
||||
auto xam = kernel_state()->GetKernelModule<kernel::XamModule>("xam.xex");
|
||||
auto xam = kernel_state()->GetKernelModule<XamModule>("xam.xex");
|
||||
|
||||
*size_ptr = xam->loader_data().launch_data_size;
|
||||
|
||||
|
@ -122,7 +123,7 @@ DECLARE_XAM_EXPORT(XamLoaderGetLaunchDataSize, ExportTag::kSketchy);
|
|||
|
||||
dword_result_t XamLoaderGetLaunchData(lpvoid_t buffer_ptr,
|
||||
dword_t buffer_size) {
|
||||
auto xam = kernel_state()->GetKernelModule<kernel::XamModule>("xam.xex");
|
||||
auto xam = kernel_state()->GetKernelModule<XamModule>("xam.xex");
|
||||
|
||||
auto& loader_data = xam->loader_data();
|
||||
if (loader_data.launch_data_ptr) {
|
||||
|
@ -140,7 +141,7 @@ dword_result_t XamLoaderGetLaunchData(lpvoid_t buffer_ptr,
|
|||
DECLARE_XAM_EXPORT(XamLoaderGetLaunchData, ExportTag::kSketchy);
|
||||
|
||||
void XamLoaderLaunchTitle(lpstring_t raw_name, dword_t flags) {
|
||||
auto xam = kernel_state()->GetKernelModule<kernel::XamModule>("xam.xex");
|
||||
auto xam = kernel_state()->GetKernelModule<XamModule>("xam.xex");
|
||||
|
||||
auto& loader_data = xam->loader_data();
|
||||
loader_data.launch_flags = flags;
|
||||
|
@ -240,11 +241,8 @@ dword_result_t XamEnumerate(dword_t handle, dword_t flags, lpvoid_t buffer,
|
|||
}
|
||||
DECLARE_XAM_EXPORT(XamEnumerate, ExportTag::kImplemented);
|
||||
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
void xe::kernel::xam::RegisterInfoExports(
|
||||
xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {
|
||||
void RegisterInfoExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state) {
|
||||
SHIM_SET_MAPPING("xam.xex", XamGetSystemVersion, state);
|
||||
SHIM_SET_MAPPING("xam.xex", XGetAVPack, state);
|
||||
SHIM_SET_MAPPING("xam.xex", XGetGameRegion, state);
|
||||
|
@ -255,3 +253,7 @@ void xe::kernel::xam::RegisterInfoExports(
|
|||
SHIM_SET_MAPPING("xam.xex", XamAlloc, state);
|
||||
SHIM_SET_MAPPING("xam.xex", XamFree, state);
|
||||
}
|
||||
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -13,11 +13,12 @@
|
|||
#include "xenia/hid/input_system.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xam_private.h"
|
||||
#include "xenia/kernel/xam/xam_private.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xam {
|
||||
|
||||
using xe::hid::X_INPUT_CAPABILITIES;
|
||||
using xe::hid::X_INPUT_KEYSTROKE;
|
||||
|
@ -253,11 +254,8 @@ SHIM_CALL XamUserGetDeviceContext_shim(PPCContext* ppc_context,
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
void xe::kernel::xam::RegisterInputExports(
|
||||
xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {
|
||||
void RegisterInputExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state) {
|
||||
SHIM_SET_MAPPING("xam.xex", XamResetInactivity, state);
|
||||
SHIM_SET_MAPPING("xam.xex", XamEnableInactivityProcessing, state);
|
||||
SHIM_SET_MAPPING("xam.xex", XamInputGetCapabilities, state);
|
||||
|
@ -268,3 +266,7 @@ void xe::kernel::xam::RegisterInputExports(
|
|||
SHIM_SET_MAPPING("xam.xex", XamInputGetKeystrokeEx, state);
|
||||
SHIM_SET_MAPPING("xam.xex", XamUserGetDeviceContext, state);
|
||||
}
|
||||
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -7,34 +7,35 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/kernel/xam_module.h"
|
||||
#include "xenia/kernel/xam/xam_module.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/xam_private.h"
|
||||
#include "xenia/kernel/xam/xam_private.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xam {
|
||||
|
||||
XamModule::XamModule(Emulator* emulator, KernelState* kernel_state)
|
||||
: XKernelModule(kernel_state, "xe:\\xam.xex"), loader_data_() {
|
||||
: KernelModule(kernel_state, "xe:\\xam.xex"), loader_data_() {
|
||||
RegisterExportTable(export_resolver_);
|
||||
|
||||
// Register all exported functions.
|
||||
xam::RegisterAvatarExports(export_resolver_, kernel_state_);
|
||||
xam::RegisterContentExports(export_resolver_, kernel_state_);
|
||||
xam::RegisterInfoExports(export_resolver_, kernel_state_);
|
||||
xam::RegisterInputExports(export_resolver_, kernel_state_);
|
||||
xam::RegisterMsgExports(export_resolver_, kernel_state_);
|
||||
xam::RegisterNetExports(export_resolver_, kernel_state_);
|
||||
xam::RegisterNotifyExports(export_resolver_, kernel_state_);
|
||||
xam::RegisterNuiExports(export_resolver_, kernel_state_);
|
||||
xam::RegisterUIExports(export_resolver_, kernel_state_);
|
||||
xam::RegisterUserExports(export_resolver_, kernel_state_);
|
||||
xam::RegisterVideoExports(export_resolver_, kernel_state_);
|
||||
xam::RegisterVoiceExports(export_resolver_, kernel_state_);
|
||||
RegisterAvatarExports(export_resolver_, kernel_state_);
|
||||
RegisterContentExports(export_resolver_, kernel_state_);
|
||||
RegisterInfoExports(export_resolver_, kernel_state_);
|
||||
RegisterInputExports(export_resolver_, kernel_state_);
|
||||
RegisterMsgExports(export_resolver_, kernel_state_);
|
||||
RegisterNetExports(export_resolver_, kernel_state_);
|
||||
RegisterNotifyExports(export_resolver_, kernel_state_);
|
||||
RegisterNuiExports(export_resolver_, kernel_state_);
|
||||
RegisterUIExports(export_resolver_, kernel_state_);
|
||||
RegisterUserExports(export_resolver_, kernel_state_);
|
||||
RegisterVideoExports(export_resolver_, kernel_state_);
|
||||
RegisterVoiceExports(export_resolver_, kernel_state_);
|
||||
}
|
||||
|
||||
std::vector<xe::cpu::Export*> xam_exports(4096);
|
||||
|
@ -51,7 +52,7 @@ void XamModule::RegisterExportTable(xe::cpu::ExportResolver* export_resolver) {
|
|||
// Build the export table used for resolution.
|
||||
#include "xenia/kernel/util/export_table_pre.inc"
|
||||
static xe::cpu::Export xam_export_table[] = {
|
||||
#include "xenia/kernel/xam_table.inc"
|
||||
#include "xenia/kernel/xam/xam_table.inc"
|
||||
};
|
||||
#include "xenia/kernel/util/export_table_post.inc"
|
||||
for (size_t i = 0; i < xe::countof(xam_export_table); ++i) {
|
||||
|
@ -66,5 +67,6 @@ void XamModule::RegisterExportTable(xe::cpu::ExportResolver* export_resolver) {
|
|||
|
||||
XamModule::~XamModule() {}
|
||||
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -7,19 +7,21 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XAM_MODULE_H_
|
||||
#define XENIA_KERNEL_XAM_MODULE_H_
|
||||
#ifndef XENIA_KERNEL_XAM_XAM_MODULE_H_
|
||||
#define XENIA_KERNEL_XAM_XAM_MODULE_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "xenia/cpu/export_resolver.h"
|
||||
#include "xenia/kernel/objects/xkernel_module.h"
|
||||
#include "xenia/kernel/xam_ordinals.h"
|
||||
#include "xenia/kernel/kernel_module.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/xam/xam_ordinals.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xam {
|
||||
|
||||
class XamModule : public XKernelModule {
|
||||
class XamModule : public KernelModule {
|
||||
public:
|
||||
XamModule(Emulator* emulator, KernelState* kernel_state);
|
||||
virtual ~XamModule();
|
||||
|
@ -40,7 +42,8 @@ class XamModule : public XKernelModule {
|
|||
LoaderData loader_data_;
|
||||
};
|
||||
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XAM_MODULE_H_
|
||||
#endif // XENIA_KERNEL_XAM_XAM_MODULE_H_
|
|
@ -9,13 +9,14 @@
|
|||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/objects/xevent.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xam_private.h"
|
||||
#include "xenia/kernel/xam/xam_private.h"
|
||||
#include "xenia/kernel/xevent.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xam {
|
||||
|
||||
SHIM_CALL XMsgInProcessCall_shim(PPCContext* ppc_context,
|
||||
KernelState* kernel_state) {
|
||||
|
@ -117,14 +118,15 @@ SHIM_CALL XMsgCancelIORequest_shim(PPCContext* ppc_context,
|
|||
SHIM_SET_RETURN_32(0);
|
||||
}
|
||||
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
void xe::kernel::xam::RegisterMsgExports(
|
||||
xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {
|
||||
void RegisterMsgExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state) {
|
||||
SHIM_SET_MAPPING("xam.xex", XMsgInProcessCall, state);
|
||||
SHIM_SET_MAPPING("xam.xex", XMsgSystemProcessCall, state);
|
||||
SHIM_SET_MAPPING("xam.xex", XMsgStartIORequest, state);
|
||||
SHIM_SET_MAPPING("xam.xex", XMsgStartIORequestEx, state);
|
||||
SHIM_SET_MAPPING("xam.xex", XMsgCancelIORequest, state);
|
||||
}
|
||||
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -12,10 +12,12 @@
|
|||
#include "xenia/base/clock.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/objects/xevent.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xam_private.h"
|
||||
#include "xenia/kernel/xam/xam_private.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_error.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_threading.h"
|
||||
#include "xenia/kernel/xevent.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
// NOTE: must be included last as it expects windows.h to already be included.
|
||||
|
@ -24,6 +26,7 @@
|
|||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xam {
|
||||
|
||||
// https://github.com/G91/TitanOffLine/blob/1e692d9bb9dfac386d08045ccdadf4ae3227bb5e/xkelib/xam/xamNet.h
|
||||
enum {
|
||||
|
@ -255,12 +258,6 @@ dword_result_t NetDll_WSARecvFrom(dword_t caller, dword_t socket,
|
|||
}
|
||||
DECLARE_XAM_EXPORT(NetDll_WSARecvFrom, ExportTag::kNetworking);
|
||||
|
||||
dword_result_t NtWaitForMultipleObjectsEx(
|
||||
dword_t count, pointer_t<xe::be<uint32_t>> handles, dword_t wait_type,
|
||||
dword_t wait_mode, dword_t alertable,
|
||||
pointer_t<xe::be<uint64_t>> timeout_ptr);
|
||||
dword_result_t RtlNtStatusToDosError(dword_t source_status);
|
||||
|
||||
dword_result_t NetDll_WSAWaitForMultipleEvents(
|
||||
dword_t num_events, pointer_t<xe::be<uint32_t>> events, dword_t wait_all,
|
||||
dword_t timeout, dword_t alertable) {
|
||||
|
@ -273,13 +270,13 @@ dword_result_t NetDll_WSAWaitForMultipleEvents(
|
|||
|
||||
X_STATUS result = 0;
|
||||
do {
|
||||
result =
|
||||
NtWaitForMultipleObjectsEx(num_events, events, wait_all, 1, alertable,
|
||||
result = xboxkrnl::NtWaitForMultipleObjectsEx(
|
||||
num_events, events, wait_all, 1, alertable,
|
||||
timeout != -1 ? &timeout_wait : nullptr);
|
||||
} while (result == X_STATUS_ALERTED);
|
||||
|
||||
if (XFAILED(result)) {
|
||||
uint32_t error = RtlNtStatusToDosError(result);
|
||||
uint32_t error = xboxkrnl::RtlNtStatusToDosError(result);
|
||||
XThread::GetCurrentThread()->set_last_error(error);
|
||||
return ~0u;
|
||||
}
|
||||
|
@ -299,7 +296,7 @@ DECLARE_XAM_EXPORT(NetDll_WSACreateEvent,
|
|||
dword_result_t NetDll_WSACloseEvent(dword_t event_handle) {
|
||||
X_STATUS result = kernel_state()->object_table()->ReleaseHandle(event_handle);
|
||||
if (XFAILED(result)) {
|
||||
uint32_t error = RtlNtStatusToDosError(result);
|
||||
uint32_t error = xboxkrnl::RtlNtStatusToDosError(result);
|
||||
XThread::GetCurrentThread()->set_last_error(error);
|
||||
return 0;
|
||||
}
|
||||
|
@ -308,12 +305,10 @@ dword_result_t NetDll_WSACloseEvent(dword_t event_handle) {
|
|||
DECLARE_XAM_EXPORT(NetDll_WSACloseEvent,
|
||||
ExportTag::kNetworking | ExportTag::kThreading);
|
||||
|
||||
dword_result_t NtClearEvent(dword_t handle);
|
||||
|
||||
dword_result_t NetDll_WSAResetEvent(dword_t event_handle) {
|
||||
X_STATUS result = NtClearEvent(event_handle);
|
||||
X_STATUS result = xboxkrnl::NtClearEvent(event_handle);
|
||||
if (XFAILED(result)) {
|
||||
uint32_t error = RtlNtStatusToDosError(result);
|
||||
uint32_t error = xboxkrnl::RtlNtStatusToDosError(result);
|
||||
XThread::GetCurrentThread()->set_last_error(error);
|
||||
return 0;
|
||||
}
|
||||
|
@ -322,12 +317,10 @@ dword_result_t NetDll_WSAResetEvent(dword_t event_handle) {
|
|||
DECLARE_XAM_EXPORT(NetDll_WSAResetEvent,
|
||||
ExportTag::kNetworking | ExportTag::kThreading);
|
||||
|
||||
dword_result_t NtSetEvent(dword_t handle, lpdword_t previous_state_ptr);
|
||||
|
||||
dword_result_t NetDll_WSASetEvent(dword_t event_handle) {
|
||||
X_STATUS result = NtSetEvent(event_handle, nullptr);
|
||||
X_STATUS result = xboxkrnl::NtSetEvent(event_handle, nullptr);
|
||||
if (XFAILED(result)) {
|
||||
uint32_t error = RtlNtStatusToDosError(result);
|
||||
uint32_t error = xboxkrnl::RtlNtStatusToDosError(result);
|
||||
XThread::GetCurrentThread()->set_last_error(error);
|
||||
return 0;
|
||||
}
|
||||
|
@ -725,11 +718,8 @@ SHIM_CALL NetDll_sendto_shim(PPCContext* ppc_context,
|
|||
SHIM_SET_RETURN_32(ret);
|
||||
}
|
||||
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
void xe::kernel::xam::RegisterNetExports(
|
||||
xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {
|
||||
void RegisterNetExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state) {
|
||||
SHIM_SET_MAPPING("xam.xex", NetDll_XNetStartup, state);
|
||||
SHIM_SET_MAPPING("xam.xex", NetDll_XNetCleanup, state);
|
||||
SHIM_SET_MAPPING("xam.xex", NetDll_XNetRandom, state);
|
||||
|
@ -752,3 +742,7 @@ void xe::kernel::xam::RegisterNetExports(
|
|||
SHIM_SET_MAPPING("xam.xex", NetDll_send, state);
|
||||
SHIM_SET_MAPPING("xam.xex", NetDll_sendto, state);
|
||||
}
|
||||
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -9,13 +9,14 @@
|
|||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/objects/xnotify_listener.h"
|
||||
#include "xenia/kernel/notify_listener.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xam_private.h"
|
||||
#include "xenia/kernel/xam/xam_private.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xam {
|
||||
|
||||
SHIM_CALL XamNotifyCreateListener_shim(PPCContext* ppc_context,
|
||||
KernelState* kernel_state) {
|
||||
|
@ -26,8 +27,7 @@ SHIM_CALL XamNotifyCreateListener_shim(PPCContext* ppc_context,
|
|||
|
||||
// r4=1 may indicate user process?
|
||||
|
||||
auto listener =
|
||||
object_ref<XNotifyListener>(new XNotifyListener(kernel_state));
|
||||
auto listener = object_ref<NotifyListener>(new NotifyListener(kernel_state));
|
||||
listener->Initialize(mask);
|
||||
|
||||
// Handle ref is incremented, so return that.
|
||||
|
@ -54,7 +54,7 @@ SHIM_CALL XNotifyGetNext_shim(PPCContext* ppc_context,
|
|||
|
||||
// Grab listener.
|
||||
auto listener =
|
||||
kernel_state->object_table()->LookupObject<XNotifyListener>(handle);
|
||||
kernel_state->object_table()->LookupObject<NotifyListener>(handle);
|
||||
if (!listener) {
|
||||
SHIM_SET_RETURN_32(0);
|
||||
return;
|
||||
|
@ -102,13 +102,14 @@ SHIM_CALL XNotifyPositionUI_shim(PPCContext* ppc_context,
|
|||
// Ignored.
|
||||
}
|
||||
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
void xe::kernel::xam::RegisterNotifyExports(
|
||||
xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {
|
||||
void RegisterNotifyExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state) {
|
||||
SHIM_SET_MAPPING("xam.xex", XamNotifyCreateListener, state);
|
||||
SHIM_SET_MAPPING("xam.xex", XNotifyGetNext, state);
|
||||
SHIM_SET_MAPPING("xam.xex", XNotifyDelayUI, state);
|
||||
SHIM_SET_MAPPING("xam.xex", XNotifyPositionUI, state);
|
||||
}
|
||||
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -11,11 +11,12 @@
|
|||
#include "xenia/emulator.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xam_private.h"
|
||||
#include "xenia/kernel/xam/xam_private.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xam {
|
||||
|
||||
struct X_NUI_DEVICE_STATUS {
|
||||
xe::be<uint32_t> unk0;
|
||||
|
@ -33,8 +34,9 @@ void XamNuiGetDeviceStatus(pointer_t<X_NUI_DEVICE_STATUS> status_ptr) {
|
|||
}
|
||||
DECLARE_XAM_EXPORT(XamNuiGetDeviceStatus, ExportTag::kStub);
|
||||
|
||||
void RegisterNuiExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state) {}
|
||||
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
void xe::kernel::xam::RegisterNuiExports(
|
||||
xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {}
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XAM_ORDINALS_H_
|
||||
#define XENIA_KERNEL_XAM_ORDINALS_H_
|
||||
#ifndef XENIA_KERNEL_XAM_XAM_ORDINALS_H_
|
||||
#define XENIA_KERNEL_XAM_XAM_ORDINALS_H_
|
||||
|
||||
#include "xenia/cpu/export_resolver.h"
|
||||
|
||||
|
@ -16,9 +16,9 @@
|
|||
#include "xenia/kernel/util/ordinal_table_pre.inc"
|
||||
namespace ordinals {
|
||||
enum {
|
||||
#include "xenia/kernel/xam_table.inc"
|
||||
#include "xenia/kernel/xam/xam_table.inc"
|
||||
};
|
||||
} // namespace ordinals
|
||||
#include "xenia/kernel/util/ordinal_table_post.inc"
|
||||
|
||||
#endif // XENIA_KERNEL_XAM_ORDINALS_H_
|
||||
#endif // XENIA_KERNEL_XAM_XAM_ORDINALS_H_
|
|
@ -7,20 +7,19 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XAM_PRIVATE_H_
|
||||
#define XENIA_KERNEL_XAM_PRIVATE_H_
|
||||
#ifndef XENIA_KERNEL_XAM_XAM_PRIVATE_H_
|
||||
#define XENIA_KERNEL_XAM_XAM_PRIVATE_H_
|
||||
|
||||
#include "xenia/cpu/export_resolver.h"
|
||||
#include "xenia/kernel/xam_ordinals.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/xam/xam_ordinals.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
||||
class KernelState;
|
||||
namespace xam {
|
||||
|
||||
xe::cpu::Export* RegisterExport_xam(xe::cpu::Export* export_entry);
|
||||
|
||||
namespace xam {
|
||||
// Registration functions, one per file.
|
||||
void RegisterAvatarExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state);
|
||||
|
@ -46,9 +45,9 @@ void RegisterVideoExports(xe::cpu::ExportResolver* export_resolver,
|
|||
KernelState* kernel_state);
|
||||
void RegisterVoiceExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state);
|
||||
} // namespace xam
|
||||
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XAM_PRIVATE_H_
|
||||
#endif // XENIA_KERNEL_XAM_XAM_PRIVATE_H_
|
|
@ -12,12 +12,13 @@
|
|||
#include "xenia/emulator.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xam_private.h"
|
||||
#include "xenia/kernel/xam/xam_private.h"
|
||||
#include "xenia/ui/window.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xam {
|
||||
|
||||
SHIM_CALL XamIsUIActive_shim(PPCContext* ppc_context,
|
||||
KernelState* kernel_state) {
|
||||
|
@ -406,12 +407,13 @@ SHIM_CALL XamShowDirtyDiscErrorUI_shim(PPCContext* ppc_context,
|
|||
exit(1);
|
||||
}
|
||||
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
void xe::kernel::xam::RegisterUIExports(
|
||||
xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {
|
||||
void RegisterUIExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state) {
|
||||
SHIM_SET_MAPPING("xam.xex", XamIsUIActive, state);
|
||||
SHIM_SET_MAPPING("xam.xex", XamShowMessageBoxUI, state);
|
||||
SHIM_SET_MAPPING("xam.xex", XamShowDirtyDiscErrorUI, state);
|
||||
}
|
||||
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -11,14 +11,15 @@
|
|||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/objects/xenumerator.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xam_private.h"
|
||||
#include "xenia/kernel/xam/xam_private.h"
|
||||
#include "xenia/kernel/xenumerator.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xam {
|
||||
|
||||
SHIM_CALL XamUserGetXUID_shim(PPCContext* ppc_context,
|
||||
KernelState* kernel_state) {
|
||||
|
@ -538,6 +539,7 @@ SHIM_CALL XamSessionRefObjByHandle_shim(PPCContext* ppc_context,
|
|||
SHIM_SET_RETURN_32(X_ERROR_FUNCTION_FAILED);
|
||||
}
|
||||
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
|
@ -10,25 +10,26 @@
|
|||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xam_private.h"
|
||||
#include "xenia/kernel/xam/xam_private.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_video.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
||||
// TODO(benvanik): actually check to see if these are the same.
|
||||
void VdQueryVideoMode(pointer_t<X_VIDEO_MODE> video_mode);
|
||||
namespace xam {
|
||||
|
||||
void XGetVideoMode(pointer_t<X_VIDEO_MODE> video_mode) {
|
||||
VdQueryVideoMode(std::move(video_mode));
|
||||
// TODO(benvanik): actually check to see if these are the same.
|
||||
xboxkrnl::VdQueryVideoMode(std::move(video_mode));
|
||||
}
|
||||
DECLARE_XAM_EXPORT(XGetVideoMode, ExportTag::kVideo | ExportTag::kSketchy);
|
||||
|
||||
dword_result_t XGetVideoCapabilities() { return 0; }
|
||||
DECLARE_XAM_EXPORT(XGetVideoCapabilities, ExportTag::kVideo | ExportTag::kStub);
|
||||
|
||||
void RegisterVideoExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state) {}
|
||||
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
void xe::kernel::xam::RegisterVideoExports(
|
||||
xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {}
|
|
@ -8,14 +8,14 @@
|
|||
*/
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xam_private.h"
|
||||
#include "xenia/kernel/xam/xam_private.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xam {
|
||||
|
||||
dword_result_t XamVoiceIsActiveProcess() {
|
||||
// Returning 0 here will short-circuit a bunch of voice stuff.
|
||||
|
@ -38,8 +38,9 @@ DECLARE_XAM_EXPORT(XamVoiceClose, ExportTag::kStub);
|
|||
dword_result_t XamVoiceHeadsetPresent(lpunknown_t voice_ptr) { return 0; }
|
||||
DECLARE_XAM_EXPORT(XamVoiceHeadsetPresent, ExportTag::kStub);
|
||||
|
||||
void RegisterVoiceExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state) {}
|
||||
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
void xe::kernel::xam::RegisterVoiceExports(
|
||||
xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {}
|
|
@ -12,11 +12,12 @@
|
|||
#include "xenia/emulator.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_private.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xboxkrnl {
|
||||
|
||||
SHIM_CALL XAudioGetSpeakerConfig_shim(PPCContext* ppc_context,
|
||||
KernelState* kernel_state) {
|
||||
|
@ -122,11 +123,8 @@ SHIM_CALL XAudioSubmitRenderDriverFrame_shim(PPCContext* ppc_context,
|
|||
SHIM_SET_RETURN_32(X_ERROR_SUCCESS);
|
||||
}
|
||||
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
void xe::kernel::xboxkrnl::RegisterAudioExports(
|
||||
xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {
|
||||
void RegisterAudioExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state) {
|
||||
// Additional XMA* methods are in xboxkrnl_audio_xma.cc.
|
||||
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", XAudioGetSpeakerConfig, state);
|
||||
|
@ -139,3 +137,7 @@ void xe::kernel::xboxkrnl::RegisterAudioExports(
|
|||
SHIM_SET_MAPPING("xboxkrnl.exe", XAudioUnregisterRenderDriverClient, state);
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", XAudioSubmitRenderDriverFrame, state);
|
||||
}
|
||||
|
||||
} // namespace xboxkrnl
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -15,11 +15,12 @@
|
|||
#include "xenia/emulator.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_private.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xboxkrnl {
|
||||
|
||||
using xe::apu::XMA_CONTEXT_DATA;
|
||||
|
||||
|
@ -352,11 +353,8 @@ SHIM_CALL XMABlockWhileInUse_shim(PPCContext* ppc_context,
|
|||
SHIM_SET_RETURN_32(0);
|
||||
}
|
||||
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
void xe::kernel::xboxkrnl::RegisterAudioXmaExports(
|
||||
xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {
|
||||
void RegisterAudioXmaExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state) {
|
||||
// Used for both XMA* methods and direct register access.
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", XMACreateContext, state);
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", XMAReleaseContext, state);
|
||||
|
@ -368,3 +366,7 @@ void xe::kernel::xboxkrnl::RegisterAudioXmaExports(
|
|||
SHIM_SET_MAPPING("xboxkrnl.exe", XMADisableContext, state);
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", XMABlockWhileInUse, state);
|
||||
}
|
||||
|
||||
} // namespace xboxkrnl
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -10,13 +10,14 @@
|
|||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_private.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
#include "third_party/crypto/TinySHA1.hpp"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xboxkrnl {
|
||||
|
||||
typedef struct {
|
||||
xe::be<uint32_t> count; // 0x0
|
||||
|
@ -127,8 +128,9 @@ dword_result_t XeCryptBnDwLePkcs1Verify(lpvoid_t hash, lpvoid_t sig,
|
|||
}
|
||||
DECLARE_XBOXKRNL_EXPORT(XeCryptBnDwLePkcs1Verify, ExportTag::kStub);
|
||||
|
||||
void xe::kernel::xboxkrnl::RegisterCryptExports(
|
||||
xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {}
|
||||
void RegisterCryptExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state) {}
|
||||
|
||||
} // namespace xboxkrnl
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -10,13 +10,14 @@
|
|||
#include "xenia/base/debugging.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xboxkrnl {
|
||||
|
||||
void DbgBreakPoint() { xe::debugging::Break(); }
|
||||
DECLARE_XBOXKRNL_EXPORT(DbgBreakPoint, ExportTag::kImportant);
|
||||
|
@ -104,8 +105,9 @@ DECLARE_XBOXKRNL_EXPORT(KeBugCheckEx, ExportTag::kImportant);
|
|||
void KeBugCheck(dword_t code) { KeBugCheckEx(code, 0, 0, 0, 0); }
|
||||
DECLARE_XBOXKRNL_EXPORT(KeBugCheck, ExportTag::kImportant);
|
||||
|
||||
void RegisterDebugExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state) {}
|
||||
|
||||
} // namespace xboxkrnl
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
void xe::kernel::xboxkrnl::RegisterDebugExports(
|
||||
xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {}
|
|
@ -13,14 +13,16 @@
|
|||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/string.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/objects/xuser_module.h"
|
||||
#include "xenia/kernel/user_module.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/util/xex2.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_error.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xboxkrnl {
|
||||
|
||||
struct error_lookup_table {
|
||||
uint32_t base_code;
|
||||
|
@ -1012,8 +1014,9 @@ dword_result_t RtlNtStatusToDosError(dword_t source_status) {
|
|||
DECLARE_XBOXKRNL_EXPORT(RtlNtStatusToDosError,
|
||||
ExportTag::kImportant | ExportTag::kLogResult);
|
||||
|
||||
void RegisterErrorExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state) {}
|
||||
|
||||
} // namespace xboxkrnl
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
void xe::kernel::xboxkrnl::RegisterErrorExports(
|
||||
xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {}
|
|
@ -0,0 +1,26 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* 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_XBOXKRNL_ERROR_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_XBOXKRNL_ERROR_H_
|
||||
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xboxkrnl {
|
||||
|
||||
dword_result_t RtlNtStatusToDosError(dword_t source_status);
|
||||
|
||||
} // namespace xboxkrnl
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_XBOXKRNL_ERROR_H_
|
|
@ -10,11 +10,12 @@
|
|||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_private.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xboxkrnl {
|
||||
|
||||
void HalReturnToFirmware(dword_t routine) {
|
||||
// void
|
||||
|
@ -30,8 +31,9 @@ void HalReturnToFirmware(dword_t routine) {
|
|||
}
|
||||
DECLARE_XBOXKRNL_EXPORT(HalReturnToFirmware, ExportTag::kImportant);
|
||||
|
||||
void RegisterHalExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state) {}
|
||||
|
||||
} // namespace xboxkrnl
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
void xe::kernel::xboxkrnl::RegisterHalExports(
|
||||
xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {}
|
|
@ -11,16 +11,17 @@
|
|||
#include "xenia/base/memory.h"
|
||||
#include "xenia/cpu/processor.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/objects/xevent.h"
|
||||
#include "xenia/kernel/objects/xfile.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/xevent.h"
|
||||
#include "xenia/kernel/xfile.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
#include "xenia/vfs/device.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xboxkrnl {
|
||||
|
||||
// http://msdn.microsoft.com/en-us/library/windows/hardware/ff540287.aspx
|
||||
class X_FILE_FS_VOLUME_INFORMATION {
|
||||
|
@ -659,13 +660,14 @@ SHIM_CALL FscSetCacheElementCount_shim(PPCContext* ppc_context,
|
|||
SHIM_SET_RETURN_32(X_STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
void xe::kernel::xboxkrnl::RegisterIoExports(
|
||||
xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {
|
||||
void RegisterIoExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state) {
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", NtQueryVolumeInformationFile, state);
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", NtFlushBuffersFile, state);
|
||||
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", FscSetCacheElementCount, state);
|
||||
}
|
||||
|
||||
} // namespace xboxkrnl
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -13,11 +13,12 @@
|
|||
#include "xenia/base/math.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_private.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xboxkrnl {
|
||||
|
||||
uint32_t ToXdkProtectFlags(uint32_t protect) {
|
||||
uint32_t result = 0;
|
||||
|
@ -581,11 +582,8 @@ SHIM_CALL MmDeleteKernelStack_shim(PPCContext* ppc_context,
|
|||
SHIM_SET_RETURN_32(0);
|
||||
}
|
||||
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
void xe::kernel::xboxkrnl::RegisterMemoryExports(
|
||||
xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {
|
||||
void RegisterMemoryExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state) {
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", NtAllocateVirtualMemory, state);
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", NtFreeVirtualMemory, state);
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", NtQueryVirtualMemory, state);
|
||||
|
@ -607,3 +605,7 @@ void xe::kernel::xboxkrnl::RegisterMemoryExports(
|
|||
SHIM_SET_MAPPING("xboxkrnl.exe", MmCreateKernelStack, state);
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", MmDeleteKernelStack, state);
|
||||
}
|
||||
|
||||
} // namespace xboxkrnl
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -9,13 +9,14 @@
|
|||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xboxkrnl {
|
||||
|
||||
SHIM_CALL KeEnableFpuExceptions_shim(PPCContext* ppc_context,
|
||||
KernelState* kernel_state) {
|
||||
|
@ -24,10 +25,11 @@ SHIM_CALL KeEnableFpuExceptions_shim(PPCContext* ppc_context,
|
|||
// TODO(benvanik): can we do anything about exceptions?
|
||||
}
|
||||
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
void xe::kernel::xboxkrnl::RegisterMiscExports(
|
||||
xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {
|
||||
void RegisterMiscExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state) {
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", KeEnableFpuExceptions, state);
|
||||
}
|
||||
|
||||
} // namespace xboxkrnl
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -7,7 +7,7 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/kernel/xboxkrnl_module.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_module.h"
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
|
@ -18,34 +18,35 @@
|
|||
#include "xenia/base/math.h"
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/objects/xuser_module.h"
|
||||
#include "xenia/kernel/user_module.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_private.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xboxkrnl {
|
||||
|
||||
XboxkrnlModule::XboxkrnlModule(Emulator* emulator, KernelState* kernel_state)
|
||||
: XKernelModule(kernel_state, "xe:\\xboxkrnl.exe"),
|
||||
: KernelModule(kernel_state, "xe:\\xboxkrnl.exe"),
|
||||
timestamp_timer_(nullptr) {
|
||||
RegisterExportTable(export_resolver_);
|
||||
|
||||
// Register all exported functions.
|
||||
xboxkrnl::RegisterAudioExports(export_resolver_, kernel_state_);
|
||||
xboxkrnl::RegisterAudioXmaExports(export_resolver_, kernel_state_);
|
||||
xboxkrnl::RegisterCryptExports(export_resolver_, kernel_state_);
|
||||
xboxkrnl::RegisterDebugExports(export_resolver_, kernel_state_);
|
||||
xboxkrnl::RegisterErrorExports(export_resolver_, kernel_state_);
|
||||
xboxkrnl::RegisterHalExports(export_resolver_, kernel_state_);
|
||||
xboxkrnl::RegisterIoExports(export_resolver_, kernel_state_);
|
||||
xboxkrnl::RegisterMemoryExports(export_resolver_, kernel_state_);
|
||||
xboxkrnl::RegisterMiscExports(export_resolver_, kernel_state_);
|
||||
xboxkrnl::RegisterModuleExports(export_resolver_, kernel_state_);
|
||||
xboxkrnl::RegisterObExports(export_resolver_, kernel_state_);
|
||||
xboxkrnl::RegisterRtlExports(export_resolver_, kernel_state_);
|
||||
xboxkrnl::RegisterStringExports(export_resolver_, kernel_state_);
|
||||
xboxkrnl::RegisterThreadingExports(export_resolver_, kernel_state_);
|
||||
xboxkrnl::RegisterUsbcamExports(export_resolver_, kernel_state_);
|
||||
xboxkrnl::RegisterVideoExports(export_resolver_, kernel_state_);
|
||||
RegisterAudioExports(export_resolver_, kernel_state_);
|
||||
RegisterAudioXmaExports(export_resolver_, kernel_state_);
|
||||
RegisterCryptExports(export_resolver_, kernel_state_);
|
||||
RegisterDebugExports(export_resolver_, kernel_state_);
|
||||
RegisterErrorExports(export_resolver_, kernel_state_);
|
||||
RegisterHalExports(export_resolver_, kernel_state_);
|
||||
RegisterIoExports(export_resolver_, kernel_state_);
|
||||
RegisterMemoryExports(export_resolver_, kernel_state_);
|
||||
RegisterMiscExports(export_resolver_, kernel_state_);
|
||||
RegisterModuleExports(export_resolver_, kernel_state_);
|
||||
RegisterObExports(export_resolver_, kernel_state_);
|
||||
RegisterRtlExports(export_resolver_, kernel_state_);
|
||||
RegisterStringExports(export_resolver_, kernel_state_);
|
||||
RegisterThreadingExports(export_resolver_, kernel_state_);
|
||||
RegisterUsbcamExports(export_resolver_, kernel_state_);
|
||||
RegisterVideoExports(export_resolver_, kernel_state_);
|
||||
|
||||
// KeDebugMonitorData (?*)
|
||||
// Set to a valid value when a remote debugger is attached.
|
||||
|
@ -154,7 +155,7 @@ void XboxkrnlModule::RegisterExportTable(
|
|||
// Build the export table used for resolution.
|
||||
#include "xenia/kernel/util/export_table_pre.inc"
|
||||
static xe::cpu::Export xboxkrnl_export_table[] = {
|
||||
#include "xenia/kernel/xboxkrnl_table.inc"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_table.inc"
|
||||
};
|
||||
#include "xenia/kernel/util/export_table_post.inc"
|
||||
for (size_t i = 0; i < xe::countof(xboxkrnl_export_table); ++i) {
|
||||
|
@ -196,5 +197,6 @@ int XboxkrnlModule::LaunchModule(const char* path) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
} // namespace xboxkrnl
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -7,25 +7,25 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_MODULE_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_MODULE_H_
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_XBOXKRNL_MODULE_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_XBOXKRNL_MODULE_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "xenia/base/threading.h"
|
||||
#include "xenia/cpu/export_resolver.h"
|
||||
#include "xenia/kernel/objects/xkernel_module.h"
|
||||
#include "xenia/kernel/xboxkrnl_ordinals.h"
|
||||
#include "xenia/kernel/kernel_module.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_ordinals.h"
|
||||
|
||||
// All of the exported functions:
|
||||
#include "xenia/kernel/xboxkrnl_rtl.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_rtl.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xboxkrnl {
|
||||
|
||||
class KernelState;
|
||||
|
||||
class XboxkrnlModule : public XKernelModule {
|
||||
class XboxkrnlModule : public KernelModule {
|
||||
public:
|
||||
XboxkrnlModule(Emulator* emulator, KernelState* kernel_state);
|
||||
virtual ~XboxkrnlModule();
|
||||
|
@ -38,7 +38,8 @@ class XboxkrnlModule : public XKernelModule {
|
|||
std::unique_ptr<xe::threading::HighResolutionTimer> timestamp_timer_;
|
||||
};
|
||||
|
||||
} // namespace xboxkrnl
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_MODULE_H_
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_XBOXKRNL_MODULE_H_
|
|
@ -10,14 +10,15 @@
|
|||
#include "xenia/base/logging.h"
|
||||
#include "xenia/cpu/processor.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/objects/xuser_module.h"
|
||||
#include "xenia/kernel/user_module.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/util/xex2.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_private.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xboxkrnl {
|
||||
|
||||
X_STATUS xeExGetXConfigSetting(uint16_t category, uint16_t setting,
|
||||
void* buffer, uint16_t buffer_size,
|
||||
|
@ -339,11 +340,8 @@ void ExRegisterTitleTerminateNotification(
|
|||
DECLARE_XBOXKRNL_EXPORT(ExRegisterTitleTerminateNotification,
|
||||
ExportTag::kImplemented);
|
||||
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
void xe::kernel::xboxkrnl::RegisterModuleExports(
|
||||
xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {
|
||||
void RegisterModuleExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state) {
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", ExGetXConfigSetting, state);
|
||||
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", XexCheckExecutablePrivilege, state);
|
||||
|
@ -354,3 +352,7 @@ void xe::kernel::xboxkrnl::RegisterModuleExports(
|
|||
SHIM_SET_MAPPING("xboxkrnl.exe", XexUnloadImage, state);
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", XexGetProcedureAddress, state);
|
||||
}
|
||||
|
||||
} // namespace xboxkrnl
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -9,15 +9,16 @@
|
|||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/objects/xsemaphore.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/xobject.h"
|
||||
#include "xenia/kernel/xsemaphore.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xboxkrnl {
|
||||
|
||||
SHIM_CALL ObOpenObjectByName_shim(PPCContext* ppc_context,
|
||||
KernelState* kernel_state) {
|
||||
|
@ -198,12 +199,13 @@ dword_result_t NtClose(dword_t handle) {
|
|||
}
|
||||
DECLARE_XBOXKRNL_EXPORT(NtClose, ExportTag::kImplemented);
|
||||
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
void xe::kernel::xboxkrnl::RegisterObExports(
|
||||
xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {
|
||||
void RegisterObExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state) {
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", ObOpenObjectByName, state);
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", ObReferenceObjectByHandle, state);
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", ObDereferenceObject, state);
|
||||
}
|
||||
|
||||
} // namespace xboxkrnl
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_ORDINALS_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_ORDINALS_H_
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_XBOXKRNL_ORDINALS_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_XBOXKRNL_ORDINALS_H_
|
||||
|
||||
#include "xenia/cpu/export_resolver.h"
|
||||
|
||||
|
@ -16,9 +16,9 @@
|
|||
#include "xenia/kernel/util/ordinal_table_pre.inc"
|
||||
namespace ordinals {
|
||||
enum {
|
||||
#include "xenia/kernel/xboxkrnl_table.inc"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_table.inc"
|
||||
};
|
||||
} // namespace ordinals
|
||||
#include "xenia/kernel/util/ordinal_table_post.inc"
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_ORDINALS_H_
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_XBOXKRNL_ORDINALS_H_
|
|
@ -7,19 +7,19 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_PRIVATE_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_PRIVATE_H_
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_XBOXKRNL_PRIVATE_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_XBOXKRNL_PRIVATE_H_
|
||||
|
||||
#include "xenia/kernel/xboxkrnl_ordinals.h"
|
||||
#include "xenia/cpu/export_resolver.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_ordinals.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
||||
class KernelState;
|
||||
namespace xboxkrnl {
|
||||
|
||||
xe::cpu::Export* RegisterExport_xboxkrnl(xe::cpu::Export* export_entry);
|
||||
|
||||
namespace xboxkrnl {
|
||||
// Registration functions, one per file.
|
||||
void RegisterAudioExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state);
|
||||
|
@ -53,8 +53,9 @@ void RegisterUsbcamExports(xe::cpu::ExportResolver* export_resolver,
|
|||
KernelState* kernel_state);
|
||||
void RegisterVideoExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state);
|
||||
|
||||
} // namespace xboxkrnl
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_PRIVATE_H_
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_XBOXKRNL_PRIVATE_H_
|
|
@ -7,7 +7,7 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/kernel/xboxkrnl_rtl.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_rtl.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
@ -17,17 +17,18 @@
|
|||
#include "xenia/base/string.h"
|
||||
#include "xenia/base/threading.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/objects/xuser_module.h"
|
||||
#include "xenia/kernel/user_module.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/util/xex2.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
|
||||
// For FileTimeToSystemTime and SystemTimeToFileTime:
|
||||
#include "xenia/base/platform_win.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xboxkrnl {
|
||||
|
||||
// http://msdn.microsoft.com/en-us/library/ff561778
|
||||
dword_result_t RtlCompareMemory(lpvoid_t source1, lpvoid_t source2,
|
||||
|
@ -269,7 +270,7 @@ pointer_result_t RtlImageXexHeaderField(pointer_t<xex2_header> xex_header,
|
|||
uint32_t field_value = 0;
|
||||
uint32_t field = field_dword; // VS acts weird going from dword_t -> enum
|
||||
|
||||
XUserModule::GetOptHeader(kernel_memory()->virtual_membase(), xex_header,
|
||||
UserModule::GetOptHeader(kernel_memory()->virtual_membase(), xex_header,
|
||||
xe_xex2_header_keys(field), &field_value);
|
||||
|
||||
return field_value;
|
||||
|
@ -509,11 +510,8 @@ dword_result_t RtlTimeFieldsToTime(pointer_t<X_TIME_FIELDS> time_fields_ptr,
|
|||
}
|
||||
DECLARE_XBOXKRNL_EXPORT(RtlTimeFieldsToTime, ExportTag::kImplemented);
|
||||
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
void xe::kernel::xboxkrnl::RegisterRtlExports(
|
||||
xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {
|
||||
void RegisterRtlExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state) {
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", RtlUnicodeStringToAnsiString, state);
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", RtlMultiByteToUnicodeN, state);
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", RtlUnicodeToMultiByteN, state);
|
||||
|
@ -522,3 +520,7 @@ void xe::kernel::xboxkrnl::RegisterRtlExports(
|
|||
SHIM_SET_MAPPING("xboxkrnl.exe", RtlTryEnterCriticalSection, state);
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", RtlLeaveCriticalSection, state);
|
||||
}
|
||||
|
||||
} // namespace xboxkrnl
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -7,13 +7,14 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_RTL_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_RTL_H_
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_XBOXKRNL_RTL_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_XBOXKRNL_RTL_H_
|
||||
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xboxkrnl {
|
||||
|
||||
struct X_RTL_CRITICAL_SECTION;
|
||||
|
||||
|
@ -23,7 +24,8 @@ X_STATUS xeRtlInitializeCriticalSectionAndSpinCount(X_RTL_CRITICAL_SECTION* cs,
|
|||
uint32_t cs_ptr,
|
||||
uint32_t spin_count);
|
||||
|
||||
} // namespace xboxkrnl
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_RTL_H_
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_XBOXKRNL_RTL_H_
|
|
@ -13,15 +13,16 @@
|
|||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/objects/xuser_module.h"
|
||||
#include "xenia/kernel/user_module.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/util/xex2.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xboxkrnl {
|
||||
|
||||
enum FormatState {
|
||||
FS_Invalid = 0,
|
||||
|
@ -1028,11 +1029,8 @@ SHIM_CALL vswprintf_shim(PPCContext* ppc_context, KernelState* kernel_state) {
|
|||
SHIM_SET_RETURN_32(count);
|
||||
}
|
||||
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
void xe::kernel::xboxkrnl::RegisterStringExports(
|
||||
xe::cpu::ExportResolver* export_resolver, KernelState* state) {
|
||||
void RegisterStringExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* state) {
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", DbgPrint, state);
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", _snprintf, state);
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", sprintf, state);
|
||||
|
@ -1042,3 +1040,7 @@ void xe::kernel::xboxkrnl::RegisterStringExports(
|
|||
SHIM_SET_MAPPING("xboxkrnl.exe", _vscwprintf, state);
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", vswprintf, state);
|
||||
}
|
||||
|
||||
} // namespace xboxkrnl
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -7,24 +7,29 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/base/atomic.h"
|
||||
#include "xenia/base/clock.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/mutex.h"
|
||||
#include "xenia/cpu/processor.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/objects/xevent.h"
|
||||
#include "xenia/kernel/objects/xmutant.h"
|
||||
#include "xenia/kernel/objects/xsemaphore.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/objects/xtimer.h"
|
||||
#include "xenia/kernel/objects/xuser_module.h"
|
||||
#include "xenia/kernel/user_module.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_threading.h"
|
||||
#include "xenia/kernel/xevent.h"
|
||||
#include "xenia/kernel/xmutant.h"
|
||||
#include "xenia/kernel/xsemaphore.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
#include "xenia/kernel/xtimer.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xboxkrnl {
|
||||
|
||||
// r13 + 0x100: pointer to thread local state
|
||||
// Thread local state:
|
||||
|
@ -1391,11 +1396,8 @@ pointer_result_t InterlockedFlushSList(pointer_t<X_SLIST_HEADER> plist_ptr) {
|
|||
}
|
||||
DECLARE_XBOXKRNL_EXPORT(InterlockedFlushSList, ExportTag::kImplemented);
|
||||
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
void xe::kernel::xboxkrnl::RegisterThreadingExports(
|
||||
xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {
|
||||
void RegisterThreadingExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state) {
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", ExCreateThread, state);
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", ExTerminateThread, state);
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", NtResumeThread, state);
|
||||
|
@ -1457,3 +1459,7 @@ void xe::kernel::xboxkrnl::RegisterThreadingExports(
|
|||
SHIM_SET_MAPPING("xboxkrnl.exe", KeInsertQueueDpc, state);
|
||||
SHIM_SET_MAPPING("xboxkrnl.exe", KeRemoveQueueDpc, state);
|
||||
}
|
||||
|
||||
} // namespace xboxkrnl
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* 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_XBOXKRNL_THREADING_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_XBOXKRNL_THREADING_H_
|
||||
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xboxkrnl {
|
||||
|
||||
dword_result_t NtSetEvent(dword_t handle, lpdword_t previous_state_ptr);
|
||||
dword_result_t NtClearEvent(dword_t handle);
|
||||
|
||||
dword_result_t NtWaitForMultipleObjectsEx(
|
||||
dword_t count, pointer_t<xe::be<uint32_t>> handles, dword_t wait_type,
|
||||
dword_t wait_mode, dword_t alertable,
|
||||
pointer_t<xe::be<uint64_t>> timeout_ptr);
|
||||
|
||||
} // namespace xboxkrnl
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_XBOXKRNL_THREADING_H_
|
|
@ -10,11 +10,12 @@
|
|||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_private.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xboxkrnl {
|
||||
|
||||
dword_result_t XUsbcamCreate(unknown_t unk1, // E
|
||||
unknown_t unk2, // 0x4B000
|
||||
|
@ -30,8 +31,9 @@ dword_result_t XUsbcamGetState() {
|
|||
}
|
||||
DECLARE_XBOXKRNL_EXPORT(XUsbcamGetState, ExportTag::kStub);
|
||||
|
||||
void RegisterUsbcamExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state) {}
|
||||
|
||||
} // namespace xboxkrnl
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
void xe::kernel::xboxkrnl::RegisterUsbcamExports(
|
||||
xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {}
|
|
@ -13,12 +13,14 @@
|
|||
#include "xenia/gpu/xenos.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/xboxkrnl_rtl.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_rtl.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_video.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xboxkrnl {
|
||||
|
||||
// http://www.tweakoz.com/orkid/
|
||||
// http://www.tweakoz.com/orkid/dox/d3/d52/xb360init_8cpp_source.html
|
||||
|
@ -372,11 +374,8 @@ void VdSwap(lpvoid_t buffer_ptr, // ptr into primary ringbuffer
|
|||
}
|
||||
DECLARE_XBOXKRNL_EXPORT(VdSwap, ExportTag::kVideo | ExportTag::kImportant);
|
||||
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
void xe::kernel::xboxkrnl::RegisterVideoExports(
|
||||
xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {
|
||||
void RegisterVideoExports(xe::cpu::ExportResolver* export_resolver,
|
||||
KernelState* kernel_state) {
|
||||
auto memory = kernel_state->memory();
|
||||
|
||||
// VdGlobalDevice (4b)
|
||||
|
@ -415,3 +414,7 @@ void xe::kernel::xboxkrnl::RegisterVideoExports(
|
|||
xeRtlInitializeCriticalSectionAndSpinCount(hsio_lock, pVdHSIOCalibrationLock,
|
||||
10000);
|
||||
}
|
||||
|
||||
} // namespace xboxkrnl
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
|
@ -2,25 +2,25 @@
|
|||
******************************************************************************
|
||||
* Xenia : Xbox 360 Emulator Research Project *
|
||||
******************************************************************************
|
||||
* Copyright 2014 Ben Vanik. All rights reserved. *
|
||||
* Copyright 2015 Ben Vanik. All rights reserved. *
|
||||
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_APPS_APPS_H_
|
||||
#define XENIA_KERNEL_APPS_APPS_H_
|
||||
#ifndef XENIA_KERNEL_XBOXKRNL_XBOXKRNL_VIDEO_H_
|
||||
#define XENIA_KERNEL_XBOXKRNL_XBOXKRNL_VIDEO_H_
|
||||
|
||||
#include "xenia/kernel/app.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace apps {
|
||||
namespace xboxkrnl {
|
||||
|
||||
void RegisterApps(KernelState* kernel_state, XAppManager* manager);
|
||||
void VdQueryVideoMode(pointer_t<X_VIDEO_MODE> video_mode);
|
||||
|
||||
} // namespace apps
|
||||
} // namespace xboxkrnl
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_APPS_APPS_H_
|
||||
#endif // XENIA_KERNEL_XBOXKRNL_XBOXKRNL_VIDEO_H_
|
|
@ -7,7 +7,7 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/kernel/objects/xenumerator.h"
|
||||
#include "xenia/kernel/xenumerator.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_OBJECTS_XENUMERATOR_H_
|
||||
#define XENIA_KERNEL_OBJECTS_XENUMERATOR_H_
|
||||
#ifndef XENIA_KERNEL_XENUMERATOR_H_
|
||||
#define XENIA_KERNEL_XENUMERATOR_H_
|
||||
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
|
@ -82,4 +82,4 @@ class XStaticEnumerator : public XEnumerator {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_OBJECTS_XENUMERATOR_H_
|
||||
#endif // XENIA_KERNEL_XENUMERATOR_H_
|
|
@ -8,7 +8,7 @@
|
|||
*/
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/objects/xevent.h"
|
||||
#include "xenia/kernel/xevent.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_OBJECTS_XEVENT_H_
|
||||
#define XENIA_KERNEL_OBJECTS_XEVENT_H_
|
||||
#ifndef XENIA_KERNEL_XEVENT_H_
|
||||
#define XENIA_KERNEL_XEVENT_H_
|
||||
|
||||
#include "xenia/base/threading.h"
|
||||
#include "xenia/kernel/xobject.h"
|
||||
|
@ -44,4 +44,4 @@ class XEvent : public XObject {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_OBJECTS_XEVENT_H_
|
||||
#endif // XENIA_KERNEL_XEVENT_H_
|
|
@ -7,10 +7,10 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/kernel/objects/xfile.h"
|
||||
#include "xenia/kernel/xfile.h"
|
||||
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/kernel/objects/xevent.h"
|
||||
#include "xenia/kernel/xevent.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
|
@ -7,13 +7,13 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_OBJECTS_XFILE_H_
|
||||
#define XENIA_KERNEL_OBJECTS_XFILE_H_
|
||||
#ifndef XENIA_KERNEL_XFILE_H_
|
||||
#define XENIA_KERNEL_XFILE_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "xenia/base/filesystem.h"
|
||||
#include "xenia/kernel/objects/xevent.h"
|
||||
#include "xenia/kernel/xevent.h"
|
||||
#include "xenia/kernel/xobject.h"
|
||||
#include "xenia/vfs/device.h"
|
||||
#include "xenia/vfs/entry.h"
|
||||
|
@ -127,4 +127,4 @@ class XFile : public XObject {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_OBJECTS_XFILE_H_
|
||||
#endif // XENIA_KERNEL_XFILE_H_
|
|
@ -7,7 +7,7 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/kernel/objects/xmodule.h"
|
||||
#include "xenia/kernel/xmodule.h"
|
||||
|
||||
#include "xenia/base/string.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_OBJECTS_XMODULE_H_
|
||||
#define XENIA_KERNEL_OBJECTS_XMODULE_H_
|
||||
#ifndef XENIA_KERNEL_XMODULE_H_
|
||||
#define XENIA_KERNEL_XMODULE_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
|
@ -94,4 +94,4 @@ class XModule : public XObject {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_OBJECTS_XMODULE_H_
|
||||
#endif // XENIA_KERNEL_XMODULE_H_
|
|
@ -7,7 +7,7 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/kernel/objects/xmutant.h"
|
||||
#include "xenia/kernel/xmutant.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_OBJECTS_XMUTANT_H_
|
||||
#define XENIA_KERNEL_OBJECTS_XMUTANT_H_
|
||||
#ifndef XENIA_KERNEL_XMUTANT_H_
|
||||
#define XENIA_KERNEL_XMUTANT_H_
|
||||
|
||||
#include "xenia/base/threading.h"
|
||||
#include "xenia/kernel/xobject.h"
|
||||
|
@ -36,4 +36,4 @@ class XMutant : public XObject {
|
|||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_OBJECTS_XMUTANT_H_
|
||||
#endif // XENIA_KERNEL_XMUTANT_H_
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue