Commit Graph

295 Commits

Author SHA1 Message Date
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
d2c8b2861f
Remove MacOS (Classic) code and all references (2/3)
Discovered this while manually removing `MACINTOSH` references. Feels
like this shouldn't actually be a fallthrough.
2024-04-27 07:38:14 -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
Chris Sarbora
9ec7714ebc
Delete unused sources
None of these sources are referenced, either directly or indirectly,
    in any CMakeLists.txt file.

    NOTE: All of legacy/ is unused, but we're keeping it around.

    Process for this commit: (in bash)
    **NOTE: THIS MUST BE DONE ON A CASE-SENSITIVE FILESYSTEM**. There are a
    few instances of differing-in-case-only (hogmaker vs HogMaker, etc) that
    will catch you out otherwise.
    ```
      # *** 1: Find all directly-referenced c/cpp files in CMakeLists.txt
      find . -name CMakeLists.txt -exec cat {} \+ |
      # Then, convert spaces and tabs to newlines for easy tokenizing
        tr -s ' \t' '\n' |
      # Filter to just tokens descripting c/cpp filenames (case insensitive)
        grep -iE '\.c(pp)?' |
      # Massage each filename to remove CMake-specific chars
        sed 's/[")]//g' |
      # Remove a URL that happens to match the pattern so far
        grep -v https: |
      # Remove files that start with # (and are thus comments, not refs)
        grep -Ev '^#' |
      # *** 2: In the output so far there is a curious entry ${SCRIPT}.cpp
      # Turns out, the makefiles generate some further filenames from script
      # names. So, delete the ${SCRIPT}.cpp filename...
        grep -v '${SCRIPT}.cpp' |
      # .. and add in the cpps.
        (
      # We use a bash subshell to let us "concatenate" to the pipe. This
      # writes stdin back to stdout, and then starts a *new command* to
      # generate more to stdout.
          cat -;
      # All the generated script cpp references live in scripts/
          cat scripts/CMakeLists.txt |
      # Squash the makefile onto one line for regex ease
            tr '\n' ' ' |
      # Extract the script names
            sed -E 's/.*set\(SCRIPTS([^)]+)\).*/\1/' |
      # Convert spaces and tabs to newlines for easy tokenizing
            tr -s ' \t' '\n' |
      # Remove blank lines
            grep -v '^$' |
      # Add cpp extension to each token
            while read TOKEN; do
              echo ${TOKEN}.cpp;
            done
        ) |
      # *** 3: Being referenced by CMakeFiles.txt isn't the only way a src
      # file can be used - it could also be potentially #include'ed. Let's
      # find those, with another subshell concatenation:
        (
          cat -;
      # Look in ALL source files. We could actually probably limit the
      # search here to just src files listed so far in stdin + *.h, but
      # that'd require a bunch of redirections and this bash pipeline is
      # already ridiculous enough. (Case!)
          find . -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" |
      # Pull out the #include directives from them
            xargs grep --no-filename '#include' |
      # Look for any include of a .c or .cpp file (Case!)
            grep -iE '\.c(pp)?' |
      # Squash multiple spaces and tabs into one single space
            tr -s ' \t' ' ' |
      # Split on spaces, take the second field
            cut -d ' ' -f 2 |
      # Delete off quotes and angle brackets to get the included filename
            tr -d '"<>'
        ) |
      # *** 4: Protect all files under legacy/, per @Lgt2x's request
        (
          cat -;
          find legacy -iname "*.cpp" -or -iname "*.c"
        ) |
      # *** 5: Reduce all entries to their basename
        while read FILENAME; do
          basename $FILENAME;
        done |
      # *** 6: FINALLY, sort and dedupe the output into a file.
        sort | uniq > used_srcs

      # Now that we know all the used source files, we need to find all of
      # the source files in the repo, and delete them if they do not appear
      # in the used_srcs list.
      for SRC in $(find . -iname "*.cpp" -or -iname "*.c"); do
      # find outputs the relative path, we want to operate on just filename
        basename $SRC |
      # grep to see if the basename occurs in the used_srcs list.
      # -q means be quiet, do not print the match (so this doesn't spam)
      # -x means match the entire line (so macfile.cpp doesn't sneak thru
      #    via cfile.cpp)
      # -F means treat the lines patterns as fixed (not regexp)
      # -f means load patterns from the given file
          grep -qxFf used_srcs ||
      # If the grep command *fails*, then the file is not in the list.
      # Bash performs logic short-circuiting, so we can use logical-OR
        git rm $SRC;
      done
    ```

    Test Plan:
    On all three of `[win, mac, linux]`:
    ```
    cmake --preset <platform>
    cmake --build --preset <platform> --config Debug
    cmake --build --preset <platform> --config Release
    ```
2024-04-27 07:33:01 -07:00
Chris Sarbora
9adfb7ef32
Move old renderer files into legacy/
These files are likely to be useful for future reference.
2024-04-26 15:39:44 -07:00
Jeod
d1a67599a8
Merge pull request #192 from jcoby/fix-mac-controls
Fix controls on aarch64
2024-04-26 17:50:38 -04:00
Jacob Coby
147078b3a6 Fix controls on aarch64
Cast the rotation values to a short before assigning to the tangles
struct to avoid the FCVTZU instruction which strips the negative sign
from kicking in.

Fixes #161
2024-04-26 17:07:24 -04:00
Jeod
19896370d9
Merge pull request #191 from InsanityBringer/fix_libacm
Remove two channel minimum of libacm
2024-04-26 16:18:02 -04:00
InsanityBringer
a164fb6d47 Remove two channel minimum of libacm 2024-04-26 14:07:48 -05:00
Jeod
74ce2fe381
Merge pull request #190 from DescentDevelopers/revert-184-readme-32
Revert "README: 32-bit Linux and other distributions mentioned"
2024-04-26 10:58:04 -04:00
Jeod
f8a2fa2cd4
Revert "README: 32-bit Linux and other distributions mentioned" 2024-04-26 10:57:35 -04:00
Jeod
444e44f9fd
Merge pull request #184 from th1000s/readme-32
README: 32-bit Linux and other distributions mentioned
2024-04-26 10:56:33 -04:00
Jeod
bfed0d8d96
Merge pull request #172 from Nakhr11n/endian
Remove misc/endian.cpp and lib/psendian.h
2024-04-26 10:54:41 -04:00
Jeod
21e23f7972
Merge pull request #189 from icculus/rm-opengl_ryan
Remove renderer/opengl_ryan.cpp
2024-04-26 10:35:13 -04:00
Ryan C. Gordon
93fdd1ac97
Remove renderer/opengl_ryan.cpp
This was debug/testing code from Loki Software, and is unused.
2024-04-26 09:49:55 -04:00
Thomas Otto
9f87771338 README: 32-bit Linux and other distributions mentioned 2024-04-26 00:54:08 +02:00
Jeod
5f9e3c3a9b
Merge pull request #182 from th1000s/osnames 2024-04-25 17:21:47 -04:00
Thomas Otto
a0a247a117 CI: give OSes pretty names
And name the resulting zip file Descent3_<OS>.zip
2024-04-25 23:06:10 +02:00
Azamat H. Hackimov
47ff6e52cd
Merge pull request #178 from jcoby/64bit-checksum
Update script CHECKSUM for 64 bit platforms
2024-04-25 19:31:40 +03:00
Jacob Coby
e21b8a3d51 Update script CHECKSUM for 64 bit platforms
Osiris_CreateGameChecksum computes a different checksum on 64 bit
architectures due to the game structures being larger, mostly from
pointers being 8 bytes instead of 4.

Fixes #160
2024-04-25 09:39:41 -04:00
Jeod
8770ea4626
Merge pull request #158 from DanielGibson/fix-141
Fix crash in hlsSystem::ComputePlayInfo(), #141
2024-04-24 19:49:51 -04:00
Daniel Gibson
923bf4bbbf Debug version of TERRAIN_REGION() that checks for invalid values
and improved comments in Play2dSound and ComputePlayInfo()
2024-04-24 22:28:26 +02:00
Jeod
41c64f9444
Merge pull request #177 from DescentDevelopers/JeodC-patch-1
Allow manual triggering if needed
2024-04-24 15:58:00 -04:00
Jeod
d46f61cca3
Allow manual triggering if needed 2024-04-24 15:57:52 -04:00
Jeod
5b2b4f2f5d
Merge pull request #131 from pzychotic/fix-release-build
Fixed Release build
2024-04-24 14:45:57 -04:00
Jeod
a597f43635
Merge pull request #175 from th1000s/readmefix
README: cmake defines must be passed to --preset
2024-04-24 14:40:36 -04:00
Jeod
3daf5b2060
Merge branch 'main' into fix-release-build 2024-04-24 14:37:13 -04:00
Thomas Otto
00a847ef9f README: cmake defines must be passed to --preset
cmake --build will ignore them
2024-04-24 20:36:40 +02:00
Jeod
155211ba52
Merge pull request #174 from DescentDevelopers/JeodC-patch-1
Update README.md - consistency
2024-04-24 14:18:50 -04:00
Jeod
d3312b7f57
Update README.md - consistency 2024-04-24 14:18:40 -04: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
Louis Gombert
aab8fbb3c9
Merge pull request #170 from eslutz/readme-update
Fix typo in README
2024-04-24 07:49:58 +00:00
Louis Gombert
e41e275436
Merge pull request #137 from Nakhr11n/unzip
Use system zlib instead of bundled.
2024-04-24 07:30:13 +00:00
Oskar Strengbohm
132a725daa unzip: Link against real zlib. 2024-04-24 08:22:13 +02:00
Eric Slutz
ac9d81d27a
Update README.md 2024-04-24 00:59:03 -04:00
Edu Garcia
a4f6405cea
Merge pull request #165 from winterheart/64bit-tests
Implementing C++ byteswap functions
2024-04-23 22:49:18 +01:00
Edu Garcia
15ac86d889
Merge pull request #91 from winterheart/cfile-update-v2
Re-apply cfile-update with fix regression
2024-04-23 22:47:55 +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
63b4284658 Fix float reading in cfile
Whoah, big surprise float_t and double_t may have different length. Still waiting float32_t and float64_t types from C++23...
2024-04-24 00:40:41 +03:00
Azamat H. Hackimov
16464ee81a Fix regression in cf_ReadByte()
cfgetc returns int on success read, but if cast it to int8_t too early, 255 will become -1, or EOF.
2024-04-24 00:40:41 +03:00
Azamat H. Hackimov
c275d359c7 Reapply "Cfile module update"
This reverts commit 066b436fd9.
2024-04-24 00:40:39 +03:00
Jeod
9ff3bd2e53
Merge pull request #166 from Kreeblah/descent3_macos_build_label
Update build label for appropriate *NIX platform
2024-04-23 17:18:09 -04:00
Kreeblah
0bcbf93d54
Update build label for appropriate *NIX platform 2024-04-23 14:11:22 -07:00
Daniel Gibson
41c4578f5c Fix crash in hlsSystem::ComputePlayInfo(), #141
sound_seg was -1, which crashes in BOA_INDEX(sound_seg) on 64bit
platforms (by pure luck it doesn't seem to crash on 32bit platforms)

It makes sense to catch this problem much earlier in Play3dSound(),
to avoid executing all the superfluous
2024-04-23 22:32:04 +02:00
Thomas Roß
a03489c8fb [WindowMode] Temporary disabled window mode in Release builds until it's ready for shipping. 2024-04-23 21:12:35 +02:00
Thomas Roß
94657a5233 Revert "[Windows] Temporary workaround to keep the window resolution as it was before the changes to fix the preprocessor defines for the Release build."
This reverts commit fabcdcd84d.
2024-04-23 21:07:27 +02:00
Thomas Roß
acd727710a Merge branch 'main' into fix-release-build
# Conflicts:
#	CMakeLists.txt
2024-04-23 20:41:34 +02: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
Louis Gombert
959a45394d
Merge pull request #159 from jcoby/enable-console-logging
Enable console logging if MONO or LOGGER is defined
2024-04-23 18:10:45 +00: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