Skip to content

Instantly share code, notes, and snippets.

View hexagit's full-sized avatar

hexagit

View GitHub Profile
@hexagit
hexagit / ExceptionUtils.cpp
Created July 20, 2018 08:13
アクセス違反でゲームエンジンが落ちないようにしよう!構造化例外時のログ出力とか
// 構造化例外時のログ出力とか
struct ExceptionUtils
{
// インスタンス作成
static ExceptionUtils* Get()
{
static ExceptionUtils instance;
return &instance;
}
@hexagit
hexagit / Main.cpp
Last active July 20, 2018 08:24
アクセス違反でゲームエンジンが落ちないようにしよう!全部
#include <Windows.h>
#include <iostream>
#include <sstream>
#pragma comment(lib,"dbghelp.lib")
#include <DbgHelp.h>
// スコープの開始と終了を出力する
struct PrintScope
{
@hexagit
hexagit / decompile_sample1.txt
Last active September 18, 2018 08:20
ILをデコンパイルしてみたい
public class TestC {
public float Add(float x, float y) {
return x + y;
}
public float TestM() {
var x = 1;
var y = 2;
return Add(x, y);
}
}
@hexagit
hexagit / decompile_sample2
Created September 18, 2018 08:22
ILをデコンパイルしてみたい
// アセンブリで定義されている型を全て取得
foreach (var type in assembly.GetTypes()) {
foreach (var method in type.GetMethods()) {
var methodBody = method.GetMethodBody();
if (methodBody == null) {
Console.WriteLine("{0}", method);
Console.WriteLine("{");
Console.WriteLine("}");
continue;
}
D3DXVECTOR3 b1, b2, d;
float s1 = 100.0f;
float s2 = 50.0f;
float g = 9.8f;
float t = 0.0f;
void Bullet::Move()
{
D3DXVECTOR3 X, Y, Z;
D3DXMATRIX m;
D3DXVECTOR3 bulletPos; //弾丸の現在位置
D3DXVECTOR3 preBulletPos; //1フレーム前の弾丸の位置
D3DXVECTOR3 moveDirection; //弾丸の移動方向
float bulletHorizontalSpeed = 100.0f; //弾丸水平方向の速度
float bulletVerticalSpeed = 50.0f; //弾丸の垂直方向の速度
float gravity = 9.8f; //重力
/// <summary>
/// 弾丸の移動処理
/// </summary>
@hexagit
hexagit / m5stack_weather_main.py
Last active October 23, 2018 06:08
2018新人ブログデビュー!⑦
import m5stack as m5
from m5stack import lcd
import time
import ujson
import urequests
class Weather:
def __init__(self):
self.base_url = 'http://api.openweathermap.org/data/2.5/weather?q={}&appid={}'
self.api_key = 'xxxxxxxxxxxxxxxxxxxxxxxxx' #openweathermapの開発用API key
using System;
using System.ComponentModel.Composition;
using System.Runtime.InteropServices;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Editor;
using Microsoft.VisualStudio.OLE.Interop;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.TextManager.Interop;
using Microsoft.VisualStudio.Utilities;
using System;
using UnityEngine;
public partial class Bitmap
{
private const int lanczosDefaultN = 3;
private Bitmap resizeLanczos(uint width, uint height, uint range = lanczosDefaultN)
{
var bitmap = new Bitmap(width, height);
@hexagit
hexagit / MouseUnderScroll.cs
Last active December 17, 2018 08:27
Windows7を便利にしたい1
using System;
using System.Runtime.InteropServices;
namespace MouseUnderScroll
{
// Win32API
public class WinAPI
{
[StructLayout(LayoutKind.Sequential)]
public struct POINT