mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-05-07 18:36:09 +08:00
Add a dot to CD labels when longer than 8 characters
This commit is contained in:
parent
c6ef650655
commit
e1d74ab354
@ -298,10 +298,12 @@ void Set_Label(char const * const input, char * const output, bool cdrom) {
|
|||||||
strncpy(upcasebuf, input, 11);
|
strncpy(upcasebuf, input, 11);
|
||||||
//DBCS_upcase(upcasebuf); /* Another mscdex quirk. Label is not always uppercase. (Daggerfall) */
|
//DBCS_upcase(upcasebuf); /* Another mscdex quirk. Label is not always uppercase. (Daggerfall) */
|
||||||
|
|
||||||
(void)cdrom;
|
|
||||||
|
|
||||||
while (togo > 0) {
|
while (togo > 0) {
|
||||||
if(upcasebuf[vnamePos] == 0) str_end = true;
|
if(upcasebuf[vnamePos] == 0) str_end = true;
|
||||||
|
else if(cdrom && vnamePos == 8 && !str_end && upcasebuf[vnamePos] != '.') {
|
||||||
|
output[labelPos] = '.'; // add a dot between 8th and 9th character (Descent 2 installer needs this)
|
||||||
|
labelPos++;
|
||||||
|
}
|
||||||
output[labelPos] = !str_end ? upcasebuf[vnamePos] : 0x0; // Pad empty characters with 0x00
|
output[labelPos] = !str_end ? upcasebuf[vnamePos] : 0x0; // Pad empty characters with 0x00
|
||||||
labelPos++;
|
labelPos++;
|
||||||
vnamePos++;
|
vnamePos++;
|
||||||
|
@ -113,7 +113,7 @@ TEST(Set_Label, Daggerfall)
|
|||||||
TEST(Set_Label, DaggerfallCD)
|
TEST(Set_Label, DaggerfallCD)
|
||||||
{
|
{
|
||||||
std::string output = run_Set_Label("Daggerfall", true);
|
std::string output = run_Set_Label("Daggerfall", true);
|
||||||
EXPECT_EQ("Daggerfall", output);
|
EXPECT_EQ("Daggerfa.ll", output);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Set_Label, LongerThan11)
|
TEST(Set_Label, LongerThan11)
|
||||||
@ -124,7 +124,7 @@ TEST(Set_Label, LongerThan11)
|
|||||||
TEST(Set_Label, LongerThan11CD)
|
TEST(Set_Label, LongerThan11CD)
|
||||||
{
|
{
|
||||||
std::string output = run_Set_Label("a123456789AAA", true);
|
std::string output = run_Set_Label("a123456789AAA", true);
|
||||||
EXPECT_EQ("a123456789A", output);
|
EXPECT_EQ("a1234567.89A", output);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Set_Label, ShorterThan8)
|
TEST(Set_Label, ShorterThan8)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user