Skip to content

Instantly share code, notes, and snippets.

@OmeGak
Last active April 8, 2016 13:26
Show Gist options
  • Save OmeGak/41fba726bd147e43640c to your computer and use it in GitHub Desktop.
Save OmeGak/41fba726bd147e43640c to your computer and use it in GitHub Desktop.
Decompiled code from Secrets of Raetikon Deserter achievement trigger
function GinkgoGames::SinglePlayerLevel::onQuit() {
// Achievement check begins
rbx = *(rdi + 0x70); // rbx = ID of current scenario
rax = GIN::Symbolize("sp_forst_destructor"); // rax = representation of scenario "sp_forst_destructor"
if (rbx == rax) { // check if we are in scenario "sp_forst_destructor"
rax = GIN::Node::getPropertyValue(
GIN::Node::find(GIN::Symbolize("destructionDirector")), // destructionDirector is the unavoidable mechanism
"Capacitor", // that starts once all 8 shards are plugged in
"killCounter",
"charge",
&var_4); // var_4 = GetPropertyValue("Capacitor", "killCounter", "charge")
// This means current killCounter of the machine
xmm0 = intrinsic_movss(xmm0, var_4); // xmm0 = var_4
xmm1 = intrinsic_xorps(xmm1, xmm1); // xmm1 = xmm1 XOR xmm1 = 0
xmm0 = intrinsic_ucomiss(xmm0, xmm1); // Compare xmm0 with xmm1
// I think this doesn't change the value of xmm0
// Checks previous comparison xmm0 > xmm1
if (CPU_FLAGS & BE) { // [?] This could be checking if we have killed more than 0 animals
xmm1 = intrinsic_movss(xmm1, *(int32_t *)0x1004b5e70); // [!] xmm1 = ???
// 0x1004b5e70 is a position in the binary file
// The hex value contained on that position is
// dq 0x40e0000040400000
xmm1 = intrinsic_ucomiss(xmm1, xmm0); // compares xmm1 with xmm0
// Checks previous comparison xmm1 > xmm0
if (CPU_FLAGS & BE) { // [!] No idea what this final check is
// ??? > animals killed > 0
// Achievement check completed
rbx = GIN::FixedSymbolize("ACH_DESERTER");
// Check if the achievemente hasn't been achieved before
rax = GIN::SteamClient::achieved(rbx);
if (LOBYTE(rax) == 0x0) {
// Trigger achievement
rax = GIN::SteamClient::setAchieved(rbx);
}
}
}
}
return rax;
}
<root>
<node name="destructorCenterLines" position="0.001 17.509" pivot="0.0 -0.4" layer="back02">
<!-- ... -->
<DelayedEventSender name="turnOnPulsers" event=".destructionDirector.allDead" sendEvent="turnOnPulser" delay="8.0" />
<!-- ... -->
</node>
<!-- ... -->
<node name="destructionDirector" position="0.001 17.009" layer="triggers">
<node name="swooshSound">
<SoundEvent name="metalSwoosh" sound="metalSwoosh03" playEvent="playSwoosh" pitch="0.5" soundType="positional" distances="20.0 500.0" minInterval="0.15" />
<RepeatedEventSender name="soundRepeater" event="playSwoosh" delayFirst="false" startEvent="root.startMachine" />
<Capacitor name="setRepeatInterval" chargeEvent="playSwoosh" chargedEvent="" resetOnFull="false" charge="1.5" capacity="0.1" chargeUnit="-0.1" minCharge="1.5" unchargeSpeed="0.0" />
<EventPropertyTransfer name="setPlaySpeed" event="playSwoosh" path=":RepeatedEventSender(soundRepeater)/interval" sourcePath=":Capacitor(setRepeatInterval)/charge" />
<SoundPositioner />
</node>
<Sizer size="10.0 10.0" />
<Capacitor name="shardCounter" chargeEvent="countShard" chargedEvent="full" resetOnFull="false" capacity="7.0" unchargeSpeed="0.0" />
<UniqueObject originalPath="destructionDirector" originalLevel="Singleplayer.sp_forst_destructor" />
<EventPropertyBool name="turnOnCamShaker" event="turnOnCamShaker" path=":ShakeCamera/active" value="true" />
<ShakeCamera active="false" durationRange="10.0 10.0" pauseRange="0.0 0.0" startMagnitude="0.0" endMagnitude="1.0" autoStart="false" />
<SoundPositioner />
<StoreBool name="allShardsReturned" />
<StoreBool name="sequenceShardsReturned" />
<StoreBool name="sequenceAllDead" />
<ConditionalEventBool name="hasFinishedGame" event=".levelStarts" sendEvent="checkSequenceAllDead" path="hasFinishedGame:StoreBool(hasFinishedGame)/value" value="false" />
<ConditionalEventBool name="checkSequenceAllDead" event="checkSequenceAllDead" sendEvent="allDead" delay="1.0" path=":StoreBool(sequenceAllDead)/value" />
<EventPropertyBool name="setAllShardsReturned" event="full" path=":StoreBool(allShardsReturned)/value" value="true" />
<EventPropertyBool name="setSequenceShardsReturned" event="full" path=":StoreBool(sequenceShardsReturned)/value" value="true" negateEvent=".cageStag.fadeInBorder" />
<EventPropertyBool name="setSequenceAllDead" event="allDead" path=":StoreBool(sequenceAllDead)/value" value="true" />
<Capacitor name="killCounter" chargeEvent="countKill" chargedEvent="allDead" resetOnFull="false" capacity="7.0" unchargeSpeed="0.0" />
<EndSequenceController />
<EventPropertyCallback name="triggerEndSequence" event="allDead" path=":EndSequenceController/trigger" />
<EventPropertyBool event="allDead" path=".loadingScreen/active" />
<EventPropertyBool event="allDead" path=".savingIcon/active" />
<Capacitor name="pitchShifter" chargeEvent="countKill" chargedEvent="" resetOnFull="false" charge="1.0" capacity="2.0" chargeUnit="0.1" unchargeSpeed="0.0" />
<SoundEvent name="activationSequence" sound="machineActivateSequence" playEvent=".destructorCenterLines.beamRobins.turnOnPulser" priority="0" singleInstance="true" />
</node>
<!-- ... -->
<node name="labelGameEnd_001" ref="floatingLabel" position="0.0 150.0" scale="1.0 1.0" layer="UI 2">
<LocalizedLabel visible="true" material="font" blendColor="1.0 1.0 1.0 0.0" texture="brokenRunes_64" uppercase="true" font="brokenRunes_64" text="...TO BE CONTINUED..." />
<DelayedEventSender name="fadeIn" event=".destructionDirector.endGame" sendEvent="fadeIn" delay="2.0" />
<UniqueObject originalPath="labelGameEnd_001" originalLevel="Singleplayer.sp_forst_destructor" />
<FadeTo active="false" />
<EventPropertyCallback name="fadeIn" event="fadeIn" path=":FadeTo/fade" />
<EventPropertyCallback name="fadeOut" event="fadeOut" path=":FadeTo/fadeBack" />
</node>
<node name="labelGameEnd_003" ref="floatingLabel" position="0.0 -209.0" scale="0.5 0.5" layer="UI 2">
<LocalizedLabel visible="false" font="medium_font_outline" text="Press START or SPACE" />
<DelayedEventSender name="showLabel" event=".labelGameEnd_001.fadeIn" sendEvent="show" delay="4.0" />
<EventPropertyBool event="show" path=":LocalizedLabel/visible" value="true" negateEvent="hide" />
<UniqueObject originalPath="labelGameEnd_003" originalLevel="Singleplayer.sp_forst_destructor" />
</node>
<node name="labelGameEnd_002" ref="floatingLabel" position="0.0 73.0" scale="0.365 0.365" layer="UI 2">
<LocalizedLabel visible="true" material="font" blendColor="1.0 1.0 1.0 0.0" texture="brokenRunes_64" uppercase="false" font="brokenRunes_64" text=" What happens next will be \n revealed when the game is done" />
<DelayedEventSender name="fadeIn" event=".destructionDirector.endGame" sendEvent="fadeIn" delay="3.0" />
<UniqueObject originalPath="labelGameEnd_002" originalLevel="Singleplayer.sp_forst_destructor" />
<FadeTo active="false" />
<EventPropertyCallback name="fadeIn" event="fadeIn" path=":FadeTo/fade" />
<EventPropertyCallback name="fadeOut" event="fadeOut" path=":FadeTo/fadeBack" />
</node>
</root>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment