diff --git a/src/xenia/kernel/async_request.cc b/src/xenia/kernel/async_request.cc index 9992ecdb7..fd0359cac 100644 --- a/src/xenia/kernel/async_request.cc +++ b/src/xenia/kernel/async_request.cc @@ -13,9 +13,8 @@ #include -using namespace std; -using namespace xe; -using namespace xe::kernel; +namespace xe { +namespace kernel { XAsyncRequest::XAsyncRequest( @@ -28,8 +27,7 @@ XAsyncRequest::XAsyncRequest( } XAsyncRequest::~XAsyncRequest() { - for (vector::iterator it = wait_events_.begin(); - it != wait_events_.end(); ++it) { + for (auto it = wait_events_.begin(); it != wait_events_.end(); ++it) { (*it)->Release(); } object_->Release(); @@ -39,3 +37,6 @@ void XAsyncRequest::AddWaitEvent(XEvent* ev) { ev->Retain(); wait_events_.push_back(ev); } + +} // namespace kernel +} // namespace xe diff --git a/src/xenia/kernel/dispatcher.cc b/src/xenia/kernel/dispatcher.cc index 30d1639a2..df11b62f4 100644 --- a/src/xenia/kernel/dispatcher.cc +++ b/src/xenia/kernel/dispatcher.cc @@ -13,8 +13,8 @@ #include -using namespace xe; -using namespace xe::kernel; +namespace xe { +namespace kernel { Dispatcher::Dispatcher(KernelState* kernel_state) : @@ -35,3 +35,6 @@ void Dispatcher::Lock() { void Dispatcher::Unlock() { xe_mutex_unlock(lock_); } + +} // namespace kernel +} // namespace xe diff --git a/src/xenia/kernel/kernel_state.cc b/src/xenia/kernel/kernel_state.cc index 92d10810f..1d1b81a07 100644 --- a/src/xenia/kernel/kernel_state.cc +++ b/src/xenia/kernel/kernel_state.cc @@ -23,18 +23,15 @@ #include -using namespace xe; -using namespace xe::kernel; +namespace xe { +namespace kernel { // This is a global object initialized with the XboxkrnlModule. // It references the current kernel state object that all kernel methods should // be using to stash their variables. -namespace xe { -namespace kernel { KernelState* shared_kernel_state_ = nullptr; -} // namespace kernel -} // namespace xe + KernelState::KernelState(Emulator* emulator) : emulator_(emulator), memory_(emulator->memory()), @@ -213,3 +210,6 @@ void KernelState::CompleteOverlappedImmediate(uint32_t overlapped_ptr, X_RESULT XThread::GetCurrentThreadHandle()); CompleteOverlapped(overlapped_ptr, result, length); } + +} // namespace kernel +} // namespace xe diff --git a/src/xenia/kernel/native_list.cc b/src/xenia/kernel/native_list.cc index c910bd667..fa87663d1 100644 --- a/src/xenia/kernel/native_list.cc +++ b/src/xenia/kernel/native_list.cc @@ -10,8 +10,8 @@ #include -using namespace xe; -using namespace xe::kernel; +namespace xe { +namespace kernel { NativeList::NativeList(Memory* memory) : @@ -70,3 +70,6 @@ uint32_t NativeList::Shift() { bool NativeList::HasPending() { return head_ != kInvalidPointer; } + +} // namespace kernel +} // namespace xe diff --git a/src/xenia/kernel/object_table.cc b/src/xenia/kernel/object_table.cc index 746821bf0..0b338d072 100644 --- a/src/xenia/kernel/object_table.cc +++ b/src/xenia/kernel/object_table.cc @@ -13,8 +13,8 @@ #include -using namespace xe; -using namespace xe::kernel; +namespace xe { +namespace kernel { ObjectTable::ObjectTable() : @@ -206,3 +206,6 @@ X_HANDLE ObjectTable::TranslateHandle(X_HANDLE handle) { return handle; } } + +} // namespace kernel +} // namespace xe diff --git a/src/xenia/kernel/xam_content.cc b/src/xenia/kernel/xam_content.cc index b367504c3..bc8a6675f 100644 --- a/src/xenia/kernel/xam_content.cc +++ b/src/xenia/kernel/xam_content.cc @@ -15,11 +15,6 @@ #include -using namespace xe; -using namespace xe::kernel; -using namespace xe::kernel::xam; - - namespace xe { namespace kernel { diff --git a/src/xenia/kernel/xam_info.cc b/src/xenia/kernel/xam_info.cc index 1827019d2..32c7c8e9d 100644 --- a/src/xenia/kernel/xam_info.cc +++ b/src/xenia/kernel/xam_info.cc @@ -17,11 +17,6 @@ #include -using namespace xe; -using namespace xe::kernel; -using namespace xe::kernel::xam; - - namespace xe { namespace kernel { diff --git a/src/xenia/kernel/xam_input.cc b/src/xenia/kernel/xam_input.cc index 4ef44b0a5..196d2dbde 100644 --- a/src/xenia/kernel/xam_input.cc +++ b/src/xenia/kernel/xam_input.cc @@ -17,15 +17,11 @@ #include -using namespace xe; -using namespace xe::hid; -using namespace xe::kernel; -using namespace xe::kernel::xam; - - namespace xe { namespace kernel { +using xe::hid::InputSystem; + SHIM_CALL XamResetInactivity_shim( PPCContext* ppc_state, KernelState* state) { diff --git a/src/xenia/kernel/xam_module.cc b/src/xenia/kernel/xam_module.cc index 2a5aa6217..b67bc2da7 100644 --- a/src/xenia/kernel/xam_module.cc +++ b/src/xenia/kernel/xam_module.cc @@ -14,9 +14,8 @@ #include -using namespace xe; -using namespace xe::kernel; -using namespace xe::kernel::xam; +namespace xe { +namespace kernel { XamModule::XamModule(Emulator* emulator, KernelState* kernel_state) : @@ -31,17 +30,20 @@ XamModule::XamModule(Emulator* emulator, KernelState* kernel_state) : "xam.xex", xam_export_table, XECOUNT(xam_export_table)); // Register all exported functions. - 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); - RegisterUIExports(export_resolver_, kernel_state); - RegisterUserExports(export_resolver_, kernel_state); - RegisterVideoExports(export_resolver_, kernel_state); - RegisterVoiceExports(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::RegisterUIExports(export_resolver_, kernel_state); + xam::RegisterUserExports(export_resolver_, kernel_state); + xam::RegisterVideoExports(export_resolver_, kernel_state); + xam::RegisterVoiceExports(export_resolver_, kernel_state); } XamModule::~XamModule() { } + +} // namespace kernel +} // namespace xe diff --git a/src/xenia/kernel/xam_msg.cc b/src/xenia/kernel/xam_msg.cc index 0317210eb..54399c7a9 100644 --- a/src/xenia/kernel/xam_msg.cc +++ b/src/xenia/kernel/xam_msg.cc @@ -16,11 +16,6 @@ #include -using namespace xe; -using namespace xe::kernel; -using namespace xe::kernel::xam; - - namespace xe { namespace kernel { diff --git a/src/xenia/kernel/xam_net.cc b/src/xenia/kernel/xam_net.cc index 8f5815404..eacec8169 100644 --- a/src/xenia/kernel/xam_net.cc +++ b/src/xenia/kernel/xam_net.cc @@ -17,11 +17,6 @@ #include -using namespace xe; -using namespace xe::kernel; -using namespace xe::kernel::xam; - - namespace xe { namespace kernel { diff --git a/src/xenia/kernel/xam_notify.cc b/src/xenia/kernel/xam_notify.cc index 356fbc269..83e673ce5 100644 --- a/src/xenia/kernel/xam_notify.cc +++ b/src/xenia/kernel/xam_notify.cc @@ -16,11 +16,6 @@ #include -using namespace xe; -using namespace xe::kernel; -using namespace xe::kernel::xam; - - namespace xe { namespace kernel { diff --git a/src/xenia/kernel/xam_ui.cc b/src/xenia/kernel/xam_ui.cc index 0824b8eb9..fa477d877 100644 --- a/src/xenia/kernel/xam_ui.cc +++ b/src/xenia/kernel/xam_ui.cc @@ -15,11 +15,6 @@ #include -using namespace xe; -using namespace xe::kernel; -using namespace xe::kernel::xam; - - namespace xe { namespace kernel { diff --git a/src/xenia/kernel/xam_user.cc b/src/xenia/kernel/xam_user.cc index c05d2e97a..521358997 100644 --- a/src/xenia/kernel/xam_user.cc +++ b/src/xenia/kernel/xam_user.cc @@ -17,11 +17,6 @@ #include -using namespace xe; -using namespace xe::kernel; -using namespace xe::kernel::xam; - - namespace xe { namespace kernel { diff --git a/src/xenia/kernel/xam_video.cc b/src/xenia/kernel/xam_video.cc index 1106f9bb7..b5f6f2693 100644 --- a/src/xenia/kernel/xam_video.cc +++ b/src/xenia/kernel/xam_video.cc @@ -15,11 +15,6 @@ #include -using namespace xe; -using namespace xe::kernel; -using namespace xe::kernel::xam; - - namespace xe { namespace kernel { diff --git a/src/xenia/kernel/xam_voice.cc b/src/xenia/kernel/xam_voice.cc index 30b94bcdd..f3c5e9f3a 100644 --- a/src/xenia/kernel/xam_voice.cc +++ b/src/xenia/kernel/xam_voice.cc @@ -16,12 +16,6 @@ #include -using namespace xe; -using namespace xe::hid; -using namespace xe::kernel; -using namespace xe::kernel::xam; - - namespace xe { namespace kernel { diff --git a/src/xenia/kernel/xboxkrnl_audio.cc b/src/xenia/kernel/xboxkrnl_audio.cc index 970abfd69..1c04f25a1 100644 --- a/src/xenia/kernel/xboxkrnl_audio.cc +++ b/src/xenia/kernel/xboxkrnl_audio.cc @@ -17,12 +17,6 @@ #include -using namespace xe; -using namespace xe::apu; -using namespace xe::kernel; -using namespace xe::kernel::xboxkrnl; - - namespace xe { namespace kernel { diff --git a/src/xenia/kernel/xboxkrnl_debug.cc b/src/xenia/kernel/xboxkrnl_debug.cc index 3ff845c0d..7da596771 100644 --- a/src/xenia/kernel/xboxkrnl_debug.cc +++ b/src/xenia/kernel/xboxkrnl_debug.cc @@ -16,11 +16,6 @@ #include -using namespace xe; -using namespace xe::kernel; -using namespace xe::kernel::xboxkrnl; - - namespace xe { namespace kernel { diff --git a/src/xenia/kernel/xboxkrnl_hal.cc b/src/xenia/kernel/xboxkrnl_hal.cc index 5e208eb11..7e225077f 100644 --- a/src/xenia/kernel/xboxkrnl_hal.cc +++ b/src/xenia/kernel/xboxkrnl_hal.cc @@ -15,11 +15,6 @@ #include -using namespace xe; -using namespace xe::kernel; -using namespace xe::kernel::xboxkrnl; - - namespace xe { namespace kernel { diff --git a/src/xenia/kernel/xboxkrnl_io.cc b/src/xenia/kernel/xboxkrnl_io.cc index caee0e283..6cd9c0fb3 100644 --- a/src/xenia/kernel/xboxkrnl_io.cc +++ b/src/xenia/kernel/xboxkrnl_io.cc @@ -18,14 +18,11 @@ #include -using namespace xe; -using namespace xe::kernel; -using namespace xe::kernel::fs; - - namespace xe { namespace kernel { +using namespace xe::kernel::fs; + SHIM_CALL NtCreateFile_shim( PPCContext* ppc_state, KernelState* state) { diff --git a/src/xenia/kernel/xboxkrnl_memory.cc b/src/xenia/kernel/xboxkrnl_memory.cc index fba730d7e..bd34eaa99 100644 --- a/src/xenia/kernel/xboxkrnl_memory.cc +++ b/src/xenia/kernel/xboxkrnl_memory.cc @@ -15,12 +15,6 @@ #include -using namespace alloy; -using namespace xe; -using namespace xe::kernel; -using namespace xe::kernel::xboxkrnl; - - namespace xe { namespace kernel { @@ -268,7 +262,7 @@ SHIM_CALL MmAllocatePhysicalMemoryEx_shim( assert_true(max_addr_range == 0xFFFFFFFF); // Allocate. - uint32_t flags = MEMORY_FLAG_PHYSICAL; + uint32_t flags = alloy::MEMORY_FLAG_PHYSICAL; uint32_t base_address = (uint32_t)state->memory()->HeapAlloc( 0, adjusted_size, flags, adjusted_alignment); if (!base_address) { @@ -445,7 +439,7 @@ SHIM_CALL ExAllocatePoolTypeWithTag_shim( } uint32_t addr = (uint32_t)state->memory()->HeapAlloc( - 0, adjusted_size, MEMORY_FLAG_ZERO, alignment); + 0, adjusted_size, alloy::MEMORY_FLAG_ZERO, alignment); SHIM_SET_RETURN_32(addr); } diff --git a/src/xenia/kernel/xboxkrnl_misc.cc b/src/xenia/kernel/xboxkrnl_misc.cc index 73d7c0f87..6a4b2db99 100644 --- a/src/xenia/kernel/xboxkrnl_misc.cc +++ b/src/xenia/kernel/xboxkrnl_misc.cc @@ -16,11 +16,6 @@ #include -using namespace xe; -using namespace xe::kernel; -using namespace xe::kernel::xboxkrnl; - - namespace xe { namespace kernel { diff --git a/src/xenia/kernel/xboxkrnl_module.cc b/src/xenia/kernel/xboxkrnl_module.cc index 4b20f0710..f9daefb54 100644 --- a/src/xenia/kernel/xboxkrnl_module.cc +++ b/src/xenia/kernel/xboxkrnl_module.cc @@ -18,15 +18,14 @@ #include -using namespace xe; -using namespace xe::kernel; -using namespace xe::kernel::xboxkrnl; - - DEFINE_bool(abort_before_entry, false, "Abort execution right before launching the module."); +namespace xe { +namespace kernel { + + XboxkrnlModule::XboxkrnlModule(Emulator* emulator, KernelState* kernel_state) : XKernelModule(kernel_state, "xe:\\xboxkrnl.exe") { // Build the export table used for resolution. @@ -39,19 +38,19 @@ XboxkrnlModule::XboxkrnlModule(Emulator* emulator, KernelState* kernel_state) : "xboxkrnl.exe", xboxkrnl_export_table, XECOUNT(xboxkrnl_export_table)); // Register all exported functions. - RegisterAudioExports(export_resolver_, kernel_state); - RegisterDebugExports(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); + xboxkrnl::RegisterAudioExports(export_resolver_, kernel_state); + xboxkrnl::RegisterDebugExports(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); uint8_t* mem = memory_->membase(); @@ -177,3 +176,6 @@ int XboxkrnlModule::LaunchModule(const char* path) { return 0; } + +} // namespace kernel +} // namespace xe diff --git a/src/xenia/kernel/xboxkrnl_modules.cc b/src/xenia/kernel/xboxkrnl_modules.cc index bc659eb55..ec7bf3fc6 100644 --- a/src/xenia/kernel/xboxkrnl_modules.cc +++ b/src/xenia/kernel/xboxkrnl_modules.cc @@ -17,11 +17,6 @@ #include -using namespace xe; -using namespace xe::kernel; -using namespace xe::kernel::xboxkrnl; - - namespace xe { namespace kernel { diff --git a/src/xenia/kernel/xboxkrnl_ob.cc b/src/xenia/kernel/xboxkrnl_ob.cc index 9631c3cd9..7cb5a42d6 100644 --- a/src/xenia/kernel/xboxkrnl_ob.cc +++ b/src/xenia/kernel/xboxkrnl_ob.cc @@ -17,11 +17,6 @@ #include -using namespace xe; -using namespace xe::kernel; -using namespace xe::kernel::xboxkrnl; - - namespace xe { namespace kernel { diff --git a/src/xenia/kernel/xboxkrnl_rtl.cc b/src/xenia/kernel/xboxkrnl_rtl.cc index 9c9285026..5ac309ae6 100644 --- a/src/xenia/kernel/xboxkrnl_rtl.cc +++ b/src/xenia/kernel/xboxkrnl_rtl.cc @@ -18,11 +18,6 @@ #include -using namespace xe; -using namespace xe::kernel; -using namespace xe::kernel::xboxkrnl; - - namespace xe { namespace kernel { diff --git a/src/xenia/kernel/xboxkrnl_strings.cc b/src/xenia/kernel/xboxkrnl_strings.cc index 05095d537..bc5340a8d 100644 --- a/src/xenia/kernel/xboxkrnl_strings.cc +++ b/src/xenia/kernel/xboxkrnl_strings.cc @@ -18,11 +18,6 @@ #include -using namespace xe; -using namespace xe::kernel; -using namespace xe::kernel::xboxkrnl; - - namespace xe { namespace kernel { diff --git a/src/xenia/kernel/xboxkrnl_threading.cc b/src/xenia/kernel/xboxkrnl_threading.cc index 517345552..7de07269f 100644 --- a/src/xenia/kernel/xboxkrnl_threading.cc +++ b/src/xenia/kernel/xboxkrnl_threading.cc @@ -23,11 +23,6 @@ #include -using namespace xe; -using namespace xe::kernel; -using namespace xe::kernel::xboxkrnl; - - namespace xe { namespace kernel { diff --git a/src/xenia/kernel/xboxkrnl_usbcam.cc b/src/xenia/kernel/xboxkrnl_usbcam.cc index b68c02796..5eb79cb28 100644 --- a/src/xenia/kernel/xboxkrnl_usbcam.cc +++ b/src/xenia/kernel/xboxkrnl_usbcam.cc @@ -15,11 +15,6 @@ #include -using namespace xe; -using namespace xe::kernel; -using namespace xe::kernel::xboxkrnl; - - namespace xe { namespace kernel { diff --git a/src/xenia/kernel/xboxkrnl_video.cc b/src/xenia/kernel/xboxkrnl_video.cc index cbabd6cab..37bd71456 100644 --- a/src/xenia/kernel/xboxkrnl_video.cc +++ b/src/xenia/kernel/xboxkrnl_video.cc @@ -20,15 +20,11 @@ #include -using namespace xe; -using namespace xe::gpu; -using namespace xe::kernel; -using namespace xe::kernel::xboxkrnl; - - namespace xe { namespace kernel { +using xe::gpu::GraphicsSystem; + // http://www.tweakoz.com/orkid/ // http://www.tweakoz.com/orkid/dox/d3/d52/xb360init_8cpp_source.html @@ -376,7 +372,7 @@ SHIM_CALL VdSwap_shim( auto dwords = reinterpret_cast(SHIM_MEM_ADDR(unk0)); dwords[0] = poly::byte_swap((0x03 << 30) | ((1 - 1) << 16) | - (xenos::PM4_XE_SWAP << 8)); + (xe::gpu::xenos::PM4_XE_SWAP << 8)); SHIM_SET_RETURN_64(0); } diff --git a/src/xenia/kernel/xobject.cc b/src/xenia/kernel/xobject.cc index 8f2b1eccf..5574b3454 100644 --- a/src/xenia/kernel/xobject.cc +++ b/src/xenia/kernel/xobject.cc @@ -15,9 +15,8 @@ #include -using namespace xe; -using namespace xe::kernel; -using namespace xe::kernel::xboxkrnl; +namespace xe { +namespace kernel { XObject::XObject(KernelState* kernel_state, Type type) : @@ -267,3 +266,6 @@ XObject* XObject::GetObject(KernelState* kernel_state, void* native_ptr, return object; } } + +} // namespace kernel +} // namespace xe