mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 06:08:35 +00:00
GOB: Fix the save list width
The length of the slot 0 string determines the list's width svn-id: r55426
This commit is contained in:
parent
185a0b9070
commit
40a4b09246
@ -77,10 +77,13 @@ int32 SlotFileIndexed::tallyUpFiles(uint32 slotSize, uint32 indexSize) const {
|
||||
}
|
||||
|
||||
void SlotFileIndexed::buildIndex(byte *buffer, SavePartInfo &info,
|
||||
SaveConverter *converter) const {
|
||||
SaveConverter *converter, bool setLongest) const {
|
||||
|
||||
uint32 descLength = info.getDescMaxLength();
|
||||
|
||||
uint32 longest = 0;
|
||||
byte *bufferStart = buffer;
|
||||
|
||||
// Iterate over all files
|
||||
for (uint32 i = 0; i < _slotCount; i++, buffer += descLength) {
|
||||
Common::String slotFile = build(i);
|
||||
@ -100,10 +103,19 @@ void SlotFileIndexed::buildIndex(byte *buffer, SavePartInfo &info,
|
||||
|
||||
delete[] desc;
|
||||
|
||||
longest = MAX<uint32>(longest, strlen((const char *) buffer));
|
||||
|
||||
} else
|
||||
// No valid slot, fill with 0
|
||||
memset(buffer, 0, descLength);
|
||||
}
|
||||
|
||||
if (setLongest) {
|
||||
uint32 slot0Len;
|
||||
for (slot0Len = strlen((const char *) bufferStart); slot0Len < longest; slot0Len++)
|
||||
buffer[slot0Len] = ' ';
|
||||
buffer[slot0Len] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
bool SlotFileIndexed::exists(int slot) const {
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
|
||||
/** Creates an index in buffer. */
|
||||
virtual void buildIndex(byte *buffer, SavePartInfo &info,
|
||||
SaveConverter *converter = 0) const;
|
||||
SaveConverter *converter = 0, bool setLongest = false) const;
|
||||
|
||||
virtual bool exists(int slot) const;
|
||||
virtual Common::InSaveFile *openRead(int slot) const;
|
||||
|
@ -547,7 +547,7 @@ void SaveLoad_v6::GameHandler::buildIndex(byte *buffer) const {
|
||||
SavePartInfo info(kSlotNameLength, (uint32) _vm->getGameType(),
|
||||
0, _vm->getEndianness(), varSize);
|
||||
|
||||
_slotFile->buildIndex(buffer, info);
|
||||
_slotFile->buildIndex(buffer, info, 0, true);
|
||||
}
|
||||
|
||||
void SaveLoad_v6::GameHandler::refreshProps() {
|
||||
|
Loading…
Reference in New Issue
Block a user