Commit 943e3643 authored by Rinnegatamante's avatar Rinnegatamante
Browse files

First commit.

Disabled SDL code in cpu.cpp
parent 60126784
/build*
*~
.*.swp
*.pyc
.cproject
.project
.settings/
/dhewm*
/*-releases/
This diff is collapsed.
# ABOUT
_dhewm 3_ is a _Doom 3_ GPL source port, known to work on at least Windows, Linux, macOS and FreeBSD.
The goal of _dhewm 3_ is bring _DOOM 3_ with the help of SDL to all suitable
platforms.
Bugs present in the original _DOOM 3_ will be fixed (when identified) without
altering the original gameplay.
**The official homepage is:** https://dhewm3.org
**Mods supported by dhewm3:** https://dhewm3.org/mods.html
**Mod SDK for dhewm3:** https://github.com/dhewm/dhewm3-sdk
**The project is hosted at:** https://github.com/dhewm
**Download the latest release:** https://github.com/dhewm/dhewm3/releases/latest
**Consult the FAQ at:** https://github.com/dhewm/dhewm3/wiki/FAQ
**Report bugs here:** https://github.com/dhewm/dhewm3/issues
## SWITCH PORT
To build the Switch port, you need the latest versions of the following:
- devkitA64
- libnx
- switch-mesa
- switch-libdrm_nouveau
- switch-sdl2
- switch-libogg
- switch-libvorbis
- switch-curl
- switch-zlib
- switch-libjpeg-turbo
- [my fork of openal-soft](https://github.com/fgsfdsfgs/openal-soft)
Most of the above libraries (except `openal-soft`) can be installed using `(dkp-)pacman` from the devkitPro repositories.
devkitA64 should be fully set up as described [here](https://devkitpro.org/wiki/Getting_Started).
To build the port, execute `make -f Makefile.nx` in the `neo` directory.
Set `D3XP=ON` to build RoE game code into the NRO instead of base game code, e.g. `D3XP=ON make -f Makefile.nx`. The resulting executable will automatically load RoE on startup, if present.
The game, both the NRO and the data files (i.e. the `base` and/or `d3xp` folders), should be installed to `/switch/dhewm3/` on your SD card.
nxlink debugging is enabled when either `DEBUG` or `NXLINK_DEBUG` is defined.
# CHANGES
Compared to the original _DOOM 3_, the changes of _dhewm 3_ worth mentioning are:
- 64-bit port
- SDL for low-level OS support, OpenGL and input handling
- OpenAL for audio output, all OS-specific audio backends are gone
- OpenAL EFX for EAX reverb effects (read: EAX-like sound effects on all platforms/hardware)
- Better support for widescreen (and arbitrary display resolutions)
- A portable build system based on CMake
- (Cross-)compilation with MinGW-w64
# GENERAL NOTES
## Game data and patching
This source release does not contain any game data, the game data is still
covered by the original EULA and must be obeyed as usual.
You must patch the game to the latest version (1.3.1). See the FAQ for details, including
how to get the game data from Steam on Linux or OSX.
Note that _Doom 3_ and _Doom 3: Resurrection of Evil_ are available from the Steam Store at
http://store.steampowered.com/app/9050/
http://store.steampowered.com/app/9070/
You can also buy Steam keys at the Humble Store:
https://www.humblebundle.com/store/p/doom3_storefront
https://www.humblebundle.com/store/p/doom3_resofevil_storefront
Note that neither Steam nor the Humble Store offer the *Resurrection of Evil* addon
for German customers (or at least people with German IP adresses).
## Compiling
The build system is based on CMake: http://cmake.org/
Required libraries are not part of the tree. These are:
- zlib
- libjpeg (v8)
- libogg
- libvorbis
- libvorbisfile (may be part of libvorbis)
- OpenAL (OpenAL Soft required, Creative's and Apple's versions are made of fail)
- SDL v1.2 or 2.0 (2.0 recommended)
- libcurl (optional, required for server downloads)
For UNIX-like systems, these libraries need to be installed (including the
developer files). It is recommended to use the software management tools of
your OS (apt, dnf, portage, BSD ports, [Homebrew for macOS](http://brew.sh), ...).
For Windows, there are two options:
- Use the provided binaries (recommended, see below)
- Compile these libraries yourself
Create a distinct build folder outside of this source repository and issue
the cmake command there, pointing it at the neo/ folder from this repository:
`cmake /path/to/repository/neo`
macOS users need to point CMake at OpenAL Soft (better solutions welcome):
`cmake -DOPENAL_LIBRARY=/usr/local/opt/openal-soft/lib/libopenal.dylib -DOPENAL_INCLUDE_DIR=/usr/local/opt/openal-soft/include /path/to/repository/neo`
## Using the provided Windows binaries
Get a clone of the latest binaries here: https://github.com/dhewm/dhewm3-libs
There are two subfolders:
- 32-bit binaries are located in `i686-w64-mingw32`
- 64-bit binaries are located in `x86_64-w64-mingw32`
Issue the appropriate command from the build folder, for example:
`cmake -G "Visual Studio 10" -DDHEWM3LIBS=/path/to/dhewm3-libs/i686-w64-mingw32 /path/to/repository/neo`
`cmake -G "MinGW Makefiles" -DDHEWM3LIBS=/path/to/dhewm3-libs/x86_64-w64-mingw32 /path/to/repository/neo`
The binaries are compatible with MinGW-w64 and all MSVC versions.
## Cross-compiling
For cross-compiling, a CMake Toolchain file is required.
For the MinGW-w64 toolchain `i686-w64-mingw32` on Ubuntu 12.04, it looks like:
```
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR i686)
set(CMAKE_C_COMPILER i686-w64-mingw32-gcc)
set(CMAKE_CXX_COMPILER i686-w64-mingw32-g++)
set(CMAKE_RC_COMPILER i686-w64-mingw32-windres)
set(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
```
Then point CMake at your toolchain file:
`cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/Toolchain.cmake -DDHEWM3LIBS=/path/to/dhewm3-libs/i686-w64-mingw32 /path/to/repository/neo`
## Back End Rendering of Stencil Shadows
The Doom 3 GPL source code release does not include functionality enabling rendering
of stencil shadows via the "depth fail" method, a functionality commonly known as
"Carmack's Reverse".
***Note*** that this **does *not* change the visual appereance** of the game.
The shadows look the same, they're just created in a slightly different way.
In theory there might be a small performance impact, but on hardware less than
ten years old it shouldn't make a difference.
## MayaImport
The code for our Maya export plugin is included, if you are a Maya licensee
you can obtain the SDK from Autodesk.
# LICENSE
See COPYING.txt for the GNU GENERAL PUBLIC LICENSE
ADDITIONAL TERMS: The Doom 3 GPL Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU GPL which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
EXCLUDED CODE: The code described below and contained in the Doom 3 GPL Source Code release is not part of the Program covered by the GPL and is expressly excluded from its terms. You are solely responsible for obtaining from the copyright holder a license for such code and complying with the applicable license terms.
## PropTree
neo/tools/common/PropTree/*
Copyright (C) 1998-2001 Scott Ramsay
sramsay@gonavi.com
http://www.gonavi.com
This material is provided "as is", with absolutely no warranty expressed
or implied. Any use is at your own risk.
Permission to use or copy this software for any purpose is hereby granted
without fee, provided the above notices are retained on all copies.
Permission to modify the code and to distribute modified code is granted,
provided the above notices are retained, and a notice that the code was
modified is included with the above copyright notice.
If you use this code, drop me an email. I'd like to know if you find the code
useful.
## Base64 implementation
neo/idlib/Base64.cpp
Copyright (c) 1996 Lars Wirzenius. All rights reserved.
June 14 2003: TTimo <ttimo@idsoftware.com>
modified + endian bug fixes
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=197039
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
## IO on .zip files using minizip
src/framework/minizip/*
Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
Modifications of Unzip for Zip64
Copyright (C) 2007-2008 Even Rouault
Modifications for Zip64 support
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
## MD4 Message-Digest Algorithm
neo/idlib/hashing/MD4.cpp
Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
rights reserved.
License to copy and use this software is granted provided that it
is identified as the "RSA Data Security, Inc. MD4 Message-Digest
Algorithm" in all material mentioning or referencing this software
or this function.
License is also granted to make and use derivative works provided
that such works are identified as "derived from the RSA Data
Security, Inc. MD4 Message-Digest Algorithm" in all material
mentioning or referencing the derived work.
RSA Data Security, Inc. makes no representations concerning either
the merchantability of this software or the suitability of this
software for any particular purpose. It is provided "as is"
without express or implied warranty of any kind.
These notices must be retained in any copies of any part of this
documentation and/or software.
## MD5 Message-Digest Algorithm
neo/idlib/hashing/MD5.cpp
This code implements the MD5 message-digest algorithm.
The algorithm is due to Ron Rivest. This code was
written by Colin Plumb in 1993, no copyright is claimed.
This code is in the public domain; do with it what you wish.
## CRC32 Checksum
neo/idlib/hashing/CRC32.cpp
Copyright (C) 1995-1998 Mark Adler
## Brandelf utility
neo/sys/linux/setup/brandelf.c
Copyright (c) 1996 Søren Schmidt
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer
in this position and unchanged.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software withough specific prior written permission
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
$FreeBSD: src/usr.bin/brandelf/brandelf.c,v 1.16 2000/07/02 03:34:08 imp Exp $
## makeself - Make self-extractable archives on Unix
neo/sys/linux/setup/makeself/*, neo/sys/linux/setup/makeself/README
Copyright (c) Stéphane Peter
Licensing: GPL v2
# empty file
This diff is collapsed.
STATIC_LINKING := 0
AR := ar
ifneq ($(V),1)
Q := @
endif
ifneq ($(SANITIZER),)
CFLAGS := -fsanitize=$(SANITIZER) $(CFLAGS)
CXXFLAGS := -fsanitize=$(SANITIZER) $(CXXFLAGS)
LDFLAGS := -fsanitize=$(SANITIZER) $(LDFLAGS)
endif
ifeq ($(platform),)
platform = unix
ifeq ($(shell uname -a),)
platform = win
else ifneq ($(findstring MINGW,$(shell uname -a)),)
platform = win
else ifneq ($(findstring Darwin,$(shell uname -a)),)
platform = osx
else ifneq ($(findstring win,$(shell uname -a)),)
platform = win
endif
endif
# system platform
system_platform = unix
ifeq ($(shell uname -a),)
EXE_EXT = .exe
system_platform = win
else ifneq ($(findstring Darwin,$(shell uname -a)),)
system_platform = osx
arch = intel
ifeq ($(shell uname -p),powerpc)
arch = ppc
endif
else ifneq ($(findstring MINGW,$(shell uname -a)),)
system_platform = win
endif
CORE_DIR += .
TARGET_NAME := dhewm3
LIBM = -lm
ifeq ($(ARCHFLAGS),)
ifeq ($(archs),ppc)
ARCHFLAGS = -arch ppc -arch ppc64
else
ARCHFLAGS = -arch i386 -arch x86_64
endif
endif
ifeq ($(platform), osx)
ifndef ($(NOUNIVERSAL))
CXXFLAGS += $(ARCHFLAGS)
LFLAGS += $(ARCHFLAGS)
endif
endif
ifeq ($(STATIC_LINKING), 1)
EXT := a
endif
ifeq ($(platform), unix)
EXT ?= so
TARGET := $(TARGET_NAME)_libretro.$(EXT)
fpic := -fPIC
SHARED := -shared -Wl,--version-script=$(CORE_DIR)/link.T -Wl,--no-undefined
else ifeq ($(platform), linux-portable)
TARGET := $(TARGET_NAME)_libretro.$(EXT)
fpic := -fPIC -nostdlib
SHARED := -shared -Wl,--version-script=$(CORE_DIR)/link.T
LIBM :=
else ifneq (,$(findstring osx,$(platform)))
TARGET := $(TARGET_NAME)_libretro.dylib
fpic := -fPIC
SHARED := -dynamiclib
else ifneq (,$(findstring ios,$(platform)))
TARGET := $(TARGET_NAME)_libretro_ios.dylib
fpic := -fPIC
SHARED := -dynamiclib
ifeq ($(IOSSDK),)
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
endif
DEFINES := -DIOS
CC = cc -arch armv7 -isysroot $(IOSSDK)
ifeq ($(platform),ios9)
CC += -miphoneos-version-min=8.0
CXXFLAGS += -miphoneos-version-min=8.0
else
CC += -miphoneos-version-min=5.0
CXXFLAGS += -miphoneos-version-min=5.0
endif
else ifneq (,$(findstring qnx,$(platform)))
TARGET := $(TARGET_NAME)_libretro_qnx.so
fpic := -fPIC
SHARED := -shared -Wl,--version-script=$(CORE_DIR)/link.T -Wl,--no-undefined
else ifeq ($(platform), emscripten)
TARGET := $(TARGET_NAME)_libretro_emscripten.bc
fpic := -fPIC
SHARED := -shared -Wl,--version-script=$(CORE_DIR)/link.T -Wl,--no-undefined
else ifeq ($(platform), vita)
TARGET := $(TARGET_NAME)_vita.a
CC = arm-vita-eabi-gcc
AR = arm-vita-eabi-ar
CXXFLAGS += -Wl,-q -Wall -O3
STATIC_LINKING = 1
# Nintendo Switch (libnx)
else ifeq ($(platform), libnx)
include $(DEVKITPRO)/libnx/switch_rules
EXT=a
TARGET := $(TARGET_NAME)_libretro_$(platform).$(EXT)
DEFINES := -DSWITCH=1 -U__linux__ -U__linux -DRARCH_INTERNAL
CFLAGS := $(DEFINES) -g -O3 \
-fPIE -I$(LIBNX)/include/ -ffunction-sections -fdata-sections -ftls-model=local-exec -Wl,--allow-multiple-definition -specs=$(LIBNX)/switch.specs
CFLAGS += $(INCDIRS) -I$(PORTLIBS)/include/
CFLAGS += -D__SWITCH__ -DHAVE_LIBNX -march=armv8-a -mtune=cortex-a57 -mtp=soft
CXXFLAGS := $(ASFLAGS) $(CFLAGS) -fno-rtti -std=gnu++11
CFLAGS +=
STATIC_LINKING = 1
HAVE_OPENGL = 1
else
CC = gcc
TARGET := $(TARGET_NAME)_libretro.dll
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=$(CORE_DIR)/link.T -Wl,--no-undefined
LDFLAGS += -lwsock32 -lWS2_32
endif
LDFLAGS += $(LIBM)
ifeq ($(DEBUG), 1)
CFLAGS += -O0 -g -DDEBUG
CXXFLAGS += -O0 -g -DDEBUG
else
CFLAGS += -O3
CXXFLAGS += -O3
endif
include Makefile.common
OBJECTS := $(SOURCES_C:.c=.o) $(SOURCES_CPP:.cpp=.o)
COMPILE_PLATFORM=$(shell uname | sed -e 's/_.*//' | tr '[:upper:]' '[:lower:]' | sed -e 's/\//_/g')
COMPILE_ARCH=$(shell uname -m | sed -e 's/i.86/x86/' | sed -e 's/^arm.*/arm/')
ifeq ($(COMPILE_PLATFORM),cygwin)
PLATFORM=mingw32
endif
ifndef PLATFORM
PLATFORM=$(COMPILE_PLATFORM)
endif
export PLATFORM
ifeq ($(PLATFORM),mingw32)
MINGW=1
endif
ifeq ($(PLATFORM),mingw64)
MINGW=1
endif
ifeq ($(COMPILE_ARCH),i86pc)
COMPILE_ARCH=x86
endif
ifeq ($(COMPILE_ARCH),amd64)
COMPILE_ARCH=x86_64
endif
ifeq ($(COMPILE_ARCH),x64)
COMPILE_ARCH=x86_64
endif
ifeq ($(COMPILE_ARCH),powerpc)
COMPILE_ARCH=ppc
endif
ifeq ($(COMPILE_ARCH),powerpc64)
COMPILE_ARCH=ppc64
endif
ifeq ($(COMPILE_ARCH),axp)
COMPILE_ARCH=alpha
endif
TOPDIR ?= $(CURDIR)
CFLAGS += -Wall -D__LIBRETRO__ $(fpic) -DCORE=ON -DSDL2=ON -DBASE=ON -DUSE_FILE32API -ffast-math \
-fno-unsafe-math-optimizations -fno-strict-aliasing -fvisibility=hidden -fomit-frame-pointer \
-Wno-sign-compare -Wno-switch -Wno-format-security -I$(TOPDIR) -I$(TOPDIR)/sys/libretro/config
CXXFLAGS += -Wall -D__LIBRETRO__ $(fpic) -fpermissive -std=gnu++11
ifeq ($(D3XP),ON)
CFLAGS += -I$(TOPDIR)/d3xp
else
CFLAGS += -I$(TOPDIR)/game
endif
CFLAGS += $(INCFLAGS)
CXXFLAGS += $(INCFLAGS)
all: $(TARGET)
$(TARGET): $(OBJECTS)
ifeq ($(STATIC_LINKING), 1)
$(AR) rcs $@ $(OBJECTS)
else
@$(if $(Q), $(shell echo echo LD $@),)
$(Q)$(CXX) $(fpic) $(SHARED) -o $@ $(OBJECTS) $(LDFLAGS)
endif
%.o: %.cpp
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CXX) $(CFLAGS) $(CXXFLAGS) $(fpic) -c -o $@ $<
%.o: %.c
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) -std=gnu11 $(fpic) -c -o $@ $<
clean:
rm -f $(OBJECTS) $(TARGET)
.PHONY: clean
print-%:
@echo '$*=$($*)'
ifeq ($(LIBRETRO_COMM_DIR),)
LIBRETRO_COMM_DIR = $(CORE_DIR)/code/libretro-common
endif
SRC_RENDERER :=\
renderer/Cinematic.cpp \
renderer/GuiModel.cpp \
renderer/Image_files.cpp \
renderer/Image_init.cpp \
renderer/Image_load.cpp \
renderer/Image_process.cpp \
renderer/Image_program.cpp \
renderer/Interaction.cpp \
renderer/Material.cpp \
renderer/MegaTexture.cpp \
renderer/Model.cpp \
renderer/ModelDecal.cpp \
renderer/ModelManager.cpp \
renderer/ModelOverlay.cpp \
renderer/Model_beam.cpp \
renderer/Model_ase.cpp \
renderer/Model_liquid.cpp \
renderer/Model_lwo.cpp \
renderer/Model_ma.cpp \
renderer/Model_md3.cpp \
renderer/Model_md5.cpp \
renderer/Model_prt.cpp \
renderer/Model_sprite.cpp \
renderer/RenderEntity.cpp \
renderer/RenderSystem.cpp \
renderer/RenderSystem_init.cpp \
renderer/RenderWorld.cpp \
renderer/RenderWorld_demo.cpp \
renderer/RenderWorld_load.cpp \
renderer/RenderWorld_portals.cpp \
renderer/VertexCache.cpp \
renderer/draw_arb2.cpp \
renderer/draw_common.cpp \
renderer/tr_backend.cpp \
renderer/tr_deform.cpp \
renderer/tr_font.cpp \
renderer/tr_guisurf.cpp \
renderer/tr_light.cpp \
renderer/tr_lightrun.cpp \
renderer/tr_main.cpp \
renderer/tr_orderIndexes.cpp \
renderer/tr_polytope.cpp \
renderer/tr_render.cpp \
renderer/tr_rendertools.cpp \
renderer/tr_shadowbounds.cpp \
renderer/tr_stencilshadow.cpp \
renderer/tr_subview.cpp \
renderer/tr_trace.cpp \
renderer/tr_trisurf.cpp \
renderer/tr_turboshadow.cpp
SRC_FRAMEWORK :=\
framework/CVarSystem.cpp \