From a332faf41909c0d06bc41a00347b7e0d3afb0d1b Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sun, 26 May 2013 19:28:46 -0700 Subject: [PATCH] Adding ordinal enums to kernel modules. Access via xe::kernel::modules::xboxkrnl::ordinals::MyFunction (or just ordinals::MyFunction when in the namespace). Some collisions occurred - just added random suffixes for now. --- src/xenia/kernel/modules/xam/sources.gypi | 1 + src/xenia/kernel/modules/xam/xam_module.h | 1 + src/xenia/kernel/modules/xam/xam_ordinals.h | 29 +++++++++++++++++++ src/xenia/kernel/modules/xam/xam_table.inc | 18 ++++++------ src/xenia/kernel/modules/xboxkrnl/module.h | 1 + .../kernel/modules/xboxkrnl/sources.gypi | 1 + .../modules/xboxkrnl/xboxkrnl_ordinals.h | 29 +++++++++++++++++++ .../modules/xboxkrnl/xboxkrnl_table.inc | 2 +- src/xenia/kernel/util/ordinal_table_post.inc | 13 +++++++++ src/xenia/kernel/util/ordinal_table_pre.inc | 27 +++++++++++++++++ src/xenia/kernel/util/sources.gypi | 2 ++ 11 files changed, 114 insertions(+), 10 deletions(-) create mode 100644 src/xenia/kernel/modules/xam/xam_ordinals.h create mode 100644 src/xenia/kernel/modules/xboxkrnl/xboxkrnl_ordinals.h create mode 100644 src/xenia/kernel/util/ordinal_table_post.inc create mode 100644 src/xenia/kernel/util/ordinal_table_pre.inc diff --git a/src/xenia/kernel/modules/xam/sources.gypi b/src/xenia/kernel/modules/xam/sources.gypi index 1aa5bfa76..7c4445d55 100644 --- a/src/xenia/kernel/modules/xam/sources.gypi +++ b/src/xenia/kernel/modules/xam/sources.gypi @@ -5,6 +5,7 @@ 'xam_info.h', 'xam_module.cc', 'xam_module.h', + 'xam_ordinals.h', 'xam_state.cc', 'xam_state.h', 'xam_table.inc', diff --git a/src/xenia/kernel/modules/xam/xam_module.h b/src/xenia/kernel/modules/xam/xam_module.h index 5880665f7..6f42aa6ac 100644 --- a/src/xenia/kernel/modules/xam/xam_module.h +++ b/src/xenia/kernel/modules/xam/xam_module.h @@ -15,6 +15,7 @@ #include #include +#include namespace xe { diff --git a/src/xenia/kernel/modules/xam/xam_ordinals.h b/src/xenia/kernel/modules/xam/xam_ordinals.h new file mode 100644 index 000000000..d32102581 --- /dev/null +++ b/src/xenia/kernel/modules/xam/xam_ordinals.h @@ -0,0 +1,29 @@ +/** + ****************************************************************************** + * 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_XAM_ORDINALS_H_ +#define XENIA_KERNEL_MODULES_XAM_ORDINALS_H_ + +#include +#include + +#include + + +// Build an ordinal enum to make it easy to lookup ordinals. +#include +namespace ordinals { +enum { + #include +}; +} // namespace ordinals +#include + + +#endif // XENIA_KERNEL_MODULES_XAM_ORDINALS_H_ diff --git a/src/xenia/kernel/modules/xam/xam_table.inc b/src/xenia/kernel/modules/xam/xam_table.inc index 95b806d70..0fb246291 100644 --- a/src/xenia/kernel/modules/xam/xam_table.inc +++ b/src/xenia/kernel/modules/xam/xam_table.inc @@ -568,8 +568,8 @@ XE_EXPORT(xam, 0x0000030D, XamVoiceHeadsetPresent, XE_EXPORT(xam, 0x0000030E, XamVoiceSubmitPacket, ? , Function, 0), XE_EXPORT(xam, 0x0000030F, XamVoiceClose, ? , Function, 0), XE_EXPORT(xam, 0x00000310, XamVoiceGetBatteryStatus, ? , Function, 0), -XE_EXPORT(xam, 0x00000311, Refresh, ? , Function, 0), -XE_EXPORT(xam, 0x00000312, Refresh, ? , Function, 0), +XE_EXPORT(xam, 0x00000311, Refresh_, ? , Function, 0), +XE_EXPORT(xam, 0x00000312, Refresh_0, ? , Function, 0), XE_EXPORT(xam, 0x00000313, XamShowJoinSessionByIdInProgressUI, ? , Function, 0), XE_EXPORT(xam, 0x00000314, XamShowPartyJoinInProgressUI, ? , Function, 0), XE_EXPORT(xam, 0x00000315, XamBuildSharedSystemResourceLocator, ? , Function, 0), @@ -579,7 +579,7 @@ XE_EXPORT(xam, 0x00000318, XamVoiceGetMicArrayStatus, XE_EXPORT(xam, 0x00000319, XamVoiceSetAudioCaptureRoutine, ? , Function, 0), XE_EXPORT(xam, 0x0000031A, XamVoiceGetDirectionalData, ? , Function, 0), XE_EXPORT(xam, 0x0000031B, XamBuildResourceLocator, ? , Function, 0), -XE_EXPORT(xam, 0x0000031C, XamBuildSharedSystemResourceLocator, ? , Function, 0), +XE_EXPORT(xam, 0x0000031C, XamBuildSharedSystemResourceLocator_, ? , Function, 0), XE_EXPORT(xam, 0x0000031D, XamBuildGamercardResourceLocator, ? , Function, 0), XE_EXPORT(xam, 0x0000031E, XamBuildDynamicResourceLocator, ? , Function, 0), XE_EXPORT(xam, 0x0000031F, XamBuildXamResourceLocator, ? , Function, 0), @@ -825,7 +825,7 @@ XE_EXPORT(xam, 0x0000040E, OutputDebugStringA, XE_EXPORT(xam, 0x0000040F, DebugBreak, ? , Function, 0), XE_EXPORT(xam, 0x00000410, GetCurrentThreadId, ? , Function, 0), XE_EXPORT(xam, 0x00000411, XDebugError, ? , Function, 0), -XE_EXPORT(xam, 0x00000412, XDebugWarning, ? , Function, 0), +XE_EXPORT(xam, 0x00000412, XDebugWarning_, ? , Function, 0), XE_EXPORT(xam, 0x00000413, RtlDebugSetLevel, ? , Function, 0), XE_EXPORT(xam, 0x00000414, CloseHandle, ? , Function, 0), XE_EXPORT(xam, 0x00000415, GetTickCount, ? , Function, 0), @@ -980,17 +980,17 @@ XE_EXPORT(xam, 0x000005E2, XamAvatarGenerateMipMaps, XE_EXPORT(xam, 0x000005E3, XamAvatarSetCustomAsset, ? , Function, 0), XE_EXPORT(xam, 0x000005E4, XamAvatarSetManifest, ? , Function, 0), XE_EXPORT(xam, 0x000005E5, EnumerateMediaObjects, ? , Function, 0), -XE_EXPORT(xam, 0x000005E6, EnumerateMediaObjects, ? , Function, 0), +XE_EXPORT(xam, 0x000005E6, EnumerateMediaObjects_, ? , Function, 0), XE_EXPORT(xam, 0x000005E7, XamAvatarLoadAnimation, ? , Function, 0), XE_EXPORT(xam, 0x000005E8, XamAvatarBeginEnumAssets, ? , Function, 0), XE_EXPORT(xam, 0x000005E9, XamAvatarEndEnumAssets, ? , Function, 0), XE_EXPORT(xam, 0x000005EA, XamAvatarEnumAssets, ? , Function, 0), XE_EXPORT(xam, 0x000005EB, XamAvatarGetMetadataRandom, ? , Function, 0), -XE_EXPORT(xam, 0x000005EC, EnumerateMediaObjects, ? , Function, 0), -XE_EXPORT(xam, 0x000005ED, EnumerateMediaObjects, ? , Function, 0), +XE_EXPORT(xam, 0x000005EC, EnumerateMediaObjects_0, ? , Function, 0), +XE_EXPORT(xam, 0x000005ED, EnumerateMediaObjects_1, ? , Function, 0), XE_EXPORT(xam, 0x000005EE, XamAvatarGetMetadataSignedOutProfileCount, ? , Function, 0), XE_EXPORT(xam, 0x000005EF, XamAvatarGetMetadataSignedOutProfile, ? , Function, 0), -XE_EXPORT(xam, 0x000005F0, EnumerateMediaObjects, ? , Function, 0), +XE_EXPORT(xam, 0x000005F0, EnumerateMediaObjects_2, ? , Function, 0), XE_EXPORT(xam, 0x000005F1, XamAvatarManifestGetBodyType, ? , Function, 0), XE_EXPORT(xam, 0x000005F2, XamAvatarGetInstrumentation, ? , Function, 0), XE_EXPORT(xam, 0x000005F3, XamAvatarGetAssetIcon, ? , Function, 0), @@ -1102,7 +1102,7 @@ XE_EXPORT(xam, 0x00000822, XamCodeCoverageFileClose, XE_EXPORT(xam, 0x00000823, XamCodeCoverageFileLseek, ? , Function, 0), XE_EXPORT(xam, 0x00000824, XamCodeCoverageFileRead, ? , Function, 0), XE_EXPORT(xam, 0x00000825, XamCodeCoverageFileWrite, ? , Function, 0), -XE_EXPORT(xam, 0x00000826, Refresh, ? , Function, 0), +XE_EXPORT(xam, 0x00000826, Refresh_1, ? , Function, 0), XE_EXPORT(xam, 0x00000827, XampHeapGetInfo, ? , Function, 0), XE_EXPORT(xam, 0x00000828, XampHeapGetCount, ? , Function, 0), XE_EXPORT(xam, 0x00000829, XamShowPamUI, ? , Function, 0), diff --git a/src/xenia/kernel/modules/xboxkrnl/module.h b/src/xenia/kernel/modules/xboxkrnl/module.h index 627d30fcc..f3732b421 100644 --- a/src/xenia/kernel/modules/xboxkrnl/module.h +++ b/src/xenia/kernel/modules/xboxkrnl/module.h @@ -15,6 +15,7 @@ #include #include +#include namespace xe { diff --git a/src/xenia/kernel/modules/xboxkrnl/sources.gypi b/src/xenia/kernel/modules/xboxkrnl/sources.gypi index bae720a60..d9df59293 100644 --- a/src/xenia/kernel/modules/xboxkrnl/sources.gypi +++ b/src/xenia/kernel/modules/xboxkrnl/sources.gypi @@ -11,6 +11,7 @@ 'xboxkrnl_memory.h', 'xboxkrnl_module.cc', 'xboxkrnl_module.h', + 'xboxkrnl_ordinals.h', 'xboxkrnl_rtl.cc', 'xboxkrnl_rtl.h', 'xboxkrnl_table.inc', diff --git a/src/xenia/kernel/modules/xboxkrnl/xboxkrnl_ordinals.h b/src/xenia/kernel/modules/xboxkrnl/xboxkrnl_ordinals.h new file mode 100644 index 000000000..def54bcff --- /dev/null +++ b/src/xenia/kernel/modules/xboxkrnl/xboxkrnl_ordinals.h @@ -0,0 +1,29 @@ +/** + ****************************************************************************** + * 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_XBOXKRNL_ORDINALS_H_ +#define XENIA_KERNEL_MODULES_XBOXKRNL_ORDINALS_H_ + +#include +#include + +#include + + +// Build an ordinal enum to make it easy to lookup ordinals. +#include +namespace ordinals { +enum { + #include +}; +} // namespace ordinals +#include + + +#endif // XENIA_KERNEL_MODULES_XBOXKRNL_ORDINALS_H_ diff --git a/src/xenia/kernel/modules/xboxkrnl/xboxkrnl_table.inc b/src/xenia/kernel/modules/xboxkrnl/xboxkrnl_table.inc index 26dc2bdb0..22461ebf0 100644 --- a/src/xenia/kernel/modules/xboxkrnl/xboxkrnl_table.inc +++ b/src/xenia/kernel/modules/xboxkrnl/xboxkrnl_table.inc @@ -423,7 +423,7 @@ XE_EXPORT(xboxkrnl, 0x00000199, XexLoadImage, XE_EXPORT(xboxkrnl, 0x0000019A, XexLoadImageFromMemory, ? , Function, 0), XE_EXPORT(xboxkrnl, 0x0000019B, XexLoadImageHeaders, ? , Function, 0), XE_EXPORT(xboxkrnl, 0x0000019C, XexPcToFileHeader, ? , Function, 0), -XE_EXPORT(xboxkrnl, 0x0000019D, KiApcNormalRoutineNop, ? , Function, 0), +XE_EXPORT(xboxkrnl, 0x0000019D, KiApcNormalRoutineNop_, ? , Function, 0), XE_EXPORT(xboxkrnl, 0x0000019E, XexRegisterPatchDescriptor, ? , Function, 0), XE_EXPORT(xboxkrnl, 0x0000019F, XexSendDeferredNotifications, ? , Function, 0), XE_EXPORT(xboxkrnl, 0x000001A0, XexStartExecutable, ? , Function, 0), diff --git a/src/xenia/kernel/util/ordinal_table_post.inc b/src/xenia/kernel/util/ordinal_table_post.inc new file mode 100644 index 000000000..3b22690ff --- /dev/null +++ b/src/xenia/kernel/util/ordinal_table_post.inc @@ -0,0 +1,13 @@ +/** + ****************************************************************************** + * 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. * + ****************************************************************************** + */ + +// Post-include file for an ordinal table. + + +#undef XE_EXPORT diff --git a/src/xenia/kernel/util/ordinal_table_pre.inc b/src/xenia/kernel/util/ordinal_table_pre.inc new file mode 100644 index 000000000..a5f93aaaf --- /dev/null +++ b/src/xenia/kernel/util/ordinal_table_pre.inc @@ -0,0 +1,27 @@ +/** + ****************************************************************************** + * 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. * + ****************************************************************************** + */ + +/** + * Pre-include file for an ordinal table. + * Use this to build tables of constants describing the ordinals: + * + * // Build an ordinal enum to make it easy to lookup ordinals. + * #include + * namespace ordinals { + * enum { + * #include + * }; + * } // namespace ordinals + * #include + */ + + +#define XE_EXPORT(module, ordinal, name, signature, type, flags) \ + name = ordinal + diff --git a/src/xenia/kernel/util/sources.gypi b/src/xenia/kernel/util/sources.gypi index db0d3f5b8..88a3cb0bb 100644 --- a/src/xenia/kernel/util/sources.gypi +++ b/src/xenia/kernel/util/sources.gypi @@ -3,5 +3,7 @@ 'sources': [ 'export_table_post.inc', 'export_table_pre.inc', + 'ordinal_table_post.inc', + 'ordinal_table_pre.inc', ], }