Skip to content

Commit 8d8c491

Browse files
Merge pull request #6197 from maron2000/fix_mscdex
Fix MSCDEX device name padding for short names
2 parents 6ec90a6 + 20ec095 commit 8d8c491

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ NEXT VERSION
99
check (maron2000)
1010
- Fixed window position not centered even when windowposition option is set
1111
to do so. (maron2000)
12+
- Fixed MSCDEX device name padding for short names (maron2000)
1213

1314
2026.03.29
1415
- Add dosbox.conf option to control the duration of the beep when

src/dos/dos_mscdex.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,14 @@ class DOS_DeviceHeader:public MemStruct {
6565
void SetDriveLetter (uint8_t letter) { sSave(sDeviceHeader,driveLetter,letter); };
6666
void SetNumSubUnits (uint8_t num) { sSave(sDeviceHeader,numSubUnits,num); };
6767
uint8_t GetNumSubUnits (void) { return sGet(sDeviceHeader,numSubUnits); };
68-
void SetName (char const* _name) { MEM_BlockWrite(pt+offsetof(sDeviceHeader,name),_name,8); };
68+
void SetName (char const* _name) {
69+
char buf[8];
70+
size_t len = strlen(_name);
71+
memset(buf, ' ', 8);
72+
memcpy(buf, _name, (len < 8) ? len : 8);
73+
74+
MEM_BlockWrite(pt + offsetof(sDeviceHeader, name), buf, 8);
75+
};
6976
void SetInterrupt (uint16_t ofs) { sSave(sDeviceHeader,interrupt,ofs); };
7077
void SetStrategy (uint16_t ofs) { sSave(sDeviceHeader,strategy,ofs); };
7178

0 commit comments

Comments
 (0)