diff --git a/src/xenia/cpu/backend/x64/x64_tracers.cc b/src/xenia/cpu/backend/x64/x64_tracers.cc index 85c0c251a..916372376 100644 --- a/src/xenia/cpu/backend/x64/x64_tracers.cc +++ b/src/xenia/cpu/backend/x64/x64_tracers.cc @@ -14,10 +14,6 @@ #include "xenia/cpu/processor.h" #include "xenia/cpu/thread_state.h" -using namespace xe; -using namespace xe::cpu::backend::x64; -using namespace xe::cpu; - namespace xe { namespace cpu { namespace backend { diff --git a/src/xenia/cpu/compiler/passes/context_promotion_pass.h b/src/xenia/cpu/compiler/passes/context_promotion_pass.h index d56f93455..5e36f9b39 100644 --- a/src/xenia/cpu/compiler/passes/context_promotion_pass.h +++ b/src/xenia/cpu/compiler/passes/context_promotion_pass.h @@ -10,6 +10,8 @@ #ifndef XENIA_CPU_COMPILER_PASSES_CONTEXT_PROMOTION_PASS_H_ #define XENIA_CPU_COMPILER_PASSES_CONTEXT_PROMOTION_PASS_H_ +#include + #include "xenia/base/platform.h" #include "xenia/cpu/compiler/compiler_pass.h" @@ -20,7 +22,6 @@ #include #pragma warning(pop) #else -#include #include #endif // XE_COMPILER_MSVC diff --git a/src/xenia/kernel/app.h b/src/xenia/kernel/app.h index bb6fb8c5d..04947f017 100644 --- a/src/xenia/kernel/app.h +++ b/src/xenia/kernel/app.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_XBOXKRNL_APP_H_ -#define XENIA_KERNEL_XBOXKRNL_APP_H_ +#ifndef XENIA_KERNEL_APP_H_ +#define XENIA_KERNEL_APP_H_ #include #include @@ -53,4 +53,4 @@ class XAppManager { } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_XBOXKRNL_APP_H_ +#endif // XENIA_KERNEL_APP_H_ diff --git a/src/xenia/kernel/apps/apps.h b/src/xenia/kernel/apps/apps.h index f9eb65603..23b5cc9ec 100644 --- a/src/xenia/kernel/apps/apps.h +++ b/src/xenia/kernel/apps/apps.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_XBOXKRNL_APPS_APPS_H_ -#define XENIA_KERNEL_XBOXKRNL_APPS_APPS_H_ +#ifndef XENIA_KERNEL_APPS_APPS_H_ +#define XENIA_KERNEL_APPS_APPS_H_ #include "xenia/kernel/app.h" #include "xenia/kernel/kernel_state.h" @@ -23,4 +23,4 @@ void RegisterApps(KernelState* kernel_state, XAppManager* manager); } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_XBOXKRNL_APPS_APPS_H_ +#endif // XENIA_KERNEL_APPS_APPS_H_ diff --git a/src/xenia/kernel/apps/xgi_app.h b/src/xenia/kernel/apps/xgi_app.h index e1e7b649a..bd971697d 100644 --- a/src/xenia/kernel/apps/xgi_app.h +++ b/src/xenia/kernel/apps/xgi_app.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_XBOXKRNL_APPS_XGI_APP_H_ -#define XENIA_KERNEL_XBOXKRNL_APPS_XGI_APP_H_ +#ifndef XENIA_KERNEL_APPS_XGI_APP_H_ +#define XENIA_KERNEL_APPS_XGI_APP_H_ #include "xenia/kernel/app.h" #include "xenia/kernel/kernel_state.h" @@ -31,4 +31,4 @@ class XXGIApp : public XApp { } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_XBOXKRNL_APPS_XGI_APP_H_ +#endif // XENIA_KERNEL_APPS_XGI_APP_H_ diff --git a/src/xenia/kernel/apps/xlivebase_app.h b/src/xenia/kernel/apps/xlivebase_app.h index ecf7d914f..8b630337c 100644 --- a/src/xenia/kernel/apps/xlivebase_app.h +++ b/src/xenia/kernel/apps/xlivebase_app.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_XBOXKRNL_APPS_XLIVEBASE_APP_H_ -#define XENIA_KERNEL_XBOXKRNL_APPS_XLIVEBASE_APP_H_ +#ifndef XENIA_KERNEL_APPS_XLIVEBASE_APP_H_ +#define XENIA_KERNEL_APPS_XLIVEBASE_APP_H_ #include "xenia/kernel/app.h" #include "xenia/kernel/kernel_state.h" @@ -31,4 +31,4 @@ class XXLiveBaseApp : public XApp { } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_XBOXKRNL_APPS_XLIVEBASE_APP_H_ +#endif // XENIA_KERNEL_APPS_XLIVEBASE_APP_H_ diff --git a/src/xenia/kernel/apps/xmp_app.h b/src/xenia/kernel/apps/xmp_app.h index 800781889..537d64ba8 100644 --- a/src/xenia/kernel/apps/xmp_app.h +++ b/src/xenia/kernel/apps/xmp_app.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_XBOXKRNL_APPS_XMP_APP_H_ -#define XENIA_KERNEL_XBOXKRNL_APPS_XMP_APP_H_ +#ifndef XENIA_KERNEL_APPS_XMP_APP_H_ +#define XENIA_KERNEL_APPS_XMP_APP_H_ #include #include @@ -112,4 +112,4 @@ class XXMPApp : public XApp { } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_XBOXKRNL_APPS_XMP_APP_H_ +#endif // XENIA_KERNEL_APPS_XMP_APP_H_ diff --git a/src/xenia/kernel/async_request.h b/src/xenia/kernel/async_request.h index a6c1de290..98133a472 100644 --- a/src/xenia/kernel/async_request.h +++ b/src/xenia/kernel/async_request.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_XBOXKRNL_ASYNC_REQUEST_H_ -#define XENIA_KERNEL_XBOXKRNL_ASYNC_REQUEST_H_ +#ifndef XENIA_KERNEL_ASYNC_REQUEST_H_ +#define XENIA_KERNEL_ASYNC_REQUEST_H_ #include @@ -50,4 +50,4 @@ class XAsyncRequest { } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_XBOXKRNL_ASYNC_REQUEST_H_ +#endif // XENIA_KERNEL_ASYNC_REQUEST_H_ diff --git a/src/xenia/kernel/dispatcher.h b/src/xenia/kernel/dispatcher.h index b8af9ea31..c03cbe23c 100644 --- a/src/xenia/kernel/dispatcher.h +++ b/src/xenia/kernel/dispatcher.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_XBOXKRNL_DISPATCHER_H_ -#define XENIA_KERNEL_XBOXKRNL_DISPATCHER_H_ +#ifndef XENIA_KERNEL_DISPATCHER_H_ +#define XENIA_KERNEL_DISPATCHER_H_ #include @@ -44,4 +44,4 @@ class Dispatcher { } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_XBOXKRNL_DISPATCHER_H_ +#endif // XENIA_KERNEL_DISPATCHER_H_ diff --git a/src/xenia/kernel/native_list.h b/src/xenia/kernel/native_list.h index f95fe4859..699c31165 100644 --- a/src/xenia/kernel/native_list.h +++ b/src/xenia/kernel/native_list.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_XBOXKRNL_NATIVE_LIST_H_ -#define XENIA_KERNEL_XBOXKRNL_NATIVE_LIST_H_ +#ifndef XENIA_KERNEL_NATIVE_LIST_H_ +#define XENIA_KERNEL_NATIVE_LIST_H_ #include "xenia/memory.h" #include "xenia/xbox.h" @@ -47,4 +47,4 @@ class NativeList { } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_XBOXKRNL_NATIVE_LIST_H_ +#endif // XENIA_KERNEL_NATIVE_LIST_H_ diff --git a/src/xenia/kernel/object_table.h b/src/xenia/kernel/object_table.h index fd47f9139..97e922284 100644 --- a/src/xenia/kernel/object_table.h +++ b/src/xenia/kernel/object_table.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_XBOXKRNL_OBJECT_TABLE_H_ -#define XENIA_KERNEL_XBOXKRNL_OBJECT_TABLE_H_ +#ifndef XENIA_KERNEL_OBJECT_TABLE_H_ +#define XENIA_KERNEL_OBJECT_TABLE_H_ #include #include @@ -74,4 +74,4 @@ class ObjectTable { } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_XBOXKRNL_OBJECT_TABLE_H_ +#endif // XENIA_KERNEL_OBJECT_TABLE_H_ diff --git a/src/xenia/kernel/objects/xenumerator.h b/src/xenia/kernel/objects/xenumerator.h index cea1f92be..c435b0625 100644 --- a/src/xenia/kernel/objects/xenumerator.h +++ b/src/xenia/kernel/objects/xenumerator.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_XBOXKRNL_XENUMERATOR_H_ -#define XENIA_KERNEL_XBOXKRNL_XENUMERATOR_H_ +#ifndef XENIA_KERNEL_OBJECTS_XENUMERATOR_H_ +#define XENIA_KERNEL_OBJECTS_XENUMERATOR_H_ #include #include @@ -82,4 +82,4 @@ class XStaticEnumerator : public XEnumerator { } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_XBOXKRNL_XENUMERATOR_H_ +#endif // XENIA_KERNEL_OBJECTS_XENUMERATOR_H_ diff --git a/src/xenia/kernel/objects/xevent.h b/src/xenia/kernel/objects/xevent.h index 696a0b27f..fc1143f7b 100644 --- a/src/xenia/kernel/objects/xevent.h +++ b/src/xenia/kernel/objects/xevent.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_XBOXKRNL_XEVENT_H_ -#define XENIA_KERNEL_XBOXKRNL_XEVENT_H_ +#ifndef XENIA_KERNEL_OBJECTS_XEVENT_H_ +#define XENIA_KERNEL_OBJECTS_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_XBOXKRNL_XEVENT_H_ +#endif // XENIA_KERNEL_OBJECTS_XEVENT_H_ diff --git a/src/xenia/kernel/objects/xfile.h b/src/xenia/kernel/objects/xfile.h index c4b09ed1a..efa3560ee 100644 --- a/src/xenia/kernel/objects/xfile.h +++ b/src/xenia/kernel/objects/xfile.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_XBOXKRNL_XFILE_H_ -#define XENIA_KERNEL_XBOXKRNL_XFILE_H_ +#ifndef XENIA_KERNEL_OBJECTS_XFILE_H_ +#define XENIA_KERNEL_OBJECTS_XFILE_H_ #include "xenia/base/filesystem.h" #include "xenia/kernel/objects/xevent.h" @@ -130,4 +130,4 @@ class XFile : public XObject { } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_XBOXKRNL_XFILE_H_ +#endif // XENIA_KERNEL_OBJECTS_XFILE_H_ diff --git a/src/xenia/kernel/objects/xkernel_module.h b/src/xenia/kernel/objects/xkernel_module.h index a966117da..75a6d2394 100644 --- a/src/xenia/kernel/objects/xkernel_module.h +++ b/src/xenia/kernel/objects/xkernel_module.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_XBOXKRNL_XKERNEL_MODULE_H_ -#define XENIA_KERNEL_XBOXKRNL_XKERNEL_MODULE_H_ +#ifndef XENIA_KERNEL_OBJECTS_XKERNEL_MODULE_H_ +#define XENIA_KERNEL_OBJECTS_XKERNEL_MODULE_H_ #include "xenia/emulator.h" #include "xenia/kernel/objects/xmodule.h" @@ -35,4 +35,4 @@ class XKernelModule : public XModule { } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_XBOXKRNL_XKERNEL_MODULE_H_ +#endif // XENIA_KERNEL_OBJECTS_XKERNEL_MODULE_H_ diff --git a/src/xenia/kernel/objects/xmodule.h b/src/xenia/kernel/objects/xmodule.h index 6573b9d1f..029e0faec 100644 --- a/src/xenia/kernel/objects/xmodule.h +++ b/src/xenia/kernel/objects/xmodule.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_XBOXKRNL_XMODULE_H_ -#define XENIA_KERNEL_XBOXKRNL_XMODULE_H_ +#ifndef XENIA_KERNEL_OBJECTS_XMODULE_H_ +#define XENIA_KERNEL_OBJECTS_XMODULE_H_ #include @@ -100,4 +100,4 @@ class XModule : public XObject { } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_XBOXKRNL_XMODULE_H_ +#endif // XENIA_KERNEL_OBJECTS_XMODULE_H_ diff --git a/src/xenia/kernel/objects/xmutant.h b/src/xenia/kernel/objects/xmutant.h index 6d8121350..06725c2f1 100644 --- a/src/xenia/kernel/objects/xmutant.h +++ b/src/xenia/kernel/objects/xmutant.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_XBOXKRNL_XMUTANT_H_ -#define XENIA_KERNEL_XBOXKRNL_XMUTANT_H_ +#ifndef XENIA_KERNEL_OBJECTS_XMUTANT_H_ +#define XENIA_KERNEL_OBJECTS_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_XBOXKRNL_XMUTANT_H_ +#endif // XENIA_KERNEL_OBJECTS_XMUTANT_H_ diff --git a/src/xenia/kernel/objects/xnotify_listener.h b/src/xenia/kernel/objects/xnotify_listener.h index ad520ba5f..27e38ce18 100644 --- a/src/xenia/kernel/objects/xnotify_listener.h +++ b/src/xenia/kernel/objects/xnotify_listener.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_XBOXKRNL_XNOTIFY_LISTENER_H_ -#define XENIA_KERNEL_XBOXKRNL_XNOTIFY_LISTENER_H_ +#ifndef XENIA_KERNEL_OBJECTS_XNOTIFY_LISTENER_H_ +#define XENIA_KERNEL_OBJECTS_XNOTIFY_LISTENER_H_ #include #include @@ -49,4 +49,4 @@ class XNotifyListener : public XObject { } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_XBOXKRNL_XNOTIFY_LISTENER_H_ +#endif // XENIA_KERNEL_OBJECTS_XNOTIFY_LISTENER_H_ diff --git a/src/xenia/kernel/objects/xsemaphore.h b/src/xenia/kernel/objects/xsemaphore.h index cdccb1993..cb63b539f 100644 --- a/src/xenia/kernel/objects/xsemaphore.h +++ b/src/xenia/kernel/objects/xsemaphore.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_XBOXKRNL_XSEMAPHORE_H_ -#define XENIA_KERNEL_XBOXKRNL_XSEMAPHORE_H_ +#ifndef XENIA_KERNEL_OBJECTS_XSEMAPHORE_H_ +#define XENIA_KERNEL_OBJECTS_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_XBOXKRNL_XSEMAPHORE_H_ +#endif // XENIA_KERNEL_OBJECTS_XSEMAPHORE_H_ diff --git a/src/xenia/kernel/objects/xthread.h b/src/xenia/kernel/objects/xthread.h index f770501c6..d9ae6d56b 100644 --- a/src/xenia/kernel/objects/xthread.h +++ b/src/xenia/kernel/objects/xthread.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_XBOXKRNL_XTHREAD_H_ -#define XENIA_KERNEL_XBOXKRNL_XTHREAD_H_ +#ifndef XENIA_KERNEL_OBJECTS_XTHREAD_H_ +#define XENIA_KERNEL_OBJECTS_XTHREAD_H_ #include #include @@ -208,4 +208,4 @@ class XHostThread : public XThread { } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_XBOXKRNL_XTHREAD_H_ +#endif // XENIA_KERNEL_OBJECTS_XTHREAD_H_ diff --git a/src/xenia/kernel/objects/xtimer.h b/src/xenia/kernel/objects/xtimer.h index 59dcc1337..b2b5a0c24 100644 --- a/src/xenia/kernel/objects/xtimer.h +++ b/src/xenia/kernel/objects/xtimer.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_XBOXKRNL_XTIMER_H_ -#define XENIA_KERNEL_XBOXKRNL_XTIMER_H_ +#ifndef XENIA_KERNEL_OBJECTS_XTIMER_H_ +#define XENIA_KERNEL_OBJECTS_XTIMER_H_ #include "xenia/base/threading.h" #include "xenia/kernel/xobject.h" @@ -41,4 +41,4 @@ class XTimer : public XObject { } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_XBOXKRNL_TIMER_H_ +#endif // XENIA_KERNEL_OBJECTS_TIMER_H_ diff --git a/src/xenia/kernel/objects/xuser_module.h b/src/xenia/kernel/objects/xuser_module.h index dc9a168dd..c260d14c7 100644 --- a/src/xenia/kernel/objects/xuser_module.h +++ b/src/xenia/kernel/objects/xuser_module.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_XBOXKRNL_XUSER_MODULE_H_ -#define XENIA_KERNEL_XBOXKRNL_XUSER_MODULE_H_ +#ifndef XENIA_KERNEL_OBJECTS_XUSER_MODULE_H_ +#define XENIA_KERNEL_OBJECTS_XUSER_MODULE_H_ #include @@ -80,4 +80,4 @@ class XUserModule : public XModule { } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_XBOXKRNL_XUSER_MODULE_H_ +#endif // XENIA_KERNEL_OBJECTS_XUSER_MODULE_H_ diff --git a/src/xenia/kernel/user_profile.h b/src/xenia/kernel/user_profile.h index 781d3e0d0..8cd86e7cb 100644 --- a/src/xenia/kernel/user_profile.h +++ b/src/xenia/kernel/user_profile.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_XBOXKRNL_USER_PROFILE_H_ -#define XENIA_KERNEL_XBOXKRNL_USER_PROFILE_H_ +#ifndef XENIA_KERNEL_USER_PROFILE_H_ +#define XENIA_KERNEL_USER_PROFILE_H_ #include #include @@ -196,4 +196,4 @@ class UserProfile { } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_XBOXKRNL_USER_PROFILE_H_ +#endif // XENIA_KERNEL_USER_PROFILE_H_ diff --git a/src/xenia/kernel/util/shim_utils.h b/src/xenia/kernel/util/shim_utils.h index 20277199e..d623c004f 100644 --- a/src/xenia/kernel/util/shim_utils.h +++ b/src/xenia/kernel/util/shim_utils.h @@ -78,7 +78,7 @@ inline uint64_t get_arg_64(PPCContext* ppc_context, uint8_t index) { uint32_t stack_address = get_arg_stack_ptr(ppc_context, index - 8); return SHIM_MEM_64(stack_address); } -} +} // namespace util #define SHIM_GET_ARG_8(n) util::get_arg_8(ppc_context, n) #define SHIM_GET_ARG_16(n) util::get_arg_16(ppc_context, n) @@ -123,7 +123,8 @@ class Param { }; template <> inline void Param::LoadValue(Param::Init& init, float* out_value) { - *out_value = float(init.ppc_context->f[1 + ++init.float_ordinal]); + *out_value = + static_cast(init.ppc_context->f[1 + ++init.float_ordinal]); } template <> inline void Param::LoadValue(Param::Init& init, double* out_value) { @@ -322,10 +323,10 @@ inline void AppendParam(StringBuffer& string_buffer, qword_t param) { string_buffer.AppendFormat("%.16llX", uint64_t(param)); } inline void AppendParam(StringBuffer& string_buffer, float_t param) { - string_buffer.AppendFormat("%G", float(param)); + string_buffer.AppendFormat("%G", static_cast(param)); } inline void AppendParam(StringBuffer& string_buffer, double_t param) { - string_buffer.AppendFormat("%G", double(param)); + string_buffer.AppendFormat("%G", static_cast(param)); } inline void AppendParam(StringBuffer& string_buffer, lpvoid_t param) { string_buffer.AppendFormat("%.8X", uint32_t(param)); diff --git a/src/xenia/kernel/util/xex2.cc b/src/xenia/kernel/util/xex2.cc index 20dbe6a0b..49b47578b 100644 --- a/src/xenia/kernel/util/xex2.cc +++ b/src/xenia/kernel/util/xex2.cc @@ -9,12 +9,12 @@ #include "xenia/kernel/util/xex2.h" +#include + #include #include #include -#include - #include "third_party/crypto/rijndael-alg-fst.h" #include "third_party/crypto/rijndael-alg-fst.c" #include "third_party/mspack/lzx.h" diff --git a/src/xenia/kernel/util/xex2_info.h b/src/xenia/kernel/util/xex2_info.h index 8df772034..b56b669c2 100644 --- a/src/xenia/kernel/util/xex2_info.h +++ b/src/xenia/kernel/util/xex2_info.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_XEX2_INFO_H_ -#define XENIA_KERNEL_XEX2_INFO_H_ +#ifndef XENIA_KERNEL_UTIL_XEX2_INFO_H_ +#define XENIA_KERNEL_UTIL_XEX2_INFO_H_ #include @@ -91,7 +91,7 @@ enum xe_xex2_system_flags : uint32_t { XEX_SYSTEM_ALLOW_AVATAR_GET_METADATA_BY_XUID = 0x20000000, XEX_SYSTEM_ALLOW_CONTROLLER_SWAPPING = 0x40000000, XEX_SYSTEM_DASH_EXTENSIBILITY_MODULE = 0x80000000, - // TODO: figure out how stored + // TODO(benvanik): figure out how stored. /*XEX_SYSTEM_ALLOW_NETWORK_READ_CANCEL = 0x0, XEX_SYSTEM_UNINTERRUPTABLE_READS = 0x0, XEX_SYSTEM_REQUIRE_FULL_EXPERIENCE = 0x0, @@ -645,4 +645,4 @@ struct X_IMAGE_EXPORT_DIRECTORY { } // namespace xe -#endif // XENIA_KERNEL_XEX2_INFO_H_ +#endif // XENIA_KERNEL_UTIL_XEX2_INFO_H_ diff --git a/src/xenia/kernel/xboxkrnl_module.h b/src/xenia/kernel/xboxkrnl_module.h index 922e440aa..3d2d54d59 100644 --- a/src/xenia/kernel/xboxkrnl_module.h +++ b/src/xenia/kernel/xboxkrnl_module.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_XBOXKRNL_MODULE_H_ -#define XENIA_KERNEL_XBOXKRNL_MODULE_H_ +#ifndef XENIA_KERNEL_MODULE_H_ +#define XENIA_KERNEL_MODULE_H_ #include @@ -41,4 +41,4 @@ class XboxkrnlModule : public XKernelModule { } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_XBOXKRNL_MODULE_H_ +#endif // XENIA_KERNEL_MODULE_H_ diff --git a/src/xenia/kernel/xboxkrnl_ordinals.h b/src/xenia/kernel/xboxkrnl_ordinals.h index 26ba98251..f9acd6c66 100644 --- a/src/xenia/kernel/xboxkrnl_ordinals.h +++ b/src/xenia/kernel/xboxkrnl_ordinals.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_XBOXKRNL_ORDINALS_H_ -#define XENIA_KERNEL_XBOXKRNL_ORDINALS_H_ +#ifndef XENIA_KERNEL_ORDINALS_H_ +#define XENIA_KERNEL_ORDINALS_H_ #include "xenia/cpu/export_resolver.h" @@ -21,4 +21,4 @@ enum { } // namespace ordinals #include "xenia/kernel/util/ordinal_table_post.inc" -#endif // XENIA_KERNEL_XBOXKRNL_ORDINALS_H_ +#endif // XENIA_KERNEL_ORDINALS_H_ diff --git a/src/xenia/kernel/xboxkrnl_private.h b/src/xenia/kernel/xboxkrnl_private.h index 7451568dd..34f123be6 100644 --- a/src/xenia/kernel/xboxkrnl_private.h +++ b/src/xenia/kernel/xboxkrnl_private.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_XBOXKRNL_PRIVATE_H_ -#define XENIA_KERNEL_XBOXKRNL_PRIVATE_H_ +#ifndef XENIA_KERNEL_PRIVATE_H_ +#define XENIA_KERNEL_PRIVATE_H_ #include "xenia/kernel/xboxkrnl_ordinals.h" @@ -58,4 +58,4 @@ void RegisterVideoExports(xe::cpu::ExportResolver* export_resolver, } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_XBOXKRNL_PRIVATE_H_ +#endif // XENIA_KERNEL_PRIVATE_H_ diff --git a/src/xenia/kernel/xboxkrnl_rtl.h b/src/xenia/kernel/xboxkrnl_rtl.h index 102d5ffb0..a5a256ca9 100644 --- a/src/xenia/kernel/xboxkrnl_rtl.h +++ b/src/xenia/kernel/xboxkrnl_rtl.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_XBOXKRNL_RTL_H_ -#define XENIA_KERNEL_XBOXKRNL_RTL_H_ +#ifndef XENIA_KERNEL_RTL_H_ +#define XENIA_KERNEL_RTL_H_ #include "xenia/xbox.h" @@ -26,4 +26,4 @@ X_STATUS xeRtlInitializeCriticalSectionAndSpinCount(X_RTL_CRITICAL_SECTION* cs, } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_XBOXKRNL_RTL_H_ +#endif // XENIA_KERNEL_RTL_H_ diff --git a/src/xenia/kernel/xobject.h b/src/xenia/kernel/xobject.h index 7b54ed030..b366a4894 100644 --- a/src/xenia/kernel/xobject.h +++ b/src/xenia/kernel/xobject.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_XBOXKRNL_XOBJECT_H_ -#define XENIA_KERNEL_XBOXKRNL_XOBJECT_H_ +#ifndef XENIA_KERNEL_XOBJECT_H_ +#define XENIA_KERNEL_XOBJECT_H_ #include @@ -323,4 +323,4 @@ object_ref retain_object(T* ptr) { } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_XBOXKRNL_XOBJECT_H_ +#endif // XENIA_KERNEL_XOBJECT_H_ diff --git a/src/xenia/ui/file_picker.h b/src/xenia/ui/file_picker.h index c6884f23e..aa0a7607a 100644 --- a/src/xenia/ui/file_picker.h +++ b/src/xenia/ui/file_picker.h @@ -12,6 +12,7 @@ #include #include +#include #include namespace xe { diff --git a/src/xenia/ui/gl/blitter.cc b/src/xenia/ui/gl/blitter.cc index 6d12eac1a..37e282d5b 100644 --- a/src/xenia/ui/gl/blitter.cc +++ b/src/xenia/ui/gl/blitter.cc @@ -35,48 +35,46 @@ Blitter::~Blitter() = default; bool Blitter::Initialize() { const std::string header = - "\n\ -#version 450 \n\ -#extension GL_ARB_explicit_uniform_location : require \n\ -#extension GL_ARB_shading_language_420pack : require \n\ -precision highp float; \n\ -precision highp int; \n\ -layout(std140, column_major) uniform; \n\ -layout(std430, column_major) buffer; \n\ -"; + R"( +#version 450 +#extension GL_ARB_explicit_uniform_location : require +#extension GL_ARB_shading_language_420pack : require +precision highp float; +precision highp int; +layout(std140, column_major) uniform; +layout(std430, column_major) buffer; +)"; const std::string vs_source = header + - "\n\ -layout(location = 0) uniform vec4 src_uv; \n\ -out gl_PerVertex { \n\ - vec4 gl_Position; \n\ - float gl_PointSize; \n\ - float gl_ClipDistance[]; \n\ -}; \n\ -layout(location = 0) in vec2 vfetch_pos; \n\ -layout(location = 0) out vec2 vtx_uv; \n\ -void main() { \n\ - gl_Position = vec4(vfetch_pos.xy * vec2(2.0, -2.0) - vec2(1.0, -1.0), 0.0, 1.0); \n\ - vtx_uv = vfetch_pos.xy * src_uv.zw + src_uv.xy; \n\ -} \n\ -"; + R"( +layout(location = 0) uniform vec4 src_uv; +out gl_PerVertex { + vec4 gl_Position; + float gl_PointSize; + float gl_ClipDistance[]; +}; +layout(location = 0) in vec2 vfetch_pos; +layout(location = 0) out vec2 vtx_uv; +void main() { + gl_Position = vec4(vfetch_pos.xy * vec2(2.0, -2.0) - + vec2(1.0, -1.0), 0.0, 1.0); + vtx_uv = vfetch_pos.xy * src_uv.zw + src_uv.xy; +})"; const std::string color_fs_source = header + - "\n\ -layout(location = 1) uniform sampler2D src_texture; \n\ -layout(location = 0) in vec2 vtx_uv; \n\ -layout(location = 0) out vec4 oC; \n\ -void main() { \n\ - oC = texture(src_texture, vtx_uv); \n\ -} \n\ -"; + R"( +layout(location = 1) uniform sampler2D src_texture; +layout(location = 0) in vec2 vtx_uv; +layout(location = 0) out vec4 oC; +void main() { + oC = texture(src_texture, vtx_uv); +})"; const std::string depth_fs_source = header + - "\n\ -layout(location = 1) uniform sampler2D src_texture; \n\ -layout(location = 0) in vec2 vtx_uv; \n\ -layout(location = 0) out vec4 oC; \n\ -void main() { \n\ - gl_FragDepth = texture(src_texture, vtx_uv).r; \n\ -} \n\ -"; + R"( +layout(location = 1) uniform sampler2D src_texture; +layout(location = 0) in vec2 vtx_uv; +layout(location = 0) out vec4 oC; +void main() { + gl_FragDepth = texture(src_texture, vtx_uv).r; +})"; auto vs_source_str = vs_source.c_str(); vertex_program_ = glCreateShaderProgramv(GL_VERTEX_SHADER, 1, &vs_source_str); @@ -165,7 +163,8 @@ struct SavedState { glGetIntegerv(GL_CULL_FACE_MODE, &cull_face); glGetIntegerv(GL_FRONT_FACE, &front_face); glGetIntegerv(GL_POLYGON_MODE, &polygon_mode); - glGetBooleani_v(GL_COLOR_WRITEMASK, 0, (GLboolean*)&color_mask_0_enabled); + glGetBooleani_v(GL_COLOR_WRITEMASK, 0, + reinterpret_cast(&color_mask_0_enabled)); blend_0_enabled = glIsEnabledi(GL_BLEND, 0); glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &draw_buffer); glGetFloati_v(GL_VIEWPORT, 0, viewport); @@ -230,10 +229,11 @@ void Blitter::Draw(GLuint src_texture, Rect2D src_rect, Rect2D dest_rect, GLint src_texture_height; glGetTextureLevelParameteriv(src_texture, 0, GL_TEXTURE_HEIGHT, &src_texture_height); - glProgramUniform4f(vertex_program_, 0, src_rect.x / float(src_texture_width), - src_rect.y / float(src_texture_height), - src_rect.width / float(src_texture_width), - src_rect.height / float(src_texture_height)); + glProgramUniform4f(vertex_program_, 0, + src_rect.x / static_cast(src_texture_width), + src_rect.y / static_cast(src_texture_height), + src_rect.width / static_cast(src_texture_width), + src_rect.height / static_cast(src_texture_height)); // Useful for seeing the entire framebuffer/etc: // glProgramUniform4f(vertex_program_, 0, 0.0f, 0.0f, 1.0f, 1.0f); diff --git a/src/xenia/ui/gl/circular_buffer.cc b/src/xenia/ui/gl/circular_buffer.cc index ba50aa1d0..863b1bd2d 100644 --- a/src/xenia/ui/gl/circular_buffer.cc +++ b/src/xenia/ui/gl/circular_buffer.cc @@ -9,6 +9,8 @@ #include "xenia/ui/gl/circular_buffer.h" +#include + #include "xenia/base/assert.h" #include "xenia/base/math.h" diff --git a/src/xenia/ui/gl/gl4_elemental_renderer.cc b/src/xenia/ui/gl/gl4_elemental_renderer.cc index 431e53a21..0baddc98a 100644 --- a/src/xenia/ui/gl/gl4_elemental_renderer.cc +++ b/src/xenia/ui/gl/gl4_elemental_renderer.cc @@ -10,6 +10,7 @@ #include "xenia/ui/gl/gl4_elemental_renderer.h" #include +#include #include "el/graphics/bitmap_fragment.h" #include "el/util/math.h" @@ -93,45 +94,43 @@ bool GL4ElementalRenderer::Initialize() { } const std::string header = - "\n\ -#version 450 \n\ -#extension GL_ARB_bindless_texture : require \n\ -#extension GL_ARB_explicit_uniform_location : require \n\ -#extension GL_ARB_shading_language_420pack : require \n\ -precision highp float; \n\ -precision highp int; \n\ -layout(std140, column_major) uniform; \n\ -layout(std430, column_major) buffer; \n\ -"; + R"( +#version 450 +#extension GL_ARB_bindless_texture : require +#extension GL_ARB_explicit_uniform_location : require +#extension GL_ARB_shading_language_420pack : require +precision highp float; +precision highp int; +layout(std140, column_major) uniform; +layout(std430, column_major) buffer; +)"; const std::string vertex_shader_source = header + - "\n\ -layout(location = 0) uniform mat4 projection_matrix; \n\ -layout(location = 0) in vec2 in_pos; \n\ -layout(location = 1) in vec4 in_color; \n\ -layout(location = 2) in vec2 in_uv; \n\ -layout(location = 0) out vec4 vtx_color; \n\ -layout(location = 1) out vec2 vtx_uv; \n\ -void main() { \n\ - gl_Position = projection_matrix * vec4(in_pos.xy, 0.0, 1.0); \n\ - vtx_color = in_color; \n\ - vtx_uv = in_uv; \n\ -} \n\ -"; + R"( +layout(location = 0) uniform mat4 projection_matrix; +layout(location = 0) in vec2 in_pos; +layout(location = 1) in vec4 in_color; +layout(location = 2) in vec2 in_uv; +layout(location = 0) out vec4 vtx_color; +layout(location = 1) out vec2 vtx_uv; +void main() { + gl_Position = projection_matrix * vec4(in_pos.xy, 0.0, 1.0); + vtx_color = in_color; + vtx_uv = in_uv; +})"; const std::string fragment_shader_source = header + - "\n\ -layout(location = 1, bindless_sampler) uniform sampler2D texture_sampler; \n\ -layout(location = 2) uniform float texture_mix; \n\ -layout(location = 0) in vec4 vtx_color; \n\ -layout(location = 1) in vec2 vtx_uv; \n\ -layout(location = 0) out vec4 oC; \n\ -void main() { \n\ - oC = vtx_color; \n\ - if (texture_mix > 0.0) { \n\ - vec4 color = texture(texture_sampler, vtx_uv); \n\ - oC *= color.rgba; \n\ - } \n\ -} \n\ -"; + R"( +layout(location = 1, bindless_sampler) uniform sampler2D texture_sampler; +layout(location = 2) uniform float texture_mix; +layout(location = 0) in vec4 vtx_color; +layout(location = 1) in vec2 vtx_uv; +layout(location = 0) out vec4 oC; +void main() { + oC = vtx_color; + if (texture_mix > 0.0) { + vec4 color = texture(texture_sampler, vtx_uv); + oC *= color.rgba; + } +})"; GLuint vertex_shader = glCreateShader(GL_VERTEX_SHADER); const char* vertex_shader_source_ptr = vertex_shader_source.c_str(); @@ -204,8 +203,8 @@ void GL4ElementalRenderer::BeginPaint(int render_target_w, glScissor(0, 0, render_target_w, render_target_h); float left = 0.0f; - float right = float(render_target_w); - float bottom = float(render_target_h); + float right = static_cast(render_target_w); + float bottom = static_cast(render_target_h); float top = 0.0f; float z_near = -1.0f; float z_far = 1.0f; diff --git a/src/xenia/ui/gl/gl4_elemental_renderer.h b/src/xenia/ui/gl/gl4_elemental_renderer.h index e40754773..15bfa7882 100644 --- a/src/xenia/ui/gl/gl4_elemental_renderer.h +++ b/src/xenia/ui/gl/gl4_elemental_renderer.h @@ -23,7 +23,7 @@ namespace gl { class GL4ElementalRenderer : public el::graphics::Renderer { public: - GL4ElementalRenderer(GLContext* context); + explicit GL4ElementalRenderer(GLContext* context); ~GL4ElementalRenderer() override; static std::unique_ptr Create(GLContext* context); diff --git a/src/xenia/ui/gl/gl_context.cc b/src/xenia/ui/gl/gl_context.cc index e993b1d30..cbddc7055 100644 --- a/src/xenia/ui/gl/gl_context.cc +++ b/src/xenia/ui/gl/gl_context.cc @@ -449,7 +449,8 @@ void GLContext::BeginSwap() { SCOPE_profile_cpu_i("gpu", "xe::ui::gl::GLContext::BeginSwap"); float clear_color[] = {238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 1.0f}; if (FLAGS_random_clear_color) { - clear_color[0] = rand() / (float)RAND_MAX; + clear_color[0] = + rand() / static_cast(RAND_MAX); // NOLINT(runtime/threadsafe_fn) clear_color[1] = 1.0f; clear_color[2] = 0.0f; clear_color[3] = 1.0f; diff --git a/src/xenia/ui/gl/gl_context.h b/src/xenia/ui/gl/gl_context.h index 441c0bb9f..dd1108ea4 100644 --- a/src/xenia/ui/gl/gl_context.h +++ b/src/xenia/ui/gl/gl_context.h @@ -49,7 +49,7 @@ class GLContext : public GraphicsContext { Blitter* blitter() { return &blitter_; } private: - GLContext(Window* target_window); + explicit GLContext(Window* target_window); GLContext(Window* target_window, HGLRC glrc); bool Initialize(Window* target_window); diff --git a/src/xenia/ui/gl/gl_profiler_display.cc b/src/xenia/ui/gl/gl_profiler_display.cc index d88d23156..5825247fe 100644 --- a/src/xenia/ui/gl/gl_profiler_display.cc +++ b/src/xenia/ui/gl/gl_profiler_display.cc @@ -9,6 +9,9 @@ #include "xenia/ui/gl/gl_profiler_display.h" +#include +#include + #include "third_party/microprofile/microprofileui.h" #include "xenia/base/assert.h" @@ -255,50 +258,48 @@ bool GLProfilerDisplay::SetupState() { bool GLProfilerDisplay::SetupShaders() { const std::string header = - "\n\ -#version 450 \n\ -#extension GL_ARB_bindless_texture : require \n\ -#extension GL_ARB_explicit_uniform_location : require \n\ -#extension GL_ARB_shading_language_420pack : require \n\ -precision highp float; \n\ -precision highp int; \n\ -layout(std140, column_major) uniform; \n\ -layout(std430, column_major) buffer; \n\ -"; + R"( +#version 450 +#extension GL_ARB_bindless_texture : require +#extension GL_ARB_explicit_uniform_location : require +#extension GL_ARB_shading_language_420pack : require +precision highp float; +precision highp int; +layout(std140, column_major) uniform; +layout(std430, column_major) buffer; +)"; const std::string vertex_shader_source = header + - "\n\ -layout(location = 0) uniform mat4 projection_matrix; \n\ -layout(location = 0) in vec2 in_pos; \n\ -layout(location = 1) in vec4 in_color; \n\ -layout(location = 2) in vec2 in_uv; \n\ -layout(location = 0) out vec4 vtx_color; \n\ -layout(location = 1) out vec2 vtx_uv; \n\ -void main() { \n\ - gl_Position = projection_matrix * vec4(in_pos.xy, 0.0, 1.0); \n\ - vtx_color = in_color; \n\ - vtx_uv = in_uv; \n\ -} \n\ -"; + R"( +layout(location = 0) uniform mat4 projection_matrix; +layout(location = 0) in vec2 in_pos; +layout(location = 1) in vec4 in_color; +layout(location = 2) in vec2 in_uv; +layout(location = 0) out vec4 vtx_color; +layout(location = 1) out vec2 vtx_uv; +void main() { + gl_Position = projection_matrix * vec4(in_pos.xy, 0.0, 1.0); + vtx_color = in_color; + vtx_uv = in_uv; +})"; const std::string fragment_shader_source = header + - "\n\ -layout(location = 1, bindless_sampler) uniform sampler2D font_texture; \n\ -layout(location = 2) uniform float font_height; \n\ -layout(location = 0) in vec4 vtx_color; \n\ -layout(location = 1) in vec2 vtx_uv; \n\ -layout(location = 0) out vec4 oC; \n\ -void main() { \n\ - if (vtx_uv.x > 1.0) { \n\ - oC = vtx_color; \n\ - } else { \n\ - vec4 color = texture(font_texture, vtx_uv); \n\ - oC = color.rgba * vtx_color; \n\ - if (color.a < 0.5) { \n\ - vec4 c1 = texture(font_texture, vtx_uv + vec2(0.0, font_height)); \n\ - oC = vec4(0, 0, 0, c1.a); \n\ - } \n\ - } \n\ -} \n\ -"; + R"( +layout(location = 1, bindless_sampler) uniform sampler2D font_texture; +layout(location = 2) uniform float font_height; +layout(location = 0) in vec4 vtx_color; +layout(location = 1) in vec2 vtx_uv; +layout(location = 0) out vec4 oC; +void main() { + if (vtx_uv.x > 1.0) { + oC = vtx_color; + } else { + vec4 color = texture(font_texture, vtx_uv); + oC = color.rgba * vtx_color; + if (color.a < 0.5) { + vec4 c1 = texture(font_texture, vtx_uv + vec2(0.0, font_height)); + oC = vec4(0, 0, 0, c1.a); + } + } +})"; GLuint vertex_shader = glCreateShader(GL_VERTEX_SHADER); const char* vertex_shader_source_ptr = vertex_shader_source.c_str(); @@ -365,8 +366,8 @@ void GLProfilerDisplay::Begin() { glViewport(0, 0, width(), height()); float left = 0.0f; - float right = float(width()); - float bottom = float(height()); + float right = static_cast(width()); + float bottom = static_cast(height()); float top = 0.0f; float z_near = -1.0f; float z_far = 1.0f; @@ -441,23 +442,23 @@ void GLProfilerDisplay::DrawBox(int x0, int y0, int x1, int y1, uint32_t color, if (type == BoxType::kFlat) { color = ((color & 0xff) << 16) | ((color >> 16) & 0xff) | (0xff00ff00 & color); - Q0(v, x, (float)x0); - Q0(v, y, (float)y0); + Q0(v, x, x0); + Q0(v, y, y0); Q0(v, color, color); Q0(v, u, 2.0f); Q0(v, v, 2.0f); - Q1(v, x, (float)x1); - Q1(v, y, (float)y0); + Q1(v, x, x1); + Q1(v, y, y0); Q1(v, color, color); Q1(v, u, 2.0f); Q1(v, v, 2.0f); - Q2(v, x, (float)x1); - Q2(v, y, (float)y1); + Q2(v, x, x1); + Q2(v, y, y1); Q2(v, color, color); Q2(v, u, 2.0f); Q2(v, v, 2.0f); - Q3(v, x, (float)x0); - Q3(v, y, (float)y1); + Q3(v, x, x0); + Q3(v, y, y1); Q3(v, color, color); Q3(v, u, 2.0f); Q3(v, v, 2.0f); @@ -477,23 +478,23 @@ void GLProfilerDisplay::DrawBox(int x0, int y0, int x1, int y1, uint32_t color, uint32_t b1 = 0xff & ((b + nMin) / 2); uint32_t color0 = (r0 << 0) | (g0 << 8) | (b0 << 16) | (0xff000000 & color); uint32_t color1 = (r1 << 0) | (g1 << 8) | (b1 << 16) | (0xff000000 & color); - Q0(v, x, (float)x0); - Q0(v, y, (float)y0); + Q0(v, x, x0); + Q0(v, y, y0); Q0(v, color, color0); Q0(v, u, 2.0f); Q0(v, v, 2.0f); - Q1(v, x, (float)x1); - Q1(v, y, (float)y0); + Q1(v, x, x1); + Q1(v, y, y0); Q1(v, color, color0); Q1(v, u, 3.0f); Q1(v, v, 2.0f); - Q2(v, x, (float)x1); - Q2(v, y, (float)y1); + Q2(v, x, x1); + Q2(v, y, y1); Q2(v, color, color1); Q2(v, u, 3.0f); Q2(v, v, 3.0f); - Q3(v, x, (float)x0); - Q3(v, y, (float)y1); + Q3(v, x, x0); + Q3(v, y, y1); Q3(v, color, color1); Q3(v, u, 2.0f); Q3(v, v, 3.0f); @@ -532,8 +533,8 @@ void GLProfilerDisplay::DrawText(int x, int y, uint32_t color, const char* text, } const float fOffsetU = 5.0f / 1024.0f; - float fX = (float)x; - float fY = (float)y; + float fX = static_cast(x); + float fY = static_cast(y); float fY2 = fY + (MICROPROFILE_TEXT_HEIGHT + 1); auto v = BeginVertices(6 * text_length); @@ -542,7 +543,7 @@ void GLProfilerDisplay::DrawText(int x, int y, uint32_t color, const char* text, ((color >> 16) & 0xff); for (size_t j = 0; j < text_length; ++j) { - int16_t char_offset = font_description_.char_offsets[(int)*pStr++]; + int16_t char_offset = font_description_.char_offsets[*pStr++]; float fOffset = char_offset / 1024.0f; Q0(v, x, fX); Q0(v, y, fY); diff --git a/src/xenia/ui/gl/gl_profiler_display.h b/src/xenia/ui/gl/gl_profiler_display.h index 60dd7c10c..0653781fc 100644 --- a/src/xenia/ui/gl/gl_profiler_display.h +++ b/src/xenia/ui/gl/gl_profiler_display.h @@ -20,7 +20,7 @@ namespace gl { class GLProfilerDisplay : public ProfilerDisplay { public: - GLProfilerDisplay(xe::ui::Window* window); + explicit GLProfilerDisplay(xe::ui::Window* window); virtual ~GLProfilerDisplay(); uint32_t width() const override; diff --git a/src/xenia/ui/graphics_context.h b/src/xenia/ui/graphics_context.h index 5f2cfc919..4f1ceef89 100644 --- a/src/xenia/ui/graphics_context.h +++ b/src/xenia/ui/graphics_context.h @@ -43,7 +43,7 @@ class GraphicsContext { }; struct GraphicsContextLock { - GraphicsContextLock(GraphicsContext* context) : context_(context) { + explicit GraphicsContextLock(GraphicsContext* context) : context_(context) { context_->MakeCurrent(); } ~GraphicsContextLock() { context_->ClearCurrent(); } diff --git a/src/xenia/ui/ui_event.h b/src/xenia/ui/ui_event.h index e1a46be6b..3fdce231c 100644 --- a/src/xenia/ui/ui_event.h +++ b/src/xenia/ui/ui_event.h @@ -17,7 +17,7 @@ class Window; class UIEvent { public: - UIEvent(Window* target = nullptr) : target_(target) {} + explicit UIEvent(Window* target = nullptr) : target_(target) {} virtual ~UIEvent() = default; Window* target() const { return target_; } diff --git a/src/xenia/ui/window.cc b/src/xenia/ui/window.cc index 1bffa1a1d..6e99aabdc 100644 --- a/src/xenia/ui/window.cc +++ b/src/xenia/ui/window.cc @@ -40,7 +40,7 @@ constexpr int32_t kMouseWheelDetent = 120; class RootElement : public el::Element { public: - RootElement(Window* owner) : owner_(owner) {} + explicit RootElement(Window* owner) : owner_(owner) {} void OnInvalid() override { owner_->Invalidate(); } private: @@ -199,8 +199,9 @@ void Window::OnPaint(UIEvent& e) { ++fps_frame_count_; uint64_t now_ns = xe::Clock::QueryHostSystemTime(); if (now_ns > fps_update_time_ + 1000 * 10000) { - fps_ = uint32_t(fps_frame_count_ / - (double(now_ns - fps_update_time_) / 10000000.0)); + fps_ = static_cast( + fps_frame_count_ / + (static_cast(now_ns - fps_update_time_) / 10000000.0)); fps_update_time_ = now_ns; fps_frame_count_ = 0; } diff --git a/src/xenia/ui/window_win.cc b/src/xenia/ui/window_win.cc index f44f8ad55..c9ae7be4f 100644 --- a/src/xenia/ui/window_win.cc +++ b/src/xenia/ui/window_win.cc @@ -409,7 +409,7 @@ LRESULT Win32Window::WndProc(HWND hWnd, UINT message, WPARAM wParam, TABLET_ENABLE_MULTITOUCHDATA; case WM_MENUCOMMAND: { - // TODO: Redirect this to MenuItem's on_selected delegate. + // TODO(benvanik): Redirect this to MenuItem's on_selected delegate. MENUINFO menu_info = {0}; menu_info.cbSize = sizeof(menu_info); menu_info.fMask = MIM_MENUDATA; @@ -503,7 +503,7 @@ bool Win32Window::HandleMouse(UINT message, WPARAM wParam, LPARAM lParam) { } bool Win32Window::HandleKeyboard(UINT message, WPARAM wParam, LPARAM lParam) { - auto e = KeyEvent(this, (int)wParam); + auto e = KeyEvent(this, static_cast(wParam)); switch (message) { case WM_KEYDOWN: OnKeyDown(e); diff --git a/src/xenia/vfs/device.h b/src/xenia/vfs/device.h index f96cfb993..36cfd04a6 100644 --- a/src/xenia/vfs/device.h +++ b/src/xenia/vfs/device.h @@ -22,7 +22,7 @@ namespace vfs { class Device { public: - Device(const std::string& path); + explicit Device(const std::string& path); virtual ~Device(); virtual bool Initialize() = 0; diff --git a/src/xenia/vfs/devices/disc_image_device.cc b/src/xenia/vfs/devices/disc_image_device.cc index d07f33394..6e7138292 100644 --- a/src/xenia/vfs/devices/disc_image_device.cc +++ b/src/xenia/vfs/devices/disc_image_device.cc @@ -34,13 +34,13 @@ bool DiscImageDevice::Initialize() { ParseState state = {0}; state.ptr = mmap_->data(); state.size = mmap_->size(); - auto result = Verify(state); + auto result = Verify(&state); if (result != Error::kSuccess) { XELOGE("Failed to verify disc image header: %d", result); return false; } - result = ReadAllEntries(state, state.ptr + state.root_offset); + result = ReadAllEntries(&state, state.ptr + state.root_offset); if (result != Error::kSuccess) { XELOGE("Failed to read all GDFX entries: %d", result); return false; @@ -49,15 +49,15 @@ bool DiscImageDevice::Initialize() { return true; } -DiscImageDevice::Error DiscImageDevice::Verify(ParseState& state) { +DiscImageDevice::Error DiscImageDevice::Verify(ParseState* state) { // Find sector 32 of the game partition - try at a few points. static const size_t likely_offsets[] = { 0x00000000, 0x0000FB20, 0x00020600, 0x0FD90000, }; bool magic_found = false; for (size_t n = 0; n < xe::countof(likely_offsets); n++) { - state.game_offset = likely_offsets[n]; - if (VerifyMagic(state, state.game_offset + (32 * kXESectorSize))) { + state->game_offset = likely_offsets[n]; + if (VerifyMagic(state, state->game_offset + (32 * kXESectorSize))) { magic_found = true; break; } @@ -68,27 +68,28 @@ DiscImageDevice::Error DiscImageDevice::Verify(ParseState& state) { } // Read sector 32 to get FS state. - if (state.size < state.game_offset + (32 * kXESectorSize)) { + if (state->size < state->game_offset + (32 * kXESectorSize)) { return Error::kErrorReadError; } - uint8_t* fs_ptr = state.ptr + state.game_offset + (32 * kXESectorSize); - state.root_sector = xe::load(fs_ptr + 20); - state.root_size = xe::load(fs_ptr + 24); - state.root_offset = state.game_offset + (state.root_sector * kXESectorSize); - if (state.root_size < 13 || state.root_size > 32 * 1024 * 1024) { + uint8_t* fs_ptr = state->ptr + state->game_offset + (32 * kXESectorSize); + state->root_sector = xe::load(fs_ptr + 20); + state->root_size = xe::load(fs_ptr + 24); + state->root_offset = + state->game_offset + (state->root_sector * kXESectorSize); + if (state->root_size < 13 || state->root_size > 32 * 1024 * 1024) { return Error::kErrorDamagedFile; } return Error::kSuccess; } -bool DiscImageDevice::VerifyMagic(ParseState& state, size_t offset) { +bool DiscImageDevice::VerifyMagic(ParseState* state, size_t offset) { // Simple check to see if the given offset contains the magic value. - return std::memcmp(state.ptr + offset, "MICROSOFT*XBOX*MEDIA", 20) == 0; + return std::memcmp(state->ptr + offset, "MICROSOFT*XBOX*MEDIA", 20) == 0; } DiscImageDevice::Error DiscImageDevice::ReadAllEntries( - ParseState& state, const uint8_t* root_buffer) { + ParseState* state, const uint8_t* root_buffer) { auto root_entry = new DiscImageEntry(this, nullptr, "", mmap_.get()); root_entry->attributes_ = kFileAttributeDirectory; root_entry_ = std::unique_ptr(root_entry); @@ -100,7 +101,7 @@ DiscImageDevice::Error DiscImageDevice::ReadAllEntries( return Error::kSuccess; } -bool DiscImageDevice::ReadEntry(ParseState& state, const uint8_t* buffer, +bool DiscImageDevice::ReadEntry(ParseState* state, const uint8_t* buffer, uint16_t entry_ordinal, DiscImageEntry* parent) { const uint8_t* p = buffer + (entry_ordinal * 4); @@ -111,7 +112,7 @@ bool DiscImageDevice::ReadEntry(ParseState& state, const uint8_t* buffer, size_t length = xe::load(p + 8); uint8_t attributes = xe::load(p + 12); uint8_t name_length = xe::load(p + 13); - char* name = (char*)(p + 14); + auto name = reinterpret_cast(p + 14); if (node_l && !ReadEntry(state, buffer, node_l, parent)) { return false; @@ -135,20 +136,20 @@ bool DiscImageDevice::ReadEntry(ParseState& state, const uint8_t* buffer, entry->data_size_ = 0; if (length) { // Not a leaf - read in children. - if (state.size < state.game_offset + (sector * kXESectorSize)) { + if (state->size < state->game_offset + (sector * kXESectorSize)) { // Out of bounds read. return false; } // Read child list. uint8_t* folder_ptr = - state.ptr + state.game_offset + (sector * kXESectorSize); + state->ptr + state->game_offset + (sector * kXESectorSize); if (!ReadEntry(state, folder_ptr, 0, entry)) { return false; } } } else { // File. - entry->data_offset_ = state.game_offset + (sector * kXESectorSize); + entry->data_offset_ = state->game_offset + (sector * kXESectorSize); entry->data_size_ = length; } diff --git a/src/xenia/vfs/devices/disc_image_device.h b/src/xenia/vfs/devices/disc_image_device.h index c0ce2ed38..66b4b1831 100644 --- a/src/xenia/vfs/devices/disc_image_device.h +++ b/src/xenia/vfs/devices/disc_image_device.h @@ -58,10 +58,10 @@ class DiscImageDevice : public Device { size_t root_size; // Size (bytes) of root. } ParseState; - Error Verify(ParseState& state); - bool VerifyMagic(ParseState& state, size_t offset); - Error ReadAllEntries(ParseState& state, const uint8_t* root_buffer); - bool ReadEntry(ParseState& state, const uint8_t* buffer, + Error Verify(ParseState* state); + bool VerifyMagic(ParseState* state, size_t offset); + Error ReadAllEntries(ParseState* state, const uint8_t* root_buffer); + bool ReadEntry(ParseState* state, const uint8_t* buffer, uint16_t entry_ordinal, DiscImageEntry* parent); }; diff --git a/src/xenia/vfs/devices/disc_image_entry.cc b/src/xenia/vfs/devices/disc_image_entry.cc index 903477605..d6748c1c7 100644 --- a/src/xenia/vfs/devices/disc_image_entry.cc +++ b/src/xenia/vfs/devices/disc_image_entry.cc @@ -26,11 +26,11 @@ DiscImageEntry::DiscImageEntry(Device* device, Entry* parent, std::string path, DiscImageEntry::~DiscImageEntry() = default; -X_STATUS DiscImageEntry::Open(KernelState* kernel_state, +X_STATUS DiscImageEntry::Open(kernel::KernelState* kernel_state, uint32_t desired_access, - object_ref* out_file) { - *out_file = - object_ref(new DiscImageFile(kernel_state, desired_access, this)); + kernel::object_ref* out_file) { + *out_file = kernel::object_ref( + new DiscImageFile(kernel_state, desired_access, this)); return X_STATUS_SUCCESS; } diff --git a/src/xenia/vfs/devices/disc_image_entry.h b/src/xenia/vfs/devices/disc_image_entry.h index 34dd515aa..a9bb5f089 100644 --- a/src/xenia/vfs/devices/disc_image_entry.h +++ b/src/xenia/vfs/devices/disc_image_entry.h @@ -10,6 +10,7 @@ #ifndef XENIA_VFS_DEVICES_DISC_IMAGE_ENTRY_H_ #define XENIA_VFS_DEVICES_DISC_IMAGE_ENTRY_H_ +#include #include #include "xenia/base/filesystem.h" @@ -31,8 +32,8 @@ class DiscImageEntry : public Entry { size_t data_offset() const { return data_offset_; } size_t data_size() const { return data_size_; } - X_STATUS Open(KernelState* kernel_state, uint32_t desired_access, - object_ref* out_file) override; + X_STATUS Open(kernel::KernelState* kernel_state, uint32_t desired_access, + kernel::object_ref* out_file) override; bool can_map() const override { return true; } std::unique_ptr OpenMapped(MappedMemory::Mode mode, diff --git a/src/xenia/vfs/devices/disc_image_file.cc b/src/xenia/vfs/devices/disc_image_file.cc index ae9289c28..bcbe56b3b 100644 --- a/src/xenia/vfs/devices/disc_image_file.cc +++ b/src/xenia/vfs/devices/disc_image_file.cc @@ -16,8 +16,8 @@ namespace xe { namespace vfs { -DiscImageFile::DiscImageFile(KernelState* kernel_state, uint32_t file_access, - DiscImageEntry* entry) +DiscImageFile::DiscImageFile(kernel::KernelState* kernel_state, + uint32_t file_access, DiscImageEntry* entry) : XFile(kernel_state, file_access, entry), entry_(entry) {} DiscImageFile::~DiscImageFile() = default; diff --git a/src/xenia/vfs/devices/disc_image_file.h b/src/xenia/vfs/devices/disc_image_file.h index b2757497b..671072b91 100644 --- a/src/xenia/vfs/devices/disc_image_file.h +++ b/src/xenia/vfs/devices/disc_image_file.h @@ -17,9 +17,9 @@ namespace vfs { class DiscImageEntry; -class DiscImageFile : public XFile { +class DiscImageFile : public kernel::XFile { public: - DiscImageFile(KernelState* kernel_state, uint32_t file_access, + DiscImageFile(kernel::KernelState* kernel_state, uint32_t file_access, DiscImageEntry* entry); ~DiscImageFile() override; diff --git a/src/xenia/vfs/devices/host_path_entry.cc b/src/xenia/vfs/devices/host_path_entry.cc index 4e1fcc0c7..ddcfde485 100644 --- a/src/xenia/vfs/devices/host_path_entry.cc +++ b/src/xenia/vfs/devices/host_path_entry.cc @@ -47,8 +47,9 @@ HostPathEntry* HostPathEntry::Create(Device* device, Entry* parent, return entry; } -X_STATUS HostPathEntry::Open(KernelState* kernel_state, uint32_t desired_access, - object_ref* out_file) { +X_STATUS HostPathEntry::Open(kernel::KernelState* kernel_state, + uint32_t desired_access, + kernel::object_ref* out_file) { if (is_read_only() && (desired_access & (FileAccess::kFileWriteData | FileAccess::kFileAppendData))) { XELOGE("Attempting to open file for write access on read-only device"); @@ -60,8 +61,8 @@ X_STATUS HostPathEntry::Open(KernelState* kernel_state, uint32_t desired_access, // TODO(benvanik): pick correct response. return X_STATUS_NO_SUCH_FILE; } - *out_file = object_ref(new HostPathFile(kernel_state, desired_access, - this, std::move(file_handle))); + *out_file = kernel::object_ref(new HostPathFile( + kernel_state, desired_access, this, std::move(file_handle))); return X_STATUS_SUCCESS; } diff --git a/src/xenia/vfs/devices/host_path_entry.h b/src/xenia/vfs/devices/host_path_entry.h index 9078c09c8..ba7970d13 100644 --- a/src/xenia/vfs/devices/host_path_entry.h +++ b/src/xenia/vfs/devices/host_path_entry.h @@ -32,8 +32,8 @@ class HostPathEntry : public Entry { const std::wstring& local_path() { return local_path_; } - X_STATUS Open(KernelState* kernel_state, uint32_t desired_access, - object_ref* out_file) override; + X_STATUS Open(kernel::KernelState* kernel_state, uint32_t desired_access, + kernel::object_ref* out_file) override; bool can_map() const override { return true; } std::unique_ptr OpenMapped(MappedMemory::Mode mode, diff --git a/src/xenia/vfs/devices/host_path_file.cc b/src/xenia/vfs/devices/host_path_file.cc index 9247330bb..851c78d77 100644 --- a/src/xenia/vfs/devices/host_path_file.cc +++ b/src/xenia/vfs/devices/host_path_file.cc @@ -15,7 +15,8 @@ namespace xe { namespace vfs { HostPathFile::HostPathFile( - KernelState* kernel_state, uint32_t file_access, HostPathEntry* entry, + kernel::KernelState* kernel_state, uint32_t file_access, + HostPathEntry* entry, std::unique_ptr file_handle) : XFile(kernel_state, file_access, entry), file_handle_(std::move(file_handle)) {} diff --git a/src/xenia/vfs/devices/host_path_file.h b/src/xenia/vfs/devices/host_path_file.h index e5087c977..5b5267c79 100644 --- a/src/xenia/vfs/devices/host_path_file.h +++ b/src/xenia/vfs/devices/host_path_file.h @@ -20,9 +20,9 @@ namespace vfs { class HostPathEntry; -class HostPathFile : public XFile { +class HostPathFile : public kernel::XFile { public: - HostPathFile(KernelState* kernel_state, uint32_t file_access, + HostPathFile(kernel::KernelState* kernel_state, uint32_t file_access, HostPathEntry* entry, std::unique_ptr file_handle); ~HostPathFile() override; diff --git a/src/xenia/vfs/devices/stfs_container_device.cc b/src/xenia/vfs/devices/stfs_container_device.cc index 9b9fbf049..6242264e0 100644 --- a/src/xenia/vfs/devices/stfs_container_device.cc +++ b/src/xenia/vfs/devices/stfs_container_device.cc @@ -9,6 +9,9 @@ #include "xenia/vfs/devices/stfs_container_device.h" +#include +#include + #include "xenia/base/logging.h" #include "xenia/base/math.h" #include "xenia/vfs/devices/stfs_container_entry.h" @@ -16,14 +19,14 @@ namespace xe { namespace vfs { -#define XEGETUINT24BE(p) \ - (((uint32_t)xe::load_and_swap((p) + 0) << 16) | \ - ((uint32_t)xe::load_and_swap((p) + 1) << 8) | \ - (uint32_t)xe::load_and_swap((p) + 2)) -#define XEGETUINT24LE(p) \ - (((uint32_t)xe::load((p) + 2) << 16) | \ - ((uint32_t)xe::load((p) + 1) << 8) | \ - (uint32_t)xe::load((p) + 0)) +uint32_t load_uint24_be(const uint8_t* p) { + return (static_cast(p[0]) << 16) | + (static_cast(p[1]) << 8) | static_cast(p[2]); +} +uint32_t load_uint24_le(const uint8_t* p) { + return (static_cast(p[2]) << 16) | + (static_cast(p[1]) << 8) | static_cast(p[0]); +} StfsContainerDevice::StfsContainerDevice(const std::string& mount_path, const std::wstring& local_path) @@ -150,8 +153,8 @@ StfsContainerDevice::Error StfsContainerDevice::ReadAllEntries( } uint8_t filename_length_flags = xe::load_and_swap(p + 0x28); // TODO(benvanik): use for allocation_size_? - // uint32_t allocated_block_count = XEGETUINT24LE(p + 0x29); - uint32_t start_block_index = XEGETUINT24LE(p + 0x2F); + // uint32_t allocated_block_count = load_uint24_le(p + 0x29); + uint32_t start_block_index = load_uint24_le(p + 0x2F); uint16_t path_indicator = xe::load_and_swap(p + 0x32); uint32_t file_size = xe::load_and_swap(p + 0x34); uint32_t update_timestamp = xe::load_and_swap(p + 0x38); @@ -167,7 +170,8 @@ StfsContainerDevice::Error StfsContainerDevice::ReadAllEntries( auto entry = new StfsContainerEntry( this, parent_entry, - std::string((char*)filename, filename_length_flags & 0x3F), + std::string(reinterpret_cast(filename), + filename_length_flags & 0x3F), mmap_.get()); // bit 0x40 = consecutive blocks (not fragmented?) if (filename_length_flags & 0x80) { @@ -286,7 +290,7 @@ StfsContainerDevice::BlockHash StfsContainerDevice::GetBlockHash( const uint8_t* hash_data = map_ptr + BlockToOffset(table_index); const uint8_t* record_data = hash_data + record * 0x18; uint32_t info = xe::load_and_swap(record_data + 0x14); - uint32_t next_block_index = XEGETUINT24BE(record_data + 0x15); + uint32_t next_block_index = load_uint24_be(record_data + 0x15); return {next_block_index, info}; } @@ -300,12 +304,12 @@ bool StfsVolumeDescriptor::Read(const uint8_t* p) { reserved = xe::load_and_swap(p + 0x01); block_separation = xe::load_and_swap(p + 0x02); file_table_block_count = xe::load_and_swap(p + 0x03); - file_table_block_number = XEGETUINT24BE(p + 0x05); + file_table_block_number = load_uint24_be(p + 0x05); std::memcpy(top_hash_table_hash, p + 0x08, 0x14); total_allocated_block_count = xe::load_and_swap(p + 0x1C); total_unallocated_block_count = xe::load_and_swap(p + 0x20); return true; -}; +} bool StfsHeader::Read(const uint8_t* p) { std::memcpy(license_entries, p + 0x22C, 0x100); diff --git a/src/xenia/vfs/devices/stfs_container_entry.cc b/src/xenia/vfs/devices/stfs_container_entry.cc index 23da60f1d..3df1f8d5f 100644 --- a/src/xenia/vfs/devices/stfs_container_entry.cc +++ b/src/xenia/vfs/devices/stfs_container_entry.cc @@ -24,10 +24,10 @@ StfsContainerEntry::StfsContainerEntry(Device* device, Entry* parent, StfsContainerEntry::~StfsContainerEntry() = default; -X_STATUS StfsContainerEntry::Open(KernelState* kernel_state, +X_STATUS StfsContainerEntry::Open(kernel::KernelState* kernel_state, uint32_t desired_access, - object_ref* out_file) { - *out_file = object_ref( + kernel::object_ref* out_file) { + *out_file = kernel::object_ref( new StfsContainerFile(kernel_state, desired_access, this)); return X_STATUS_SUCCESS; } diff --git a/src/xenia/vfs/devices/stfs_container_entry.h b/src/xenia/vfs/devices/stfs_container_entry.h index 3cd8e8c99..11a7138dc 100644 --- a/src/xenia/vfs/devices/stfs_container_entry.h +++ b/src/xenia/vfs/devices/stfs_container_entry.h @@ -10,6 +10,7 @@ #ifndef XENIA_VFS_DEVICES_STFS_CONTAINER_ENTRY_H_ #define XENIA_VFS_DEVICES_STFS_CONTAINER_ENTRY_H_ +#include #include #include "xenia/base/filesystem.h" @@ -31,8 +32,8 @@ class StfsContainerEntry : public Entry { size_t data_offset() const { return data_offset_; } size_t data_size() const { return data_size_; } - X_STATUS Open(KernelState* kernel_state, uint32_t desired_access, - object_ref* out_file) override; + X_STATUS Open(kernel::KernelState* kernel_state, uint32_t desired_access, + kernel::object_ref* out_file) override; struct BlockRecord { size_t offset; diff --git a/src/xenia/vfs/devices/stfs_container_file.cc b/src/xenia/vfs/devices/stfs_container_file.cc index 02c97c88b..0de27b61d 100644 --- a/src/xenia/vfs/devices/stfs_container_file.cc +++ b/src/xenia/vfs/devices/stfs_container_file.cc @@ -16,7 +16,7 @@ namespace xe { namespace vfs { -StfsContainerFile::StfsContainerFile(KernelState* kernel_state, +StfsContainerFile::StfsContainerFile(kernel::KernelState* kernel_state, uint32_t file_access, StfsContainerEntry* entry) : XFile(kernel_state, file_access, entry), entry_(entry) {} @@ -38,7 +38,7 @@ X_STATUS StfsContainerFile::ReadSync(void* buffer, size_t buffer_length, size_t end_block = std::min(entry_->block_list().size(), (size_t)ceil((byte_offset + real_length) / 4096.0)); - uint8_t* dest_ptr = (uint8_t*)buffer; + uint8_t* dest_ptr = reinterpret_cast(buffer); size_t remaining_length = real_length; for (size_t n = start_block; n < end_block; n++) { auto& record = entry_->block_list()[n]; diff --git a/src/xenia/vfs/devices/stfs_container_file.h b/src/xenia/vfs/devices/stfs_container_file.h index faaa8f58b..288d0a799 100644 --- a/src/xenia/vfs/devices/stfs_container_file.h +++ b/src/xenia/vfs/devices/stfs_container_file.h @@ -17,9 +17,9 @@ namespace vfs { class StfsContainerEntry; -class StfsContainerFile : public XFile { +class StfsContainerFile : public kernel::XFile { public: - StfsContainerFile(KernelState* kernel_state, uint32_t file_access, + StfsContainerFile(kernel::KernelState* kernel_state, uint32_t file_access, StfsContainerEntry* entry); ~StfsContainerFile() override; diff --git a/src/xenia/vfs/entry.h b/src/xenia/vfs/entry.h index e88b07286..55fcfd194 100644 --- a/src/xenia/vfs/entry.h +++ b/src/xenia/vfs/entry.h @@ -21,9 +21,6 @@ #include "xenia/xbox.h" namespace xe { -namespace filesystem { -class WildcardEngine; -} // namespace filesystem namespace kernel { class KernelState; class XFile; @@ -33,8 +30,6 @@ class XFile; namespace xe { namespace vfs { -using namespace xe::kernel; - class Device; // Matches http://source.winehq.org/source/include/winternl.h#1591. @@ -110,8 +105,9 @@ class Entry { bool Delete(); void Touch(); - virtual X_STATUS Open(KernelState* kernel_state, uint32_t desired_access, - object_ref* out_file) = 0; + virtual X_STATUS Open(kernel::KernelState* kernel_state, + uint32_t desired_access, + kernel::object_ref* out_file) = 0; virtual bool can_map() const { return false; } virtual std::unique_ptr OpenMapped(MappedMemory::Mode mode, diff --git a/src/xenia/vfs/virtual_file_system.cc b/src/xenia/vfs/virtual_file_system.cc index cfd3b1646..4aeb126a1 100644 --- a/src/xenia/vfs/virtual_file_system.cc +++ b/src/xenia/vfs/virtual_file_system.cc @@ -140,12 +140,10 @@ bool VirtualFileSystem::DeletePath(std::string path) { return parent->Delete(entry); } -X_STATUS VirtualFileSystem::OpenFile(KernelState* kernel_state, - std::string path, - FileDisposition creation_disposition, - uint32_t desired_access, - object_ref* out_file, - FileAction* out_action) { +X_STATUS VirtualFileSystem::OpenFile( + kernel::KernelState* kernel_state, std::string path, + FileDisposition creation_disposition, uint32_t desired_access, + kernel::object_ref* out_file, FileAction* out_action) { // Cleanup access. if (desired_access & FileAccess::kGenericRead) { desired_access |= FileAccess::kFileReadData; diff --git a/src/xenia/vfs/virtual_file_system.h b/src/xenia/vfs/virtual_file_system.h index f5f35e41e..68b54d1eb 100644 --- a/src/xenia/vfs/virtual_file_system.h +++ b/src/xenia/vfs/virtual_file_system.h @@ -39,9 +39,10 @@ class VirtualFileSystem { Entry* CreatePath(std::string path, uint32_t attributes); bool DeletePath(std::string path); - X_STATUS OpenFile(KernelState* kernel_state, std::string path, + X_STATUS OpenFile(kernel::KernelState* kernel_state, std::string path, FileDisposition creation_disposition, - uint32_t desired_access, object_ref* out_file, + uint32_t desired_access, + kernel::object_ref* out_file, FileAction* out_action); private: