Skip to content

Commit df2ad30

Browse files
committed
more prefs chunk parsing
1 parent 3f0ba16 commit df2ad30

File tree

3 files changed

+689
-3
lines changed

3 files changed

+689
-3
lines changed

internal/chunks/database.go

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,12 @@ var structData = map[string]ChunkData{
116116
"PREF.ICTL": {handlePrefIctl, "IControl Preferences"},
117117
"PREF.INPT": {handlePrefInpt, "Input Preferences"},
118118
"PREF.KMSW": {handlePrefKmsw, "Keyboard/Mouse Preferences"},
119-
"PREF.LCLE": {nil, "Locale Preferences"},
120-
"PREF.PALT": {nil, "Palette Preferences"},
119+
"PREF.LCLE": {handlePrefLcle, "Locale Preferences"},
120+
"PREF.OSCN": {handlePrefOscn, "Overscan Preferences"},
121+
"PREF.PALT": {handlePrefPalt, "Palette Preferences"},
121122
"PREF.CMAP": {handleIlbmCmap, "Color Map"},
122-
"PREF.NPTR": {nil, "Pointer Preferences"},
123+
"PREF.PNTR": {handlePrefPntr, "Pointer Preferences"},
124+
"PREF.NPTR": {handlePrefNptr, "New Pointer Preferences"}, // AROS specific
123125
"PREF.PTXT": {nil, "Printer Preferences"},
124126
"PREF.PUNT": {nil, "Printer Unit Preferences"},
125127
"PREF.PDEV": {nil, "Printer Device Preferences"},
@@ -275,3 +277,20 @@ func getStringBuffer(data []byte, offset *uint32, bufLen uint32) (string, error)
275277
*offset += bufLen
276278
return result, nil
277279
}
280+
281+
// getStringBuffer reads a string from the data at the given offset.
282+
// The numer of bytes to read is given by bufLen. The offset is incremented
283+
// by the bufLen.
284+
// In case of an error, it returns "" and the error. The offset is unchanged.
285+
func getByteBuffer(data []byte, offset *uint32, bufLen uint32) ([]byte, error) {
286+
var result []byte
287+
288+
if len(data) < int(*offset+bufLen) {
289+
return nil, fmt.Errorf("data too short for []byte")
290+
}
291+
high := int(*offset + bufLen)
292+
result = data[*offset:high]
293+
294+
*offset += bufLen
295+
return result, nil
296+
}
File renamed without changes.

0 commit comments

Comments
 (0)