Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GSoC Final Evaluation: Steam Workshop SDK/Third Party Integration #2350

Merged
merged 215 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
215 commits
Select commit Hold shift + click to select a range
abaf735
add Steamworks extension prototypes and SOG tests
k0T0z Apr 2, 2023
7e85d8c
add debugging hook
k0T0z Apr 6, 2023
90ee0b7
setup project structure
May 20, 2023
4411149
setup
May 20, 2023
bdcec06
Merge branch 'enigma-dev:master' into steam-sdk-integration
k0T0z May 27, 2023
cdf2f1b
enhancing initial code (doesn't work)
Jun 5, 2023
3350b13
fixed exceptions wall
Jun 5, 2023
77caed6
fixed deleted file
Jun 5, 2023
f2d96c8
improves provided
Jun 5, 2023
ff7e84a
improved tests
Jun 5, 2023
cc2494c
implemented some of general API user functions, added the testing exa…
Jun 7, 2023
d193016
modifying game example
Jun 8, 2023
01bf091
improved example game to be now ready for testing functions, implemen…
Jun 16, 2023
a249a0e
bug fixes and few improvements
Jun 17, 2023
58cd5e4
adding linux support in Makefile
k0T0z Jun 19, 2023
b5638a5
adding linux support in Makefile
k0T0z Jun 19, 2023
c8aaa0d
Merge branch 'steam-sdk-integration' of https://github.com/k0T0z/enig…
k0T0z Jun 19, 2023
fd2267f
implemented another 2 user functions, fixed ABI issue by moving to li…
k0T0z Jun 20, 2023
723509e
creating architecture instead of a wrapper, clean files, bug fixes
k0T0z Jun 24, 2023
44a5e39
bug fixes
k0T0z Jun 25, 2023
31cfd1d
fixed example game, fixed overlay activated callback, implemented 2 m…
k0T0z Jun 26, 2023
b648f16
calling steam_init() automatically, bug fixes, few improvements
k0T0z Jun 30, 2023
44f9b02
bug fixes
k0T0z Jun 30, 2023
03c2277
implemented 2 user functions in overlay
k0T0z Jul 2, 2023
65ff597
bug fixes
k0T0z Jul 2, 2023
bab0841
overlay API done, fixed example game
k0T0z Jul 2, 2023
f0b8e01
bug fixes, added achievements API
k0T0z Jul 2, 2023
9c727e9
fix naming, update readme
k0T0z Jul 2, 2023
5ad6468
bug fixes
k0T0z Jul 2, 2023
a609e0c
adding dlls, fixing output messages
k0T0z Jul 2, 2023
55c9c87
few improvements
k0T0z Jul 2, 2023
c8934cc
few improvements
k0T0z Jul 3, 2023
e8e3ebd
few improvements
k0T0z Jul 5, 2023
0605d59
started implementing Stats and Achievements API, bug fixes
k0T0z Jul 5, 2023
9be4767
bug fixes
k0T0z Jul 5, 2023
b07a455
add Steamworks extension prototypes and SOG tests
k0T0z Apr 2, 2023
87a94e4
add debugging hook
k0T0z Apr 6, 2023
e7c39f9
setup project structure
May 20, 2023
5576b7e
setup
May 20, 2023
8b9140d
enhancing initial code (doesn't work)
Jun 5, 2023
9b7f8a6
fixed exceptions wall
Jun 5, 2023
b1a1e7f
fixed deleted file
Jun 5, 2023
c9a93e2
improves provided
Jun 5, 2023
b2f4289
improved tests
Jun 5, 2023
53fe0af
implemented some of general API user functions, added the testing exa…
Jun 7, 2023
854c24f
modifying game example
Jun 8, 2023
055662d
improved example game to be now ready for testing functions, implemen…
Jun 16, 2023
a5aeed1
bug fixes and few improvements
Jun 17, 2023
80bca61
adding linux support in Makefile
k0T0z Jun 19, 2023
4fd96e8
implemented another 2 user functions, fixed ABI issue by moving to li…
k0T0z Jun 20, 2023
51e5ab3
creating architecture instead of a wrapper, clean files, bug fixes
k0T0z Jun 24, 2023
ba00ec9
bug fixes
k0T0z Jun 25, 2023
4502fd8
fixed example game, fixed overlay activated callback, implemented 2 m…
k0T0z Jun 26, 2023
12bb0fa
calling steam_init() automatically, bug fixes, few improvements
k0T0z Jun 30, 2023
5b8c18c
bug fixes
k0T0z Jun 30, 2023
048dce5
implemented 2 user functions in overlay
k0T0z Jul 2, 2023
349c42e
bug fixes
k0T0z Jul 2, 2023
a4591df
overlay API done, fixed example game
k0T0z Jul 2, 2023
62b1c6b
bug fixes, added achievements API
k0T0z Jul 2, 2023
3be9a6f
fix naming, update readme
k0T0z Jul 2, 2023
1ae41e3
bug fixes
k0T0z Jul 2, 2023
0185ddf
adding dlls, fixing output messages
k0T0z Jul 2, 2023
28e2170
few improvements
k0T0z Jul 2, 2023
3019ef4
few improvements
k0T0z Jul 3, 2023
61a573f
few improvements
k0T0z Jul 5, 2023
aa43d17
started implementing Stats and Achievements API, bug fixes
k0T0z Jul 5, 2023
f054304
bug fixes
k0T0z Jul 5, 2023
a837a59
Merge branch 'steam-sdk-integration' of https://github.com/k0T0z/enig…
k0T0z Jul 5, 2023
83e679f
bug fixes
k0T0z Jul 5, 2023
15a9124
bug fixes, implemented 3 more user functions, achievements are now wo…
k0T0z Jul 6, 2023
90973fb
few improvements, implemented most of the achievements API
k0T0z Jul 6, 2023
769c63c
achievements api done, bug fixes
k0T0z Jul 7, 2023
8311de5
add steam logo
k0T0z Jul 7, 2023
16ea047
clean files, add leaderboard starter code
k0T0z Jul 11, 2023
b03fffd
clean files, bug fixes, started implementing Leaderboards API
k0T0z Jul 11, 2023
351445f
adding Async support inside Steamworks ENIGMA extension
k0T0z Jul 13, 2023
9e9a901
adding CMakeLists.txt file
k0T0z Jul 13, 2023
145076e
adding CMakeLists.txt file
k0T0z Jul 13, 2023
088f8b4
bug fixes, few improvements, changing the way Async work in ENIGMA
k0T0z Jul 15, 2023
17b593a
changing the way Async works
k0T0z Jul 17, 2023
69d01bf
bug fixes
k0T0z Jul 18, 2023
c4144ad
Merge remote-tracking branch 'upstream/master' into steam-sdk-integra…
k0T0z Jul 19, 2023
db840d4
bug fixes, updating the new Async system
k0T0z Jul 19, 2023
ab58d54
fixing .ignore file
k0T0z Jul 22, 2023
5007221
bug fixes, implementing using the old Async system for now
k0T0z Jul 22, 2023
5ea8902
new Async system: trial 3
k0T0z Jul 22, 2023
bc3fbdd
Fixing the new Async system done
k0T0z Jul 23, 2023
d363b46
bug fixs
k0T0z Jul 25, 2023
6f6216e
game client documentation done
k0T0z Jul 26, 2023
150eea7
APIs documentation done
k0T0z Jul 26, 2023
bba3b36
Removing example game from git for midterm review, bug fixes, and doc…
k0T0z Jul 26, 2023
0d71898
bug fixes
k0T0z Jul 26, 2023
e3bcb12
bug fixes
k0T0z Jul 26, 2023
9db0e8f
new project structure
k0T0z Jul 27, 2023
003d844
initial commit
k0T0z Aug 3, 2023
98dac7d
fixed .gitignore with the new structure, committed the example game, …
k0T0z Aug 9, 2023
42661cd
not improtant
k0T0z Aug 9, 2023
67355aa
implemented json_encode()
k0T0z Aug 9, 2023
8ec281d
Merge with master
k0T0z Aug 9, 2023
6bf23c8
Merge branch 'fix-json-encode' into steam-sdk-integration-final
k0T0z Aug 9, 2023
5bf57c3
add SOG test for json_encode() user function
k0T0z Aug 9, 2023
8c4024f
!imp
k0T0z Aug 9, 2023
221c78b
ignore this commit
k0T0z Aug 11, 2023
748edad
Merge branch 'fix-json-encode' into steam-sdk-integration-final
k0T0z Aug 11, 2023
6ca5f61
ignore this commit
k0T0z Aug 11, 2023
7ce0b77
Merge branch 'master' into fix-json-encode
k0T0z Aug 11, 2023
806771a
fixed json_encode and fixed tests
k0T0z Aug 11, 2023
c206749
Merge fix-json-encode branch into steam-sdk-integration-final branch
k0T0z Aug 11, 2023
7f4db94
bug fixes
k0T0z Aug 11, 2023
6f134e0
ignore this
k0T0z Aug 11, 2023
e88f79b
bug fixes
k0T0z Aug 11, 2023
aa67248
bug fixes
k0T0z Aug 11, 2023
c81daac
Merge branch 'fix-json-encode' into steam-sdk-integration-final
k0T0z Aug 11, 2023
3d1fb47
bug fixes
k0T0z Aug 11, 2023
3aec01a
Merge branch 'fix-json-encode' into steam-sdk-integration-final
k0T0z Aug 11, 2023
9563576
bug fixes
k0T0z Aug 11, 2023
4590d62
Merge branch 'master' of https://github.com/k0T0z/enigma-dev into ste…
k0T0z Aug 12, 2023
1fc9981
fixed wired text blowing up Async event output and modifying example …
k0T0z Aug 14, 2023
cb5bc57
ignore this
k0T0z Aug 14, 2023
7281024
moving to std::sstream instead of std::string
k0T0z Aug 14, 2023
b917519
Merge branch 'master' into fix-json-encode
k0T0z Aug 14, 2023
de07daa
Merge branch 'fix-json-encode' into steam-sdk-integration-final
k0T0z Aug 14, 2023
131a485
bug fixes
k0T0z Aug 15, 2023
5f79412
Merge branch 'master' into steam-sdk-integration-final
k0T0z Aug 15, 2023
45cbe88
modified example game
k0T0z Aug 15, 2023
c38f484
ignore
k0T0z Aug 15, 2023
654b94f
ignore
k0T0z Aug 15, 2023
d3a955e
fixed json extension conversion to ds map and improved naming of some…
k0T0z Aug 15, 2023
08cad9d
Merge branch 'fix-json-extension' into steam-sdk-integration-final
k0T0z Aug 15, 2023
1bbd97b
updating example game
k0T0z Aug 15, 2023
274e156
add instance_create_depth
RobertBColton Aug 16, 2023
c991219
fix instance_copy init order
RobertBColton Aug 16, 2023
cb94251
Merge branch 'master' of https://github.com/k0T0z/enigma-dev into ste…
k0T0z Aug 16, 2023
df85643
Update ENIGMAsystem/SHELL/Universal_System/Instances/instance_create.h
RobertBColton Aug 16, 2023
1bf3f78
ignore
k0T0z Aug 16, 2023
89eee39
Merge branch 'instance-create-depth' into steam-sdk-integration-final
k0T0z Aug 16, 2023
970daa2
declare instance_create_depth
RobertBColton Aug 16, 2023
a57b4fb
ignore
k0T0z Aug 16, 2023
41634dc
Merge branch 'instance-create-depth' into steam-sdk-integration-final
k0T0z Aug 16, 2023
778d6e7
Merge branch 'enigma-dev:master' into instance-create-depth
k0T0z Aug 16, 2023
c2ca90b
Merge branch 'master' of https://github.com/k0T0z/enigma-dev into ste…
k0T0z Aug 16, 2023
1fec49a
Merge branch 'instance-create-depth' of https://github.com/k0T0z/enig…
k0T0z Aug 16, 2023
5f52b10
ignore
k0T0z Aug 16, 2023
8a21955
fix #2354
k0T0z Aug 16, 2023
b39a11d
Merge branch 'fix-json-extension' into steam-sdk-integration-final an…
k0T0z Aug 16, 2023
020b1d0
leaderboards done
k0T0z Aug 16, 2023
7c4e1ed
Merge branch 'master' into fix-json-extension
k0T0z Aug 16, 2023
3661dbe
Merge branch 'fix-json-extension' into steam-sdk-integration-final
k0T0z Aug 16, 2023
4e90d47
adding stubs directory for fixing linkage errors when extension is di…
k0T0z Aug 16, 2023
0468ebb
few improvements
k0T0z Aug 17, 2023
9ca40ee
Merge branch 'master' into steam-sdk-integration-final
k0T0z Aug 17, 2023
4978d92
few improvements and bug fixes, added the new algorithm for dealing w…
k0T0z Aug 17, 2023
495d239
leaderboards API now complete and README.md updated
k0T0z Aug 18, 2023
4a89b8f
switching from pointer sstream to reference
k0T0z Aug 18, 2023
80de2a2
improved documentation
k0T0z Aug 19, 2023
716b741
adding interface for leaderboards call results
k0T0z Aug 20, 2023
6992485
fixed a memory leak and investigating in a leaderboard handle bug
k0T0z Aug 23, 2023
fe687d7
fixed leaderboard name bug
k0T0z Aug 24, 2023
ccb98ff
ignore
k0T0z Aug 27, 2023
79dfbc0
fix #2339 the right way
k0T0z Aug 27, 2023
87a9e64
Merge branch 'fix-decode-json' into steam-sdk-integration-final
k0T0z Aug 27, 2023
2a8bd90
merge master into steam-sdk-integration-final
k0T0z Aug 28, 2023
75d9f0c
fixed the upload rate limit output message algorithm, improved flushi…
k0T0z Aug 31, 2023
b38c2dc
improved the example game
k0T0z Sep 1, 2023
f9b5452
fixed steam_get_user_persona_name user function, fixed the overlay co…
k0T0z Sep 1, 2023
81e4bac
delete sdk
k0T0z Sep 2, 2023
8fed488
improve the README and .gitignore
k0T0z Sep 2, 2023
325fa35
improve .gitignore
k0T0z Sep 2, 2023
d7ec585
improve .gitignore
k0T0z Sep 2, 2023
cb684a3
improve REAME
k0T0z Sep 2, 2023
30ac953
improved achievements API, implemented another function in Social API…
k0T0z Sep 5, 2023
f3976d3
fixed bug in Social API
k0T0z Sep 5, 2023
f1c5147
Cloud API starter code is now here and Social API is postponed until …
k0T0z Sep 6, 2023
49541be
Adding starter doc for Cloud API
k0T0z Sep 6, 2023
9806577
few improvements
k0T0z Sep 6, 2023
55457f8
added Steamworks API mock, fixed set_warning_message_hook() function,…
k0T0z Sep 10, 2023
ad34b5a
fixed API mock
k0T0z Sep 10, 2023
7f82618
improved mock
k0T0z Sep 10, 2023
a300fc1
improved tests
k0T0z Sep 10, 2023
5e39252
implemented steam_get_image_rgba() and few improvements
k0T0z Sep 11, 2023
38937c3
bug fixes
k0T0z Sep 11, 2023
563de7f
bug fixes
k0T0z Sep 13, 2023
e08013c
adding stub extensions
k0T0z Sep 14, 2023
1162b36
ignorre
k0T0z Sep 17, 2023
3d4480a
remove redistributable_bin from git
k0T0z Sep 17, 2023
e2ef87b
ignore
k0T0z Sep 17, 2023
1e5ee4f
change of plans: link the fake statically and load the real dynamical…
k0T0z Sep 18, 2023
72f5aaa
implemented fake API
k0T0z Sep 20, 2023
e877ddf
bug fixes
k0T0z Sep 20, 2023
7b69d34
refactored some user functions to load addresses dynamically
k0T0z Sep 21, 2023
702a525
reverting changes due to chnage of plans
k0T0z Sep 22, 2023
287d6b8
Merge branch 'steam-sdk-integration-final' of https://github.com/k0T0…
k0T0z Sep 22, 2023
6e634fa
reverting changes due to chnage of plans
k0T0z Sep 22, 2023
0ae3ae0
adding binder layer
k0T0z Sep 22, 2023
8269e96
real lib loading now works but without callbacks or callresults
k0T0z Sep 23, 2023
fd20b5d
add fake shared lib code makefile
k0T0z Sep 24, 2023
40d8c62
add fake shared lib code makefile
k0T0z Sep 24, 2023
1ecb36d
few improvements and bug fixes
k0T0z Sep 25, 2023
32fc705
implemented the rest of fake API, fixed callback and callresults in t…
k0T0z Sep 26, 2023
45ea2ee
ig i cannot use env var, so lets use -D define instead for now
k0T0z Sep 26, 2023
3eee74a
fixed memory leak inside fake API, improved functions using assert, a…
k0T0z Sep 28, 2023
728f6ca
enabled Json and Steamworks extensions in the test-runner
k0T0z Sep 28, 2023
104f4b1
documented the gameclient and steambinder layers
k0T0z Sep 29, 2023
8d6e6be
bug fixes and final commit for GSoC 2023
k0T0z Sep 29, 2023
056abc9
fix readme
k0T0z Sep 29, 2023
dd6a11e
clean
k0T0z Sep 29, 2023
dcad6e7
remove steam.svg
k0T0z Sep 30, 2023
3bf0eaa
improve documentation
k0T0z Sep 30, 2023
4a57794
improve documentation
k0T0z Sep 30, 2023
1632bdc
update spirites for copyright constraints
k0T0z Oct 1, 2023
e416e63
update readme
k0T0z Oct 2, 2023
929c796
update readme
k0T0z Oct 2, 2023
77c5bae
improving documentation
k0T0z Oct 9, 2023
0729469
few cleaning and bug fixes
k0T0z Oct 9, 2023
433a9cd
fixing documentation
k0T0z Oct 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 39 additions & 0 deletions CommandLine/testing/SimpleTests/steam_general.sog/create.edl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
var steam_api = 0;

if (steam_initialised())
{
if (steam_stats_ready() && steam_is_overlay_enabled())
{
steam_api = 1;
}
}

gtest_assert_true(steam_api);

var app_id = steam_get_app_id();
gtest_assert_eq(app_id, 480);

var steam_id = steam_get_user_steam_id();
gtest_assert_eq(steam_id, 0);

var account_id = steam_get_user_account_id();
gtest_assert_eq(account_id, 0);

var logged_in = steam_is_user_logged_on();
gtest_assert_true(logged_in);

var name = steam_get_persona_name();
gtest_assert_eq(name, "FakeSteamUser");

var user_name = steam_get_user_persona_name(0);
gtest_assert_eq(user_name, "FakeSteamUser");

var language = steam_current_game_language();
gtest_assert_eq(language, "FakeLanguage");

var languages = steam_available_languages();
gtest_assert_eq(languages, "FakeLanguages");

steam_shutdown();
steam_api = steam_initialised();
gtest_assert_false(steam_api);
23 changes: 23 additions & 0 deletions CommandLine/testing/SimpleTests/steam_overlay.sog/create.edl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
var steam_api = 0;

if (steam_initialised())
{
if (steam_stats_ready() && steam_is_overlay_enabled())
{
steam_api = 1;
}
}

gtest_assert_true(steam_api);

var is_enabled = steam_is_overlay_enabled();
gtest_assert_true(is_enabled);

steam_activate_overlay(ov_friends);

var is_activated = steam_is_overlay_activated();
gtest_assert_true(is_activated);

steam_shutdown();
steam_api = steam_initialised();
gtest_assert_false(steam_api);
2 changes: 1 addition & 1 deletion CommandLine/testing/SmallTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ TEST_P(SimpleTestHarness, SimpleTestRunner) {
// Iterate only platforms, graphics & collision systems for now
for (TestConfig tc : GetValidConfigs(true, true, false, true, false, false)) {

tc.extensions = "Alarms,Timelines,Paths,MotionPlanning,IniFilesystem,ParticleSystems,DateTime,DataStructures,libpng,GTest";
tc.extensions = "Alarms,Timelines,Paths,MotionPlanning,IniFilesystem,ParticleSystems,DateTime,DataStructures,libpng,GTest,Json,Steamworks";
int ret = TestHarness::run_to_completion(game, tc);
if (!ret) continue;
switch (ret) {
Expand Down
15 changes: 14 additions & 1 deletion ENIGMAsystem/SHELL/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,20 @@ SOURCES := $(wildcard *.cpp) $(wildcard Platforms/General/*.cpp)
include $(addsuffix /Makefile,$(SYSTEMS) $(EXTENSIONS))
include Bridges/$(PLATFORM)-$(GRAPHICS)/Makefile

# If Steamworks extension not enabled, enable Steamworks stub.
# Else build the fake library.
ifeq (,$(findstring Universal_System/Extensions/Steamworks, $(EXTENSIONS)))
include Universal_System/StubExtensions/Steamworks/Makefile
else
compile_game: $(STEAM_FAKE_LIB)
clean: steam_clean
endif

# If DataStructures extension not enabled, enable DataStructures stub.
ifeq (,$(findstring Universal_System/Extensions/DataStructures, $(EXTENSIONS)))
include Universal_System/StubExtensions/DataStructures/Makefile
endif

#This does not work, use a for loop and prepend it to each one not the whole string
OBJECTS := $(addprefix $(OBJDIR)/,$(patsubst %.m, %.o, $(patsubst %.cpp, %.o, $(patsubst %.c, %.o, $(SOURCES)))))
#RCFILES := $(addprefix $(WORKDIR),$(RESOURCES))
Expand All @@ -137,7 +151,6 @@ else
RESOURCEBINARY := $(OBJDIR)/resources.res
endif


############
# building #
############
Expand Down
30 changes: 30 additions & 0 deletions ENIGMAsystem/SHELL/Platforms/General/PFmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@
#include "Universal_System/roomsystem.h"
#include "Universal_System/mathnc.h" // enigma_user::clamp

#include "Universal_System/Extensions/Steamworks/steamworks.h"

#include <chrono> // std::chrono::microseconds
#include <thread> // sleep_for

namespace enigma {

std::queue<std::map<std::string, variant>> posted_async_events;

std::mutex posted_async_events_mutex;

std::vector<std::function<void()> > extension_update_hooks;

bool game_isending = false;
Expand Down Expand Up @@ -166,7 +172,27 @@ int updateTimer() {
return 0;
}

void fireEventsFromQueue() {
// Acquire lock and release it when out of scope of fireEventsFromQueue().
std::lock_guard<std::mutex> guard(posted_async_events_mutex);
while (!posted_async_events.empty()) {
enigma_user::ds_map_clear(enigma_user::async_load);

std::map<std::string, variant> event = posted_async_events.front();

posted_async_events.pop();

for (auto& [key, value] : event) {
enigma_user::ds_map_add(enigma_user::async_load, key, value);
}

enigma::fireSteamworksEvent();
}
}

int enigma_main(int argc, char** argv) {
enigma_user::async_load = enigma_user::ds_map_create();

// Initialize directory globals
initialize_directory_globals();

Expand Down Expand Up @@ -201,6 +227,8 @@ int enigma_main(int argc, char** argv) {
for (auto update_hook : extension_update_hooks)
update_hook();

enigma::fireEventsFromQueue();

ENIGMA_events();
handleInput();
}
Expand All @@ -215,6 +243,8 @@ int enigma_main(int argc, char** argv) {

namespace enigma_user {

int async_load;

const int os_browser = browser_not_a_browser;
std::string working_directory = "";
std::string program_directory = "";
Expand Down
98 changes: 66 additions & 32 deletions ENIGMAsystem/SHELL/Platforms/General/PFmain.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** Copyright (C) 2011 Josh Ventura
*** Copyright (C) 2013-2014 Robert B. Colton
*** Copyright (C) 2023-2024 Saif Kandil (k0T0z)
***
*** This file is a part of the ENIGMA Development Environment.
***
Expand All @@ -19,35 +20,61 @@
#ifndef ENIGMA_PLATFORM_MAIN
#define ENIGMA_PLATFORM_MAIN

#include <map>
#include <mutex>
#include <queue>
#include <string>

#include "Universal_System/Extensions/DataStructures/include.h"
#include "Universal_System/var4.h"

namespace enigma {
extern bool game_isending;
extern int game_return;
extern int parameterc;
extern std::string* parameters;
extern int pausedSteps;
extern int current_room_speed;
extern int frames_count;
extern unsigned long current_time_mcs;
extern bool game_window_focused;

int enigma_main(int argc, char** argv);
int game_ending();
void Sleep(int ms);
void compute_window_scaling();
void compute_window_size();
void initialize_program_directory();
void initialize_directory_globals();
void set_program_args(int argc, char** argv);
void platform_focus_lost();
void platform_focus_gained();
void initTimer();
int updateTimer();
int gameWait();
void set_room_speed(int rs);
}

extern bool game_isending;
extern int game_return;
extern int parameterc;
extern std::string* parameters;
extern int pausedSteps;
extern int current_room_speed;
extern int frames_count;
extern unsigned long current_time_mcs;
extern bool game_window_focused;

/**
* @brief This queue is used to store the events that are fired from the
* async event system.
*
*/
extern std::queue<std::map<std::string, variant>> posted_async_events;

/**
* @brief This mutex is used to lock the posted_async_events queue.
*
*/
extern std::mutex posted_async_events_mutex;

int enigma_main(int argc, char** argv);
int game_ending();
void Sleep(int ms);
void compute_window_scaling();
void compute_window_size();
void initialize_program_directory();
void initialize_directory_globals();
void set_program_args(int argc, char** argv);
void platform_focus_lost();
void platform_focus_gained();
void initTimer();
int updateTimer();
int gameWait();
void set_room_speed(int rs);

/**
* @brief This function is used to fire all the events that are stored in the
* @c posted_async_events queue.
*
*/
void fireEventsFromQueue();
} // namespace enigma

namespace enigma_user {

extern std::string working_directory;
Expand All @@ -58,8 +85,15 @@ extern double fps;
extern unsigned long delta_time;
extern unsigned long current_time;

/**
* @brief When firing any event inside posted_async_events queue, this variable will
* contain the data that will be sent to the game.
*
*/
extern int async_load;

void sleep(int ms);
unsigned long get_timer(); // number of microseconds since the game started
unsigned long get_timer(); // number of microseconds since the game started
void game_end();
void game_end(int ret);
void action_end_game();
Expand All @@ -76,17 +110,17 @@ unsigned long long disk_free(std::string drive);

void execute_shell(std::string fname, std::string args);
void execute_program(std::string fname, std::string args, bool wait);
std::string execute_shell_for_output(const std::string &command);
std::string execute_shell_for_output(const std::string& command);
void url_open(std::string url);
void action_webpage(const std::string &url);
void action_webpage(const std::string& url);

void set_program_priority(int value);
std::string filename_absolute(std::string fname);
std::string filename_join(std::string prefix, std::string suffix);
std::string environment_get_variable(std::string name);
bool environment_set_variable(const std::string &name, const std::string &value);
bool environment_set_variable(const std::string& name, const std::string& value);
bool set_working_directory(std::string dname);

} // namespace enigma_user
} // namespace enigma_user

#endif //ENIGMA_PLATFORM_MAIN
#endif //ENIGMA_PLATFORM_MAIN
3 changes: 3 additions & 0 deletions ENIGMAsystem/SHELL/Universal_System/Extensions/Json/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ namespace enigma_user
}
}

/*
Check https://github.com/enigma-dev/enigma-dev/pull/2358.
*/
string json_encode(variant ds_map) {
if (!enigma_user::ds_map_exists(ds_map)) {
DEBUG_MESSAGE("DS map does not exist", MESSAGE_TYPE::M_ERROR);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
############################################################################
# Copyright (C) 2023-2024 Saif Kandil (k0T0z)
#
# This file is a part of the ENIGMA Development Environment.
#
# ENIGMA is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, version 3 of the license or any later version.
#
# This application and its source code is distributed AS-IS, WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along
# with this code. If not, see <http://www.gnu.org/licenses/>
############################################################################

/.vs/*
/.vscode/*

# gb stands for Global Backup and it shouldn't be committed to git
# gb is auto-generated by the example game
/*.gb*/*

# This is only temporary, it will be removed once the Midterm review is done.
# /steamworks_demo/*
15 changes: 15 additions & 0 deletions ENIGMAsystem/SHELL/Universal_System/Extensions/Steamworks/About.ey
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
%e-yaml
---

Name: Steamworks
Identifier: Steamworks
Author: Saif Kandil (https://k0t0z.github.io)
Description: Steamworks is a set of tools and services that help game developers and publishers build their games and get the most out of distributing on Steam.
Default: false
Icon: steam.svg

Depends:
Extensions: DataStructures, Json
Dependencies: None
Implement: extension_steamworks
Init: extension_steamworks_init
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
############################################################################
# Copyright (C) 2023-2024 Saif Kandil (k0T0z)
#
# This file is a part of the ENIGMA Development Environment.
#
# ENIGMA is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, version 3 of the license or any later version.
#
# This application and its source code is distributed AS-IS, WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along
# with this code. If not, see <http://www.gnu.org/licenses/>
############################################################################

############################################################################
# Note that this file isn't tested yet as ENIGMA's engine still works with
# the old build system. Ignore this file for now.
############################################################################

add_library(steamapi STATIC IMPORTED GLOBAL
redistributable_bin/steam_api.lib
)

set_property(TARGET steamapi APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(steamapi PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
IMPORTED_LOCATION_DEBUG "${CMAKE_SOURCE_DIR}/game_client/Steamv157/sdk/redistributable_bin/steam_api.lib")

target_link_libraries(steamworks
steamapi
)