mirror of
https://github.com/mordentral/AdvancedSessionsPlugin.git
synced 2025-10-23 08:24:18 +00:00

One is for the general AdvancedSessions The second is for Steam specific implementations This makes it easier to package without steam included, as the default setup always packaged steam out on PC platforms. Unchecking the AdvancedSteamSessions plugin should allow for totally removing any steam reliance from the plugin. You would also have to remove steam specific nodes from your blueprints as well however as they will no longer exist. Former-commit-id: 0bf1fc80dff7be0cc2b9cebaf5affed4918cea49
70 lines
1.9 KiB
C++
70 lines
1.9 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
#include "OnlineSubSystemHeader.h"
|
|
#include "AdvancedSteamWorkshopLibrary.h"
|
|
//General Log
|
|
DEFINE_LOG_CATEGORY(AdvancedSteamWorkshopLog);
|
|
|
|
|
|
void UAdvancedSteamWorkshopLibrary::GetNumSubscribedWorkshopItems(int32 & NumberOfItems)
|
|
{
|
|
NumberOfItems = 0;
|
|
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
|
|
|
if (SteamAPI_Init())
|
|
{
|
|
NumberOfItems = SteamUGC()->GetNumSubscribedItems();
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
UE_LOG(AdvancedSteamWorkshopLog, Warning, TEXT("Error in GetNumSubscribedWorkshopItemCount : SteamAPI is not Inited!"));
|
|
return;
|
|
}
|
|
#endif
|
|
|
|
UE_LOG(AdvancedSteamWorkshopLog, Warning, TEXT("Error in GetNumSubscribedWorkshopItemCount : Called on an incompatible platform"));
|
|
return;
|
|
}
|
|
|
|
TArray<FBPSteamWorkshopID> UAdvancedSteamWorkshopLibrary::GetSubscribedWorkshopItems(int32 & NumberOfItems)
|
|
{
|
|
TArray<FBPSteamWorkshopID> outArray;
|
|
NumberOfItems = 0;
|
|
|
|
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
|
|
|
if (SteamAPI_Init())
|
|
{
|
|
uint32 NumItems = SteamUGC()->GetNumSubscribedItems();
|
|
|
|
if (NumItems == 0)
|
|
return outArray;
|
|
|
|
// Not using the actual variable above in case someone somehow goes past int32 limits
|
|
// Don't want to go negative on the iteration.
|
|
NumberOfItems = NumItems;
|
|
|
|
PublishedFileId_t *fileIds = new PublishedFileId_t[NumItems];
|
|
|
|
uint32 subItems = SteamUGC()->GetSubscribedItems(fileIds, NumItems);
|
|
|
|
for (uint32 i = 0; i < subItems; ++i)
|
|
{
|
|
outArray.Add(FBPSteamWorkshopID(fileIds[i]));
|
|
}
|
|
|
|
delete[] fileIds;
|
|
|
|
return outArray;
|
|
}
|
|
else
|
|
{
|
|
UE_LOG(AdvancedSteamWorkshopLog, Warning, TEXT("Error in GetSubscribedWorkshopItemCount : SteamAPI is not Inited!"));
|
|
return outArray;
|
|
}
|
|
#endif
|
|
|
|
UE_LOG(AdvancedSteamWorkshopLog, Warning, TEXT("Error in GetSubscribedWorkshopItemCount : Called on an incompatible platform"));
|
|
return outArray;
|
|
}
|