Skip to content

Commit

Permalink
Corrected minor issues with steamshim and documented the building
Browse files Browse the repository at this point in the history
  • Loading branch information
KockaAdmiralac committed Aug 6, 2018
1 parent c8b0b92 commit e2c9806
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
4 changes: 3 additions & 1 deletion steamshim/steamshim_child.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ typedef int PipeType;
#ifdef STEAMSHIM_DEBUG
#define dbgpipe printf
#else
static inline void dbgpipe(const char *fmt, ...) {}
static inline void dbgpipe(const char *fmt, ...) {
(void)fmt;
}
#endif

static int writePipe(PipeType fd, const void *buf, const unsigned int _len);
Expand Down
2 changes: 1 addition & 1 deletion steamshim_parent/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ FLAGS += -lsteam_api

ifeq ($(DEBUG),1)
FLAGS += -DSTEAMSHIM_DEBUG
else
else ifeq ($(HOST),w32)
FLAGS += -mwindows
endif

Expand Down
22 changes: 22 additions & 0 deletions steamshim_parent/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Steamshim parent
OneShot uses [steamshim](https://hg.icculus.org/icculus/steamshim/) for GNU GPL v3 and Steam interoperability. There are five components that OneShot uses to communicate with Steam, in order:
1. Steamworks SDK (that can be obtained from [here](https://partner.steamgames.com)) that is used for directly communicating with Steam. It is closed-source, and because of license compatibility issues steamshim must be used as a layer between OneShot and Steamworks SDK to communicate with Steam.
2. steamshim parent (whose source is within this folder) is a separate application that will start up the main OneShot application and can communicate with the Steamworks SDK.
3. steamshim child (whose source is inside the `steamshim` folder) is the client used to communicate with the steamshim parent from the OneShot application through pipes.
4. Steam controller inside OneShot application (`src/steam.cpp`) controls the communication between OneShot and steamshim components.
5. Steam binding (`binding-mri/steam-binding.cpp`) creates Ruby objects so Steam functionalities (like achievements) can be controlled from the game's scripts/events and passes on the handling to the Steam controller

## Building
Download Steamworks SDK from [here](https://partner.steamgames.com) and run
```console
$ export LD_LIBRARY_PATH=/path/to/steamworks/sdk/redistributable_bin/platform
$ STEAMWORKS=/path/to/steamworks/sdk HOST=platform make
```
inside this directory, where `platform` can be `win64`, `osx32`, `linux64` or `linux32`

If you need debug output from the steamshim parent, compile with `DEBUG=1` in command-line arguments for `make`.

## Running
After building the steamshim parent, place it in the same directory as the OneShot application. Note that the OneShot application **must be named "oneshot"**. Changing the case ("OneShot") will make the game not launch.

To run the game with the Steam wrapper, run the steamshim parent.
5 changes: 4 additions & 1 deletion steamshim_parent/steamshim_parent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ typedef int PipeType;
#ifdef STEAMSHIM_DEBUG
#define dbgpipe printf
#else
static inline void dbgpipe(const char *fmt, ...) {}
static inline void dbgpipe(const char *fmt, ...) {
(void)fmt;
}
#endif

/* platform-specific mainline calls this. */
Expand Down Expand Up @@ -245,6 +247,7 @@ static bool launchChild(ProcessType *pid)

// we're the child.
GArgv[0] = strdup("./" GAME_LAUNCH_NAME);
dbgpipe("Starting %s\n", GArgv[0]);
execvp(GArgv[0], GArgv);
// still here? It failed! Terminate, closing child's ends of the pipes.
_exit(1);
Expand Down

0 comments on commit e2c9806

Please sign in to comment.