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

Languages