// SPDX-FileCopyrightText: 2026 Terin Stock // SPDX-License-Identifier: EUPL-1.2 package toolbox import ( "strings" ) const ( TOOLBOX_COUNT_CDS = 0xDA TOOLBOX_LIST_CDS = 0xD7 TOOLBOX_SET_NEXT_CD = 0xD8 TOOLBOX_LIST_DEVICES = 0xD9 ) // FileType represents the type of file in a [FileEntry]. type FileType uint8 const ( File FileType = iota Directory ) // DeviceType represents the type of emulated device. type DeviceType uint8 const ( Fixed DeviceType = iota Removeable Optical Floppy14MB MO Sequential Network Zip100 None DeviceType = 0xFF ) // FileEntry describes each file recognized by the ODE as // emulatable media. type FileEntry [40]byte // Index is the file's index, to be used with [Device.SetCDByIndex]. func (e *FileEntry) Index() int { return int(e[0]) } // FileType returns the entry's file type. func (e *FileEntry) FileType() FileType { return FileType(e[1]) } // Name is the entry's name, truncated to 32 characters. func (e *FileEntry) Name() string { str := string(e[2:35]) idx := strings.IndexByte(str, 0) if idx < 0 { idx = 33 } return str[:idx] } // Size returns the size of the entry in bytes. func (e *FileEntry) Size() uint64 { return uint64(e[36])<<24 | uint64(e[37])<<16 | uint64(e[38])<<8 | uint64(e[39]) }