Commit Graph

144 Commits

Author SHA1 Message Date
Jacob Coby
fbb2fcb769 Revert pstypes.h 2024-04-29 14:56:58 -04:00
Jacob Coby
a6a6869a7e 64 Bit-Safe Updates
Imported Icculus' 64-bit changes.

Changes `[un]signed long` data types to `[un]signed int`.
2024-04-29 14:10:09 -04:00
C.W. Betts
61e9a42a73 Add virtual default destructors on a few abstract classes. 2024-04-29 15:28:30 +00:00
Oskar Strengbohm
f9fdfc22e8 misc: pstring: Remove unneccesary or unused functions. 2024-04-29 09:55:45 +02:00
Ryan C. Gordon
6c8977caf0
Heavy patching for compiler warnings.
The vast majority of this is fixing up `char *` that should be `const char *`
but a handful of other fixes, like potential buffer overflows that GCC
noticed, etc, were applied as well.

This removes `-Wno-write-strings` from CMakeLists.txt, as it is no longer
necessary, as there is no longer a flood of compiler warning spam when
building.

This does not fix all compiler warnings; there are still a handful, and they
are legitimate, but they can be dealt with in a future commit.
2024-04-29 00:18:56 -04:00
Azamat H. Hackimov
1926a77f19 Introducing git revision in source code
Git revision is generating on build time (not on configure time). In case of uncommited changes this revision will be marked as "dirty". If cmake cannot retrieve revision from git history (i.e. from packaged source code), cmake will attempt to read "git-hash.txt" from `PROJECT_SOURCE_DIR` (it will be generated on build time; after implementing packaging workflow it can be reworked).
Reworked main screen and console output to display proper version.
Version project now is 1.5.0 as previous PATCH value (500) was intended to be D3_RELEASE_BUILD_NO, autogenerated on compile time. As we switched to GIT_HASH, D3_RELEASE_BUILD_NO now useless.
2024-04-28 22:05:26 +03:00
Chris Sarbora
1bc5648a9a
Remove MacOS (Classic) code and all references (3/3)
At this point, all remaining references to `MACINTOSH` are either part
of multi-value conditionals that `unifdef` was unable to determine the
final value for, or a `#define`, or a comment. I manually go through the
files with a Ctrl+Shift+F search (ignoring legacy/, to preserve useful
historic knowledge) and clean up each usage.

As part of that search, I discovered `lib/mac/` which I deleted wholly.

Test Plan:
On Mac, build both Debug and Release
```
cmake --build --preset mac --config Debug
cmake --build --preset mac --config Release
```
2024-04-27 07:44:40 -07:00
Chris Sarbora
e6ba1906c9
Remove MacOS (Classic) code and all references (1/3)
The MACINTOSH define refers to MacOS Classic (not OS X) which we do not
plan to support. Rather than carry the cruft forever, let's delete it.

NOTE: legacy/ is unused but we're keeping it around, so MACINTOSH uses
there are left alone.

Process used for this commit:
```
git rm -r mac
find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" \) \
  -exec unifdef -UMACINTOSH -o {} {} \;
git restore legacy
git add .
```

Test Plan:
On Mac, build both Debug and Release
```
cmake --build --preset mac --config Debug
cmake --build --preset mac --config Release
```
2024-04-27 07:38:14 -07:00
Oskar Strengbohm
b54d22614d misc: Remove endian.cpp and lib/psendian.h
They were not used, and a better alternative is now lib/byteswap.h
2024-04-24 17:27:21 +02:00
Edu Garcia
a4f6405cea
Merge pull request #165 from winterheart/64bit-tests
Implementing C++ byteswap functions
2024-04-23 22:49:18 +01:00
Azamat H. Hackimov
4826c37a69 Add BUILD_INTERFACE to cfile module
Other modules that depends on it, can reuse includes on linking.
There some files formally not belonging any packages (lib directory), as workaround there temporary include_directories(cfile) on root of project. After migrating all modules this can be removed.
2024-04-24 00:41:02 +03:00
Azamat H. Hackimov
c275d359c7 Reapply "Cfile module update"
This reverts commit 066b436fd9.
2024-04-24 00:40:39 +03:00
Azamat H. Hackimov
c3e0102a4f Implementing C++ byteswap functions
Implementing byteswap functions by using "backported" from C++23 std::byteswap.
Adding unittests based on GoogleTests. To enable it add `-DBUILD_TESTING=ON` to cmake.
2024-04-23 21:18:07 +03:00
Jacob Coby
96ce6d2c73 Logging updates:
* Adds CMake Option
 * Adds LOGGER to the README
 * Removes MONO define in favor of LOGGER
2024-04-23 13:53:00 -04:00
Jacob Coby
9753f8367f Enable console logging if MONO or LOGGER is defined
Re-enable console logging on linux and mac builds with the -DMONO
option.

Rename overloaded Debug_ConsolePrintf function to
Debug_ConsolePrintfAt to fix macro expansion.

Adds -DLOGGER alias for -DMONO.

Implements #157
2024-04-23 09:07:20 -04:00
GravisZro
9a80863c7f Ensure STDCALL/STDCALLPTR is only invoked on x86
Prevent the code from trying to use stdcall for anything except (32-bit) x86 builds
because it's the only platform it's applicable for.
2024-04-21 22:24:50 -04:00
Daniel Gibson
94ce70bb89 AudioDecoder: Get rid of custom malloc/free functions
were never set anyway, and (the real) libacm doesn't support custom
allocators.
2024-04-21 18:25:52 +02:00
Kevin Bentley
44c4f867e8 Removed extraneous license 2024-04-20 10:15:38 -06:00
Kevin Bentley
1f45163248 Updated source to reflect the license that this code is released under. 2024-04-20 09:57:49 -06:00
C.W. Betts
57078ae4b5 Change most sprintf to snprintf.
This also includes vsprintf to vsnprintf.
2024-04-19 12:31:28 -06:00
Edu Garcia
066b436fd9
Revert "Cfile module update" 2024-04-19 13:57:55 +01:00
Louis Gombert
21fb443cb3
Merge pull request #74 from GravisZro/fix/warnings
Fix build warnings (NULL instead of '\0')
2024-04-19 11:21:14 +00:00
Azamat H. Hackimov
9b45091633 Rename/move cfile related files
Rename to lowercase and move headers to own directory.
2024-04-19 00:17:15 +03:00
GravisZro
b5632bbc3e Fix simple warnings
Most of these warnings are due to the use of NULL instead of 0 or NULL instead of '\0'.
Some are macro redefinitions. None of them are pointer storage related. Those will be
in another PR.
2024-04-18 15:13:35 -04:00
Dan Raviv
aaefe86a2a Fix cf_SetSearchPath bad memory access (tested on macOS) 2024-04-18 10:33:21 -07:00
Edu Garcia
316d50a706
Merge pull request #59 from Lgt2x/fix-hog-64
Fix HOG file entry parser in 64 bit architectures
2024-04-18 07:55:17 +01:00
Louis Gombert
622b8278dc Fix HOG file entry parser in 64 bit architectures
timestamp is 4 bytes in the file, but is read as an 8-bytes long when built on 64 bit architectures, screwing up the read offset
2024-04-18 08:23:22 +02:00
Matt Stephenson
e1af942a13 Use __aarch64__ instead of __arm64__ for Linux builds
Signed-off-by: Matt Stephenson <mstephenson6@users.noreply.github.com>
2024-04-18 01:34:24 -04:00
Azamat H. Hackimov
9e6ebbc8fb Remove dublicate byteswap.h
Linux-specific byteswap.h just includes BYTESWAP.H, so there no need platform-specific header.

Fixes "non-portable path to file" ([-Wnonportable-include-path]) warnings.
2024-04-18 03:20:36 +03:00
Azamat H. Hackimov
a6d90107bf Re-format with clang-format recently changed files 2024-04-18 00:46:57 +03:00
Thomas Otto
b909a4cf43 Convert min/max macros to std::min/max
Added explicit <float> or <int> template argument where needed.
Add -DNOMINMAX define for Windows.
2024-04-17 21:43:38 +02:00
Louis Gombert
4247f30c3d
Merge pull request #21 from th1000s/misc_linux
Linux build fixes: remove unused osMutex code and typedefs
2024-04-17 18:46:42 +00:00
Louis Gombert
4d181c8ab3
Merge pull request #20 from th1000s/cmake_unix
Set C++ to 17, and a few CMake fixes for Linux
2024-04-17 18:39:51 +00:00
Edu Garcia
c7898fae7e
Merge pull request #40 from jcoby/fix-mac-m-series
Apple M-Series Fixes
2024-04-17 17:03:48 +01:00
Jacob Coby
531e528c61 Apple M-Series Fixes
* Adds portable debug_break (https://github.com/scottt/debugbreak/)
 * Adds Brewfile for Homebrew deps
 * use isfinite() instead of finite()
 * Stub int3 code in mveasm
2024-04-17 09:09:22 -04:00
Jeff Slutter
69a2e15625 Committing local fixes and changes I had. 2024-04-16 22:53:28 -05:00
Thomas Otto
26266d625c Unix: set -std=c++17 explicitly
remove register keyword, add cstdint include
2024-04-17 01:38:18 +02:00
Thomas Otto
b58d3585bd Remove unused osMutex code
It was never Acquire'd, only Created and Destroyed; and it was
a stub on Linux and macOS.
2024-04-17 01:20:51 +02:00
Azamat H. Hackimov
38128ea134 Additional clang-format 2024-04-17 00:25:04 +03:00
Kevin Bentley
61be1317b2 More clanging 2024-04-16 14:46:12 -06:00
Kevin Bentley
7399b5a2f2 Fix CRLF line endings. 2024-04-16 14:21:35 -06:00
Dan Raviv
3f11c5d78e Movie handles avoid assuming pointer size is 32 bits 2024-04-16 13:02:45 -07:00
Kevin Bentley
c6640cc631 clang-format on everything. 2024-04-16 12:56:40 -06:00
Kevin Bentley
df209742fc Initial import 2024-04-15 21:43:29 -06:00