mirror of
https://github.com/BertoldVdb/ms-tools.git
synced 2025-12-10 07:44:46 +01:00
Enable call function for MS2130
This commit is contained in:
parent
162cc22d62
commit
bc6f0b327d
3 changed files with 17 additions and 1 deletions
Binary file not shown.
16
mshal/hal.go
16
mshal/hal.go
|
|
@ -1,6 +1,8 @@
|
||||||
package mshal
|
package mshal
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
|
|
||||||
"github.com/BertoldVdb/ms-tools/gohid"
|
"github.com/BertoldVdb/ms-tools/gohid"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -16,6 +18,7 @@ type HAL struct {
|
||||||
patchCallAddrs []int
|
patchCallAddrs []int
|
||||||
|
|
||||||
patchInstalled bool
|
patchInstalled bool
|
||||||
|
patchCanCall bool
|
||||||
|
|
||||||
config HALConfig
|
config HALConfig
|
||||||
ms2130spiEnabled int
|
ms2130spiEnabled int
|
||||||
|
|
@ -114,6 +117,19 @@ func New(dev gohid.HIDDevice, config HALConfig) (*HAL, error) {
|
||||||
|
|
||||||
h.config.LogFunc(1, "Assumed EEPROM Size: %d", h.eepromSize)
|
h.config.LogFunc(1, "Assumed EEPROM Size: %d", h.eepromSize)
|
||||||
|
|
||||||
|
/* MS2130 can be running code from flash that is pre-patched. This is a hack to allow
|
||||||
|
* using that even withtout offset discovery */
|
||||||
|
if h.deviceType == 2130 {
|
||||||
|
var id [4]byte
|
||||||
|
if _, err := xdata.Access(false, 0x7b00, id[:]); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if bytes.Equal(id[:], []byte("BVDB")) {
|
||||||
|
h.patchCanCall = true
|
||||||
|
h.config.LogFunc(1, "MS213x firmware supports calling functions")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return h, nil
|
return h, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ type PatchExecFuncRequest struct {
|
||||||
func (h *HAL) PatchExecFunc(inIRQ bool, addr int, req PatchExecFuncRequest) (PatchExecFuncResponse, error) {
|
func (h *HAL) PatchExecFunc(inIRQ bool, addr int, req PatchExecFuncRequest) (PatchExecFuncResponse, error) {
|
||||||
var response PatchExecFuncResponse
|
var response PatchExecFuncResponse
|
||||||
|
|
||||||
if !h.patchInstalled {
|
if !h.patchInstalled && !h.patchCanCall {
|
||||||
return response, ErrorMissingFunction
|
return response, ErrorMissingFunction
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue