Update and fix certain routines

pull/3/head
Minizbot2012 4 years ago
parent 262bf344ec
commit 2b41478166
No known key found for this signature in database
GPG Key ID: 977C8ADE12361917

@ -2,6 +2,7 @@ package orbweaver
import ( import (
"encoding/binary" "encoding/binary"
"fmt"
"fyne.io/fyne" "fyne.io/fyne"
"github.com/minizbot2012/orbbind/keys" "github.com/minizbot2012/orbbind/keys"
@ -16,20 +17,18 @@ type PKM struct {
//SaveIntoKeymap saves an orb //SaveIntoKeymap saves an orb
func SaveIntoKeymap(mapped *PKM, file fyne.FileWriteCloser) { func SaveIntoKeymap(mapped *PKM, file fyne.FileWriteCloser) {
buf := make([]byte, 2)
for i := 0; i < 26; i++ { for i := 0; i < 26; i++ {
if i < 26 { if i < 20 {
buf := make([]byte, 2) binary.LittleEndian.PutUint16(buf, uint16(keys.GetSCForASCII(int(byte(mapped.MIP[i])))))
if i < 20 {
binary.LittleEndian.PutUint16(buf, uint16(keys.GetSCForASCII(int(byte(mapped.MIP[i])))))
} else {
binary.LittleEndian.PutUint16(buf, uint16(keys.GetSCForASCII(int(byte(mapped.SIP[i-20])))))
}
file.Write(buf)
} else { } else {
arr := []byte{byte(mapped.COL[0]), byte(mapped.COL[1]), byte(mapped.COL[2])} binary.LittleEndian.PutUint16(buf, uint16(keys.GetSCForASCII(int(byte(mapped.SIP[i-20])))))
file.Write(arr)
} }
fmt.Println(i, buf)
file.Write(buf)
} }
arr := []byte{byte(mapped.COL[0]), byte(mapped.COL[1]), byte(mapped.COL[2])}
file.Write(arr)
file.Close() file.Close()
} }

Loading…
Cancel
Save