Skip to content

Instantly share code, notes, and snippets.

@vk2gpu
vk2gpu / gist:7c8364c2b2f9a8d75f81484779261191
Created July 11, 2017 04:31
DLL delayload switcharoo.
#include <cstdio>
#include <cstring>
#include <Windows.h>
#include <Delayimp.h>
#include <string>
/// GetExampleDLLName comes from here.
#include "../ExampleDLL/exampledll.h"
@vk2gpu
vk2gpu / soa.cpp
Last active April 20, 2018 18:04
#include <vector>
#include <cstdio>
#include <cstdint>
#include <cmath>
#include <xmmintrin.h>
namespace Soa
{
template<typename TYPE, typename... ARGS>
void Load(TYPE&, ARGS...);
// Starts a programmatically controlled capture.
// captureFlags uses the PIX_CAPTURE_* family of flags to specify the type of capture to take
extern "C" HRESULT WINAPI PIXBeginCapture(DWORD captureFlags, _In_opt_ const PPIXCaptureParameters captureParameters);
// Stops a programmatically controlled capture
// If discard == TRUE, the captured data is discarded
// If discard == FALSE, the captured data is saved
extern "C" HRESULT WINAPI PIXEndCapture(BOOL discard);
extern "C" DWORD WINAPI PIXGetCaptureState();
extern "C" void WINAPI PIXReportCounter(_In_ PCWSTR name, float value);
#if PLATFORM_WINDOWS
static void APIENTRY debugOutput(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam)
#else
static void debugOutput( GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam )
#endif
{
if( type != GL_DEBUG_TYPE_ERROR )
{
return;
}
{
"$Objects" : [
{
"$Class" : "ScnEntity",
"$ID" : "$(ScnEntity:default.TrackEntity)",
"Components_" : [ "$(GaTrackComponent:default.GaTrackComponent_0)" ],
"LocalTransform_" : {
"$Class" : "MaMat4d",
"Row0_" : "1.0000000000000000, 0.0000000000000000, 0.0000000000000000, 0.0000000000000000",
"Row1_" : "0.0000000000000000, 1.0000000000000000, -0.0000000000000000, 0.0000000000000000",
/// Core undo/redo code.
typedef std::function< void() > ActionCallback;
struct EditorAction
{
BcU32 ID_ = 0;
const char* Name_ = nullptr;
ActionCallback Do_;
ActionCallback Undo_;
fn get_piece(piece: i32) -> String
{
let mut string = String::new();
match piece
{
-1 => string.push_str(" "),
0 => string.push_str("O"),
1 => string.push_str("X"),
_ => panic!("Invalid piece"),
};
extern crate sdl2;
use sdl2::pixels::Color;
use sdl2::event::Event;
use sdl2::keyboard::Keycode;
use sdl2::rect::Rect;
const BORDER: i32 = 32;
const WIDTH: i32 = 1024;
const HEIGHT: i32 = 768;
extern crate sdl2;
use sdl2::pixels::Color;
use sdl2::event::Event;
use sdl2::keyboard::Keycode;
use sdl2::rect::Rect;
const BORDER: i32 = 32;
const WIDTH: i32 = 1024;
const HEIGHT: i32 = 768;
// Add editor.
Class.addAttribute(
new DsImGuiFieldEditor(
[]( DsImGuiFieldEditor* ThisFieldEditor, std::string Name, void* Object, const ReClass* Class, ReFieldFlags Flags )
{
ScnTexture* Value = (ScnTexture*)Object;
if( Value != nullptr )
{
auto StateStorage = ImGui::GetStateStorage();
int MinWidth = 256;