Skip to content

Instantly share code, notes, and snippets.

@leonkasovan
leonkasovan / drm-gbm.c
Created January 19, 2024 08:19 — forked from varphone/drm-gbm.c
drm-gbm
// gcc -o drm-gbm drm-gbm.c -ldrm -lgbm -lEGL -lGL -I/usr/include/libdrm
// general documentation: man drm
#include <xf86drm.h>
#include <xf86drmMode.h>
#include <gbm.h>
#include <EGL/egl.h>
#include <GLES2/gl2.h>
#include <stdlib.h>
@leonkasovan
leonkasovan / joysticks.c
Created February 2, 2024 13:47
joysticks.c
//========================================================================
// Joystick input test
// Copyright (c) Camilla Löwy <[email protected]>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
#include <guis/GuiMsgBoxScroll2.h>
#include <components/TextComponent.h>
#include <components/ButtonComponent.h>
#include <components/MenuComponent.h> // for makeButtonGrid
#define ES_DIR1 "/recalbox/share_init/system/.emulationstation"
#define BUFFER_SIZE 1024
int ReadHelpContent(const char *filename, int content_number, String &content){
FILE *fi = fopen(filename, "r");
// ROMs Downloader using ImGui Library
// Dhani Novan 25 Mei 2024 Cempaka Putih Jakarta
// TODO:
// 1. (done) Check target path if exists confirm to continue download or cancel download
// Note: now if target path if exists, it won't displayed in result
// 2. (done) Clipping for result
// 3. Scrape
// 4. Build database using lua script
#include "imgui.h"
// #include <string>
#include <map>
std::map<std::string, int> scrapeId{
{"megadrive",1},
{"snes",4},
{"psx",57},
{"ps2",58}
};
@leonkasovan
leonkasovan / compile_shader.go
Created November 8, 2024 10:28
Compile OpenGL shader using GLFW
package main
import (
"fmt"
"io/ioutil"
"log"
"runtime"
"os"
"path/filepath"
"strings"
@leonkasovan
leonkasovan / main.c
Created November 9, 2024 03:51
Command line tool to test shader compiler (using OpenGL + SDL2).
/*
Command line tool to test shader compiler (using OpenGL + SDL2).
Run it inside folder that contains shader files.
If filename consists "frag" then it treat as fragment shader.
If filename consists "vert" then it treat as vertex shader.
If filename consists "geo" then it treat as geometry shader.
Build:
gcc main.c -o compile_shader -lGL `sdl2-config --cflags --libs`
*/
@leonkasovan
leonkasovan / settings.json
Created November 30, 2024 14:48
Visual Code Recommend Default Setting
///C:/Users/Personal Komputer/AppData/Roaming/Code/User/settings.json
{
"editor.minimap.enabled": false,
"extensions.ignoreRecommendations": true,
"git.openRepositoryInParentFolders": "never",
"diffEditor.ignoreTrimWhitespace": true,
"terminal.integrated.defaultProfile.windows": "PowerShell",
"terminal.integrated.profiles.windows": {
"PowerShell": {
"source": "PowerShell",
@leonkasovan
leonkasovan / KMSDRM_GLES_SwapWindow.c
Created December 8, 2024 22:16
KMSDRM_GLES_SwapWindow to be ported into GLFW
KMSDRM_GLES_SwapWindow;
a. KMSDRM_CreateSurfaces
b. KMSDRM_WaitPageflip
c. KMSDRM_gbm_surface_release_buffer
d. eglSwapBuffers
e. KMSDRM_gbm_surface_lock_front_buffer
f. KMSDRM_FBFromBO -> KMSDRM_drmModeAddFB
g. KMSDRM_drmModeSetCrtc OR KMSDRM_drmModePageFlip -> KMSDRM_WaitPageflip
@leonkasovan
leonkasovan / recalbox_kmsdrm.log
Created December 25, 2024 05:24
recalbox_kmsdrm.log
drm-common.c:find_drm_device: drmGetDevices2
drm-common.c:find_drm_device: open /dev/dri/card0
drm-common.c:get_resources:find_drm_device: drmModeGetResources
drm-common.c:find_drm_device: drmFreeDevices
drm-common.c:find_drm_connector: drmModeGetConnector
drm-common.c:find_drm_connector: drmModeFreeConnector
drm-common.c:find_drm_connector: drmModeGetConnector
drm-common.c:init_drm: drmModeGetEncoder
drm-common.c:init_drm: drmModeFreeEncoder
drm-common.c:init_drm: drmModeGetEncoder