7c22ae1f02
- remove diagnostic canaries from audio hot path (crackle fix) and stuck C5 note raw-MIDI test (Vst2Instrument::init noteOff) - split native bridge into daw_vst_bridge (VSTi) + fx_vst_bridge (VST FX) - VST3: processData prepare before setActive, zero input buses, accept both .vstpreset and bridge-state blob in RenderJob presets - native_render/vst_engine: bridge-exe discovery + render_fx_chain + /fx-gui - delete old install/ engine binaries (install via sidecar+resources now) - add BUILD_LAYOUT.md, build_selfcheck, tools/ diagnostics
40 lines
1.7 KiB
Python
40 lines
1.7 KiB
Python
import sys
|
|
|
|
p = r"C:/Users/locpham/SonicForgeStudio/native_bridge/src/main.cpp"
|
|
data = open(p, "rb").read()
|
|
|
|
def rep(old, new, count=1):
|
|
global data
|
|
old = old.encode(); new = new.encode()
|
|
assert data.count(old) >= count, "pattern not found: %r" % old
|
|
data = data.replace(old, new, count)
|
|
|
|
# 1. vectored handler ghi dump cho first-chance; cai gan CrashDumpHandler
|
|
vectored = r"""
|
|
// Vectored handler: catches first-chance exceptions INCLUDING heap-corruption
|
|
// raises that never reach SetUnhandledExceptionFilter (0xC0000374 observed to
|
|
// bypass it on this machine). Writes the same minidump then continues.
|
|
#ifdef _WIN32
|
|
static LONG WINAPI VectoredCrashHandler(PEXCEPTION_POINTERS ep) {
|
|
PEXCEPTION_RECORD er = ep ? ep->ExceptionRecord : nullptr;
|
|
DWORD code = er ? er->ExceptionCode : 0;
|
|
if (code != 0xC0000374 && code != 0xC0000005 && code != 0xC0000409) {
|
|
return EXCEPTION_CONTINUE_SEARCH; // ignore benign first-chance noise
|
|
}
|
|
std::cerr << "[VCRASH] first-chance code=0x" << std::hex << code
|
|
<< " addr=0x" << (er ? (void*)er->ExceptionAddress : nullptr)
|
|
<< std::dec << " tid=" << GetCurrentThreadId() << std::endl;
|
|
// route into the same dump writer
|
|
return CrashDumpHandler(ep) == EXCEPTION_CONTINUE_SEARCH
|
|
? EXCEPTION_CONTINUE_SEARCH
|
|
: EXCEPTION_CONTINUE_SEARCH;
|
|
}
|
|
#endif
|
|
"""
|
|
|
|
rep("int main(int argc, char* argv[]) {\n SetUnhandledExceptionFilter(CrashDumpHandler);\n",
|
|
vectored + "\nint main(int argc, char* argv[]) {\n SetUnhandledExceptionFilter(CrashDumpHandler);\n AddVectoredExceptionHandler(1, VectoredCrashHandler);\n")
|
|
|
|
open(p, "wb").write(data)
|
|
print("patched OK, size=", len(data))
|