Gleb Mazovetskiy
88f706e0d1
SDL3: Add some backports / compat helpers
5 months ago
Gleb Mazovetskiy
8f6e9810d0
SDL3: Make `text_render_integration_test` build
...
Adds support for just enough SDL3 to make `text_render_integration_test`
work.
5 months ago
Anders Jenbo
01507d532c
Add basic DOS port ( #8155 )
7 months ago
Anders Jenbo
1c76897f2c
Apply simple const rules using clang-tidy
7 months ago
Gleb Mazovetskiy
58fe44f836
init.h -> init.hpp
10 months ago
staphen
d9dc49199f
Do not depend on FileExists() when opening save files for writing
1 year ago
staphen
a4f38d5dd4
Avoid write mode when opening save files
1 year ago
pionere
96392116e0
prevent the overwrite of existing mpq files (requires C++17)
...
fixes #7672
1 year ago
Gleb Mazovetskiy
d7647d6c63
More dependency untangling
...
1. Moves more assets-related stuff from `init` to `engine/assets`.
2. Removes `SDL_audiolib` dependency from `soundsample.h`.
3. Cleans up some unused/missing includes.
1 year ago
Gleb Mazovetskiy
c31836eab8
Split up `engine.{h,cpp}`
...
Untangles dependencies by splitting up `engine.{h,cpp}` into 3 files:
1. `primitive_render`
2. `ticks` -- only contains `GetAnimationFrame` for now.
3. `GetWidth2` renamed to `CalculateSpriteTileCenterX` and moved to `levels/dun_tile.hpp`.
1 year ago
Gleb Mazovetskiy
dd76f17e4b
Rename endian.hpp to endian_read.hpp
...
Following #7620 , which split the write functions into a separate header.
1 year ago
Gleb Mazovetskiy
3d716f74d3
Add dun_render_benchmark
...
Results from a single run (a bit noisy) on my machine:
```
tools/build_and_run_benchmark.py dun_render_benchmark
```
```
------------------------------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations UserCounters...
------------------------------------------------------------------------------------------------------------------------
DunRenderBenchmark/LeftTriangle_Solid_FullyLit 98297 ns 98282 ns 8840 items_per_second=15.1096M/s
DunRenderBenchmark/LeftTriangle_Solid_FullyDark 124727 ns 124701 ns 6973 items_per_second=11.9085M/s
DunRenderBenchmark/LeftTriangle_Solid_PartiallyLit 514869 ns 514747 ns 1700 items_per_second=2.88491M/s
DunRenderBenchmark/LeftTriangle_Transparent_FullyLit 520312 ns 520216 ns 1682 items_per_second=2.85458M/s
DunRenderBenchmark/LeftTriangle_Transparent_FullyDark 524440 ns 524331 ns 1664 items_per_second=2.83218M/s
DunRenderBenchmark/LeftTriangle_Transparent_PartiallyLit 532300 ns 532162 ns 1647 items_per_second=2.7905M/s
DunRenderBenchmark/RightTriangle_Solid_FullyLit 92387 ns 92363 ns 8840 items_per_second=16.7275M/s
DunRenderBenchmark/RightTriangle_Solid_FullyDark 85680 ns 85662 ns 9884 items_per_second=18.0361M/s
DunRenderBenchmark/RightTriangle_Solid_PartiallyLit 538347 ns 538250 ns 1626 items_per_second=2.87041M/s
DunRenderBenchmark/RightTriangle_Transparent_FullyLit 548800 ns 548760 ns 1598 items_per_second=2.81544M/s
DunRenderBenchmark/RightTriangle_Transparent_FullyDark 540450 ns 540369 ns 1620 items_per_second=2.85916M/s
DunRenderBenchmark/RightTriangle_Transparent_PartiallyLit 555061 ns 555003 ns 1575 items_per_second=2.78377M/s
DunRenderBenchmark/TransparentSquare_Solid_FullyLit 700849 ns 700751 ns 1320 items_per_second=3.68176M/s
DunRenderBenchmark/TransparentSquare_Solid_FullyDark 664927 ns 664872 ns 1389 items_per_second=3.88045M/s
DunRenderBenchmark/TransparentSquare_Solid_PartiallyLit 1131702 ns 1131559 ns 822 items_per_second=2.28004M/s
DunRenderBenchmark/TransparentSquare_Transparent_FullyLit 1022384 ns 1022267 ns 916 items_per_second=2.5238M/s
DunRenderBenchmark/TransparentSquare_Transparent_FullyDark 1023193 ns 1023057 ns 900 items_per_second=2.52185M/s
DunRenderBenchmark/TransparentSquare_Transparent_PartiallyLit 1033573 ns 1033496 ns 895 items_per_second=2.49638M/s
DunRenderBenchmark/Square_Solid_FullyLit 53532 ns 53524 ns 10000 items_per_second=30.8272M/s
DunRenderBenchmark/Square_Solid_FullyDark 41993 ns 41987 ns 19794 items_per_second=47.1573M/s
DunRenderBenchmark/Square_Solid_PartiallyLit 842772 ns 842615 ns 1108 items_per_second=1.56655M/s
DunRenderBenchmark/Square_Transparent_FullyLit 834105 ns 834026 ns 1119 items_per_second=1.58269M/s
DunRenderBenchmark/Square_Transparent_FullyDark 831912 ns 831823 ns 1122 items_per_second=1.58688M/s
DunRenderBenchmark/Square_Transparent_PartiallyLit 924638 ns 924536 ns 1010 items_per_second=1.42774M/s
DunRenderBenchmark/LeftTrapezoid_Solid_FullyLit 33728 ns 33725 ns 24962 items_per_second=18.8583M/s
DunRenderBenchmark/LeftTrapezoid_Solid_FullyDark 31088 ns 31085 ns 27444 items_per_second=20.4601M/s
DunRenderBenchmark/LeftTrapezoid_Solid_PartiallyLit 268792 ns 268768 ns 3254 items_per_second=1.97196M/s
DunRenderBenchmark/LeftTrapezoid_Transparent_FullyLit 277990 ns 277965 ns 3140 items_per_second=1.90672M/s
DunRenderBenchmark/LeftTrapezoid_Transparent_FullyDark 268952 ns 268912 ns 3250 items_per_second=1.9709M/s
DunRenderBenchmark/LeftTrapezoid_Transparent_PartiallyLit 288869 ns 288826 ns 3056 items_per_second=1.83501M/s
DunRenderBenchmark/RightTrapezoid_Solid_FullyLit 29581 ns 29576 ns 28347 items_per_second=21.0984M/s
DunRenderBenchmark/RightTrapezoid_Solid_FullyDark 25315 ns 25312 ns 32250 items_per_second=24.6523M/s
DunRenderBenchmark/RightTrapezoid_Solid_PartiallyLit 259977 ns 259960 ns 3312 items_per_second=2.0003M/s
DunRenderBenchmark/RightTrapezoid_Transparent_FullyLit 263079 ns 263056 ns 3322 items_per_second=1.97677M/s
DunRenderBenchmark/RightTrapezoid_Transparent_FullyDark 259849 ns 259824 ns 3364 items_per_second=2.00136M/s
DunRenderBenchmark/RightTrapezoid_Transparent_PartiallyLit 279623 ns 279594 ns 3127 items_per_second=1.85984M/s
```
2 years ago
obligaron
9964ff8721
Fix MSVC warning in SDL1
2 years ago
Gleb Mazovetskiy
76c90e34a9
mpq_sdl_rwops: Fix -Wtype-limits
...
Fixes the following warning:
mpq/mpq_sdl_rwops.cpp:82:25: warning: comparison of unsigned expression in '< 0' is always false [-Wtype-limits]
82 | if (newPosition < 0) {
2 years ago
obligaron
95205294e8
Fix MSVC x86 warnings
2 years ago
obligaron
780015bfd4
Fix warnings in MpqWriter
2 years ago
obligaron
63f4f3896e
Fix warnings in SDL_RWops_FromMpqFile
2 years ago
Gleb Mazovetskiy
16a6fc62e1
Deduplicate some of the MPQ handling
...
Reuse libmpq functions where possible instead of our own.
3 years ago
Gleb Mazovetskiy
4a4735e908
`string_view`-based asset lookup
...
Changes asset lookup functions to use `std::string_view` instead of
`const char *`.
This required new APIs in libmpq, added in
https://github.com/diasurgical/libmpq/pull/13 .
3 years ago
Gleb Mazovetskiy
14540164a7
Remove utils/stdcompat/optional.hpp
3 years ago
Gleb Mazovetskiy
74755c8be7
Remove utils/stdcompat/cstddef.hpp
3 years ago
Gleb Mazovetskiy
4fa3732526
Add missing <cstdint> includes
...
Done with the following script:
```ruby
Dir["Source/**/*.{h,c,cc,cpp,hpp}"].each do |path|
v = File.read(path)
next if !v.include?("uint32_t") || v.include?("cstdint")
lines = v.lines
line_num = if lines[2].start_with?(" *")
lines.index { |l| l.start_with?(" */") } + 3
else
3
end
lines.insert(line_num, "#include <cstdint>\n")
File.write(path, lines.join(""))
end
```
then fixed-up manually
3 years ago
Gleb Mazovetskiy
c858ab4d2c
Fix some compilation warnings
...
also removes a couple of unused filesystem includes
3 years ago
Gleb Mazovetskiy
f2cb9f0fa0
file_util: Implement `RecursivelyCreateDir`
...
With this, we no longer require `std::filesystem` support to create the
save file directory when it does not exist.
Note that by default the save file directory exists because it is
created by SDL, so this is mostly useful on platforms that override the
save directory or use `UNPACKED_SAVES`.
3 years ago
Gleb Mazovetskiy
1a1a282d9a
Use C FILE instead of C++ streams throughout
...
Reduces binary size by ~2 KiB and may improve compatibility with oddball
systems (e.g. PS2).
3 years ago
Gleb Mazovetskiy
6d274c9547
`UNPACKED_SAVES`: Saves without MPQs
...
Reduces rg99 binary size by ~70 KiB.
3 years ago
Gleb Mazovetskiy
8fe8023542
Create save and config directories
...
If a config directory did not exist, the ini file was
not saved at all.
Only implemented for targets that support `std::filesystem` or `std::experimental::filesystem`.
These are all the targets except nxdk and iOS (only supported on iOS 13+).
3 years ago
Gleb Mazovetskiy
ea1087dfeb
Use `StrCat` in a few more places
...
Now `fmt` is only used for more complex formatting and for translations.
4 years ago
Gleb Mazovetskiy
04c3d85179
Remove `MAX_PATH`
...
Rather than using the Windows-like `MAX_PATH`, what we really want is 2
things:
1. Maximum path of a file in an MPQ. This is now `MaxMpqPathSize`.
2. Max size for the known monster paths. This is now 64 for sounds and
TRNs, which is more than enough (picked arbitrarily).
4 years ago
Anders Jenbo
2d21fc372e
Remove more miniwin code
4 years ago
Gleb Mazovetskiy
197e1180b2
Add StrCat and StrAppend
...
Adds simple string / integer concatenation functions.
Many of the uses of `fmt::format` are simply concatenation
of a few strings and integers.
`StrCat` is an easier-to-read alternative to such uses of `fmt`.
4 years ago
Gleb Mazovetskiy
ac15c3bbb4
MpqWriter: No `std::ios::in` for new archives
4 years ago
Gleb Mazovetskiy
a23ad0113b
MpqWriter constructor: Better error message
4 years ago
Gleb Mazovetskiy
72660d9189
Migrate snprintf to fmt ( #4845 )
...
* Migrate `app_fatal` from printf to libfmt
* Migrate snprintf to fmt
4 years ago
obligaron
7afe7d2a70
Save Methods in loadsave gets MpqWriter passed
4 years ago
Gleb Mazovetskiy
0bddde1644
Reduce debug log output of MpqWriter
4 years ago
Gleb Mazovetskiy
67581033d7
Remove "MpqFileRwRead beyond EOF by %u" warning
...
It spams the debug log but is not really an error from what I understand
4 years ago
Gleb Mazovetskiy
8d74b99c72
MpqWriter: Cleanups and renames
...
I've spent some time understanding how the `MpqWriter` works
and cleaned it up a bit and renamed some variables for clarity.
1. Fixes all signedness and clang-tidy warnings.
2. Renames variables, structs, and methods for clarity.
3. Marks structs used for I/O as packed.
4. Adds comments in a few places.
5. Eliminates recursion from `MpqWriter::AllocBlock` (a clang-tidy
warning).
4 years ago
Gleb Mazovetskiy
a4bc8fea7d
Fix warnings: `-Wsign-compare`, `-Wnarrowing`
4 years ago
Gleb Mazovetskiy
7e1fea6f76
clang-format all files in {Source,test}/
...
Also includes a few manual tweaks to comments and newlines for better results.
Co-authored-by: Anders Jenbo <anders@jenbo.dk>
4 years ago
Gleb Mazovetskiy
720d210d95
utils/mpq* -> mpq/*
4 years ago