Commit Graph

41 Commits (63b8e636f391e80388a7d7a5077c16cf9847fd64)

Author SHA1 Message Date
Evil Eye 5a0aed3a78 Use more decomposition, string_view, and implicit sizes in ESM code 9 months ago
AnyOldName3 818a99a870 Review 9 months ago
Evil Eye a9e6e63c4e Remove fixed size reads 1 year ago
Petr Mikheev 32f3a16db3 Change FormId::toString to be consistent with RefId. Remove FormIdRefId. 1 year ago
Petr Mikheev 9a9f9d7081 Adjust FormId in FormIdRefId and for items in containers when loading saves 1 year ago
Evil Eye 45ba05c0ed Disallow implicitly sized reads of ESM structs 1 year ago
Alexei Dobrohotov 66fd1f8862 Allow subrecords to overlap the following record (bug #6025) 1 year ago
elsid f6fce5ee15
Cleanup includes 2 years ago
elsid 0601d7213e
Remove ESM::RefId::sEmpty
This variable is only required to return empty RefId as const reference. There
is no point in doing so for a type cheap to copy.
2 years ago
Petr Mikheev f09a689a4f Merge ESM::RefNum and ESM4::FormId 2 years ago
florent.teppe 21bd28542a Applies review advice
2d coord hash moved to hash.hpp file
format version adds suffix to be more coherent
don't use ESM::RefId::sEmpty
RefId equality with string_view, conversion to refId unecessary
action teleport remove test that mCellId is empty
removes some const references, when copy is enough
invalid refid => empty refid
removes useless change
2 years ago
florent.teppe d782d37ee2 Make sure Vec2iRefId is trivially copyable on GCC 11.3
std::pair<int, int> isn't trivially copyable on some compilers
so a specific struct is defined, it's an int pair, but it should be recognised by GCC 11.3 as trivially copyable

Vec2iRefId => ESM3ExteriorCellRefId

more explcit name and use mX,mY instead of pair
renamed files and enum
2 years ago
florent.teppe 4c15064a83 Create new Vec2i RefId for ESM3 exterior cells.
Applies the necessary changes to use !2708 for the new Id type
2 years ago
florent.teppe c2182c2fcc Get Rid of ESM::CellId almost everywhere
it was a competing concept from using RefIds for cell.
There is almost no point to it now, except to load older data.
2 years ago
florent.teppe fb6701ac1a ESM::CellId is no longer stored on saves. 2 years ago
florent.teppe c39dd576f8 Gets rid of most ESM::CellId 2 years ago
elsid e6cf516e12
Support index RefId as pair of record type and std::uint32_t 2 years ago
elsid 86293af084
Support generated RefId as std::uint64_t 2 years ago
elsid 0992624c8b
Support reading and writing typed ESM::RefId to ESM 2 years ago
elsid 6d261d38dd
Add functions to read and write ESM::RefId and use them
To be later changed with another implementation.
2 years ago
elsid 80e6d6cbe3
Support variable size strings in ESM3 2 years ago
elsid 2e64155c0f
Use signed type for left record and files size in ESM3 reader context
Otherwise reading some of the records like ESM::CellRef without a subrecord
after could lead to underflow of ESM_Context::leftRec which makes
ESM::ESMReader::hasMoreSubs to return true and load hangs for a while trying to
read the same subrecord many times.

Fix ESM::Variant tests since it's now required to have a record for any ESM
data. Add 16 (size of record header) to all expected data sizes.
2 years ago
florent.teppe 65cdd489fb create a specific esm reader function for RefID to avoid allocation for string and then again for RefId
Fixed some types

removed useless header

applied clang format

fixed compile tests

fixed clang tidy, and closer to logic before this MR

Removed hardcoded refids

unless there is a returned value we don't use static RefIds
can use == between RefId and hardcoded string

Fix clang format

Fixed a few instances where std::string was used, when only const std::string& was needed

removed unused variable
2 years ago
fteppe 125b21de20 Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID

Slowly going through all the changes to make, still hundreds of errors

a lot of functions/structures use std::string or stringview to designate an ID. So it takes time

Continues slowly replacing ids. There are technically more and more compilation errors

I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type

Continue moving forward, changes to the stores

slowly moving along

Starting to see the fruit of those changes.

still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.

More replacements. Things are starting to get easier

I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.

Still moving forward, and for the first time error count is going down!

Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably

Cells are back to using string for the name, haven't fixed everything yet. Many other changes

Under the bar of 400 compilation errors.

more good progress <100 compile errors!

More progress

Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string

some more progress on other fronts

Mostly game settings clean

one error opened a lot of other errors. Down to 18, but more will prbably appear

only link errors left??

Fixed link errors

OpenMW compiles, and launches, with some issues, but still!
2 years ago
clang-format-bot ddb0522bbf
Apply clang-format to code base 2 years ago
Project579 a13709c510 Replace implicit convertions from std::filesystem::path to std::string with correctly converting functions. 2 years ago
Project579 e5c417c968 Make sure all paths are passed as std::filesystem::path instead of std::string where possible. 2 years ago
elsid f99ed6f1db
Split components/misc/stringops.hpp into multiple headers
Replace all ciEqual overloads with one having std::string_view as argument.
2 years ago
elsid 3affe9913f
Limit the number of simultaneously open not actively used content files
Use LRU cache for ESMReaders. When cache capacity is reached close least
recently used ESMReader. Remember the file name if a reader was open. Once the
reader requested again open the file if there is stored name for it. Put
released ESMReader to the back of the free items list. Close ESMReader's from
the front of the free items list.

Cached item can be used only by one client at the same time. If the same item is
requested twice exception is thrown. This should never happen in practice. If
this happens need to fix the client logic.

It's allowed to go over the capacity limit when requesting different readers.
Ideally this should never happen but there will be system error anyway
signalizing about too many open files. Need to fix client logic in this case.

All places that were using a vector of ESMReaders now using the cache. Cache is
local for each use case and there is no need for a thread safety.
3 years ago
jvoisin 6feb92a9bf Remove boost::filesystem from a couple of files 3 years ago
jvoisin 23eccebe9e Convert esmtool from `const std::string&` to `std::string_view` 3 years ago
elsid b09570692e
Use ifstream for ESMReader
ESMReader reads the whole file, there is no need in the ConstrainedFileStream.
3 years ago
psi29a 03806eb75e Merge branch 'esm_rm_redundant_include' into 'master'
Remove redundant include from esm3/esmreader.hpp

See merge request OpenMW/openmw!1761
3 years ago
elsid 5eb8c4aebe
Avoid redundant conversion to const char* and use make_shared 3 years ago
elsid db44f91fd5
Remove redundant include from esm3/esmreader.hpp 3 years ago
elsid bbfdb347bd
Skip load cell ref when there is no need
Primarily to avoid temporary allocations by ESMReader::getHString.
3 years ago
elsid 3305b400dc
Use ESM::NAME instead of const char* and std::string as argument type 3 years ago
elsid c75e938c46
Return string_view from Utf8Encoder functions
To avoid redundant std::string constructions.
3 years ago
elsid c9c7fb7e49
Remove redundant functions from Utf8Encoder interface 3 years ago
elsid 45db56b382
Rework fixed string
* Avoid inheritance.
* Define equality operators out of the class definition.
* Replace toString with toStringView where it doesn't make sense to create a string.
3 years ago
Bret Curtis d1fb854521 move most of the files from esm to esm3, keep common code in esm; this is make space for a future with esm4
esm typo

esm typo
3 years ago