Skip to content

Instantly share code, notes, and snippets.

View LemonHaze420's full-sized avatar

LemonHaze420

View GitHub Profile
@LemonHaze420
LemonHaze420 / da_ghost_ridaaa.cpp
Created February 14, 2025 21:29
da_ghost_ridaaa.cpp for Ghost Rider 2002 (arc files)
// LemonHaze - 2025
#include <iostream>
#include <ostream>
#include <fstream>
#include <vector>
#include <zlib.h>
struct arc {
struct entry {
int a, b, c, size;
@LemonHaze420
LemonHaze420 / analyse_calls.py
Last active December 27, 2024 13:18
script to analyse all calls to a given function and optionally renames callbacks based on the name provided at the call-site
import idc
import idautils
import idaapi
rename_funcs = True
name_regs = ["rax", "r12", "r13", "r14", "r15", "rdi", "rbp"]
exclude_func_substrings = ["Queue_", "_Callback"]
unwanted_chars = ["[", ">"]
@LemonHaze420
LemonHaze420 / split.py
Created November 24, 2024 21:55
split up output
import os
import re
import sys
def split_c_file(input_file, output_dir):
os.makedirs(output_dir, exist_ok=True)
marker_pattern = re.compile(r"//----- \(0000000[0-9A-Fa-f]+\) ----------------------------------------------------")
function_decl_keyword = "Function declarations"
@LemonHaze420
LemonHaze420 / pcmesh.cpp
Created November 22, 2024 17:11
USM Mesh Tools
// Dylan E - 2024
#include <iostream>
#include <ostream>
#include <fstream>
#include <string>
#include <vector>
struct header_t {
int fourcc;
@LemonHaze420
LemonHaze420 / VehicleController.cpp
Created October 9, 2024 07:58
Prototype vehicle controller for UE4/5, mostly written in 2022
// Dylan E. - 2022
#include "VehicleController.h"
#include "NavigationSystem.h"
#include "NavFilters/RecastFilter_UseDefaultArea.h"
#include "NavigationPath.h"
#include "Kismet/GameplayStatics.h"
#include "Kismet/KismetSystemLibrary.h"
@LemonHaze420
LemonHaze420 / 3DAudio.cpp
Created April 20, 2024 06:22
Shenmue 3D audio, sample decompilation
unsigned int Shenmue::CalculateAngleBetweenAngles(float firstFloat, float secondFloat)
{
if ( secondFloat < firstFloat )
{
if ( secondFloat < -firstFloat )
{
if ( secondFloat == 0.0 )
return 32768; // -180 degrees
else
return ((((atanf(firstFloat / secondFloat) * 65536.0) / 6.2831855) + 0.5) + 32768);
@LemonHaze420
LemonHaze420 / find_specific_string.py
Last active November 23, 2024 17:31
Searchin strings in IDA with python
import idaapi as ida
try:
the_string = ida_kernwin.ask_str("", 0, "Please enter a string to search for.")
b = bytearray()
b.extend(map(ord, the_string))
address = ida.get_first_seg().start_ea
while address != BADADDR:
if b == get_bytes(address, len(b)):
print ("Found at 0x%X" % address)
address += 1
@LemonHaze420
LemonHaze420 / silent-hill-2-pc-misc-patches.c
Created September 19, 2022 22:35
some SH2 PC patches
#include "pch.h"
#define UNK2_DebugLog_offs 0x005657C0
#define ADX_DebugLog_offs 0x0055F030
#define UNK_DebugLog_offs 0x005670E0
#define MH_Call(x) status = x; \
if (status != MH_OK) \
return
@LemonHaze420
LemonHaze420 / compare_online_tag_to_our_tag.cpp
Last active July 20, 2022 04:31
compares the latest tag name to the one provided to the function and returns either true/false if it matches
#include <curl\curl.h>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
size_t WriteCallback(char* contents, size_t size, size_t nmemb, void* userp)
{
((std::string*)userp)->append((char*)contents, size * nmemb);
return size * nmemb;
}
@LemonHaze420
LemonHaze420 / bledomctl.sh
Last active September 8, 2022 08:49
Simple BLEDOM LED controller bash script with sample HomeAssistant config. Supports RGB and brightness manipulation.
#!/bin/bash
# Configuration
device="XX:XX:XX:XX:XX:XX"
device_san="XX_XX_XX_XX_XX_XX"
characteristic="/org/bluez/hci0/dev_$device_san/service0006/char0007"
mode=on
brightness=100
red=255