mirror of
https://github.com/thunderbrewhq/binana.git
synced 2025-12-12 09:52:28 +00:00
feat(profile): binana x64dbg-gen now generates a types file from C source headers
This commit is contained in:
parent
e3ec21ecec
commit
5d5630a6cb
19 changed files with 2961 additions and 354 deletions
51
go/profile/open.go
Normal file
51
go/profile/open.go
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
package profile
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/thunderbrewhq/binana/go/symfile"
|
||||
)
|
||||
|
||||
type Profile struct {
|
||||
Directory string
|
||||
SymbolTable *symfile.InMemoryTable
|
||||
}
|
||||
|
||||
func Open(profile_directory string) (profile *Profile, err error) {
|
||||
var dir fs.FileInfo
|
||||
dir, err = os.Stat(profile_directory)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if !dir.IsDir() {
|
||||
err = fmt.Errorf("profile: game profile is not a directory")
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println("Opening profile", profile_directory)
|
||||
|
||||
profile = new(Profile)
|
||||
profile.Directory = profile_directory
|
||||
|
||||
path_to_symbols_file := filepath.Join(profile_directory, "symbol", "main.sym")
|
||||
var symbols_file *os.File
|
||||
symbols_file, err = os.Open(path_to_symbols_file)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
profile.SymbolTable = new(symfile.InMemoryTable)
|
||||
|
||||
if err = symfile.Load(profile.SymbolTable, symbols_file); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
symbols_file.Close()
|
||||
|
||||
//
|
||||
return
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue