-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
69706cc
commit 8bd6761
Showing
19 changed files
with
246 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#pragma once | ||
|
||
/* | ||
* This is a header designed to be included in C++ source code. | ||
* It should not be included in applications using any C wrapper libraries! | ||
*/ | ||
#ifndef __cplusplus | ||
#error "This header can only be used in C++!" | ||
#endif | ||
|
||
#include "steampp.h" | ||
|
||
namespace steampp { | ||
|
||
class Steam; | ||
|
||
} // namespace steampp | ||
|
||
namespace Convert { | ||
|
||
steampp::Steam* steam(steampp_steam_handle_t handle); | ||
|
||
} // namespace Convert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#pragma once | ||
|
||
#include <sourceppc/Buffer.h> | ||
#include <sourceppc/String.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
typedef uint32_t AppID; | ||
|
||
typedef void* steampp_steam_handle_t; | ||
|
||
#ifdef __cplusplus | ||
} // extern "C" | ||
#endif | ||
|
||
// REQUIRES MANUAL FREE: steampp_steam_free | ||
SOURCEPP_API steampp_steam_handle_t steampp_steam_new(); | ||
|
||
SOURCEPP_API void steampp_steam_free(steampp_steam_handle_t* handle); | ||
|
||
SOURCEPP_API const char* steampp_get_install_dir(steampp_steam_handle_t handle); | ||
|
||
// REQUIRES MANUAL FREE: sourcepp_string_array_free | ||
SOURCEPP_API sourcepp_string_array_t steampp_get_library_dirs(steampp_steam_handle_t handle); | ||
|
||
// REQUIRES MANUAL FREE: sourcepp_string_free | ||
SOURCEPP_API sourcepp_string_t steampp_get_sourcemod_dir(steampp_steam_handle_t handle); | ||
|
||
SOURCEPP_API size_t steampp_get_installed_apps(steampp_steam_handle_t handle, AppID* array, size_t arrayLen); | ||
|
||
SOURCEPP_API size_t steampp_get_installed_apps_count(steampp_steam_handle_t handle); | ||
|
||
SOURCEPP_API bool steampp_is_app_installed(steampp_steam_handle_t handle, AppID appID); | ||
|
||
SOURCEPP_API const char* steampp_get_app_name(steampp_steam_handle_t handle, AppID appID); | ||
|
||
// REQUIRES MANUAL FREE: sourcepp_string_free | ||
SOURCEPP_API sourcepp_string_t steampp_get_app_install_dir(steampp_steam_handle_t handle, AppID appID); | ||
|
||
// REQUIRES MANUAL FREE: sourcepp_string_free | ||
SOURCEPP_API sourcepp_string_t steampp_get_app_icon_path(steampp_steam_handle_t handle, AppID appID); | ||
|
||
// REQUIRES MANUAL FREE: sourcepp_string_free | ||
SOURCEPP_API sourcepp_string_t steampp_get_app_logo_path(steampp_steam_handle_t handle, AppID appID); | ||
|
||
// REQUIRES MANUAL FREE: sourcepp_string_free | ||
SOURCEPP_API sourcepp_string_t steampp_get_app_box_art_path(steampp_steam_handle_t handle, AppID appID); | ||
|
||
// REQUIRES MANUAL FREE: sourcepp_string_free | ||
SOURCEPP_API sourcepp_string_t steampp_get_app_store_art_path(steampp_steam_handle_t handle, AppID appID); | ||
|
||
SOURCEPP_API bool steampp_is_app_using_source_engine(steampp_steam_handle_t handle, AppID appID); | ||
|
||
SOURCEPP_API bool steampp_is_app_using_source_2_engine(steampp_steam_handle_t handle, AppID appID); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include <steamppc/Convert.hpp> | ||
|
||
#include <steampp/steampp.h> | ||
|
||
using namespace steampp; | ||
|
||
Steam* Convert::steam(steampp_steam_handle_t handle) { | ||
return static_cast<Steam*>(handle); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
add_pretty_parser(steampp C SOURCES | ||
"${CMAKE_CURRENT_SOURCE_DIR}/lang/c/include/steamppc/Convert.hpp" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/lang/c/include/steamppc/steampp.h" | ||
"${CMAKE_CURRENT_LIST_DIR}/Convert.cpp" | ||
"${CMAKE_CURRENT_LIST_DIR}/steampp.cpp") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
#include <steamppc/steampp.h> | ||
|
||
#include <steampp/steampp.h> | ||
|
||
#include <sourceppc/Convert.hpp> | ||
#include <sourceppc/Helpers.h> | ||
#include <steamppc/Convert.hpp> | ||
|
||
using namespace steampp; | ||
|
||
SOURCEPP_API steampp_steam_handle_t steampp_steam_new() { | ||
auto* steam = new Steam{}; | ||
if (!*steam) { | ||
delete steam; | ||
steam = nullptr; | ||
} | ||
return steam; | ||
} | ||
|
||
SOURCEPP_API void steampp_steam_free(steampp_steam_handle_t* handle) { | ||
SOURCEPP_EARLY_RETURN(handle); | ||
|
||
delete Convert::steam(*handle); | ||
*handle = nullptr; | ||
} | ||
|
||
SOURCEPP_API const char* steampp_get_install_dir(steampp_steam_handle_t handle) { | ||
SOURCEPP_EARLY_RETURN_VAL(handle, ""); | ||
|
||
return Convert::steam(handle)->getInstallDir().data(); | ||
} | ||
|
||
SOURCEPP_API sourcepp_string_array_t steampp_get_library_dirs(steampp_steam_handle_t handle) { | ||
SOURCEPP_EARLY_RETURN_VAL(handle, SOURCEPP_STRING_ARRAY_INVALID); | ||
|
||
return Convert::toStringArray(Convert::steam(handle)->getLibraryDirs()); | ||
} | ||
|
||
SOURCEPP_API sourcepp_string_t steampp_get_sourcemod_dir(steampp_steam_handle_t handle) { | ||
SOURCEPP_EARLY_RETURN_VAL(handle, SOURCEPP_STRING_INVALID); | ||
|
||
return Convert::toString(Convert::steam(handle)->getSourceModDir()); | ||
} | ||
|
||
SOURCEPP_API size_t steampp_get_installed_apps(steampp_steam_handle_t handle, AppID* array, size_t arrayLen) { | ||
SOURCEPP_EARLY_RETURN_VAL(handle, 0); | ||
SOURCEPP_EARLY_RETURN_VAL(array, 0); | ||
SOURCEPP_EARLY_RETURN_VAL(arrayLen, 0); | ||
|
||
return Convert::writeVectorToMem<AppID>(Convert::steam(handle)->getInstalledApps(), array, arrayLen); | ||
} | ||
|
||
SOURCEPP_API size_t steampp_get_installed_apps_count(steampp_steam_handle_t handle) { | ||
SOURCEPP_EARLY_RETURN_VAL(handle, 0); | ||
|
||
return Convert::steam(handle)->getInstalledApps().size(); | ||
} | ||
|
||
SOURCEPP_API bool steampp_is_app_installed(steampp_steam_handle_t handle, AppID appID) { | ||
SOURCEPP_EARLY_RETURN_VAL(handle, false); | ||
|
||
return Convert::steam(handle)->isAppInstalled(appID); | ||
} | ||
|
||
SOURCEPP_API const char* steampp_get_app_name(steampp_steam_handle_t handle, AppID appID) { | ||
SOURCEPP_EARLY_RETURN_VAL(handle, ""); | ||
|
||
return Convert::steam(handle)->getAppName(appID).data(); | ||
} | ||
|
||
SOURCEPP_API sourcepp_string_t steampp_get_app_install_dir(steampp_steam_handle_t handle, AppID appID) { | ||
SOURCEPP_EARLY_RETURN_VAL(handle, SOURCEPP_STRING_INVALID); | ||
|
||
return Convert::toString(Convert::steam(handle)->getAppInstallDir(appID)); | ||
} | ||
|
||
SOURCEPP_API sourcepp_string_t steampp_get_app_icon_path(steampp_steam_handle_t handle, AppID appID) { | ||
SOURCEPP_EARLY_RETURN_VAL(handle, SOURCEPP_STRING_INVALID); | ||
|
||
return Convert::toString(Convert::steam(handle)->getAppIconPath(appID)); | ||
} | ||
|
||
SOURCEPP_API sourcepp_string_t steampp_get_app_logo_path(steampp_steam_handle_t handle, AppID appID) { | ||
SOURCEPP_EARLY_RETURN_VAL(handle, SOURCEPP_STRING_INVALID); | ||
|
||
return Convert::toString(Convert::steam(handle)->getAppLogoPath(appID)); | ||
} | ||
|
||
SOURCEPP_API sourcepp_string_t steampp_get_app_box_art_path(steampp_steam_handle_t handle, AppID appID) { | ||
SOURCEPP_EARLY_RETURN_VAL(handle, SOURCEPP_STRING_INVALID); | ||
|
||
return Convert::toString(Convert::steam(handle)->getAppBoxArtPath(appID)); | ||
} | ||
|
||
SOURCEPP_API sourcepp_string_t steampp_get_app_store_art_path(steampp_steam_handle_t handle, AppID appID) { | ||
SOURCEPP_EARLY_RETURN_VAL(handle, SOURCEPP_STRING_INVALID); | ||
|
||
return Convert::toString(Convert::steam(handle)->getAppStoreArtPath(appID)); | ||
} | ||
|
||
SOURCEPP_API bool steampp_is_app_using_source_engine(steampp_steam_handle_t handle, AppID appID) { | ||
SOURCEPP_EARLY_RETURN_VAL(handle, false); | ||
|
||
return Convert::steam(handle)->isAppUsingSourceEngine(appID); | ||
} | ||
|
||
SOURCEPP_API bool steampp_is_app_using_source_2_engine(steampp_steam_handle_t handle, AppID appID) { | ||
SOURCEPP_EARLY_RETURN_VAL(handle, false); | ||
|
||
return Convert::steam(handle)->isAppUsingSource2Engine(appID); | ||
} |