Skip to content

Commit

Permalink
Add steamshim integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Ancurio committed Sep 20, 2015
1 parent 213ee81 commit 4382bc5
Show file tree
Hide file tree
Showing 4 changed files with 529 additions and 0 deletions.
28 changes: 28 additions & 0 deletions binding-mri/binding-mri.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
#include "audio.h"
#include "boost-hash.h"

#include "steamshim/steamshim_child.h"

#include <ruby.h>
#include <ruby/encoding.h>

Expand Down Expand Up @@ -313,6 +315,22 @@ RB_METHOD(_kernelCaller)
return trace;
}

RB_METHOD(_steamAchievementUnlock)
{
RB_UNUSED_PARAM;

if (!STEAMSHIM_alive())
return Qnil;

const char *achv;
rb_get_args(argc, argv, "z", &achv RB_ARG_END);

STEAMSHIM_setAchievement(achv, true);
STEAMSHIM_storeStats();

return Qnil;
}

static VALUE newStringUTF8(const char *string, long length)
{
return rb_enc_str_new(string, length, rb_utf8_encoding());
Expand Down Expand Up @@ -588,6 +606,12 @@ static void mriBindingExecute()

mriBindingInit();


STEAMSHIM_init();
_rb_define_module_function(rb_mKernel, "_steam_achievement_unlock",
_steamAchievementUnlock);


std::string &customScript = conf.customScript;
if (!customScript.empty())
runCustomScript(customScript);
Expand All @@ -600,6 +624,10 @@ static void mriBindingExecute()

ruby_cleanup(0);


STEAMSHIM_deinit();


shState->rtData().rqTermAck.set();
}

Expand Down
3 changes: 3 additions & 0 deletions mkxp.pro
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ SOURCES += \
src/midisource.cpp \
src/fluid-fun.cpp

HEADERS += steamshim/steamshim_child.h
SOURCES += steamshim/steamshim_child.c

EMBED = \
shader/common.h \
shader/transSimple.frag \
Expand Down
Loading

0 comments on commit 4382bc5

Please sign in to comment.