Skip to content

Instantly share code, notes, and snippets.

View widberg's full-sized avatar
🚰
Hydrating

widberg widberg

🚰
Hydrating
View GitHub Profile
@widberg
widberg / renderdoc-nvapi-ansel.patch
Last active September 24, 2025 14:17
Patch for RenderDoc to fix some errors with NVAPI and AnselSDK. The error can manifest as CreateTexture2D returning DXGI_ERROR_DEVICE_REMOVED due to RenderDoc returning NULL for nvapi interface 0xd451e834 deep in the call stack for Present in an Ansel DLL. (nvapi.dll, nvapi64.dll, AnselSDK32.dll, AnselSDK64.dll)
diff --git a/renderdoc/driver/ihv/nv/nvapi_hooks.cpp b/renderdoc/driver/ihv/nv/nvapi_hooks.cpp
index 0f4e21245..ff046b434 100644
--- a/renderdoc/driver/ihv/nv/nvapi_hooks.cpp
+++ b/renderdoc/driver/ihv/nv/nvapi_hooks.cpp
@@ -610,6 +610,7 @@ private:
WHITELIST_NVAPI(unknown_func, 0xad298d3f);
WHITELIST_NVAPI(unknown_func, 0x33c7358c);
WHITELIST_NVAPI(unknown_func, 0x593e8644);
+ WHITELIST_NVAPI(unknown_func, 0xd451e834);
default: break;
-borderless
-debugAftermath
-FastLaunch
-force720p
-height <height>
-L # outputs to a path ending in \\ZOUNA_MSG.TXT
-locale <locale>
-noAftermath
-nopsocache
-nosl
AddCheckPoint,Exit,SetFrame,OpenBF,CloseBF,SetSplitType,SetWorldToSplit,SetLodRender,FitOnObject,DisplayImage,DisplayImage2,DisplayExitScreen,PlayMUsic,StopMUsic,PlayMOVie,AddKeyBoard,AddJoyStick,AddMOuse,SetKeyBoard,ShowMapping,ShowInputDebug,ValidateInputs,SetGameLogicAgent,StartTheGame,SetCurrentPlayer,PlayTheMusic,OpenMenu,ReloadMenu,ReturnToMainMenu,SelectCharacterForPlayer,LaunchLevel,FlushTheMusicSequence,AddTheMusicToSequence,ScriptPlayOutro,SouRCe,CLeaR,Help,Pause,SetDBPath,SetDFPath,DontFreezeDisplay,FreezeDisplay,LoadObjectLib,RemoveObjectLib,CheckHandles,LoadMaterialLib,InitRandomSeed,SetBFPath,EnableBF,SetGame,ActivateGame,DeactivateGame,RemoveGame,SetMonoGame,SwitchGameToMono,SwitchGameToMUlti,AddGamePlayer,AddMenuPlayer,ReMoveGamePlayer,REsetGame,DeactivateGamePlayer,ACtivateGamePlayer,PlayerGotoCoord,SwitchCameraUser,SetPersoCamera,MakeCameraPatch,MakeCameraFrame,MakeCameraTexture,EndCameraCapture,ResetCameraZone,SetRTC,LoadRTC,PlayRTC,AddCursorState,MouseDebug,SetFullScreen,DisplayWire,PosPer
CLeaR,SwitchFUllScreen,SwitchGlassesWindow,SwitchFWindow,CheckHandles,AsynchCheckHandles,OpenBF,OpenBFS,DisableBFSExceptFor,CommonBF,CommonBFS,ForceBF,CloseBF,CloneClass,UpdateBF,GetMatrixUsage,ToggleProfileFibers,ToggleDrawFibers,ShowGameServicesInfo,SetSplitType,SetLodRender,SetLIghtingType,SetShadowMapSize,FitOnObject,DisplayImage,MakeVIDEO,CloseVIDEO,WaitRendererReady,UpdateShaderRequest,OutputShadersNonUsed,SetFullscreenBorderless,SetTAASampleCount,SetTemporalSCaling,SetSpatialSCaling,ResetWindowPos,SwitchResolution,TriggerDeviceRemove,DebugDisplayMonitors,PlayMUsic,PlayDIalog,StopMUsic,OpenSBF,CloseSBF,SetWwiseState,InitVoiceRecognition,LoadVoiceRecognitionGrammar,UnloadVoiceRecognitionGrammar,SetVoiceRecognitionGrammarEnabled,SetVoiceRecognitionGrammarDisabled,CompileVoiceRecognitionGrammars,SetVoiceRecognitionRuleState,STARTVoiceRecognition,STOPVoiceRecognition,EmulateVoice,PlayMOVie,AddJoyStick,ACtivateJoyStick,ActivateXCloudOverlay,ForceOverLay,SCanControl,ProtATest,SToReBuy,SToReLiST,INVentoryLiST,
CLeaR,SwitchFUllScreen,SwitchGlassesWindow,SwitchFWindow,CheckHandles,AsynchCheckHandles,OpenBF,OpenBFS,ForceBF,CloseBF,ClosingBFS,CloneClass,DumpBFS,UpdateBF,GetMatrixUsage,SetSplitType,SetLodRender,SetLIghtingType,SetLodTexture,SetMaxAnisotropy,SetShadowMapSize,SetTExtureFiltering,FitOnObject,DisplayImage,MakeAVI,CloseAVI,MakeVIDEO,CloseVIDEO,WaitRendererReady,UpdateShaderRequest,SetStereoUserIpd,SetFullscreenBorderless,SetTAASampleCount,SetTemporalSCaling,SetSpatialSCaling,SetDownscaleFactor,ResetWindowPos,SwitchResolution,DebugDisplayMonitors,PrintShaderDeclStats,ShowOnlyThisShaderDecl,IgnoreThisShaderDecl,PlayMUsic,PlayDIalog,StopMUsic,OpenSBF,CloseSBF,InitVoiceRecognition,LoadVoiceRecognitionGrammar,UnloadVoiceRecognitionGrammar,SetVoiceRecognitionGrammarEnabled,SetVoiceRecognitionGrammarDisabled,CompileVoiceRecognitionGrammars,SetVoiceRecognitionRuleState,STARTVoiceRecognition,STOPVoiceRecognition,EmulateVoice,PlayMOVie,AddJoyStick,ACtivateJoyStick,SCanControl,RegisterNetManager,InstallGameFiles,TakePr
// The Witness Console Command Runner Frida Agent
// Usage:
// launch the game with "frida -l "the_witness_console.js" -f witness64_d3d11.exe"
// * Run print_commands() in the frida repl to print registered command names. (the help command
// doesn't list them all)
// * Run something like cmd("command argument0 argument1") to run commands.
// Some commands I tried:
// * The "go" command accepts marker names, run print_gotos() to print a list of marker names the
// game knows about, they don't all have names.
// * If you are clicked into a panel and drawing a line "solve_panel" will print out a shit tonne of
#!/usr/bin/env python3
# A Little To The Left Save Editor
# Usage: python3 a_little_to_the_left_save_editor.py decrypt save1.json save1_decrypted.json
# Usage: python3 a_little_to_the_left_save_editor.py encrypt save1_decrypted.json save1.json
# See https://www.pcgamingwiki.com/wiki/A_Little_to_the_Left for save file locations
# Backup your save file before using this script
import argparse
import json
SHIFT = 11
#!/usr/bin/env python3
# Monster Prom Save Editor
# Usage: python3 monster_prom_save_editor.py decrypt 76561198083837418_GameProgress.xml 76561198083837418_GameProgress_decrypted.xml
# Usage: python3 monster_prom_save_editor.py encrypt 76561198083837418_GameProgress_decrypted.xml 76561198083837418_GameProgress.xml
# See https://www.pcgamingwiki.com/wiki/Monster_Prom for save file locations
# Backup your save file before using this script
import argparse
import base64
import xml.etree.ElementTree as ET
@widberg
widberg / find-compressed-data.py
Created May 24, 2025 01:01 — forked from nstarke/find-compressed-data.py
Find Compressed Data without Compression Header
#!/usr/bin/env python3
#
# find-compressed-data.py
#
# A small script to bruteforce embedded compressed data that might not have a header
# Useful for raw binary firmware images that do not contain a standard
# binary header (ELF, PE, MACH-O).
#
# I included a limt on size at 16KB because this has a tendency to create
"""
This script converts BMFONT FNT XML files to [bff](https://github.com/widberg/bff) Fonts_Z JSON files.
It was originally posted in the [Zouna Underground Discord](https://discord.gg/CQgMNbYeUR) by Ahmed Khaled.
"""
import json
import xml.etree.ElementTree as ET
import os
import sys
import tkinter as tk