forked from ddnet/ddnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Load datafile into memory instead of keeping file open
When loading a datafile (map) with `CDataFileReader`, immediately read the entire map file into memory and perform all further operations on the memory buffer. This allows the file to be closed immediately after reading it into memory, so map files can be written in the editor while the respective map is loaded on a server or by another client or tool. Remove `CDataFileReader::File` and `CMap::File`, as the file is immediately closed after reading and also not exposed to the datafile reader anymore. Rename `CDataFileReader::MapSize` and `CMap::MapSize` to `FileSize` and make them return the actual size of the map that was read into memory instead of the size that is declared in the datafile header. Add `CDataFileReader::FileData` and `CMap::FileData` to get a `const` pointer to the entire file memory buffer. Internally add `CDataFileMemoryReader` to handle reading operations on the memory buffer as replacement for `io_read` and `io_seek` reading from the file.
- Loading branch information
Showing
8 changed files
with
113 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.