Adding modding folder with a hacked build.

This commit is contained in:
ml
2026-09-26 08:53:08 +02:00
parent cdb960dc71
commit c91080aba7
755 changed files with 50424 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
package crash
// Handler is a function that tries to preserve some panic/stack info to the user.
var Handler = func(versionInfo string) {}
+42
View File
@@ -0,0 +1,42 @@
package crash
//#include <windows.h>
import "C"
import (
"fmt"
"runtime/debug"
"unsafe"
)
func init() {
Handler = windowsHandler
}
func windowsHandler(versionInfo string) {
if e := recover(); e != nil {
text := `There was a crash in the application. This is bad and I am sorry.
Perhaps you can make something with the details of the error below.
If you can reproduce this, please make a screenshot of this box and report it with details on the http://www.systemshock.org forums.
Thank you!
`
text += fmt.Sprintf("%s:\n%s", e, debug.Stack())
messageBox(text, "Something unexpected happened - "+versionInfo)
}
}
func messageBox(text, caption string) {
textArg, textFin := wrapString(text)
defer textFin()
captionArg, captionFin := wrapString(caption)
defer captionFin()
var hwnd unsafe.Pointer
C.MessageBoxExA((*C.struct_HWND__)(hwnd), textArg, captionArg, C.UINT(0), C.WORD(0))
}
func wrapString(value string) (wrapped *C.char, finisher func()) {
wrapped = C.CString(value)
finisher = func() { C.free(unsafe.Pointer(wrapped)) } // nolint: gas
return
}