Skip to content

Instantly share code, notes, and snippets.

View DJm00n's full-sized avatar

Dimitriy Ryazantcev DJm00n

View GitHub Profile
@DJm00n
DJm00n / gist:34fba6e2b2f57e706e780214eb490281
Created November 12, 2022 07:34
CTransBmp::CreateMask(CDC* pDC)
void CTransBmp::CreateMask(CDC* pDC)
{
m_hbmMask = new CBitmap;
// Nuke any existing mask
if (m_hbmMask) m_hbmMask->DeleteObject();
// Create memory DCs to work with
CDC* hdcMask = new CDC;
CDC* hdcImage = new CDC;
SHGetKnownFolderPath
FOLDERID_SavedGames
{4C5C32FF-BB9D-43b0-B5B4-2D72E54EAAA4}
@DJm00n
DJm00n / Devices.Abstraction.winmd
Last active October 3, 2022 15:02
Xbox Accesiories App
namespace Devices.Abstraction {
// {2C424946-00A9-47BB-BEB9-D7DCA5C7B7D1}
[Windows.Foundation.Metadata.Guid(742541638u, 169, 18363, 190, 185, 215, 220, 165, 199, 183, 209)]
public interface IHidControllerStatics
// {5B6949A8-F5E4-4264-8735-55CD757A8E44}
[Windows.Foundation.Metadata.Guid(1533626792u, 62948, 16996, 135, 53, 85, 205, 117, 122, 142, 68)]
public interface IHidController : IGameController
@DJm00n
DJm00n / code.cpp
Created May 29, 2022 18:10
GetDefaultLayout() from input.dll
/* WARNING: Could not reconcile some variable overlaps */
void GetDefaultLayout(LPCWSTR param_1,wchar_t *param_2,uint *param_3)
{
LSTATUS LVar1;
uint uVar2;
ulonglong uVar3;
undefined **ppuVar4;
@DJm00n
DJm00n / DualSense_WASAPI_Vibration.cpp
Created April 13, 2022 10:56 — forked from Ohjurot/DualSense_WASAPI_Vibration.cpp
Minimal demo to get the DualSense controller vibrating using the haptic feedback (Audio device channel 3 and 4)
#include <Windows.h>
#include <avrt.h>
#include <string>
#include <sstream>
#include <initguid.h>
#include <Mmdeviceapi.h>
#include <audioclient.h>
@DJm00n
DJm00n / XInputGetCapabilitiesEx.cpp
Last active December 6, 2023 10:28
We can use a hidden func XInputGetCapabilitiesEx from XInput 1.4 (comes with Windows 8) to fetch gamepad VID/PID
typedef struct _XINPUT_CAPABILITIES_EX
{
XINPUT_CAPABILITIES Capabilities;
WORD VendorId;
WORD ProductId;
WORD VersionNumber;
WORD unk1;
DWORD unk2;
} XINPUT_CAPABILITIES_EX, *PXINPUT_CAPABILITIES_EX;
Information for device Controller (VID=0x045E PID=0x028E):
Connection Information:
------------------------------
Device current bus speed: FullSpeed
Device supports USB 1.1 specification
Device supports USB 2.0 specification
Device address: 0x000F
Current configuration value: 0x01
Number of open pipes: 7
@DJm00n
DJm00n / gipHidGamepadDescriptor.txt
Last active May 8, 2021 02:16
xusb.sys HID Report Descriptors
//--------------------------------------------------------------------------------
// Report descriptor data in hex (length 262 bytes)
//--------------------------------------------------------------------------------
// 05010905 A101A100 09300931 150027FF FF000095 02751081 02C0A100 09330934
// 150027FF FF000095 02751081 02C00501 09321500 26FF0395 01750A81 02150025
// 00750695 01810305 01093515 0026FF03 9501750A 81021500 25007506 95018103
// 05091901 290A950A 75018102 15002500 75069501 81030501 09391501 25083500
MIIBqjCBsAYJKoZIhvcNAQUNMIGiMEMGCSqGSIb3DQEFDDA2BCCM6a4iNcV1ZkQaJJc4n7wSULd469F2
jWYCwQxLwV4BQgICJxAwDgYKKoYkAgEBAQEBAgUAMFsGCyqGJAIBAQEBAQEDMEwECJF27pUuqlxyBECp
1utF8TxwgoDElnsjH16t9ljrpMA3KR042WvwJcpOF/jpcg3GFbQ6KJdfC8Heo2Q4tWTqLBef0BI+bbj6
xXkEBIH01WwfhTQoZMqNpVDtZxUC8pu0vlnbFn/6DNVVyZGFLbQ1yX4QJjrPyEkDYcBHnoTBUvFcXXJG
3S7S8vtSmJ85c7Jtyk8B0AMhB+F8bmhxV/9pLPuBohTlq6r7lbj6HBmSccmWwVPQEPPvf8MS90F47E3r
dXeF1piuxllB4TEUl7j/ALWXGxhcBrfUyqee6Fq2v2/COc8U4JWZm3DZhQ/+MPp0buePLL+l+7rXDgHj
AHARhCyoLIQEg0UUbMKv4In5MyYefucxAWHsPnlp7Lhc7RlgSmADTiVk48MLU9qRQylp3/JRJG7rL5My
HnhsVRUvvWyvUw==
@DJm00n
DJm00n / utf8.cpp
Last active November 19, 2019 11:58
#include <iostream>
#include <Windows.h>
int main()
{
SetConsoleCP(CP_UTF8);
SetConsoleOutputCP(CP_UTF8);
std::cout << "GetConsoleCP()=" << GetConsoleCP() << ", GetConsoleOutputCP()=" << GetConsoleOutputCP() << std::endl;
std::cout << "GetACP()=" << GetACP() << std::endl;