From e5fbf840d2fdfe0b63c1ad72f016086f7ab45bbf Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sun, 6 Sep 2015 18:07:52 -0700 Subject: [PATCH] Shuffling kernel/. --- .travis.yml | 8 +-- src/xenia/app/emulator_window.cc | 2 +- src/xenia/apu/audio_system.h | 2 +- src/xenia/apu/xma_context.h | 1 + src/xenia/apu/xma_decoder.cc | 2 +- src/xenia/apu/xma_decoder.h | 2 +- src/xenia/base/bit_stream.cc | 5 +- src/xenia/base/bit_stream.h | 6 ++- src/xenia/base/logging.cc | 2 +- src/xenia/cpu/elf_module.cc | 6 +-- src/xenia/cpu/elf_module.h | 3 +- src/xenia/cpu/frontend/ppc_hir_builder.h | 2 +- src/xenia/cpu/xex_module.cc | 2 +- src/xenia/debug/debug_server.cc | 4 +- src/xenia/debug/debugger.cc | 8 +-- src/xenia/debug/ui/model/thread.h | 2 +- .../ui/views/cpu/register_list_control.h | 2 +- src/xenia/emulator.cc | 14 ++--- src/xenia/gpu/gl4/command_processor.cc | 2 +- src/xenia/gpu/gl4/command_processor.h | 2 +- src/xenia/gpu/gl4/gl4_graphics_system.h | 2 +- src/xenia/gpu/graphics_system.cc | 2 +- src/xenia/gpu/ucode_disassembler.cc | 8 +-- src/xenia/hid/input_system.cc | 2 +- src/xenia/hid/winkey/winkey_input_driver.cc | 2 +- src/xenia/kernel/apps/apps.cc | 28 ---------- .../xkernel_module.cc => kernel_module.cc} | 12 ++--- .../xkernel_module.h => kernel_module.h} | 14 ++--- src/xenia/kernel/kernel_state.cc | 42 +++++++-------- src/xenia/kernel/kernel_state.h | 52 ++++++++++--------- src/xenia/kernel/modules.h | 16 ------ ...xnotify_listener.cc => notify_listener.cc} | 18 +++---- .../xnotify_listener.h => notify_listener.h} | 12 ++--- .../xuser_module.cc => user_module.cc} | 40 +++++++------- .../{objects/xuser_module.h => user_module.h} | 22 ++++---- src/xenia/kernel/util/object_table.cc | 2 +- .../kernel/{app.cc => xam/app_manager.cc} | 29 +++++++---- src/xenia/kernel/{app.h => xam/app_manager.h} | 30 +++++++---- src/xenia/kernel/{ => xam}/apps/xgi_app.cc | 10 ++-- src/xenia/kernel/{ => xam}/apps/xgi_app.h | 16 +++--- .../kernel/{ => xam}/apps/xlivebase_app.cc | 14 ++--- .../kernel/{ => xam}/apps/xlivebase_app.h | 16 +++--- src/xenia/kernel/{ => xam}/apps/xmp_app.cc | 42 ++++++++------- src/xenia/kernel/{ => xam}/apps/xmp_app.h | 14 ++--- src/xenia/kernel/{ => xam}/content_manager.cc | 4 +- src/xenia/kernel/{ => xam}/content_manager.h | 14 +++-- src/xenia/kernel/{ => xam}/user_profile.cc | 4 +- src/xenia/kernel/{ => xam}/user_profile.h | 8 +-- src/xenia/kernel/{ => xam}/xam_avatar.cc | 10 ++-- src/xenia/kernel/{ => xam}/xam_content.cc | 16 +++--- src/xenia/kernel/{ => xam}/xam_info.cc | 30 ++++++----- src/xenia/kernel/{ => xam}/xam_input.cc | 14 ++--- src/xenia/kernel/{ => xam}/xam_module.cc | 34 ++++++------ src/xenia/kernel/{ => xam}/xam_module.h | 15 +++--- src/xenia/kernel/{ => xam}/xam_msg.cc | 16 +++--- src/xenia/kernel/{ => xam}/xam_net.cc | 48 ++++++++--------- src/xenia/kernel/{ => xam}/xam_notify.cc | 21 ++++---- src/xenia/kernel/{ => xam}/xam_nui.cc | 10 ++-- src/xenia/kernel/{ => xam}/xam_ordinals.h | 8 +-- src/xenia/kernel/{ => xam}/xam_private.h | 15 +++--- src/xenia/kernel/{ => xam}/xam_table.inc | 0 src/xenia/kernel/{ => xam}/xam_ui.cc | 14 ++--- src/xenia/kernel/{ => xam}/xam_user.cc | 8 +-- src/xenia/kernel/{ => xam}/xam_video.cc | 17 +++--- src/xenia/kernel/{ => xam}/xam_voice.cc | 11 ++-- .../kernel/{ => xboxkrnl}/xboxkrnl_audio.cc | 14 ++--- .../{ => xboxkrnl}/xboxkrnl_audio_xma.cc | 14 ++--- .../kernel/{ => xboxkrnl}/xboxkrnl_crypt.cc | 8 +-- .../kernel/{ => xboxkrnl}/xboxkrnl_debug.cc | 12 +++-- .../kernel/{ => xboxkrnl}/xboxkrnl_error.cc | 15 +++--- src/xenia/kernel/xboxkrnl/xboxkrnl_error.h | 26 ++++++++++ .../kernel/{ => xboxkrnl}/xboxkrnl_hal.cc | 10 ++-- .../kernel/{ => xboxkrnl}/xboxkrnl_io.cc | 20 +++---- .../kernel/{ => xboxkrnl}/xboxkrnl_memory.cc | 14 ++--- .../kernel/{ => xboxkrnl}/xboxkrnl_misc.cc | 16 +++--- .../kernel/{ => xboxkrnl}/xboxkrnl_module.cc | 44 ++++++++-------- .../kernel/{ => xboxkrnl}/xboxkrnl_module.h | 19 +++---- .../kernel/{ => xboxkrnl}/xboxkrnl_modules.cc | 16 +++--- .../kernel/{ => xboxkrnl}/xboxkrnl_ob.cc | 18 ++++--- .../kernel/{ => xboxkrnl}/xboxkrnl_ordinals.h | 8 +-- .../kernel/{ => xboxkrnl}/xboxkrnl_private.h | 15 +++--- .../kernel/{ => xboxkrnl}/xboxkrnl_rtl.cc | 24 +++++---- .../kernel/{ => xboxkrnl}/xboxkrnl_rtl.h | 8 +-- .../kernel/{ => xboxkrnl}/xboxkrnl_strings.cc | 18 ++++--- .../kernel/{ => xboxkrnl}/xboxkrnl_table.inc | 0 .../{ => xboxkrnl}/xboxkrnl_threading.cc | 30 ++++++----- .../kernel/xboxkrnl/xboxkrnl_threading.h | 32 ++++++++++++ .../kernel/{ => xboxkrnl}/xboxkrnl_usbcam.cc | 10 ++-- .../kernel/{ => xboxkrnl}/xboxkrnl_video.cc | 17 +++--- .../apps.h => xboxkrnl/xboxkrnl_video.h} | 18 +++---- src/xenia/kernel/{objects => }/xenumerator.cc | 2 +- src/xenia/kernel/{objects => }/xenumerator.h | 6 +-- src/xenia/kernel/{objects => }/xevent.cc | 2 +- src/xenia/kernel/{objects => }/xevent.h | 6 +-- src/xenia/kernel/{objects => }/xfile.cc | 4 +- src/xenia/kernel/{objects => }/xfile.h | 8 +-- src/xenia/kernel/{objects => }/xmodule.cc | 2 +- src/xenia/kernel/{objects => }/xmodule.h | 6 +-- src/xenia/kernel/{objects => }/xmutant.cc | 2 +- src/xenia/kernel/{objects => }/xmutant.h | 6 +-- src/xenia/kernel/xobject.cc | 8 +-- src/xenia/kernel/{objects => }/xsemaphore.cc | 2 +- src/xenia/kernel/{objects => }/xsemaphore.h | 6 +-- src/xenia/kernel/{objects => }/xthread.cc | 6 +-- src/xenia/kernel/{objects => }/xthread.h | 6 +-- src/xenia/kernel/{objects => }/xtimer.cc | 4 +- src/xenia/kernel/{objects => }/xtimer.h | 6 +-- src/xenia/ui/gl/gl4_elemental_renderer.cc | 2 +- src/xenia/ui/gl/gl_context.cc | 2 +- src/xenia/ui/loop_win.h | 2 +- src/xenia/ui/window.cc | 2 +- src/xenia/vfs/devices/disc_image_file.h | 2 +- src/xenia/vfs/devices/host_path_device.cc | 2 +- src/xenia/vfs/devices/host_path_file.h | 2 +- src/xenia/vfs/devices/stfs_container_file.h | 2 +- src/xenia/vfs/virtual_file_system.cc | 2 +- third_party/elemental-forms | 2 +- xenia-build | 2 +- 118 files changed, 749 insertions(+), 620 deletions(-) delete mode 100644 src/xenia/kernel/apps/apps.cc rename src/xenia/kernel/{objects/xkernel_module.cc => kernel_module.cc} (84%) rename src/xenia/kernel/{objects/xkernel_module.h => kernel_module.h} (72%) delete mode 100644 src/xenia/kernel/modules.h rename src/xenia/kernel/{objects/xnotify_listener.cc => notify_listener.cc} (79%) rename src/xenia/kernel/{objects/xnotify_listener.h => notify_listener.h} (83%) rename src/xenia/kernel/{objects/xuser_module.cc => user_module.cc} (95%) rename src/xenia/kernel/{objects/xuser_module.h => user_module.h} (87%) rename src/xenia/kernel/{app.cc => xam/app_manager.cc} (60%) rename src/xenia/kernel/{app.h => xam/app_manager.h} (69%) rename src/xenia/kernel/{ => xam}/apps/xgi_app.cc (92%) rename src/xenia/kernel/{ => xam}/apps/xgi_app.h (74%) rename src/xenia/kernel/{ => xam}/apps/xlivebase_app.cc (83%) rename src/xenia/kernel/{ => xam}/apps/xlivebase_app.h (72%) rename src/xenia/kernel/{ => xam}/apps/xmp_app.cc (93%) rename src/xenia/kernel/{ => xam}/apps/xmp_app.h (91%) rename src/xenia/kernel/{ => xam}/content_manager.cc (98%) rename src/xenia/kernel/{ => xam}/content_manager.h (92%) rename src/xenia/kernel/{ => xam}/user_profile.cc (98%) rename src/xenia/kernel/{ => xam}/user_profile.h (97%) rename src/xenia/kernel/{ => xam}/xam_avatar.cc (86%) rename src/xenia/kernel/{ => xam}/xam_content.cc (98%) rename src/xenia/kernel/{ => xam}/xam_info.cc (92%) rename src/xenia/kernel/{ => xam}/xam_input.cc (97%) rename src/xenia/kernel/{ => xam}/xam_module.cc (65%) rename src/xenia/kernel/{ => xam}/xam_module.h (78%) rename src/xenia/kernel/{ => xam}/xam_msg.cc (95%) rename src/xenia/kernel/{ => xam}/xam_net.cc (95%) rename src/xenia/kernel/{ => xam}/xam_notify.cc (88%) rename src/xenia/kernel/{ => xam}/xam_nui.cc (85%) rename src/xenia/kernel/{ => xam}/xam_ordinals.h (81%) rename src/xenia/kernel/{ => xam}/xam_private.h (91%) rename src/xenia/kernel/{ => xam}/xam_table.inc (100%) rename src/xenia/kernel/{ => xam}/xam_ui.cc (98%) rename src/xenia/kernel/{ => xam}/xam_user.cc (99%) rename src/xenia/kernel/{ => xam}/xam_video.cc (72%) rename src/xenia/kernel/{ => xam}/xam_voice.cc (87%) rename src/xenia/kernel/{ => xboxkrnl}/xboxkrnl_audio.cc (95%) rename src/xenia/kernel/{ => xboxkrnl}/xboxkrnl_audio_xma.cc (98%) rename src/xenia/kernel/{ => xboxkrnl}/xboxkrnl_crypt.cc (94%) rename src/xenia/kernel/{ => xboxkrnl}/xboxkrnl_debug.cc (93%) rename src/xenia/kernel/{ => xboxkrnl}/xboxkrnl_error.cc (98%) create mode 100644 src/xenia/kernel/xboxkrnl/xboxkrnl_error.h rename src/xenia/kernel/{ => xboxkrnl}/xboxkrnl_hal.cc (83%) rename src/xenia/kernel/{ => xboxkrnl}/xboxkrnl_io.cc (98%) rename src/xenia/kernel/{ => xboxkrnl}/xboxkrnl_memory.cc (98%) rename src/xenia/kernel/{ => xboxkrnl}/xboxkrnl_misc.cc (80%) rename src/xenia/kernel/{ => xboxkrnl}/xboxkrnl_module.cc (85%) rename src/xenia/kernel/{ => xboxkrnl}/xboxkrnl_module.h (70%) rename src/xenia/kernel/{ => xboxkrnl}/xboxkrnl_modules.cc (97%) rename src/xenia/kernel/{ => xboxkrnl}/xboxkrnl_ob.cc (95%) rename src/xenia/kernel/{ => xboxkrnl}/xboxkrnl_ordinals.h (78%) rename src/xenia/kernel/{ => xboxkrnl}/xboxkrnl_private.h (90%) rename src/xenia/kernel/{ => xboxkrnl}/xboxkrnl_rtl.cc (97%) rename src/xenia/kernel/{ => xboxkrnl}/xboxkrnl_rtl.h (83%) rename src/xenia/kernel/{ => xboxkrnl}/xboxkrnl_strings.cc (98%) rename src/xenia/kernel/{ => xboxkrnl}/xboxkrnl_table.inc (100%) rename src/xenia/kernel/{ => xboxkrnl}/xboxkrnl_threading.cc (98%) create mode 100644 src/xenia/kernel/xboxkrnl/xboxkrnl_threading.h rename src/xenia/kernel/{ => xboxkrnl}/xboxkrnl_usbcam.cc (83%) rename src/xenia/kernel/{ => xboxkrnl}/xboxkrnl_video.cc (98%) rename src/xenia/kernel/{apps/apps.h => xboxkrnl/xboxkrnl_video.h} (56%) rename src/xenia/kernel/{objects => }/xenumerator.cc (95%) rename src/xenia/kernel/{objects => }/xenumerator.h (94%) rename src/xenia/kernel/{objects => }/xevent.cc (97%) rename src/xenia/kernel/{objects => }/xevent.h (91%) rename src/xenia/kernel/{objects => }/xfile.cc (97%) rename src/xenia/kernel/{objects => }/xfile.h (96%) rename src/xenia/kernel/{objects => }/xmodule.cc (98%) rename src/xenia/kernel/{objects => }/xmodule.h (96%) rename src/xenia/kernel/{objects => }/xmutant.cc (96%) rename src/xenia/kernel/{objects => }/xmutant.h (90%) rename src/xenia/kernel/{objects => }/xsemaphore.cc (96%) rename src/xenia/kernel/{objects => }/xsemaphore.h (90%) rename src/xenia/kernel/{objects => }/xthread.cc (99%) rename src/xenia/kernel/{objects => }/xthread.h (98%) rename src/xenia/kernel/{objects => }/xtimer.cc (97%) rename src/xenia/kernel/{objects => }/xtimer.h (91%) diff --git a/.travis.yml b/.travis.yml index 0cc66c865..b4219a317 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/src/xenia/app/emulator_window.cc b/src/xenia/app/emulator_window.cc index 776dbc82d..150958f66 100644 --- a/src/xenia/app/emulator_window.cc +++ b/src/xenia/app/emulator_window.cc @@ -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 { diff --git a/src/xenia/apu/audio_system.h b/src/xenia/apu/audio_system.h index de8901c37..f0bd9d4a6 100644 --- a/src/xenia/apu/audio_system.h +++ b/src/xenia/apu/audio_system.h @@ -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" diff --git a/src/xenia/apu/xma_context.h b/src/xenia/apu/xma_context.h index 8bcf543b7..6ae9197d3 100644 --- a/src/xenia/apu/xma_context.h +++ b/src/xenia/apu/xma_context.h @@ -13,6 +13,7 @@ #include #include #include +#include #include "xenia/memory.h" #include "xenia/xbox.h" diff --git a/src/xenia/apu/xma_decoder.cc b/src/xenia/apu/xma_decoder.cc index e3184b8c4..82d601dcd 100644 --- a/src/xenia/apu/xma_decoder.cc +++ b/src/xenia/apu/xma_decoder.cc @@ -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" { diff --git a/src/xenia/apu/xma_decoder.h b/src/xenia/apu/xma_decoder.h index 98877a176..5c3c4d69d 100644 --- a/src/xenia/apu/xma_decoder.h +++ b/src/xenia/apu/xma_decoder.h @@ -15,7 +15,7 @@ #include #include "xenia/apu/xma_context.h" -#include "xenia/kernel/objects/xthread.h" +#include "xenia/kernel/xthread.h" #include "xenia/xbox.h" namespace xe { diff --git a/src/xenia/base/bit_stream.cc b/src/xenia/base/bit_stream.cc index 2a073109e..34aac7350 100644 --- a/src/xenia/base/bit_stream.cc +++ b/src/xenia/base/bit_stream.cc @@ -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_); @@ -140,4 +141,4 @@ size_t BitStream::Copy(uint8_t* dest_buffer, size_t num_bits) { void BitStream::Advance(size_t num_bits) { SetOffset(offset_bits_ + num_bits); } -} // namespace xe \ No newline at end of file +} // namespace xe diff --git a/src/xenia/base/bit_stream.h b/src/xenia/base/bit_stream.h index ad84379d4..fbe6bccb1 100644 --- a/src/xenia/base/bit_stream.h +++ b/src/xenia/base/bit_stream.h @@ -13,6 +13,7 @@ #include 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_ \ No newline at end of file +#endif // XENIA_BASE_BIT_STREAM_H_ diff --git a/src/xenia/base/logging.cc b/src/xenia/base/logging.cc index e11b84063..e249c2384 100644 --- a/src/xenia/base/logging.cc +++ b/src/xenia/base/logging.cc @@ -42,7 +42,7 @@ thread_local std::vector 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()); diff --git a/src/xenia/cpu/elf_module.cc b/src/xenia/cpu/elf_module.cc index 314b15d45..5fb0d223f 100644 --- a/src/xenia/cpu/elf_module.cc +++ b/src/xenia/cpu/elf_module.cc @@ -9,11 +9,11 @@ #include "xenia/cpu/elf_module.h" +#include #include #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 { @@ -141,4 +141,4 @@ std::unique_ptr ElfModule::CreateFunction(uint32_t address) { } } // namespace cpu -} // namespace xe \ No newline at end of file +} // namespace xe diff --git a/src/xenia/cpu/elf_module.h b/src/xenia/cpu/elf_module.h index 8b8e50e18..859f0fae3 100644 --- a/src/xenia/cpu/elf_module.h +++ b/src/xenia/cpu/elf_module.h @@ -10,6 +10,7 @@ #ifndef XENIA_CPU_ELF_MODULE_H_ #define XENIA_CPU_ELF_MODULE_H_ +#include #include #include "xenia/cpu/module.h" @@ -52,4 +53,4 @@ class ElfModule : public xe::cpu::Module { } // namespace cpu } // namespace xe -#endif // XENIA_CPU_ELF_MODULE_H_ \ No newline at end of file +#endif // XENIA_CPU_ELF_MODULE_H_ diff --git a/src/xenia/cpu/frontend/ppc_hir_builder.h b/src/xenia/cpu/frontend/ppc_hir_builder.h index 630d3c4be..d47079f4e 100644 --- a/src/xenia/cpu/frontend/ppc_hir_builder.h +++ b/src/xenia/cpu/frontend/ppc_hir_builder.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 { diff --git a/src/xenia/cpu/xex_module.cc b/src/xenia/cpu/xex_module.cc index 28ec1fa5f..07730e211 100644 --- a/src/xenia/cpu/xex_module.cc +++ b/src/xenia/cpu/xex_module.cc @@ -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" diff --git a/src/xenia/debug/debug_server.cc b/src/xenia/debug/debug_server.cc index 4811d789e..64ea25ce7 100644 --- a/src/xenia/debug/debug_server.cc +++ b/src/xenia/debug/debug_server.cc @@ -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."); diff --git a/src/xenia/debug/debugger.cc b/src/xenia/debug/debugger.cc index dbd7a0231..288a6e9d9 100644 --- a/src/xenia/debug/debugger.cc +++ b/src/xenia/debug/debugger.cc @@ -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 diff --git a/src/xenia/debug/ui/model/thread.h b/src/xenia/debug/ui/model/thread.h index cda801a6d..efbf1dd30 100644 --- a/src/xenia/debug/ui/model/thread.h +++ b/src/xenia/debug/ui/model/thread.h @@ -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_; } diff --git a/src/xenia/debug/ui/views/cpu/register_list_control.h b/src/xenia/debug/ui/views/cpu/register_list_control.h index 8e574c962..f9b290a9b 100644 --- a/src/xenia/debug/ui/views/cpu/register_list_control.h +++ b/src/xenia/debug/ui/views/cpu/register_list_control.h @@ -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; diff --git a/src/xenia/emulator.cc b/src/xenia/emulator.cc index 833a5a50b..9770d67a8 100644 --- a/src/xenia/emulator.cc +++ b/src/xenia/emulator.cc @@ -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_state_->LoadKernelModule(); + kernel_state_->LoadKernelModule(); + kernel_state_->LoadKernelModule(); // 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("xam.xex"); + auto xam = kernel_state()->GetKernelModule("xam.xex"); auto xboxkrnl = - kernel_state()->GetKernelModule("xboxkrnl.exe"); + kernel_state()->GetKernelModule( + "xboxkrnl.exe"); int result = 0; auto next_module = module_path; diff --git a/src/xenia/gpu/gl4/command_processor.cc b/src/xenia/gpu/gl4/command_processor.cc index c06fc83fa..ce487a2e4 100644 --- a/src/xenia/gpu/gl4/command_processor.cc +++ b/src/xenia/gpu/gl4/command_processor.cc @@ -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" diff --git a/src/xenia/gpu/gl4/command_processor.h b/src/xenia/gpu/gl4/command_processor.h index a609d3549..804b1069d 100644 --- a/src/xenia/gpu/gl4/command_processor.h +++ b/src/xenia/gpu/gl4/command_processor.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" diff --git a/src/xenia/gpu/gl4/gl4_graphics_system.h b/src/xenia/gpu/gl4/gl4_graphics_system.h index 1256ef4b3..473a7f431 100644 --- a/src/xenia/gpu/gl4/gl4_graphics_system.h +++ b/src/xenia/gpu/gl4/gl4_graphics_system.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 { diff --git a/src/xenia/gpu/graphics_system.cc b/src/xenia/gpu/graphics_system.cc index 14e7d8b90..97ac0c6ee 100644 --- a/src/xenia/gpu/graphics_system.cc +++ b/src/xenia/gpu/graphics_system.cc @@ -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 { diff --git a/src/xenia/gpu/ucode_disassembler.cc b/src/xenia/gpu/ucode_disassembler.cc index a150b99a9..b27322b65 100644 --- a/src/xenia/gpu/ucode_disassembler.cc +++ b/src/xenia/gpu/ucode_disassembler.cc @@ -32,10 +32,10 @@ #include "xenia/gpu/ucode_disassembler.h" -#include -#include -#include -#include +#include +#include +#include +#include #include "xenia/base/assert.h" #include "xenia/base/string_buffer.h" diff --git a/src/xenia/hid/input_system.cc b/src/xenia/hid/input_system.cc index 155746456..e6772e7ef 100644 --- a/src/xenia/hid/input_system.cc +++ b/src/xenia/hid/input_system.cc @@ -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" diff --git a/src/xenia/hid/winkey/winkey_input_driver.cc b/src/xenia/hid/winkey/winkey_input_driver.cc index 7be1a5b26..ae58e3df7 100644 --- a/src/xenia/hid/winkey/winkey_input_driver.cc +++ b/src/xenia/hid/winkey/winkey_input_driver.cc @@ -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)) { diff --git a/src/xenia/kernel/apps/apps.cc b/src/xenia/kernel/apps/apps.cc deleted file mode 100644 index bbcfc72c7..000000000 --- a/src/xenia/kernel/apps/apps.cc +++ /dev/null @@ -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(kernel_state)); - manager->RegisterApp(std::make_unique(kernel_state)); - manager->RegisterApp(std::make_unique(kernel_state)); -} - -} // namespace apps -} // namespace kernel -} // namespace xe diff --git a/src/xenia/kernel/objects/xkernel_module.cc b/src/xenia/kernel/kernel_module.cc similarity index 84% rename from src/xenia/kernel/objects/xkernel_module.cc rename to src/xenia/kernel/kernel_module.cc index 7c313cc91..2442dde8c 100644 --- a/src/xenia/kernel/objects/xkernel_module.cc +++ b/src/xenia/kernel/kernel_module.cc @@ -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; } diff --git a/src/xenia/kernel/objects/xkernel_module.h b/src/xenia/kernel/kernel_module.h similarity index 72% rename from src/xenia/kernel/objects/xkernel_module.h rename to src/xenia/kernel/kernel_module.h index 75a6d2394..3341bd9a7 100644 --- a/src/xenia/kernel/objects/xkernel_module.h +++ b/src/xenia/kernel/kernel_module.h @@ -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_ diff --git a/src/xenia/kernel/kernel_state.cc b/src/xenia/kernel/kernel_state.cc index 940438934..c0be947ba 100644 --- a/src/xenia/kernel/kernel_state.cc +++ b/src/xenia/kernel/kernel_state.cc @@ -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(); - user_profile_ = std::make_unique(); + app_manager_ = std::make_unique(); + user_profile_ = std::make_unique(); auto content_root = xe::to_wstring(FLAGS_content_root); content_root = xe::to_absolute_path(content_root); - content_manager_ = std::make_unique(this, content_root); + content_manager_ = std::make_unique(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 KernelState::GetKernelModule(const char* name) { +object_ref KernelState::GetKernelModule(const char* name) { assert_true(IsKernelModule(name)); for (auto kernel_module : kernel_modules_) { @@ -208,14 +206,14 @@ object_ref KernelState::GetModule(const char* name) { return nullptr; } -object_ref KernelState::GetExecutableModule() { +object_ref KernelState::GetExecutableModule() { if (!executable_module_) { return nullptr; } return executable_module_; } -void KernelState::SetExecutableModule(object_ref module) { +void KernelState::SetExecutableModule(object_ref module) { if (module.get() == executable_module_.get()) { return; } @@ -270,12 +268,12 @@ void KernelState::SetExecutableModule(object_ref module) { } } -void KernelState::LoadKernelModule(object_ref kernel_module) { +void KernelState::LoadKernelModule(object_ref kernel_module) { auto global_lock = global_critical_region_.Acquire(); kernel_modules_.push_back(std::move(kernel_module)); } -object_ref KernelState::LoadUserModule(const char* raw_name) { +object_ref 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 KernelState::LoadUserModule(const char* raw_name) { path = xe::join_paths(xe::find_base_path(executable_module_->path()), name); } - object_ref module; + object_ref module; { auto global_lock = global_critical_region_.Acquire(); @@ -297,7 +295,7 @@ object_ref KernelState::LoadUserModule(const char* raw_name) { } // Module wasn't loaded, so load it. - module = object_ref(new XUserModule(this, path.c_str())); + module = object_ref(new UserModule(this, path.c_str())); X_STATUS status = module->LoadFromFile(path); if (XFAILED(status)) { return nullptr; @@ -465,7 +463,7 @@ object_ref 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) { diff --git a/src/xenia/kernel/kernel_state.h b/src/xenia/kernel/kernel_state.h index 7e21139f3..39928dd56 100644 --- a/src/xenia/kernel/kernel_state.h +++ b/src/xenia/kernel/kernel_state.h @@ -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 GetModule(const char* name); - object_ref GetExecutableModule(); - void SetExecutableModule(object_ref module); - object_ref LoadUserModule(const char* name); + object_ref GetExecutableModule(); + void SetExecutableModule(object_ref module); + object_ref LoadUserModule(const char* name); - object_ref GetKernelModule(const char* name); + object_ref GetKernelModule(const char* name); template - object_ref LoadKernelModule() { - auto kernel_module = object_ref(new T(emulator_, this)); + object_ref LoadKernelModule() { + auto kernel_module = object_ref(new T(emulator_, this)); LoadKernelModule(kernel_module); return kernel_module; } @@ -146,8 +148,8 @@ class KernelState { void OnThreadExit(XThread* thread); object_ref 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 kernel_module); + void LoadKernelModule(object_ref kernel_module); Emulator* emulator_; Memory* memory_; cpu::Processor* processor_; vfs::VirtualFileSystem* file_system_; - std::unique_ptr app_manager_; - std::unique_ptr user_profile_; - std::unique_ptr content_manager_; + std::unique_ptr app_manager_; + std::unique_ptr content_manager_; + std::unique_ptr user_profile_; xe::global_critical_region global_critical_region_; // Must be guarded by the global critical region. util::ObjectTable object_table_; std::unordered_map threads_by_id_; - std::vector> notify_listeners_; + std::vector> notify_listeners_; bool has_notified_startup_ = false; uint32_t process_type_ = X_PROCTYPE_USER; - object_ref executable_module_; - std::vector> kernel_modules_; - std::vector> user_modules_; + object_ref executable_module_; + std::vector> kernel_modules_; + std::vector> user_modules_; std::vector terminate_notifications; uint32_t process_info_block_address_ = 0; diff --git a/src/xenia/kernel/modules.h b/src/xenia/kernel/modules.h deleted file mode 100644 index 662db1894..000000000 --- a/src/xenia/kernel/modules.h +++ /dev/null @@ -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_ diff --git a/src/xenia/kernel/objects/xnotify_listener.cc b/src/xenia/kernel/notify_listener.cc similarity index 79% rename from src/xenia/kernel/objects/xnotify_listener.cc rename to src/xenia/kernel/notify_listener.cc index b84a9d8e3..bf92d8098 100644 --- a/src/xenia/kernel/objects/xnotify_listener.cc +++ b/src/xenia/kernel/notify_listener.cc @@ -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,8 +48,8 @@ void XNotifyListener::EnqueueNotification(XNotificationID id, uint32_t data) { wait_handle_->Set(); } -bool XNotifyListener::DequeueNotification(XNotificationID* out_id, - uint32_t* out_data) { +bool NotifyListener::DequeueNotification(XNotificationID* out_id, + uint32_t* out_data) { auto global_lock = global_critical_region_.Acquire(); bool dequeued = false; if (notification_count_) { @@ -66,8 +66,8 @@ bool XNotifyListener::DequeueNotification(XNotificationID* out_id, return dequeued; } -bool XNotifyListener::DequeueNotification(XNotificationID id, - uint32_t* out_data) { +bool NotifyListener::DequeueNotification(XNotificationID id, + uint32_t* out_data) { auto global_lock = global_critical_region_.Acquire(); bool dequeued = false; if (notification_count_) { diff --git a/src/xenia/kernel/objects/xnotify_listener.h b/src/xenia/kernel/notify_listener.h similarity index 83% rename from src/xenia/kernel/objects/xnotify_listener.h rename to src/xenia/kernel/notify_listener.h index 1b16b5a70..70562ea59 100644 --- a/src/xenia/kernel/objects/xnotify_listener.h +++ b/src/xenia/kernel/notify_listener.h @@ -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 #include @@ -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_ diff --git a/src/xenia/kernel/objects/xuser_module.cc b/src/xenia/kernel/user_module.cc similarity index 95% rename from src/xenia/kernel/objects/xuser_module.cc rename to src/xenia/kernel/user_module.cc index 5e3cc148e..85892e2d8 100644 --- a/src/xenia/kernel/objects/xuser_module.cc +++ b/src/xenia/kernel/user_module.cc @@ -7,7 +7,7 @@ ****************************************************************************** */ -#include "xenia/kernel/objects/xuser_module.h" +#include "xenia/kernel/user_module.h" #include @@ -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(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,16 +155,16 @@ 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, - uint32_t* out_section_size) { +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, &resource_header)) { @@ -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,8 +203,8 @@ 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, - uint32_t* out_header_guest_ptr) { +X_STATUS UserModule::GetOptHeader(xe_xex2_header_keys key, + uint32_t* out_header_guest_ptr) { if (module_format_ == kModuleFormatElf) { // Quick die. return X_STATUS_UNSUCCESSFUL; @@ -219,9 +219,9 @@ X_STATUS XUserModule::GetOptHeader(xe_xex2_header_keys key, out_header_guest_ptr); } -X_STATUS XUserModule::GetOptHeader(uint8_t* membase, const xex2_header* header, - xe_xex2_header_keys key, - uint32_t* out_header_guest_ptr) { +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); uint32_t field_value = 0; bool field_found = false; @@ -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; diff --git a/src/xenia/kernel/objects/xuser_module.h b/src/xenia/kernel/user_module.h similarity index 87% rename from src/xenia/kernel/objects/xuser_module.h rename to src/xenia/kernel/user_module.h index c33b31c68..cc4d67f2a 100644 --- a/src/xenia/kernel/objects/xuser_module.h +++ b/src/xenia/kernel/user_module.h @@ -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 #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_ diff --git a/src/xenia/kernel/util/object_table.cc b/src/xenia/kernel/util/object_table.cc index c4d8f7e2d..2fe774cc8 100644 --- a/src/xenia/kernel/util/object_table.cc +++ b/src/xenia/kernel/util/object_table.cc @@ -13,7 +13,7 @@ #include #include "xenia/kernel/xobject.h" -#include "xenia/kernel/objects/xthread.h" +#include "xenia/kernel/xthread.h" namespace xe { namespace kernel { diff --git a/src/xenia/kernel/app.cc b/src/xenia/kernel/xam/app_manager.cc similarity index 60% rename from src/xenia/kernel/app.cc rename to src/xenia/kernel/xam/app_manager.cc index 05c3e0759..e83740776 100644 --- a/src/xenia/kernel/app.cc +++ b/src/xenia/kernel/xam/app_manager.cc @@ -7,27 +7,37 @@ ****************************************************************************** */ -#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 app) { +void AppManager::RegisterApps(KernelState* kernel_state, AppManager* manager) { + manager->RegisterApp(std::make_unique(kernel_state)); + manager->RegisterApp(std::make_unique(kernel_state)); + manager->RegisterApp(std::make_unique(kernel_state)); +} + +void AppManager::RegisterApp(std::unique_ptr 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, - uint32_t buffer_ptr, - uint32_t buffer_length) { +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); if (it == app_lookup_.end()) { return X_STATUS_UNSUCCESSFUL; @@ -35,9 +45,9 @@ 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, - uint32_t buffer_ptr, - uint32_t buffer_length) { +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); if (it == app_lookup_.end()) { return X_ERROR_NOT_FOUND; @@ -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 diff --git a/src/xenia/kernel/app.h b/src/xenia/kernel/xam/app_manager.h similarity index 69% rename from src/xenia/kernel/app.h rename to src/xenia/kernel/xam/app_manager.h index 04947f017..2420cdd6a 100644 --- a/src/xenia/kernel/app.h +++ b/src/xenia/kernel/xam/app_manager.h @@ -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 +#include #include #include @@ -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 app); + static void RegisterApps(KernelState* kernel_state, AppManager* manager); + + void RegisterApp(std::unique_ptr 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> apps_; - std::unordered_map app_lookup_; + std::vector> apps_; + std::unordered_map app_lookup_; }; +} // namespace xam } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_APP_H_ +#endif // XENIA_KERNEL_XAM_APP_MANAGER_H_ diff --git a/src/xenia/kernel/apps/xgi_app.cc b/src/xenia/kernel/xam/apps/xgi_app.cc similarity index 92% rename from src/xenia/kernel/apps/xgi_app.cc rename to src/xenia/kernel/xam/apps/xgi_app.cc index 4172d2f92..793be3ce1 100644 --- a/src/xenia/kernel/apps/xgi_app.cc +++ b/src/xenia/kernel/xam/apps/xgi_app.cc @@ -7,21 +7,22 @@ ****************************************************************************** */ -#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, - uint32_t buffer_length) { +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); switch (message) { @@ -94,5 +95,6 @@ X_RESULT XXGIApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr, } } // namespace apps +} // namespace xam } // namespace kernel } // namespace xe diff --git a/src/xenia/kernel/apps/xgi_app.h b/src/xenia/kernel/xam/apps/xgi_app.h similarity index 74% rename from src/xenia/kernel/apps/xgi_app.h rename to src/xenia/kernel/xam/apps/xgi_app.h index ff525e2e3..accac54a3 100644 --- a/src/xenia/kernel/apps/xgi_app.h +++ b/src/xenia/kernel/xam/apps/xgi_app.h @@ -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_ diff --git a/src/xenia/kernel/apps/xlivebase_app.cc b/src/xenia/kernel/xam/apps/xlivebase_app.cc similarity index 83% rename from src/xenia/kernel/apps/xlivebase_app.cc rename to src/xenia/kernel/xam/apps/xlivebase_app.cc index 30532065c..db0ae94fc 100644 --- a/src/xenia/kernel/apps/xlivebase_app.cc +++ b/src/xenia/kernel/xam/apps/xlivebase_app.cc @@ -7,23 +7,24 @@ ****************************************************************************** */ -#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, - uint32_t buffer_ptr, - uint32_t buffer_length) { +X_RESULT XLiveBaseApp::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); switch (message) { @@ -57,5 +58,6 @@ X_RESULT XXLiveBaseApp::DispatchMessageSync(uint32_t message, } } // namespace apps +} // namespace xam } // namespace kernel } // namespace xe diff --git a/src/xenia/kernel/apps/xlivebase_app.h b/src/xenia/kernel/xam/apps/xlivebase_app.h similarity index 72% rename from src/xenia/kernel/apps/xlivebase_app.h rename to src/xenia/kernel/xam/apps/xlivebase_app.h index b9d71d621..0068ec781 100644 --- a/src/xenia/kernel/apps/xlivebase_app.h +++ b/src/xenia/kernel/xam/apps/xlivebase_app.h @@ -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_ diff --git a/src/xenia/kernel/apps/xmp_app.cc b/src/xenia/kernel/xam/apps/xmp_app.cc similarity index 93% rename from src/xenia/kernel/apps/xmp_app.cc rename to src/xenia/kernel/xam/apps/xmp_app.cc index 3be4fdbb7..128d0939d 100644 --- a/src/xenia/kernel/apps/xmp_app.cc +++ b/src/xenia/kernel/xam/apps/xmp_app.cc @@ -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,10 +41,12 @@ 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, - uint32_t out_playlist_handle) { +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, xe::to_string(playlist_name).c_str(), flags, out_song_handles, @@ -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,8 +107,8 @@ X_RESULT XXMPApp::XMPDeleteTitlePlaylist(uint32_t playlist_handle) { return X_ERROR_SUCCESS; } -X_RESULT XXMPApp::XMPPlayTitlePlaylist(uint32_t playlist_handle, - uint32_t song_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,13 +192,13 @@ X_RESULT XXMPApp::XMPPrevious() { return X_ERROR_SUCCESS; } -void XXMPApp::OnStateChanged() { +void XmpApp::OnStateChanged() { kernel_state_->BroadcastNotification(kMsgStateChanged, static_cast(state_)); } -X_RESULT XXMPApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr, - uint32_t buffer_length) { +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); switch (message) { @@ -419,5 +422,6 @@ X_RESULT XXMPApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr, } } // namespace apps +} // namespace xam } // namespace kernel } // namespace xe diff --git a/src/xenia/kernel/apps/xmp_app.h b/src/xenia/kernel/xam/apps/xmp_app.h similarity index 91% rename from src/xenia/kernel/apps/xmp_app.h rename to src/xenia/kernel/xam/apps/xmp_app.h index 6d135d752..868d39c66 100644 --- a/src/xenia/kernel/apps/xmp_app.h +++ b/src/xenia/kernel/xam/apps/xmp_app.h @@ -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 #include @@ -16,17 +16,18 @@ #include #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> 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_ diff --git a/src/xenia/kernel/content_manager.cc b/src/xenia/kernel/xam/content_manager.cc similarity index 98% rename from src/xenia/kernel/content_manager.cc rename to src/xenia/kernel/xam/content_manager.cc index 2cf3713d3..270c5eb64 100644 --- a/src/xenia/kernel/content_manager.cc +++ b/src/xenia/kernel/xam/content_manager.cc @@ -7,7 +7,7 @@ ****************************************************************************** */ -#include "xenia/kernel/content_manager.h" +#include "xenia/kernel/xam/content_manager.h" #include @@ -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 diff --git a/src/xenia/kernel/content_manager.h b/src/xenia/kernel/xam/content_manager.h similarity index 92% rename from src/xenia/kernel/content_manager.h rename to src/xenia/kernel/xam/content_manager.h index a9342faed..9a0bd1948 100644 --- a/src/xenia/kernel/content_manager.h +++ b/src/xenia/kernel/xam/content_manager.h @@ -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 #include @@ -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 open_packages_; }; +} // namespace xam } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_CONTENT_MANAGER_H_ +#endif // XENIA_KERNEL_XAM_CONTENT_MANAGER_H_ diff --git a/src/xenia/kernel/user_profile.cc b/src/xenia/kernel/xam/user_profile.cc similarity index 98% rename from src/xenia/kernel/user_profile.cc rename to src/xenia/kernel/xam/user_profile.cc index b53a9d0d7..a32468294 100644 --- a/src/xenia/kernel/user_profile.cc +++ b/src/xenia/kernel/xam/user_profile.cc @@ -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 diff --git a/src/xenia/kernel/user_profile.h b/src/xenia/kernel/xam/user_profile.h similarity index 97% rename from src/xenia/kernel/user_profile.h rename to src/xenia/kernel/xam/user_profile.h index 8cd86e7cb..a024b17f0 100644 --- a/src/xenia/kernel/user_profile.h +++ b/src/xenia/kernel/xam/user_profile.h @@ -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 #include @@ -19,6 +19,7 @@ namespace xe { namespace kernel { +namespace xam { class UserProfile { public: @@ -193,7 +194,8 @@ class UserProfile { std::unordered_map settings_; }; +} // namespace xam } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_USER_PROFILE_H_ +#endif // XENIA_KERNEL_XAM_USER_PROFILE_H_ diff --git a/src/xenia/kernel/xam_avatar.cc b/src/xenia/kernel/xam/xam_avatar.cc similarity index 86% rename from src/xenia/kernel/xam_avatar.cc rename to src/xenia/kernel/xam/xam_avatar.cc index e206428fa..68c3f9f7b 100644 --- a/src/xenia/kernel/xam_avatar.cc +++ b/src/xenia/kernel/xam/xam_avatar.cc @@ -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) {} diff --git a/src/xenia/kernel/xam_content.cc b/src/xenia/kernel/xam/xam_content.cc similarity index 98% rename from src/xenia/kernel/xam_content.cc rename to src/xenia/kernel/xam/xam_content.cc index f1b82ca76..273f42690 100644 --- a/src/xenia/kernel/xam_content.cc +++ b/src/xenia/kernel/xam/xam_content.cc @@ -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 diff --git a/src/xenia/kernel/xam_info.cc b/src/xenia/kernel/xam/xam_info.cc similarity index 92% rename from src/xenia/kernel/xam_info.cc rename to src/xenia/kernel/xam/xam_info.cc index e66c29edc..447391ef4 100644 --- a/src/xenia/kernel/xam_info.cc +++ b/src/xenia/kernel/xam/xam_info.cc @@ -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("xam.xex"); + auto xam = kernel_state()->GetKernelModule("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("xam.xex"); + auto xam = kernel_state()->GetKernelModule("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("xam.xex"); + auto xam = kernel_state()->GetKernelModule("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("xam.xex"); + auto xam = kernel_state()->GetKernelModule("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 diff --git a/src/xenia/kernel/xam_input.cc b/src/xenia/kernel/xam/xam_input.cc similarity index 97% rename from src/xenia/kernel/xam_input.cc rename to src/xenia/kernel/xam/xam_input.cc index 1221fd914..328d1d6c0 100644 --- a/src/xenia/kernel/xam_input.cc +++ b/src/xenia/kernel/xam/xam_input.cc @@ -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 diff --git a/src/xenia/kernel/xam_module.cc b/src/xenia/kernel/xam/xam_module.cc similarity index 65% rename from src/xenia/kernel/xam_module.cc rename to src/xenia/kernel/xam/xam_module.cc index d66e29fa2..f28ded82d 100644 --- a/src/xenia/kernel/xam_module.cc +++ b/src/xenia/kernel/xam/xam_module.cc @@ -7,34 +7,35 @@ ****************************************************************************** */ -#include "xenia/kernel/xam_module.h" +#include "xenia/kernel/xam/xam_module.h" #include #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 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 diff --git a/src/xenia/kernel/xam_module.h b/src/xenia/kernel/xam/xam_module.h similarity index 78% rename from src/xenia/kernel/xam_module.h rename to src/xenia/kernel/xam/xam_module.h index fa0181dae..089836a68 100644 --- a/src/xenia/kernel/xam_module.h +++ b/src/xenia/kernel/xam/xam_module.h @@ -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 #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_ diff --git a/src/xenia/kernel/xam_msg.cc b/src/xenia/kernel/xam/xam_msg.cc similarity index 95% rename from src/xenia/kernel/xam_msg.cc rename to src/xenia/kernel/xam/xam_msg.cc index 265e8e803..2ccc19e13 100644 --- a/src/xenia/kernel/xam_msg.cc +++ b/src/xenia/kernel/xam/xam_msg.cc @@ -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 diff --git a/src/xenia/kernel/xam_net.cc b/src/xenia/kernel/xam/xam_net.cc similarity index 95% rename from src/xenia/kernel/xam_net.cc rename to src/xenia/kernel/xam/xam_net.cc index dd9fce524..cadc353f1 100644 --- a/src/xenia/kernel/xam_net.cc +++ b/src/xenia/kernel/xam/xam_net.cc @@ -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> handles, dword_t wait_type, - dword_t wait_mode, dword_t alertable, - pointer_t> timeout_ptr); -dword_result_t RtlNtStatusToDosError(dword_t source_status); - dword_result_t NetDll_WSAWaitForMultipleEvents( dword_t num_events, pointer_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, - timeout != -1 ? &timeout_wait : nullptr); + 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 diff --git a/src/xenia/kernel/xam_notify.cc b/src/xenia/kernel/xam/xam_notify.cc similarity index 88% rename from src/xenia/kernel/xam_notify.cc rename to src/xenia/kernel/xam/xam_notify.cc index 71b975bcd..04622fa60 100644 --- a/src/xenia/kernel/xam_notify.cc +++ b/src/xenia/kernel/xam/xam_notify.cc @@ -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(new XNotifyListener(kernel_state)); + auto listener = object_ref(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(handle); + kernel_state->object_table()->LookupObject(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 diff --git a/src/xenia/kernel/xam_nui.cc b/src/xenia/kernel/xam/xam_nui.cc similarity index 85% rename from src/xenia/kernel/xam_nui.cc rename to src/xenia/kernel/xam/xam_nui.cc index 06cf94040..90123d12b 100644 --- a/src/xenia/kernel/xam_nui.cc +++ b/src/xenia/kernel/xam/xam_nui.cc @@ -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 unk0; @@ -33,8 +34,9 @@ void XamNuiGetDeviceStatus(pointer_t 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) {} diff --git a/src/xenia/kernel/xam_ordinals.h b/src/xenia/kernel/xam/xam_ordinals.h similarity index 81% rename from src/xenia/kernel/xam_ordinals.h rename to src/xenia/kernel/xam/xam_ordinals.h index dc534882d..25c555226 100644 --- a/src/xenia/kernel/xam_ordinals.h +++ b/src/xenia/kernel/xam/xam_ordinals.h @@ -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_ diff --git a/src/xenia/kernel/xam_private.h b/src/xenia/kernel/xam/xam_private.h similarity index 91% rename from src/xenia/kernel/xam_private.h rename to src/xenia/kernel/xam/xam_private.h index c1fd9068a..9e4a1916e 100644 --- a/src/xenia/kernel/xam_private.h +++ b/src/xenia/kernel/xam/xam_private.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_ diff --git a/src/xenia/kernel/xam_table.inc b/src/xenia/kernel/xam/xam_table.inc similarity index 100% rename from src/xenia/kernel/xam_table.inc rename to src/xenia/kernel/xam/xam_table.inc diff --git a/src/xenia/kernel/xam_ui.cc b/src/xenia/kernel/xam/xam_ui.cc similarity index 98% rename from src/xenia/kernel/xam_ui.cc rename to src/xenia/kernel/xam/xam_ui.cc index 796a75e4b..074d6db47 100644 --- a/src/xenia/kernel/xam_ui.cc +++ b/src/xenia/kernel/xam/xam_ui.cc @@ -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 diff --git a/src/xenia/kernel/xam_user.cc b/src/xenia/kernel/xam/xam_user.cc similarity index 99% rename from src/xenia/kernel/xam_user.cc rename to src/xenia/kernel/xam/xam_user.cc index 87ec02dee..c7e0352fb 100644 --- a/src/xenia/kernel/xam_user.cc +++ b/src/xenia/kernel/xam/xam_user.cc @@ -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 diff --git a/src/xenia/kernel/xam_video.cc b/src/xenia/kernel/xam/xam_video.cc similarity index 72% rename from src/xenia/kernel/xam_video.cc rename to src/xenia/kernel/xam/xam_video.cc index a5029c4c0..157af39fd 100644 --- a/src/xenia/kernel/xam_video.cc +++ b/src/xenia/kernel/xam/xam_video.cc @@ -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 video_mode); +namespace xam { void XGetVideoMode(pointer_t 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) {} diff --git a/src/xenia/kernel/xam_voice.cc b/src/xenia/kernel/xam/xam_voice.cc similarity index 87% rename from src/xenia/kernel/xam_voice.cc rename to src/xenia/kernel/xam/xam_voice.cc index 2ec3d6160..96de3db66 100644 --- a/src/xenia/kernel/xam_voice.cc +++ b/src/xenia/kernel/xam/xam_voice.cc @@ -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) {} diff --git a/src/xenia/kernel/xboxkrnl_audio.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_audio.cc similarity index 95% rename from src/xenia/kernel/xboxkrnl_audio.cc rename to src/xenia/kernel/xboxkrnl/xboxkrnl_audio.cc index 40b93e69d..7d93bbd4c 100644 --- a/src/xenia/kernel/xboxkrnl_audio.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_audio.cc @@ -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 diff --git a/src/xenia/kernel/xboxkrnl_audio_xma.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_audio_xma.cc similarity index 98% rename from src/xenia/kernel/xboxkrnl_audio_xma.cc rename to src/xenia/kernel/xboxkrnl/xboxkrnl_audio_xma.cc index e664e7ca4..1d80a731f 100644 --- a/src/xenia/kernel/xboxkrnl_audio_xma.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_audio_xma.cc @@ -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 diff --git a/src/xenia/kernel/xboxkrnl_crypt.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_crypt.cc similarity index 94% rename from src/xenia/kernel/xboxkrnl_crypt.cc rename to src/xenia/kernel/xboxkrnl/xboxkrnl_crypt.cc index 8865d5f22..c5cf8c0ca 100644 --- a/src/xenia/kernel/xboxkrnl_crypt.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_crypt.cc @@ -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 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 diff --git a/src/xenia/kernel/xboxkrnl_debug.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_debug.cc similarity index 93% rename from src/xenia/kernel/xboxkrnl_debug.cc rename to src/xenia/kernel/xboxkrnl/xboxkrnl_debug.cc index 360716250..64e7d466e 100644 --- a/src/xenia/kernel/xboxkrnl_debug.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_debug.cc @@ -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) {} diff --git a/src/xenia/kernel/xboxkrnl_error.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_error.cc similarity index 98% rename from src/xenia/kernel/xboxkrnl_error.cc rename to src/xenia/kernel/xboxkrnl/xboxkrnl_error.cc index 62f95c498..5ba8de2cd 100644 --- a/src/xenia/kernel/xboxkrnl_error.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_error.cc @@ -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) {} diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_error.h b/src/xenia/kernel/xboxkrnl/xboxkrnl_error.h new file mode 100644 index 000000000..0d0a8be19 --- /dev/null +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_error.h @@ -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_ diff --git a/src/xenia/kernel/xboxkrnl_hal.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_hal.cc similarity index 83% rename from src/xenia/kernel/xboxkrnl_hal.cc rename to src/xenia/kernel/xboxkrnl/xboxkrnl_hal.cc index bfc5a3ecc..658275483 100644 --- a/src/xenia/kernel/xboxkrnl_hal.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_hal.cc @@ -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) {} diff --git a/src/xenia/kernel/xboxkrnl_io.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_io.cc similarity index 98% rename from src/xenia/kernel/xboxkrnl_io.cc rename to src/xenia/kernel/xboxkrnl/xboxkrnl_io.cc index 262b6095d..33731e0e8 100644 --- a/src/xenia/kernel/xboxkrnl_io.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_io.cc @@ -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 diff --git a/src/xenia/kernel/xboxkrnl_memory.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_memory.cc similarity index 98% rename from src/xenia/kernel/xboxkrnl_memory.cc rename to src/xenia/kernel/xboxkrnl/xboxkrnl_memory.cc index 9a1fe8795..1ea023d0a 100644 --- a/src/xenia/kernel/xboxkrnl_memory.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_memory.cc @@ -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 diff --git a/src/xenia/kernel/xboxkrnl_misc.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_misc.cc similarity index 80% rename from src/xenia/kernel/xboxkrnl_misc.cc rename to src/xenia/kernel/xboxkrnl/xboxkrnl_misc.cc index abe08374b..8ef7664be 100644 --- a/src/xenia/kernel/xboxkrnl_misc.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_misc.cc @@ -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 diff --git a/src/xenia/kernel/xboxkrnl_module.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_module.cc similarity index 85% rename from src/xenia/kernel/xboxkrnl_module.cc rename to src/xenia/kernel/xboxkrnl/xboxkrnl_module.cc index 29b3938d4..9bf661cbc 100644 --- a/src/xenia/kernel/xboxkrnl_module.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_module.cc @@ -7,7 +7,7 @@ ****************************************************************************** */ -#include "xenia/kernel/xboxkrnl_module.h" +#include "xenia/kernel/xboxkrnl/xboxkrnl_module.h" #include @@ -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 diff --git a/src/xenia/kernel/xboxkrnl_module.h b/src/xenia/kernel/xboxkrnl/xboxkrnl_module.h similarity index 70% rename from src/xenia/kernel/xboxkrnl_module.h rename to src/xenia/kernel/xboxkrnl/xboxkrnl_module.h index 922e440aa..a8da85efc 100644 --- a/src/xenia/kernel/xboxkrnl_module.h +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_module.h @@ -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 #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 timestamp_timer_; }; +} // namespace xboxkrnl } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_XBOXKRNL_MODULE_H_ +#endif // XENIA_KERNEL_XBOXKRNL_XBOXKRNL_MODULE_H_ diff --git a/src/xenia/kernel/xboxkrnl_modules.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_modules.cc similarity index 97% rename from src/xenia/kernel/xboxkrnl_modules.cc rename to src/xenia/kernel/xboxkrnl/xboxkrnl_modules.cc index 6ad16bc71..1bfc7da25 100644 --- a/src/xenia/kernel/xboxkrnl_modules.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_modules.cc @@ -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 diff --git a/src/xenia/kernel/xboxkrnl_ob.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_ob.cc similarity index 95% rename from src/xenia/kernel/xboxkrnl_ob.cc rename to src/xenia/kernel/xboxkrnl/xboxkrnl_ob.cc index b71a59f18..057b27297 100644 --- a/src/xenia/kernel/xboxkrnl_ob.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_ob.cc @@ -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 diff --git a/src/xenia/kernel/xboxkrnl_ordinals.h b/src/xenia/kernel/xboxkrnl/xboxkrnl_ordinals.h similarity index 78% rename from src/xenia/kernel/xboxkrnl_ordinals.h rename to src/xenia/kernel/xboxkrnl/xboxkrnl_ordinals.h index 26ba98251..3002fabc8 100644 --- a/src/xenia/kernel/xboxkrnl_ordinals.h +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_ordinals.h @@ -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_ diff --git a/src/xenia/kernel/xboxkrnl_private.h b/src/xenia/kernel/xboxkrnl/xboxkrnl_private.h similarity index 90% rename from src/xenia/kernel/xboxkrnl_private.h rename to src/xenia/kernel/xboxkrnl/xboxkrnl_private.h index 56ecdb16f..feb95649c 100644 --- a/src/xenia/kernel/xboxkrnl_private.h +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_private.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_ diff --git a/src/xenia/kernel/xboxkrnl_rtl.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_rtl.cc similarity index 97% rename from src/xenia/kernel/xboxkrnl_rtl.cc rename to src/xenia/kernel/xboxkrnl/xboxkrnl_rtl.cc index 651211563..2fb90d76d 100644 --- a/src/xenia/kernel/xboxkrnl_rtl.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_rtl.cc @@ -7,7 +7,7 @@ ****************************************************************************** */ -#include "xenia/kernel/xboxkrnl_rtl.h" +#include "xenia/kernel/xboxkrnl/xboxkrnl_rtl.h" #include #include @@ -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,8 +270,8 @@ pointer_result_t RtlImageXexHeaderField(pointer_t 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, - xe_xex2_header_keys(field), &field_value); + 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 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 diff --git a/src/xenia/kernel/xboxkrnl_rtl.h b/src/xenia/kernel/xboxkrnl/xboxkrnl_rtl.h similarity index 83% rename from src/xenia/kernel/xboxkrnl_rtl.h rename to src/xenia/kernel/xboxkrnl/xboxkrnl_rtl.h index 102d5ffb0..755bc5e12 100644 --- a/src/xenia/kernel/xboxkrnl_rtl.h +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_rtl.h @@ -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_ diff --git a/src/xenia/kernel/xboxkrnl_strings.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_strings.cc similarity index 98% rename from src/xenia/kernel/xboxkrnl_strings.cc rename to src/xenia/kernel/xboxkrnl/xboxkrnl_strings.cc index d5ce99e43..b8ba3e194 100644 --- a/src/xenia/kernel/xboxkrnl_strings.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_strings.cc @@ -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 diff --git a/src/xenia/kernel/xboxkrnl_table.inc b/src/xenia/kernel/xboxkrnl/xboxkrnl_table.inc similarity index 100% rename from src/xenia/kernel/xboxkrnl_table.inc rename to src/xenia/kernel/xboxkrnl/xboxkrnl_table.inc diff --git a/src/xenia/kernel/xboxkrnl_threading.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_threading.cc similarity index 98% rename from src/xenia/kernel/xboxkrnl_threading.cc rename to src/xenia/kernel/xboxkrnl/xboxkrnl_threading.cc index 1a5fd6da1..fb1128297 100644 --- a/src/xenia/kernel/xboxkrnl_threading.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_threading.cc @@ -7,24 +7,29 @@ ****************************************************************************** */ +#include +#include + #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 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 diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_threading.h b/src/xenia/kernel/xboxkrnl/xboxkrnl_threading.h new file mode 100644 index 000000000..506ef2daf --- /dev/null +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_threading.h @@ -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> handles, dword_t wait_type, + dword_t wait_mode, dword_t alertable, + pointer_t> timeout_ptr); + +} // namespace xboxkrnl +} // namespace kernel +} // namespace xe + +#endif // XENIA_KERNEL_XBOXKRNL_XBOXKRNL_THREADING_H_ diff --git a/src/xenia/kernel/xboxkrnl_usbcam.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_usbcam.cc similarity index 83% rename from src/xenia/kernel/xboxkrnl_usbcam.cc rename to src/xenia/kernel/xboxkrnl/xboxkrnl_usbcam.cc index aaaddc5b0..28c85abb1 100644 --- a/src/xenia/kernel/xboxkrnl_usbcam.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_usbcam.cc @@ -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) {} diff --git a/src/xenia/kernel/xboxkrnl_video.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_video.cc similarity index 98% rename from src/xenia/kernel/xboxkrnl_video.cc rename to src/xenia/kernel/xboxkrnl/xboxkrnl_video.cc index cd4bce86f..0d6dae6e8 100644 --- a/src/xenia/kernel/xboxkrnl_video.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_video.cc @@ -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 diff --git a/src/xenia/kernel/apps/apps.h b/src/xenia/kernel/xboxkrnl/xboxkrnl_video.h similarity index 56% rename from src/xenia/kernel/apps/apps.h rename to src/xenia/kernel/xboxkrnl/xboxkrnl_video.h index 23b5cc9ec..2d26c6bd3 100644 --- a/src/xenia/kernel/apps/apps.h +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_video.h @@ -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 video_mode); -} // namespace apps +} // namespace xboxkrnl } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_APPS_APPS_H_ +#endif // XENIA_KERNEL_XBOXKRNL_XBOXKRNL_VIDEO_H_ diff --git a/src/xenia/kernel/objects/xenumerator.cc b/src/xenia/kernel/xenumerator.cc similarity index 95% rename from src/xenia/kernel/objects/xenumerator.cc rename to src/xenia/kernel/xenumerator.cc index ed367e03b..924b234a1 100644 --- a/src/xenia/kernel/objects/xenumerator.cc +++ b/src/xenia/kernel/xenumerator.cc @@ -7,7 +7,7 @@ ****************************************************************************** */ -#include "xenia/kernel/objects/xenumerator.h" +#include "xenia/kernel/xenumerator.h" namespace xe { namespace kernel { diff --git a/src/xenia/kernel/objects/xenumerator.h b/src/xenia/kernel/xenumerator.h similarity index 94% rename from src/xenia/kernel/objects/xenumerator.h rename to src/xenia/kernel/xenumerator.h index c435b0625..437ce7339 100644 --- a/src/xenia/kernel/objects/xenumerator.h +++ b/src/xenia/kernel/xenumerator.h @@ -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 #include @@ -82,4 +82,4 @@ class XStaticEnumerator : public XEnumerator { } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_OBJECTS_XENUMERATOR_H_ +#endif // XENIA_KERNEL_XENUMERATOR_H_ diff --git a/src/xenia/kernel/objects/xevent.cc b/src/xenia/kernel/xevent.cc similarity index 97% rename from src/xenia/kernel/objects/xevent.cc rename to src/xenia/kernel/xevent.cc index 7da6e7f58..5b5ee61cd 100644 --- a/src/xenia/kernel/objects/xevent.cc +++ b/src/xenia/kernel/xevent.cc @@ -8,7 +8,7 @@ */ #include "xenia/base/logging.h" -#include "xenia/kernel/objects/xevent.h" +#include "xenia/kernel/xevent.h" namespace xe { namespace kernel { diff --git a/src/xenia/kernel/objects/xevent.h b/src/xenia/kernel/xevent.h similarity index 91% rename from src/xenia/kernel/objects/xevent.h rename to src/xenia/kernel/xevent.h index b17c76586..4567617d4 100644 --- a/src/xenia/kernel/objects/xevent.h +++ b/src/xenia/kernel/xevent.h @@ -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_ diff --git a/src/xenia/kernel/objects/xfile.cc b/src/xenia/kernel/xfile.cc similarity index 97% rename from src/xenia/kernel/objects/xfile.cc rename to src/xenia/kernel/xfile.cc index 70bda198a..3b85372fc 100644 --- a/src/xenia/kernel/objects/xfile.cc +++ b/src/xenia/kernel/xfile.cc @@ -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 { diff --git a/src/xenia/kernel/objects/xfile.h b/src/xenia/kernel/xfile.h similarity index 96% rename from src/xenia/kernel/objects/xfile.h rename to src/xenia/kernel/xfile.h index 7f10d2845..8bd7c6a00 100644 --- a/src/xenia/kernel/objects/xfile.h +++ b/src/xenia/kernel/xfile.h @@ -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 #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_ diff --git a/src/xenia/kernel/objects/xmodule.cc b/src/xenia/kernel/xmodule.cc similarity index 98% rename from src/xenia/kernel/objects/xmodule.cc rename to src/xenia/kernel/xmodule.cc index 183fa86fe..7fdbd7f8e 100644 --- a/src/xenia/kernel/objects/xmodule.cc +++ b/src/xenia/kernel/xmodule.cc @@ -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" diff --git a/src/xenia/kernel/objects/xmodule.h b/src/xenia/kernel/xmodule.h similarity index 96% rename from src/xenia/kernel/objects/xmodule.h rename to src/xenia/kernel/xmodule.h index 55d6e676f..ac215d135 100644 --- a/src/xenia/kernel/objects/xmodule.h +++ b/src/xenia/kernel/xmodule.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 @@ -94,4 +94,4 @@ class XModule : public XObject { } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_OBJECTS_XMODULE_H_ +#endif // XENIA_KERNEL_XMODULE_H_ diff --git a/src/xenia/kernel/objects/xmutant.cc b/src/xenia/kernel/xmutant.cc similarity index 96% rename from src/xenia/kernel/objects/xmutant.cc rename to src/xenia/kernel/xmutant.cc index f9dba8ec4..8e2de374f 100644 --- a/src/xenia/kernel/objects/xmutant.cc +++ b/src/xenia/kernel/xmutant.cc @@ -7,7 +7,7 @@ ****************************************************************************** */ -#include "xenia/kernel/objects/xmutant.h" +#include "xenia/kernel/xmutant.h" namespace xe { namespace kernel { diff --git a/src/xenia/kernel/objects/xmutant.h b/src/xenia/kernel/xmutant.h similarity index 90% rename from src/xenia/kernel/objects/xmutant.h rename to src/xenia/kernel/xmutant.h index 0d41eb6a9..1c87f472a 100644 --- a/src/xenia/kernel/objects/xmutant.h +++ b/src/xenia/kernel/xmutant.h @@ -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_ diff --git a/src/xenia/kernel/xobject.cc b/src/xenia/kernel/xobject.cc index 14f9bf97f..adfc02ab4 100644 --- a/src/xenia/kernel/xobject.cc +++ b/src/xenia/kernel/xobject.cc @@ -13,10 +13,10 @@ #include "xenia/base/clock.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/xboxkrnl_private.h" +#include "xenia/kernel/xboxkrnl/xboxkrnl_private.h" +#include "xenia/kernel/xevent.h" +#include "xenia/kernel/xmutant.h" +#include "xenia/kernel/xsemaphore.h" namespace xe { namespace kernel { diff --git a/src/xenia/kernel/objects/xsemaphore.cc b/src/xenia/kernel/xsemaphore.cc similarity index 96% rename from src/xenia/kernel/objects/xsemaphore.cc rename to src/xenia/kernel/xsemaphore.cc index abf86eb5a..ff7a69ff0 100644 --- a/src/xenia/kernel/objects/xsemaphore.cc +++ b/src/xenia/kernel/xsemaphore.cc @@ -7,7 +7,7 @@ ****************************************************************************** */ -#include "xenia/kernel/objects/xsemaphore.h" +#include "xenia/kernel/xsemaphore.h" namespace xe { namespace kernel { diff --git a/src/xenia/kernel/objects/xsemaphore.h b/src/xenia/kernel/xsemaphore.h similarity index 90% rename from src/xenia/kernel/objects/xsemaphore.h rename to src/xenia/kernel/xsemaphore.h index 2cdb0fcd6..c68393d68 100644 --- a/src/xenia/kernel/objects/xsemaphore.h +++ b/src/xenia/kernel/xsemaphore.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_OBJECTS_XSEMAPHORE_H_ -#define XENIA_KERNEL_OBJECTS_XSEMAPHORE_H_ +#ifndef XENIA_KERNEL_XSEMAPHORE_H_ +#define XENIA_KERNEL_XSEMAPHORE_H_ #include "xenia/base/threading.h" #include "xenia/kernel/xobject.h" @@ -43,4 +43,4 @@ class XSemaphore : public XObject { } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_OBJECTS_XSEMAPHORE_H_ +#endif // XENIA_KERNEL_XSEMAPHORE_H_ diff --git a/src/xenia/kernel/objects/xthread.cc b/src/xenia/kernel/xthread.cc similarity index 99% rename from src/xenia/kernel/objects/xthread.cc rename to src/xenia/kernel/xthread.cc index 802b2f356..d8ff5863d 100644 --- a/src/xenia/kernel/objects/xthread.cc +++ b/src/xenia/kernel/xthread.cc @@ -7,7 +7,7 @@ ****************************************************************************** */ -#include "xenia/kernel/objects/xthread.h" +#include "xenia/kernel/xthread.h" #include @@ -20,8 +20,8 @@ #include "xenia/cpu/processor.h" #include "xenia/emulator.h" #include "xenia/kernel/kernel_state.h" -#include "xenia/kernel/objects/xevent.h" -#include "xenia/kernel/objects/xuser_module.h" +#include "xenia/kernel/user_module.h" +#include "xenia/kernel/xevent.h" #include "xenia/profiling.h" DEFINE_bool(ignore_thread_priorities, true, diff --git a/src/xenia/kernel/objects/xthread.h b/src/xenia/kernel/xthread.h similarity index 98% rename from src/xenia/kernel/objects/xthread.h rename to src/xenia/kernel/xthread.h index a9b071928..8bcef6ac8 100644 --- a/src/xenia/kernel/objects/xthread.h +++ b/src/xenia/kernel/xthread.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_OBJECTS_XTHREAD_H_ -#define XENIA_KERNEL_OBJECTS_XTHREAD_H_ +#ifndef XENIA_KERNEL_XTHREAD_H_ +#define XENIA_KERNEL_XTHREAD_H_ #include #include @@ -208,4 +208,4 @@ class XHostThread : public XThread { } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_OBJECTS_XTHREAD_H_ +#endif // XENIA_KERNEL_XTHREAD_H_ diff --git a/src/xenia/kernel/objects/xtimer.cc b/src/xenia/kernel/xtimer.cc similarity index 97% rename from src/xenia/kernel/objects/xtimer.cc rename to src/xenia/kernel/xtimer.cc index 9256be02a..bda94f3c6 100644 --- a/src/xenia/kernel/objects/xtimer.cc +++ b/src/xenia/kernel/xtimer.cc @@ -7,12 +7,12 @@ ****************************************************************************** */ -#include "xenia/kernel/objects/xtimer.h" +#include "xenia/kernel/xtimer.h" #include "xenia/base/clock.h" #include "xenia/base/logging.h" #include "xenia/cpu/processor.h" -#include "xenia/kernel/objects/xthread.h" +#include "xenia/kernel/xthread.h" namespace xe { namespace kernel { diff --git a/src/xenia/kernel/objects/xtimer.h b/src/xenia/kernel/xtimer.h similarity index 91% rename from src/xenia/kernel/objects/xtimer.h rename to src/xenia/kernel/xtimer.h index 9c81f8f05..914af0b17 100644 --- a/src/xenia/kernel/objects/xtimer.h +++ b/src/xenia/kernel/xtimer.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_OBJECTS_XTIMER_H_ -#define XENIA_KERNEL_OBJECTS_XTIMER_H_ +#ifndef XENIA_KERNEL_XTIMER_H_ +#define XENIA_KERNEL_XTIMER_H_ #include "xenia/base/threading.h" #include "xenia/kernel/xobject.h" @@ -43,4 +43,4 @@ class XTimer : public XObject { } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_OBJECTS_XTIMER_H_ +#endif // XENIA_KERNEL_XTIMER_H_ diff --git a/src/xenia/ui/gl/gl4_elemental_renderer.cc b/src/xenia/ui/gl/gl4_elemental_renderer.cc index d42f09df1..8eb7f5ae9 100644 --- a/src/xenia/ui/gl/gl4_elemental_renderer.cc +++ b/src/xenia/ui/gl/gl4_elemental_renderer.cc @@ -18,8 +18,8 @@ #include "xenia/base/assert.h" #include "xenia/base/logging.h" #include "xenia/profiling.h" -#include "xenia/ui/gl/gl_context.h" #include "xenia/ui/gl/gl.h" +#include "xenia/ui/gl/gl_context.h" namespace xe { namespace ui { diff --git a/src/xenia/ui/gl/gl_context.cc b/src/xenia/ui/gl/gl_context.cc index 9dadea451..ab045e4fd 100644 --- a/src/xenia/ui/gl/gl_context.cc +++ b/src/xenia/ui/gl/gl_context.cc @@ -18,8 +18,8 @@ #include "xenia/base/logging.h" #include "xenia/base/math.h" #include "xenia/profiling.h" -#include "xenia/ui/gl/gl_profiler_display.h" #include "xenia/ui/gl/gl4_elemental_renderer.h" +#include "xenia/ui/gl/gl_profiler_display.h" #include "xenia/ui/window.h" // TODO(benvanik): move win32 code to _win? diff --git a/src/xenia/ui/loop_win.h b/src/xenia/ui/loop_win.h index 893dfabe4..f8c6538cd 100644 --- a/src/xenia/ui/loop_win.h +++ b/src/xenia/ui/loop_win.h @@ -10,8 +10,8 @@ #ifndef XENIA_UI_LOOP_WIN_H_ #define XENIA_UI_LOOP_WIN_H_ -#include #include +#include #include #include "xenia/base/platform_win.h" diff --git a/src/xenia/ui/window.cc b/src/xenia/ui/window.cc index a9439c0a9..4182c7607 100644 --- a/src/xenia/ui/window.cc +++ b/src/xenia/ui/window.cc @@ -10,13 +10,13 @@ #include "xenia/ui/window.h" #include "el/animation_manager.h" -#include "el/util/debug.h" #include "el/elemental_forms.h" #include "el/io/file_manager.h" #include "el/io/posix_file_system.h" #include "el/io/win32_res_file_system_win.h" #include "el/message_handler.h" #include "el/text/font_manager.h" +#include "el/util/debug.h" #include "el/util/metrics.h" #include "el/util/string_table.h" #include "el/util/timer.h" diff --git a/src/xenia/vfs/devices/disc_image_file.h b/src/xenia/vfs/devices/disc_image_file.h index 671072b91..e477286e1 100644 --- a/src/xenia/vfs/devices/disc_image_file.h +++ b/src/xenia/vfs/devices/disc_image_file.h @@ -10,7 +10,7 @@ #ifndef XENIA_VFS_DEVICES_DISC_IMAGE_FILE_H_ #define XENIA_VFS_DEVICES_DISC_IMAGE_FILE_H_ -#include "xenia/kernel/objects/xfile.h" +#include "xenia/kernel/xfile.h" namespace xe { namespace vfs { diff --git a/src/xenia/vfs/devices/host_path_device.cc b/src/xenia/vfs/devices/host_path_device.cc index 7e8449d4d..2d7107fa8 100644 --- a/src/xenia/vfs/devices/host_path_device.cc +++ b/src/xenia/vfs/devices/host_path_device.cc @@ -12,8 +12,8 @@ #include "xenia/base/filesystem.h" #include "xenia/base/logging.h" #include "xenia/base/math.h" +#include "xenia/kernel/xfile.h" #include "xenia/vfs/devices/host_path_entry.h" -#include "xenia/kernel/objects/xfile.h" namespace xe { namespace vfs { diff --git a/src/xenia/vfs/devices/host_path_file.h b/src/xenia/vfs/devices/host_path_file.h index 5b5267c79..325c131d4 100644 --- a/src/xenia/vfs/devices/host_path_file.h +++ b/src/xenia/vfs/devices/host_path_file.h @@ -13,7 +13,7 @@ #include #include "xenia/base/filesystem.h" -#include "xenia/kernel/objects/xfile.h" +#include "xenia/kernel/xfile.h" namespace xe { namespace vfs { diff --git a/src/xenia/vfs/devices/stfs_container_file.h b/src/xenia/vfs/devices/stfs_container_file.h index 288d0a799..7f6874ebf 100644 --- a/src/xenia/vfs/devices/stfs_container_file.h +++ b/src/xenia/vfs/devices/stfs_container_file.h @@ -10,7 +10,7 @@ #ifndef XENIA_VFS_DEVICES_STFS_CONTAINER_FILE_H_ #define XENIA_VFS_DEVICES_STFS_CONTAINER_FILE_H_ -#include "xenia/kernel/objects/xfile.h" +#include "xenia/kernel/xfile.h" namespace xe { namespace vfs { diff --git a/src/xenia/vfs/virtual_file_system.cc b/src/xenia/vfs/virtual_file_system.cc index 879ac1480..90694442f 100644 --- a/src/xenia/vfs/virtual_file_system.cc +++ b/src/xenia/vfs/virtual_file_system.cc @@ -12,7 +12,7 @@ #include "xenia/base/filesystem.h" #include "xenia/base/logging.h" #include "xenia/base/string.h" -#include "xenia/kernel/objects/xfile.h" +#include "xenia/kernel/xfile.h" namespace xe { namespace vfs { diff --git a/third_party/elemental-forms b/third_party/elemental-forms index 0b0d51fa4..b69064233 160000 --- a/third_party/elemental-forms +++ b/third_party/elemental-forms @@ -1 +1 @@ -Subproject commit 0b0d51fa4afcf00f67770cf52fc4db7abb6a8cbb +Subproject commit b6906423349431e54bc646be61b7c64b13c442c3 diff --git a/xenia-build b/xenia-build index b6bb48451..a2fa895db 100755 --- a/xenia-build +++ b/xenia-build @@ -967,7 +967,7 @@ class StyleCommand(Command): 'build_tools/third_party/google-styleguide/cpplint/cpplint.py', '--output=vs7', '--linelength=80', - '--filter=-build/c++11', + '--filter=-build/c++11,+build/include_alpha', '--root=src', ] + all_files, throw_on_error=False) print('')