Skip to content

Instantly share code, notes, and snippets.

@MortimerGoro
MortimerGoro / gist:73103944326698e57f34
Created June 4, 2014 10:55
Receipt validation using OpenSSL and asn1c.
/* The PKCS #7 container (the receipt) and the output of the verification. */
BIO *b_p7;
PKCS7 *p7;
/* The Apple root certificate, as raw data and in its OpenSSL representation. */
BIO *b_x509;
X509 *Apple;
/* The root certificate for chain-of-trust verification. */
X509_STORE *store = X509_STORE_new();
@MortimerGoro
MortimerGoro / WebGLContext.cpp
Last active June 29, 2018 16:03
WebGLContext patch
#define VRB_LOG(format, ...) __android_log_print(ANDROID_LOG_INFO, "VRB", format, ##__VA_ARGS__);
static already_AddRefed<SharedSurfaceTextureClient>
CloneSurface(gl::SharedSurface* src, gl::SurfaceFactory* factory)
{
RefPtr<SharedSurfaceTextureClient> dest = factory->NewTexClient(src->mSize);
if (!dest) {
return nullptr;
}
@MortimerGoro
MortimerGoro / OVRService.java
Last active August 7, 2017 18:19
Gear VR SurfaceView
// Android SurfaceView initialization example
void init(final Activity activity) {
mSurfaceView = new SurfaceView(activity);
mSurfaceView.getHolder().addCallback(OVRService.this);
// Enabling setZOrderOnTop is very important! If not enabled a single swap_buffers
// on the NativeActivity's window will make the SurfaceView invisible.
mSurfaceView.setZOrderOnTop(true);
activity.getApplication().registerActivityLifecycleCallbacks(OVRService.this);
}
@MortimerGoro
MortimerGoro / gearvr_display.rs
Last active August 7, 2017 17:56
Gear VR submit frame
fn submit_frame(&mut self, layer: &VRLayer) {
let mut frame_params = ovr::helpers::vrapi_DefaultFrameParms(self.render_ovr_java.handle(),
ovr::ovrFrameInit::VRAPI_FRAME_INIT_DEFAULT,
self.predicted_display_time,
ptr::null_mut());
frame_params.FrameIndex = self.frame_index;
let eye_projection = self.eye_projection.get();
for (i, eye) in self.eye_framebuffers.iter_mut().enumerate() {
let swap_chain_index = (self.frame_index % eye.swap_chain_length as i64) as i32;
@MortimerGoro
MortimerGoro / crash.txt
Created April 28, 2017 13:24
crash android chould've computed the final hint and handled later_siblings already
This file has been truncated, but you can view the full file.
--------- beginning of system
07-03 16:58:41.761 447 455 I QISL : QSEE Interrupt Service Listener Thread is started
07-03 16:58:41.762 447 455 I QISL : QSEE Interrupt Service Listener was activated successfully
07-03 16:58:43.880 545 545 I vold : Vold 3.0 (the awakening) firing up
07-03 16:58:43.888 545 545 V vold : Detected support for: ext4 vfat
07-03 16:58:43.942 545 552 I vold : e4crypt_initialize_global_de
07-03 16:58:44.149 545 552 D vold : Added key 353542628 (ext4:5a0dc95cb48db9de) to keyring 936389460 in process 545
07-03 16:58:44.204 545 552 D vold : e4crypt_init_user0
07-03 16:58:44.204 545 552 D vold : Preparing: /data/misc/vold/user_keys
07-03 16:58:44.205 545 552 D vold : Preparing: /data/misc/vold/user_keys/ce
pub trait VRGamepad {
fn id(&self) -> u32;
// Constant data for the gamepad.
fn data(&self) -> VRGamepadData;
// Data that should be polled every frame.
fn state(&self) -> VRGamepadState;
}
pub struct VRGamepadState {
pub connected: bool,
if self.fbo_texture != layer.texture_id {
// Attach external texture to the used later in BlitFramebuffer.
gl::BindFramebuffer(gl::FRAMEBUFFER, self.fbo_id);
gl::FramebufferTexture2D(gl::FRAMEBUFFER, gl::COLOR_ATTACHMENT0, gl::TEXTURE_2D, layer.texture_id, 0);
self.fbo_texture = layer.texture_id;
}
let texture_size = layer.texture_size.unwrap_or_else(|| {
(self.render_size.width as u32, self.render_size.height as u32)
});
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().takeSurface(null);
FrameLayout layout = new FrameLayout(this);
layout.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.MATCH_PARENT));
SurfaceView nativeSurface = new SurfaceView(this);
nativeSurface.getHolder().addCallback(this);
layout.addView(nativeSurface, new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.MATCH_PARENT));
@MortimerGoro
MortimerGoro / main.rs
Last active November 29, 2016 21:58
VRServiceManager example
let mut vr = VRServiceManager::new();
// Register default VRService implementations.
// Default VRServices are specified using cargo features.
vr.register_defaults();
// Fallback to Mock Device if no real headset is found.
vr.register_mock();
// Intialize all registered VR Services
vr.initialize_services();
// Discover VR devices
let devices = vr.get_devices();
@MortimerGoro
MortimerGoro / VRCompositor.rs
Last active November 29, 2016 19:08
VRCompositor traits for blogpost
// Trait object that handles WebVR commands.
// Receives the texture_id associated to the WebGLContext.
pub trait VRCompositorHandler: Send {
fn handle(&mut self, command: VRCompositorCommand, texture_id: Option<u32>);
}