Skip to content

Commit

Permalink
Add support for 1.148.5 (while implementing 1.150.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
grasmanek94 committed Apr 27, 2024
1 parent 84b7cf8 commit a7a16d6
Show file tree
Hide file tree
Showing 32 changed files with 7,043 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Source/Client/Impl/User.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,19 @@ namespace universelan::client {
}
#endif

#if GALAXY_BUILD_FEATURE_IUSER_UWP_TO_XBOX_RENAME
void UserImpl::SignInXbox(uint64_t xboxID, IAuthListener* const listener) {
tracer::Trace trace{ nullptr, __FUNCTION__, tracer::Trace::IUSER };

SignIn(listener);
}
#else
void UserImpl::SignInUWP(IAuthListener* const listener) {
tracer::Trace trace { nullptr, __FUNCTION__, tracer::Trace::IUSER };

SignIn(listener);
}
#endif

void UserImpl::SignInPS4(const char* ps4ClientID, IAuthListener* const listener) {
tracer::Trace trace { nullptr, __FUNCTION__, tracer::Trace::IUSER };
Expand Down
16 changes: 16 additions & 0 deletions Source/Client/Impl/User.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,21 @@ namespace universelan::client {
virtual void SignInEpic(const char* epicAccessToken, const char* epicUsername, IAuthListener* const listener = NULL) override;
#endif

#if GALAXY_BUILD_FEATURE_IUSER_UWP_TO_XBOX_RENAME
/**
* Authenticates the Galaxy Peer based on XBOX GDK credentials.
*
* This call is asynchronous. Responses come to the IAuthListener
* (for all GlobalAuthListener-derived and optional listener passed as argument).
*
* @remark Information about being signed in or signed out also comes to
* the IOperationalStateChangeListener.
*
* @param [in] xboxID The XBOX user ID.
* @param [in] listener The listener for specific operation.
*/
virtual void SignInXbox(uint64_t xboxID, IAuthListener* const listener = NULL) override;
#else
/**
* Authenticates the Galaxy Peer based on Windows Store authentication
* in Universal Windows Platform application.
Expand All @@ -281,6 +296,7 @@ namespace universelan::client {
* @param [in] listener The listener for specific operation.
*/
virtual void SignInUWP(IAuthListener* const listener = NULL) override;
#endif

/**
* Authenticates the Galaxy Peer based on PS4 credentials.
Expand Down
92 changes: 92 additions & 0 deletions Source/DLLs/1.148.5/Dll.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#include <GalaxyDLL.hxx>

namespace galaxy::api {
GALAXY_DLL_EXPORT void GALAXY_CALLTYPE Init(struct InitOptions const& initOptions)
{
return universelan::client::Init(initOptions);
}

GALAXY_DLL_EXPORT void GALAXY_CALLTYPE ProcessData(void)
{
universelan::client::ProcessData();
}

GALAXY_DLL_EXPORT void GALAXY_CALLTYPE Shutdown(void)
{
universelan::client::Shutdown();
}

GALAXY_DLL_EXPORT IApps* GALAXY_CALLTYPE Apps(void)
{
return universelan::client::Apps();
}

GALAXY_DLL_EXPORT IChat* GALAXY_CALLTYPE Chat(void)
{
return universelan::client::Chat();
}

GALAXY_DLL_EXPORT ICustomNetworking* GALAXY_CALLTYPE CustomNetworking(void)
{
return universelan::client::CustomNetworking();
}

GALAXY_DLL_EXPORT IFriends* GALAXY_CALLTYPE Friends(void)
{
return universelan::client::Friends();
}

GALAXY_DLL_EXPORT IError const* GALAXY_CALLTYPE GetError(void)
{
return universelan::client::GetError();
}

GALAXY_DLL_EXPORT IListenerRegistrar* GALAXY_CALLTYPE ListenerRegistrar(void)
{
return universelan::client::ListenerRegistrar();
}

GALAXY_DLL_EXPORT ILogger* GALAXY_CALLTYPE Logger(void)
{
return universelan::client::Logger();
}

GALAXY_DLL_EXPORT IMatchmaking* GALAXY_CALLTYPE Matchmaking(void)
{
return universelan::client::Matchmaking();
}

GALAXY_DLL_EXPORT INetworking* GALAXY_CALLTYPE Networking(void)
{
return universelan::client::Networking();
}

GALAXY_DLL_EXPORT INetworking* GALAXY_CALLTYPE ServerNetworking(void)
{
return universelan::client::ServerNetworking();
}

GALAXY_DLL_EXPORT ITelemetry* GALAXY_CALLTYPE Telemetry(void) {
return universelan::client::Telemetry();
}

GALAXY_DLL_EXPORT IStats* GALAXY_CALLTYPE Stats(void)
{
return universelan::client::Stats();
}

GALAXY_DLL_EXPORT IStorage* GALAXY_CALLTYPE Storage(void)
{
return universelan::client::Storage();
}

GALAXY_DLL_EXPORT IUser* GALAXY_CALLTYPE User(void)
{
return universelan::client::User();
}

GALAXY_DLL_EXPORT IUtils* GALAXY_CALLTYPE Utils(void)
{
return universelan::client::Utils();
}
}
34 changes: 34 additions & 0 deletions Source/DLLs/1.148.5/DllHost.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <GalaxyApi.h>

#include <chrono>
#include <thread>

using namespace galaxy::api;
using namespace std::chrono;

int main()
{
InitOptions options("", "");

Init(options);

while (true)
{
ProcessData();
std::this_thread::sleep_for(milliseconds(5));
}
return 0;
}

#ifdef _WIN32
#include <windows.h>

int
#ifndef _WIN64
__stdcall
#endif
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
return main();
}
#endif
105 changes: 105 additions & 0 deletions Source/DLLs/1.148.5/galaxy/Errors.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#ifndef GALAXY_ERRORS_H
#define GALAXY_ERRORS_H

/**
* @file
* Contains classes representing exceptions.
*/

#include "GalaxyExport.h"

namespace galaxy
{
namespace api
{
/**
* @addtogroup api
* @{
*/

/**
* Base interface for exceptions.
*/
class IError
{
public:

virtual ~IError()
{
}

/**
* Returns the name of the error.
*
* @return The name of the error.
*/
virtual const char* GetName() const = 0;

/**
* Returns the error message.
*
* @return The error message.
*/
virtual const char* GetMsg() const = 0;

/**
* Type of error.
*/
enum Type
{
UNAUTHORIZED_ACCESS,
INVALID_ARGUMENT,
INVALID_STATE,
RUNTIME_ERROR
};

/**
* Returns the type of the error.
*
* @return The type of the error.
*/
virtual Type GetType() const = 0;
};

/**
* The exception thrown when calling Galaxy interfaces while
* the user is not signed in and thus not authorized for any interaction.
*/
class IUnauthorizedAccessError : public IError
{
};

/**
* The exception thrown to report that a method was called with an invalid argument.
*/
class IInvalidArgumentError : public IError
{
};

/**
* The exception thrown to report that a method was called while the callee is in
* an invalid state, i.e. should not have been called the way it was at that time.
*/
class IInvalidStateError : public IError
{
};

/**
* The exception thrown to report errors that can only be detected during runtime.
*/
class IRuntimeError : public IError
{
};

/**
* Retrieves error connected with the last API call on the local thread.
*
* @return Either the last API call error or NULL if there was no error.
*/
GALAXY_DLL_EXPORT const IError* GALAXY_CALLTYPE GetError();

/** @} */
}
}

#endif
83 changes: 83 additions & 0 deletions Source/DLLs/1.148.5/galaxy/GalaxyAllocator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#ifndef GALAXY_I_ALLOCATOR_H
#define GALAXY_I_ALLOCATOR_H

/**
* @file
* Contains definition of custom memory allocator.
*/

#include "stdint.h"
#include <cstddef>

namespace galaxy
{
namespace api
{
/**
* @addtogroup api
* @{
*/

/**
* Allocate function.
*
* @param [in] size Requested size of allocation.
* @param [in] typeName String which identifies the type of allocation.
* @return Pointer to memory block or NULL if it goes out of memory.
*/
typedef void* (*GalaxyMalloc)(uint32_t size, const char* typeName);

/**
* Reallocate function.
*
* @param [in] ptr Pointer to the memory block to be reallocated.
* @param [in] newSize New, requested size of allocation.
* @param [in] typeName String which identifies the type of allocation.
* @return Pointer to memory block or NULL if it goes out of memory.
*/
typedef void* (*GalaxyRealloc)(void* ptr, uint32_t newSize, const char* typeName);

/**
* Free function.
*
* @param [in] ptr Pointer to memory block requested to be freed.
*/
typedef void (*GalaxyFree)(void* ptr);

/**
* Custom memory allocator for GOG Galaxy SDK.
*/
struct GalaxyAllocator
{
/**
* GalaxyAllocator default constructor.
*/
GalaxyAllocator()
: galaxyMalloc(NULL)
, galaxyRealloc(NULL)
, galaxyFree(NULL)
{}

/**
* GalaxyAllocator constructor.
*
* @param [in] _galaxyMalloc Allocation function.
* @param [in] _galaxyRealloc Reallocation function.
* @param [in] _galaxyFree Free function.
*/
GalaxyAllocator(GalaxyMalloc _galaxyMalloc, GalaxyRealloc _galaxyRealloc, GalaxyFree _galaxyFree)
: galaxyMalloc(_galaxyMalloc)
, galaxyRealloc(_galaxyRealloc)
, galaxyFree(_galaxyFree)
{}

GalaxyMalloc galaxyMalloc; ///< Allocation function.
GalaxyRealloc galaxyRealloc; ///< Reallocation function.
GalaxyFree galaxyFree; ///< Free function.
};

/** @} */
}
}

#endif
Loading

0 comments on commit a7a16d6

Please sign in to comment.