Skip to content

NeKzor/xdead

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

build

XDead

Minimal replacement layer for Games for Windows Live (GFWL) aka XLive.

Overview

Tested Games

Game Implementation
Tron: Evolution Used in TEM for offline usage and support on Linux w/Wine.

API (WIP)

Listeners are user-defined callbacks which are used to hook into functions. They allow to read and modify existing parameters but also overwrite the default return value.

TODO: Expose function signatures as types/macros? Or allow exports like XDead_XFriendsCreateEnumerator?

Include

Overview of the header file:

namespace xdead {

#define XDEAD_CALLBACK(type, name, ...) type __stdcall name##_callback(##__VA_ARGS__)
#define XDEAD_FUNCTION_NAME(name, ordinal) static constexpr auto name = ordinal

enum class ListenerStatus {
    Ok               = 0,
    OrdinalNotFound  = 1,
    InvalidCallback  = 2,
    CallbackNotFound = 3,
};

// ...
XDEAD_FUNCTION_NAME(XFriendsCreateEnumerator, 5312);
// ...

auto __stdcall add_listener(uint32_t ordinal, void* callback, uint32_t index) -> ListenerStatus;
auto __stdcall remove_listener(uint32_t ordinal, void* callback) -> ListenerStatus;
auto __stdcall remove_all_listeners() -> ListenerStatus;

using add_listener_t = decltype(&add_listener);
using remove_listener_t = decltype(&remove_listener);
using remove_all_listeners_t = decltype(&remove_all_listeners);
}

Example Usage

The basic philosophy is to reimplement a small surface of the API, only to get the game working. After this step the user has the freedom for creativity to rewrite any features of XLive like account management, save files and UI etc.

TODO: could we use "context" for controlling the return-value?

// Define a callback
XDEAD_CALLBACK(signed int, XFriendsCreateEnumerator, int a1, int a2, int a3, int a4, int a5)
{
    // By default XDead always returns 0 which in most functions means "success".
    // If a callback returns anything else, all other callbacks of this
    // functions will not run.
    return 1;
}

// Get exported functions

auto xdead = GetModuleHandleA("xlive.dll");

auto xdead_add_listener = xdead::add_listener_t(
    GetProcAddress(xdead, "xdead_add_listener")
);

auto xdead_remove_listener = xdead::remove_listener_t(
    GetProcAddress(xdead, "xdead_remove_listener")
);

auto xdead_remove_all_listeners = xdead::remove_all_listeners_t(
    GetProcAddress(xdead, "xdead_remove_all_listeners")
);

// Add callback as listener

auto status = xdead_add_listener(
    xdead::XFriendsCreateEnumerator,   // Provide ordinal by function name
    XFriendsCreateEnumerator_callback, // Function from above
    0                                  // Sort index
);

if (status == xdead::ListenerStatus::Ok) {
    println("Added listener for XFriendsCreateEnumerator");
}

// Remove listener

xdead_remove_listener(XFriendsCreateEnumerator_callback);

// Or automatically remove all previously added listeners

// NOTE: This also remove listeners which have been added by other modules.
xdead_remove_all_listeners();

Automatic Module Loader (TODO)

XDead can also be used to load additional modules automatically. When the main process calls into XLiveInitialize/XLiveInitializeEx, it will check for an existing xdead.json definition file and then load each module sequentially.

TODO: Use YAML instead of JSON?

{
    "version": "0.1.0",
    "mods": [
        {
            "name": "tem",
            "version": "0.1.0",
            "author": "NeKz",
            "path": "tem.dll",
        }
    ]
}

Supported Functions

View table
Function Ordinal
XWSAStartup 1
XWSACleanup 2
โœ” XSocketCreate 3
โœ” XSocketClose 4
XSocketShutdown 5
โœ” XSocketIOCTLSocket 6
โœ” XSocketSetSockOpt 7
โœ” XSocketGetSockOpt 8
โœ” XSocketGetSockName 9
XSocketGetPeerName 10
โœ” XSocketBind 11
โœ” XSocketConnect 12
โœ” XSocketListen 13
โœ” XSocketAccept 14
โœ” XSocketSelect 15
XWSAGetOverlappedResult 16
XWSACancelOverlappedIO 17
โœ” XSocketRecv 18
WSARecv 19
XSocketRecvFrom 20
XWSARecvFrom 21
โœ” XSocketSend 22
XWSASend 23
โœ” XSocketSendTo 24
XWSASendTo 25
XSocketInet_Addr 26
XSocketWSAGetLastError 27
XWSASetLastError 28
XWSACreateEvent 29
XWSACloseEvent 30
XWSASetEvent 31
XWSAResetEvent 32
XWSAWaitForMultipleEvents 33
XWSAFDIsSet 34
XWSAEventSelect 35
XSocketHTONL 37
โœ” XSocketNTOHS 38
XSocketNTOHL 39
XSocketHTONS 40
โœ” XNetStartup 51
โœ” XNetCleanup 52
โœ” XNetRandom 53
XNetCreateKey 54
โœ” XNetRegisterKey 55
โœ” XNetUnregisterKey 56
โœ” XNetXnAddrToInAddr 57
โœ” XNetServerToInAddr 58
XNetTsAddrToInAddr 59
XNetInAddrToXnAddr 60
XNetInAddrToServer 61
XNetInAddrToString 62
โœ” XNetUnregisterInAddr 63
XNetXnAddrToMachineId 64
XNetConnect 65
XNetGetConnectStatus 66
โœ” XNetDnsLookup 67
โœ” XNetDnsRelease 68
โœ” XNetQosListen 69
โœ” XNetQosLookup 70
โœ” XNetQosServiceLookup 71
โœ” XNetQosRelease 72
โœ” XNetGetTitleXnAddr 73
XNetGetDebugXnAddr 74
โœ” XNetGetEthernetLinkStatus 75
XNetGetBroadcastVersionStatus 76
โœ” XNetQosGetListenStats 77
XNetGetOpt 78
XNetSetOpt 79
XNetStartupEx 80
XNetReplaceKey 81
XNetGetXnAddrPlatform 82
XNetGetSystemLinkPort 83
โœ” XNetSetSystemLinkPort 84
XNetSetSystemLinkPort 84
XCustomSetAction 472
XCustomGetLastActionPress 473
XCustomSetDynamicActions 474
XCustomGetLastActionPressEx 476
XCustomRegisterDynamicActions 477
XCustomUnregisterDynamicActions 478
XCustomGetCurrentGamercard 479
XNotifyGetNext 651
โœ” XNotifyPositionUI 652
XNotifyDelayUI 653
โœ” XGetOverlappedExtendedError 1082
XGetOverlappedResult 1083
XLiveInitialize 5000
XLiveInput 5001
XLiveRender 5002
โœ” XLiveUninitialize 5003
XLiveOnCreateDevice 5005
โœ” XLiveOnDestroyDevice 5006
โœ” XLiveOnResetDevice 5007
โœ” XHVCreateEngine 5008
XLiveRegisterDataSection 5010
XLiveUnregisterDataSection 5011
XLiveUpdateHashes 5012
โœ” XLivePBufferAllocate 5016
โœ” XLivePBufferFree 5017
XLivePBufferGetByte 5018
XLivePBufferSetByte 5019
XLivePBufferGetDWORD 5020
XLivePBufferSetDWORD 5021
XLiveGetUpdateInformation 5022
XNetGetCurrentAdapter 5023
XLiveUpdateSystem 5024
XLiveGetLiveIdError 5025
โœ” XLiveSetSponsorToken 5026
XLiveUninstallTitle 5027
XLiveLoadLibraryEx 5028
XLiveFreeLibrary 5029
XLivePreTranslateMessage 5030
โœ” XLiveSetDebugLevel 5031
XLiveVerifyArcadeLicense 5032
โœ” XLiveProtectData 5034
โœ” XLiveUnprotectData 5035
โœ” XLiveCreateProtectedDataContext 5036
XLiveQueryProtectedDataInformation 5037
โœ” XLiveCloseProtectedDataContext 5038
XLiveVerifyDataFile 5039
โœ” XShowMessagesUI 5206
โœ” XShowGameInviteUI 5208
โœ” XShowMessageComposeUI 5209
โœ” XShowFriendRequestUI 5210
โœ” XShowCustomPlayerListUI 5212
โœ” XShowPlayerReviewUI 5214
โœ” XShowGuideUI 5215
โœ” XShowKeyboardUI 5216
XShowArcadeUI 5218
XLocatorServerAdvertise 5230
XLocatorServerUnAdvertise 5231
XLocatorGetServiceProperty 5233
XLocatorCreateServerEnumerator 5234
XLocatorCreateServerEnumeratorByIDs 5235
XLocatorServiceInitialize 5236
XLocatorServiceUnInitialize 5237
XLocatorCreateKey 5238
โœ” XShowAchievementsUI 5250
โœ” XCloseHandle 5251
โœ” XShowGamerCardUI 5252
XCancelOverlapped 5254
XEnumerateBack 5255
โœ” XEnumerate 5256
XLiveManageCredentials 5257
โœ” XLiveSignout 5258
โœ” XLiveSignin 5259
โœ” XShowSigninUI 5260
XUserGetXUID 5261
โœ” XUserGetSigninState 5262
โœ” XUserGetName 5263
โœ” XUserAreUsersFriends 5264
โœ” XUserCheckPrivilege 5265
XShowMessageBoxUI 5266
โœ” XUserGetSigninInfo 5267
โœ” XNotifyCreateListener 5270
โœ” XShowPlayersUI 5271
XUserReadGamerPictureByKey 5273
โœ” XUserAwardGamerPicture 5274
โœ” XShowFriendsUI 5275
XUserSetProperty 5276
โœ” XUserSetContext 5277
โœ” XUserWriteAchievements 5278
โœ” XUserReadAchievementPicture 5279
โœ” XUserCreateAchievementEnumerator 5280
โœ” XUserReadStats 5281
XUserReadGamerPicture 5282
โœ” XUserCreateStatsEnumeratorByRank 5284
XUserCreateStatsEnumeratorByRating 5285
โœ” XUserCreateStatsEnumeratorByXuid 5286
XUserResetStatsView 5287
XUserGetProperty 5288
XUserGetContext 5289
XUserGetReputationStars 5290
XUserResetStatsViewAllUsers 5291
โœ” XUserSetContextEx 5292
โœ” XUserSetPropertyEx 5293
โœ” XLivePBufferGetByteArray 5294
XLivePBufferSetByteArray 5295
XLiveGetLocalOnlinePort 5296
โœ” XLiveInitializeEx 5297
XLiveGetGuideKey 5298
XShowGuideKeyRemapUI 5299
โœ” XSessionCreate 5300
โœ” XStringVerify 5303
XStorageUploadFromMemoryGetProgress 5304
โœ” XStorageUploadFromMemory 5305
โœ” XStorageEnumerate 5306
XStorageDownloadToMemoryGetProgress 5307
XStorageDelete 5308
XStorageBuildServerPathByXuid 5309
โœ” XOnlineStartup 5310
โœ” XOnlineCleanup 5311
โœ” XFriendsCreateEnumerator 5312
โœ” XPresenceInitialize 5313
โœ” XUserMuteListQuery 5314
โœ” XInviteGetAcceptedInfo 5315
โœ” XInviteSend 5316
โœ” XSessionWriteStats 5317
โœ” XSessionStart 5318
XSessionSearchEx 5319
โœ” XSessionSearchByID 5320
โœ” XSessionSearch 5321
โœ” XSessionModify 5322
XSessionMigrateHost 5323
โœ” XOnlineGetNatType 5324
โœ” XSessionJoinRemote 5326
โœ” XSessionJoinLocal 5327
โœ” XSessionGetDetails 5328
โœ” XSessionFlushStats 5329
โœ” XSessionDelete 5330
โœ” XUserReadProfileSettings 5331
โœ” XSessionEnd 5332
โœ” XSessionArbitrationRegister 5333
XOnlineGetServiceInfo 5334
โœ” XTitleServerCreateEnumerator 5335
โœ” XSessionLeaveRemote 5336
โœ” XUserWriteProfileSettings 5337
โœ” XPresenceSubscribe 5338
XUserReadProfileSettingsByXuid 5339
โœ” XPresenceCreateEnumerator 5340
XPresenceUnsubscribe 5341
โœ” XSessionModifySkill 5342
โœ” XSessionCalculateSkill 5343
โœ” XStorageBuildServerPath 5344
โœ” XStorageDownloadToMemory 5345
XUserEstimateRankForRating 5346
XLiveProtectedLoadLibrary 5347
XLiveProtectedCreateFile 5348
XLiveProtectedVerifyFile 5349
โœ” XLiveContentCreateAccessHandle 5350
XLiveContentInstallPackage 5351
XLiveContentUninstall 5352
XLiveContentVerifyInstalledPackage 5354
โœ” XLiveContentGetPath 5355
โœ” XLiveContentGetDisplayName 5356
XLiveContentGetThumbnail 5357
XLiveContentInstallLicense 5358
XLiveGetUPnPState 5359
โœ” XLiveContentCreateEnumerator 5360
XLiveContentRetrieveOffersByDate 5361
XLiveMarketplaceDoesContentIdMatch 5362
XLiveContentGetLicensePath 5363
โœ” XShowMarketplaceUI 5365
XShowMarketplaceDownloadItemsUI 5366
โœ” XContentGetMarketplaceCounts 5367
XMarketplaceConsumeAssets 5370
XMarketplaceCreateAssetEnumerator 5371
โœ” XMarketplaceCreateOfferEnumerator 5372
XMarketplaceGetDownloadStatus 5374
XMarketplaceGetImageUrl 5375
XMarketplaceCreateOfferEnumeratorByOffering 5376
XUserFindUsers 5377

TODO

View list
  • XWSAStartup
  • XWSACleanup
  • XSocketShutdown
  • XSocketGetPeerName
  • XWSAGetOverlappedResult
  • XWSACancelOverlappedIO
  • WSARecv
  • XSocketRecvFrom
  • XWSARecvFrom
  • XWSASend
  • XWSASendTo
  • XSocketInet_Addr
  • XSocketWSAGetLastError
  • XWSASetLastError
  • XWSACreateEvent
  • XWSACloseEvent
  • XWSASetEvent
  • XWSAResetEvent
  • XWSAWaitForMultipleEvents
  • XWSAFDIsSet
  • XWSAEventSelect
  • XSocketHTONL
  • XSocketNTOHL
  • XSocketHTONS
  • XNetCreateKey
  • XNetTsAddrToInAddr
  • XNetInAddrToXnAddr
  • XNetInAddrToServer
  • XNetInAddrToString
  • XNetXnAddrToMachineId
  • XNetConnect
  • XNetGetConnectStatus
  • XNetGetDebugXnAddr
  • XNetGetBroadcastVersionStatus
  • XNetGetOpt
  • XNetSetOpt
  • XNetStartupEx
  • XNetReplaceKey
  • XNetGetXnAddrPlatform
  • XNetGetSystemLinkPort
  • XNetSetSystemLinkPort
  • XCustomSetAction
  • XCustomGetLastActionPress
  • XCustomSetDynamicActions
  • XCustomGetLastActionPressEx
  • XCustomRegisterDynamicActions
  • XCustomUnregisterDynamicActions
  • XCustomGetCurrentGamercard
  • XNotifyGetNext
  • XNotifyDelayUI
  • XGetOverlappedResult
  • XLiveInitialize
  • XLiveInput
  • XLiveRender
  • XLiveOnCreateDevice
  • XLiveRegisterDataSection
  • XLiveUnregisterDataSection
  • XLiveUpdateHashes
  • XLivePBufferGetByte
  • XLivePBufferSetByte
  • XLivePBufferGetDWORD
  • XLivePBufferSetDWORD
  • XLiveGetUpdateInformation
  • XNetGetCurrentAdapter
  • XLiveUpdateSystem
  • XLiveGetLiveIdError
  • XLiveUninstallTitle
  • XLiveLoadLibraryEx
  • XLiveFreeLibrary
  • XLivePreTranslateMessage
  • XLiveVerifyArcadeLicense
  • XLiveQueryProtectedDataInformation
  • XLiveVerifyDataFile
  • XShowArcadeUI
  • XLocatorServerAdvertise
  • XLocatorServerUnAdvertise
  • XLocatorGetServiceProperty
  • XLocatorCreateServerEnumerator
  • XLocatorCreateServerEnumeratorByIDs
  • XLocatorServiceInitialize
  • XLocatorServiceUnInitialize
  • XLocatorCreateKey
  • XCancelOverlapped
  • XEnumerateBack
  • XLiveManageCredentials
  • XUserGetXUID
  • XShowMessageBoxUI
  • XUserReadGamerPictureByKey
  • XUserSetProperty
  • XUserReadGamerPicture
  • XUserCreateStatsEnumeratorByRating
  • XUserResetStatsView
  • XUserGetProperty
  • XUserGetContext
  • XUserGetReputationStars
  • XUserResetStatsViewAllUsers
  • XLivePBufferSetByteArray
  • XLiveGetLocalOnlinePort
  • XLiveGetGuideKey
  • XShowGuideKeyRemapUI
  • XStorageUploadFromMemoryGetProgress
  • XStorageDownloadToMemoryGetProgress
  • XStorageDelete
  • XStorageBuildServerPathByXuid
  • XSessionSearchEx
  • XSessionMigrateHost
  • XOnlineGetServiceInfo
  • XUserReadProfileSettingsByXuid
  • XPresenceUnsubscribe
  • XUserEstimateRankForRating
  • XLiveProtectedLoadLibrary
  • XLiveProtectedCreateFile
  • XLiveProtectedVerifyFile
  • XLiveContentInstallPackage
  • XLiveContentUninstall
  • XLiveContentVerifyInstalledPackage
  • XLiveContentGetThumbnail
  • XLiveContentInstallLicense
  • XLiveGetUPnPState
  • XLiveContentRetrieveOffersByDate
  • XLiveMarketplaceDoesContentIdMatch
  • XLiveContentGetLicensePath
  • XShowMarketplaceDownloadItemsUI
  • XMarketplaceConsumeAssets
  • XMarketplaceCreateAssetEnumerator
  • XMarketplaceGetDownloadStatus
  • XMarketplaceGetImageUrl
  • XMarketplaceCreateOfferEnumeratorByOffering
  • XUserFindUsers

Credits

XLiveLessNess (XLLN)

XLLN is by far the most advanced FOSS project out there which aims to be a full rewrite of XLive. However, XDead only provides a minimal layer to work with and does not try to reimplement any of the original functions.

Comparison

XLLN XDead
Goal? Full Rewrite Minimal Layer
Additional API? Yes Yes
Modules? XLLN-Modules No
Module Loader? XLNN or XLLN-Wrapper Yes
Standalone header? No Yes
Local online support? Yes No
Supported games? 81 1

1 Counting only the official XLLN-Modules. However, XLLN might work for many other games.

About

Because it's dead. Get it? Haha. ๐Ÿ’€

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages

โšก