Commit graph

131 commits

Author SHA1 Message Date
Anders Jenbo
1284333765 ♻️ Use explicit types and remove globals from save file logic 2021-03-09 22:27:11 +01:00
Anders Jenbo
d37fb68809 Make header checks portable 2021-03-02 12:17:13 +01:00
pionere
2cbe239d6d Revert "bugfix for vanilla diablo (set archive size to zero in case the file did not exists)"
This reverts commit 5fb3b6fa66.
2021-02-20 20:46:02 +01:00
pionere
d5a0fa8e85 get rid of a few warnings 2021-02-19 22:04:11 +01:00
pionere
5fb3b6fa66 bugfix for vanilla diablo (set archive size to zero in case the file did not exists) 2021-02-19 22:04:11 +01:00
Anders Jenbo
5bdbf18902 Merge branch 'master' of github.com:diasurgical/devilution 2021-01-05 22:44:11 +01:00
Anders Jenbo
e2a98b75fe Clean up some magic values 2021-01-02 22:34:32 +01:00
Anders Jenbo
aa3c0242e7 Merge branch 'master' of github.com:diasurgical/devilution 2020-12-31 02:12:23 +01:00
Anders Jenbo
c833d55cc1 Clean up mpqapi_write_file_contents 2020-12-30 23:03:11 +01:00
Anders Jenbo
0bf9b1bfe6 Fix mpqapi_get_hash_index 2020-12-29 05:36:06 +01:00
qndel
bb54ed00e4 mpqapi_get_hash_index bin exact 2020-12-28 17:45:21 +01:00
qndel
8255c27f21
mpqapi_find_free_block bin exact (#2182) 2020-12-28 16:51:22 +01:00
qndel
e1406e241a mpqapi_new_block bin exact 2020-12-28 16:50:47 +01:00
Anders Jenbo
fa3785a475 Merge branch 'master' of github.com:diasurgical/devilution 2020-11-04 03:02:48 +01:00
Anders Jenbo
f2f4de8e33 Reorder mpqapi.cpp 2020-11-04 00:01:29 +01:00
Anders Jenbo
a3505ab904 Remove the std namespace from uint32_t
Again to help older compileres that aren't C++11 aware.
2020-05-14 11:44:15 +02:00
Anders Jenbo
69ad34f58f Consistently use NULL instead of nullptr
While nullptr does have extra checking, most of the code uses NULL and
nullptr makes it harder to port the code to some targets like the
original XBox
2020-05-14 11:44:15 +02:00
Anders Jenbo
5641e2bdec Fix MSVC build 2020-04-14 16:05:29 +02:00
Anders Jenbo
7108145a04 Merge branch 'master' of github.com:diasurgical/devilution 2020-04-14 15:30:49 +02:00
Anders Jenbo
cd18914026 Avoid void pointers 2020-04-08 20:34:38 +02:00
Anders Jenbo
c384711a5f Backport cleanups from hellfire branch 2020-04-08 20:16:32 +02:00
Anders Jenbo
776ab10476 Merge branch 'master' of github.com:diasurgical/devilution 2020-03-29 23:40:05 +02:00
Gleb Mazovetskiy
82845004cc Ensure _HASH/BLOCKENTRY are 16-bytes and aligned 2020-03-16 02:19:49 +01:00
Anders Jenbo
5c02333fc0 Only log savegame read/write in debug mode 2020-03-09 00:19:31 +01:00
Anders Jenbo
0383f9abcd Add documentation to more files 2020-03-02 02:29:28 +01:00
Anders Jenbo
3c276a3cd3 Add documentation
- Add file documentation to about 1/4 of the files in Source
- Copy over a lot of the documentation from the sanctuary/notes repo
- Standardise all the existing documentation
- Create a configuration for Doxygen
- Add more documentation (engine.cpp is now fully documented)
2020-03-01 22:18:00 +01:00
Gleb Mazovetskiy
4ed20e0607 mpqapi: Use format macros instead of literals
Testing if this builds on VS 2017
2020-02-22 23:44:30 +01:00
Gleb Mazovetskiy
768a07d7d0 mpqapi: Replace macro with template function
Fixes MSVC compatibility, where `__VA_ARGS__` is not implemented
correctly.
2020-02-22 23:07:52 +01:00
Gleb Mazovetskiy
c9c1c323cd
mpqapi cleanup (#624)
* mpqapi FStreamWrapper: Fix silly bugs

* mpqapi cleanup

1. Do not rely on stream positions for getting the initial file size.
2. Remove most `seek` calls that were unnecessary.
3. Replace magic numbers with constants.
4. A class to manage archive lifetime and all associated data.

* Revert "Revert "mpqapi: Log all fstream calls""

This reverts commit e08007670f.

* mpqapi: Fix saves on Amiga

Works around https://github.com/bebbo/libnix/issues/30

* mpqapi: Fix logging format specifiers

This fixes fstream logging on Amiga

* mpqapi: Do not ResizeFile unless it was modified

* Add tests for file_util

* mpqapi: Replace malloc/free with new[]/delete[]

* mpqapi: Keep track of size instead of using tellp

This reduces log noise and reliance on `tellp`.

* mpqapi: Refactor mpqapi_write_file_contents

* mpqapi: Ensure we don't seekp beyond EOF on Amiga

* mpqapi: Minor fixes

* mpqapi: Fix FSTREAM_CHECK on Windows

* mpqapi: Remove undefined methods from header
2020-02-22 19:19:13 +01:00
Anders Jenbo
e08007670f Revert "mpqapi: Log all fstream calls"
This reverts commit c530b7f62b.
2020-02-16 02:57:19 +01:00
Gleb Mazovetskiy
c530b7f62b mpqapi: Log all fstream calls 2020-02-16 01:34:15 +01:00
Anders Jenbo
25993b4043 Merge branch 'master' of github.com:diasurgical/devilution 2020-02-14 23:03:31 +01:00
Anders Jenbo
20621a0642
add all.h and use in place of diablo.h (#2005)
Now diablo.h is treated in the same way as all other header files of
Source, as it only contains the declarations of global variables and
functions of diablo.cpp.

Besides consistency, this also enables mods to include diablo.h just
like any other header file without having to include every header file
(and without having to include C++ specific aspects of the now all.h).
2020-02-14 13:12:54 +01:00
Gleb Mazovetskiy
42fd614609 mpqapi: Log errno on error 2020-02-11 19:38:51 +01:00
Anders Jenbo
40ba1e7a6f Merge branch 'master' of github.com:diasurgical/devilution 2020-02-01 14:48:39 +01:00
Anders Jenbo
17b0c7186d Check sgdwMpqOffset before resizing 2020-02-01 03:13:40 +01:00
Anders Jenbo
cc4d6b57d8 Remove unused miniwin IO 2020-01-31 22:30:13 +01:00
Gleb Mazovetskiy
d2c39767e3 mpqapi: Fix open MPQs getting cleared on exit 2020-01-31 01:01:41 +01:00
Gleb Mazovetskiy
cfe288a28e mpqapi: Use <fstream> instead of custom functions 2020-01-31 01:01:41 +01:00
Samuel-DEVULDER
9c516819c1 Make save game code big-endian compatible 2020-01-27 00:03:02 +01:00
Anders Jenbo
7f699dbad2 Remove more legacy savegame code
This code was only active in versions prior to 1.08
2020-01-23 16:38:35 +01:00
qndel
3008439bc7 enums and stuff 2020-01-15 15:46:21 +01:00
Anders Jenbo
40cea40aa4 Remove windows call types collisions 2019-12-26 05:00:02 +01:00
Anders Jenbo
f4496aa7f9 Merge branch 'master' of github.com:diasurgical/devilution 2019-11-09 21:27:06 +01:00
Anders Jenbo
4532f009ff Remove old anti-cheat code from save function
Tthis code simply logs the save time of a multiplayer game in the
register database, this was likly done as part of an anti cheat scheme
(the key was "Video Player"), but appears to have since been disabled.
Probably to allow moving save games between PC's which was supported
when better Windows 2000 support was added.
2019-11-09 20:00:53 +01:00
Anders Jenbo
802f2e76fa
save_archive_modified = TRUE; 2019-11-09 19:41:58 +01:00
Anders Jenbo
1bc2ea4f58
Update mpqapi.cpp 2019-11-09 19:40:47 +01:00
Marlon Beijer
d641c65562 Some fixes for Big Endian systems 2019-10-06 20:50:35 +02:00
Gleb Mazovetskiy
2cc0c2cfbb Clang: Remove -fms-extensions -fms-compatibility 2019-09-25 03:32:00 +02:00
Anders Jenbo
14f8c9368a Merge branch 'master' of github.com:diasurgical/devilution 2019-09-13 17:51:58 +02:00