SDL icon indicating copy to clipboard operation
SDL copied to clipboard

gdk: Add SDL_GDKGetDefaultUser, SDL_GetPrefPath implementation

Open flibitijibibo opened this issue 2 years ago • 1 comments

This adds some features that are really helpful for single-player titles that don't need a lot of fancy user management and want to reuse their existing desktop work.

Marked as a draft until I get this stuff through cert! Also, this targets SDL2 instead of SDL3, for now.

flibitijibibo avatar Apr 18 '23 15:04 flibitijibibo

I believe you can use GetModuleFileNameA(NULL, buff, SDL_arraysize(buff)) for SDL_GetBasePath since the GDK documentation specifically mentions this use case: https://learn.microsoft.com/en-us/gaming/gdk/_content/gc/reference/system/xgame/functions/xlaunchnewgame (see exePath parameter description) (the game may be deployed as loose files for example...) Otherwise LGTM.

nkrapivin avatar May 22 '23 18:05 nkrapivin

I believe you can use GetModuleFileNameA(NULL, buff, SDL_arraysize(buff)) for SDL_GetBasePath since the GDK documentation specifically mentions this use case: https://learn.microsoft.com/en-us/gaming/gdk/_content/gc/reference/system/xgame/functions/xlaunchnewgame (see exePath parameter description) (the game may be deployed as loose files for example...) Otherwise LGTM.

Implemented this, thanks for the note! The GDK path is now basically the Win32 path, but amazingly the GDK docs recommend using the A functions directly over the W functions, so I went ahead and made that one change.

This change is expected to ship on the Xbox store in the near future, so it should now be ready for review.

flibitijibibo avatar Aug 14 '23 17:08 flibitijibibo

This patch has officially passed cert, so I'll probably merge this and an SDL3 version within the next couple days unless somebody stops me...!

flibitijibibo avatar Aug 23 '23 16:08 flibitijibibo

This looks good to me! :)

slouken avatar Aug 24 '23 18:08 slouken

SDL3 variant: https://github.com/libsdl-org/SDL/commit/c0cd8c8142b70c70da4dddc32244da6593cb6bb0

flibitijibibo avatar Aug 25 '23 14:08 flibitijibibo